dsh-artifact-studio 0.7.2 → 0.8.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.
package/client.js CHANGED
@@ -4,48 +4,48 @@ window.__ModuleLoader__.load({
4
4
  var module = { exports: {} };
5
5
  var exports = module.exports;
6
6
  globalThis.__dshArtifactsRequireAsync = require.async;
7
- "use strict";var Rn=Object.create;var wt=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var zn=Object.getOwnPropertyNames;var Dn=Object.getPrototypeOf,Pn=Object.prototype.hasOwnProperty;var Mn=(e,t)=>{for(var a in t)wt(e,a,{get:t[a],enumerable:!0})},Va=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of zn(t))!Pn.call(e,n)&&n!==a&&wt(e,n,{get:()=>t[n],enumerable:!(r=An(t,n))||r.enumerable});return e};var Ln=(e,t,a)=>(a=e!=null?Rn(Dn(e)):{},Va(t||!e||!e.__esModule?wt(a,"default",{value:e,enumerable:!0}):a,e)),On=e=>Va(wt({},"__esModule",{value:!0}),e);var ei={};Mn(ei,{ARTIFACT_ID:()=>ct,ARTIFACT_KIND:()=>va,ArtifactCard:()=>ha,ArtifactTab:()=>ba,CARD_TOOLS:()=>sn,DocView:()=>Pt,PANEL_ID:()=>Xe,apply:()=>Jo,inject:()=>Yo});module.exports=On(ei);var on=require("@deepseek-ai/dsh-client-ui-primitives");var Fn=["page","doc","design"];function jn(e){return Fn.some(t=>t===e)}var _a={page:["html"],doc:["md","docx","html"],design:["png","svg","fig"]};var kt=/^art_(ws|lib)_[a-z0-9]{10,32}$/;var nt=["primary","accent","surface","text","muted"];function ra(e){if(e===null||typeof e!="object")return!1;let t={...e};return typeof t.pages=="number"&&typeof t.nodes=="number"&&t.types!==null&&typeof t.types=="object"&&Array.isArray(t.fonts)&&t.fonts.every(a=>typeof a=="string")&&Array.isArray(t.warnings)&&t.warnings.every(a=>typeof a=="string")}function na(e){if(e===null||typeof e!="object")return!1;let t="origin"in e?e.origin:void 0,a="action"in e?e.action:void 0;return(t==="agent"||t==="user")&&(a==="create"||a==="update"||a==="restore")}function Nt(e){if(e===null||typeof e!="object")return!1;let t={...e};return t.schemaVersion===1&&typeof t.id=="string"&&kt.test(t.id)&&(t.scope==="workspace"||t.scope==="library")&&typeof t.type=="string"&&jn(t.type)&&typeof t.title=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string"&&typeof t.version=="number"&&Number.isInteger(t.version)&&t.version>=1&&typeof t.contentFile=="string"&&typeof t.contentBytes=="number"&&typeof t.contentHash=="string"&&na(t.source)}var Tt="dsh-resource://artifact/",St="data-artifact-theme";function q(e){return e.scope==="workspace"?`${Tt}workspace/${encodeURIComponent(e.workspaceId)}/${e.id}`:`${Tt}library/${e.id}`}function Ee(e){if(typeof e!="string"||!e.startsWith(Tt))return;let t=e.slice(Tt.length).split("/");if(t[0]==="library"&&t.length===2){let a=t[1]??"";return kt.test(a)&&a.startsWith("art_lib_")?{scope:"library",id:a}:void 0}if(t[0]==="workspace"&&t.length===3){let a=t[2]??"",r;try{r=decodeURIComponent(t[1]??"")}catch{return}return r===""||!kt.test(a)||!a.startsWith("art_ws_")?void 0:{scope:"workspace",workspaceId:r,id:a}}}function Ua(e){if(kt.test(e))return e.startsWith("art_ws_")?"workspace":"library"}function $a(e){let t=[];for(let r of nt)t.push(`--artifact-color-${r}: ${e.colors[r]};`);t.push(`--artifact-font-family: ${e.typography.fontFamily};`),t.push(`--artifact-font-display: ${e.typography.displayFamily};`),t.push(`--artifact-font-mono: ${e.typography.monoFamily};`),e.typography.scale.forEach((r,n)=>t.push(`--artifact-font-size-${n}: ${r}px;`)),t.push(`--artifact-space-unit: ${e.spacing.unit}px;`),e.spacing.scale.forEach((r,n)=>t.push(`--artifact-space-${n}: ${r}px;`));for(let[r,n]of Object.entries(e.radius))t.push(`--artifact-radius-${r}: ${n}px;`);let a=nt.map(r=>`--artifact-color-${r}: ${e.colorsDark[r]};`).join(`
7
+ "use strict";var Pn=Object.create;var Tt=Object.defineProperty;var Ln=Object.getOwnPropertyDescriptor;var Mn=Object.getOwnPropertyNames;var On=Object.getPrototypeOf,jn=Object.prototype.hasOwnProperty;var Fn=(e,t)=>{for(var a in t)Tt(e,a,{get:t[a],enumerable:!0})},qa=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Mn(t))!jn.call(e,n)&&n!==a&&Tt(e,n,{get:()=>t[n],enumerable:!(r=Ln(t,n))||r.enumerable});return e};var Bn=(e,t,a)=>(a=e!=null?Pn(On(e)):{},qa(t||!e||!e.__esModule?Tt(a,"default",{value:e,enumerable:!0}):a,e)),Hn=e=>qa(Tt({},"__esModule",{value:!0}),e);var ni={};Fn(ni,{ARTIFACT_ID:()=>ut,ARTIFACT_KIND:()=>Sa,ArtifactCard:()=>Ta,ArtifactTab:()=>wa,CARD_TOOLS:()=>pn,DocView:()=>Lt,GALLERY_ID:()=>Vt,GALLERY_KIND:()=>Na,PANEL_ID:()=>Ze,apply:()=>ri,inject:()=>Jo});module.exports=Hn(ni);var dn=require("@deepseek-ai/dsh-client-ui-primitives");var Vn=["page","doc","design"];function _n(e){return Vn.some(t=>t===e)}var Ka={page:["html"],doc:["md","docx","html"],design:["png","svg","fig"]};var St=/^art_(ws|lib)_[a-z0-9]{10,32}$/;var it=["primary","accent","surface","text","muted","background","raised","border","control","action","actionText","focus","success","warning","danger"];function sa(e){if(e===null||typeof e!="object")return!1;let t={...e};return typeof t.pages=="number"&&typeof t.nodes=="number"&&t.types!==null&&typeof t.types=="object"&&Array.isArray(t.fonts)&&t.fonts.every(a=>typeof a=="string")&&Array.isArray(t.warnings)&&t.warnings.every(a=>typeof a=="string")}function la(e){if(e===null||typeof e!="object")return!1;let t="origin"in e?e.origin:void 0,a="action"in e?e.action:void 0;return(t==="agent"||t==="user")&&(a==="create"||a==="update"||a==="restore")}function It(e){if(e===null||typeof e!="object")return!1;let t={...e};return t.schemaVersion===1&&typeof t.id=="string"&&St.test(t.id)&&(t.scope==="workspace"||t.scope==="library")&&typeof t.type=="string"&&_n(t.type)&&typeof t.title=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string"&&typeof t.version=="number"&&Number.isInteger(t.version)&&t.version>=1&&typeof t.contentFile=="string"&&typeof t.contentBytes=="number"&&typeof t.contentHash=="string"&&la(t.source)}var Nt="dsh-resource://artifact/",Ct="data-artifact-theme";function K(e){return e.scope==="workspace"?`${Nt}workspace/${encodeURIComponent(e.workspaceId)}/${e.id}`:`${Nt}library/${e.id}`}function we(e){if(typeof e!="string"||!e.startsWith(Nt))return;let t=e.slice(Nt.length).split("/");if(t[0]==="library"&&t.length===2){let a=t[1]??"";return St.test(a)&&a.startsWith("art_lib_")?{scope:"library",id:a}:void 0}if(t[0]==="workspace"&&t.length===3){let a=t[2]??"",r;try{r=decodeURIComponent(t[1]??"")}catch{return}return r===""||!St.test(a)||!a.startsWith("art_ws_")?void 0:{scope:"workspace",workspaceId:r,id:a}}}function Ya(e){if(St.test(e))return e.startsWith("art_ws_")?"workspace":"library"}function ia(e){return"--artifact-color-"+e.replace(/[A-Z]/g,t=>"-"+t.toLowerCase())}function Qa(e){let t=[];for(let r of it)t.push(`${ia(r)}: ${e.colors[r]};`);t.push(`--artifact-font-family: ${e.typography.fontFamily};`),t.push(`--artifact-font-display: ${e.typography.displayFamily};`),t.push(`--artifact-font-mono: ${e.typography.monoFamily};`),e.typography.scale.forEach((r,n)=>t.push(`--artifact-font-size-${n}: ${r}px;`)),t.push(`--artifact-space-unit: ${e.spacing.unit}px;`),e.spacing.scale.forEach((r,n)=>t.push(`--artifact-space-${n}: ${r}px;`));for(let[r,n]of Object.entries(e.radius))t.push(`--artifact-radius-${r}: ${n}px;`);let a=it.map(r=>`${ia(r)}: ${e.colorsDark[r]};`).join(`
8
8
  `);return[`:root {
9
9
  ${t.join(`
10
10
  `)}
11
- }`,`:root[${St}="dark"] {
11
+ }`,`:root[${Ct}="dark"] {
12
12
  color-scheme: dark;
13
13
  ${a}
14
14
  }`,`@media (prefers-color-scheme: dark) {
15
- :root[${St}="auto"] {
15
+ :root[${Ct}="auto"] {
16
16
  color-scheme: dark;
17
17
  ${a.replace(/\n /g,`
18
18
  `)}
19
19
  }
20
20
  }`].join(`
21
- `)}function Wa(e,t){let a=t?e.colorsDark:e.colors,r={"--artifact-font-family":e.typography.fontFamily,"--artifact-font-display":e.typography.displayFamily,"--artifact-font-mono":e.typography.monoFamily};for(let n of nt)r[`--artifact-color-${n}`]=a[n];e.typography.scale.forEach((n,o)=>{r[`--artifact-font-size-${o}`]=`${n}px`}),e.spacing.scale.forEach((n,o)=>{r[`--artifact-space-${o}`]=`${n}px`});for(let[n,o]of Object.entries(e.radius))r[`--artifact-radius-${n}`]=`${o}px`;return r}var Bn="/artifacts-rpc",Fe=class extends Error{code;details;constructor(t,a,r){super(a),this.name="ArtifactCallError",this.code=t,this.details=r}},ia=null;function Ga(e){ia=e}async function ne(e,t,a,r){if(ia===null)throw new Fe("artifact/not-ready","The artifact channel is not ready.",{});let n=await ia.rpc.call(Bn,e,t,r);if(!n.ok)throw new Fe(n.error.code,n.error.message,n.error.details);if(!a(n.value))throw new Fe("artifact/bad-response",`The ${e} response has an unexpected shape.`,{});return n.value}function X(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Hn(e){return X(e)&&Array.isArray(e.items)&&e.items.every(Nt)&&typeof e.total=="number"&&typeof e.hasMore=="boolean"}function Vn(e){return X(e)&&Nt(e.manifest)&&typeof e.content=="string"&&typeof e.version=="number"&&typeof e.designCss=="string"&&qa(e.design)&&(e.designInfo===void 0||ra(e.designInfo))}function Ct(e){return X(e)&&Nt(e.manifest)}function _n(e){return X(e)&&typeof e.version=="number"&&typeof e.createdAt=="string"&&typeof e.contentHash=="string"&&typeof e.contentBytes=="number"&&na(e.source)}function Un(e){return X(e)&&Array.isArray(e.versions)&&e.versions.every(_n)}function $n(e){return X(e)&&e.trashed===!0&&typeof e.trashPath=="string"}function Wn(e){return X(e)&&typeof e.path=="string"&&typeof e.bytes=="number"&&typeof e.fileName=="string"&&typeof e.mediaType=="string"&&typeof e.data=="string"}function Gn(e){return X(e)&&typeof e.html=="string"}function qn(e){return X(e)&&typeof e.mediaType=="string"&&typeof e.data=="string"&&typeof e.width=="number"&&typeof e.height=="number"&&ra(e.info)}function qa(e){return X(e)&&e.schemaVersion===1&&typeof e.name=="string"&&X(e.colors)&&X(e.colorsDark)&&X(e.typography)&&X(e.spacing)&&X(e.radius)}function oa(e){return X(e)&&qa(e.tokens)&&(e.source==="workspace"||e.source==="library"||e.source==="default")&&typeof e.css=="string"}function se(e){return{scope:e.scope,...e.workspaceId===null?{}:{workspaceId:e.workspaceId}}}var U={list:(e,t,a)=>ne("list",{...se(e),...t},Hn,a),get:(e,t,a,r)=>ne("get",{...se(e),id:t,...a===void 0?{}:{version:a}},Vn,r),create:(e,t,a,r)=>ne("create",{...se(e),type:t,title:a,content:r},Ct),update:(e,t,a,r,n)=>ne("update",{...se(e),id:t,baseVersion:a,content:r,...n===void 0?{}:{title:n}},Ct),rename:(e,t,a,r)=>ne("update",{...se(e),id:t,baseVersion:a,title:r},Ct),remove:(e,t)=>ne("delete",{...se(e),id:t},$n),history:(e,t,a)=>ne("history",{...se(e),id:t},Un,a),restore:(e,t,a,r)=>ne("restore",{...se(e),id:t,version:a,baseVersion:r},Ct),exportFile:(e,t,a,r)=>ne("export",{...se(e),id:t,format:a,version:r},Wn),printable:(e,t,a)=>ne("printable",{...se(e),id:t,version:a},Gn),preview:(e,t,a,r)=>ne("preview",{...se(e),id:t,...a===void 0?{}:{version:a}},qn,r),designSystem:(e,t)=>ne("designSystem",e===null?{}:{workspaceId:e},oa,t),saveDesignSystem:(e,t)=>ne("saveDesignSystem",{...se(e),tokens:t},oa),clearDesignSystem:e=>ne("clearDesignSystem",{workspaceId:e,scope:"workspace"},oa)};function Z(e){return e instanceof Fe?e.code:void 0}function J(e){switch(e){case"artifact/not-found":return"error.notFound";case"artifact/stale-version":return"error.stale";case"artifact/too-large":return"error.tooLarge";case"artifact/no-workspace":return"error.noWorkspace";case"artifact/forbidden-path":return"error.forbidden";case"artifact/corrupt":return"error.corrupt";case"artifact/invalid-tokens":return"error.tokens";case"artifact/library-unavailable":return"error.library";case"artifact/design-invalid":return"error.designInvalid";case"artifact/design-icon-unsupported":return"error.designIcon";case"artifact/design-icon-not-found":return"error.designIconNotFound";case"artifact/design-render-failed":return"error.designRender";case"artifact/design-timeout":return"error.designTimeout";case"artifact/design-unavailable":return"error.designUnavailable";case"artifact/unsupported-type":return"error.unsupportedType";default:return"error.generic"}}function sa(e){if(!(!(e instanceof Fe)||!e.code.startsWith("artifact/design-")))return e.message===""?void 0:e.message}function Ka(e,t){return sa(t)??e(J(Z(t)))}function Ya(e){let t=atob(e.data),a=new Uint8Array(t.length);for(let o=0;o<t.length;o+=1)a[o]=t.charCodeAt(o);let r=URL.createObjectURL(new Blob([a],{type:e.mediaType})),n=document.createElement("a");n.href=r,n.download=e.fileName,n.rel="noopener",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}var Ke=require("react");var it=require("react");function Et(e){let t=e,a=new Set;return{get:()=>t,set(r){t=r;for(let n of a)n()},subscribe(r){return a.add(r),()=>a.delete(r)}}}var Ge=Et(new Map);function xe(e,t){if(Ge.get().get(e)===t)return;let a=new Map(Ge.get());a.set(e,t),Ge.set(a)}function Qa(e){return Ge.get().get(e)}function Xa(e){return(0,it.useSyncExternalStore)(Ge.subscribe,()=>e===void 0?void 0:Ge.get().get(e))}var ot=Et(new Map);function je(e,t){if((ot.get().get(e)??0)>=t)return;let a=new Map(ot.get());a.set(e,t),ot.set(a)}function Za(e){return(0,it.useSyncExternalStore)(ot.subscribe,()=>e===void 0?0:ot.get().get(e)??0)}var It=Et(0);function we(){It.set(It.get()+1)}function Rt(){return(0,it.useSyncExternalStore)(It.subscribe,It.get)}var qe=Et(null);function Q(e){qe.set({seq:(qe.get()?.seq??0)+1,message:e})}function Ja(){return(0,it.useSyncExternalStore)(qe.subscribe,qe.get)}function la(e){let t=qe.get();t===null||e!==void 0&&t.seq!==e||qe.set(null)}var ke=new Map,ca;function er(){ca?.();let e=t=>{[...ke.values()].some(a=>a.getSnapshot().draft!==null||a.getSnapshot().saving)&&(t.preventDefault(),t.returnValue="")};return window.addEventListener("beforeunload",e),ca=()=>window.removeEventListener("beforeunload",e),ca}var da=class{state={payload:null,draft:null,loading:!0,saving:!1,conflict:!1,revision:0};listeners=new Set;pending=null;readSequence=0;mounts=0;renameTo;where;key;address;constructor(t){this.address=t,this.key=q(t),this.where={scope:t.scope,workspaceId:t.scope==="workspace"?t.workspaceId:null}}getSnapshot=()=>this.state;subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));publish(t){this.state={...this.state,...t},this.state.draft!==null||this.state.saving?ke.set(this.key,this):this.mounts===0&&ke.get(this.key)===this&&ke.delete(this.key);for(let a of this.listeners)a()}attach(){return this.mounts+=1,ke.set(this.key,this),this.mounts===1&&(this.state.payload===null||this.state.draft===null)&&this.load(),()=>{this.mounts-=1,this.mounts===0&&this.state.draft===null&&!this.state.saving&&ke.get(this.key)===this&&ke.delete(this.key)}}async load(){let t=++this.readSequence;this.publish({loading:!0,failure:void 0,failureMessage:void 0});try{let a=await U.get(this.where,this.address.id);if(t!==this.readSequence)return;if(this.state.draft!==null&&this.state.payload!==null){this.publish({loading:!1,conflict:a.version!==this.state.payload.version});return}this.publish({payload:a,loading:!1,conflict:!1,failure:void 0,revision:this.state.revision+1}),xe(this.address.id,a.manifest.title),je(this.address.id,a.version)}catch(a){t===this.readSequence&&this.publish({loading:!1,failure:Z(a)??"artifact/storage-failure",failureMessage:void 0})}}edit(t){this.publish({draft:t,failure:void 0,failureMessage:void 0})}async discardAndReload(){this.pending!==null&&await this.pending,this.publish({draft:null,conflict:!1,failure:void 0,failureMessage:void 0}),await this.load()}externalVersion(t){this.state.payload===null||t<=this.state.payload.version||this.state.saving||(this.state.draft!==null?this.publish({conflict:!0}):this.load())}save(t){return t!==void 0&&(this.renameTo=t),this.pending!==null?this.pending:this.state.conflict||this.state.payload===null?Promise.resolve(!1):(this.pending=Promise.resolve().then(()=>this.drain()),this.pending)}async drain(){this.publish({saving:!0,failure:void 0,failureMessage:void 0});try{for(;this.state.draft!==null||this.renameTo!==void 0;){let t=this.state.payload;if(t===null||this.state.conflict)return!1;let a=this.state.draft,r=a??t.content,n=this.renameTo,{manifest:o}=await U.update(this.where,this.address.id,t.version,r,n);this.renameTo===n&&(this.renameTo=void 0),this.accept(o,r,this.state.draft===a?null:this.state.draft)}return!0}catch(t){let a=Z(t)??"artifact/storage-failure";return this.renameTo=void 0,this.publish({failure:a,failureMessage:a.startsWith("artifact/design-")?sa(t):void 0,conflict:a==="artifact/stale-version"}),!1}finally{this.pending=null,this.publish({saving:!1})}}accept(t,a,r){let n=this.state.payload;n!==null&&(++this.readSequence,this.publish({payload:{...n,manifest:t,content:a,version:t.version},draft:r,conflict:!1,loading:!1}),xe(t.id,t.title),je(t.id,t.version),we())}};function tr(e){let t=q(e),a=(0,Ke.useMemo)(()=>{let n=ke.get(t);if(n!==void 0)return n;let o=new da(e);return ke.set(t,o),o},[t]),r=(0,Ke.useSyncExternalStore)(a.subscribe,a.getSnapshot,a.getSnapshot);return(0,Ke.useEffect)(()=>a.attach(),[a]),{model:a,state:r}}var k=require("react"),h=require("@deepseek-ai/dsh-client-ui-primitives");var le=require("react"),me=require("@deepseek-ai/dsh-client-ui-primitives");var pi=require("react"),v=require("react/jsx-runtime");function K({children:e,size:t=16}){return(0,v.jsx)("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e})}var At=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,v.jsx)("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,v.jsx)("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.5"}),(0,v.jsx)("path",{d:"M17 13.5v7M13.5 17h7"})]}),fe=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,v.jsx)("path",{d:"M3.5 8.5h17M9 13l-2 1.8L9 16.5M15 13l2 1.8-2 1.7"})]}),Te=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("path",{d:"M6.5 3.5h7l4 4v13h-11z"}),(0,v.jsx)("path",{d:"M13.5 3.5v4h4M9 12h6M9 15.5h6"})]}),Be=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,v.jsx)("path",{d:"M3.5 14.5l4.5-4.5 4 4 3-3 5 5"}),(0,v.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.2"})]}),ar=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("path",{d:"M20.5 12a8.5 8.5 0 1 1-8.5-8.5c4.7 0 8.5 3.4 8.5 7.6 0 2.1-1.7 3.8-3.8 3.8h-1.4c-1 0-1.9.8-1.9 1.8 0 .8.5 1.3.5 2.1 0 1-.7 1.7-1.9 1.7Z"}),(0,v.jsx)("circle",{cx:"7.6",cy:"10",r:"1.1",fill:"currentColor",stroke:"none"}),(0,v.jsx)("circle",{cx:"10",cy:"6.8",r:"1.1",fill:"currentColor",stroke:"none"}),(0,v.jsx)("circle",{cx:"14",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),(0,v.jsx)("circle",{cx:"17",cy:"10.2",r:"1.1",fill:"currentColor",stroke:"none"})]}),rr=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M7 3v18M17 3v18M3 7h18M3 17h18"})}),nr=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M5 6h14M12 6v13"})}),or=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"3.5",y:"3.5",width:"11",height:"11",rx:"2"}),(0,v.jsx)("circle",{cx:"15.5",cy:"15.5",r:"5"})]}),ir=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"3.5",y:"3.5",width:"12",height:"12",rx:"2"}),(0,v.jsx)("path",{d:"M8.5 8.5h12v12h-12z"})]}),sr=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M5 3.5l12.5 8.2-5.7 1.2L14 19l-2.4 1-2.1-5.1L5 18.2z"})}),lr=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M8 12V5.5a1.5 1.5 0 0 1 3 0V11M11 10.5V4.5a1.5 1.5 0 0 1 3 0V11M14 10.5V6.5a1.5 1.5 0 0 1 3 0V13c0 4-2.4 7-6 7-3.3 0-4.6-1.6-6.5-5.2L3.2 11.5a1.5 1.5 0 0 1 2.5-1.6L8 12.5"})}),cr=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"4.5",y:"4.5",width:"15",height:"15",rx:"2"}),(0,v.jsx)("path",{d:"M8.5 4.5v15M15.5 4.5v15M4.5 8.5h15M4.5 15.5h15"})]}),dr=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M4.5 6.5h15M12 6.5v12"})}),pr=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M4 9.5h9.5a5.5 5.5 0 0 1 0 11H9M4 9.5l4-4M4 9.5l4 4"})}),ur=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M20 9.5h-9.5a5.5 5.5 0 0 0 0 11H15M20 9.5l-4-4M20 9.5l-4 4"})}),fr=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,v.jsx)("circle",{cx:"12",cy:"12",r:"2.6"})]}),mr=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,v.jsx)("path",{d:"M4 4l16 16"})]}),gr=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"5",y:"10.5",width:"14",height:"9.5",rx:"2"}),(0,v.jsx)("path",{d:"M8 10.5V7a4 4 0 0 1 8 0v3.5"})]}),yr=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"5",y:"10.5",width:"14",height:"9.5",rx:"2"}),(0,v.jsx)("path",{d:"M8 10.5V7a4 4 0 0 1 7.4-2"})]});var F=require("react/jsx-runtime"),zt=null;function Kn(e){return e===null||typeof e!="object"?!1:typeof{...e}.mountDesignCanvas=="function"}async function Yn(){return zt??=(async()=>{let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")throw new Error("The canvas loader is unavailable.");let t=await e("./client.canvas.js");if(!Kn(t))throw new Error("The canvas engine did not load.");return t})(),zt.catch(()=>{zt=null}),zt}var Qn=[{value:"select",label:"canvas.select",icon:(0,F.jsx)(sr,{size:16})},{value:"hand",label:"canvas.hand",icon:(0,F.jsx)(lr,{size:16})},{value:"frame",label:"canvas.frame",icon:(0,F.jsx)(cr,{size:16})},{value:"text",label:"canvas.text",icon:(0,F.jsx)(dr,{size:16})}];function br({t:e,source:t,revision:a,title:r,mode:n,onChange:o,onSave:l,onFailure:s,onHandle:g,onSelection:d,attempt:b,fallback:T}){let w=(0,le.useRef)(null),c=(0,le.useRef)(null),u=(0,le.useRef)(t),p=(0,le.useRef)({onChange:o,onSave:l,onFailure:s,onHandle:g,onSelection:d});p.current={onChange:o,onSave:l,onFailure:s,onHandle:g,onSelection:d};let[y,z]=(0,le.useState)({status:"loading"}),[N,j]=(0,le.useState)(null);(0,le.useEffect)(()=>{let C=w.current;if(C===null)return;let L=!1,B=null;return z({status:"loading"}),j(null),(async()=>{try{let I=await Yn();if(L)return;let H=await I.mountDesignCanvas({element:C,source:u.current,mode:n,onChange:V=>{u.current=V,p.current.onChange(V)},onSave:()=>p.current.onSave(),onFailure:V=>{z({status:"failed"}),p.current.onFailure(V)},t:e});if(L){H.destroy();return}c.current=H,p.current.onFailure(null),p.current.onHandle(H),z({status:"ready"});let W=H.getSnapshot();j(W),p.current.onSelection(W.selection),B=H.subscribe(V=>{j(V),p.current.onSelection(V.selection)})}catch(I){L||(z({status:"failed"}),p.current.onFailure(I instanceof Error?I.message:String(I)))}})(),()=>{L=!0,B?.(),c.current?.destroy(),c.current=null,p.current.onHandle(null)}},[b]),(0,le.useEffect)(()=>{let C=c.current;C===null||t===u.current||(u.current=t,C.setSource(t))},[a,t]),(0,le.useEffect)(()=>{c.current?.setMode(n)},[n]);let D=y.status==="ready",_=Qn.map(C=>(0,F.jsx)(me.Tooltip,{label:e(C.label),side:"top",portal:!0,children:(0,F.jsx)(me.Button,{size:"sm",className:"art-dock-button","aria-label":e(C.label),"aria-pressed":N?.tool===C.value,onClick:()=>c.current?.setTool(C.value),children:C.icon})},C.value));return(0,F.jsx)("div",{className:"art-canvas",children:(0,F.jsxs)("div",{className:"art-canvas-stage",children:[(0,F.jsx)("div",{className:"art-canvas-mount",ref:w,role:"application","aria-label":r,tabIndex:0,hidden:y.status==="failed","data-ready":D?"1":void 0}),D?null:(0,F.jsx)("div",{className:"art-canvas-fallback",children:T}),y.status==="loading"?(0,F.jsx)("div",{className:"art-canvas-opening",role:"status",children:e("canvas.opening")}):null,D&&N!==null&&N.rows.length===0?(0,F.jsx)("p",{className:"art-canvas-empty",children:e("canvas.empty")}):null,D?(0,F.jsxs)("div",{className:"art-canvas-dock",role:"toolbar","aria-label":e("canvas.toolbar"),children:[n==="edit"?(0,F.jsxs)(F.Fragment,{children:[_,(0,F.jsx)("span",{className:"art-dock-divider","aria-hidden":"true"}),(0,F.jsx)(me.Tooltip,{label:e("canvas.undo"),side:"top",portal:!0,children:(0,F.jsx)(me.Button,{size:"sm",className:"art-dock-button","aria-label":e("canvas.undo"),disabled:N?.canUndo===!1,onClick:()=>c.current?.undo(),children:(0,F.jsx)(pr,{size:16})})}),(0,F.jsx)(me.Tooltip,{label:e("canvas.redo"),side:"top",portal:!0,children:(0,F.jsx)(me.Button,{size:"sm",className:"art-dock-button","aria-label":e("canvas.redo"),disabled:N?.canRedo===!1,onClick:()=>c.current?.redo(),children:(0,F.jsx)(ur,{size:16})})}),(0,F.jsx)("span",{className:"art-dock-divider","aria-hidden":"true"})]}):null,(0,F.jsx)(me.ZoomControls,{className:"art-dock-zoom",zoom:N?.zoom??1,fit:{label:e("canvas.fit"),selected:N?.fit??!1,onSelect:()=>c.current?.zoomToFit()},labels:{controls:e("canvas.zoomControls"),out:e("canvas.zoomOut"),into:e("canvas.zoomIn"),menu:e("canvas.zoomMenu"),value:C=>e("canvas.zoomValue",{percent:C})},visible:D,onZoom:C=>c.current?.setZoom(C),onActiveChange:()=>{}})]}):null]})})}var de=require("react"),Re=require("@deepseek-ai/dsh-client-ui-primitives");var x=require("react/jsx-runtime"),Xn=["Inter","Roboto","Noto Naskh Arabic"],Zn=[400,500,600,700];function Dt(e){switch(e){case"FRAME":case"SECTION":return(0,x.jsx)(rr,{size:14});case"TEXT":return(0,x.jsx)(nr,{size:14});case"GROUP":case"COMPONENT":case"COMPONENT_SET":case"INSTANCE":return(0,x.jsx)(ir,{size:14});default:return(0,x.jsx)(or,{size:14})}}function pa(e,t){switch(t){case"FRAME":return e("layer.type.frame");case"SECTION":return e("layer.type.section");case"TEXT":return e("layer.type.text");case"RECTANGLE":return e("layer.type.rectangle");case"ELLIPSE":return e("layer.type.ellipse");case"LINE":return e("layer.type.line");case"VECTOR":case"STAR":case"POLYGON":return e("layer.type.vector");case"GROUP":return e("layer.type.group");case"COMPONENT":case"COMPONENT_SET":return e("layer.type.component");case"INSTANCE":return e("layer.type.instance");default:return e("layer.type.other")}}function Jn({t:e,label:t,value:a,mixed:r,min:n,max:o,step:l=1,onPreview:s,onCommit:g}){let[d,b]=(0,de.useState)(""),T=(0,de.useRef)(!1),w=(0,de.useRef)(0),c=(0,de.useRef)(!1),u=(0,de.useRef)(!1),p=a===null?"":String(a);(0,de.useEffect)(()=>{T.current||b(a===null?"":String(a))},[a]);let y=()=>b(a===null?"":String(a)),z=()=>{T.current=!1;let N=Number(d);if(d.trim()===""||!Number.isFinite(N)){y(),c.current&&g(w.current,w.current),c.current=!1;return}c.current&&g(N,w.current),c.current=!1};return(0,x.jsxs)("label",{className:"art-inspector-field",children:[(0,x.jsx)("span",{className:"art-inspector-field-label",children:t}),(0,x.jsx)(Re.Input,{className:"art-inspector-input","aria-label":t,type:"number",inputMode:"decimal",min:n,max:o,step:l,value:d,placeholder:r||p===""?e("panel.mixed"):void 0,onFocus:()=>{T.current=!0,w.current=a??0,c.current=!1,b(a===null?"":String(a))},onChange:N=>{let j=N.target.value;b(j);let D=Number(j);j.trim()!==""&&Number.isFinite(D)&&(c.current=!0,s(D))},onBlur:()=>{if(u.current){u.current=!1,T.current=!1,y();return}z()},onKeyDown:N=>{N.key==="Enter"?(N.preventDefault(),N.currentTarget.blur()):N.key==="Escape"&&(N.preventDefault(),y(),c.current&&g(w.current,w.current),c.current=!1,u.current=!0,N.currentTarget.blur())}})]})}function eo({t:e,handle:t,snapshot:a}){let[r,n]=(0,de.useState)(null),[o,l]=(0,de.useState)(""),s=a.rows,g=s.findIndex(c=>c.selected),d=c=>{let u=s[c];u!==void 0&&t.select(u.id,"replace")},b=c=>{l(c.name),n(c.id)},T=c=>{let u=o.trim();n(null),u!==""&&u!==c.name&&t.rename(c.id,u)},w=c=>{let u=g===-1?void 0:s[g];if(c.key==="ArrowDown"){c.preventDefault(),d(g===-1?0:Math.min(g+1,s.length-1));return}if(c.key==="ArrowUp"){c.preventDefault(),d(g===-1?s.length-1:Math.max(g-1,0));return}if(u!==void 0){if(c.key==="ArrowLeft"){if(c.preventDefault(),u.hasChildren&&u.expanded){t.toggleExpand(u.id);return}for(let p=g-1;p>=0;p-=1)if(s[p].level<u.level){t.select(s[p].id,"replace");return}return}if(c.key==="ArrowRight"){if(c.preventDefault(),u.hasChildren&&!u.expanded)t.toggleExpand(u.id);else{let p=s[g+1];p!==void 0&&p.level>u.level&&t.select(p.id,"replace")}return}c.key==="Enter"&&(c.preventDefault(),b(u))}};return s.length===0?(0,x.jsx)("p",{className:"art-inspector-empty",children:e("panel.none")}):(0,x.jsx)("div",{className:"art-layer-tree",role:"tree","aria-label":e("panel.layers"),tabIndex:0,onKeyDown:w,children:s.map(c=>(0,x.jsxs)("div",{className:"art-layer-row"+(c.selected?" is-selected":""),"data-layer-id":c.id,role:"treeitem","aria-level":c.level,"aria-selected":c.selected,"aria-expanded":c.hasChildren?c.expanded:void 0,style:{paddingInlineStart:(c.level-1)*14+6},onClick:u=>{u.shiftKey?t.select(c.id,"range"):u.metaKey||u.ctrlKey?t.select(c.id,"add"):t.select(c.id,"replace")},onDoubleClick:()=>b(c),children:[c.hasChildren?(0,x.jsx)("button",{type:"button",className:"art-layer-caret","aria-label":e(c.expanded?"panel.collapse":"panel.expand"),onClick:u=>{u.stopPropagation(),t.toggleExpand(c.id)},children:c.expanded?(0,x.jsx)(Re.IconChevronDownOutlineRegular,{size:12}):(0,x.jsx)(Re.IconChevronRightOutlineRegular,{size:12})}):(0,x.jsx)("span",{className:"art-layer-caret","aria-hidden":"true"}),(0,x.jsx)("span",{className:"art-layer-icon","aria-hidden":"true",children:Dt(c.type)}),r===c.id?(0,x.jsx)("input",{className:"art-layer-rename","aria-label":e("panel.rename"),autoFocus:!0,value:o,onChange:u=>l(u.target.value),onClick:u=>u.stopPropagation(),onBlur:()=>T(c),onKeyDown:u=>{u.key==="Enter"?(u.preventDefault(),T(c)):u.key==="Escape"&&(u.preventDefault(),n(null))}}):(0,x.jsx)("span",{className:"art-layer-name",title:c.name,children:c.name}),(0,x.jsxs)("span",{className:"art-layer-actions",children:[(0,x.jsx)("button",{type:"button",className:"art-layer-action","aria-label":e(c.visible?"panel.hide":"panel.show"),"aria-pressed":!c.visible,onClick:u=>{u.stopPropagation(),t.toggleVisibility(c.id)},children:c.visible?(0,x.jsx)(fr,{size:13}):(0,x.jsx)(mr,{size:13})}),(0,x.jsx)("button",{type:"button",className:"art-layer-action","aria-label":e(c.locked?"panel.unlock":"panel.lock"),"aria-pressed":c.locked,onClick:u=>{u.stopPropagation(),t.toggleLock(c.id)},children:c.locked?(0,x.jsx)(gr,{size:13}):(0,x.jsx)(yr,{size:13})})]})]},c.id))})}function to({t:e,handle:t,snapshot:a}){let r=a.properties;if(r.ids.length===0)return(0,x.jsx)("p",{className:"art-inspector-empty",children:e("panel.selectLayerHint")});let n=(o,l,s,g={})=>(0,x.jsx)(Jn,{t:e,label:l,value:s,mixed:s===null,...g,onPreview:d=>t.preview(o,d),onCommit:(d,b)=>t.commit(o,d,b)});return(0,x.jsxs)("div",{className:"art-inspector-properties",children:[(0,x.jsxs)("div",{className:"art-inspector-node",children:[(0,x.jsx)("span",{className:"art-inspector-node-icon","aria-hidden":"true",children:Dt(r.type??"")}),(0,x.jsx)("span",{className:"art-inspector-node-name",title:r.name??"",children:r.name}),(0,x.jsx)("span",{className:"art-inspector-node-type",children:pa(e,r.type??"")})]}),(0,x.jsxs)("section",{className:"art-inspector-group",children:[(0,x.jsx)("h3",{className:"art-inspector-heading",children:e("panel.positionSize")}),(0,x.jsxs)("div",{className:"art-inspector-grid",children:[n("x",e("panel.x"),r.x),n("y",e("panel.y"),r.y),n("width",e("panel.w"),r.width,{min:1}),n("height",e("panel.h"),r.height,{min:1}),n("rotation",e("panel.rotation"),r.rotation),n("radius",e("panel.radius"),r.radius,{min:0})]})]}),(0,x.jsxs)("section",{className:"art-inspector-group",children:[(0,x.jsx)("h3",{className:"art-inspector-heading",children:e("panel.appearance")}),(0,x.jsxs)("div",{className:"art-inspector-appearance",children:[n("opacity",e("panel.opacity"),r.opacity,{min:0,max:100}),(0,x.jsxs)("label",{className:"art-inspector-switch",children:[(0,x.jsx)("span",{className:"art-inspector-field-label",children:e("panel.visible")}),(0,x.jsx)(Re.Switch,{checked:r.visible===!0,label:e("panel.visible"),onChange:o=>t.setVisible(o)})]})]})]}),a.isText&&r.text!==null?(0,x.jsxs)("section",{className:"art-inspector-group",children:[(0,x.jsx)("h3",{className:"art-inspector-heading",children:e("panel.text")}),(0,x.jsxs)("div",{className:"art-inspector-grid",children:[(0,x.jsxs)("label",{className:"art-inspector-field",children:[(0,x.jsx)("span",{className:"art-inspector-field-label",children:e("panel.family")}),(0,x.jsx)("select",{className:"art-inspector-select","aria-label":e("panel.family"),value:r.text.family,onChange:o=>t.setFamily(o.target.value),children:Xn.map(o=>(0,x.jsx)("option",{value:o,children:o},o))})]}),(0,x.jsxs)("label",{className:"art-inspector-field",children:[(0,x.jsx)("span",{className:"art-inspector-field-label",children:e("panel.weight")}),(0,x.jsx)("select",{className:"art-inspector-select","aria-label":e("panel.weight"),value:String(r.text.weight),onChange:o=>t.setWeight(Number(o.target.value)),children:Zn.map(o=>(0,x.jsx)("option",{value:String(o),children:String(o)},o))})]}),n("fontSize",e("panel.fontSize"),r.text.fontSize,{min:1})]})]}):(0,x.jsx)("p",{className:"art-inspector-hint",children:e("panel.selectTextHint")})]})}function hr({t:e,handle:t,snapshot:a,tab:r}){return t===null||a===null?(0,x.jsx)("p",{className:"art-inspector-empty",children:e("canvas.opening")}):r==="layers"?(0,x.jsx)(eo,{t:e,handle:t,snapshot:a}):(0,x.jsx)(to,{t:e,handle:t,snapshot:a})}var st=require("react"),vr=require("@deepseek-ai/dsh-client-ui-primitives");var ie=require("react/jsx-runtime");function ua({t:e,where:t,id:a,version:r,title:n}){let[o,l]=(0,st.useState)({status:"loading"}),[s,g]=(0,st.useState)(0);if((0,st.useEffect)(()=>{let b=new AbortController;return l({status:"loading"}),U.preview(t,a,r,b.signal).then(T=>{b.signal.aborted||l({status:"ready",preview:T})}).catch(T=>{b.signal.aborted||l({status:"failed",message:Ka(e,T)})}),()=>b.abort()},[t.scope,t.workspaceId,a,r,s,e]),o.status==="loading")return(0,ie.jsx)("div",{className:"art-design-state",role:"status","aria-busy":"true",children:e("preview.loading")});if(o.status==="failed")return(0,ie.jsxs)("div",{className:"art-design-state",role:"alert",children:[(0,ie.jsx)("span",{className:"art-design-error",children:o.message}),(0,ie.jsx)(vr.Button,{size:"sm",variant:"outline",onClick:()=>g(b=>b+1),children:e("preview.retry")})]});let{preview:d}=o;return(0,ie.jsxs)("div",{className:"art-design-preview",children:[(0,ie.jsx)("div",{className:"art-design-canvas",children:(0,ie.jsx)("img",{className:"art-design-image",src:`data:${d.mediaType};base64,${d.data}`,alt:n,width:d.width,height:d.height})}),d.info.warnings.length===0?null:(0,ie.jsxs)("div",{className:"art-design-warnings",role:"note",children:[(0,ie.jsx)("span",{className:"art-design-warnings-title",children:e("preview.warnings")}),(0,ie.jsx)("ul",{children:d.info.warnings.map(b=>(0,ie.jsx)("li",{children:b},b))})]})]})}var $=require("react"),xr=require("@deepseek-ai/dsh-client-ui-primitives");var ge=require("react/jsx-runtime"),lt=null;function ao(){if(lt===null){let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")return Promise.reject(new Error("The document editor loader is unavailable."));lt=e("./client.doc.js"),lt.catch(()=>{lt=null})}return lt}var ro=["heading","bold","italic","bulletList","orderedList","codeBlock"];function no(e){let t=window.getSelection(),a=e.getBoundingClientRect(),n=(t!==null&&t.rangeCount>0?t.getRangeAt(0):null)?.getBoundingClientRect();if(n===void 0||n.width===0&&n.height===0)return{top:e.scrollTop+8,left:16};let o=Math.min(Math.max(n.left-a.left+n.width/2,120),Math.max(a.width-120,120));return{top:Math.max(n.top-a.top+e.scrollTop-46,e.scrollTop+4),left:o}}function Pt({markdown:e,revision:t,editable:a,label:r,loadingLabel:n,failedLabel:o,onChange:l,onSave:s,onSelectionText:g,t:d,design:b,dark:T=!1,selectionAction:w}){let c=(0,$.useRef)(null),u=(0,$.useRef)(null),p=(0,$.useRef)(null),y=(0,$.useRef)(l);y.current=l;let z=(0,$.useRef)(g);z.current=g;let N=(0,$.useRef)({markdown:e,editable:a,label:r});N.current={markdown:e,editable:a,label:r};let[j,D]=(0,$.useState)([]),[_,C]=(0,$.useState)("loading"),[L,B]=(0,$.useState)(null),I=(0,$.useRef)(null);(0,$.useLayoutEffect)(()=>{let R=I.current,S=c.current;if(R===null||S===null||L===null)return;let G=R.offsetWidth/2,ae=S.clientWidth,Me=G*2+16>=ae?ae/2:Math.min(Math.max(L.left,G+8),ae-G-8);R.style.left=Me+"px"});let H=(0,$.useMemo)(()=>b===void 0?{}:{...Wa(b,T),colorScheme:T?"dark":"light"},[b,T]),W=R=>{z.current?.(R);let S=c.current;B(R===""||S===null?null:no(S))},V=(0,$.useRef)(W);V.current=W,(0,$.useEffect)(()=>{let R=!1;return ao().then(S=>{R||u.current===null||(p.current=S.mountDocEditor({element:u.current,...N.current,onChange:G=>y.current(G),onSelectionChange:D,onSelectionText:G=>V.current(G)}),C("ready"))}).catch(()=>{R||C("failed")}),()=>{R=!0,p.current?.destroy(),p.current=null}},[]),(0,$.useEffect)(()=>{let R=p.current;R!==null&&R.getMarkdown()!==e&&R.setMarkdown(e)},[t,e]),(0,$.useEffect)(()=>{p.current?.setEditable(a)},[a]),(0,$.useEffect)(()=>{let R=()=>{let S=p.current,G=c.current,ae=window.getSelection();S===null||G===null||ae!==null&&ae.anchorNode!==null&&!G.contains(ae.anchorNode)||V.current(S.getSelectionText())};return document.addEventListener("selectionchange",R),()=>document.removeEventListener("selectionchange",R)},[]);let Pe=L!==null&&d!==void 0&&(a||w!=null);return(0,ge.jsxs)("div",{className:"art-doc",ref:c,"data-doc-revision":t,onKeyDown:R=>{(R.ctrlKey||R.metaKey)&&R.key.toLowerCase()==="s"&&(R.preventDefault(),s()),R.key==="Escape"&&L!==null&&B(null)},children:[Pe?(0,ge.jsxs)("div",{ref:I,className:"art-doc-toolbar",role:"toolbar","aria-label":d("format.toolbar"),style:{top:L.top,left:L.left},children:[a?ro.map(R=>(0,ge.jsx)(xr.Button,{size:"sm",variant:"ghost","aria-pressed":j.includes(R),disabled:_!=="ready",onMouseDown:S=>S.preventDefault(),onClick:()=>p.current?.format(R),children:d(`format.${R}`)},R)):null,a&&w!=null?(0,ge.jsx)("span",{className:"art-doc-toolbar-gap","aria-hidden":"true"}):null,w]}):null,_==="loading"?(0,ge.jsx)("p",{className:"art-note",children:n}):null,_==="failed"?(0,ge.jsx)("p",{className:"art-note",children:o}):null,(0,ge.jsx)("div",{className:"art-docpage",style:H,children:(0,ge.jsx)("div",{className:"art-doc-mount",ref:u})})]})}function oo(e){return/<meta\b[^>]*name\s*=\s*["']?color-scheme["']?[^>]*content\s*=\s*["'][^"']*\bdark\b/i.test(e)||/<meta\b[^>]*content\s*=\s*["'][^"']*\bdark\b[^"']*["'][^>]*name\s*=\s*["']?color-scheme/i.test(e)}var kr="default-src 'none'; img-src data: blob:; media-src data: blob:; style-src 'unsafe-inline'; script-src 'unsafe-inline' 'unsafe-eval'; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'",Tr=["body, .art-docpage { color: var(--artifact-color-text); font-family: var(--artifact-font-family); font-size: 16px; line-height: 1.65; }","h1, h2, h3, h4 { font-family: var(--artifact-font-display); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; margin: 1.8em 0 0.5em; color: var(--artifact-color-text); text-wrap: balance; }","h1 { font-size: 2.1em; margin-top: 0; }","h2 { font-size: 1.45em; }","h3 { font-size: 1.15em; }","p, ul, ol, blockquote, table, pre { margin: 0 0 1em; }","a { color: var(--artifact-color-primary); text-underline-offset: 2px; }","strong { font-weight: 650; }","code { font-family: var(--artifact-font-mono); font-size: 0.88em; padding: 0.1em 0.35em; border-radius: var(--artifact-radius-sm); background: color-mix(in srgb, var(--artifact-color-text) 7%, transparent); }","pre { font-family: var(--artifact-font-mono); font-size: 0.86em; line-height: 1.55; padding: 14px 16px; border-radius: var(--artifact-radius-md); background: color-mix(in srgb, var(--artifact-color-text) 6%, transparent); overflow: auto; }","pre code { padding: 0; background: none; font-size: 1em; }","blockquote { padding: 0 0 0 16px; border-left: 3px solid var(--artifact-color-accent); color: var(--artifact-color-muted); }","ul, ol { padding-left: 1.4em; }","li + li { margin-top: 0.25em; }","table { border-collapse: collapse; width: 100%; font-size: 0.94em; font-variant-numeric: tabular-nums; }","th, td { padding: 8px 10px; border-bottom: 1px solid color-mix(in srgb, var(--artifact-color-text) 14%, transparent); text-align: left; vertical-align: top; }","th { font-weight: 600; color: var(--artifact-color-muted); border-bottom-color: color-mix(in srgb, var(--artifact-color-text) 28%, transparent); }","hr { border: none; border-top: 1px solid color-mix(in srgb, var(--artifact-color-text) 14%, transparent); margin: 2em 0; }"].join(`
22
- `);var fa="<script>addEventListener('message',function(e){if(e.source!==parent||e.data!=='dsh-artifact-print')return;addEventListener('afterprint',function(){parent.postMessage('dsh-artifact-printed','*')},{once:true});print()})<\/script>";function wr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function io(e){return e.replace(/<meta\b[^>]*http-equiv\s*=\s*["']?refresh["']?[^>]*>/gi,"").replace(/<meta\b[^>]*content\s*=\s*["'][^"']*url\s*=[^>]*>/gi,"")}function Sr(e,t,a,r,n="",o="auto"){let l='<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">'+(a===null?"":`<meta http-equiv="Content-Security-Policy" content="${wr(a)}">`)+`<title>${wr(r)}</title><style data-artifact-tokens>${t}</style>`+n;return`<!doctype html><html${oo(e)?` ${St}="${o}"`:""}><head>${l}</head><body>${io(e)}</body></html>`}var Nr="allow-scripts",so="allow-scripts allow-modals",lo=3e4,co="<script>(function(){var t;document.addEventListener('selectionchange',function(){clearTimeout(t);t=setTimeout(function(){var s=String(getSelection()||'');parent.postMessage({dshArtifactSelection:s.slice(0,4000)},'*')},150)})})()<\/script>",po=4e3;function Mt(e,t,a,r="auto",n=!1){return Sr(e,t,kr,a,n?co:"",r)}function Cr(e){if(e===null||typeof e!="object")return;let t={...e};return typeof t.dshArtifactSelection=="string"?t.dshArtifactSelection.slice(0,po):void 0}function Ir(e){let t=/<\/head>/i.test(e)?e.replace(/<\/head>/i,`${fa}</head>`):`${fa}${e}`,a=URL.createObjectURL(new Blob([t],{type:"text/html"})),r=document.createElement("iframe");r.setAttribute("sandbox",so),r.setAttribute("aria-hidden","true"),r.tabIndex=-1,r.style.cssText="position:fixed;left:-10000px;top:0;width:800px;height:1000px;border:0;";let n=!1,o=()=>{n||(n=!0,clearTimeout(s),window.removeEventListener("message",l),r.remove(),URL.revokeObjectURL(a))},l=g=>{g.source===r.contentWindow&&g.data==="dsh-artifact-printed"&&o()};window.addEventListener("message",l);let s=setTimeout(o,lo);r.addEventListener("load",()=>{r.contentWindow?.postMessage("dsh-artifact-print","*")},{once:!0}),r.src=a,document.body.appendChild(r)}var Er={"agent.ask":"Edit with agent","agent.reference":'In artifact "{title}" ({id}, v{version}):',"agent.referenceOld":'In artifact "{title}" ({id}, v{version}, the current version is v{current}):',"agent.added":"Added to your message. Describe the change, then send.","agent.addedTruncated":"Added to your message. The selection was shortened to 2,000 characters.","agent.insertFailed":"The message box is busy, so the request was copied instead.","agent.copied":"Copied. Paste it into a conversation, then send.","agent.copyTitle":"Copy the request","card.creating":"Creating {title}","card.updating":"Updating {title}","card.updatingUntitled":"Updating the artifact","card.openNamed":"Open {title}","tab.codeHint":"Read-only code. Select text to ask the agent about it.","tab.editSource":"Edit code","tab.deleteTitle":"Move to trash?","code.copy":"Copy code","dialog.close":"Close","dialog.done":"Done","design.colorsDark":"Dark colors","panel.layers":"Layers","panel.properties":"Properties","panel.none":"No layers","panel.mixed":"Mixed","panel.expand":"Expand","panel.collapse":"Collapse","panel.show":"Show","panel.hide":"Hide","panel.lock":"Lock","panel.unlock":"Unlock","panel.rename":"Rename layer","panel.x":"X","panel.y":"Y","panel.rotation":"Rotate","panel.radius":"Radius","panel.opacity":"Opacity","panel.visible":"Visible","panel.hidden":"Hidden","panel.family":"Font family","panel.weight":"Weight","panel.fontSize":"Size","panel.w":"W","panel.h":"H","panel.positionSize":"Position and size","panel.appearance":"Appearance","panel.text":"Text","panel.selectLayerHint":"Select a layer to see its properties.","panel.selectTextHint":"Select a text layer to change its font, weight, and size.","layer.parentLine":"{type} in {parent}","layer.type.frame":"Frame","layer.type.section":"Section","layer.type.text":"Text","layer.type.rectangle":"Rectangle","layer.type.ellipse":"Ellipse","layer.type.line":"Line","layer.type.vector":"Vector","layer.type.group":"Group","layer.type.component":"Component","layer.type.instance":"Instance","layer.type.other":"Layer","canvas.viewMode":"View","canvas.editMode":"Edit","canvas.opening":"Opening the canvas\u2026","canvas.startFailed":"The canvas did not start. Showing the saved image.","canvas.empty":"This mockup has no layers yet. Switch to Edit to draw one.","canvas.zoomControls":"Zoom","canvas.zoomOut":"Zoom out","canvas.zoomIn":"Zoom in","canvas.zoomMenu":"Zoom level","canvas.zoomValue":"{percent}%","canvas.inspector":"Inspector","canvas.closeInspector":"Close inspector","canvas.inspectorTabs":"Inspector sections","canvas.editOldVersion":"Old versions open in View only. Restore this version to edit.","agent.quoteDesign":`Layer "{name}"
21
+ `)}function Xa(e,t){let a=t?e.colorsDark:e.colors,r={"--artifact-font-family":e.typography.fontFamily,"--artifact-font-display":e.typography.displayFamily,"--artifact-font-mono":e.typography.monoFamily};for(let n of it)r[ia(n)]=a[n];e.typography.scale.forEach((n,o)=>{r[`--artifact-font-size-${o}`]=`${n}px`}),e.spacing.scale.forEach((n,o)=>{r[`--artifact-space-${o}`]=`${n}px`});for(let[n,o]of Object.entries(e.radius))r[`--artifact-radius-${n}`]=`${o}px`;return r}var Un="/artifacts-rpc",je=class extends Error{code;details;constructor(t,a,r){super(a),this.name="ArtifactCallError",this.code=t,this.details=r}},da=null;function Za(e){da=e}async function oe(e,t,a,r){if(da===null)throw new je("artifact/not-ready","The artifact channel is not ready.",{});let n=await da.rpc.call(Un,e,t,r);if(!n.ok)throw new je(n.error.code,n.error.message,n.error.details);if(!a(n.value))throw new je("artifact/bad-response",`The ${e} response has an unexpected shape.`,{});return n.value}function J(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Wn(e){return J(e)&&Array.isArray(e.items)&&e.items.every(It)&&typeof e.total=="number"&&typeof e.hasMore=="boolean"}function Gn(e){return J(e)&&It(e.manifest)&&typeof e.content=="string"&&typeof e.version=="number"&&typeof e.designCss=="string"&&Ja(e.design)&&(e.designInfo===void 0||sa(e.designInfo))}function At(e){return J(e)&&It(e.manifest)}function $n(e){return J(e)&&typeof e.version=="number"&&typeof e.createdAt=="string"&&typeof e.contentHash=="string"&&typeof e.contentBytes=="number"&&la(e.source)}function qn(e){return J(e)&&Array.isArray(e.versions)&&e.versions.every($n)}function Kn(e){return J(e)&&e.trashed===!0&&typeof e.trashPath=="string"}function Yn(e){return J(e)&&typeof e.path=="string"&&typeof e.bytes=="number"&&typeof e.fileName=="string"&&typeof e.mediaType=="string"&&typeof e.data=="string"}function Qn(e){return J(e)&&typeof e.html=="string"}function Xn(e){return J(e)&&typeof e.mediaType=="string"&&typeof e.data=="string"&&typeof e.width=="number"&&typeof e.height=="number"&&sa(e.info)}function Ja(e){return J(e)&&e.schemaVersion===1&&typeof e.name=="string"&&J(e.colors)&&J(e.colorsDark)&&J(e.typography)&&J(e.spacing)&&J(e.radius)}function ca(e){return J(e)&&Ja(e.tokens)&&(e.source==="workspace"||e.source==="library"||e.source==="default")&&typeof e.css=="string"}function le(e){return{scope:e.scope,...e.workspaceId===null?{}:{workspaceId:e.workspaceId}}}var U={list:(e,t,a)=>oe("list",{...le(e),...t},Wn,a),get:(e,t,a,r)=>oe("get",{...le(e),id:t,...a===void 0?{}:{version:a}},Gn,r),create:(e,t,a,r)=>oe("create",{...le(e),type:t,title:a,content:r},At),update:(e,t,a,r,n)=>oe("update",{...le(e),id:t,baseVersion:a,content:r,...n===void 0?{}:{title:n}},At),rename:(e,t,a,r)=>oe("update",{...le(e),id:t,baseVersion:a,title:r},At),remove:(e,t)=>oe("delete",{...le(e),id:t},Kn),history:(e,t,a)=>oe("history",{...le(e),id:t},qn,a),restore:(e,t,a,r)=>oe("restore",{...le(e),id:t,version:a,baseVersion:r},At),exportFile:(e,t,a,r)=>oe("export",{...le(e),id:t,format:a,version:r},Yn),printable:(e,t,a)=>oe("printable",{...le(e),id:t,version:a},Qn),preview:(e,t,a,r)=>oe("preview",{...le(e),id:t,...a===void 0?{}:{version:a}},Xn,r),designSystem:(e,t)=>oe("designSystem",e===null?{}:{workspaceId:e},ca,t),saveDesignSystem:(e,t)=>oe("saveDesignSystem",{...le(e),tokens:t},ca),clearDesignSystem:e=>oe("clearDesignSystem",{workspaceId:e,scope:"workspace"},ca)};function ee(e){return e instanceof je?e.code:void 0}function te(e){switch(e){case"artifact/not-found":return"error.notFound";case"artifact/stale-version":return"error.stale";case"artifact/too-large":return"error.tooLarge";case"artifact/no-workspace":return"error.noWorkspace";case"artifact/forbidden-path":return"error.forbidden";case"artifact/corrupt":return"error.corrupt";case"artifact/invalid-tokens":return"error.tokens";case"artifact/library-unavailable":return"error.library";case"artifact/design-invalid":return"error.designInvalid";case"artifact/design-icon-unsupported":return"error.designIcon";case"artifact/design-icon-not-found":return"error.designIconNotFound";case"artifact/design-render-failed":return"error.designRender";case"artifact/design-timeout":return"error.designTimeout";case"artifact/design-unavailable":return"error.designUnavailable";case"artifact/unsupported-type":return"error.unsupportedType";default:return"error.generic"}}function pa(e){if(!(!(e instanceof je)||!e.code.startsWith("artifact/design-")))return e.message===""?void 0:e.message}function er(e,t){return pa(t)??e(te(ee(t)))}function tr(e){let t=atob(e.data),a=new Uint8Array(t.length);for(let o=0;o<t.length;o+=1)a[o]=t.charCodeAt(o);let r=URL.createObjectURL(new Blob([a],{type:e.mediaType})),n=document.createElement("a");n.href=r,n.download=e.fileName,n.rel="noopener",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}var Ye=require("react");var lt=require("react");function Rt(e){let t=e,a=new Set;return{get:()=>t,set(r){t=r;for(let n of a)n()},subscribe(r){return a.add(r),()=>a.delete(r)}}}var qe=Rt(new Map);function ke(e,t){if(qe.get().get(e)===t)return;let a=new Map(qe.get());a.set(e,t),qe.set(a)}function ar(e){return qe.get().get(e)}function rr(e){return(0,lt.useSyncExternalStore)(qe.subscribe,()=>e===void 0?void 0:qe.get().get(e))}var st=Rt(new Map);function Fe(e,t){if((st.get().get(e)??0)>=t)return;let a=new Map(st.get());a.set(e,t),st.set(a)}function nr(e){return(0,lt.useSyncExternalStore)(st.subscribe,()=>e===void 0?0:st.get().get(e)??0)}var Et=Rt(0);function Te(){Et.set(Et.get()+1)}function Dt(){return(0,lt.useSyncExternalStore)(Et.subscribe,Et.get)}var Ke=Rt(null);function Z(e){Ke.set({seq:(Ke.get()?.seq??0)+1,message:e})}function or(){return(0,lt.useSyncExternalStore)(Ke.subscribe,Ke.get)}function ua(e){let t=Ke.get();t===null||e!==void 0&&t.seq!==e||Ke.set(null)}var Se=new Map,fa;function ir(){fa?.();let e=t=>{[...Se.values()].some(a=>a.getSnapshot().draft!==null||a.getSnapshot().saving)&&(t.preventDefault(),t.returnValue="")};return window.addEventListener("beforeunload",e),fa=()=>window.removeEventListener("beforeunload",e),fa}var ga=class{state={payload:null,draft:null,loading:!0,saving:!1,conflict:!1,revision:0};listeners=new Set;pending=null;readSequence=0;mounts=0;renameTo;where;key;address;constructor(t){this.address=t,this.key=K(t),this.where={scope:t.scope,workspaceId:t.scope==="workspace"?t.workspaceId:null}}getSnapshot=()=>this.state;subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));publish(t){this.state={...this.state,...t},this.state.draft!==null||this.state.saving?Se.set(this.key,this):this.mounts===0&&Se.get(this.key)===this&&Se.delete(this.key);for(let a of this.listeners)a()}attach(){return this.mounts+=1,Se.set(this.key,this),this.mounts===1&&(this.state.payload===null||this.state.draft===null)&&this.load(),()=>{this.mounts-=1,this.mounts===0&&this.state.draft===null&&!this.state.saving&&Se.get(this.key)===this&&Se.delete(this.key)}}async load(){let t=++this.readSequence;this.publish({loading:!0,failure:void 0,failureMessage:void 0});try{let a=await U.get(this.where,this.address.id);if(t!==this.readSequence)return;if(this.state.draft!==null&&this.state.payload!==null){this.publish({loading:!1,conflict:a.version!==this.state.payload.version});return}this.publish({payload:a,loading:!1,conflict:!1,failure:void 0,revision:this.state.revision+1}),ke(this.address.id,a.manifest.title),Fe(this.address.id,a.version)}catch(a){t===this.readSequence&&this.publish({loading:!1,failure:ee(a)??"artifact/storage-failure",failureMessage:void 0})}}edit(t){this.publish({draft:t,failure:void 0,failureMessage:void 0})}async discardAndReload(){this.pending!==null&&await this.pending,this.publish({draft:null,conflict:!1,failure:void 0,failureMessage:void 0}),await this.load()}externalVersion(t){this.state.payload===null||t<=this.state.payload.version||this.state.saving||(this.state.draft!==null?this.publish({conflict:!0}):this.load())}save(t){return t!==void 0&&(this.renameTo=t),this.pending!==null?this.pending:this.state.conflict||this.state.payload===null?Promise.resolve(!1):(this.pending=Promise.resolve().then(()=>this.drain()),this.pending)}async drain(){this.publish({saving:!0,failure:void 0,failureMessage:void 0});try{for(;this.state.draft!==null||this.renameTo!==void 0;){let t=this.state.payload;if(t===null||this.state.conflict)return!1;let a=this.state.draft,r=a??t.content,n=this.renameTo,{manifest:o}=await U.update(this.where,this.address.id,t.version,r,n);this.renameTo===n&&(this.renameTo=void 0),this.accept(o,r,this.state.draft===a?null:this.state.draft)}return!0}catch(t){let a=ee(t)??"artifact/storage-failure";return this.renameTo=void 0,this.publish({failure:a,failureMessage:a.startsWith("artifact/design-")?pa(t):void 0,conflict:a==="artifact/stale-version"}),!1}finally{this.pending=null,this.publish({saving:!1})}}accept(t,a,r){let n=this.state.payload;n!==null&&(++this.readSequence,this.publish({payload:{...n,manifest:t,content:a,version:t.version},draft:r,conflict:!1,loading:!1}),ke(t.id,t.title),Fe(t.id,t.version),Te())}};function sr(e){let t=K(e),a=(0,Ye.useMemo)(()=>{let n=Se.get(t);if(n!==void 0)return n;let o=new ga(e);return Se.set(t,o),o},[t]),r=(0,Ye.useSyncExternalStore)(a.subscribe,a.getSnapshot,a.getSnapshot);return(0,Ye.useEffect)(()=>a.attach(),[a]),{model:a,state:r}}var T=require("react"),b=require("@deepseek-ai/dsh-client-ui-primitives");var ce=require("react"),me=require("@deepseek-ai/dsh-client-ui-primitives");var mi=require("react"),w=require("react/jsx-runtime");function Y({children:e,size:t=16}){return(0,w.jsx)("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e})}var ct=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,w.jsx)("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,w.jsx)("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.5"}),(0,w.jsx)("path",{d:"M17 13.5v7M13.5 17h7"})]}),ge=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,w.jsx)("path",{d:"M3.5 8.5h17M9 13l-2 1.8L9 16.5M15 13l2 1.8-2 1.7"})]}),Ne=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("path",{d:"M6.5 3.5h7l4 4v13h-11z"}),(0,w.jsx)("path",{d:"M13.5 3.5v4h4M9 12h6M9 15.5h6"})]}),Be=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,w.jsx)("path",{d:"M3.5 14.5l4.5-4.5 4 4 3-3 5 5"}),(0,w.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.2"})]}),lr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("path",{d:"M20.5 12a8.5 8.5 0 1 1-8.5-8.5c4.7 0 8.5 3.4 8.5 7.6 0 2.1-1.7 3.8-3.8 3.8h-1.4c-1 0-1.9.8-1.9 1.8 0 .8.5 1.3.5 2.1 0 1-.7 1.7-1.9 1.7Z"}),(0,w.jsx)("circle",{cx:"7.6",cy:"10",r:"1.1",fill:"currentColor",stroke:"none"}),(0,w.jsx)("circle",{cx:"10",cy:"6.8",r:"1.1",fill:"currentColor",stroke:"none"}),(0,w.jsx)("circle",{cx:"14",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),(0,w.jsx)("circle",{cx:"17",cy:"10.2",r:"1.1",fill:"currentColor",stroke:"none"})]}),cr=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M7 3v18M17 3v18M3 7h18M3 17h18"})}),dr=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M5 6h14M12 6v13"})}),pr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"3.5",y:"3.5",width:"11",height:"11",rx:"2"}),(0,w.jsx)("circle",{cx:"15.5",cy:"15.5",r:"5"})]}),ur=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"3.5",y:"3.5",width:"12",height:"12",rx:"2"}),(0,w.jsx)("path",{d:"M8.5 8.5h12v12h-12z"})]}),fr=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M5 3.5l12.5 8.2-5.7 1.2L14 19l-2.4 1-2.1-5.1L5 18.2z"})}),gr=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M8 12V5.5a1.5 1.5 0 0 1 3 0V11M11 10.5V4.5a1.5 1.5 0 0 1 3 0V11M14 10.5V6.5a1.5 1.5 0 0 1 3 0V13c0 4-2.4 7-6 7-3.3 0-4.6-1.6-6.5-5.2L3.2 11.5a1.5 1.5 0 0 1 2.5-1.6L8 12.5"})}),mr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"4.5",y:"4.5",width:"15",height:"15",rx:"2"}),(0,w.jsx)("path",{d:"M8.5 4.5v15M15.5 4.5v15M4.5 8.5h15M4.5 15.5h15"})]}),yr=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M4.5 6.5h15M12 6.5v12"})}),br=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M4 9.5h9.5a5.5 5.5 0 0 1 0 11H9M4 9.5l4-4M4 9.5l4 4"})}),hr=({size:e})=>(0,w.jsx)(Y,{size:e,children:(0,w.jsx)("path",{d:"M20 9.5h-9.5a5.5 5.5 0 0 0 0 11H15M20 9.5l-4-4M20 9.5l-4 4"})}),vr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,w.jsx)("circle",{cx:"12",cy:"12",r:"2.6"})]}),xr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,w.jsx)("path",{d:"M4 4l16 16"})]}),wr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"5",y:"10.5",width:"14",height:"9.5",rx:"2"}),(0,w.jsx)("path",{d:"M8 10.5V7a4 4 0 0 1 8 0v3.5"})]}),kr=({size:e})=>(0,w.jsxs)(Y,{size:e,children:[(0,w.jsx)("rect",{x:"5",y:"10.5",width:"14",height:"9.5",rx:"2"}),(0,w.jsx)("path",{d:"M8 10.5V7a4 4 0 0 1 7.4-2"})]});var B=require("react/jsx-runtime"),zt=null;function Zn(e){return e===null||typeof e!="object"?!1:typeof{...e}.mountDesignCanvas=="function"}async function Jn(){return zt??=(async()=>{let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")throw new Error("The canvas loader is unavailable.");let t=await e("./client.canvas.js");if(!Zn(t))throw new Error("The canvas engine did not load.");return t})(),zt.catch(()=>{zt=null}),zt}var eo=[{value:"select",label:"canvas.select",icon:(0,B.jsx)(fr,{size:16})},{value:"hand",label:"canvas.hand",icon:(0,B.jsx)(gr,{size:16})},{value:"frame",label:"canvas.frame",icon:(0,B.jsx)(mr,{size:16})},{value:"text",label:"canvas.text",icon:(0,B.jsx)(yr,{size:16})}];function Tr({t:e,source:t,revision:a,title:r,mode:n,onChange:o,onSave:l,onFailure:s,onHandle:y,onSelection:c,attempt:h,fallback:v}){let x=(0,ce.useRef)(null),d=(0,ce.useRef)(null),p=(0,ce.useRef)(t),u=(0,ce.useRef)({onChange:o,onSave:l,onFailure:s,onHandle:y,onSelection:c});u.current={onChange:o,onSave:l,onFailure:s,onHandle:y,onSelection:c};let[m,L]=(0,ce.useState)({status:"loading"}),[S,V]=(0,ce.useState)(null);(0,ce.useEffect)(()=>{let C=x.current;if(C===null)return;let F=!1,_=null;return L({status:"loading"}),V(null),(async()=>{try{let P=await Jn();if(F)return;let A=await P.mountDesignCanvas({element:C,source:p.current,mode:n,onChange:O=>{p.current=O,u.current.onChange(O)},onSave:()=>u.current.onSave(),onFailure:O=>{L({status:"failed"}),u.current.onFailure(O)},t:e});if(F){A.destroy();return}d.current=A,u.current.onFailure(null),u.current.onHandle(A),L({status:"ready"});let $=A.getSnapshot();V($),u.current.onSelection($.selection),_=A.subscribe(O=>{V(O),u.current.onSelection(O.selection)})}catch(P){F||(L({status:"failed"}),u.current.onFailure(P instanceof Error?P.message:String(P)))}})(),()=>{F=!0,_?.(),d.current?.destroy(),d.current=null,u.current.onHandle(null)}},[h]),(0,ce.useEffect)(()=>{let C=d.current;C===null||t===p.current||(p.current=t,C.setSource(t))},[a,t]),(0,ce.useEffect)(()=>{d.current?.setMode(n)},[n]);let D=m.status==="ready",H=eo.map(C=>(0,B.jsx)(me.Tooltip,{label:e(C.label),side:"top",portal:!0,children:(0,B.jsx)(me.Button,{size:"sm",className:"art-dock-button","aria-label":e(C.label),"aria-pressed":S?.tool===C.value,onClick:()=>d.current?.setTool(C.value),children:C.icon})},C.value));return(0,B.jsx)("div",{className:"art-canvas",children:(0,B.jsxs)("div",{className:"art-canvas-stage",children:[(0,B.jsx)("div",{className:"art-canvas-mount",ref:x,role:"application","aria-label":r,tabIndex:0,hidden:m.status==="failed","data-ready":D?"1":void 0}),D?null:(0,B.jsx)("div",{className:"art-canvas-fallback",children:v}),m.status==="loading"?(0,B.jsx)("div",{className:"art-canvas-opening",role:"status",children:e("canvas.opening")}):null,D&&S!==null&&S.rows.length===0?(0,B.jsx)("p",{className:"art-canvas-empty",children:e("canvas.empty")}):null,D?(0,B.jsxs)("div",{className:"art-canvas-dock",role:"toolbar","aria-label":e("canvas.toolbar"),children:[n==="edit"?(0,B.jsxs)(B.Fragment,{children:[H,(0,B.jsx)("span",{className:"art-dock-divider","aria-hidden":"true"}),(0,B.jsx)(me.Tooltip,{label:e("canvas.undo"),side:"top",portal:!0,children:(0,B.jsx)(me.Button,{size:"sm",className:"art-dock-button","aria-label":e("canvas.undo"),disabled:S?.canUndo===!1,onClick:()=>d.current?.undo(),children:(0,B.jsx)(br,{size:16})})}),(0,B.jsx)(me.Tooltip,{label:e("canvas.redo"),side:"top",portal:!0,children:(0,B.jsx)(me.Button,{size:"sm",className:"art-dock-button","aria-label":e("canvas.redo"),disabled:S?.canRedo===!1,onClick:()=>d.current?.redo(),children:(0,B.jsx)(hr,{size:16})})}),(0,B.jsx)("span",{className:"art-dock-divider","aria-hidden":"true"})]}):null,(0,B.jsx)(me.ZoomControls,{className:"art-dock-zoom",zoom:S?.zoom??1,fit:{label:e("canvas.fit"),selected:S?.fit??!1,onSelect:()=>d.current?.zoomToFit()},labels:{controls:e("canvas.zoomControls"),out:e("canvas.zoomOut"),into:e("canvas.zoomIn"),menu:e("canvas.zoomMenu"),value:C=>e("canvas.zoomValue",{percent:C})},visible:D,onZoom:C=>d.current?.setZoom(C),onActiveChange:()=>{}})]}):null]})})}var pe=require("react"),De=require("@deepseek-ai/dsh-client-ui-primitives");var k=require("react/jsx-runtime"),to=["Inter","Roboto","Noto Naskh Arabic"],ao=[400,500,600,700];function Pt(e){switch(e){case"FRAME":case"SECTION":return(0,k.jsx)(cr,{size:14});case"TEXT":return(0,k.jsx)(dr,{size:14});case"GROUP":case"COMPONENT":case"COMPONENT_SET":case"INSTANCE":return(0,k.jsx)(ur,{size:14});default:return(0,k.jsx)(pr,{size:14})}}function ma(e,t){switch(t){case"FRAME":return e("layer.type.frame");case"SECTION":return e("layer.type.section");case"TEXT":return e("layer.type.text");case"RECTANGLE":return e("layer.type.rectangle");case"ELLIPSE":return e("layer.type.ellipse");case"LINE":return e("layer.type.line");case"VECTOR":case"STAR":case"POLYGON":return e("layer.type.vector");case"GROUP":return e("layer.type.group");case"COMPONENT":case"COMPONENT_SET":return e("layer.type.component");case"INSTANCE":return e("layer.type.instance");default:return e("layer.type.other")}}function ro({t:e,label:t,value:a,mixed:r,min:n,max:o,step:l=1,onPreview:s,onCommit:y}){let[c,h]=(0,pe.useState)(""),v=(0,pe.useRef)(!1),x=(0,pe.useRef)(0),d=(0,pe.useRef)(!1),p=(0,pe.useRef)(!1),u=a===null?"":String(a);(0,pe.useEffect)(()=>{v.current||h(a===null?"":String(a))},[a]);let m=()=>h(a===null?"":String(a)),L=()=>{v.current=!1;let S=Number(c);if(c.trim()===""||!Number.isFinite(S)){m(),d.current&&y(x.current,x.current),d.current=!1;return}d.current&&y(S,x.current),d.current=!1};return(0,k.jsxs)("label",{className:"art-inspector-field",children:[(0,k.jsx)("span",{className:"art-inspector-field-label",children:t}),(0,k.jsx)(De.Input,{className:"art-inspector-input","aria-label":t,type:"number",inputMode:"decimal",min:n,max:o,step:l,value:c,placeholder:r||u===""?e("panel.mixed"):void 0,onFocus:()=>{v.current=!0,x.current=a??0,d.current=!1,h(a===null?"":String(a))},onChange:S=>{let V=S.target.value;h(V);let D=Number(V);V.trim()!==""&&Number.isFinite(D)&&(d.current=!0,s(D))},onBlur:()=>{if(p.current){p.current=!1,v.current=!1,m();return}L()},onKeyDown:S=>{S.key==="Enter"?(S.preventDefault(),S.currentTarget.blur()):S.key==="Escape"&&(S.preventDefault(),m(),d.current&&y(x.current,x.current),d.current=!1,p.current=!0,S.currentTarget.blur())}})]})}function no({t:e,handle:t,snapshot:a}){let[r,n]=(0,pe.useState)(null),[o,l]=(0,pe.useState)(""),s=a.rows,y=s.findIndex(d=>d.selected),c=d=>{let p=s[d];p!==void 0&&t.select(p.id,"replace")},h=d=>{l(d.name),n(d.id)},v=d=>{let p=o.trim();n(null),p!==""&&p!==d.name&&t.rename(d.id,p)},x=d=>{let p=y===-1?void 0:s[y];if(d.key==="ArrowDown"){d.preventDefault(),c(y===-1?0:Math.min(y+1,s.length-1));return}if(d.key==="ArrowUp"){d.preventDefault(),c(y===-1?s.length-1:Math.max(y-1,0));return}if(p!==void 0){if(d.key==="ArrowLeft"){if(d.preventDefault(),p.hasChildren&&p.expanded){t.toggleExpand(p.id);return}for(let u=y-1;u>=0;u-=1)if(s[u].level<p.level){t.select(s[u].id,"replace");return}return}if(d.key==="ArrowRight"){if(d.preventDefault(),p.hasChildren&&!p.expanded)t.toggleExpand(p.id);else{let u=s[y+1];u!==void 0&&u.level>p.level&&t.select(u.id,"replace")}return}d.key==="Enter"&&(d.preventDefault(),h(p))}};return s.length===0?(0,k.jsx)("p",{className:"art-inspector-empty",children:e("panel.none")}):(0,k.jsx)("div",{className:"art-layer-tree",role:"tree","aria-label":e("panel.layers"),tabIndex:0,onKeyDown:x,children:s.map(d=>(0,k.jsxs)("div",{className:"art-layer-row"+(d.selected?" is-selected":""),"data-layer-id":d.id,role:"treeitem","aria-level":d.level,"aria-selected":d.selected,"aria-expanded":d.hasChildren?d.expanded:void 0,style:{paddingInlineStart:(d.level-1)*14+6},onClick:p=>{p.shiftKey?t.select(d.id,"range"):p.metaKey||p.ctrlKey?t.select(d.id,"add"):t.select(d.id,"replace")},onDoubleClick:()=>h(d),children:[d.hasChildren?(0,k.jsx)("button",{type:"button",className:"art-layer-caret","aria-label":e(d.expanded?"panel.collapse":"panel.expand"),onClick:p=>{p.stopPropagation(),t.toggleExpand(d.id)},children:d.expanded?(0,k.jsx)(De.IconChevronDownOutlineRegular,{size:12}):(0,k.jsx)(De.IconChevronRightOutlineRegular,{size:12})}):(0,k.jsx)("span",{className:"art-layer-caret","aria-hidden":"true"}),(0,k.jsx)("span",{className:"art-layer-icon","aria-hidden":"true",children:Pt(d.type)}),r===d.id?(0,k.jsx)("input",{className:"art-layer-rename","aria-label":e("panel.rename"),autoFocus:!0,value:o,onChange:p=>l(p.target.value),onClick:p=>p.stopPropagation(),onBlur:()=>v(d),onKeyDown:p=>{p.key==="Enter"?(p.preventDefault(),v(d)):p.key==="Escape"&&(p.preventDefault(),n(null))}}):(0,k.jsx)("span",{className:"art-layer-name",title:d.name,children:d.name}),(0,k.jsxs)("span",{className:"art-layer-actions",children:[(0,k.jsx)("button",{type:"button",className:"art-layer-action","aria-label":e(d.visible?"panel.hide":"panel.show"),"aria-pressed":!d.visible,onClick:p=>{p.stopPropagation(),t.toggleVisibility(d.id)},children:d.visible?(0,k.jsx)(vr,{size:13}):(0,k.jsx)(xr,{size:13})}),(0,k.jsx)("button",{type:"button",className:"art-layer-action","aria-label":e(d.locked?"panel.unlock":"panel.lock"),"aria-pressed":d.locked,onClick:p=>{p.stopPropagation(),t.toggleLock(d.id)},children:d.locked?(0,k.jsx)(wr,{size:13}):(0,k.jsx)(kr,{size:13})})]})]},d.id))})}function oo({t:e,handle:t,snapshot:a}){let r=a.properties;if(r.ids.length===0)return(0,k.jsx)("p",{className:"art-inspector-empty",children:e("panel.selectLayerHint")});let n=(o,l,s,y={})=>(0,k.jsx)(ro,{t:e,label:l,value:s,mixed:s===null,...y,onPreview:c=>t.preview(o,c),onCommit:(c,h)=>t.commit(o,c,h)});return(0,k.jsxs)("div",{className:"art-inspector-properties",children:[(0,k.jsxs)("div",{className:"art-inspector-node",children:[(0,k.jsx)("span",{className:"art-inspector-node-icon","aria-hidden":"true",children:Pt(r.type??"")}),(0,k.jsx)("span",{className:"art-inspector-node-name",title:r.name??"",children:r.name}),(0,k.jsx)("span",{className:"art-inspector-node-type",children:ma(e,r.type??"")})]}),(0,k.jsxs)("section",{className:"art-inspector-group",children:[(0,k.jsx)("h3",{className:"art-inspector-heading",children:e("panel.positionSize")}),(0,k.jsxs)("div",{className:"art-inspector-grid",children:[n("x",e("panel.x"),r.x),n("y",e("panel.y"),r.y),n("width",e("panel.w"),r.width,{min:1}),n("height",e("panel.h"),r.height,{min:1}),n("rotation",e("panel.rotation"),r.rotation),n("radius",e("panel.radius"),r.radius,{min:0})]})]}),(0,k.jsxs)("section",{className:"art-inspector-group",children:[(0,k.jsx)("h3",{className:"art-inspector-heading",children:e("panel.appearance")}),(0,k.jsxs)("div",{className:"art-inspector-appearance",children:[n("opacity",e("panel.opacity"),r.opacity,{min:0,max:100}),(0,k.jsxs)("label",{className:"art-inspector-switch",children:[(0,k.jsx)("span",{className:"art-inspector-field-label",children:e("panel.visible")}),(0,k.jsx)(De.Switch,{checked:r.visible===!0,label:e("panel.visible"),onChange:o=>t.setVisible(o)})]})]})]}),a.isText&&r.text!==null?(0,k.jsxs)("section",{className:"art-inspector-group",children:[(0,k.jsx)("h3",{className:"art-inspector-heading",children:e("panel.text")}),(0,k.jsxs)("div",{className:"art-inspector-grid",children:[(0,k.jsxs)("label",{className:"art-inspector-field",children:[(0,k.jsx)("span",{className:"art-inspector-field-label",children:e("panel.family")}),(0,k.jsx)("select",{className:"art-inspector-select","aria-label":e("panel.family"),value:r.text.family,onChange:o=>t.setFamily(o.target.value),children:to.map(o=>(0,k.jsx)("option",{value:o,children:o},o))})]}),(0,k.jsxs)("label",{className:"art-inspector-field",children:[(0,k.jsx)("span",{className:"art-inspector-field-label",children:e("panel.weight")}),(0,k.jsx)("select",{className:"art-inspector-select","aria-label":e("panel.weight"),value:String(r.text.weight),onChange:o=>t.setWeight(Number(o.target.value)),children:ao.map(o=>(0,k.jsx)("option",{value:String(o),children:String(o)},o))})]}),n("fontSize",e("panel.fontSize"),r.text.fontSize,{min:1})]})]}):(0,k.jsx)("p",{className:"art-inspector-hint",children:e("panel.selectTextHint")})]})}function Sr({t:e,handle:t,snapshot:a,tab:r}){return t===null||a===null?(0,k.jsx)("p",{className:"art-inspector-empty",children:e("canvas.opening")}):r==="layers"?(0,k.jsx)(no,{t:e,handle:t,snapshot:a}):(0,k.jsx)(oo,{t:e,handle:t,snapshot:a})}var dt=require("react"),Nr=require("@deepseek-ai/dsh-client-ui-primitives");var se=require("react/jsx-runtime");function ya({t:e,where:t,id:a,version:r,title:n}){let[o,l]=(0,dt.useState)({status:"loading"}),[s,y]=(0,dt.useState)(0);if((0,dt.useEffect)(()=>{let h=new AbortController;return l({status:"loading"}),U.preview(t,a,r,h.signal).then(v=>{h.signal.aborted||l({status:"ready",preview:v})}).catch(v=>{h.signal.aborted||l({status:"failed",message:er(e,v)})}),()=>h.abort()},[t.scope,t.workspaceId,a,r,s,e]),o.status==="loading")return(0,se.jsx)("div",{className:"art-design-state",role:"status","aria-busy":"true",children:e("preview.loading")});if(o.status==="failed")return(0,se.jsxs)("div",{className:"art-design-state",role:"alert",children:[(0,se.jsx)("span",{className:"art-design-error",children:o.message}),(0,se.jsx)(Nr.Button,{size:"sm",variant:"outline",onClick:()=>y(h=>h+1),children:e("preview.retry")})]});let{preview:c}=o;return(0,se.jsxs)("div",{className:"art-design-preview",children:[(0,se.jsx)("div",{className:"art-design-canvas",children:(0,se.jsx)("img",{className:"art-design-image",src:`data:${c.mediaType};base64,${c.data}`,alt:n,width:c.width,height:c.height})}),c.info.warnings.length===0?null:(0,se.jsxs)("div",{className:"art-design-warnings",role:"note",children:[(0,se.jsx)("span",{className:"art-design-warnings-title",children:e("preview.warnings")}),(0,se.jsx)("ul",{children:c.info.warnings.map(h=>(0,se.jsx)("li",{children:h},h))})]})]})}var W=require("react"),Cr=require("@deepseek-ai/dsh-client-ui-primitives");var ye=require("react/jsx-runtime"),pt=null;function io(){if(pt===null){let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")return Promise.reject(new Error("The document editor loader is unavailable."));pt=e("./client.doc.js"),pt.catch(()=>{pt=null})}return pt}var so=["heading","bold","italic","bulletList","orderedList","codeBlock"];function lo(e){let t=window.getSelection(),a=e.getBoundingClientRect(),n=(t!==null&&t.rangeCount>0?t.getRangeAt(0):null)?.getBoundingClientRect();if(n===void 0||n.width===0&&n.height===0)return{top:e.scrollTop+8,left:16};let o=Math.min(Math.max(n.left-a.left+n.width/2,120),Math.max(a.width-120,120));return{top:Math.max(n.top-a.top+e.scrollTop-46,e.scrollTop+4),left:o}}function Lt({markdown:e,revision:t,editable:a,label:r,loadingLabel:n,failedLabel:o,onChange:l,onSave:s,onSelectionText:y,t:c,design:h,dark:v=!1,selectionAction:x}){let d=(0,W.useRef)(null),p=(0,W.useRef)(null),u=(0,W.useRef)(null),m=(0,W.useRef)(l);m.current=l;let L=(0,W.useRef)(y);L.current=y;let S=(0,W.useRef)({markdown:e,editable:a,label:r});S.current={markdown:e,editable:a,label:r};let[V,D]=(0,W.useState)([]),[H,C]=(0,W.useState)("loading"),[F,_]=(0,W.useState)(null),P=(0,W.useRef)(null);(0,W.useLayoutEffect)(()=>{let E=P.current,q=d.current;if(E===null||q===null||F===null)return;let N=E.offsetWidth/2,Q=q.clientWidth,_e=N*2+16>=Q?Q/2:Math.min(Math.max(F.left,N+8),Q-N-8);E.style.left=_e+"px"});let A=(0,W.useMemo)(()=>h===void 0?{}:{...Xa(h,v),colorScheme:v?"dark":"light"},[h,v]),$=E=>{L.current?.(E);let q=d.current;_(E===""||q===null?null:lo(q))},O=(0,W.useRef)($);O.current=$,(0,W.useEffect)(()=>{let E=!1;return io().then(q=>{E||p.current===null||(u.current=q.mountDocEditor({element:p.current,...S.current,onChange:N=>m.current(N),onSelectionChange:D,onSelectionText:N=>O.current(N)}),C("ready"))}).catch(()=>{E||C("failed")}),()=>{E=!0,u.current?.destroy(),u.current=null}},[]),(0,W.useEffect)(()=>{let E=u.current;E!==null&&E.getMarkdown()!==e&&E.setMarkdown(e)},[t,e]),(0,W.useEffect)(()=>{u.current?.setEditable(a)},[a]),(0,W.useEffect)(()=>{let E=()=>{let q=u.current,N=d.current,Q=window.getSelection();q===null||N===null||Q!==null&&Q.anchorNode!==null&&!N.contains(Q.anchorNode)||O.current(q.getSelectionText())};return document.addEventListener("selectionchange",E),()=>document.removeEventListener("selectionchange",E)},[]);let Le=F!==null&&c!==void 0&&(a||x!=null);return(0,ye.jsxs)("div",{className:"art-doc",ref:d,"data-doc-revision":t,onKeyDown:E=>{(E.ctrlKey||E.metaKey)&&E.key.toLowerCase()==="s"&&(E.preventDefault(),s()),E.key==="Escape"&&F!==null&&_(null)},children:[Le?(0,ye.jsxs)("div",{ref:P,className:"art-doc-toolbar",role:"toolbar","aria-label":c("format.toolbar"),style:{top:F.top,left:F.left},children:[a?so.map(E=>(0,ye.jsx)(Cr.Button,{size:"sm",variant:"ghost","aria-pressed":V.includes(E),disabled:H!=="ready",onMouseDown:q=>q.preventDefault(),onClick:()=>u.current?.format(E),children:c(`format.${E}`)},E)):null,a&&x!=null?(0,ye.jsx)("span",{className:"art-doc-toolbar-gap","aria-hidden":"true"}):null,x]}):null,H==="loading"?(0,ye.jsx)("p",{className:"art-note",children:n}):null,H==="failed"?(0,ye.jsx)("p",{className:"art-note",children:o}):null,(0,ye.jsx)("div",{className:"art-docpage",style:A,children:(0,ye.jsx)("div",{className:"art-doc-mount",ref:p})})]})}function co(e){return/<meta\b[^>]*name\s*=\s*["']?color-scheme["']?[^>]*content\s*=\s*["'][^"']*\bdark\b/i.test(e)||/<meta\b[^>]*content\s*=\s*["'][^"']*\bdark\b[^"']*["'][^>]*name\s*=\s*["']?color-scheme/i.test(e)}var Ar="default-src 'none'; img-src data: blob:; media-src data: blob:; style-src 'unsafe-inline'; script-src 'unsafe-inline' 'unsafe-eval'; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'",Er=["body, .art-docpage { color: var(--artifact-color-text); font-family: var(--artifact-font-family); font-size: 16px; line-height: 1.65; }","h1, h2, h3, h4 { font-family: var(--artifact-font-display); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; margin: 1.8em 0 0.5em; color: var(--artifact-color-text); text-wrap: balance; }","h1 { font-size: 2.1em; margin-top: 0; }","h2 { font-size: 1.45em; }","h3 { font-size: 1.15em; }","p, ul, ol, blockquote, table, pre { margin: 0 0 1em; }","a { color: var(--artifact-color-primary); text-underline-offset: 2px; }","strong { font-weight: 650; }","code { font-family: var(--artifact-font-mono); font-size: 0.88em; padding: 0.1em 0.35em; border-radius: var(--artifact-radius-sm); background: color-mix(in srgb, var(--artifact-color-text) 7%, transparent); }","pre { font-family: var(--artifact-font-mono); font-size: 0.86em; line-height: 1.55; padding: 14px 16px; border-radius: var(--artifact-radius-md); background: color-mix(in srgb, var(--artifact-color-text) 6%, transparent); overflow: auto; }","pre code { padding: 0; background: none; font-size: 1em; }","blockquote { padding: 0 0 0 16px; border-left: 3px solid var(--artifact-color-accent); color: var(--artifact-color-muted); }","ul, ol { padding-left: 1.4em; }","li + li { margin-top: 0.25em; }","table { border-collapse: collapse; width: 100%; font-size: 0.94em; font-variant-numeric: tabular-nums; }","th, td { padding: 8px 10px; border-bottom: 1px solid color-mix(in srgb, var(--artifact-color-text) 14%, transparent); text-align: left; vertical-align: top; }","th { font-weight: 600; color: var(--artifact-color-muted); border-bottom-color: color-mix(in srgb, var(--artifact-color-text) 28%, transparent); }","hr { border: none; border-top: 1px solid color-mix(in srgb, var(--artifact-color-text) 14%, transparent); margin: 2em 0; }"].join(`
22
+ `);var ba="<script>addEventListener('message',function(e){if(e.source!==parent||e.data!=='dsh-artifact-print')return;addEventListener('afterprint',function(){parent.postMessage('dsh-artifact-printed','*')},{once:true});print()})<\/script>";function Ir(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function po(e){return e.replace(/<meta\b[^>]*http-equiv\s*=\s*["']?refresh["']?[^>]*>/gi,"").replace(/<meta\b[^>]*content\s*=\s*["'][^"']*url\s*=[^>]*>/gi,"")}function Rr(e,t,a,r,n="",o="auto"){let l='<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">'+(a===null?"":`<meta http-equiv="Content-Security-Policy" content="${Ir(a)}">`)+`<title>${Ir(r)}</title><style data-artifact-tokens>${t}</style>`+n;return`<!doctype html><html${co(e)?` ${Ct}="${o}"`:""}><head>${l}</head><body>${po(e)}</body></html>`}var Dr="allow-scripts",uo="allow-scripts allow-modals",fo=3e4,go="<script>(function(){var t;document.addEventListener('selectionchange',function(){clearTimeout(t);t=setTimeout(function(){var s=String(getSelection()||'');parent.postMessage({dshArtifactSelection:s.slice(0,4000)},'*')},150)})})()<\/script>",mo=4e3;function Mt(e,t,a,r="auto",n=!1){return Rr(e,t,Ar,a,n?go:"",r)}function zr(e){if(e===null||typeof e!="object")return;let t={...e};return typeof t.dshArtifactSelection=="string"?t.dshArtifactSelection.slice(0,mo):void 0}function Pr(e){let t=/<\/head>/i.test(e)?e.replace(/<\/head>/i,`${ba}</head>`):`${ba}${e}`,a=URL.createObjectURL(new Blob([t],{type:"text/html"})),r=document.createElement("iframe");r.setAttribute("sandbox",uo),r.setAttribute("aria-hidden","true"),r.tabIndex=-1,r.style.cssText="position:fixed;left:-10000px;top:0;width:800px;height:1000px;border:0;";let n=!1,o=()=>{n||(n=!0,clearTimeout(s),window.removeEventListener("message",l),r.remove(),URL.revokeObjectURL(a))},l=y=>{y.source===r.contentWindow&&y.data==="dsh-artifact-printed"&&o()};window.addEventListener("message",l);let s=setTimeout(o,fo);r.addEventListener("load",()=>{r.contentWindow?.postMessage("dsh-artifact-print","*")},{once:!0}),r.src=a,document.body.appendChild(r)}var Lr={"agent.ask":"Edit with agent","agent.reference":'In artifact "{title}" ({id}, v{version}):',"agent.referenceOld":'In artifact "{title}" ({id}, v{version}, the current version is v{current}):',"agent.referenceProject":'In artifact "{title}" ({id}, workspace {workspaceId}, v{version}):',"agent.referenceOldProject":'In artifact "{title}" ({id}, workspace {workspaceId}, v{version}, the current version is v{current}):',"agent.added":"Added to your message. Describe the change, then send.","agent.addedTruncated":"Added to your message. The selection was shortened to 2,000 characters.","agent.insertFailed":"The message box is busy, so the request was copied instead.","agent.copied":"Copied. Paste it into a conversation, then send.","agent.copyTitle":"Copy the request","card.creating":"Creating {title}","card.updating":"Updating {title}","card.updatingUntitled":"Updating the artifact","card.openNamed":"Open {title}","tab.codeHint":"Read-only code. Select text to ask the agent about it.","tab.editSource":"Edit code","tab.deleteTitle":"Move to trash?","code.copy":"Copy code","dialog.close":"Close","dialog.done":"Done","design.colorsDark":"Dark colors","panel.layers":"Layers","panel.properties":"Properties","panel.none":"No layers","panel.mixed":"Mixed","panel.expand":"Expand","panel.collapse":"Collapse","panel.show":"Show","panel.hide":"Hide","panel.lock":"Lock","panel.unlock":"Unlock","panel.rename":"Rename layer","panel.x":"X","panel.y":"Y","panel.rotation":"Rotate","panel.radius":"Radius","panel.opacity":"Opacity","panel.visible":"Visible","panel.hidden":"Hidden","panel.family":"Font family","panel.weight":"Weight","panel.fontSize":"Size","panel.w":"W","panel.h":"H","panel.positionSize":"Position and size","panel.appearance":"Appearance","panel.text":"Text","panel.selectLayerHint":"Select a layer to see its properties.","panel.selectTextHint":"Select a text layer to change its font, weight, and size.","layer.parentLine":"{type} in {parent}","layer.type.frame":"Frame","layer.type.section":"Section","layer.type.text":"Text","layer.type.rectangle":"Rectangle","layer.type.ellipse":"Ellipse","layer.type.line":"Line","layer.type.vector":"Vector","layer.type.group":"Group","layer.type.component":"Component","layer.type.instance":"Instance","layer.type.other":"Layer","canvas.viewMode":"View","canvas.editMode":"Edit","canvas.opening":"Opening the canvas\u2026","canvas.startFailed":"The canvas did not start. Showing the saved image.","canvas.empty":"This mockup has no layers yet. Switch to Edit to draw one.","canvas.zoomControls":"Zoom","canvas.zoomOut":"Zoom out","canvas.zoomIn":"Zoom in","canvas.zoomMenu":"Zoom level","canvas.zoomValue":"{percent}%","canvas.inspector":"Inspector","canvas.closeInspector":"Close inspector","canvas.inspectorTabs":"Inspector sections","canvas.editOldVersion":"Old versions open in View only. Restore this version to edit.","agent.quoteDesign":`Layer "{name}"
23
23
  Path: {path}
24
24
 
25
- Design JSX:`,"agent.quoteCut":"The Design JSX was shortened to {limit} characters.","agent.addedTruncatedDesign":"Added to your message. The layer's code was shortened to 4,000 characters.","canvas.toolbar":"Canvas tools","canvas.tools":"Tool","canvas.select":"Select","canvas.hand":"Hand","canvas.frame":"Frame","canvas.text":"Text","canvas.undo":"Undo","canvas.redo":"Redo","canvas.fit":"Fit","preview.loading":"Rendering the mockup\u2026","preview.retry":"Render again","preview.warnings":"Preview warnings","error.designIconNotFound":"That icon is not in the bundled set. Use an mdi: name from Material Design Icons.","design.display":"Heading font stack","composer.recent":"This project","composer.empty":"No artifacts yet","composer.start":"Start with","composer.all":"All artifacts","gallery.copyPrompt":"Copy prompt","gallery.copyPromptNamed":"Copy the {name} prompt","gallery.promptCopied":"Prompt copied. Paste it into a conversation.","prompt.dashboard":"Dashboard","prompt.dashboardText":"Create an artifact page: a dashboard that shows ","prompt.explainer":"Explainer","prompt.explainerText":"Create an artifact page: a one-page visual explainer of ","prompt.report":"Report","prompt.reportText":"Create an artifact doc: a report about ","prompt.brief":"Project brief","prompt.briefText":"Create an artifact doc: a project brief with context, goal, scope, and open questions for ","filter.type":"Filter by type","tab.mode":"Page view","tab.manualSave":"Page source saves with Save or Ctrl/Cmd+S.","tab.manualSaveDesign":"Mockup source saves with Save or Ctrl/Cmd+S.","tab.versionPicker":"Choose version","tab.currentVersion":"current","tab.allVersions":"All versions","tab.agentUpdate":"Updated to v{version}","tab.viewHistory":"View history","tab.dismiss":"Dismiss","tab.leaveTitle":"Keep your changes?","tab.leaveHint":"Save your changes before continuing, or discard them. Cancel keeps you here.","tab.discardContinue":"Discard and continue","tab.saveContinue":"Save and continue","tab.copyDraft":"Copy my draft","tab.discardReload":"Discard mine and reload","history.close":"Close history","action.copied":"Copied","action.copyFailed":"Copy was blocked. Select the text and copy it manually.","format.toolbar":"Document formatting","format.heading":"Heading","format.bold":"Bold","format.italic":"Italic","format.bulletList":"Bullet list","format.orderedList":"Numbered list","format.codeBlock":"Code block",panel:"Artifacts","action.back":"Back","scope.label":"Scope","scope.all":"All projects","scope.workspace":"This project","scope.library":"Library","type.page":"Page","type.doc":"Document","type.design":"Mockup","type.all":"All types","gallery.search":"Search artifacts","gallery.searchLabel":"Search by title","gallery.create":"New artifact","gallery.newPage":"New page","gallery.newDoc":"New document","gallery.newDesign":"New mockup","gallery.design":"Design system","gallery.refresh":"Refresh","gallery.more":"Show more","gallery.truncated":"Only the first 500 artifacts are scanned.","gallery.failedProjects":"Some sources could not be loaded.","gallery.version":"v{version}","gallery.updated":"Updated {time}","gallery.count":"{count} artifacts","gallery.pinned":"Pinned","gallery.recent":"Recently updated","gallery.coverTitle":"Preview of {title}","gallery.coverFailed":"Preview unavailable","gallery.pin":"Pin {title}","gallery.unpin":"Unpin {title}","gallery.allPinned":"Everything here is pinned.","empty.workspaceTitle":"No artifacts in this project yet","empty.workspaceHint":"Ask the agent for a dashboard, report, or one-pager, or start one here.","empty.allTitle":"No artifacts yet","empty.allHint":"Artifacts from every project and your library appear here.","empty.libraryTitle":"Your library is empty","empty.libraryHint":"Library artifacts follow you to every project. Ask the agent to save one to the library.","empty.noMatch":"Nothing matches that search.","empty.typeMatch":"No {type} artifacts match the filter.","empty.noWorkspace":"Open a session in a workspace to see its artifacts.","empty.loading":"Loading...","create.title":"New {type}","create.name":"Title","create.scope":"Save to","create.submit":"Create","create.cancel":"Cancel","create.untitledPage":"Untitled page","create.untitledDesign":"Untitled mockup","create.untitledDoc":"Untitled document","tab.preview":"Preview","tab.source":"Code","tab.history":"History","tab.export":"Export","tab.reload":"Reload","tab.rename":"Rename","tab.delete":"Move to trash","tab.deleteConfirm":'"{title}" moves to the trash. Its files stay there for 7 days.',"tab.save":"Save","tab.saving":"Saving...","tab.saved":"Saved","tab.readOnly":"Read-only","tab.saveFailed":"Save failed","tab.unsaved":"Unsaved changes","tab.frameTitle":"Artifact preview: {title}","tab.versionOf":"Version {version}","tab.viewingOld":"Viewing version {version}. The current version is {current}.","tab.backToCurrent":"Back to current","tab.restoreThis":"Restore this version","tab.conflictTitle":"This artifact changed","tab.conflictHint":"A newer version was saved while you were editing. Your draft is kept here. Copy it before discarding, then reload the latest version.","tab.deleted":"This artifact is no longer here","tab.deletedHint":"It was moved to the trash or deleted.","tab.close":"Close tab","history.title":"Versions","history.current":"Current","history.byAgent":"Agent","history.byUser":"You","history.restored":"Restored from v{version}","history.created":"Created","history.updated":"Edited","history.empty":"No earlier versions.","export.html":"HTML file","export.png":"PNG image","export.svg":"SVG image","export.fig":"OpenPencil document (.fig)","export.md":"Markdown file","export.docx":"Word document","export.print":"Print or save as PDF","export.done":"Saved {name} to {path}","design.title":"Design system","design.hint":"Pages and documents use these values through CSS variables.","design.source.workspace":"This project overrides the library.","design.source.library":"Inherited from your library.","design.source.default":"Built-in defaults. Save to start your own.","design.name":"Name","design.colors":"Colors","design.color.primary":"Primary","design.color.accent":"Accent","design.color.surface":"Surface","design.color.text":"Text","design.color.muted":"Muted","design.type":"Typography","design.font":"Body font stack","design.mono":"Code font stack","design.radius":"Corner radius","design.radius.sm":"Small","design.radius.md":"Medium","design.radius.lg":"Large","design.notes":"Notes for the agent","design.notesHint":"Tone, layout rules, or brand guidance the agent reads before it designs.","design.saveWorkspace":"Save for this project","design.saveWorkspaceNamed":"Save for {name}","design.saveLibrary":"Save to library","design.clear":"Remove project override","design.saved":"Design system saved","design.preview":"Preview","design.previewHeading":"Quarterly review","design.previewBody":"Revenue grew in every region this quarter.","design.previewButton":"Primary action","card.created":"Created","card.updated":"Updated","card.working":"Writing the artifact...","card.failed":"The artifact was not saved","card.missing":"This result has no artifact details.","composer.label":"Artifacts","error.generic":"Something went wrong. Try again.","error.designInvalid":"The mockup source is not valid.","error.designIcon":"The mockup cannot use that icon.","error.designRender":"The mockup could not be rendered.","error.designTimeout":"The mockup took too long to render.","error.designUnavailable":"This runtime cannot render mockups.","error.unsupportedType":"That action is not available for this artifact.","error.notFound":"This artifact no longer exists.","error.stale":"The artifact changed. Reload to continue.","error.tooLarge":"The content is over the 2 MiB limit.","error.noWorkspace":"This session has no workspace.","error.forbidden":"That path is not allowed.","error.corrupt":"The artifact files are damaged.","error.tokens":"A design value is not valid CSS.","error.library":"The library folder cannot be created.","error.surface":"The artifact panel failed to draw.","error.surfaceHint":"Reload the window. Your artifacts are safe on disk.","action.retry":"Retry","action.reloadWindow":"Reload window","time.justNow":"just now","time.minutes":"{count} min ago","time.hours":"{count} h ago","time.days":"{count} d ago"},Rr={"agent.ask":"\u8BA9\u667A\u80FD\u4F53\u4FEE\u6539","agent.reference":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0Cv{version}\uFF09\u4E2D\uFF1A","agent.referenceOld":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0Cv{version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A v{current}\uFF09\u4E2D\uFF1A","agent.added":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u63CF\u8FF0\u8981\u4FEE\u6539\u7684\u5185\u5BB9\u540E\u53D1\u9001\u3002","agent.addedTruncated":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u9009\u4E2D\u7684\u6587\u672C\u5DF2\u7F29\u77ED\u4E3A 2,000 \u4E2A\u5B57\u7B26\u3002","agent.insertFailed":"\u6D88\u606F\u6846\u6B63\u5FD9\uFF0C\u5DF2\u6539\u4E3A\u590D\u5236\u8BF7\u6C42\u3002","agent.copied":"\u5DF2\u590D\u5236\u3002\u7C98\u8D34\u5230\u5BF9\u8BDD\u4E2D\u540E\u53D1\u9001\u3002","agent.copyTitle":"\u590D\u5236\u8BF7\u6C42","card.creating":"\u6B63\u5728\u521B\u5EFA {title}","card.updating":"\u6B63\u5728\u66F4\u65B0 {title}","card.updatingUntitled":"\u6B63\u5728\u66F4\u65B0\u4EA7\u7269","card.openNamed":"\u6253\u5F00 {title}","tab.codeHint":"\u53EA\u8BFB\u4EE3\u7801\u3002\u9009\u4E2D\u6587\u672C\u5373\u53EF\u8BA9\u667A\u80FD\u4F53\u5904\u7406\u3002","tab.editSource":"\u7F16\u8F91\u4EE3\u7801","tab.deleteTitle":"\u79FB\u5230\u56DE\u6536\u7AD9\uFF1F","code.copy":"\u590D\u5236\u4EE3\u7801","dialog.close":"\u5173\u95ED","dialog.done":"\u5B8C\u6210","design.colorsDark":"\u6DF1\u8272\u914D\u8272","panel.layers":"\u56FE\u5C42","panel.properties":"\u5C5E\u6027","panel.none":"\u6CA1\u6709\u56FE\u5C42","panel.mixed":"\u6DF7\u5408","panel.expand":"\u5C55\u5F00","panel.collapse":"\u6298\u53E0","panel.show":"\u663E\u793A","panel.hide":"\u9690\u85CF","panel.lock":"\u9501\u5B9A","panel.unlock":"\u89E3\u9501","panel.rename":"\u91CD\u547D\u540D\u56FE\u5C42","panel.x":"X","panel.y":"Y","panel.rotation":"\u65CB\u8F6C","panel.radius":"\u5706\u89D2","panel.opacity":"\u4E0D\u900F\u660E\u5EA6","panel.visible":"\u53EF\u89C1","panel.hidden":"\u5DF2\u9690\u85CF","panel.family":"\u5B57\u4F53","panel.weight":"\u5B57\u91CD","panel.fontSize":"\u5B57\u53F7","panel.w":"\u5BBD","panel.h":"\u9AD8","panel.positionSize":"\u4F4D\u7F6E\u548C\u5C3A\u5BF8","panel.appearance":"\u5916\u89C2","panel.text":"\u6587\u672C","panel.selectLayerHint":"\u9009\u62E9\u4E00\u4E2A\u56FE\u5C42\u4EE5\u67E5\u770B\u5176\u5C5E\u6027\u3002","panel.selectTextHint":"\u9009\u62E9\u6587\u672C\u56FE\u5C42\u53EF\u4FEE\u6539\u5B57\u4F53\u3001\u5B57\u91CD\u548C\u5B57\u53F7\u3002","layer.parentLine":"{type}\uFF0C\u4F4D\u4E8E {parent}","layer.type.frame":"\u6846\u67B6","layer.type.section":"\u5206\u533A","layer.type.text":"\u6587\u672C","layer.type.rectangle":"\u77E9\u5F62","layer.type.ellipse":"\u692D\u5706","layer.type.line":"\u7EBF","layer.type.vector":"\u77E2\u91CF","layer.type.group":"\u7F16\u7EC4","layer.type.component":"\u7EC4\u4EF6","layer.type.instance":"\u5B9E\u4F8B","layer.type.other":"\u56FE\u5C42","canvas.viewMode":"\u67E5\u770B","canvas.editMode":"\u7F16\u8F91","canvas.opening":"\u6B63\u5728\u6253\u5F00\u753B\u5E03\u2026","canvas.startFailed":"\u753B\u5E03\u672A\u80FD\u542F\u52A8\uFF0C\u73B0\u663E\u793A\u5DF2\u4FDD\u5B58\u7684\u56FE\u7247\u3002","canvas.empty":"\u6B64\u539F\u578B\u8FD8\u6CA1\u6709\u56FE\u5C42\u3002\u5207\u6362\u5230\u7F16\u8F91\u6A21\u5F0F\u5373\u53EF\u7ED8\u5236\u3002","canvas.zoomControls":"\u7F29\u653E","canvas.zoomOut":"\u7F29\u5C0F","canvas.zoomIn":"\u653E\u5927","canvas.zoomMenu":"\u7F29\u653E\u7EA7\u522B","canvas.zoomValue":"{percent}%","canvas.inspector":"\u68C0\u67E5\u5668","canvas.closeInspector":"\u5173\u95ED\u68C0\u67E5\u5668","canvas.inspectorTabs":"\u68C0\u67E5\u5668\u5206\u533A","canvas.editOldVersion":"\u65E7\u7248\u672C\u4EC5\u53EF\u67E5\u770B\u3002\u6062\u590D\u6B64\u7248\u672C\u540E\u624D\u80FD\u7F16\u8F91\u3002","agent.quoteDesign":`\u56FE\u5C42\u201C{name}\u201D
25
+ Design JSX:`,"agent.quoteCut":"The Design JSX was shortened to {limit} characters.","agent.addedTruncatedDesign":"Added to your message. The layer's code was shortened to 4,000 characters.","canvas.toolbar":"Canvas tools","canvas.tools":"Tool","canvas.select":"Select","canvas.hand":"Hand","canvas.frame":"Frame","canvas.text":"Text","canvas.undo":"Undo","canvas.redo":"Redo","canvas.fit":"Fit","preview.loading":"Rendering the mockup\u2026","preview.retry":"Render again","preview.warnings":"Preview warnings","error.designIconNotFound":"That icon is not in the bundled set. Use an mdi: name from Material Design Icons.","design.display":"Heading font stack","composer.recent":"This project","composer.empty":"No artifacts yet","composer.start":"Start with","composer.all":"All artifacts","gallery.copyPrompt":"Copy prompt","gallery.copyPromptNamed":"Copy the {name} prompt","gallery.promptCopied":"Prompt copied. Paste it into a conversation.","prompt.dashboard":"Dashboard","prompt.dashboardText":"Create an artifact page: a dashboard that shows ","prompt.explainer":"Explainer","prompt.explainerText":"Create an artifact page: a one-page visual explainer of ","prompt.report":"Report","prompt.reportText":"Create an artifact doc: a report about ","prompt.brief":"Project brief","prompt.briefText":"Create an artifact doc: a project brief with context, goal, scope, and open questions for ","filter.type":"Filter by type","tab.mode":"Page view","tab.manualSave":"Page source saves with Save or Ctrl/Cmd+S.","tab.manualSaveDesign":"Mockup source saves with Save or Ctrl/Cmd+S.","tab.versionPicker":"Choose version","tab.currentVersion":"current","tab.allVersions":"All versions","tab.agentUpdate":"Updated to v{version}","tab.viewHistory":"View history","tab.dismiss":"Dismiss","tab.leaveTitle":"Unsaved changes","tab.leaveHint":"Save your changes before continuing, or discard them.","tab.leaveDiscard":"Discard","tab.leaveSave":"Save","tab.copyDraft":"Copy my draft","tab.discardReload":"Discard mine and reload","history.close":"Close history","action.copied":"Copied","action.copyFailed":"Copy was blocked. Select the text and copy it manually.","format.toolbar":"Document formatting","format.heading":"Heading","format.bold":"Bold","format.italic":"Italic","format.bulletList":"Bullet list","format.orderedList":"Numbered list","format.codeBlock":"Code block",panel:"Artifacts","right.guideHint":"Pages, documents, and mockups in this project.","action.back":"Back","scope.label":"Scope","scope.all":"All projects","scope.workspace":"This project","scope.library":"Library","type.page":"Page","type.doc":"Document","type.design":"Mockup","type.all":"All types","gallery.search":"Search artifacts","gallery.searchLabel":"Search by title","gallery.create":"New artifact","gallery.newPage":"New page","gallery.newDoc":"New document","gallery.newDesign":"New mockup","gallery.design":"Design system","gallery.refresh":"Refresh","gallery.more":"Show more","gallery.truncated":"Only the first 500 artifacts are scanned.","gallery.failedProjects":"Some sources could not be loaded.","gallery.version":"v{version}","gallery.updated":"Updated {time}","gallery.count":"{count} artifacts","gallery.pinned":"Pinned","gallery.recent":"Recently updated","gallery.coverTitle":"Preview of {title}","gallery.coverFailed":"Preview unavailable","gallery.pin":"Pin {title}","gallery.unpin":"Unpin {title}","gallery.allPinned":"Everything here is pinned.","empty.workspaceTitle":"No artifacts in this project yet","empty.workspaceHint":"Ask the agent for a dashboard, report, or one-pager, or start one here.","empty.allTitle":"No artifacts yet","empty.allHint":"Artifacts from every project and your library appear here.","empty.libraryTitle":"Your library is empty","empty.libraryHint":"Library artifacts follow you to every project. Ask the agent to save one to the library.","empty.noMatch":"Nothing matches that search.","empty.typeMatch":"No {type} artifacts match the filter.","empty.noWorkspace":"Open a session in a workspace to see its artifacts.","empty.loading":"Loading...","create.title":"New {type}","create.name":"Title","create.scope":"Save to","create.submit":"Create","create.cancel":"Cancel","create.untitledPage":"Untitled page","create.untitledDesign":"Untitled mockup","create.untitledDoc":"Untitled document","tab.preview":"Preview","tab.source":"Code","tab.history":"History","tab.export":"Export","tab.reload":"Reload","tab.rename":"Rename","tab.delete":"Move to trash","tab.deleteConfirm":'"{title}" moves to the trash. Its files stay there for 7 days.',"tab.save":"Save","tab.saving":"Saving...","tab.saved":"Saved","tab.readOnly":"Read-only","tab.saveFailed":"Save failed","tab.unsaved":"Unsaved changes","tab.frameTitle":"Artifact preview: {title}","tab.versionOf":"Version {version}","tab.viewingOld":"Viewing version {version}. The current version is {current}.","tab.backToCurrent":"Back to current","tab.restoreThis":"Restore this version","tab.conflictTitle":"This artifact changed","tab.conflictHint":"A newer version was saved while you were editing. Your draft is kept here. Copy it before discarding, then reload the latest version.","tab.deleted":"This artifact is no longer here","tab.deletedHint":"It was moved to the trash or deleted.","tab.close":"Close tab","history.title":"Versions","history.current":"Current","history.byAgent":"Agent","history.byUser":"You","history.restored":"Restored from v{version}","history.created":"Created","history.updated":"Edited","history.empty":"No earlier versions.","export.html":"HTML file","export.png":"PNG image","export.svg":"SVG image","export.fig":"OpenPencil document (.fig)","export.md":"Markdown file","export.docx":"Word document","export.print":"Print or save as PDF","export.done":"Saved {name} to {path}","design.title":"Design system","design.hint":"Pages and documents use these values through CSS variables.","design.source.workspace":"This project overrides the library.","design.source.library":"Inherited from your library.","design.source.default":"Built-in defaults. Save to start your own.","design.name":"Name","design.colors":"Colors","design.color.primary":"Primary","design.color.accent":"Accent","design.color.surface":"Surface","design.color.text":"Text","design.color.muted":"Muted","design.color.background":"Page background","design.color.raised":"Raised background","design.color.border":"Divider","design.color.control":"Control border","design.color.action":"Action background","design.color.actionText":"Action text","design.color.focus":"Focus ring","design.color.success":"Success","design.color.warning":"Warning","design.color.danger":"Danger","design.type":"Typography","design.font":"Body font stack","design.mono":"Code font stack","design.radius":"Corner radius","design.radius.sm":"Small","design.radius.md":"Medium","design.radius.lg":"Large","design.notes":"Notes for the agent","design.notesHint":"Tone, layout rules, or brand guidance the agent reads before it designs.","design.saveWorkspace":"Save for this project","design.saveWorkspaceNamed":"Save for {name}","design.saveLibrary":"Save to library","design.clear":"Remove project override","design.saved":"Design system saved","design.preview":"Preview","design.previewHeading":"Quarterly review","design.previewBody":"Revenue grew in every region this quarter.","design.previewButton":"Primary action","card.created":"Created","card.updated":"Updated","card.working":"Writing the artifact...","card.failed":"The artifact was not saved","card.missing":"This result has no artifact details.","composer.label":"Artifacts","error.generic":"Something went wrong. Try again.","error.designInvalid":"The mockup source is not valid.","error.designIcon":"The mockup cannot use that icon.","error.designRender":"The mockup could not be rendered.","error.designTimeout":"The mockup took too long to render.","error.designUnavailable":"This runtime cannot render mockups.","error.unsupportedType":"That action is not available for this artifact.","error.notFound":"This artifact no longer exists.","error.stale":"The artifact changed. Reload to continue.","error.tooLarge":"The content is over the 2 MiB limit.","error.noWorkspace":"This session has no workspace.","error.forbidden":"That path is not allowed.","error.corrupt":"The artifact files are damaged.","error.tokens":"A design value is not valid CSS.","error.library":"The library folder cannot be created.","error.surface":"The artifact panel failed to draw.","error.surfaceHint":"Reload the window. Your artifacts are safe on disk.","action.retry":"Retry","action.reloadWindow":"Reload window","time.justNow":"just now","time.minutes":"{count} min ago","time.hours":"{count} h ago","time.days":"{count} d ago"},Mr={"agent.ask":"\u8BA9\u667A\u80FD\u4F53\u4FEE\u6539","agent.reference":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0Cv{version}\uFF09\u4E2D\uFF1A","agent.referenceOld":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0Cv{version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A v{current}\uFF09\u4E2D\uFF1A","agent.referenceProject":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0C\u5DE5\u4F5C\u533A {workspaceId}\uFF0Cv{version}\uFF09\u4E2D\uFF1A","agent.referenceOldProject":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0C\u5DE5\u4F5C\u533A {workspaceId}\uFF0Cv{version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A v{current}\uFF09\u4E2D\uFF1A","agent.added":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u63CF\u8FF0\u8981\u4FEE\u6539\u7684\u5185\u5BB9\u540E\u53D1\u9001\u3002","agent.addedTruncated":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u9009\u4E2D\u7684\u6587\u672C\u5DF2\u7F29\u77ED\u4E3A 2,000 \u4E2A\u5B57\u7B26\u3002","agent.insertFailed":"\u6D88\u606F\u6846\u6B63\u5FD9\uFF0C\u5DF2\u6539\u4E3A\u590D\u5236\u8BF7\u6C42\u3002","agent.copied":"\u5DF2\u590D\u5236\u3002\u7C98\u8D34\u5230\u5BF9\u8BDD\u4E2D\u540E\u53D1\u9001\u3002","agent.copyTitle":"\u590D\u5236\u8BF7\u6C42","card.creating":"\u6B63\u5728\u521B\u5EFA {title}","card.updating":"\u6B63\u5728\u66F4\u65B0 {title}","card.updatingUntitled":"\u6B63\u5728\u66F4\u65B0\u4EA7\u7269","card.openNamed":"\u6253\u5F00 {title}","tab.codeHint":"\u53EA\u8BFB\u4EE3\u7801\u3002\u9009\u4E2D\u6587\u672C\u5373\u53EF\u8BA9\u667A\u80FD\u4F53\u5904\u7406\u3002","tab.editSource":"\u7F16\u8F91\u4EE3\u7801","tab.deleteTitle":"\u79FB\u5230\u56DE\u6536\u7AD9\uFF1F","code.copy":"\u590D\u5236\u4EE3\u7801","dialog.close":"\u5173\u95ED","dialog.done":"\u5B8C\u6210","design.colorsDark":"\u6DF1\u8272\u914D\u8272","panel.layers":"\u56FE\u5C42","panel.properties":"\u5C5E\u6027","panel.none":"\u6CA1\u6709\u56FE\u5C42","panel.mixed":"\u6DF7\u5408","panel.expand":"\u5C55\u5F00","panel.collapse":"\u6298\u53E0","panel.show":"\u663E\u793A","panel.hide":"\u9690\u85CF","panel.lock":"\u9501\u5B9A","panel.unlock":"\u89E3\u9501","panel.rename":"\u91CD\u547D\u540D\u56FE\u5C42","panel.x":"X","panel.y":"Y","panel.rotation":"\u65CB\u8F6C","panel.radius":"\u5706\u89D2","panel.opacity":"\u4E0D\u900F\u660E\u5EA6","panel.visible":"\u53EF\u89C1","panel.hidden":"\u5DF2\u9690\u85CF","panel.family":"\u5B57\u4F53","panel.weight":"\u5B57\u91CD","panel.fontSize":"\u5B57\u53F7","panel.w":"\u5BBD","panel.h":"\u9AD8","panel.positionSize":"\u4F4D\u7F6E\u548C\u5C3A\u5BF8","panel.appearance":"\u5916\u89C2","panel.text":"\u6587\u672C","panel.selectLayerHint":"\u9009\u62E9\u4E00\u4E2A\u56FE\u5C42\u4EE5\u67E5\u770B\u5176\u5C5E\u6027\u3002","panel.selectTextHint":"\u9009\u62E9\u6587\u672C\u56FE\u5C42\u53EF\u4FEE\u6539\u5B57\u4F53\u3001\u5B57\u91CD\u548C\u5B57\u53F7\u3002","layer.parentLine":"{type}\uFF0C\u4F4D\u4E8E {parent}","layer.type.frame":"\u6846\u67B6","layer.type.section":"\u5206\u533A","layer.type.text":"\u6587\u672C","layer.type.rectangle":"\u77E9\u5F62","layer.type.ellipse":"\u692D\u5706","layer.type.line":"\u7EBF","layer.type.vector":"\u77E2\u91CF","layer.type.group":"\u7F16\u7EC4","layer.type.component":"\u7EC4\u4EF6","layer.type.instance":"\u5B9E\u4F8B","layer.type.other":"\u56FE\u5C42","canvas.viewMode":"\u67E5\u770B","canvas.editMode":"\u7F16\u8F91","canvas.opening":"\u6B63\u5728\u6253\u5F00\u753B\u5E03\u2026","canvas.startFailed":"\u753B\u5E03\u672A\u80FD\u542F\u52A8\uFF0C\u73B0\u663E\u793A\u5DF2\u4FDD\u5B58\u7684\u56FE\u7247\u3002","canvas.empty":"\u6B64\u539F\u578B\u8FD8\u6CA1\u6709\u56FE\u5C42\u3002\u5207\u6362\u5230\u7F16\u8F91\u6A21\u5F0F\u5373\u53EF\u7ED8\u5236\u3002","canvas.zoomControls":"\u7F29\u653E","canvas.zoomOut":"\u7F29\u5C0F","canvas.zoomIn":"\u653E\u5927","canvas.zoomMenu":"\u7F29\u653E\u7EA7\u522B","canvas.zoomValue":"{percent}%","canvas.inspector":"\u68C0\u67E5\u5668","canvas.closeInspector":"\u5173\u95ED\u68C0\u67E5\u5668","canvas.inspectorTabs":"\u68C0\u67E5\u5668\u5206\u533A","canvas.editOldVersion":"\u65E7\u7248\u672C\u4EC5\u53EF\u67E5\u770B\u3002\u6062\u590D\u6B64\u7248\u672C\u540E\u624D\u80FD\u7F16\u8F91\u3002","agent.quoteDesign":`\u56FE\u5C42\u201C{name}\u201D
26
26
  \u8DEF\u5F84\uFF1A{path}
27
27
 
28
- \u8BBE\u8BA1 JSX\uFF1A`,"agent.quoteCut":"\u8BBE\u8BA1 JSX \u5DF2\u7F29\u77ED\u4E3A {limit} \u4E2A\u5B57\u7B26\u3002","agent.addedTruncatedDesign":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u56FE\u5C42\u4EE3\u7801\u5DF2\u7F29\u77ED\u4E3A 4,000 \u4E2A\u5B57\u7B26\u3002","canvas.toolbar":"\u753B\u5E03\u5DE5\u5177","canvas.tools":"\u5DE5\u5177","canvas.select":"\u9009\u62E9","canvas.hand":"\u6293\u624B","canvas.frame":"\u6846\u67B6","canvas.text":"\u6587\u672C","canvas.undo":"\u64A4\u9500","canvas.redo":"\u91CD\u505A","canvas.fit":"\u9002\u5E94","preview.loading":"\u6B63\u5728\u6E32\u67D3\u539F\u578B\u2026","preview.retry":"\u91CD\u65B0\u6E32\u67D3","preview.warnings":"\u9884\u89C8\u8B66\u544A","error.designIconNotFound":"\u8BE5\u56FE\u6807\u4E0D\u5728\u5185\u7F6E\u56FE\u6807\u96C6\u4E2D\u3002\u8BF7\u4F7F\u7528 Material Design Icons \u7684 mdi: \u540D\u79F0\u3002","design.display":"\u6807\u9898\u5B57\u4F53\u6808","composer.recent":"\u5F53\u524D\u9879\u76EE","composer.empty":"\u8FD8\u6CA1\u6709\u4EA7\u7269","composer.start":"\u4ECE\u8FD9\u91CC\u5F00\u59CB","composer.all":"\u5168\u90E8\u4EA7\u7269","gallery.copyPrompt":"\u590D\u5236\u63D0\u793A\u8BCD","gallery.copyPromptNamed":"\u590D\u5236\u201C{name}\u201D\u63D0\u793A\u8BCD","gallery.promptCopied":"\u63D0\u793A\u8BCD\u5DF2\u590D\u5236\u3002\u7C98\u8D34\u5230\u5BF9\u8BDD\u4E2D\u5373\u53EF\u3002","prompt.dashboard":"\u4EEA\u8868\u76D8","prompt.dashboardText":"\u521B\u5EFA\u4E00\u4E2A artifact \u9875\u9762\uFF1A\u4E00\u4E2A\u4EEA\u8868\u76D8\uFF0C\u5C55\u793A","prompt.explainer":"\u56FE\u89E3\u8BF4\u660E","prompt.explainerText":"\u521B\u5EFA\u4E00\u4E2A artifact \u9875\u9762\uFF1A\u4E00\u9875\u53EF\u89C6\u5316\u8BF4\u660E\uFF0C\u4E3B\u9898\u662F","prompt.report":"\u62A5\u544A","prompt.reportText":"\u521B\u5EFA\u4E00\u4E2A artifact \u6587\u6863\uFF1A\u4E00\u4EFD\u62A5\u544A\uFF0C\u4E3B\u9898\u662F","prompt.brief":"\u9879\u76EE\u7B80\u4ECB","prompt.briefText":"\u521B\u5EFA\u4E00\u4E2A artifact \u6587\u6863\uFF1A\u4E00\u4EFD\u9879\u76EE\u7B80\u4ECB\uFF0C\u5305\u542B\u80CC\u666F\u3001\u76EE\u6807\u3001\u8303\u56F4\u548C\u5F85\u5B9A\u95EE\u9898\uFF0C\u9879\u76EE\u662F","filter.type":"\u6309\u7C7B\u578B\u7B5B\u9009","tab.mode":"\u9875\u9762\u89C6\u56FE","tab.manualSave":"\u9875\u9762\u6E90\u7801\u9700\u70B9\u51FB\u4FDD\u5B58\u6216\u6309 Ctrl/Cmd+S\u3002","tab.manualSaveDesign":"\u539F\u578B\u6E90\u7801\u9700\u70B9\u51FB\u4FDD\u5B58\u6216\u6309 Ctrl/Cmd+S\u3002","tab.versionPicker":"\u9009\u62E9\u7248\u672C","tab.currentVersion":"\u5F53\u524D","tab.allVersions":"\u5168\u90E8\u7248\u672C","tab.agentUpdate":"\u5DF2\u66F4\u65B0\u5230 v{version}","tab.viewHistory":"\u67E5\u770B\u5386\u53F2","tab.dismiss":"\u5173\u95ED","tab.leaveTitle":"\u4FDD\u7559\u66F4\u6539\uFF1F","tab.leaveHint":"\u7EE7\u7EED\u524D\u4FDD\u5B58\u66F4\u6539\uFF0C\u6216\u653E\u5F03\u66F4\u6539\u3002\u53D6\u6D88\u5C06\u4FDD\u7559\u5F53\u524D\u7F16\u8F91\u3002","tab.discardContinue":"\u653E\u5F03\u5E76\u7EE7\u7EED","tab.saveContinue":"\u4FDD\u5B58\u5E76\u7EE7\u7EED","tab.copyDraft":"\u590D\u5236\u6211\u7684\u8349\u7A3F","tab.discardReload":"\u653E\u5F03\u6211\u7684\u66F4\u6539\u5E76\u91CD\u65B0\u52A0\u8F7D","history.close":"\u5173\u95ED\u5386\u53F2","action.copied":"\u5DF2\u590D\u5236","action.copyFailed":"\u590D\u5236\u88AB\u963B\u6B62\u3002\u8BF7\u9009\u4E2D\u6587\u672C\u540E\u624B\u52A8\u590D\u5236\u3002","format.toolbar":"\u6587\u6863\u683C\u5F0F","format.heading":"\u6807\u9898","format.bold":"\u7C97\u4F53","format.italic":"\u659C\u4F53","format.bulletList":"\u9879\u76EE\u7B26\u53F7\u5217\u8868","format.orderedList":"\u7F16\u53F7\u5217\u8868","format.codeBlock":"\u4EE3\u7801\u5757",panel:"\u4EA7\u7269","action.back":"\u8FD4\u56DE","scope.label":"\u8303\u56F4","scope.all":"\u5168\u90E8\u9879\u76EE","scope.workspace":"\u5F53\u524D\u9879\u76EE","scope.library":"\u8D44\u6599\u5E93","type.page":"\u9875\u9762","type.doc":"\u6587\u6863","type.design":"\u539F\u578B","type.all":"\u5168\u90E8\u7C7B\u578B","gallery.search":"\u641C\u7D22\u4EA7\u7269","gallery.searchLabel":"\u6309\u6807\u9898\u641C\u7D22","gallery.create":"\u65B0\u5EFA\u4EA7\u7269","gallery.newPage":"\u65B0\u5EFA\u9875\u9762","gallery.newDoc":"\u65B0\u5EFA\u6587\u6863","gallery.newDesign":"\u65B0\u5EFA\u539F\u578B","gallery.design":"\u8BBE\u8BA1\u7CFB\u7EDF","gallery.refresh":"\u5237\u65B0","gallery.more":"\u663E\u793A\u66F4\u591A","gallery.truncated":"\u4EC5\u626B\u63CF\u524D 500 \u4E2A\u4EA7\u7269\u3002","gallery.failedProjects":"\u90E8\u5206\u6765\u6E90\u52A0\u8F7D\u5931\u8D25\u3002","gallery.version":"v{version}","gallery.updated":"\u66F4\u65B0\u4E8E {time}","gallery.count":"{count} \u4E2A\u4EA7\u7269","gallery.pinned":"\u5DF2\u7F6E\u9876","gallery.recent":"\u6700\u8FD1\u66F4\u65B0","gallery.coverTitle":"{title} \u7684\u9884\u89C8","gallery.coverFailed":"\u9884\u89C8\u4E0D\u53EF\u7528","gallery.pin":"\u7F6E\u9876 {title}","gallery.unpin":"\u53D6\u6D88\u7F6E\u9876 {title}","gallery.allPinned":"\u8FD9\u91CC\u7684\u4EA7\u7269\u90FD\u5DF2\u7F6E\u9876\u3002","empty.workspaceTitle":"\u672C\u9879\u76EE\u8FD8\u6CA1\u6709\u4EA7\u7269","empty.workspaceHint":"\u8BA9\u667A\u80FD\u4F53\u751F\u6210\u4EEA\u8868\u76D8\u3001\u62A5\u544A\u6216\u5355\u9875\uFF0C\u6216\u5728\u8FD9\u91CC\u65B0\u5EFA\u3002","empty.allTitle":"\u8FD8\u6CA1\u6709\u4EA7\u7269","empty.allHint":"\u8FD9\u91CC\u663E\u793A\u6240\u6709\u9879\u76EE\u548C\u8D44\u6599\u5E93\u4E2D\u7684\u4EA7\u7269\u3002","empty.libraryTitle":"\u8D44\u6599\u5E93\u4E3A\u7A7A","empty.libraryHint":"\u8D44\u6599\u5E93\u4E2D\u7684\u4EA7\u7269\u5728\u6240\u6709\u9879\u76EE\u53EF\u7528\u3002\u8BA9\u667A\u80FD\u4F53\u628A\u4EA7\u7269\u4FDD\u5B58\u5230\u8D44\u6599\u5E93\u3002","empty.noMatch":"\u6CA1\u6709\u5339\u914D\u7684\u4EA7\u7269\u3002","empty.typeMatch":"\u6CA1\u6709\u7B26\u5408\u7C7B\u578B\u7B5B\u9009\u7684{type}\u4EA7\u7269\u3002","empty.noWorkspace":"\u5728\u5DE5\u4F5C\u533A\u4E2D\u6253\u5F00\u4F1A\u8BDD\u4EE5\u67E5\u770B\u5176\u4EA7\u7269\u3002","empty.loading":"\u52A0\u8F7D\u4E2D...","create.title":"\u65B0\u5EFA{type}","create.name":"\u6807\u9898","create.scope":"\u4FDD\u5B58\u5230","create.submit":"\u521B\u5EFA","create.cancel":"\u53D6\u6D88","create.untitledPage":"\u672A\u547D\u540D\u9875\u9762","create.untitledDesign":"\u672A\u547D\u540D\u539F\u578B","create.untitledDoc":"\u672A\u547D\u540D\u6587\u6863","tab.preview":"\u9884\u89C8","tab.source":"\u4EE3\u7801","tab.history":"\u5386\u53F2","tab.export":"\u5BFC\u51FA","tab.reload":"\u91CD\u65B0\u52A0\u8F7D","tab.rename":"\u91CD\u547D\u540D","tab.delete":"\u79FB\u5230\u56DE\u6536\u7AD9","tab.deleteConfirm":"\u201C{title}\u201D\u5C06\u79FB\u5230\u56DE\u6536\u7AD9\uFF0C\u6587\u4EF6\u4F1A\u4FDD\u7559 7 \u5929\u3002","tab.save":"\u4FDD\u5B58","tab.saving":"\u6B63\u5728\u4FDD\u5B58...","tab.saved":"\u5DF2\u4FDD\u5B58","tab.readOnly":"\u53EA\u8BFB","tab.saveFailed":"\u4FDD\u5B58\u5931\u8D25","tab.unsaved":"\u6709\u672A\u4FDD\u5B58\u7684\u66F4\u6539","tab.frameTitle":"\u4EA7\u7269\u9884\u89C8\uFF1A{title}","tab.versionOf":"\u7248\u672C {version}","tab.viewingOld":"\u6B63\u5728\u67E5\u770B\u7248\u672C {version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A {current}\u3002","tab.backToCurrent":"\u56DE\u5230\u5F53\u524D\u7248\u672C","tab.restoreThis":"\u6062\u590D\u6B64\u7248\u672C","tab.conflictTitle":"\u6B64\u4EA7\u7269\u5DF2\u66F4\u6539","tab.conflictHint":"\u7F16\u8F91\u671F\u95F4\u4FDD\u5B58\u4E86\u66F4\u65B0\u7248\u672C\u3002\u8349\u7A3F\u4ECD\u4FDD\u7559\u5728\u8FD9\u91CC\u3002\u653E\u5F03\u524D\u53EF\u5148\u590D\u5236\u8349\u7A3F\uFF0C\u518D\u91CD\u65B0\u52A0\u8F7D\u6700\u65B0\u7248\u672C\u3002","tab.deleted":"\u6B64\u4EA7\u7269\u5DF2\u4E0D\u5B58\u5728","tab.deletedHint":"\u5B83\u5DF2\u88AB\u79FB\u5230\u56DE\u6536\u7AD9\u6216\u5220\u9664\u3002","tab.close":"\u5173\u95ED\u6807\u7B7E\u9875","history.title":"\u7248\u672C","history.current":"\u5F53\u524D","history.byAgent":"\u667A\u80FD\u4F53","history.byUser":"\u4F60","history.restored":"\u4ECE v{version} \u6062\u590D","history.created":"\u521B\u5EFA","history.updated":"\u7F16\u8F91","history.empty":"\u6CA1\u6709\u66F4\u65E9\u7684\u7248\u672C\u3002","export.html":"HTML \u6587\u4EF6","export.png":"PNG \u56FE\u7247","export.svg":"SVG \u56FE\u7247","export.fig":"OpenPencil \u6587\u6863\uFF08.fig\uFF09","export.md":"Markdown \u6587\u4EF6","export.docx":"Word \u6587\u6863","export.print":"\u6253\u5370\u6216\u53E6\u5B58\u4E3A PDF","export.done":"\u5DF2\u5C06 {name} \u4FDD\u5B58\u5230 {path}","design.title":"\u8BBE\u8BA1\u7CFB\u7EDF","design.hint":"\u9875\u9762\u548C\u6587\u6863\u901A\u8FC7 CSS \u53D8\u91CF\u4F7F\u7528\u8FD9\u4E9B\u503C\u3002","design.source.workspace":"\u672C\u9879\u76EE\u8986\u76D6\u4E86\u8D44\u6599\u5E93\u8BBE\u7F6E\u3002","design.source.library":"\u7EE7\u627F\u81EA\u8D44\u6599\u5E93\u3002","design.source.default":"\u5185\u7F6E\u9ED8\u8BA4\u503C\u3002\u4FDD\u5B58\u540E\u5373\u53EF\u81EA\u5B9A\u4E49\u3002","design.name":"\u540D\u79F0","design.colors":"\u989C\u8272","design.color.primary":"\u4E3B\u8272","design.color.accent":"\u5F3A\u8C03\u8272","design.color.surface":"\u5E95\u8272","design.color.text":"\u6587\u5B57","design.color.muted":"\u6B21\u8981","design.type":"\u5B57\u4F53","design.font":"\u6B63\u6587\u5B57\u4F53","design.mono":"\u4EE3\u7801\u5B57\u4F53","design.radius":"\u5706\u89D2","design.radius.sm":"\u5C0F","design.radius.md":"\u4E2D","design.radius.lg":"\u5927","design.notes":"\u7ED9\u667A\u80FD\u4F53\u7684\u8BF4\u660E","design.notesHint":"\u667A\u80FD\u4F53\u8BBE\u8BA1\u524D\u4F1A\u8BFB\u53D6\u7684\u8BED\u6C14\u3001\u6392\u7248\u89C4\u5219\u6216\u54C1\u724C\u89C4\u8303\u3002","design.saveWorkspace":"\u4FDD\u5B58\u5230\u672C\u9879\u76EE","design.saveWorkspaceNamed":"\u4FDD\u5B58\u5230 {name}","design.saveLibrary":"\u4FDD\u5B58\u5230\u8D44\u6599\u5E93","design.clear":"\u79FB\u9664\u9879\u76EE\u8986\u76D6","design.saved":"\u8BBE\u8BA1\u7CFB\u7EDF\u5DF2\u4FDD\u5B58","design.preview":"\u9884\u89C8","design.previewHeading":"\u5B63\u5EA6\u56DE\u987E","design.previewBody":"\u672C\u5B63\u5EA6\u5404\u533A\u57DF\u6536\u5165\u5747\u6709\u589E\u957F\u3002","design.previewButton":"\u4E3B\u8981\u64CD\u4F5C","card.created":"\u5DF2\u521B\u5EFA","card.updated":"\u5DF2\u66F4\u65B0","card.working":"\u6B63\u5728\u5199\u5165\u4EA7\u7269...","card.failed":"\u4EA7\u7269\u672A\u4FDD\u5B58","card.missing":"\u6B64\u7ED3\u679C\u6CA1\u6709\u4EA7\u7269\u4FE1\u606F\u3002","composer.label":"\u4EA7\u7269","error.generic":"\u51FA\u9519\u4E86\uFF0C\u8BF7\u91CD\u8BD5\u3002","error.designInvalid":"\u539F\u578B\u6E90\u7801\u65E0\u6548\u3002","error.designIcon":"\u8BE5\u539F\u578B\u65E0\u6CD5\u4F7F\u7528\u6B64\u56FE\u6807\u3002","error.designRender":"\u539F\u578B\u65E0\u6CD5\u6E32\u67D3\u3002","error.designTimeout":"\u539F\u578B\u6E32\u67D3\u8D85\u65F6\u3002","error.designUnavailable":"\u6B64\u8FD0\u884C\u65F6\u65E0\u6CD5\u6E32\u67D3\u539F\u578B\u3002","error.unsupportedType":"\u8BE5\u4EA7\u7269\u4E0D\u652F\u6301\u6B64\u64CD\u4F5C\u3002","error.notFound":"\u6B64\u4EA7\u7269\u5DF2\u4E0D\u5B58\u5728\u3002","error.stale":"\u4EA7\u7269\u5DF2\u66F4\u6539\uFF0C\u8BF7\u91CD\u65B0\u52A0\u8F7D\u3002","error.tooLarge":"\u5185\u5BB9\u8D85\u8FC7 2 MiB \u4E0A\u9650\u3002","error.noWorkspace":"\u6B64\u4F1A\u8BDD\u6CA1\u6709\u5DE5\u4F5C\u533A\u3002","error.forbidden":"\u4E0D\u5141\u8BB8\u8BBF\u95EE\u8BE5\u8DEF\u5F84\u3002","error.corrupt":"\u4EA7\u7269\u6587\u4EF6\u5DF2\u635F\u574F\u3002","error.tokens":"\u67D0\u4E2A\u8BBE\u8BA1\u503C\u4E0D\u662F\u6709\u6548\u7684 CSS\u3002","error.library":"\u65E0\u6CD5\u521B\u5EFA\u8D44\u6599\u5E93\u6587\u4EF6\u5939\u3002","error.surface":"\u4EA7\u7269\u9762\u677F\u7ED8\u5236\u5931\u8D25\u3002","error.surfaceHint":"\u8BF7\u91CD\u65B0\u52A0\u8F7D\u7A97\u53E3\u3002\u4F60\u7684\u4EA7\u7269\u4ECD\u5B89\u5168\u4FDD\u5B58\u5728\u78C1\u76D8\u4E0A\u3002","action.retry":"\u91CD\u8BD5","action.reloadWindow":"\u91CD\u65B0\u52A0\u8F7D\u7A97\u53E3","time.justNow":"\u521A\u521A","time.minutes":"{count} \u5206\u949F\u524D","time.hours":"{count} \u5C0F\u65F6\u524D","time.days":"{count} \u5929\u524D"};function Lt(e,t,a=Date.now()){let r=Math.max(0,a-Date.parse(t)),n=Math.floor(r/6e4);if(n<1)return e("time.justNow");if(n<60)return e("time.minutes",{count:n});let o=Math.floor(n/60);if(o<24)return e("time.hours",{count:o});let l=Math.floor(o/24);return l<7?e("time.days",{count:l}):new Date(t).toLocaleDateString()}var pe=require("react/jsx-runtime");function uo(e,t){let a=t.source.origin==="agent"?e("history.byAgent"):e("history.byUser"),r=t.source.action==="restore"&&t.source.restoredFrom!==void 0?e("history.restored",{version:t.source.restoredFrom}):t.source.action==="create"?e("history.created"):e("history.updated");return`${a} \xB7 ${r} \xB7 ${Lt(e,t.createdAt)}`}function Ar({t:e,versions:t,failed:a,current:r,selected:n,onSelect:o}){return(0,pe.jsxs)("div",{className:"art-history-body",children:[t===null?(0,pe.jsx)("p",{className:"art-note",children:e("empty.loading")}):null,a?(0,pe.jsx)("p",{className:"art-note",children:e("error.generic")}):null,!a&&t!==null&&t.length<=1?(0,pe.jsx)("p",{className:"art-note",children:e("history.empty")}):null,t?.map(l=>(0,pe.jsxs)("button",{type:"button",className:"art-version","aria-current":l.version===n?"true":void 0,onClick:()=>o(l.version),children:[(0,pe.jsxs)("span",{className:"art-version-top",children:[(0,pe.jsx)("span",{children:e("tab.versionOf",{version:l.version})}),l.version===r?(0,pe.jsx)("span",{className:"art-badge",children:e("history.current")}):null]}),(0,pe.jsx)("span",{className:"art-version-sub",children:uo(e,l)})]},l.version))]})}var ye=require("react");var Ae=require("react/jsx-runtime");function Ot({content:e,designCss:t,title:a,frameTitle:r,dark:n=!1,onSelectionText:o}){let[l,s]=(0,ye.useState)(null),[g,d]=(0,ye.useState)(!1),b=(0,ye.useRef)(0),T=(0,ye.useRef)(null),w=(0,ye.useRef)(o);w.current=o;let c=o!==void 0;return(0,ye.useEffect)(()=>{b.current=0,d(!1);let u=URL.createObjectURL(new Blob([Mt(e,t,a,n?"dark":"light",c)],{type:"text/html"}));return s(u),()=>URL.revokeObjectURL(u)},[e,t,a,n,c]),(0,ye.useEffect)(()=>{if(!c)return;let u=p=>{if(T.current===null||b.current>1||p.source!==T.current.contentWindow)return;let y=Cr(p.data);y!==void 0&&w.current?.(y)};return window.addEventListener("message",u),()=>window.removeEventListener("message",u)},[c]),g?(0,Ae.jsx)("div",{className:"art-center",role:"alert",children:a}):l===null?null:(0,Ae.jsx)("iframe",{ref:T,className:"art-frame",title:r,sandbox:Nr,referrerPolicy:"no-referrer",src:l,onLoad:()=>{b.current+=1,b.current>1&&d(!0)}},l)}function zr({value:e,readOnly:t,label:a,hint:r,onChange:n,onSave:o,onSelectionText:l}){let s=g=>{t||l?.(g.value.slice(g.selectionStart,g.selectionEnd))};return(0,Ae.jsxs)("div",{className:"art-source-wrap",children:[r===void 0?null:(0,Ae.jsx)("div",{className:"art-code-bar",children:(0,Ae.jsx)("span",{children:r})}),(0,Ae.jsx)("textarea",{className:"art-source","aria-label":a,spellCheck:!1,readOnly:t,value:e,autoFocus:!t,onChange:g=>{n(g.target.value),l?.("")},onSelect:g=>s(g.currentTarget),onMouseUp:g=>s(g.currentTarget),onKeyUp:g=>s(g.currentTarget),onKeyDown:g=>{if((g.ctrlKey||g.metaKey)&&g.key.toLowerCase()==="s"){g.preventDefault(),o();return}if(g.key==="Tab"&&!g.shiftKey&&!t){g.preventDefault();let d=g.currentTarget,b=d.selectionStart,T=d.selectionEnd,w=e.slice(0,b)+" "+e.slice(T);n(w),requestAnimationFrame(()=>d.setSelectionRange(b+2,b+2))}}})]})}function ma(e,t=2e3){let a=e.replace(/\r\n/g,`
28
+ \u8BBE\u8BA1 JSX\uFF1A`,"agent.quoteCut":"\u8BBE\u8BA1 JSX \u5DF2\u7F29\u77ED\u4E3A {limit} \u4E2A\u5B57\u7B26\u3002","agent.addedTruncatedDesign":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u56FE\u5C42\u4EE3\u7801\u5DF2\u7F29\u77ED\u4E3A 4,000 \u4E2A\u5B57\u7B26\u3002","canvas.toolbar":"\u753B\u5E03\u5DE5\u5177","canvas.tools":"\u5DE5\u5177","canvas.select":"\u9009\u62E9","canvas.hand":"\u6293\u624B","canvas.frame":"\u6846\u67B6","canvas.text":"\u6587\u672C","canvas.undo":"\u64A4\u9500","canvas.redo":"\u91CD\u505A","canvas.fit":"\u9002\u5E94","preview.loading":"\u6B63\u5728\u6E32\u67D3\u539F\u578B\u2026","preview.retry":"\u91CD\u65B0\u6E32\u67D3","preview.warnings":"\u9884\u89C8\u8B66\u544A","error.designIconNotFound":"\u8BE5\u56FE\u6807\u4E0D\u5728\u5185\u7F6E\u56FE\u6807\u96C6\u4E2D\u3002\u8BF7\u4F7F\u7528 Material Design Icons \u7684 mdi: \u540D\u79F0\u3002","design.display":"\u6807\u9898\u5B57\u4F53\u6808","composer.recent":"\u5F53\u524D\u9879\u76EE","composer.empty":"\u8FD8\u6CA1\u6709\u4EA7\u7269","composer.start":"\u4ECE\u8FD9\u91CC\u5F00\u59CB","composer.all":"\u5168\u90E8\u4EA7\u7269","gallery.copyPrompt":"\u590D\u5236\u63D0\u793A\u8BCD","gallery.copyPromptNamed":"\u590D\u5236\u201C{name}\u201D\u63D0\u793A\u8BCD","gallery.promptCopied":"\u63D0\u793A\u8BCD\u5DF2\u590D\u5236\u3002\u7C98\u8D34\u5230\u5BF9\u8BDD\u4E2D\u5373\u53EF\u3002","prompt.dashboard":"\u4EEA\u8868\u76D8","prompt.dashboardText":"\u521B\u5EFA\u4E00\u4E2A artifact \u9875\u9762\uFF1A\u4E00\u4E2A\u4EEA\u8868\u76D8\uFF0C\u5C55\u793A","prompt.explainer":"\u56FE\u89E3\u8BF4\u660E","prompt.explainerText":"\u521B\u5EFA\u4E00\u4E2A artifact \u9875\u9762\uFF1A\u4E00\u9875\u53EF\u89C6\u5316\u8BF4\u660E\uFF0C\u4E3B\u9898\u662F","prompt.report":"\u62A5\u544A","prompt.reportText":"\u521B\u5EFA\u4E00\u4E2A artifact \u6587\u6863\uFF1A\u4E00\u4EFD\u62A5\u544A\uFF0C\u4E3B\u9898\u662F","prompt.brief":"\u9879\u76EE\u7B80\u4ECB","prompt.briefText":"\u521B\u5EFA\u4E00\u4E2A artifact \u6587\u6863\uFF1A\u4E00\u4EFD\u9879\u76EE\u7B80\u4ECB\uFF0C\u5305\u542B\u80CC\u666F\u3001\u76EE\u6807\u3001\u8303\u56F4\u548C\u5F85\u5B9A\u95EE\u9898\uFF0C\u9879\u76EE\u662F","filter.type":"\u6309\u7C7B\u578B\u7B5B\u9009","tab.mode":"\u9875\u9762\u89C6\u56FE","tab.manualSave":"\u9875\u9762\u6E90\u7801\u9700\u70B9\u51FB\u4FDD\u5B58\u6216\u6309 Ctrl/Cmd+S\u3002","tab.manualSaveDesign":"\u539F\u578B\u6E90\u7801\u9700\u70B9\u51FB\u4FDD\u5B58\u6216\u6309 Ctrl/Cmd+S\u3002","tab.versionPicker":"\u9009\u62E9\u7248\u672C","tab.currentVersion":"\u5F53\u524D","tab.allVersions":"\u5168\u90E8\u7248\u672C","tab.agentUpdate":"\u5DF2\u66F4\u65B0\u5230 v{version}","tab.viewHistory":"\u67E5\u770B\u5386\u53F2","tab.dismiss":"\u5173\u95ED","tab.leaveTitle":"\u672A\u4FDD\u5B58\u7684\u66F4\u6539","tab.leaveHint":"\u7EE7\u7EED\u524D\u4FDD\u5B58\u66F4\u6539\uFF0C\u6216\u653E\u5F03\u5B83\u4EEC\u3002","tab.leaveDiscard":"\u653E\u5F03","tab.leaveSave":"\u4FDD\u5B58","tab.copyDraft":"\u590D\u5236\u6211\u7684\u8349\u7A3F","tab.discardReload":"\u653E\u5F03\u6211\u7684\u66F4\u6539\u5E76\u91CD\u65B0\u52A0\u8F7D","history.close":"\u5173\u95ED\u5386\u53F2","action.copied":"\u5DF2\u590D\u5236","action.copyFailed":"\u590D\u5236\u88AB\u963B\u6B62\u3002\u8BF7\u9009\u4E2D\u6587\u672C\u540E\u624B\u52A8\u590D\u5236\u3002","format.toolbar":"\u6587\u6863\u683C\u5F0F","format.heading":"\u6807\u9898","format.bold":"\u7C97\u4F53","format.italic":"\u659C\u4F53","format.bulletList":"\u9879\u76EE\u7B26\u53F7\u5217\u8868","format.orderedList":"\u7F16\u53F7\u5217\u8868","format.codeBlock":"\u4EE3\u7801\u5757",panel:"\u4EA7\u7269","right.guideHint":"\u6B64\u9879\u76EE\u4E2D\u7684\u9875\u9762\u3001\u6587\u6863\u548C\u539F\u578B\u3002","action.back":"\u8FD4\u56DE","scope.label":"\u8303\u56F4","scope.all":"\u5168\u90E8\u9879\u76EE","scope.workspace":"\u5F53\u524D\u9879\u76EE","scope.library":"\u8D44\u6599\u5E93","type.page":"\u9875\u9762","type.doc":"\u6587\u6863","type.design":"\u539F\u578B","type.all":"\u5168\u90E8\u7C7B\u578B","gallery.search":"\u641C\u7D22\u4EA7\u7269","gallery.searchLabel":"\u6309\u6807\u9898\u641C\u7D22","gallery.create":"\u65B0\u5EFA\u4EA7\u7269","gallery.newPage":"\u65B0\u5EFA\u9875\u9762","gallery.newDoc":"\u65B0\u5EFA\u6587\u6863","gallery.newDesign":"\u65B0\u5EFA\u539F\u578B","gallery.design":"\u8BBE\u8BA1\u7CFB\u7EDF","gallery.refresh":"\u5237\u65B0","gallery.more":"\u663E\u793A\u66F4\u591A","gallery.truncated":"\u4EC5\u626B\u63CF\u524D 500 \u4E2A\u4EA7\u7269\u3002","gallery.failedProjects":"\u90E8\u5206\u6765\u6E90\u52A0\u8F7D\u5931\u8D25\u3002","gallery.version":"v{version}","gallery.updated":"\u66F4\u65B0\u4E8E {time}","gallery.count":"{count} \u4E2A\u4EA7\u7269","gallery.pinned":"\u5DF2\u7F6E\u9876","gallery.recent":"\u6700\u8FD1\u66F4\u65B0","gallery.coverTitle":"{title} \u7684\u9884\u89C8","gallery.coverFailed":"\u9884\u89C8\u4E0D\u53EF\u7528","gallery.pin":"\u7F6E\u9876 {title}","gallery.unpin":"\u53D6\u6D88\u7F6E\u9876 {title}","gallery.allPinned":"\u8FD9\u91CC\u7684\u4EA7\u7269\u90FD\u5DF2\u7F6E\u9876\u3002","empty.workspaceTitle":"\u672C\u9879\u76EE\u8FD8\u6CA1\u6709\u4EA7\u7269","empty.workspaceHint":"\u8BA9\u667A\u80FD\u4F53\u751F\u6210\u4EEA\u8868\u76D8\u3001\u62A5\u544A\u6216\u5355\u9875\uFF0C\u6216\u5728\u8FD9\u91CC\u65B0\u5EFA\u3002","empty.allTitle":"\u8FD8\u6CA1\u6709\u4EA7\u7269","empty.allHint":"\u8FD9\u91CC\u663E\u793A\u6240\u6709\u9879\u76EE\u548C\u8D44\u6599\u5E93\u4E2D\u7684\u4EA7\u7269\u3002","empty.libraryTitle":"\u8D44\u6599\u5E93\u4E3A\u7A7A","empty.libraryHint":"\u8D44\u6599\u5E93\u4E2D\u7684\u4EA7\u7269\u5728\u6240\u6709\u9879\u76EE\u53EF\u7528\u3002\u8BA9\u667A\u80FD\u4F53\u628A\u4EA7\u7269\u4FDD\u5B58\u5230\u8D44\u6599\u5E93\u3002","empty.noMatch":"\u6CA1\u6709\u5339\u914D\u7684\u4EA7\u7269\u3002","empty.typeMatch":"\u6CA1\u6709\u7B26\u5408\u7C7B\u578B\u7B5B\u9009\u7684{type}\u4EA7\u7269\u3002","empty.noWorkspace":"\u5728\u5DE5\u4F5C\u533A\u4E2D\u6253\u5F00\u4F1A\u8BDD\u4EE5\u67E5\u770B\u5176\u4EA7\u7269\u3002","empty.loading":"\u52A0\u8F7D\u4E2D...","create.title":"\u65B0\u5EFA{type}","create.name":"\u6807\u9898","create.scope":"\u4FDD\u5B58\u5230","create.submit":"\u521B\u5EFA","create.cancel":"\u53D6\u6D88","create.untitledPage":"\u672A\u547D\u540D\u9875\u9762","create.untitledDesign":"\u672A\u547D\u540D\u539F\u578B","create.untitledDoc":"\u672A\u547D\u540D\u6587\u6863","tab.preview":"\u9884\u89C8","tab.source":"\u4EE3\u7801","tab.history":"\u5386\u53F2","tab.export":"\u5BFC\u51FA","tab.reload":"\u91CD\u65B0\u52A0\u8F7D","tab.rename":"\u91CD\u547D\u540D","tab.delete":"\u79FB\u5230\u56DE\u6536\u7AD9","tab.deleteConfirm":"\u201C{title}\u201D\u5C06\u79FB\u5230\u56DE\u6536\u7AD9\uFF0C\u6587\u4EF6\u4F1A\u4FDD\u7559 7 \u5929\u3002","tab.save":"\u4FDD\u5B58","tab.saving":"\u6B63\u5728\u4FDD\u5B58...","tab.saved":"\u5DF2\u4FDD\u5B58","tab.readOnly":"\u53EA\u8BFB","tab.saveFailed":"\u4FDD\u5B58\u5931\u8D25","tab.unsaved":"\u6709\u672A\u4FDD\u5B58\u7684\u66F4\u6539","tab.frameTitle":"\u4EA7\u7269\u9884\u89C8\uFF1A{title}","tab.versionOf":"\u7248\u672C {version}","tab.viewingOld":"\u6B63\u5728\u67E5\u770B\u7248\u672C {version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A {current}\u3002","tab.backToCurrent":"\u56DE\u5230\u5F53\u524D\u7248\u672C","tab.restoreThis":"\u6062\u590D\u6B64\u7248\u672C","tab.conflictTitle":"\u6B64\u4EA7\u7269\u5DF2\u66F4\u6539","tab.conflictHint":"\u7F16\u8F91\u671F\u95F4\u4FDD\u5B58\u4E86\u66F4\u65B0\u7248\u672C\u3002\u8349\u7A3F\u4ECD\u4FDD\u7559\u5728\u8FD9\u91CC\u3002\u653E\u5F03\u524D\u53EF\u5148\u590D\u5236\u8349\u7A3F\uFF0C\u518D\u91CD\u65B0\u52A0\u8F7D\u6700\u65B0\u7248\u672C\u3002","tab.deleted":"\u6B64\u4EA7\u7269\u5DF2\u4E0D\u5B58\u5728","tab.deletedHint":"\u5B83\u5DF2\u88AB\u79FB\u5230\u56DE\u6536\u7AD9\u6216\u5220\u9664\u3002","tab.close":"\u5173\u95ED\u6807\u7B7E\u9875","history.title":"\u7248\u672C","history.current":"\u5F53\u524D","history.byAgent":"\u667A\u80FD\u4F53","history.byUser":"\u4F60","history.restored":"\u4ECE v{version} \u6062\u590D","history.created":"\u521B\u5EFA","history.updated":"\u7F16\u8F91","history.empty":"\u6CA1\u6709\u66F4\u65E9\u7684\u7248\u672C\u3002","export.html":"HTML \u6587\u4EF6","export.png":"PNG \u56FE\u7247","export.svg":"SVG \u56FE\u7247","export.fig":"OpenPencil \u6587\u6863\uFF08.fig\uFF09","export.md":"Markdown \u6587\u4EF6","export.docx":"Word \u6587\u6863","export.print":"\u6253\u5370\u6216\u53E6\u5B58\u4E3A PDF","export.done":"\u5DF2\u5C06 {name} \u4FDD\u5B58\u5230 {path}","design.title":"\u8BBE\u8BA1\u7CFB\u7EDF","design.hint":"\u9875\u9762\u548C\u6587\u6863\u901A\u8FC7 CSS \u53D8\u91CF\u4F7F\u7528\u8FD9\u4E9B\u503C\u3002","design.source.workspace":"\u672C\u9879\u76EE\u8986\u76D6\u4E86\u8D44\u6599\u5E93\u8BBE\u7F6E\u3002","design.source.library":"\u7EE7\u627F\u81EA\u8D44\u6599\u5E93\u3002","design.source.default":"\u5185\u7F6E\u9ED8\u8BA4\u503C\u3002\u4FDD\u5B58\u540E\u5373\u53EF\u81EA\u5B9A\u4E49\u3002","design.name":"\u540D\u79F0","design.colors":"\u989C\u8272","design.color.primary":"\u4E3B\u8272","design.color.accent":"\u5F3A\u8C03\u8272","design.color.surface":"\u5E95\u8272","design.color.text":"\u6587\u5B57","design.color.muted":"\u6B21\u8981","design.color.background":"\u9875\u9762\u80CC\u666F","design.color.raised":"\u6B21\u7EA7\u80CC\u666F","design.color.border":"\u5206\u9694\u7EBF","design.color.control":"\u63A7\u4EF6\u8FB9\u6846","design.color.action":"\u64CD\u4F5C\u80CC\u666F","design.color.actionText":"\u64CD\u4F5C\u6587\u5B57","design.color.focus":"\u7126\u70B9\u8F6E\u5ED3","design.color.success":"\u6210\u529F","design.color.warning":"\u8B66\u544A","design.color.danger":"\u5371\u9669","design.type":"\u5B57\u4F53","design.font":"\u6B63\u6587\u5B57\u4F53","design.mono":"\u4EE3\u7801\u5B57\u4F53","design.radius":"\u5706\u89D2","design.radius.sm":"\u5C0F","design.radius.md":"\u4E2D","design.radius.lg":"\u5927","design.notes":"\u7ED9\u667A\u80FD\u4F53\u7684\u8BF4\u660E","design.notesHint":"\u667A\u80FD\u4F53\u8BBE\u8BA1\u524D\u4F1A\u8BFB\u53D6\u7684\u8BED\u6C14\u3001\u6392\u7248\u89C4\u5219\u6216\u54C1\u724C\u89C4\u8303\u3002","design.saveWorkspace":"\u4FDD\u5B58\u5230\u672C\u9879\u76EE","design.saveWorkspaceNamed":"\u4FDD\u5B58\u5230 {name}","design.saveLibrary":"\u4FDD\u5B58\u5230\u8D44\u6599\u5E93","design.clear":"\u79FB\u9664\u9879\u76EE\u8986\u76D6","design.saved":"\u8BBE\u8BA1\u7CFB\u7EDF\u5DF2\u4FDD\u5B58","design.preview":"\u9884\u89C8","design.previewHeading":"\u5B63\u5EA6\u56DE\u987E","design.previewBody":"\u672C\u5B63\u5EA6\u5404\u533A\u57DF\u6536\u5165\u5747\u6709\u589E\u957F\u3002","design.previewButton":"\u4E3B\u8981\u64CD\u4F5C","card.created":"\u5DF2\u521B\u5EFA","card.updated":"\u5DF2\u66F4\u65B0","card.working":"\u6B63\u5728\u5199\u5165\u4EA7\u7269...","card.failed":"\u4EA7\u7269\u672A\u4FDD\u5B58","card.missing":"\u6B64\u7ED3\u679C\u6CA1\u6709\u4EA7\u7269\u4FE1\u606F\u3002","composer.label":"\u4EA7\u7269","error.generic":"\u51FA\u9519\u4E86\uFF0C\u8BF7\u91CD\u8BD5\u3002","error.designInvalid":"\u539F\u578B\u6E90\u7801\u65E0\u6548\u3002","error.designIcon":"\u8BE5\u539F\u578B\u65E0\u6CD5\u4F7F\u7528\u6B64\u56FE\u6807\u3002","error.designRender":"\u539F\u578B\u65E0\u6CD5\u6E32\u67D3\u3002","error.designTimeout":"\u539F\u578B\u6E32\u67D3\u8D85\u65F6\u3002","error.designUnavailable":"\u6B64\u8FD0\u884C\u65F6\u65E0\u6CD5\u6E32\u67D3\u539F\u578B\u3002","error.unsupportedType":"\u8BE5\u4EA7\u7269\u4E0D\u652F\u6301\u6B64\u64CD\u4F5C\u3002","error.notFound":"\u6B64\u4EA7\u7269\u5DF2\u4E0D\u5B58\u5728\u3002","error.stale":"\u4EA7\u7269\u5DF2\u66F4\u6539\uFF0C\u8BF7\u91CD\u65B0\u52A0\u8F7D\u3002","error.tooLarge":"\u5185\u5BB9\u8D85\u8FC7 2 MiB \u4E0A\u9650\u3002","error.noWorkspace":"\u6B64\u4F1A\u8BDD\u6CA1\u6709\u5DE5\u4F5C\u533A\u3002","error.forbidden":"\u4E0D\u5141\u8BB8\u8BBF\u95EE\u8BE5\u8DEF\u5F84\u3002","error.corrupt":"\u4EA7\u7269\u6587\u4EF6\u5DF2\u635F\u574F\u3002","error.tokens":"\u67D0\u4E2A\u8BBE\u8BA1\u503C\u4E0D\u662F\u6709\u6548\u7684 CSS\u3002","error.library":"\u65E0\u6CD5\u521B\u5EFA\u8D44\u6599\u5E93\u6587\u4EF6\u5939\u3002","error.surface":"\u4EA7\u7269\u9762\u677F\u7ED8\u5236\u5931\u8D25\u3002","error.surfaceHint":"\u8BF7\u91CD\u65B0\u52A0\u8F7D\u7A97\u53E3\u3002\u4F60\u7684\u4EA7\u7269\u4ECD\u5B89\u5168\u4FDD\u5B58\u5728\u78C1\u76D8\u4E0A\u3002","action.retry":"\u91CD\u8BD5","action.reloadWindow":"\u91CD\u65B0\u52A0\u8F7D\u7A97\u53E3","time.justNow":"\u521A\u521A","time.minutes":"{count} \u5206\u949F\u524D","time.hours":"{count} \u5C0F\u65F6\u524D","time.days":"{count} \u5929\u524D"};function Ot(e,t,a=Date.now()){let r=Math.max(0,a-Date.parse(t)),n=Math.floor(r/6e4);if(n<1)return e("time.justNow");if(n<60)return e("time.minutes",{count:n});let o=Math.floor(n/60);if(o<24)return e("time.hours",{count:o});let l=Math.floor(o/24);return l<7?e("time.days",{count:l}):new Date(t).toLocaleDateString()}var ue=require("react/jsx-runtime");function yo(e,t){let a=t.source.origin==="agent"?e("history.byAgent"):e("history.byUser"),r=t.source.action==="restore"&&t.source.restoredFrom!==void 0?e("history.restored",{version:t.source.restoredFrom}):t.source.action==="create"?e("history.created"):e("history.updated");return`${a} \xB7 ${r} \xB7 ${Ot(e,t.createdAt)}`}function Or({t:e,versions:t,failed:a,current:r,selected:n,onSelect:o}){return(0,ue.jsxs)("div",{className:"art-history-body",children:[t===null?(0,ue.jsx)("p",{className:"art-note",children:e("empty.loading")}):null,a?(0,ue.jsx)("p",{className:"art-note",children:e("error.generic")}):null,!a&&t!==null&&t.length<=1?(0,ue.jsx)("p",{className:"art-note",children:e("history.empty")}):null,t?.map(l=>(0,ue.jsxs)("button",{type:"button",className:"art-version","aria-current":l.version===n?"true":void 0,onClick:()=>o(l.version),children:[(0,ue.jsxs)("span",{className:"art-version-top",children:[(0,ue.jsx)("span",{children:e("tab.versionOf",{version:l.version})}),l.version===r?(0,ue.jsx)("span",{className:"art-badge",children:e("history.current")}):null]}),(0,ue.jsx)("span",{className:"art-version-sub",children:yo(e,l)})]},l.version))]})}var be=require("react");var ze=require("react/jsx-runtime");function jt({content:e,designCss:t,title:a,frameTitle:r,dark:n=!1,onSelectionText:o}){let[l,s]=(0,be.useState)(null),[y,c]=(0,be.useState)(!1),h=(0,be.useRef)(0),v=(0,be.useRef)(null),x=(0,be.useRef)(o);x.current=o;let d=o!==void 0;return(0,be.useEffect)(()=>{h.current=0,c(!1);let p=URL.createObjectURL(new Blob([Mt(e,t,a,n?"dark":"light",d)],{type:"text/html"}));return s(p),()=>URL.revokeObjectURL(p)},[e,t,a,n,d]),(0,be.useEffect)(()=>{if(!d)return;let p=u=>{if(v.current===null||h.current>1||u.source!==v.current.contentWindow)return;let m=zr(u.data);m!==void 0&&x.current?.(m)};return window.addEventListener("message",p),()=>window.removeEventListener("message",p)},[d]),y?(0,ze.jsx)("div",{className:"art-center",role:"alert",children:a}):l===null?null:(0,ze.jsx)("iframe",{ref:v,className:"art-frame",title:r,sandbox:Dr,referrerPolicy:"no-referrer",src:l,onLoad:()=>{h.current+=1,h.current>1&&c(!0)}},l)}function jr({value:e,readOnly:t,label:a,hint:r,onChange:n,onSave:o,onSelectionText:l}){let s=y=>{t||l?.(y.value.slice(y.selectionStart,y.selectionEnd))};return(0,ze.jsxs)("div",{className:"art-source-wrap",children:[r===void 0?null:(0,ze.jsx)("div",{className:"art-code-bar",children:(0,ze.jsx)("span",{children:r})}),(0,ze.jsx)("textarea",{className:"art-source","aria-label":a,spellCheck:!1,readOnly:t,value:e,autoFocus:!t,onChange:y=>{n(y.target.value),l?.("")},onSelect:y=>s(y.currentTarget),onMouseUp:y=>s(y.currentTarget),onKeyUp:y=>s(y.currentTarget),onKeyDown:y=>{if((y.ctrlKey||y.metaKey)&&y.key.toLowerCase()==="s"){y.preventDefault(),o();return}if(y.key==="Tab"&&!y.shiftKey&&!t){y.preventDefault();let c=y.currentTarget,h=c.selectionStart,v=c.selectionEnd,x=e.slice(0,h)+" "+e.slice(v);n(x),requestAnimationFrame(()=>c.setSelectionRange(h+2,h+2))}}})]})}function ha(e,t=2e3){let a=e.replace(/\r\n/g,`
29
29
  `).replace(/[ \t]+\n/g,`
30
30
  `).replace(/\n{3,}/g,`
31
31
 
32
- `).trim();return a.length<=t?{text:a,truncated:!1}:{text:a.slice(0,t).trimEnd(),truncated:!0}}function Dr(e,t){let a=t.version===t.current?"agent.reference":"agent.referenceOld";return`${e(a,{title:t.title,id:t.id,version:t.version,current:t.current})} `}function ga(e,t){let r=e("agent.quoteDesign",{name:t.name,path:t.path})+"\n\n```jsx\n"+t.jsx+"\n```";if(r.length<=4e3)return{text:r,truncated:!1};let n=`
32
+ `).trim();return a.length<=t?{text:a,truncated:!1}:{text:a.slice(0,t).trimEnd(),truncated:!0}}function Fr(e,t){let a=t.workspaceId!==void 0&&t.workspaceId!=="",r=t.version===t.current?a?"agent.referenceProject":"agent.reference":a?"agent.referenceOldProject":"agent.referenceOld",n={title:t.title,id:t.id,version:t.version,current:t.current,...a?{workspaceId:t.workspaceId}:{}};return`${e(r,n)} `}function va(e,t){let r=e("agent.quoteDesign",{name:t.name,path:t.path})+"\n\n```jsx\n"+t.jsx+"\n```";if(r.length<=4e3)return{text:r,truncated:!1};let n=`
33
33
 
34
- `+e("agent.quoteCut",{limit:4e3});return{text:r.slice(0,4e3-n.length).trimEnd()+n,truncated:!0}}function ya(e,t){return e===""?t:`${e.split(`
34
+ `+e("agent.quoteCut",{limit:4e3});return{text:r.slice(0,4e3-n.length).trimEnd()+n,truncated:!0}}function xa(e,t){return e===""?t:`${e.split(`
35
35
  `).map(a=>`> ${a}`).join(`
36
36
  `)}
37
37
 
38
- ${t}`}var Pr=require("react"),Mr="data-ds-dark-theme";function fo(){return typeof document<"u"&&document.body?.hasAttribute(Mr)===!0}function mo(e){if(typeof document>"u"||document.body===null)return()=>{};let t=new MutationObserver(e);return t.observe(document.body,{attributes:!0,attributeFilter:[Mr]}),()=>t.disconnect()}function Ye(){return(0,Pr.useSyncExternalStore)(mo,fo,()=>!1)}var i=require("react/jsx-runtime");function He({label:e,icon:t,onClick:a,pressed:r,disabled:n,buttonRef:o}){return(0,i.jsx)(h.Tooltip,{label:e,side:"bottom",portal:!0,children:(0,i.jsx)(h.Button,{ref:o,size:"sm",className:"art-icon-button","aria-label":e,"aria-pressed":r,disabled:n,onClick:a,children:t})})}function go({quote:e,askLabel:t,dismissLabel:a,onAsk:r,onDismiss:n}){return(0,i.jsxs)("div",{className:"art-selection-bar",role:"toolbar","aria-label":t,children:[(0,i.jsx)("span",{className:"art-selection-quote",title:e,children:e}),(0,i.jsx)(h.Button,{size:"sm",variant:"primary",icon:(0,i.jsx)(h.IconSparkleRegular,{size:14}),onClick:r,children:t}),(0,i.jsx)(He,{label:a,icon:(0,i.jsx)(h.IconCloseOutlineRegular,{size:14}),onClick:n})]})}function yo({t:e,layer:t,askLabel:a,dismissLabel:r,onAsk:n,onDismiss:o}){let l=pa(e,t.type);return(0,i.jsxs)("div",{className:"art-selection-bar art-layer-bar",role:"toolbar","aria-label":a,children:[(0,i.jsx)("span",{className:"art-layer-bar-glyph","aria-hidden":"true",children:Dt(t.type)}),(0,i.jsxs)("span",{className:"art-layer-bar-text",children:[(0,i.jsx)("span",{className:"art-layer-bar-name",title:t.name,children:t.name}),(0,i.jsx)("span",{className:"art-layer-bar-sub",children:t.parentName===""?l:e("layer.parentLine",{type:l,parent:t.parentName})})]}),(0,i.jsx)(h.Button,{size:"sm",variant:"primary",icon:(0,i.jsx)(h.IconSparkleRegular,{size:14}),onClick:n,children:a}),(0,i.jsx)(He,{label:r,icon:(0,i.jsx)(h.IconCloseOutlineRegular,{size:14}),onClick:o})]})}function bo({label:e,closeLabel:t,overlay:a,onClose:r,head:n,children:o}){let l=(0,k.useRef)(null);return(0,k.useEffect)(()=>{l.current?.querySelector("[data-drawer-initial]")?.focus()??l.current?.querySelector(".art-version, button")?.focus()},[e]),(0,k.useEffect)(()=>{if(!a)return;let s=g=>{let d=l.current;d===null||g.target instanceof Node&&d.contains(g.target)||d.querySelector("button")?.focus()};return document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)},[a]),(0,i.jsxs)("div",{className:"art-drawer-layer","data-overlay":a?"true":void 0,children:[a?(0,i.jsx)("div",{className:"art-drawer-scrim","aria-hidden":"true",onPointerDown:r}):null,(0,i.jsxs)("aside",{ref:l,className:"art-drawer",role:"dialog","aria-modal":a?"true":void 0,"aria-label":e,onKeyDown:s=>{if(s.key==="Escape"){s.preventDefault(),s.stopPropagation(),r();return}if(s.key!=="Tab"||!a)return;let g=[...l.current?.querySelectorAll("button:not(:disabled)")??[]],d=g[0],b=g[g.length-1];d===void 0||b===void 0||(s.shiftKey&&document.activeElement===d?(s.preventDefault(),b.focus()):!s.shiftKey&&document.activeElement===b&&(s.preventDefault(),d.focus()))},children:[(0,i.jsxs)("div",{className:"art-drawer-head",children:[n??(0,i.jsx)("h2",{children:e}),(0,i.jsx)(He,{label:t,icon:(0,i.jsx)(h.IconCloseOutlineRegular,{size:14}),onClick:r})]}),(0,i.jsx)("div",{className:"art-drawer-body",children:o})]})]})}function ba(e){let t=e.useTabInfo(),a=Ee(t.tab.contentId??t.tab.navigation?.address),r=e.useWorkspaces(n=>n.items.find(o=>a?.scope==="workspace"&&o.workspaceId===a.workspaceId)?.title);return a===void 0?(0,i.jsx)("section",{className:"art-root",children:(0,i.jsx)("p",{className:"art-note",children:e.t("error.notFound")})}):(0,i.jsx)(Or,{t:e.t,address:a,useTabInfo:e.useTabInfo,onBack:t.tab.actions?.close,workspaceName:r,inputActions:e.inputActions},q(a))}function Lr({t:e,address:t,onBack:a,workspaceName:r}){return(0,i.jsx)(Or,{t:e,address:t,onBack:a,workspaceName:r,back:!0},q(t))}var ho=()=>{};function Or({t:e,address:t,useTabInfo:a,onBack:r,workspaceName:n,back:o,inputActions:l}){let{model:s,state:g}=tr(t),{payload:d,draft:b,saving:T,conflict:w,failure:c,failureMessage:u}=g,p=s.where,y=t.id,z=Ye(),[N,j]=(0,k.useState)("view"),[D,_]=(0,k.useState)(!1),[C,L]=(0,k.useState)(!1),[B,I]=(0,k.useState)(!1),[H,W]=(0,k.useState)("layers"),[V,Pe]=(0,k.useState)(null),[R,S]=(0,k.useState)(null),[G,ae]=(0,k.useState)([]),[Me,ft]=(0,k.useState)(null),[mt,$t]=(0,k.useState)(0),[Wt,ln]=(0,k.useState)(!1),[Ca,Gt]=(0,k.useState)(null),[cn,Ia]=(0,k.useState)(!1),[Ze,Le]=(0,k.useState)(!1),[re,Ue]=(0,k.useState)(null),[be,oe]=(0,k.useState)(null),[dn,gt]=(0,k.useState)(!1),[qt,Ea]=(0,k.useState)(""),[Kt,Je]=(0,k.useState)(null),[pn,yt]=(0,k.useState)(!1),[ue,Ie]=(0,k.useState)(!1),[$e,he]=(0,k.useState)(null),[Ra,Yt]=(0,k.useState)(null),[Aa,et]=(0,k.useState)(null),ve=(0,k.useRef)(0),bt=(0,k.useRef)(null),za=(0,k.useRef)(null),Da=(0,k.useRef)(null),Qt=(0,k.useRef)(!1),ht=Za(y),Pa=(a??ho)();(0,k.useEffect)(()=>{d!==null&&ht>d.version&&b===null&&!T&&!w&&et(ht),s.externalVersion(ht)},[ht,s,T,d?.version,b,w]),(0,k.useEffect)(()=>{w&&et(null)},[w]),(0,k.useEffect)(()=>{he(null),ae([])},[d?.version,re?.version,g.revision]),(0,k.useEffect)(()=>{if(V===null){S(null);return}return S(V.getSnapshot()),V.subscribe(S)},[V]);let Ma=re!==null;(0,k.useEffect)(()=>{Ma&&N==="edit"&&(j("view"),I(!1))},[Ma,N]);let un=d!==null,We=(0,k.useCallback)(()=>{let f=bt.current,A=f===null?0:f.clientWidth;ln(A>0?A<=600:window.innerWidth<=600)},[]);(0,k.useEffect)(()=>{let f=bt.current;if(f===null)return;We();let A=new ResizeObserver(We);return A.observe(f),window.addEventListener("resize",We),()=>{A.disconnect(),window.removeEventListener("resize",We)}},[un,We]);let Oe=(0,k.useCallback)(f=>{s.getSnapshot().draft!==null||s.getSnapshot().saving?Je({run:f}):f()},[s]),Xt=(0,k.useCallback)(()=>{++ve.current,Le(!1),Ue(null),he(null),oe(null),et(null)},[]),vt=(0,k.useCallback)(async()=>{Xt(),await s.discardAndReload()},[s,Xt]);(0,k.useEffect)(()=>Pa?.tab.actions?.bindCommands({refresh:()=>Oe(vt)}),[Pa?.tab.actions,Oe,vt]),(0,k.useEffect)(()=>{if(d?.manifest.type!=="doc"||b===null||w||T)return;let f=setTimeout(()=>void s.save(),1200);return()=>clearTimeout(f)},[b,w,T,s,d?.manifest.type]),(0,k.useEffect)(()=>{if(!C||d===null)return;let f=new AbortController;return Gt(null),Ia(!1),U.history(p,y,f.signal).then(A=>{f.signal.aborted||Gt(A.versions)}).catch(()=>{f.signal.aborted||Ia(!0)}),()=>f.abort()},[C,d?.version,s]),(0,k.useEffect)(()=>()=>{++ve.current},[]),(0,k.useEffect)(()=>{if(C){Qt.current=!0;return}Qt.current&&(Qt.current=!1,Da.current?.focus())},[C]),(0,k.useEffect)(()=>{if(N!=="source"||d?.manifest.type!=="page")return;let f=()=>{let A=za.current,te=window.getSelection();if(A===null||te===null||te.anchorNode===null||!A.contains(te.anchorNode))return;let rt=ma(te.toString());he(rt.text===""?null:rt)};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[N,d?.manifest.type]);let fn=(0,k.useCallback)(f=>Pe(f),[]),mn=(0,k.useCallback)(f=>ae(f),[]),gn=(0,k.useCallback)(f=>ft(f),[]),yn=()=>I(!1),La=()=>{++ve.current,Le(!1),Ue(null),L(!1)},Zt=()=>{We(),++ve.current,Le(!1),Ue(null),oe(null),I(!1),L(!0)},Oa=async f=>{let A=++ve.current;if(oe(null),he(null),f===d?.version){Le(!1),Ue(null);return}Le(!0);try{let te=await U.get(p,y,f);A===ve.current&&Ue(te)}catch(te){A===ve.current&&Q(e(J(Z(te))))}finally{A===ve.current&&Le(!1)}},Fa=async()=>Ze?null:re!==null?re.version:await s.save()?s.getSnapshot().payload?.version??null:null,ja=async f=>{if(!ue){Ie(!0);try{let A=await Fa();if(A===null)return;if(f==="print")Ir((await U.printable(p,y,A)).html);else{let te=await U.exportFile(p,y,f,A);Ya(te),Q(e("export.done",{name:te.fileName,path:te.path}))}}catch(A){Q(e(J(Z(A))))}finally{Ie(!1)}}},bn=async()=>{qt.trim()===""||T||await s.save(qt.trim())&&gt(!1)},hn=async()=>{if(re===null||ue)return;let f=re.version;Oe(async()=>{Ie(!0);try{let A=await U.restore(p,y,f,s.getSnapshot().payload?.version??0);je(y,A.manifest.version),we(),Xt(),await s.load()}catch(A){Q(e(J(Z(A))))}finally{Ie(!1)}})},Jt=async(f,A)=>{try{await navigator.clipboard.writeText(f),Q(e(A))}catch{Yt(f)}},tt=async(f,A="agent.addedTruncated")=>{if(!(ue||w||Ze||d===null)){Ie(!0);try{let te=await Fa();if(te===null)return;let rt=s.getSnapshot().payload??d,aa=Dr(e,{title:rt.manifest.title,id:y,version:te,current:rt.version}),xt=f?.text??"";if(he(null),ae([]),V?.clearSelection(),l===void 0){await Jt(ya(xt,aa),"agent.copied");return}if((xt===""||l.insertQuote(xt))&&l.insertText(aa,l.captureInsertion())){Q(e(f?.truncated===!0?A:"agent.added"));return}await Jt(ya(xt,aa),"agent.insertFailed")}finally{Ie(!1)}}},ea=(0,k.useCallback)(f=>{let A=ma(f);he(A.text===""?null:A)},[]),vn=async()=>{if(be==="version"){oe(null);return}if(d!==null){try{let f=await U.history(p,y);Gt(f.versions)}catch(f){Q(e(J(Z(f))));return}oe("version")}};if(d===null)return(0,i.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",ref:bt,children:(0,i.jsxs)("div",{className:"art-center",role:c===void 0?"status":"alert",children:[(0,i.jsx)("p",{className:"art-center-hint",children:e(c===void 0?"empty.loading":J(c))}),(0,i.jsxs)("div",{className:"art-center-actions",children:[c===void 0?null:(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>void s.load(),children:e("action.retry")}),r===void 0?null:(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:r,children:e("tab.close")})]})]})});let Y=d.manifest.type,at=re?.content??b??d.content,ce=re!==null,ta=re?.version??d.version,xn=e(T?"tab.saving":w?"tab.conflictTitle":Ze?"empty.loading":re!==null?"tab.readOnly":c!==void 0?"tab.saveFailed":b!==null?"tab.unsaved":"tab.saved"),wn=w||c!==void 0&&!T?"error":T?"warn":void 0,kn=t.scope==="workspace"?n??t.workspaceId:e("scope.library"),Tn=N==="source"&&!ce&&(D||b!==null),Ba=[..._a[Y].map(f=>({id:f,label:e(`export.${f}`)})),...Y==="design"?[]:[{type:"separator",id:"export-gap"},{id:"print",label:e("export.print")}]],Ha=f=>{oe(null),ja(f==="print"?"print":f)},Sn=[...Wt?[...Ba,{type:"separator",id:"more-gap"}]:[],{id:"rename",label:e("tab.rename")},{id:"reload",label:e("tab.reload")},{type:"separator",id:"danger-gap"},{id:"delete",label:e("tab.delete"),danger:!0}],Nn=f=>{oe(null),f==="rename"?(Ea(d.manifest.title),gt(!0)):f==="reload"?Oe(vt):f==="delete"?yt(!0):Ha(f)},Cn=[...(Ca??[]).map(f=>({id:"v"+f.version,label:e("tab.versionOf",{version:f.version})+(f.version===d.version?" \xB7 "+e("tab.currentVersion"):"")})),{type:"separator",id:"versions-gap"},{id:"all",label:e("tab.allVersions")}],In=f=>{oe(null),f==="all"?Zt():Oa(Number(f.slice(1)))},En=(0,i.jsx)(h.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,i.jsx)(h.IconSparkleRegular,{size:14}),disabled:ue||w||Ze,onClick:()=>{if(Y==="design"){let f=V?.quoteSelection();if(f!=null){tt(ga(e,f),"agent.addedTruncatedDesign");return}}tt($e)},children:e("agent.ask")});return(0,i.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"","data-artifact-id":y,"aria-busy":ue,ref:bt,children:[(0,i.jsxs)("header",{className:"art-header art-editor-header",children:[(0,i.jsxs)("div",{className:"art-heading",children:[!o||r===void 0?null:(0,i.jsx)(He,{label:e("action.back"),icon:(0,i.jsx)(h.IconChevronLeftOutlineRegular,{size:16}),onClick:()=>Oe(r)}),(0,i.jsxs)("div",{className:"art-identity",children:[(0,i.jsx)("h1",{className:"art-title",title:d.manifest.title,children:d.manifest.title}),(0,i.jsxs)("div",{className:"art-meta",children:[(0,i.jsxs)("span",{className:"art-meta-text",children:[kn,t.scope==="workspace"?" \xB7 "+e("scope.workspace"):null]}),(0,i.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,i.jsx)(h.Menu,{open:be==="version",onClose:()=>oe(null),items:Cn,onSelect:In,portal:!0,autoFocus:!0,anchor:(0,i.jsxs)("button",{type:"button",className:"art-version-button","aria-label":e("tab.versionPicker"),"aria-haspopup":"menu","aria-expanded":be==="version",onClick:()=>void vn(),children:[e("gallery.version",{version:ta}),(0,i.jsx)(h.IconChevronDownOutlineRegular,{size:12})]})}),(0,i.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,i.jsx)("span",{className:"art-save-status","data-tone":wn,"aria-live":"polite",children:xn})]})]})]}),(0,i.jsxs)("div",{className:"art-actions art-editor-actions",children:[Y==="doc"?null:(0,i.jsx)(h.SegmentedControl,{id:"art-mode-"+y,className:"art-segment",label:e("tab.mode"),value:N,options:Y==="design"?[{value:"view",label:e("canvas.viewMode")},{value:"edit",label:e("canvas.editMode"),disabled:ce,title:ce?e("canvas.editOldVersion"):void 0},{value:"source",label:e("tab.source")}]:[{value:"view",label:e("tab.preview")},{value:"source",label:e("tab.source")}],onChange:f=>{j(f),he(null),I(Y==="design"&&f==="edit"&&!ce)}}),Y==="design"&&N==="edit"&&!ce?(0,i.jsx)(He,{label:e("canvas.inspector"),icon:(0,i.jsx)(h.IconSlidersTwoOutlineRegular,{size:16}),pressed:B,onClick:()=>{B?I(!1):(L(!1),I(!0))}}):null,b===null||ce?null:(0,i.jsx)(He,{label:e("tab.save"),icon:(0,i.jsx)(h.IconSaveOutlineRegular,{size:16}),disabled:w,onClick:()=>void s.save()}),(0,i.jsx)(He,{buttonRef:Da,label:e("tab.history"),icon:(0,i.jsx)(h.IconClockOutlineRegular,{size:16}),pressed:C,onClick:()=>{C?La():Zt()}}),Wt?null:(0,i.jsx)(h.Menu,{open:be==="export",onClose:()=>oe(null),items:Ba,onSelect:Ha,align:"end",portal:!0,autoFocus:!0,anchor:(0,i.jsx)(h.Button,{size:"sm",icon:(0,i.jsx)(h.IconDownloadOutlineRegular,{size:14}),"aria-label":e("tab.export"),"aria-haspopup":"menu","aria-expanded":be==="export",disabled:ue||Ze,onClick:()=>oe(be==="export"?null:"export"),children:e("tab.export")})}),En,(0,i.jsx)(h.Menu,{open:be==="more",onClose:()=>oe(null),items:Sn,onSelect:Nn,align:"end",portal:!0,autoFocus:!0,anchor:(0,i.jsx)(h.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.more"),"aria-haspopup":"menu","aria-expanded":be==="more",onClick:()=>oe(be==="more"?null:"more"),children:(0,i.jsx)(h.IconEllipsisOutlineRegular,{size:14})})})]})]}),dn?(0,i.jsxs)("form",{className:"art-inline-form",onSubmit:f=>{f.preventDefault(),bn()},children:[(0,i.jsx)("input",{"aria-label":e("tab.rename"),value:qt,maxLength:120,autoFocus:!0,onChange:f=>Ea(f.target.value),onKeyDown:f=>{f.key==="Escape"&&gt(!1)}}),(0,i.jsx)(h.Button,{type:"submit",size:"sm",variant:"primary",disabled:T||w,children:e("tab.save")}),(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>gt(!1),children:e("create.cancel")})]}):null,Aa===null?null:(0,i.jsxs)("div",{className:"art-bar",role:"status",children:[(0,i.jsx)("span",{children:e("tab.agentUpdate",{version:Aa})}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>{et(null),Zt()},children:e("tab.viewHistory")}),(0,i.jsx)(h.Button,{size:"sm",onClick:()=>et(null),children:e("tab.dismiss")})]})]}),w?(0,i.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"alert",children:[(0,i.jsxs)("span",{className:"art-bar-text",children:[(0,i.jsx)("strong",{children:e("tab.conflictTitle")}),(0,i.jsx)("span",{children:e("tab.conflictHint")})]}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>void Jt(b??"","action.copied"),children:e("tab.copyDraft")}),(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>Oe(vt),children:e("tab.discardReload")})]})]}):null,!w&&c!==void 0?(0,i.jsxs)("div",{className:"art-bar","data-tone":"error",role:"alert",children:[(0,i.jsx)("span",{children:u??e(J(c))}),(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>void s.save(),children:e("action.retry")})]}):null,re===null?null:(0,i.jsxs)("div",{className:"art-bar",role:"status",children:[(0,i.jsx)("span",{children:e("tab.viewingOld",{version:re.version,current:d.version})}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>{++ve.current,Le(!1),Ue(null),he(null)},children:e("tab.backToCurrent")}),(0,i.jsx)(h.Button,{size:"sm",variant:"outline",disabled:ue,onClick:()=>void hn(),children:e("tab.restoreThis")})]})]}),Y!=="design"||Me===null?null:(0,i.jsxs)("div",{className:"art-bar","data-tone":"error",role:"alert",children:[(0,i.jsx)("span",{children:e("canvas.startFailed")}),(0,i.jsx)("span",{className:"art-bar-actions",children:(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>{ft(null),$t(f=>f+1)},children:e("action.retry")})})]}),(0,i.jsxs)("div",{className:"art-body",children:[(0,i.jsxs)("div",{className:"art-stage",role:Y==="doc"?void 0:"tabpanel",id:Y==="doc"?void 0:"art-mode-"+y+"-"+N+"-panel","aria-labelledby":Y==="doc"?void 0:"art-mode-"+y+"-"+N,children:[Y==="page"&&$e!==null&&!C?(0,i.jsx)(go,{quote:$e.text,askLabel:e("agent.ask"),dismissLabel:e("tab.dismiss"),onAsk:()=>void tt($e),onDismiss:()=>he(null)}):null,Y==="design"&&N!=="source"&&!ce&&G[0]!==void 0?(0,i.jsx)(yo,{t:e,layer:G[0],askLabel:e("agent.ask"),dismissLabel:e("tab.dismiss"),onAsk:()=>{let f=V?.quoteSelection();f!=null&&tt(ga(e,f),"agent.addedTruncatedDesign")},onDismiss:()=>V?.clearSelection()}):null,Y==="doc"?(0,i.jsx)(Pt,{markdown:at,revision:(re?.version??0)+":"+g.revision,editable:!ce&&!w,label:d.manifest.title,loadingLabel:e("empty.loading"),failedLabel:e("error.generic"),design:d.design,dark:z,t:e,onChange:f=>s.edit(f),onSave:()=>void s.save(),onSelectionText:ea,selectionAction:$e===null?null:(0,i.jsx)(h.Button,{size:"sm",variant:"primary",icon:(0,i.jsx)(h.IconSparkleRegular,{size:14}),onMouseDown:f=>f.preventDefault(),onClick:()=>void tt($e),children:e("agent.ask")})}):N!=="source"?Y==="design"?ce?(0,i.jsx)(ua,{t:e,where:p,id:y,version:ta,title:d.manifest.title}):(0,i.jsx)(br,{t:e,source:at,revision:"0:"+g.revision,title:d.manifest.title,mode:N==="edit"?"edit":"view",onChange:f=>s.edit(f),onSave:()=>void s.save(),onFailure:gn,onHandle:fn,onSelection:mn,attempt:mt,fallback:(0,i.jsx)(ua,{t:e,where:p,id:y,version:ta,title:d.manifest.title})}):(0,i.jsx)(Ot,{content:at,designCss:d.designCss,title:d.manifest.title,frameTitle:e("tab.frameTitle",{title:d.manifest.title}),dark:z,onSelectionText:ea}):Tn?(0,i.jsx)(zr,{value:at,readOnly:!1,label:e("tab.source"),hint:e(Y==="design"?"tab.manualSaveDesign":"tab.manualSave"),onChange:f=>s.edit(f),onSave:()=>void s.save(),onSelectionText:ea}):(0,i.jsxs)("div",{className:"art-code",ref:za,children:[(0,i.jsxs)("div",{className:"art-code-bar",children:[(0,i.jsx)("span",{children:e(ce?"tab.readOnly":"tab.codeHint")}),ce?null:(0,i.jsx)(h.Button,{size:"sm",variant:"outline",icon:(0,i.jsx)(h.IconEditOutlineRegular,{size:14}),onClick:()=>_(!0),children:e("tab.editSource")})]}),(0,i.jsx)(h.CodeBlock,{code:at,lang:Y==="design"?"jsx":"html",lineNumbers:!0,showHeader:!1,wrap:!0,className:"art-code-block",copyLabel:e("code.copy"),copiedLabel:e("action.copied")})]})]}),!C&&!B?null:(0,i.jsx)(bo,{label:e(C?"history.title":"canvas.inspector"),closeLabel:e(C?"history.close":"canvas.closeInspector"),overlay:Wt,onClose:C?La:yn,head:C?void 0:(0,i.jsx)(h.SegmentedTabs,{className:"art-inspector-tabs",items:[{value:"layers",label:e("panel.layers"),id:"art-inspector-"+y+"-layers-tab",panelId:"art-inspector-"+y+"-layers"},{value:"properties",label:e("panel.properties"),id:"art-inspector-"+y+"-properties-tab",panelId:"art-inspector-"+y+"-properties"}],value:H,onChange:W,label:e("canvas.inspectorTabs"),size:"sm"}),children:C?(0,i.jsx)(Ar,{t:e,versions:Ca,failed:cn,current:d.version,selected:re?.version??d.version,onSelect:f=>void Oa(f)}):(0,i.jsx)("div",{className:"art-inspector",role:"tabpanel",id:"art-inspector-"+y+"-"+H,"aria-labelledby":"art-inspector-"+y+"-"+H+"-tab",children:(0,i.jsx)(hr,{t:e,handle:V,snapshot:R,tab:H})})})]}),(0,i.jsx)(h.Modal,{open:Kt!==null,onClose:()=>Je(null),title:e("tab.leaveTitle"),closeLabel:e("dialog.close"),description:e(w?"tab.conflictHint":"tab.leaveHint"),footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(h.Button,{variant:"outline",disabled:ue,onClick:()=>Je(null),children:e("create.cancel")}),(0,i.jsx)(h.Button,{variant:"outline",disabled:T||ue,onClick:()=>{let f=Kt?.run;Je(null),f!==void 0&&s.discardAndReload().then(f)},children:e("tab.discardContinue")}),(0,i.jsx)(h.Button,{variant:"primary",disabled:w||ue,onClick:async()=>{Ie(!0);let f=await s.save();Ie(!1);let A=Kt?.run;f&&A!==void 0&&(Je(null),await A())},children:e("tab.saveContinue")})]}),children:c===void 0?null:(0,i.jsx)("p",{className:"art-modal-error",role:"alert",children:u??e(J(c))})}),(0,i.jsx)(h.Modal,{open:pn,onClose:()=>yt(!1),title:e("tab.deleteTitle"),closeLabel:e("dialog.close"),description:e("tab.deleteConfirm",{title:d.manifest.title}),footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(h.Button,{variant:"outline",onClick:()=>yt(!1),children:e("create.cancel")}),(0,i.jsx)(h.Button,{variant:"primary",onClick:()=>{yt(!1),Oe(async()=>{try{await U.remove(p,y),we(),r?.()}catch(f){Q(e(J(Z(f))))}})},children:e("tab.delete")})]})}),(0,i.jsx)(h.Modal,{open:Ra!==null,onClose:()=>Yt(null),title:e("agent.copyTitle"),closeLabel:e("dialog.close"),description:e("action.copyFailed"),footer:(0,i.jsx)(h.Button,{variant:"primary",onClick:()=>Yt(null),children:e("dialog.done")}),children:(0,i.jsx)("textarea",{className:"art-fallback",readOnly:!0,value:Ra??"","aria-label":e("agent.copyTitle"),onFocus:f=>f.currentTarget.select()})})]})}var Fr=Ln(require("react"),1),jr=require("@deepseek-ai/dsh-client-ui-primitives"),Ve=require("react/jsx-runtime"),Ft=class extends Fr.default.Component{constructor(t){super(t),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,Ve.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",children:(0,Ve.jsxs)("div",{className:"art-center",role:"alert",children:[(0,Ve.jsx)("p",{className:"art-center-title",children:this.props.title}),(0,Ve.jsx)("p",{className:"art-center-hint",children:this.props.hint}),(0,Ve.jsx)(jr.Button,{size:"sm",variant:"outline",onClick:()=>window.location.reload(),children:this.props.reloadLabel})]})}):this.props.children}};var jt=require("react"),Qe=require("@deepseek-ai/dsh-client-ui-primitives");var Se={sidebarRight:null,layout:null};var M=require("react/jsx-runtime");function vo(e){if(e===null||typeof e!="object")return null;let t={...e},{id:a,type:r,title:n,version:o,workspaceId:l}=t;if(t.kind!=="artifact"||typeof a!="string"||typeof n!="string"||typeof o!="number"||r!=="page"&&r!=="doc"&&r!=="design")return null;let s=Ua(a);return s===void 0?null:s==="workspace"?typeof l!="string"||l===""?null:{id:a,type:r,title:n,version:o,address:{scope:s,workspaceId:l,id:a}}:{id:a,type:r,title:n,version:o,address:{scope:s,id:a}}}function xo(e){return Array.isArray(e)?e.map(t=>{if(t===null||typeof t!="object")return"";let a={...t};return a.type==="text"&&typeof a.text=="string"?a.text:""}).filter(t=>t!=="").join(`
39
- `).trim():""}function wo(e){if(e===null||typeof e!="object")return;let t={...e};return typeof t.title=="string"&&t.title.trim()!==""?t.title.trim():void 0}var Br=new Set;function ha({t:e,phase:t,toolName:a,block:r}){let n=t==="result"&&r?.isError!==!0?vo(r?.meta):null,o=(0,jt.useRef)(t!=="result");t!=="result"&&(o.current=!0);let l=a==="artifact_update";if((0,jt.useEffect)(()=>{if(n===null)return;xe(n.id,n.title),je(n.id,n.version),we();let g=n.id+":"+n.version;!o.current||Br.has(g)||(Br.add(g),Se.sidebarRight?.openResource(q(n.address)))},[n?.id,n?.version,n?.title]),t!=="result"){let g=wo(r?.args),d=g===void 0?e(l?"card.updatingUntitled":"card.working"):e(l?"card.updating":"card.creating",{title:g});return(0,M.jsxs)("div",{className:"art-card","data-artifact-card":"working",children:[(0,M.jsx)("span",{className:"art-card-icon",children:(0,M.jsx)(fe,{})}),(0,M.jsx)("span",{className:"art-card-text",children:(0,M.jsx)(Qe.TextShimmer,{active:!0,className:"art-card-title",children:(0,M.jsx)("span",{role:"status",children:d})})}),(0,M.jsx)(Qe.StateDot,{state:"ongoing"})]})}if(r?.isError===!0)return(0,M.jsxs)("div",{className:"art-card","data-artifact-card":"error",children:[(0,M.jsx)("span",{className:"art-card-icon","data-tone":"error",children:(0,M.jsx)(fe,{})}),(0,M.jsxs)("span",{className:"art-card-text",children:[(0,M.jsx)("span",{className:"art-card-title",children:e("card.failed")}),(0,M.jsx)("span",{className:"art-card-sub","data-tone":"error",children:xo(r.content)})]})]});if(n===null)return(0,M.jsxs)("div",{className:"art-card","data-artifact-card":"missing",children:[(0,M.jsx)("span",{className:"art-card-icon",children:(0,M.jsx)(fe,{})}),(0,M.jsx)("span",{className:"art-card-sub",children:e("card.missing")})]});let s=q(n.address);return(0,M.jsxs)("button",{type:"button",className:"art-card art-card-open","data-artifact-card":"ready","data-artifact-id":n.id,"aria-label":e("card.openNamed",{title:n.title}),onClick:()=>Se.sidebarRight?.openResource(s),children:[(0,M.jsx)("span",{className:"art-card-icon",children:n.type==="page"?(0,M.jsx)(fe,{}):n.type==="doc"?(0,M.jsx)(Te,{}):(0,M.jsx)(Be,{})}),(0,M.jsxs)("span",{className:"art-card-text",children:[(0,M.jsx)("span",{className:"art-card-title",title:n.title,children:n.title}),(0,M.jsxs)("span",{className:"art-card-sub",children:[e(l?"card.updated":"card.created")," \xB7 ",e(`type.${n.type}`)," \xB7 ",e("gallery.version",{version:n.version}),n.address.scope==="library"?" \xB7 "+e("scope.library"):""]})]}),(0,M.jsx)("span",{className:"art-card-go","aria-hidden":"true",children:(0,M.jsx)(Qe.IconChevronRightOutlineRegular,{size:14})})]})}var dt=require("react"),Bt=require("@deepseek-ai/dsh-client-ui-primitives");var Hr=require("react");function Vr({sessionId:e,useSessions:t,useWorkspaces:a}){let r=a(o=>o.items),n=t(o=>o.byId[e]);return(0,Hr.useMemo)(()=>{let o=typeof n?.cwd=="string"?n.cwd:null,l=r.find(s=>s.sessionIds?.includes(e))??r.find(s=>o!==null&&(o===s.path||o.startsWith(`${s.path}/`)))??null;return{root:o??l?.path??null,workspaceId:l?.workspaceId??null}},[r,n,e])}var ct="dsh-artifact-studio/artifact",va="artifact",Xe="dsh-artifact-studio-panel";var ze=require("react/jsx-runtime"),ko=6,xa=["dashboard","explainer","report","brief"];function To(e,t){let a=e.filter(n=>n.source.sessionId===t),r=e.filter(n=>n.source.sessionId!==t);return[...a,...r].slice(0,ko)}function _r(e){let{t,sessionId:a,inputActions:r}=e,o=Vr(e).workspaceId,l=Rt(),[s,g]=(0,dt.useState)(!1),[d,b]=(0,dt.useState)(null);(0,dt.useEffect)(()=>{if(!s||o===null)return;let u=new AbortController;return U.list({scope:"workspace",workspaceId:o},{},u.signal).then(p=>{u.signal.aborted||b(To(p.items,a))}).catch(()=>{u.signal.aborted||b([])}),()=>u.abort()},[s,o,a,l]);let T=o===null?[{type:"label",id:"no-workspace",text:t("empty.noWorkspace")}]:d===null?[{type:"label",id:"loading",text:t("empty.loading")}]:d.length===0?[{type:"label",id:"empty",text:t("composer.empty")}]:d.map(u=>({id:"open:"+u.id,label:u.title,icon:u.type==="page"?(0,ze.jsx)(fe,{size:14}):u.type==="doc"?(0,ze.jsx)(Te,{size:14}):(0,ze.jsx)(Be,{size:14})})),w=[{type:"label",id:"recent",text:t("composer.recent")},...T,...r===void 0?[]:[{type:"separator",id:"start-gap"},{type:"label",id:"start",text:t("composer.start")},...xa.map(u=>({id:"prompt:"+u,label:t(`prompt.${u}`)}))],{type:"separator",id:"all-gap"},{id:"all",label:t("composer.all")}];return(0,ze.jsx)(Bt.Menu,{open:s,onClose:()=>g(!1),items:w,onSelect:u=>{if(g(!1),u==="all"){Se.layout?.selectPanel(Xe);return}if(u.startsWith("prompt:")&&r!==void 0){r.insertText(t(`prompt.${u.slice(7)}Text`),r.captureInsertion());return}let p=d?.find(y=>"open:"+y.id===u);p===void 0||o===null||(xe(p.id,p.title),Se.sidebarRight?.openResource(q({scope:"workspace",workspaceId:o,id:p.id})))},side:"top",portal:!0,autoFocus:!0,anchor:(0,ze.jsx)(Bt.Tooltip,{label:t("composer.label"),side:"top",portal:!0,children:(0,ze.jsx)("button",{type:"button",className:"art-composer","aria-label":t("composer.label"),"aria-haspopup":"menu","aria-expanded":s,onClick:()=>g(u=>!u),children:(0,ze.jsx)(At,{})})})})}var ee=require("react");var O=require("react"),P=require("@deepseek-ai/dsh-client-ui-primitives");var Ne=require("react"),Ht=require("@deepseek-ai/dsh-client-ui-primitives");var E=require("react/jsx-runtime"),So=["sm","md","lg"],No=e=>`<!doctype html><html><head><meta name="color-scheme" content="light dark"><style>
38
+ ${t}`}var Br=require("react"),Hr="data-ds-dark-theme";function bo(){return typeof document<"u"&&document.body?.hasAttribute(Hr)===!0}function ho(e){if(typeof document>"u"||document.body===null)return()=>{};let t=new MutationObserver(e);return t.observe(document.body,{attributes:!0,attributeFilter:[Hr]}),()=>t.disconnect()}function Qe(){return(0,Br.useSyncExternalStore)(ho,bo,()=>!1)}var i=require("react/jsx-runtime");function He({label:e,icon:t,onClick:a,pressed:r,disabled:n,buttonRef:o}){return(0,i.jsx)(b.Tooltip,{label:e,side:"bottom",portal:!0,children:(0,i.jsx)(b.Button,{ref:o,size:"sm",className:"art-icon-button","aria-label":e,"aria-pressed":r,disabled:n,onClick:a,children:t})})}function vo({quote:e,askLabel:t,dismissLabel:a,onAsk:r,onDismiss:n}){return(0,i.jsxs)("div",{className:"art-selection-bar",role:"toolbar","aria-label":t,children:[(0,i.jsx)("span",{className:"art-selection-quote",title:e,children:e}),(0,i.jsx)(b.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,i.jsx)(b.IconSparkleRegular,{size:14}),onClick:r,children:t}),(0,i.jsx)(He,{label:a,icon:(0,i.jsx)(b.IconCloseOutlineRegular,{size:14}),onClick:n})]})}function xo({t:e,layer:t,askLabel:a,dismissLabel:r,onAsk:n,onDismiss:o}){let l=ma(e,t.type);return(0,i.jsxs)("div",{className:"art-selection-bar art-layer-bar",role:"toolbar","aria-label":a,children:[(0,i.jsx)("span",{className:"art-layer-bar-glyph","aria-hidden":"true",children:Pt(t.type)}),(0,i.jsxs)("span",{className:"art-layer-bar-text",children:[(0,i.jsx)("span",{className:"art-layer-bar-name",title:t.name,children:t.name}),(0,i.jsx)("span",{className:"art-layer-bar-sub",children:t.parentName===""?l:e("layer.parentLine",{type:l,parent:t.parentName})})]}),(0,i.jsx)(b.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,i.jsx)(b.IconSparkleRegular,{size:14}),onClick:n,children:a}),(0,i.jsx)(He,{label:r,icon:(0,i.jsx)(b.IconCloseOutlineRegular,{size:14}),onClick:o})]})}function wo({label:e,closeLabel:t,overlay:a,onClose:r,head:n,children:o}){let l=(0,T.useRef)(null);return(0,T.useEffect)(()=>{l.current?.querySelector("[data-drawer-initial]")?.focus()??l.current?.querySelector(".art-version, button")?.focus()},[e]),(0,T.useEffect)(()=>{if(!a)return;let s=y=>{let c=l.current;c===null||y.target instanceof Node&&c.contains(y.target)||c.querySelector("button")?.focus()};return document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)},[a]),(0,i.jsxs)("div",{className:"art-drawer-layer","data-overlay":a?"true":void 0,children:[a?(0,i.jsx)("div",{className:"art-drawer-scrim","aria-hidden":"true",onPointerDown:r}):null,(0,i.jsxs)("aside",{ref:l,className:"art-drawer",role:"dialog","aria-modal":a?"true":void 0,"aria-label":e,onKeyDown:s=>{if(s.key==="Escape"){s.preventDefault(),s.stopPropagation(),r();return}if(s.key!=="Tab"||!a)return;let y=[...l.current?.querySelectorAll("button:not(:disabled)")??[]],c=y[0],h=y[y.length-1];c===void 0||h===void 0||(s.shiftKey&&document.activeElement===c?(s.preventDefault(),h.focus()):!s.shiftKey&&document.activeElement===h&&(s.preventDefault(),c.focus()))},children:[(0,i.jsxs)("div",{className:"art-drawer-head",children:[n??(0,i.jsx)("h2",{children:e}),(0,i.jsx)(He,{label:t,icon:(0,i.jsx)(b.IconCloseOutlineRegular,{size:14}),onClick:r})]}),(0,i.jsx)("div",{className:"art-drawer-body",children:o})]})]})}function wa(e){let t=e.useTabInfo(),a=we(t.tab.contentId??t.tab.navigation?.address),r=e.useWorkspaces(n=>n.items.find(o=>a?.scope==="workspace"&&o.workspaceId===a.workspaceId)?.title);return a===void 0?(0,i.jsx)("section",{className:"art-root",children:(0,i.jsx)("p",{className:"art-note",children:e.t("error.notFound")})}):(0,i.jsx)(Vr,{t:e.t,address:a,useTabInfo:e.useTabInfo,onBack:t.tab.actions?.close,workspaceName:r,inputActions:e.inputActions},K(a))}function ka({t:e,address:t,onBack:a,workspaceName:r,inputActions:n}){return(0,i.jsx)(Vr,{t:e,address:t,onBack:a,workspaceName:r,back:!0,inputActions:n},K(t))}var ko=()=>{};function Vr({t:e,address:t,useTabInfo:a,onBack:r,workspaceName:n,back:o,inputActions:l}){let{model:s,state:y}=sr(t),{payload:c,draft:h,saving:v,conflict:x,failure:d,failureMessage:p}=y,u=s.where,m=t.id,L=Qe(),[S,V]=(0,T.useState)("view"),[D,H]=(0,T.useState)(!1),[C,F]=(0,T.useState)(!1),[_,P]=(0,T.useState)(!1),[A,$]=(0,T.useState)("layers"),[O,Le]=(0,T.useState)(null),[E,q]=(0,T.useState)(null),[N,Q]=(0,T.useState)([]),[_e,Ue]=(0,T.useState)(null),[Kt,yt]=(0,T.useState)(0),[Je,un]=(0,T.useState)(!1),[za,Yt]=(0,T.useState)(null),[fn,Pa]=(0,T.useState)(!1),[et,Me]=(0,T.useState)(!1),[ne,We]=(0,T.useState)(null),[he,ie]=(0,T.useState)(null),[gn,bt]=(0,T.useState)(!1),[Qt,La]=(0,T.useState)(""),[Xt,tt]=(0,T.useState)(null),[mn,ht]=(0,T.useState)(!1),[fe,Re]=(0,T.useState)(!1),[Ge,ve]=(0,T.useState)(null),[Ma,Zt]=(0,T.useState)(null),[Oa,at]=(0,T.useState)(null),xe=(0,T.useRef)(0),vt=(0,T.useRef)(null),ja=(0,T.useRef)(null),Fa=(0,T.useRef)(null),Jt=(0,T.useRef)(!1),xt=nr(m),Ba=(a??ko)();(0,T.useEffect)(()=>{c!==null&&xt>c.version&&h===null&&!v&&!x&&at(xt),s.externalVersion(xt)},[xt,s,v,c?.version,h,x]),(0,T.useEffect)(()=>{x&&at(null)},[x]),(0,T.useEffect)(()=>{ve(null),Q([])},[c?.version,ne?.version,y.revision]),(0,T.useEffect)(()=>{if(O===null){q(null);return}return q(O.getSnapshot()),O.subscribe(q)},[O]);let Ha=ne!==null;(0,T.useEffect)(()=>{Ha&&S==="edit"&&(V("view"),P(!1))},[Ha,S]);let yn=c!==null,$e=(0,T.useCallback)(()=>{let f=vt.current,R=f===null?0:f.clientWidth;un(R>0?R<=600:window.innerWidth<=600)},[]);(0,T.useEffect)(()=>{let f=vt.current;if(f===null)return;$e();let R=new ResizeObserver($e);return R.observe(f),window.addEventListener("resize",$e),()=>{R.disconnect(),window.removeEventListener("resize",$e)}},[yn,$e]);let Oe=(0,T.useCallback)(f=>{s.getSnapshot().draft!==null||s.getSnapshot().saving?tt({run:f}):f()},[s]),ea=(0,T.useCallback)(()=>{++xe.current,Me(!1),We(null),ve(null),ie(null),at(null)},[]),wt=(0,T.useCallback)(async()=>{ea(),await s.discardAndReload()},[s,ea]);(0,T.useEffect)(()=>Ba?.tab.actions?.bindCommands({refresh:()=>Oe(wt)}),[Ba?.tab.actions,Oe,wt]),(0,T.useEffect)(()=>{if(c?.manifest.type!=="doc"||h===null||x||v)return;let f=setTimeout(()=>void s.save(),1200);return()=>clearTimeout(f)},[h,x,v,s,c?.manifest.type]),(0,T.useEffect)(()=>{if(!C||c===null)return;let f=new AbortController;return Yt(null),Pa(!1),U.history(u,m,f.signal).then(R=>{f.signal.aborted||Yt(R.versions)}).catch(()=>{f.signal.aborted||Pa(!0)}),()=>f.abort()},[C,c?.version,s]),(0,T.useEffect)(()=>()=>{++xe.current},[]),(0,T.useEffect)(()=>{if(C){Jt.current=!0;return}Jt.current&&(Jt.current=!1,Fa.current?.focus())},[C]),(0,T.useEffect)(()=>{if(S!=="source"||c?.manifest.type!=="page")return;let f=()=>{let R=ja.current,ae=window.getSelection();if(R===null||ae===null||ae.anchorNode===null||!R.contains(ae.anchorNode))return;let ot=ha(ae.toString());ve(ot.text===""?null:ot)};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[S,c?.manifest.type]);let bn=(0,T.useCallback)(f=>Le(f),[]),hn=(0,T.useCallback)(f=>Q(f),[]),vn=(0,T.useCallback)(f=>Ue(f),[]),xn=()=>P(!1),Va=()=>{++xe.current,Me(!1),We(null),F(!1)},ta=()=>{$e(),++xe.current,Me(!1),We(null),ie(null),P(!1),F(!0)},_a=async f=>{let R=++xe.current;if(ie(null),ve(null),f===c?.version){Me(!1),We(null);return}Me(!0);try{let ae=await U.get(u,m,f);R===xe.current&&We(ae)}catch(ae){R===xe.current&&Z(e(te(ee(ae))))}finally{R===xe.current&&Me(!1)}},Ua=async()=>et?null:ne!==null?ne.version:await s.save()?s.getSnapshot().payload?.version??null:null,Wa=async f=>{if(!fe){Re(!0);try{let R=await Ua();if(R===null)return;if(f==="print")Pr((await U.printable(u,m,R)).html);else{let ae=await U.exportFile(u,m,f,R);tr(ae),Z(e("export.done",{name:ae.fileName,path:ae.path}))}}catch(R){Z(e(te(ee(R))))}finally{Re(!1)}}},wn=async()=>{Qt.trim()===""||v||await s.save(Qt.trim())&&bt(!1)},kn=async()=>{if(ne===null||fe)return;let f=ne.version;Oe(async()=>{Re(!0);try{let R=await U.restore(u,m,f,s.getSnapshot().payload?.version??0);Fe(m,R.manifest.version),Te(),ea(),await s.load()}catch(R){Z(e(te(ee(R))))}finally{Re(!1)}})},aa=async(f,R)=>{try{await navigator.clipboard.writeText(f),Z(e(R))}catch{Zt(f)}},rt=async(f,R="agent.addedTruncated")=>{if(!(fe||x||et||c===null)){Re(!0);try{let ae=await Ua();if(ae===null)return;let ot=s.getSnapshot().payload??c,oa=Fr(e,{title:ot.manifest.title,id:m,version:ae,current:ot.version,...t.scope==="workspace"?{workspaceId:t.workspaceId}:{}}),kt=f?.text??"";if(ve(null),Q([]),O?.clearSelection(),l===void 0){await aa(xa(kt,oa),"agent.copied");return}if((kt===""||l.insertQuote(kt))&&l.insertText(oa,l.captureInsertion())){Z(e(f?.truncated===!0?R:"agent.added"));return}await aa(xa(kt,oa),"agent.insertFailed")}finally{Re(!1)}}},ra=(0,T.useCallback)(f=>{let R=ha(f);ve(R.text===""?null:R)},[]),Tn=async()=>{if(he==="version"){ie(null);return}if(c!==null){try{let f=await U.history(u,m);Yt(f.versions)}catch(f){Z(e(te(ee(f))));return}ie("version")}};if(c===null)return(0,i.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",ref:vt,children:(0,i.jsxs)("div",{className:"art-center",role:d===void 0?"status":"alert",children:[(0,i.jsx)("p",{className:"art-center-hint",children:e(d===void 0?"empty.loading":te(d))}),(0,i.jsxs)("div",{className:"art-center-actions",children:[d===void 0?null:(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>void s.load(),children:e("action.retry")}),r===void 0?null:(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:r,children:e("tab.close")})]})]})});let X=c.manifest.type,nt=ne?.content??h??c.content,de=ne!==null,na=ne?.version??c.version,Sn=e(v?"tab.saving":x?"tab.conflictTitle":et?"empty.loading":ne!==null?"tab.readOnly":d!==void 0?"tab.saveFailed":h!==null?"tab.unsaved":"tab.saved"),Nn=x||d!==void 0&&!v?"error":v?"warn":void 0,Cn=t.scope==="workspace"?n??t.workspaceId:e("scope.library"),In=S==="source"&&!de&&(D||h!==null),Ga=[...Ka[X].map(f=>({id:f,label:e(`export.${f}`)})),...X==="design"?[]:[{type:"separator",id:"export-gap"},{id:"print",label:e("export.print")}]],$a=f=>{ie(null),Wa(f==="print"?"print":f)},An=[...Je?[...Ga,{type:"separator",id:"more-gap"}]:[],{id:"rename",label:e("tab.rename")},{id:"reload",label:e("tab.reload")},{type:"separator",id:"danger-gap"},{id:"delete",label:e("tab.delete"),danger:!0}],En=f=>{ie(null),f==="rename"?(La(c.manifest.title),bt(!0)):f==="reload"?Oe(wt):f==="delete"?ht(!0):$a(f)},Rn=[...(za??[]).map(f=>({id:"v"+f.version,label:e("tab.versionOf",{version:f.version})+(f.version===c.version?" \xB7 "+e("tab.currentVersion"):"")})),{type:"separator",id:"versions-gap"},{id:"all",label:e("tab.allVersions")}],Dn=f=>{ie(null),f==="all"?ta():_a(Number(f.slice(1)))},zn=(0,i.jsx)(b.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,i.jsx)(b.IconSparkleRegular,{size:14}),disabled:fe||x||et,onClick:()=>{if(X==="design"){let f=O?.quoteSelection();if(f!=null){rt(va(e,f),"agent.addedTruncatedDesign");return}}rt(Ge)},children:e("agent.ask")});return(0,i.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"","data-artifact-id":m,"aria-busy":fe,ref:vt,children:[(0,i.jsxs)("header",{className:"art-header art-editor-header",children:[(0,i.jsxs)("div",{className:"art-heading",children:[!o||r===void 0?null:(0,i.jsx)(He,{label:e("action.back"),icon:(0,i.jsx)(b.IconChevronLeftOutlineRegular,{size:16}),onClick:()=>Oe(r)}),(0,i.jsxs)("div",{className:"art-identity",children:[(0,i.jsx)("h1",{className:"art-title",title:c.manifest.title,children:c.manifest.title}),(0,i.jsxs)("div",{className:"art-meta",children:[(0,i.jsxs)("span",{className:"art-meta-text",children:[Cn,t.scope==="workspace"?" \xB7 "+e("scope.workspace"):null]}),(0,i.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,i.jsx)(b.Menu,{open:he==="version",onClose:()=>ie(null),items:Rn,onSelect:Dn,portal:!0,autoFocus:!0,anchor:(0,i.jsxs)("button",{type:"button",className:"art-version-button","aria-label":e("tab.versionPicker"),"aria-haspopup":"menu","aria-expanded":he==="version",onClick:()=>void Tn(),children:[e("gallery.version",{version:na}),(0,i.jsx)(b.IconChevronDownOutlineRegular,{size:12})]})}),(0,i.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,i.jsx)("span",{className:"art-save-status","data-tone":Nn,"aria-live":"polite",children:Sn})]})]})]}),(0,i.jsxs)("div",{className:"art-actions art-editor-actions",children:[X==="doc"?null:(0,i.jsx)(b.SegmentedControl,{id:"art-mode-"+m,className:"art-segment",label:e("tab.mode"),value:S,options:X==="design"?[{value:"view",label:e("canvas.viewMode")},{value:"edit",label:e("canvas.editMode"),disabled:de,title:de?e("canvas.editOldVersion"):void 0},{value:"source",label:e("tab.source")}]:[{value:"view",label:e("tab.preview")},{value:"source",label:e("tab.source")}],onChange:f=>{V(f),ve(null),P(X==="design"&&f==="edit"&&!de)}}),X==="design"&&S==="edit"&&!de?(0,i.jsx)(He,{label:e("canvas.inspector"),icon:(0,i.jsx)(b.IconSlidersTwoOutlineRegular,{size:16}),pressed:_,onClick:()=>{_?P(!1):(F(!1),P(!0))}}):null,h===null||de?null:(0,i.jsx)(He,{label:e("tab.save"),icon:(0,i.jsx)(b.IconSaveOutlineRegular,{size:16}),disabled:x,onClick:()=>void s.save()}),(0,i.jsx)(He,{buttonRef:Fa,label:e("tab.history"),icon:(0,i.jsx)(b.IconClockOutlineRegular,{size:16}),pressed:C,onClick:()=>{C?Va():ta()}}),Je?null:(0,i.jsx)(b.Menu,{open:he==="export",onClose:()=>ie(null),items:Ga,onSelect:$a,align:"end",portal:!0,autoFocus:!0,anchor:(0,i.jsx)(b.Button,{size:"sm",icon:(0,i.jsx)(b.IconDownloadOutlineRegular,{size:14}),"aria-label":e("tab.export"),"aria-haspopup":"menu","aria-expanded":he==="export",disabled:fe||et,onClick:()=>ie(he==="export"?null:"export"),children:e("tab.export")})}),zn,(0,i.jsx)(b.Menu,{open:he==="more",onClose:()=>ie(null),items:An,onSelect:En,align:"end",portal:!0,autoFocus:!0,anchor:(0,i.jsx)(b.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.more"),"aria-haspopup":"menu","aria-expanded":he==="more",onClick:()=>ie(he==="more"?null:"more"),children:(0,i.jsx)(b.IconEllipsisOutlineRegular,{size:14})})})]})]}),gn?(0,i.jsxs)("form",{className:"art-inline-form",onSubmit:f=>{f.preventDefault(),wn()},children:[(0,i.jsx)("input",{"aria-label":e("tab.rename"),value:Qt,maxLength:120,autoFocus:!0,onChange:f=>La(f.target.value),onKeyDown:f=>{f.key==="Escape"&&bt(!1)}}),(0,i.jsx)(b.Button,{type:"submit",size:"sm",variant:"primary",disabled:v||x,children:e("tab.save")}),(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>bt(!1),children:e("create.cancel")})]}):null,Oa===null?null:(0,i.jsxs)("div",{className:"art-bar",role:"status",children:[(0,i.jsx)("span",{children:e("tab.agentUpdate",{version:Oa})}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>{at(null),ta()},children:e("tab.viewHistory")}),(0,i.jsx)(b.Button,{size:"sm",onClick:()=>at(null),children:e("tab.dismiss")})]})]}),x?(0,i.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"alert",children:[(0,i.jsxs)("span",{className:"art-bar-text",children:[(0,i.jsx)("strong",{children:e("tab.conflictTitle")}),(0,i.jsx)("span",{children:e("tab.conflictHint")})]}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>void aa(h??"","action.copied"),children:e("tab.copyDraft")}),(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>Oe(wt),children:e("tab.discardReload")})]})]}):null,!x&&d!==void 0?(0,i.jsxs)("div",{className:"art-bar","data-tone":"error",role:"alert",children:[(0,i.jsx)("span",{children:p??e(te(d))}),(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>void s.save(),children:e("action.retry")})]}):null,ne===null?null:(0,i.jsxs)("div",{className:"art-bar",role:"status",children:[(0,i.jsx)("span",{children:e("tab.viewingOld",{version:ne.version,current:c.version})}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>{++xe.current,Me(!1),We(null),ve(null)},children:e("tab.backToCurrent")}),(0,i.jsx)(b.Button,{size:"sm",variant:"outline",disabled:fe,onClick:()=>void kn(),children:e("tab.restoreThis")})]})]}),X!=="design"||_e===null?null:(0,i.jsxs)("div",{className:"art-bar","data-tone":"error",role:"alert",children:[(0,i.jsx)("span",{children:e("canvas.startFailed")}),(0,i.jsx)("span",{className:"art-bar-actions",children:(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>{Ue(null),yt(f=>f+1)},children:e("action.retry")})})]}),(0,i.jsxs)("div",{className:"art-body",children:[(0,i.jsxs)("div",{className:"art-stage",role:X==="doc"?void 0:"tabpanel",id:X==="doc"?void 0:"art-mode-"+m+"-"+S+"-panel","aria-labelledby":X==="doc"?void 0:"art-mode-"+m+"-"+S,children:[X==="page"&&Ge!==null&&!C?(0,i.jsx)(vo,{quote:Ge.text,askLabel:e("agent.ask"),dismissLabel:e("tab.dismiss"),onAsk:()=>void rt(Ge),onDismiss:()=>ve(null)}):null,X==="design"&&S!=="source"&&!de&&N[0]!==void 0?(0,i.jsx)(xo,{t:e,layer:N[0],askLabel:e("agent.ask"),dismissLabel:e("tab.dismiss"),onAsk:()=>{let f=O?.quoteSelection();f!=null&&rt(va(e,f),"agent.addedTruncatedDesign")},onDismiss:()=>O?.clearSelection()}):null,X==="doc"?(0,i.jsx)(Lt,{markdown:nt,revision:(ne?.version??0)+":"+y.revision,editable:!de&&!x,label:c.manifest.title,loadingLabel:e("empty.loading"),failedLabel:e("error.generic"),design:c.design,dark:L,t:e,onChange:f=>s.edit(f),onSave:()=>void s.save(),onSelectionText:ra,selectionAction:Ge===null?null:(0,i.jsx)(b.Button,{size:"sm",variant:"primary",icon:(0,i.jsx)(b.IconSparkleRegular,{size:14}),onMouseDown:f=>f.preventDefault(),onClick:()=>void rt(Ge),children:e("agent.ask")})}):S!=="source"?X==="design"?de?(0,i.jsx)(ya,{t:e,where:u,id:m,version:na,title:c.manifest.title}):(0,i.jsx)(Tr,{t:e,source:nt,revision:"0:"+y.revision,title:c.manifest.title,mode:S==="edit"?"edit":"view",onChange:f=>s.edit(f),onSave:()=>void s.save(),onFailure:vn,onHandle:bn,onSelection:hn,attempt:Kt,fallback:(0,i.jsx)(ya,{t:e,where:u,id:m,version:na,title:c.manifest.title})}):(0,i.jsx)(jt,{content:nt,designCss:c.designCss,title:c.manifest.title,frameTitle:e("tab.frameTitle",{title:c.manifest.title}),dark:L,onSelectionText:ra}):In?(0,i.jsx)(jr,{value:nt,readOnly:!1,label:e("tab.source"),hint:e(X==="design"?"tab.manualSaveDesign":"tab.manualSave"),onChange:f=>s.edit(f),onSave:()=>void s.save(),onSelectionText:ra}):(0,i.jsxs)("div",{className:"art-code",ref:ja,children:[(0,i.jsxs)("div",{className:"art-code-bar",children:[(0,i.jsx)("span",{children:e(de?"tab.readOnly":"tab.codeHint")}),de?null:(0,i.jsx)(b.Button,{size:"sm",variant:"outline",icon:(0,i.jsx)(b.IconEditOutlineRegular,{size:14}),onClick:()=>H(!0),children:e("tab.editSource")})]}),(0,i.jsx)(b.CodeBlock,{code:nt,lang:X==="design"?"jsx":"html",lineNumbers:!0,showHeader:!1,wrap:!0,className:"art-code-block",copyLabel:e("code.copy"),copiedLabel:e("action.copied")})]})]}),!C&&!_?null:(0,i.jsx)(wo,{label:e(C?"history.title":"canvas.inspector"),closeLabel:e(C?"history.close":"canvas.closeInspector"),overlay:Je,onClose:C?Va:xn,head:C?void 0:(0,i.jsx)(b.SegmentedTabs,{className:"art-inspector-tabs",items:[{value:"layers",label:e("panel.layers"),id:"art-inspector-"+m+"-layers-tab",panelId:"art-inspector-"+m+"-layers"},{value:"properties",label:e("panel.properties"),id:"art-inspector-"+m+"-properties-tab",panelId:"art-inspector-"+m+"-properties"}],value:A,onChange:$,label:e("canvas.inspectorTabs"),size:"sm"}),children:C?(0,i.jsx)(Or,{t:e,versions:za,failed:fn,current:c.version,selected:ne?.version??c.version,onSelect:f=>void _a(f)}):(0,i.jsx)("div",{className:"art-inspector",role:"tabpanel",id:"art-inspector-"+m+"-"+A,"aria-labelledby":"art-inspector-"+m+"-"+A+"-tab",children:(0,i.jsx)(Sr,{t:e,handle:O,snapshot:E,tab:A})})})]}),(0,i.jsx)(b.Modal,{open:Xt!==null,onClose:()=>tt(null),title:e("tab.leaveTitle"),closeLabel:e("dialog.close"),description:e(x?"tab.conflictHint":"tab.leaveHint"),footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(b.Button,{variant:"outline",disabled:fe,onClick:()=>tt(null),children:e("create.cancel")}),(0,i.jsx)(b.Button,{variant:"outline",disabled:v||fe,onClick:()=>{let f=Xt?.run;tt(null),f!==void 0&&s.discardAndReload().then(f)},children:e("tab.leaveDiscard")}),(0,i.jsx)(b.Button,{variant:"primary",disabled:x||fe,onClick:async()=>{Re(!0);let f=await s.save();Re(!1);let R=Xt?.run;f&&R!==void 0&&(tt(null),await R())},children:e("tab.leaveSave")})]}),children:d===void 0?null:(0,i.jsx)("p",{className:"art-modal-error",role:"alert",children:p??e(te(d))})}),(0,i.jsx)(b.Modal,{open:mn,onClose:()=>ht(!1),title:e("tab.deleteTitle"),closeLabel:e("dialog.close"),description:e("tab.deleteConfirm",{title:c.manifest.title}),footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(b.Button,{variant:"outline",onClick:()=>ht(!1),children:e("create.cancel")}),(0,i.jsx)(b.Button,{variant:"primary",onClick:()=>{ht(!1),Oe(async()=>{try{await U.remove(u,m),Te(),r?.()}catch(f){Z(e(te(ee(f))))}})},children:e("tab.delete")})]})}),(0,i.jsx)(b.Modal,{open:Ma!==null,onClose:()=>Zt(null),title:e("agent.copyTitle"),closeLabel:e("dialog.close"),description:e("action.copyFailed"),footer:(0,i.jsx)(b.Button,{variant:"primary",onClick:()=>Zt(null),children:e("dialog.done")}),children:(0,i.jsx)("textarea",{className:"art-fallback",readOnly:!0,value:Ma??"","aria-label":e("agent.copyTitle"),onFocus:f=>f.currentTarget.select()})})]})}var _r=Bn(require("react"),1),Ur=require("@deepseek-ai/dsh-client-ui-primitives"),Ve=require("react/jsx-runtime"),Ft=class extends _r.default.Component{constructor(t){super(t),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,Ve.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",children:(0,Ve.jsxs)("div",{className:"art-center",role:"alert",children:[(0,Ve.jsx)("p",{className:"art-center-title",children:this.props.title}),(0,Ve.jsx)("p",{className:"art-center-hint",children:this.props.hint}),(0,Ve.jsx)(Ur.Button,{size:"sm",variant:"outline",onClick:()=>window.location.reload(),children:this.props.reloadLabel})]})}):this.props.children}};var Bt=require("react"),Xe=require("@deepseek-ai/dsh-client-ui-primitives");var Ce={sidebarRight:null,layout:null};var M=require("react/jsx-runtime");function To(e){if(e===null||typeof e!="object")return null;let t={...e},{id:a,type:r,title:n,version:o,workspaceId:l}=t;if(t.kind!=="artifact"||typeof a!="string"||typeof n!="string"||typeof o!="number"||r!=="page"&&r!=="doc"&&r!=="design")return null;let s=Ya(a);return s===void 0?null:s==="workspace"?typeof l!="string"||l===""?null:{id:a,type:r,title:n,version:o,address:{scope:s,workspaceId:l,id:a}}:{id:a,type:r,title:n,version:o,address:{scope:s,id:a}}}function So(e){return Array.isArray(e)?e.map(t=>{if(t===null||typeof t!="object")return"";let a={...t};return a.type==="text"&&typeof a.text=="string"?a.text:""}).filter(t=>t!=="").join(`
39
+ `).trim():""}function No(e){if(e===null||typeof e!="object")return;let t={...e};return typeof t.title=="string"&&t.title.trim()!==""?t.title.trim():void 0}var Wr=new Set;function Ta({t:e,phase:t,toolName:a,block:r}){let n=t==="result"&&r?.isError!==!0?To(r?.meta):null,o=(0,Bt.useRef)(t!=="result");t!=="result"&&(o.current=!0);let l=a==="artifact_update";if((0,Bt.useEffect)(()=>{if(n===null)return;ke(n.id,n.title),Fe(n.id,n.version),Te();let y=n.id+":"+n.version;!o.current||Wr.has(y)||(Wr.add(y),Ce.sidebarRight?.openResource(K(n.address)))},[n?.id,n?.version,n?.title]),t!=="result"){let y=No(r?.args),c=y===void 0?e(l?"card.updatingUntitled":"card.working"):e(l?"card.updating":"card.creating",{title:y});return(0,M.jsxs)("div",{className:"art-card","data-artifact-card":"working",children:[(0,M.jsx)("span",{className:"art-card-icon",children:(0,M.jsx)(ge,{})}),(0,M.jsx)("span",{className:"art-card-text",children:(0,M.jsx)(Xe.TextShimmer,{active:!0,className:"art-card-title",children:(0,M.jsx)("span",{role:"status",children:c})})}),(0,M.jsx)(Xe.StateDot,{state:"ongoing"})]})}if(r?.isError===!0)return(0,M.jsxs)("div",{className:"art-card","data-artifact-card":"error",children:[(0,M.jsx)("span",{className:"art-card-icon","data-tone":"error",children:(0,M.jsx)(ge,{})}),(0,M.jsxs)("span",{className:"art-card-text",children:[(0,M.jsx)("span",{className:"art-card-title",children:e("card.failed")}),(0,M.jsx)("span",{className:"art-card-sub","data-tone":"error",children:So(r.content)})]})]});if(n===null)return(0,M.jsxs)("div",{className:"art-card","data-artifact-card":"missing",children:[(0,M.jsx)("span",{className:"art-card-icon",children:(0,M.jsx)(ge,{})}),(0,M.jsx)("span",{className:"art-card-sub",children:e("card.missing")})]});let s=K(n.address);return(0,M.jsxs)("button",{type:"button",className:"art-card art-card-open","data-artifact-card":"ready","data-artifact-id":n.id,"aria-label":e("card.openNamed",{title:n.title}),onClick:()=>Ce.sidebarRight?.openResource(s),children:[(0,M.jsx)("span",{className:"art-card-icon",children:n.type==="page"?(0,M.jsx)(ge,{}):n.type==="doc"?(0,M.jsx)(Ne,{}):(0,M.jsx)(Be,{})}),(0,M.jsxs)("span",{className:"art-card-text",children:[(0,M.jsx)("span",{className:"art-card-title",title:n.title,children:n.title}),(0,M.jsxs)("span",{className:"art-card-sub",children:[e(l?"card.updated":"card.created")," \xB7 ",e(`type.${n.type}`)," \xB7 ",e("gallery.version",{version:n.version}),n.address.scope==="library"?" \xB7 "+e("scope.library"):""]})]}),(0,M.jsx)("span",{className:"art-card-go","aria-hidden":"true",children:(0,M.jsx)(Xe.IconChevronRightOutlineRegular,{size:14})})]})}var ft=require("react"),_t=require("@deepseek-ai/dsh-client-ui-primitives");var Gr=require("react");function Ht({sessionId:e,useSessions:t,useWorkspaces:a}){let r=a(o=>o.items),n=t(o=>o.byId[e]);return(0,Gr.useMemo)(()=>{let o=typeof n?.cwd=="string"?n.cwd:null,l=r.find(s=>s.sessionIds?.includes(e))??r.find(s=>o!==null&&(o===s.path||o.startsWith(`${s.path}/`)))??null;return{root:o??l?.path??null,workspaceId:l?.workspaceId??null}},[r,n,e])}var ut="dsh-artifact-studio/artifact",Sa="artifact",Ze="dsh-artifact-studio-panel",Vt="dsh-artifact-studio/artifacts",Na="artifacts";var Pe=require("react/jsx-runtime"),Co=6,Ca=["dashboard","explainer","report","brief"];function Io(e,t){let a=e.filter(n=>n.source.sessionId===t),r=e.filter(n=>n.source.sessionId!==t);return[...a,...r].slice(0,Co)}function $r(e){let{t,sessionId:a,inputActions:r}=e,o=Ht(e).workspaceId,l=Dt(),[s,y]=(0,ft.useState)(!1),[c,h]=(0,ft.useState)(null);(0,ft.useEffect)(()=>{if(!s||o===null)return;let p=new AbortController;return U.list({scope:"workspace",workspaceId:o},{},p.signal).then(u=>{p.signal.aborted||h(Io(u.items,a))}).catch(()=>{p.signal.aborted||h([])}),()=>p.abort()},[s,o,a,l]);let v=o===null?[{type:"label",id:"no-workspace",text:t("empty.noWorkspace")}]:c===null?[{type:"label",id:"loading",text:t("empty.loading")}]:c.length===0?[{type:"label",id:"empty",text:t("composer.empty")}]:c.map(p=>({id:"open:"+p.id,label:p.title,icon:p.type==="page"?(0,Pe.jsx)(ge,{size:14}):p.type==="doc"?(0,Pe.jsx)(Ne,{size:14}):(0,Pe.jsx)(Be,{size:14})})),x=[{type:"label",id:"recent",text:t("composer.recent")},...v,...r===void 0?[]:[{type:"separator",id:"start-gap"},{type:"label",id:"start",text:t("composer.start")},...Ca.map(p=>({id:"prompt:"+p,label:t(`prompt.${p}`)}))],{type:"separator",id:"all-gap"},{id:"all",label:t("composer.all")}];return(0,Pe.jsx)(_t.Menu,{open:s,onClose:()=>y(!1),items:x,onSelect:p=>{if(y(!1),p==="all"){Ce.layout?.selectPanel(Ze);return}if(p.startsWith("prompt:")&&r!==void 0){r.insertText(t(`prompt.${p.slice(7)}Text`),r.captureInsertion());return}let u=c?.find(m=>"open:"+m.id===p);u===void 0||o===null||(ke(u.id,u.title),Ce.sidebarRight?.openResource(K({scope:"workspace",workspaceId:o,id:u.id})))},side:"top",portal:!0,autoFocus:!0,anchor:(0,Pe.jsx)(_t.Tooltip,{label:t("composer.label"),side:"top",portal:!0,children:(0,Pe.jsx)("button",{type:"button",className:"art-composer","aria-label":t("composer.label"),"aria-haspopup":"menu","aria-expanded":s,onClick:()=>y(p=>!p),children:(0,Pe.jsx)(ct,{})})})})}var G=require("react");var j=require("react"),z=require("@deepseek-ai/dsh-client-ui-primitives");var Ie=require("react"),Ut=require("@deepseek-ai/dsh-client-ui-primitives");var I=require("react/jsx-runtime"),Ao=["sm","md","lg"],Eo=e=>`<!doctype html><html><head><meta name="color-scheme" content="light dark"><style>
40
40
  body { margin: 0; padding: 20px; font-family: var(--artifact-font-family); background: var(--artifact-color-surface); color: var(--artifact-color-text); }
41
41
  h2 { margin: 0 0 6px; font-family: var(--artifact-font-display); font-size: var(--artifact-font-size-4); letter-spacing: -0.02em; }
42
42
  p { margin: 0 0 14px; color: var(--artifact-color-muted); }
43
43
  .row { display: flex; gap: 8px; align-items: center; }
44
- button { padding: 8px 14px; border: 0; border-radius: var(--artifact-radius-md); background: var(--artifact-color-primary); color: var(--artifact-color-surface); font: inherit; }
45
- .tag { padding: 3px 8px; border-radius: var(--artifact-radius-sm); background: color-mix(in srgb, var(--artifact-color-accent) 18%, transparent); color: var(--artifact-color-accent); font-size: 12px; }
44
+ button { padding: 8px 14px; border: 0; border-radius: var(--artifact-radius-md); background: var(--artifact-color-action); color: var(--artifact-color-action-text); font: inherit; }
45
+ .tag { padding: 3px 8px; border-radius: var(--artifact-radius-sm); background: var(--artifact-color-raised); color: var(--artifact-color-success); font-size: 12px; }
46
46
  code { font-family: var(--artifact-font-mono); font-size: 12px; }
47
47
  </style></head><body><h2>${e("design.previewHeading")}</h2><p>${e("design.previewBody")}</p>
48
- <div class="row"><button>${e("design.previewButton")}</button><span class="tag">+12%</span><code>var(--artifact-color-primary)</code></div></body></html>`;function Co(e){return/^#[0-9a-f]{6}$/i.test(e)}function Ur({t:e,workspaceId:t,workspaceTitle:a}){let[r,n]=(0,Ne.useState)(null),[o,l]=(0,Ne.useState)(null),[s,g]=(0,Ne.useState)(!1),[d,b]=(0,Ne.useState)(!1),T=Ye();(0,Ne.useEffect)(()=>{let p=new AbortController;return U.designSystem(t,p.signal).then(y=>{n(y),l(y.tokens)}).catch(()=>{p.signal.aborted||g(!0)}),()=>p.abort()},[t]);let w=(0,Ne.useMemo)(()=>o===null?"":$a(o),[o]);if(s)return(0,E.jsx)("p",{className:"art-note",children:e("error.generic")});if(r===null||o===null)return(0,E.jsx)("p",{className:"art-note",children:e("empty.loading")});let c=async p=>{b(!0);try{let y=await U.saveDesignSystem({scope:p,workspaceId:t},o);n(y),l(y.tokens),Q(e("design.saved"))}catch(y){Q(e(J(Z(y))))}finally{b(!1)}},u=async()=>{if(t!==null){b(!0);try{let p=await U.clearDesignSystem(t);n(p),l(p.tokens)}catch(p){Q(e(J(Z(p))))}finally{b(!1)}}};return(0,E.jsxs)("div",{className:"art-design",children:[(0,E.jsxs)("p",{className:"art-design-source",children:[e("design.hint")," ",e(`design.source.${r.source}`)]}),(0,E.jsxs)("div",{className:"art-design-group",children:[(0,E.jsx)("h3",{children:e("design.preview")}),(0,E.jsx)("div",{className:"art-design-preview",style:{height:150,display:"flex"},children:(0,E.jsx)(Ot,{content:No(e),designCss:w,title:o.name,frameTitle:e("design.preview"),dark:T})})]}),(0,E.jsxs)("label",{className:"art-field",children:[e("design.name"),(0,E.jsx)("input",{type:"text",value:o.name,maxLength:80,onChange:p=>l({...o,name:p.target.value})})]}),["colors","colorsDark"].map(p=>(0,E.jsxs)("div",{className:"art-design-group",children:[(0,E.jsx)("h3",{children:e(p==="colors"?"design.colors":"design.colorsDark")}),(0,E.jsx)("div",{className:"art-swatches",children:nt.map(y=>{let z=N=>{let j={...o[p],[y]:N};l({...o,[p]:j})};return(0,E.jsxs)("div",{className:"art-swatch",children:[(0,E.jsx)("input",{type:"color","aria-label":e(`design.color.${y}`)+" "+e(p==="colors"?"design.colors":"design.colorsDark"),value:Co(o[p][y])?o[p][y]:"#000000",onChange:N=>z(N.target.value)}),(0,E.jsxs)("span",{className:"art-swatch-text",children:[e(`design.color.${y}`),(0,E.jsx)("input",{type:"text","aria-label":e(`design.color.${y}`)+" "+e(p==="colors"?"design.colors":"design.colorsDark")+" CSS",value:o[p][y],onChange:N=>z(N.target.value)})]})]},y)})})]},p)),(0,E.jsxs)("div",{className:"art-design-group",children:[(0,E.jsx)("h3",{children:e("design.type")}),(0,E.jsxs)("label",{className:"art-field",children:[e("design.font"),(0,E.jsx)("input",{type:"text",value:o.typography.fontFamily,onChange:p=>l({...o,typography:{...o.typography,fontFamily:p.target.value}})})]}),(0,E.jsxs)("label",{className:"art-field",children:[e("design.display"),(0,E.jsx)("input",{type:"text",value:o.typography.displayFamily,onChange:p=>l({...o,typography:{...o.typography,displayFamily:p.target.value}})})]}),(0,E.jsxs)("label",{className:"art-field",children:[e("design.mono"),(0,E.jsx)("input",{type:"text",value:o.typography.monoFamily,onChange:p=>l({...o,typography:{...o.typography,monoFamily:p.target.value}})})]})]}),(0,E.jsxs)("div",{className:"art-design-group",children:[(0,E.jsx)("h3",{children:e("design.radius")}),(0,E.jsx)("div",{className:"art-radius-row",children:So.map(p=>(0,E.jsxs)("label",{children:[e(`design.radius.${p}`),(0,E.jsx)("input",{type:"number",min:0,max:64,value:o.radius[p],onChange:y=>l({...o,radius:{...o.radius,[p]:Number(y.target.value)||0}})})]},p))})]}),(0,E.jsxs)("label",{className:"art-field",children:[e("design.notes"),(0,E.jsx)("textarea",{value:o.notes,maxLength:4e3,onChange:p=>l({...o,notes:p.target.value})}),(0,E.jsx)("span",{className:"art-field-hint",children:e("design.notesHint")})]}),(0,E.jsxs)("div",{className:"art-design-actions",children:[t===null?null:(0,E.jsx)(Ht.Button,{size:"sm",variant:"primary",disabled:d,onClick:()=>void c("workspace"),children:a===void 0?e("design.saveWorkspace"):e("design.saveWorkspaceNamed",{name:a})}),(0,E.jsx)(Ht.Button,{size:"sm",variant:t===null?"primary":"outline",disabled:d,onClick:()=>void c("library"),children:e("design.saveLibrary")}),r.source==="workspace"&&t!==null?(0,E.jsx)(Ht.Button,{size:"sm",variant:"outline",disabled:d,onClick:()=>void u(),children:e("design.clear")}):null]})]})}var $r=require("react"),Wr="dsh-artifact-studio.pins";function Io(){if(typeof window>"u")return new Set;try{let e=window.localStorage.getItem(Wr);if(e===null)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(a=>typeof a=="string")):new Set}catch{return new Set}}var Vt=Io(),wa=new Set;function Eo(e){return wa.add(e),()=>wa.delete(e)}function Gr(){return(0,$r.useSyncExternalStore)(Eo,()=>Vt,()=>Vt)}function qr(e){let t=new Set(Vt);t.has(e)?t.delete(e):t.add(e),Vt=t;try{window.localStorage.setItem(Wr,JSON.stringify([...t]))}catch{}for(let a of wa)a()}var Ro=`<!doctype html>
48
+ <div class="row"><button>${e("design.previewButton")}</button><span class="tag">+12%</span><code>var(--artifact-color-primary)</code></div></body></html>`;function Ro(e){return/^#[0-9a-f]{6}$/i.test(e)}function qr({t:e,workspaceId:t,workspaceTitle:a}){let[r,n]=(0,Ie.useState)(null),[o,l]=(0,Ie.useState)(null),[s,y]=(0,Ie.useState)(!1),[c,h]=(0,Ie.useState)(!1),v=Qe();(0,Ie.useEffect)(()=>{let u=new AbortController;return U.designSystem(t,u.signal).then(m=>{n(m),l(m.tokens)}).catch(()=>{u.signal.aborted||y(!0)}),()=>u.abort()},[t]);let x=(0,Ie.useMemo)(()=>o===null?"":Qa(o),[o]);if(s)return(0,I.jsx)("p",{className:"art-note",children:e("error.generic")});if(r===null||o===null)return(0,I.jsx)("p",{className:"art-note",children:e("empty.loading")});let d=async u=>{h(!0);try{let m=await U.saveDesignSystem({scope:u,workspaceId:t},o);n(m),l(m.tokens),Z(e("design.saved"))}catch(m){Z(e(te(ee(m))))}finally{h(!1)}},p=async()=>{if(t!==null){h(!0);try{let u=await U.clearDesignSystem(t);n(u),l(u.tokens)}catch(u){Z(e(te(ee(u))))}finally{h(!1)}}};return(0,I.jsxs)("div",{className:"art-design",children:[(0,I.jsxs)("p",{className:"art-design-source",children:[e("design.hint")," ",e(`design.source.${r.source}`)]}),(0,I.jsxs)("div",{className:"art-design-group",children:[(0,I.jsx)("h3",{children:e("design.preview")}),(0,I.jsx)("div",{className:"art-design-preview",style:{height:150,display:"flex"},children:(0,I.jsx)(jt,{content:Eo(e),designCss:x,title:o.name,frameTitle:e("design.preview"),dark:v})})]}),(0,I.jsxs)("label",{className:"art-field",children:[e("design.name"),(0,I.jsx)("input",{type:"text",value:o.name,maxLength:80,onChange:u=>l({...o,name:u.target.value})})]}),["colors","colorsDark"].map(u=>(0,I.jsxs)("div",{className:"art-design-group",children:[(0,I.jsx)("h3",{children:e(u==="colors"?"design.colors":"design.colorsDark")}),(0,I.jsx)("div",{className:"art-swatches",children:it.map(m=>{let L=S=>{let V={...o[u],[m]:S};l({...o,[u]:V})};return(0,I.jsxs)("div",{className:"art-swatch",children:[(0,I.jsx)("input",{type:"color","aria-label":e(`design.color.${m}`)+" "+e(u==="colors"?"design.colors":"design.colorsDark"),value:Ro(o[u][m])?o[u][m]:"#000000",onChange:S=>L(S.target.value)}),(0,I.jsxs)("span",{className:"art-swatch-text",children:[e(`design.color.${m}`),(0,I.jsx)("input",{type:"text","aria-label":e(`design.color.${m}`)+" "+e(u==="colors"?"design.colors":"design.colorsDark")+" CSS",value:o[u][m],onChange:S=>L(S.target.value)})]})]},m)})})]},u)),(0,I.jsxs)("div",{className:"art-design-group",children:[(0,I.jsx)("h3",{children:e("design.type")}),(0,I.jsxs)("label",{className:"art-field",children:[e("design.font"),(0,I.jsx)("input",{type:"text",value:o.typography.fontFamily,onChange:u=>l({...o,typography:{...o.typography,fontFamily:u.target.value}})})]}),(0,I.jsxs)("label",{className:"art-field",children:[e("design.display"),(0,I.jsx)("input",{type:"text",value:o.typography.displayFamily,onChange:u=>l({...o,typography:{...o.typography,displayFamily:u.target.value}})})]}),(0,I.jsxs)("label",{className:"art-field",children:[e("design.mono"),(0,I.jsx)("input",{type:"text",value:o.typography.monoFamily,onChange:u=>l({...o,typography:{...o.typography,monoFamily:u.target.value}})})]})]}),(0,I.jsxs)("div",{className:"art-design-group",children:[(0,I.jsx)("h3",{children:e("design.radius")}),(0,I.jsx)("div",{className:"art-radius-row",children:Ao.map(u=>(0,I.jsxs)("label",{children:[e(`design.radius.${u}`),(0,I.jsx)("input",{type:"number",min:0,max:64,value:o.radius[u],onChange:m=>l({...o,radius:{...o.radius,[u]:Number(m.target.value)||0}})})]},u))})]}),(0,I.jsxs)("label",{className:"art-field",children:[e("design.notes"),(0,I.jsx)("textarea",{value:o.notes,maxLength:4e3,onChange:u=>l({...o,notes:u.target.value})}),(0,I.jsx)("span",{className:"art-field-hint",children:e("design.notesHint")})]}),(0,I.jsxs)("div",{className:"art-design-actions",children:[t===null?null:(0,I.jsx)(Ut.Button,{size:"sm",variant:"primary",disabled:c,onClick:()=>void d("workspace"),children:a===void 0?e("design.saveWorkspace"):e("design.saveWorkspaceNamed",{name:a})}),(0,I.jsx)(Ut.Button,{size:"sm",variant:t===null?"primary":"outline",disabled:c,onClick:()=>void d("library"),children:e("design.saveLibrary")}),r.source==="workspace"&&t!==null?(0,I.jsx)(Ut.Button,{size:"sm",variant:"outline",disabled:c,onClick:()=>void p(),children:e("design.clear")}):null]})]})}var Kr=require("react"),Yr="dsh-artifact-studio.pins";function Do(){if(typeof window>"u")return new Set;try{let e=window.localStorage.getItem(Yr);if(e===null)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(a=>typeof a=="string")):new Set}catch{return new Set}}var Wt=Do(),Ia=new Set;function zo(e){return Ia.add(e),()=>Ia.delete(e)}function Qr(){return(0,Kr.useSyncExternalStore)(zo,()=>Wt,()=>Wt)}function Xr(e){let t=new Set(Wt);t.has(e)?t.delete(e):t.add(e),Wt=t;try{window.localStorage.setItem(Yr,JSON.stringify([...t]))}catch{}for(let a of Ia)a()}var Po=`<!doctype html>
49
49
  <html lang="en">
50
50
  <head>
51
51
  <meta charset="utf-8">
@@ -71,10 +71,10 @@ code { font-family: var(--artifact-font-mono); font-size: 12px; }
71
71
  </main>
72
72
  </body>
73
73
  </html>
74
- `,Ao=`# {{title}}
74
+ `,Lo=`# {{title}}
75
75
 
76
76
  Start writing, or select text and choose Edit with agent.
77
- `,zo=`<Frame w={720} p={40} bg="#ffffff" flex="col" gap={12}>
77
+ `,Mo=`<Frame w={720} p={40} bg="#ffffff" flex="col" gap={12}>
78
78
  <Text size={13} weight={600} color="#2856c7">DESIGN</Text>
79
79
  <Text size={40} weight={700} color="#16181d">{{title}}</Text>
80
80
  <Text size={16} color="#5b6170">Edit the source, or ask the agent for a change.</Text>
@@ -82,9 +82,9 @@ Start writing, or select text and choose Edit with agent.
82
82
  <Text size={15} weight={600} color="#ffffff">Get started</Text>
83
83
  </Frame>
84
84
  </Frame>
85
- `;function Do(e){return e.replace(/[&<>"']/g,t=>`&#${t.charCodeAt(0)};`)}function Po(e){return e.replace(/[\\`*_\[\]#]/g,t=>`\\${t}`)}function Mo(e){return e.replace(/[{}<>]/g," ")}function Kr(e,t){return e==="doc"?Ao.replace("{{title}}",Po(t)):e==="design"?zo.replace("{{title}}",Mo(t)):Ro.replace("{{title}}",Do(t))}var m=require("react/jsx-runtime");function Ut(e){return e.kind==="workspace"?"ws:"+e.workspaceId:e.kind}function Sa(e){if(e==="all")return{kind:"all"};if(e==="library")return{kind:"library"};if(e==null||!e.startsWith("ws:"))return;let t=e.slice(3);return t===""?void 0:{kind:"workspace",workspaceId:t}}function Xr(e,t,a){return e.scope==="library"?{manifest:e,address:{scope:"library",id:e.id},where:{scope:"library",workspaceId:t},project:null}:a===null?null:{manifest:e,address:{scope:"workspace",workspaceId:a.workspaceId,id:e.id},where:{scope:"workspace",workspaceId:a.workspaceId},project:a.title}}function Lo(e,t){e!==void 0&&(xe(t.manifest.id,t.manifest.title),e(q(t.address)))}function Zr(e){let t=q(e.address);return e.manifest.scope==="library"?t+"@"+(e.where.workspaceId??""):t}var pt=new Map,ka=new Map,Oo=2,_t=new Map,ut=[],Ta=0;function Yr(){for(;Ta<Oo&&ut.length>0;){let e=ut.shift();if(e===void 0)return;Ta+=1,e.start()}}function Fo(e){let t={start:()=>{e().finally(()=>{Ta-=1,Yr()})}};return ut.push(t),Yr(),()=>{let a=ut.indexOf(t);a!==-1&&ut.splice(a,1)}}function jo(e){let t=Zr(e),a=pt.get(t);if(a!==void 0&&a.version>=e.manifest.version)return Promise.resolve(a);let r=t+":"+e.manifest.version,n=ka.get(r);if(n!==void 0)return n;let o=U.get(e.where,e.manifest.id).then(l=>{let s={version:l.version,content:l.content,designCss:l.designCss},g=pt.get(t);return(g===void 0||g.version<=s.version)&&(pt.size>=60&&pt.clear(),pt.set(t,s)),s}).finally(()=>{ka.delete(r)});return ka.set(r,o),o}function Bo(e){if(typeof DOMParser>"u")return e.replace(/<script\b[^>]*>[\s\S]*?<\/script\s*>/gi,"").replace(/<script\b[^>]*\/?>/gi,"").replace(/\son[a-z]+\s*=\s*"[^"]*"/gi,"");let t=new DOMParser().parseFromString(e,"text/html");for(let a of t.querySelectorAll("script, iframe, object, embed, base"))a.remove();for(let a of t.querySelectorAll("*"))for(let r of[...a.attributes]){let n=r.name.toLowerCase();(n.startsWith("on")||n==="srcdoc")&&a.removeAttribute(r.name)}return t.documentElement.outerHTML}function Ho(e){let t=e.replace(/\x60{3}[\s\S]*?\x60{3}/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/<[^>]+>/g," ").replace(/[#>*_\x60~]/g," ").replace(/\s+/g," ").trim();return t.length>220?t.slice(0,220).trimEnd()+"...":t}function Vo({t:e,view:t}){let[a,r]=(0,O.useState)(null),[n,o]=(0,O.useState)(!1),[l,s]=(0,O.useState)(typeof IntersectionObserver>"u"),[g,d]=(0,O.useState)(null),[b,T]=(0,O.useState)(null),w=(0,O.useRef)(null),c=Ye(),u=Zr(t),p=t.manifest.title,y=t.manifest.type,z=t.manifest.version;(0,O.useEffect)(()=>{if(l)return;let D=w.current;if(D===null)return;let _=new IntersectionObserver(C=>{C.some(L=>L.isIntersecting)&&(s(!0),_.disconnect())},{rootMargin:"140px"});return _.observe(D),()=>_.disconnect()},[l]),(0,O.useEffect)(()=>{if(!l||y!=="design")return;let D=u+"@"+z,_=_t.get(D);if(_!==void 0){T(_),o(!1);return}let C=new AbortController,L=!1,B=Fo(async()=>{try{let I=await U.preview(t.where,t.manifest.id,z,C.signal);if(L)return;let H="data:"+I.mediaType+";base64,"+I.data;_t.size>=40&&_t.clear(),_t.set(D,H),T(H),o(!1)}catch{L||o(!0)}});return()=>{L=!0,C.abort(),B()}},[l,u,z,y]),(0,O.useEffect)(()=>{if(!l||y==="design")return;let D=!1;return jo(t).then(_=>{!D&&_.version===z&&(r(_),o(!1))}).catch(()=>{D||o(!0)}),()=>{D=!0}},[l,u,z]),(0,O.useEffect)(()=>{if(y!=="page"||a===null){d(null);return}let D=URL.createObjectURL(new Blob([Mt(Bo(a.content),a.designCss,p,c?"dark":"light")],{type:"text/html"}));return d(D),()=>URL.revokeObjectURL(D)},[a,y,p,c]);let N=y==="page"?(0,m.jsx)(fe,{}):y==="doc"?(0,m.jsx)(Te,{}):(0,m.jsx)(Be,{});if(n)return(0,m.jsx)("span",{className:"art-cover",ref:w,"aria-hidden":"true",children:(0,m.jsx)("span",{className:"art-cover-fallback",children:N})});if(y==="design")return(0,m.jsx)("span",{className:"art-cover",ref:w,"aria-hidden":"true",children:b===null?(0,m.jsx)("span",{className:"art-cover-fallback",children:N}):(0,m.jsx)("img",{className:"art-cover-design",src:b,alt:""})});if(y==="page")return(0,m.jsx)("span",{className:"art-cover",ref:w,"aria-hidden":"true",children:g===null?(0,m.jsx)("span",{className:"art-cover-fallback",children:N}):(0,m.jsx)("span",{className:"art-cover-frame-wrap",children:(0,m.jsx)("iframe",{className:"art-cover-frame",src:g,sandbox:"",title:e("gallery.coverTitle",{title:p}),tabIndex:-1,loading:"lazy",referrerPolicy:"no-referrer"})})});let j=a===null?"":Ho(a.content);return(0,m.jsx)("span",{className:"art-cover",ref:w,"aria-hidden":"true",children:j===""?(0,m.jsx)("span",{className:"art-cover-fallback",children:N}):(0,m.jsxs)("span",{className:"art-cover-doc",children:[(0,m.jsx)("span",{className:"art-cover-doc-title",children:p}),(0,m.jsx)("span",{className:"art-cover-doc-text",children:j})]})})}function _o({t:e,view:t,pinned:a,onOpen:r,showProject:n}){let o=q(t.address),l=e(a?"gallery.unpin":"gallery.pin",{title:t.manifest.title}),s=t.manifest.scope==="library"?" \xB7 "+e("scope.library"):n&&t.project!==null?" \xB7 "+t.project:"";return(0,m.jsxs)("li",{className:"art-tile",children:[(0,m.jsxs)("button",{type:"button",className:"art-tile-open",onClick:()=>r(t),children:[(0,m.jsx)(Vo,{t:e,view:t}),(0,m.jsxs)("span",{className:"art-tile-body",children:[(0,m.jsx)("span",{className:"art-tile-title",title:t.manifest.title,children:t.manifest.title}),(0,m.jsxs)("span",{className:"art-tile-sub",children:[e(`type.${t.manifest.type}`)," \xB7 ",e("gallery.updated",{time:Lt(e,t.manifest.updatedAt)})," \xB7 ",e("gallery.version",{version:t.manifest.version}),s]})]})]}),(0,m.jsx)(P.Tooltip,{label:l,side:"left",portal:!0,children:(0,m.jsx)("button",{type:"button",className:"art-tile-pin","aria-label":l,"aria-pressed":a,onClick:()=>qr(o),children:a?(0,m.jsx)(P.IconPinFillRegular,{size:14}):(0,m.jsx)(P.IconPinOutlineRegular,{size:14})})})]})}function Qr({t:e,heading:t,views:a,pinned:r,onOpen:n,showProject:o}){let l=(0,O.useId)();return a.length===0?null:(0,m.jsxs)("section",{className:"art-section","aria-labelledby":l,children:[(0,m.jsxs)("div",{className:"art-section-head",children:[(0,m.jsx)("h2",{className:"art-section-title",id:l,children:t}),(0,m.jsx)("span",{className:"art-section-hint",children:e("gallery.count",{count:a.length})})]}),(0,m.jsx)("ul",{className:"art-grid",children:a.map(s=>(0,m.jsx)(_o,{t:e,view:s,pinned:r.has(q(s.address)),onOpen:n,showProject:o},q(s.address)))})]})}function Uo(e,t,a){let r={where:{scope:"library",workspaceId:a},project:null};if(e.kind==="library")return[r];if(e.kind==="workspace"){let n=t.find(o=>o.workspaceId===e.workspaceId);return n===void 0?[]:[{where:{scope:"workspace",workspaceId:n.workspaceId},project:n}]}return[...t.map(n=>({where:{scope:"workspace",workspaceId:n.workspaceId},project:n})),r]}var $o=12;function Wo(e,t,a,r,n,o){let[l,s]=(0,O.useState)(1),[g,d]=(0,O.useState)({key:"",state:{status:"loading"}}),b=t.map(u=>u.workspaceId+":"+u.title).join(","),T=Ut(e)+":"+b+":"+(a??"")+":"+r+":"+(n??""),w=e.kind==="all",c=g.key===T?g.state:{status:"loading"};return(0,O.useEffect)(()=>s(1),[T,r]),(0,O.useEffect)(()=>{let u=Uo(e,t,a);if(u.length===0){d({key:T,state:{status:"ready",items:[],hasMore:!1,truncated:!1,failed:0}});return}let p=new AbortController,y=setTimeout(async()=>{let z=w?$o:void 0,N=await Promise.all(u.map(async B=>{let I=[];for(let H=0;H<l;H+=1)try{let W=await U.list(B.where,{query:r,type:n,offset:H*(z??50),...z===void 0?{}:{limit:z}},p.signal);if(I.push(W),!W.hasMore)break}catch(W){return{loaded:I,failed:!0,code:Z(W)}}return{loaded:I,failed:!1}}));if(p.signal.aborted)return;let j=[],D=!1,_=!1,C=0,L;if(N.forEach((B,I)=>{let H=u[I];if(H===void 0)return;B.failed&&(C+=1,L===void 0&&(L=B.code));let W=B.loaded[B.loaded.length-1];if(W!==void 0){W.hasMore&&(D=!0),W.truncated&&(_=!0);for(let V of B.loaded)for(let Pe of V.items){let R=Xr(Pe,a,H.project);R!==null&&j.push(R)}}}),C===u.length){d({key:T,state:{status:"failed",code:L}});return}j.sort((B,I)=>Date.parse(I.manifest.updatedAt)-Date.parse(B.manifest.updatedAt)),d({key:T,state:{status:"ready",items:j,hasMore:D,truncated:_,failed:C}})},r===""?0:180);return()=>{p.abort(),clearTimeout(y)}},[T,o,l]),{state:c,more:()=>s(u=>u+1)}}function Go({t:e,variant:t}){let a=t==="all"?"empty.allTitle":t==="library"?"empty.libraryTitle":"empty.workspaceTitle",r=t==="all"?"empty.allHint":t==="library"?"empty.libraryHint":"empty.workspaceHint",n=async o=>{try{await navigator.clipboard.writeText(o),Q(e("gallery.promptCopied"))}catch{Q(e("action.copyFailed"))}};return(0,m.jsxs)("div",{className:"art-empty",children:[(0,m.jsx)("p",{className:"art-empty-title",children:e(a)}),(0,m.jsx)("p",{className:"art-empty-hint",children:e(r)}),(0,m.jsx)("ul",{className:"art-starters",children:xa.map(o=>(0,m.jsxs)("li",{className:"art-starter",children:[(0,m.jsxs)("span",{className:"art-starter-text",children:[(0,m.jsx)("span",{className:"art-starter-name",children:e(`prompt.${o}`)}),(0,m.jsx)("span",{className:"art-starter-hint",children:e(`prompt.${o}Text`)})]}),(0,m.jsx)(P.Tooltip,{label:e("gallery.copyPrompt"),side:"left",portal:!0,children:(0,m.jsx)(P.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.copyPromptNamed",{name:e(`prompt.${o}`)}),onClick:()=>void n(e(`prompt.${o}Text`)),children:(0,m.jsx)(P.IconCopyOutlineRegular,{size:14})})})]},o))})]})}function Jr({t:e,projects:t,scope:a,contextWorkspaceId:r,onScopeChange:n,open:o}){let[l,s]=(0,O.useState)(""),[g,d]=(0,O.useState)(void 0),[b,T]=(0,O.useState)("list"),[w,c]=(0,O.useState)(!1),[u,p]=(0,O.useState)(0),y=Rt()+u,z=Gr(),N=Wo(a,t,r,l,g,y),j=(0,O.useId)(),D=t.find(S=>S.workspaceId===r)??null,_=a.kind==="library"?null:r,C=_===null?null:t.find(S=>S.workspaceId===_)??null,L=a.kind==="library"||D===null?"library":"workspace",B=L==="library"?e("scope.library"):D?.title??e("scope.library"),I=N.state,H=I.status==="ready"?I.items:[],W=(0,O.useCallback)(S=>Lo(o,S),[o]),V=(0,O.useCallback)(async(S,G)=>{if(G==="workspace"&&r===null)return;let ae=e(S==="page"?"create.untitledPage":S==="doc"?"create.untitledDoc":"create.untitledDesign");try{let{manifest:Me}=await U.create({scope:G,workspaceId:r},S,ae,Kr(S,ae));we();let ft=G==="workspace"?t.find($t=>$t.workspaceId===r)??null:null,mt=Xr(Me,r,ft);mt!==null&&W(mt)}catch(Me){Q(e(J(Z(Me))))}},[r,t,e,W]),Pe=H.filter(S=>z.has(q(S.address))),R=H.filter(S=>!z.has(q(S.address)));return(0,m.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"",children:[(0,m.jsxs)("header",{className:"art-header",children:[(0,m.jsxs)("div",{className:"art-heading",children:[b==="design"?(0,m.jsx)(P.Tooltip,{label:e("panel"),side:"bottom",portal:!0,children:(0,m.jsx)(P.Button,{size:"sm",className:"art-icon-button","aria-label":e("panel"),onClick:()=>T("list"),children:(0,m.jsx)(P.IconChevronLeftOutlineRegular,{size:16})})}):null,(0,m.jsx)("span",{className:"art-title",children:e(b==="design"?"design.title":"panel")})]}),b==="list"?(0,m.jsxs)("label",{className:"art-workspace",children:[(0,m.jsx)("span",{className:"art-workspace-label",children:e("scope.label")}),(0,m.jsxs)("select",{className:"art-workspace-select","aria-label":e("scope.label"),value:Ut(a),onChange:S=>{let G=Sa(S.target.value);G!==void 0&&n(G)},children:[(0,m.jsx)("option",{value:"all",children:e("scope.all")}),t.map(S=>(0,m.jsx)("option",{value:"ws:"+S.workspaceId,children:S.title},S.workspaceId)),(0,m.jsx)("option",{value:"library",children:e("scope.library")})]})]}):null,b==="list"?(0,m.jsxs)("div",{className:"art-actions",children:[(0,m.jsx)(P.Tooltip,{label:e("gallery.design"),side:"bottom",portal:!0,children:(0,m.jsx)(P.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.design"),onClick:()=>T("design"),children:(0,m.jsx)(ar,{size:16})})}),(0,m.jsx)(P.Tooltip,{label:e("gallery.refresh"),side:"bottom",portal:!0,children:(0,m.jsx)(P.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.refresh"),onClick:()=>p(S=>S+1),children:(0,m.jsx)(P.IconRefreshOutlineRegular,{size:16})})}),(0,m.jsx)(P.Menu,{open:w,onClose:()=>c(!1),align:"end",portal:!0,autoFocus:!0,items:[{id:"page",label:e("gallery.newPage")+" \xB7 "+B,icon:(0,m.jsx)(fe,{size:14})},{id:"doc",label:e("gallery.newDoc")+" \xB7 "+B,icon:(0,m.jsx)(Te,{size:14})},{id:"design",label:e("gallery.newDesign")+" \xB7 "+B,icon:(0,m.jsx)(Be,{size:14})}],onSelect:S=>{c(!1),V(S==="doc"?"doc":S==="design"?"design":"page",L)},anchor:(0,m.jsx)(P.Button,{size:"sm",variant:"outline",icon:(0,m.jsx)(P.IconPlusOutlineRegular,{size:14}),"aria-haspopup":"menu","aria-expanded":w,onClick:()=>c(S=>!S),children:e("gallery.create")})})]}):null]}),b==="design"?(0,m.jsx)("div",{className:"art-scroll",children:(0,m.jsx)(Ur,{t:e,workspaceId:_,workspaceTitle:C?.title})}):(0,m.jsx)("div",{className:"art-scroll",children:(0,m.jsxs)("div",{className:"art-gallery",children:[(0,m.jsxs)("div",{className:"art-toolbar",children:[(0,m.jsx)("input",{className:"art-search",type:"search","aria-label":e("gallery.searchLabel"),placeholder:e("gallery.search"),value:l,onChange:S=>s(S.target.value)}),(0,m.jsx)(P.SegmentedControl,{id:j,className:"art-segment",label:e("filter.type"),value:g??"all",options:[{value:"all",label:e("type.all")},{value:"page",label:e("type.page")},{value:"doc",label:e("type.doc")},{value:"design",label:e("type.design")}],onChange:S=>d(S==="all"?void 0:S)})]}),(0,m.jsxs)("div",{role:"tabpanel",id:j+"-"+(g??"all")+"-panel","aria-labelledby":j+"-"+(g??"all"),children:[I.status==="loading"?(0,m.jsx)("p",{className:"art-note",children:e("empty.loading")}):null,I.status==="failed"?(0,m.jsxs)("div",{className:"art-empty",role:"alert",children:[(0,m.jsx)("p",{className:"art-empty-title",children:e(J(I.code))}),(0,m.jsx)(P.Button,{size:"sm",variant:"outline",onClick:()=>p(S=>S+1),children:e("action.retry")})]}):null,I.status==="ready"&&I.failed>0?(0,m.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"status",children:[(0,m.jsx)("span",{children:e("gallery.failedProjects")}),(0,m.jsx)(P.Button,{size:"sm",variant:"outline",onClick:()=>p(S=>S+1),children:e("action.retry")})]}):null,I.status==="ready"&&I.items.length===0&&I.failed===0?l!==""?(0,m.jsx)("p",{className:"art-note",children:e("empty.noMatch")}):g!==void 0?(0,m.jsx)("p",{className:"art-note",children:e("empty.typeMatch",{type:e(`type.${g}`)})}):(0,m.jsx)(Go,{t:e,variant:a.kind}):null,I.status==="ready"&&I.items.length>0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Qr,{t:e,heading:e("gallery.pinned"),views:Pe,pinned:z,onOpen:W,showProject:a.kind==="all"}),R.length===0?(0,m.jsx)("p",{className:"art-note",children:e("gallery.allPinned")}):(0,m.jsx)(Qr,{t:e,heading:e("gallery.recent"),views:R,pinned:z,onOpen:W,showProject:a.kind==="all"}),I.hasMore?(0,m.jsx)("div",{className:"art-gallery-more",children:(0,m.jsx)(P.Button,{size:"sm",variant:"outline",onClick:N.more,children:e("gallery.more")})}):null,I.truncated?(0,m.jsx)("p",{className:"art-note",children:e("gallery.truncated")}):null]}):null]})]})})]})}var _e=require("react/jsx-runtime"),en="dsh-artifact-studio.panel.scope",tn="dsh-artifact-studio.panel.workspace";function an({t:e,workspaces:t}){let a=(0,ee.useCallback)(y=>t.subscribe(y),[t]),r=(0,ee.useCallback)(()=>t.getSnapshot(),[t]),o=(0,ee.useSyncExternalStore)(a,r,r).items,l=(0,ee.useMemo)(()=>o.map(({workspaceId:y,title:z})=>({workspaceId:y,title:z})),[o]),[s,g]=(0,ee.useState)(()=>Sa(window.localStorage.getItem(en))??{kind:"all"}),[d,b]=(0,ee.useState)(()=>{let y=window.localStorage.getItem(tn);return y===null||y===""?null:y}),[T,w]=(0,ee.useState)(null),c=s.kind==="workspace"?o.find(y=>y.workspaceId===s.workspaceId):void 0,u=c!==void 0?c.workspaceId:d!==null&&o.some(y=>y.workspaceId===d)?d:o[0]?.workspaceId??null;(0,ee.useEffect)(()=>{if(o.length!==0){if(s.kind==="workspace"&&!o.some(y=>y.workspaceId===s.workspaceId)){g({kind:"all"});return}u!==null&&u!==d&&b(u)}},[o,s,u,d]),(0,ee.useEffect)(()=>{window.localStorage.setItem(en,Ut(s))},[s]),(0,ee.useEffect)(()=>{d!==null&&window.localStorage.setItem(tn,d)},[d]);let p=(0,ee.useMemo)(()=>T===null?void 0:Ee(T),[T]);return(0,_e.jsxs)("div",{className:"art-panel-stack",children:[(0,_e.jsx)("div",{className:"art-panel-region",hidden:p!==void 0,children:(0,_e.jsx)(Jr,{t:e,projects:l,scope:s,contextWorkspaceId:u,onScopeChange:g,open:y=>w(y)})}),p===void 0?null:(0,_e.jsx)("div",{className:"art-panel-region",children:(0,_e.jsx)(Lr,{t:e,address:p,workspaceName:o.find(y=>p.scope==="workspace"&&y.workspaceId===p.workspaceId)?.title,onBack:()=>w(null)})})]})}var rn="dsh-artifact-studio/styles",qo=Tr.split(`
85
+ `;function Oo(e){return e.replace(/[&<>"']/g,t=>`&#${t.charCodeAt(0)};`)}function jo(e){return e.replace(/[\\`*_\[\]#]/g,t=>`\\${t}`)}function Fo(e){return e.replace(/[{}<>]/g," ")}function Zr(e,t){return e==="doc"?Lo.replace("{{title}}",jo(t)):e==="design"?Mo.replace("{{title}}",Fo(t)):Po.replace("{{title}}",Oo(t))}var g=require("react/jsx-runtime");function $t(e){return e.kind==="workspace"?"ws:"+e.workspaceId:e.kind}function Ra(e){if(e==="all")return{kind:"all"};if(e==="library")return{kind:"library"};if(e==null||!e.startsWith("ws:"))return;let t=e.slice(3);return t===""?void 0:{kind:"workspace",workspaceId:t}}function tn(e,t,a){return e.scope==="library"?{manifest:e,address:{scope:"library",id:e.id},where:{scope:"library",workspaceId:t},project:null}:a===null?null:{manifest:e,address:{scope:"workspace",workspaceId:a.workspaceId,id:e.id},where:{scope:"workspace",workspaceId:a.workspaceId},project:a.title}}function Bo(e,t){e!==void 0&&(ke(t.manifest.id,t.manifest.title),e(K(t.address)))}function an(e){let t=K(e.address);return e.manifest.scope==="library"?t+"@"+(e.where.workspaceId??""):t}var gt=new Map,Aa=new Map,Ho=2,Gt=new Map,mt=[],Ea=0;function Jr(){for(;Ea<Ho&&mt.length>0;){let e=mt.shift();if(e===void 0)return;Ea+=1,e.start()}}function Vo(e){let t={start:()=>{e().finally(()=>{Ea-=1,Jr()})}};return mt.push(t),Jr(),()=>{let a=mt.indexOf(t);a!==-1&&mt.splice(a,1)}}function _o(e){let t=an(e),a=gt.get(t);if(a!==void 0&&a.version>=e.manifest.version)return Promise.resolve(a);let r=t+":"+e.manifest.version,n=Aa.get(r);if(n!==void 0)return n;let o=U.get(e.where,e.manifest.id).then(l=>{let s={version:l.version,content:l.content,designCss:l.designCss},y=gt.get(t);return(y===void 0||y.version<=s.version)&&(gt.size>=60&&gt.clear(),gt.set(t,s)),s}).finally(()=>{Aa.delete(r)});return Aa.set(r,o),o}function Uo(e){if(typeof DOMParser>"u")return e.replace(/<script\b[^>]*>[\s\S]*?<\/script\s*>/gi,"").replace(/<script\b[^>]*\/?>/gi,"").replace(/\son[a-z]+\s*=\s*"[^"]*"/gi,"");let t=new DOMParser().parseFromString(e,"text/html");for(let a of t.querySelectorAll("script, iframe, object, embed, base"))a.remove();for(let a of t.querySelectorAll("*"))for(let r of[...a.attributes]){let n=r.name.toLowerCase();(n.startsWith("on")||n==="srcdoc")&&a.removeAttribute(r.name)}return t.documentElement.outerHTML}function Wo(e){let t=e.replace(/\x60{3}[\s\S]*?\x60{3}/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/<[^>]+>/g," ").replace(/[#>*_\x60~]/g," ").replace(/\s+/g," ").trim();return t.length>220?t.slice(0,220).trimEnd()+"...":t}function Go({t:e,view:t}){let[a,r]=(0,j.useState)(null),[n,o]=(0,j.useState)(!1),[l,s]=(0,j.useState)(typeof IntersectionObserver>"u"),[y,c]=(0,j.useState)(null),[h,v]=(0,j.useState)(null),x=(0,j.useRef)(null),d=Qe(),p=an(t),u=t.manifest.title,m=t.manifest.type,L=t.manifest.version;(0,j.useEffect)(()=>{if(l)return;let D=x.current;if(D===null)return;let H=new IntersectionObserver(C=>{C.some(F=>F.isIntersecting)&&(s(!0),H.disconnect())},{rootMargin:"140px"});return H.observe(D),()=>H.disconnect()},[l]),(0,j.useEffect)(()=>{if(!l||m!=="design")return;let D=p+"@"+L,H=Gt.get(D);if(H!==void 0){v(H),o(!1);return}let C=new AbortController,F=!1,_=Vo(async()=>{try{let P=await U.preview(t.where,t.manifest.id,L,C.signal);if(F)return;let A="data:"+P.mediaType+";base64,"+P.data;Gt.size>=40&&Gt.clear(),Gt.set(D,A),v(A),o(!1)}catch{F||o(!0)}});return()=>{F=!0,C.abort(),_()}},[l,p,L,m]),(0,j.useEffect)(()=>{if(!l||m==="design")return;let D=!1;return _o(t).then(H=>{!D&&H.version===L&&(r(H),o(!1))}).catch(()=>{D||o(!0)}),()=>{D=!0}},[l,p,L]),(0,j.useEffect)(()=>{if(m!=="page"||a===null){c(null);return}let D=URL.createObjectURL(new Blob([Mt(Uo(a.content),a.designCss,u,d?"dark":"light")],{type:"text/html"}));return c(D),()=>URL.revokeObjectURL(D)},[a,m,u,d]);let S=m==="page"?(0,g.jsx)(ge,{}):m==="doc"?(0,g.jsx)(Ne,{}):(0,g.jsx)(Be,{});if(n)return(0,g.jsx)("span",{className:"art-cover",ref:x,"aria-hidden":"true",children:(0,g.jsx)("span",{className:"art-cover-fallback",children:S})});if(m==="design")return(0,g.jsx)("span",{className:"art-cover",ref:x,"aria-hidden":"true",children:h===null?(0,g.jsx)("span",{className:"art-cover-fallback",children:S}):(0,g.jsx)("img",{className:"art-cover-design",src:h,alt:""})});if(m==="page")return(0,g.jsx)("span",{className:"art-cover",ref:x,"aria-hidden":"true",children:y===null?(0,g.jsx)("span",{className:"art-cover-fallback",children:S}):(0,g.jsx)("span",{className:"art-cover-frame-wrap",children:(0,g.jsx)("iframe",{className:"art-cover-frame",src:y,sandbox:"",title:e("gallery.coverTitle",{title:u}),tabIndex:-1,loading:"lazy",referrerPolicy:"no-referrer"})})});let V=a===null?"":Wo(a.content);return(0,g.jsx)("span",{className:"art-cover",ref:x,"aria-hidden":"true",children:V===""?(0,g.jsx)("span",{className:"art-cover-fallback",children:S}):(0,g.jsxs)("span",{className:"art-cover-doc",children:[(0,g.jsx)("span",{className:"art-cover-doc-title",children:u}),(0,g.jsx)("span",{className:"art-cover-doc-text",children:V})]})})}function $o({t:e,view:t,pinned:a,onOpen:r,showProject:n}){let o=K(t.address),l=e(a?"gallery.unpin":"gallery.pin",{title:t.manifest.title}),s=t.manifest.scope==="library"?" \xB7 "+e("scope.library"):n&&t.project!==null?" \xB7 "+t.project:"";return(0,g.jsxs)("li",{className:"art-tile",children:[(0,g.jsxs)("button",{type:"button",className:"art-tile-open",onClick:()=>r(t),children:[(0,g.jsx)(Go,{t:e,view:t}),(0,g.jsxs)("span",{className:"art-tile-body",children:[(0,g.jsx)("span",{className:"art-tile-title",title:t.manifest.title,children:t.manifest.title}),(0,g.jsxs)("span",{className:"art-tile-sub",children:[e(`type.${t.manifest.type}`)," \xB7 ",e("gallery.updated",{time:Ot(e,t.manifest.updatedAt)})," \xB7 ",e("gallery.version",{version:t.manifest.version}),s]})]})]}),(0,g.jsx)(z.Tooltip,{label:l,side:"left",portal:!0,children:(0,g.jsx)("button",{type:"button",className:"art-tile-pin","aria-label":l,"aria-pressed":a,onClick:()=>Xr(o),children:a?(0,g.jsx)(z.IconPinFillRegular,{size:14}):(0,g.jsx)(z.IconPinOutlineRegular,{size:14})})})]})}function en({t:e,heading:t,views:a,pinned:r,onOpen:n,showProject:o}){let l=(0,j.useId)();return a.length===0?null:(0,g.jsxs)("section",{className:"art-section","aria-labelledby":l,children:[(0,g.jsxs)("div",{className:"art-section-head",children:[(0,g.jsx)("h2",{className:"art-section-title",id:l,children:t}),(0,g.jsx)("span",{className:"art-section-hint",children:e("gallery.count",{count:a.length})})]}),(0,g.jsx)("ul",{className:"art-grid",children:a.map(s=>(0,g.jsx)($o,{t:e,view:s,pinned:r.has(K(s.address)),onOpen:n,showProject:o},K(s.address)))})]})}function qo(e,t,a){let r={where:{scope:"library",workspaceId:a},project:null};if(e.kind==="library")return[r];if(e.kind==="workspace"){let n=t.find(o=>o.workspaceId===e.workspaceId);return n===void 0?[]:[{where:{scope:"workspace",workspaceId:n.workspaceId},project:n}]}return[...t.map(n=>({where:{scope:"workspace",workspaceId:n.workspaceId},project:n})),r]}var Ko=12;function Yo(e,t,a,r,n,o){let[l,s]=(0,j.useState)(1),[y,c]=(0,j.useState)({key:"",state:{status:"loading"}}),h=t.map(p=>p.workspaceId+":"+p.title).join(","),v=$t(e)+":"+h+":"+(a??"")+":"+r+":"+(n??""),x=e.kind==="all",d=y.key===v?y.state:{status:"loading"};return(0,j.useEffect)(()=>s(1),[v,r]),(0,j.useEffect)(()=>{let p=qo(e,t,a);if(p.length===0){c({key:v,state:{status:"ready",items:[],hasMore:!1,truncated:!1,failed:0}});return}let u=new AbortController,m=setTimeout(async()=>{let L=x?Ko:void 0,S=await Promise.all(p.map(async _=>{let P=[];for(let A=0;A<l;A+=1)try{let $=await U.list(_.where,{query:r,type:n,offset:A*(L??50),...L===void 0?{}:{limit:L}},u.signal);if(P.push($),!$.hasMore)break}catch($){return{loaded:P,failed:!0,code:ee($)}}return{loaded:P,failed:!1}}));if(u.signal.aborted)return;let V=[],D=!1,H=!1,C=0,F;if(S.forEach((_,P)=>{let A=p[P];if(A===void 0)return;_.failed&&(C+=1,F===void 0&&(F=_.code));let $=_.loaded[_.loaded.length-1];if($!==void 0){$.hasMore&&(D=!0),$.truncated&&(H=!0);for(let O of _.loaded)for(let Le of O.items){let E=tn(Le,a,A.project);E!==null&&V.push(E)}}}),C===p.length){c({key:v,state:{status:"failed",code:F}});return}V.sort((_,P)=>Date.parse(P.manifest.updatedAt)-Date.parse(_.manifest.updatedAt)),c({key:v,state:{status:"ready",items:V,hasMore:D,truncated:H,failed:C}})},r===""?0:180);return()=>{u.abort(),clearTimeout(m)}},[v,o,l]),{state:d,more:()=>s(p=>p+1)}}function Qo({t:e,variant:t}){let a=t==="all"?"empty.allTitle":t==="library"?"empty.libraryTitle":"empty.workspaceTitle",r=t==="all"?"empty.allHint":t==="library"?"empty.libraryHint":"empty.workspaceHint",n=async o=>{try{await navigator.clipboard.writeText(o),Z(e("gallery.promptCopied"))}catch{Z(e("action.copyFailed"))}};return(0,g.jsxs)("div",{className:"art-empty",children:[(0,g.jsx)("p",{className:"art-empty-title",children:e(a)}),(0,g.jsx)("p",{className:"art-empty-hint",children:e(r)}),(0,g.jsx)("ul",{className:"art-starters",children:Ca.map(o=>(0,g.jsxs)("li",{className:"art-starter",children:[(0,g.jsxs)("span",{className:"art-starter-text",children:[(0,g.jsx)("span",{className:"art-starter-name",children:e(`prompt.${o}`)}),(0,g.jsx)("span",{className:"art-starter-hint",children:e(`prompt.${o}Text`)})]}),(0,g.jsx)(z.Tooltip,{label:e("gallery.copyPrompt"),side:"left",portal:!0,children:(0,g.jsx)(z.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.copyPromptNamed",{name:e(`prompt.${o}`)}),onClick:()=>void n(e(`prompt.${o}Text`)),children:(0,g.jsx)(z.IconCopyOutlineRegular,{size:14})})})]},o))})]})}function Da({t:e,projects:t,scope:a,contextWorkspaceId:r,onScopeChange:n,scopeLocked:o=!1,open:l}){let[s,y]=(0,j.useState)(""),[c,h]=(0,j.useState)(void 0),[v,x]=(0,j.useState)("list"),[d,p]=(0,j.useState)(!1),[u,m]=(0,j.useState)(0),L=Dt()+u,S=Qr(),V=Yo(a,t,r,s,c,L),D=(0,j.useId)(),H=t.find(N=>N.workspaceId===r)??null,C=a.kind==="library"?null:r,F=C===null?null:t.find(N=>N.workspaceId===C)??null,_=a.kind==="library"||H===null?"library":"workspace",P=_==="library"?e("scope.library"):H?.title??e("scope.library"),A=V.state,$=A.status==="ready"?A.items:[],O=(0,j.useCallback)(N=>Bo(l,N),[l]),Le=(0,j.useCallback)(async(N,Q)=>{if(Q==="workspace"&&r===null)return;let _e=e(N==="page"?"create.untitledPage":N==="doc"?"create.untitledDoc":"create.untitledDesign");try{let{manifest:Ue}=await U.create({scope:Q,workspaceId:r},N,_e,Zr(N,_e));Te();let Kt=Q==="workspace"?t.find(Je=>Je.workspaceId===r)??null:null,yt=tn(Ue,r,Kt);yt!==null&&O(yt)}catch(Ue){Z(e(te(ee(Ue))))}},[r,t,e,O]),E=$.filter(N=>S.has(K(N.address))),q=$.filter(N=>!S.has(K(N.address)));return(0,g.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"",children:[(0,g.jsxs)("header",{className:"art-header",children:[(0,g.jsxs)("div",{className:"art-heading",children:[v==="design"?(0,g.jsx)(z.Tooltip,{label:e("panel"),side:"bottom",portal:!0,children:(0,g.jsx)(z.Button,{size:"sm",className:"art-icon-button","aria-label":e("panel"),onClick:()=>x("list"),children:(0,g.jsx)(z.IconChevronLeftOutlineRegular,{size:16})})}):null,(0,g.jsx)("span",{className:"art-title",children:e(v==="design"?"design.title":"panel")})]}),v==="list"?o?(0,g.jsx)("span",{className:"art-scope-fixed",title:H?.title??e("scope.workspace"),children:H?.title??e("scope.workspace")}):(0,g.jsxs)("label",{className:"art-workspace",children:[(0,g.jsx)("span",{className:"art-workspace-label",children:e("scope.label")}),(0,g.jsxs)("select",{className:"art-workspace-select","aria-label":e("scope.label"),value:$t(a),onChange:N=>{let Q=Ra(N.target.value);Q!==void 0&&n?.(Q)},children:[(0,g.jsx)("option",{value:"all",children:e("scope.all")}),t.map(N=>(0,g.jsx)("option",{value:"ws:"+N.workspaceId,children:N.title},N.workspaceId)),(0,g.jsx)("option",{value:"library",children:e("scope.library")})]})]}):null,v==="list"?(0,g.jsxs)("div",{className:"art-actions",children:[(0,g.jsx)(z.Tooltip,{label:e("gallery.design"),side:"bottom",portal:!0,children:(0,g.jsx)(z.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.design"),onClick:()=>x("design"),children:(0,g.jsx)(lr,{size:16})})}),(0,g.jsx)(z.Tooltip,{label:e("gallery.refresh"),side:"bottom",portal:!0,children:(0,g.jsx)(z.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.refresh"),onClick:()=>m(N=>N+1),children:(0,g.jsx)(z.IconRefreshOutlineRegular,{size:16})})}),(0,g.jsx)(z.Menu,{open:d,onClose:()=>p(!1),align:"end",portal:!0,autoFocus:!0,items:[{id:"page",label:e("gallery.newPage")+" \xB7 "+P,icon:(0,g.jsx)(ge,{size:14})},{id:"doc",label:e("gallery.newDoc")+" \xB7 "+P,icon:(0,g.jsx)(Ne,{size:14})},{id:"design",label:e("gallery.newDesign")+" \xB7 "+P,icon:(0,g.jsx)(Be,{size:14})}],onSelect:N=>{p(!1),Le(N==="doc"?"doc":N==="design"?"design":"page",_)},anchor:(0,g.jsx)(z.Button,{size:"sm",variant:"outline",icon:(0,g.jsx)(z.IconPlusOutlineRegular,{size:14}),"aria-haspopup":"menu","aria-expanded":d,onClick:()=>p(N=>!N),children:e("gallery.create")})})]}):null]}),v==="design"?(0,g.jsx)("div",{className:"art-scroll",children:(0,g.jsx)(qr,{t:e,workspaceId:C,workspaceTitle:F?.title})}):(0,g.jsx)("div",{className:"art-scroll",children:(0,g.jsxs)("div",{className:"art-gallery",children:[(0,g.jsxs)("div",{className:"art-toolbar",children:[(0,g.jsx)("input",{className:"art-search",type:"search","aria-label":e("gallery.searchLabel"),placeholder:e("gallery.search"),value:s,onChange:N=>y(N.target.value)}),(0,g.jsx)(z.SegmentedControl,{id:D,className:"art-segment",label:e("filter.type"),value:c??"all",options:[{value:"all",label:e("type.all")},{value:"page",label:e("type.page")},{value:"doc",label:e("type.doc")},{value:"design",label:e("type.design")}],onChange:N=>h(N==="all"?void 0:N)})]}),(0,g.jsxs)("div",{role:"tabpanel",id:D+"-"+(c??"all")+"-panel","aria-labelledby":D+"-"+(c??"all"),children:[A.status==="loading"?(0,g.jsx)("p",{className:"art-note",children:e("empty.loading")}):null,A.status==="failed"?(0,g.jsxs)("div",{className:"art-empty",role:"alert",children:[(0,g.jsx)("p",{className:"art-empty-title",children:e(te(A.code))}),(0,g.jsx)(z.Button,{size:"sm",variant:"outline",onClick:()=>m(N=>N+1),children:e("action.retry")})]}):null,A.status==="ready"&&A.failed>0?(0,g.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"status",children:[(0,g.jsx)("span",{children:e("gallery.failedProjects")}),(0,g.jsx)(z.Button,{size:"sm",variant:"outline",onClick:()=>m(N=>N+1),children:e("action.retry")})]}):null,A.status==="ready"&&A.items.length===0&&A.failed===0?s!==""?(0,g.jsx)("p",{className:"art-note",children:e("empty.noMatch")}):c!==void 0?(0,g.jsx)("p",{className:"art-note",children:e("empty.typeMatch",{type:e(`type.${c}`)})}):(0,g.jsx)(Qo,{t:e,variant:a.kind}):null,A.status==="ready"&&A.items.length>0?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(en,{t:e,heading:e("gallery.pinned"),views:E,pinned:S,onOpen:O,showProject:a.kind==="all"}),q.length===0?(0,g.jsx)("p",{className:"art-note",children:e("gallery.allPinned")}):(0,g.jsx)(en,{t:e,heading:e("gallery.recent"),views:q,pinned:S,onOpen:O,showProject:a.kind==="all"}),A.hasMore?(0,g.jsx)("div",{className:"art-gallery-more",children:(0,g.jsx)(z.Button,{size:"sm",variant:"outline",onClick:V.more,children:e("gallery.more")})}):null,A.truncated?(0,g.jsx)("p",{className:"art-note",children:e("gallery.truncated")}):null]}):null]})]})})]})}var re=require("react/jsx-runtime"),rn="dsh-artifact-studio.panel.scope",nn="dsh-artifact-studio.panel.workspace";function on({t:e,workspaces:t}){let a=(0,G.useCallback)(m=>t.subscribe(m),[t]),r=(0,G.useCallback)(()=>t.getSnapshot(),[t]),o=(0,G.useSyncExternalStore)(a,r,r).items,l=(0,G.useMemo)(()=>o.map(({workspaceId:m,title:L})=>({workspaceId:m,title:L})),[o]),[s,y]=(0,G.useState)(()=>Ra(window.localStorage.getItem(rn))??{kind:"all"}),[c,h]=(0,G.useState)(()=>{let m=window.localStorage.getItem(nn);return m===null||m===""?null:m}),[v,x]=(0,G.useState)(null),d=s.kind==="workspace"?o.find(m=>m.workspaceId===s.workspaceId):void 0,p=d!==void 0?d.workspaceId:c!==null&&o.some(m=>m.workspaceId===c)?c:o[0]?.workspaceId??null;(0,G.useEffect)(()=>{if(o.length!==0){if(s.kind==="workspace"&&!o.some(m=>m.workspaceId===s.workspaceId)){y({kind:"all"});return}p!==null&&p!==c&&h(p)}},[o,s,p,c]),(0,G.useEffect)(()=>{window.localStorage.setItem(rn,$t(s))},[s]),(0,G.useEffect)(()=>{c!==null&&window.localStorage.setItem(nn,c)},[c]);let u=(0,G.useMemo)(()=>v===null?void 0:we(v),[v]);return(0,re.jsxs)("div",{className:"art-panel-stack",children:[(0,re.jsx)("div",{className:"art-panel-region",hidden:u!==void 0,children:(0,re.jsx)(Da,{t:e,projects:l,scope:s,contextWorkspaceId:p,onScopeChange:y,open:m=>x(m)})}),u===void 0?null:(0,re.jsx)("div",{className:"art-panel-region",children:(0,re.jsx)(ka,{t:e,address:u,workspaceName:o.find(m=>u.scope==="workspace"&&m.workspaceId===u.workspaceId)?.title,onBack:()=>x(null)})})]})}function sn({t:e,sessionId:t,useSessions:a,useWorkspaces:r,inputActions:n}){let l=Ht({sessionId:t,useSessions:a,useWorkspaces:r}).workspaceId,s=r(x=>x.items.find(d=>d.workspaceId===l)?.title),[y,c]=(0,G.useState)(null);(0,G.useEffect)(()=>{c(null)},[l]);let h=(0,G.useMemo)(()=>l===null?[]:[{workspaceId:l,title:s??l}],[l,s]),v=(0,G.useMemo)(()=>y===null?void 0:we(y),[y]);return l===null?(0,re.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",children:(0,re.jsx)("div",{className:"art-center",role:"status",children:(0,re.jsx)("p",{className:"art-center-hint",children:e("empty.noWorkspace")})})}):(0,re.jsxs)("div",{className:"art-panel-stack",children:[(0,re.jsx)("div",{className:"art-panel-region",hidden:v!==void 0,children:(0,re.jsx)(Da,{t:e,projects:h,scope:{kind:"workspace",workspaceId:l},contextWorkspaceId:l,scopeLocked:!0,open:x=>c(x)})}),v===void 0?null:(0,re.jsx)("div",{className:"art-panel-region",children:(0,re.jsx)(ka,{t:e,address:v,workspaceName:s,onBack:()=>c(null),...n===void 0?{}:{inputActions:n}})})]})}var ln="dsh-artifact-studio/styles",Xo=Er.split(`
86
86
  `).map(e=>{let t=e.indexOf("{"),a=e.slice(0,t).split(",").map(n=>n.trim()).filter(n=>n!=="body"&&n!==".art-docpage");return(a.length===0?".art-docpage":a.map(n=>".art-docpage .art-prose "+n).join(", "))+" "+e.slice(t)}).join(`
87
- `),Ko=`
87
+ `),Zo=`
88
88
  .art-root {
89
89
  box-sizing: border-box;
90
90
  display: flex;
@@ -221,7 +221,7 @@ Start writing, or select text and choose Edit with agent.
221
221
  }
222
222
  .art-tile-open:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }
223
223
  .art-tile-body { display: flex; flex-direction: column; gap: 3px; padding: 9px 10px 10px; }
224
- .art-tile-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
224
+ .art-tile-title { min-width: 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 600; line-height: 1.45; }
225
225
  .art-tile-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--dsw-alias-label-secondary); }
226
226
  .art-tile-pin {
227
227
  position: absolute;
@@ -464,6 +464,7 @@ Start writing, or select text and choose Edit with agent.
464
464
  background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary);
465
465
  font: inherit; font-size: 12px;
466
466
  }
467
+ .art-scope-fixed { flex: none; max-width: 180px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dsw-alias-label-secondary); }
467
468
  .art-panel-stack, .art-panel-region { height: 100%; min-height: 0; min-width: 0; }
468
469
  .art-panel-region[hidden] { display: none; }
469
470
  .art-root { container-type: inline-size; }
@@ -490,8 +491,7 @@ Start writing, or select text and choose Edit with agent.
490
491
  background: var(--dsw-alias-bg-overlay);
491
492
  box-shadow: 0 8px 24px color-mix(in srgb, var(--dsw-alias-label-primary) 18%, transparent);
492
493
  }
493
- .art-selection-quote { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dsw-alias-label-secondary); }
494
- .art-selection-bar .art-button { flex: none; }
494
+ .art-selection-quote { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dsw-alias-label-secondary); }
495
495
  .art-version-button {
496
496
  display: inline-flex;
497
497
  align-items: center;
@@ -546,7 +546,7 @@ Start writing, or select text and choose Edit with agent.
546
546
  .art-icon-button { flex: none; }
547
547
  .art-icon-button[aria-pressed="true"] { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
548
548
  .art-meta-dot { color: var(--dsw-alias-label-tertiary, var(--dsw-alias-label-secondary)); padding: 0 2px; }
549
- .art-ask { flex: none; }
549
+ .art-ask { flex: none; white-space: nowrap; }
550
550
  .art-center-actions { display: flex; gap: 8px; }
551
551
  .art-modal-error { margin: 0; color: var(--dsw-alias-state-error-primary); font-size: 13px; }
552
552
  .art-fallback { width: 100%; min-height: 140px; padding: 10px 12px; border: 1px solid var(--dsw-alias-border-l1); border-radius: var(--dsw-radius-sm, 8px); background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: 12px/1.55 ui-monospace, Menlo, Consolas, monospace; resize: vertical; }
@@ -694,7 +694,7 @@ Start writing, or select text and choose Edit with agent.
694
694
  .op-canvas { position: relative; flex: 1; min-width: 0; height: 100%; }
695
695
  .op-surface { width: 100%; height: 100%; }
696
696
  .op-bridge { display: none; }
697
- `;function nn(){if(typeof document>"u"||document.querySelector(`style[data-plugin-css="${rn}"]`)!==null)return;let e=document.createElement("style");e.dataset.plugin="dsh-artifact-studio",e.dataset.pluginCss=rn,e.textContent=Ko+qo,document.head.appendChild(e)}var Ce=require("react/jsx-runtime");var De="artifacts",sn=["artifact_create","artifact_update"],Yo=["connection","slots","locale","sidebarRightTabs","sidebarRight","workspaces"];function Qo(e){if(e===null||typeof e!="object"||!("selectPanel"in e))return null;let{selectPanel:t}=e;return typeof t!="function"?null:{selectPanel:a=>{t.call(e,a)}}}function Na(e){return function(a){return(0,Ce.jsx)(Ft,{title:a.t("error.surface"),hint:a.t("error.surfaceHint"),reloadLabel:a.t("action.reloadWindow"),children:(0,Ce.jsx)(e,{...a})})}}function Xo(){let e=Ja();return e===null?null:(0,Ce.jsx)(on.Toast,{text:e.message,onDone:()=>la(e.seq)},e.seq)}function Zo({useTabInfo:e}){let{tab:t}=e(),a=Ee(t.contentId??t.navigation?.address),r=Xa(a?.id);return(0,Ce.jsxs)("span",{className:"art-chip",children:[(0,Ce.jsx)(Te,{}),(0,Ce.jsx)("span",{children:r??a?.id??""})]})}function Jo(e){nn(),e.effect(er,"dsh-artifact-studio: unsaved draft guard"),Ga(e.connection),Se.sidebarRight=e.sidebarRight,Se.layout=Qo(e.get("layout")),e.locale.register(De,"en",Er),e.locale.register(De,"zh",Rr);let t=e.locale.bind(De),a=(l,s)=>t(l,s);e.effect(()=>e.sidebarRightTabs.register({id:ct,kind:va,priority:"extension",patterns:["dsh-resource://artifact/**"],canOpen:l=>Ee(l)!==void 0,title:l=>{let s=Ee(l);return s===void 0?"":Qa(s.id)??s.id}}),"dsh-artifact-studio: artifact tab type");let r=()=>({t:a});e.effect(()=>()=>la(),"dsh-artifact-studio: notification cleanup"),e.slots.inject("shell.overlay",()=>e.slots.register({name:"shell.overlay",id:"dsh-artifact-studio.notice"},Xo)),e.slots.inject("sidebar.right.pane.tab",()=>e.slots.register({name:"sidebar.right.pane.tab",key:ct,locale:De,inject:r},Na(ba))),e.slots.inject("sidebar.right.pane.tab.title",()=>e.slots.register({name:"sidebar.right.pane.tab.title",key:ct,locale:De,inject:r},Zo));for(let l of sn)e.slots.inject("tool.call.toolview",()=>e.slots.register({name:"tool.call.toolview",key:l,locale:De,inject:r},Na(ha)));e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"dsh-artifact-studio",order:40,locale:De,inject:r},_r));function n({size:l}){return(0,Ce.jsx)(At,{size:l})}let o=()=>({t:a,workspaces:e.workspaces.list});e.slots.inject("main",()=>e.slots.register({name:"main",key:Xe,locale:De,inject:o},Na(an))),e.slots.inject("sidebar.panellist",()=>e.slots.register({name:"sidebar.panellist",id:Xe,order:10,label:()=>a("panel")},n))}
697
+ `;function cn(){if(typeof document>"u"||document.querySelector(`style[data-plugin-css="${ln}"]`)!==null)return;let e=document.createElement("style");e.dataset.plugin="dsh-artifact-studio",e.dataset.pluginCss=ln,e.textContent=Zo+Xo,document.head.appendChild(e)}var Ee=require("react/jsx-runtime");var Ae="artifacts",pn=["artifact_create","artifact_update"],Jo=["connection","slots","locale","sidebarRightTabs","sidebarRight","workspaces"];function ei(e){if(e===null||typeof e!="object"||!("selectPanel"in e))return null;let{selectPanel:t}=e;return typeof t!="function"?null:{selectPanel:a=>{t.call(e,a)}}}function qt(e){return function(a){return(0,Ee.jsx)(Ft,{title:a.t("error.surface"),hint:a.t("error.surfaceHint"),reloadLabel:a.t("action.reloadWindow"),children:(0,Ee.jsx)(e,{...a})})}}function ti(){let e=or();return e===null?null:(0,Ee.jsx)(dn.Toast,{text:e.message,onDone:()=>ua(e.seq)},e.seq)}function ai({useTabInfo:e}){let{tab:t}=e(),a=we(t.contentId??t.navigation?.address),r=rr(a?.id);return(0,Ee.jsxs)("span",{className:"art-chip",children:[(0,Ee.jsx)(Ne,{}),(0,Ee.jsx)("span",{children:r??a?.id??""})]})}function ri(e){cn(),e.effect(ir,"dsh-artifact-studio: unsaved draft guard"),Za(e.connection),Ce.sidebarRight=e.sidebarRight,Ce.layout=ei(e.get("layout")),e.locale.register(Ae,"en",Lr),e.locale.register(Ae,"zh",Mr);let t=e.locale.bind(Ae),a=(l,s)=>t(l,s);e.effect(()=>e.sidebarRightTabs.register({id:ut,kind:Sa,priority:"extension",patterns:["dsh-resource://artifact/**"],canOpen:l=>we(l)!==void 0,title:l=>{let s=we(l);return s===void 0?"":ar(s.id)??s.id}}),"dsh-artifact-studio: artifact tab type"),e.effect(()=>e.sidebarRightTabs.register({id:Vt,kind:Na,priority:"extension",title:()=>a("panel"),guide:[{id:"artifacts",order:30,title:()=>a("panel"),description:()=>a("right.guideHint"),icon:ct}]}),"dsh-artifact-studio: right panel artifacts page");let r=()=>({t:a});e.effect(()=>()=>ua(),"dsh-artifact-studio: notification cleanup"),e.slots.inject("shell.overlay",()=>e.slots.register({name:"shell.overlay",id:"dsh-artifact-studio.notice"},ti)),e.slots.inject("sidebar.right.pane.tab",()=>e.slots.register({name:"sidebar.right.pane.tab",key:ut,locale:Ae,inject:r},qt(wa))),e.slots.inject("sidebar.right.pane.tab.title",()=>e.slots.register({name:"sidebar.right.pane.tab.title",key:ut,locale:Ae,inject:r},ai)),e.slots.inject("sidebar.right.pane.tab",()=>e.slots.register({name:"sidebar.right.pane.tab",key:Vt,locale:Ae,inject:r},qt(sn)));for(let l of pn)e.slots.inject("tool.call.toolview",()=>e.slots.register({name:"tool.call.toolview",key:l,locale:Ae,inject:r},qt(Ta)));e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"dsh-artifact-studio",order:40,locale:Ae,inject:r},$r));function n({size:l}){return(0,Ee.jsx)(ct,{size:l})}let o=()=>({t:a,workspaces:e.workspaces.list});e.slots.inject("main",()=>e.slots.register({name:"main",key:Ze,locale:Ae,inject:o},qt(on))),e.slots.inject("sidebar.panellist",()=>e.slots.register({name:"sidebar.panellist",id:Ze,order:10,label:()=>a("panel")},n))}
698
698
 
699
699
  return module.exports;
700
700
  },