dsh-artifact-studio 0.0.0-stage → 0.2.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 ADDED
@@ -0,0 +1,564 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "dsh-artifact-studio",
3
+ factory(require) {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ globalThis.__dshArtifactsRequireAsync = require.async;
7
+ "use strict";var va=Object.create;var ot=Object.defineProperty;var xa=Object.getOwnPropertyDescriptor;var wa=Object.getOwnPropertyNames;var ka=Object.getPrototypeOf,Ta=Object.prototype.hasOwnProperty;var Sa=(e,t)=>{for(var r in t)ot(e,r,{get:t[r],enumerable:!0})},sr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of wa(t))!Ta.call(e,a)&&a!==r&&ot(e,a,{get:()=>t[a],enumerable:!(n=xa(t,a))||n.enumerable});return e};var Na=(e,t,r)=>(r=e!=null?va(ka(e)):{},sr(t||!e||!e.__esModule?ot(r,"default",{value:e,enumerable:!0}):r,e)),Ca=e=>sr(ot({},"__esModule",{value:!0}),e);var Rn={};Sa(Rn,{ARTIFACT_ID:()=>Ye,ARTIFACT_KIND:()=>_t,ArtifactCard:()=>Wt,ArtifactTab:()=>$t,CARD_TOOLS:()=>na,DocView:()=>mt,PANEL_ID:()=>$e,apply:()=>An,inject:()=>Tn});module.exports=Ca(Rn);var aa=require("@deepseek-ai/dsh-client-ui-primitives");var Aa=["page","doc"];function Ra(e){return Aa.some(t=>t===e)}var lr={page:["html"],doc:["md","docx","html"]};var it=/^art_(ws|lib)_[a-z0-9]{10,32}$/;var _e=["primary","accent","surface","text","muted"];function Lt(e){if(e===null||typeof e!="object")return!1;let t="origin"in e?e.origin:void 0,r="action"in e?e.action:void 0;return(t==="agent"||t==="user")&&(r==="create"||r==="update"||r==="restore")}function ct(e){if(e===null||typeof e!="object")return!1;let t={...e};return t.schemaVersion===1&&typeof t.id=="string"&&it.test(t.id)&&(t.scope==="workspace"||t.scope==="library")&&typeof t.type=="string"&&Ra(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"&&Lt(t.source)}var st="dsh-resource://artifact/",lt="data-artifact-theme";function z(e){return e.scope==="workspace"?`${st}workspace/${encodeURIComponent(e.workspaceId)}/${e.id}`:`${st}library/${e.id}`}function ke(e){if(typeof e!="string"||!e.startsWith(st))return;let t=e.slice(st.length).split("/");if(t[0]==="library"&&t.length===2){let r=t[1]??"";return it.test(r)&&r.startsWith("art_lib_")?{scope:"library",id:r}:void 0}if(t[0]==="workspace"&&t.length===3){let r=t[2]??"",n;try{n=decodeURIComponent(t[1]??"")}catch{return}return n===""||!it.test(r)||!r.startsWith("art_ws_")?void 0:{scope:"workspace",workspaceId:n,id:r}}}function cr(e){if(it.test(e))return e.startsWith("art_ws_")?"workspace":"library"}function dr(e){let t=[];for(let n of _e)t.push(`--artifact-color-${n}: ${e.colors[n]};`);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((n,a)=>t.push(`--artifact-font-size-${a}: ${n}px;`)),t.push(`--artifact-space-unit: ${e.spacing.unit}px;`),e.spacing.scale.forEach((n,a)=>t.push(`--artifact-space-${a}: ${n}px;`));for(let[n,a]of Object.entries(e.radius))t.push(`--artifact-radius-${n}: ${a}px;`);let r=_e.map(n=>`--artifact-color-${n}: ${e.colorsDark[n]};`).join(`
8
+ `);return[`:root {
9
+ ${t.join(`
10
+ `)}
11
+ }`,`:root[${lt}="dark"] {
12
+ color-scheme: dark;
13
+ ${r}
14
+ }`,`@media (prefers-color-scheme: dark) {
15
+ :root[${lt}="auto"] {
16
+ color-scheme: dark;
17
+ ${r.replace(/\n /g,`
18
+ `)}
19
+ }
20
+ }`].join(`
21
+ `)}function pr(e,t){let r=t?e.colorsDark:e.colors,n={"--artifact-font-family":e.typography.fontFamily,"--artifact-font-display":e.typography.displayFamily,"--artifact-font-mono":e.typography.monoFamily};for(let a of _e)n[`--artifact-color-${a}`]=r[a];e.typography.scale.forEach((a,i)=>{n[`--artifact-font-size-${i}`]=`${a}px`}),e.spacing.scale.forEach((a,i)=>{n[`--artifact-space-${i}`]=`${a}px`});for(let[a,i]of Object.entries(e.radius))n[`--artifact-radius-${a}`]=`${i}px`;return n}var Ea="/artifacts-rpc",Ie=class extends Error{code;details;constructor(t,r,n){super(r),this.name="ArtifactCallError",this.code=t,this.details=n}},zt=null;function ur(e){zt=e}async function G(e,t,r,n){if(zt===null)throw new Ie("artifact/not-ready","The artifact channel is not ready.",{});let a=await zt.rpc.call(Ea,e,t,n);if(!a.ok)throw new Ie(a.error.code,a.error.message,a.error.details);if(!r(a.value))throw new Ie("artifact/bad-response",`The ${e} response has an unexpected shape.`,{});return a.value}function _(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Pa(e){return _(e)&&Array.isArray(e.items)&&e.items.every(ct)&&typeof e.total=="number"&&typeof e.hasMore=="boolean"}function Da(e){return _(e)&&ct(e.manifest)&&typeof e.content=="string"&&typeof e.version=="number"&&typeof e.designCss=="string"&&fr(e.design)}function dt(e){return _(e)&&ct(e.manifest)}function La(e){return _(e)&&typeof e.version=="number"&&typeof e.createdAt=="string"&&typeof e.contentHash=="string"&&typeof e.contentBytes=="number"&&Lt(e.source)}function Ma(e){return _(e)&&Array.isArray(e.versions)&&e.versions.every(La)}function za(e){return _(e)&&e.trashed===!0&&typeof e.trashPath=="string"}function Ia(e){return _(e)&&typeof e.path=="string"&&typeof e.bytes=="number"&&typeof e.fileName=="string"&&typeof e.mediaType=="string"&&typeof e.data=="string"}function Oa(e){return _(e)&&typeof e.html=="string"}function fr(e){return _(e)&&e.schemaVersion===1&&typeof e.name=="string"&&_(e.colors)&&_(e.colorsDark)&&_(e.typography)&&_(e.spacing)&&_(e.radius)}function Mt(e){return _(e)&&fr(e.tokens)&&(e.source==="workspace"||e.source==="library"||e.source==="default")&&typeof e.css=="string"}function J(e){return{scope:e.scope,...e.workspaceId===null?{}:{workspaceId:e.workspaceId}}}var L={list:(e,t,r)=>G("list",{...J(e),...t},Pa,r),get:(e,t,r,n)=>G("get",{...J(e),id:t,...r===void 0?{}:{version:r}},Da,n),create:(e,t,r,n)=>G("create",{...J(e),type:t,title:r,content:n},dt),update:(e,t,r,n,a)=>G("update",{...J(e),id:t,baseVersion:r,content:n,...a===void 0?{}:{title:a}},dt),rename:(e,t,r,n)=>G("update",{...J(e),id:t,baseVersion:r,title:n},dt),remove:(e,t)=>G("delete",{...J(e),id:t},za),history:(e,t,r)=>G("history",{...J(e),id:t},Ma,r),restore:(e,t,r,n)=>G("restore",{...J(e),id:t,version:r,baseVersion:n},dt),exportFile:(e,t,r,n)=>G("export",{...J(e),id:t,format:r,version:n},Ia),printable:(e,t,r)=>G("printable",{...J(e),id:t,version:r},Oa),designSystem:(e,t)=>G("designSystem",e===null?{}:{workspaceId:e},Mt,t),saveDesignSystem:(e,t)=>G("saveDesignSystem",{...J(e),tokens:t},Mt),clearDesignSystem:e=>G("clearDesignSystem",{workspaceId:e,scope:"workspace"},Mt)};function U(e){return e instanceof Ie?e.code:void 0}function V(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";default:return"error.generic"}}function mr(e){let t=atob(e.data),r=new Uint8Array(t.length);for(let i=0;i<t.length;i+=1)r[i]=t.charCodeAt(i);let n=URL.createObjectURL(new Blob([r],{type:e.mediaType})),a=document.createElement("a");a.href=n,a.download=e.fileName,a.rel="noopener",document.body.appendChild(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(n),3e4)}var Fe=require("react");var qe=require("react");function ut(e){let t=e,r=new Set;return{get:()=>t,set(n){t=n;for(let a of r)a()},subscribe(n){return r.add(n),()=>r.delete(n)}}}var Oe=ut(new Map);function fe(e,t){if(Oe.get().get(e)===t)return;let r=new Map(Oe.get());r.set(e,t),Oe.set(r)}function gr(e){return Oe.get().get(e)}function br(e){return(0,qe.useSyncExternalStore)(Oe.subscribe,()=>e===void 0?void 0:Oe.get().get(e))}var Ue=ut(new Map);function Ae(e,t){if((Ue.get().get(e)??0)>=t)return;let r=new Map(Ue.get());r.set(e,t),Ue.set(r)}function yr(e){return(0,qe.useSyncExternalStore)(Ue.subscribe,()=>e===void 0?0:Ue.get().get(e)??0)}var pt=ut(0);function me(){pt.set(pt.get()+1)}function ft(){return(0,qe.useSyncExternalStore)(pt.subscribe,pt.get)}var Be=ut(null);function $(e){Be.set({seq:(Be.get()?.seq??0)+1,message:e})}function hr(){return(0,qe.useSyncExternalStore)(Be.subscribe,Be.get)}function It(e){let t=Be.get();t===null||e!==void 0&&t.seq!==e||Be.set(null)}var ge=new Map,Ot;function vr(){Ot?.();let e=t=>{[...ge.values()].some(r=>r.getSnapshot().draft!==null||r.getSnapshot().saving)&&(t.preventDefault(),t.returnValue="")};return window.addEventListener("beforeunload",e),Ot=()=>window.removeEventListener("beforeunload",e),Ot}var Bt=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=z(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?ge.set(this.key,this):this.mounts===0&&ge.get(this.key)===this&&ge.delete(this.key);for(let r of this.listeners)r()}attach(){return this.mounts+=1,ge.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&&ge.get(this.key)===this&&ge.delete(this.key)}}async load(){let t=++this.readSequence;this.publish({loading:!0,failure:void 0});try{let r=await L.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:r.version!==this.state.payload.version});return}this.publish({payload:r,loading:!1,conflict:!1,failure:void 0,revision:this.state.revision+1}),fe(this.address.id,r.manifest.title),Ae(this.address.id,r.version)}catch(r){t===this.readSequence&&this.publish({loading:!1,failure:U(r)??"artifact/storage-failure"})}}edit(t){this.publish({draft:t,failure:void 0})}async discardAndReload(){this.pending!==null&&await this.pending,this.publish({draft:null,conflict:!1,failure: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});try{for(;this.state.draft!==null||this.renameTo!==void 0;){let t=this.state.payload;if(t===null||this.state.conflict)return!1;let r=this.state.draft,n=r??t.content,a=this.renameTo,{manifest:i}=await L.update(this.where,this.address.id,t.version,n,a);this.renameTo===a&&(this.renameTo=void 0),this.accept(i,n,this.state.draft===r?null:this.state.draft)}return!0}catch(t){let r=U(t)??"artifact/storage-failure";return this.renameTo=void 0,this.publish({failure:r,conflict:r==="artifact/stale-version"}),!1}finally{this.pending=null,this.publish({saving:!1})}}accept(t,r,n){let a=this.state.payload;a!==null&&(++this.readSequence,this.publish({payload:{...a,manifest:t,content:r,version:t.version},draft:n,conflict:!1,loading:!1}),fe(t.id,t.title),Ae(t.id,t.version),me())}};function xr(e){let t=z(e),r=(0,Fe.useMemo)(()=>{let a=ge.get(t);if(a!==void 0)return a;let i=new Bt(e);return ge.set(t,i),i},[t]),n=(0,Fe.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot);return(0,Fe.useEffect)(()=>r.attach(),[r]),{model:r,state:n}}var v=require("react"),m=require("@deepseek-ai/dsh-client-ui-primitives");var D=require("react"),wr=require("@deepseek-ai/dsh-client-ui-primitives");var ne=require("react/jsx-runtime"),Ke=null;function Ba(){if(Ke===null){let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")return Promise.reject(new Error("The document editor loader is unavailable."));Ke=e("./client.doc.js"),Ke.catch(()=>{Ke=null})}return Ke}var Fa=["heading","bold","italic","bulletList","orderedList","codeBlock"];function ja(e){let t=window.getSelection(),r=e.getBoundingClientRect(),a=(t!==null&&t.rangeCount>0?t.getRangeAt(0):null)?.getBoundingClientRect();if(a===void 0||a.width===0&&a.height===0)return{top:e.scrollTop+8,left:16};let i=Math.min(Math.max(a.left-r.left+a.width/2,120),Math.max(r.width-120,120));return{top:Math.max(a.top-r.top+e.scrollTop-46,e.scrollTop+4),left:i}}function mt({markdown:e,revision:t,editable:r,label:n,loadingLabel:a,failedLabel:i,onChange:s,onSave:d,onSelectionText:u,t:f,design:b,dark:y=!1,selectionAction:h}){let k=(0,D.useRef)(null),c=(0,D.useRef)(null),g=(0,D.useRef)(null),M=(0,D.useRef)(s);M.current=s;let E=(0,D.useRef)(u);E.current=u;let P=(0,D.useRef)({markdown:e,editable:r,label:n});P.current={markdown:e,editable:r,label:n};let[F,se]=(0,D.useState)([]),[B,te]=(0,D.useState)("loading"),[X,xe]=(0,D.useState)(null),le=(0,D.useRef)(null);(0,D.useLayoutEffect)(()=>{let x=le.current,C=k.current;if(x===null||C===null||X===null)return;let I=x.offsetWidth/2,O=C.clientWidth,H=I*2+16>=O?O/2:Math.min(Math.max(X.left,I+8),O-I-8);x.style.left=H+"px"});let ce=(0,D.useMemo)(()=>b===void 0?{}:{...pr(b,y),colorScheme:y?"dark":"light"},[b,y]),re=x=>{E.current?.(x);let C=k.current;xe(x===""||C===null?null:ja(C))},Q=(0,D.useRef)(re);Q.current=re,(0,D.useEffect)(()=>{let x=!1;return Ba().then(C=>{x||c.current===null||(g.current=C.mountDocEditor({element:c.current,...P.current,onChange:I=>M.current(I),onSelectionChange:se,onSelectionText:I=>Q.current(I)}),te("ready"))}).catch(()=>{x||te("failed")}),()=>{x=!0,g.current?.destroy(),g.current=null}},[]),(0,D.useEffect)(()=>{let x=g.current;x!==null&&x.getMarkdown()!==e&&x.setMarkdown(e)},[t,e]),(0,D.useEffect)(()=>{g.current?.setEditable(r)},[r]),(0,D.useEffect)(()=>{let x=()=>{let C=g.current,I=k.current,O=window.getSelection();C===null||I===null||O!==null&&O.anchorNode!==null&&!I.contains(O.anchorNode)||Q.current(C.getSelectionText())};return document.addEventListener("selectionchange",x),()=>document.removeEventListener("selectionchange",x)},[]);let j=X!==null&&f!==void 0&&(r||h!=null);return(0,ne.jsxs)("div",{className:"art-doc",ref:k,"data-doc-revision":t,onKeyDown:x=>{(x.ctrlKey||x.metaKey)&&x.key.toLowerCase()==="s"&&(x.preventDefault(),d()),x.key==="Escape"&&X!==null&&xe(null)},children:[j?(0,ne.jsxs)("div",{ref:le,className:"art-doc-toolbar",role:"toolbar","aria-label":f("format.toolbar"),style:{top:X.top,left:X.left},children:[r?Fa.map(x=>(0,ne.jsx)(wr.Button,{size:"sm",variant:"ghost","aria-pressed":F.includes(x),disabled:B!=="ready",onMouseDown:C=>C.preventDefault(),onClick:()=>g.current?.format(x),children:f(`format.${x}`)},x)):null,r&&h!=null?(0,ne.jsx)("span",{className:"art-doc-toolbar-gap","aria-hidden":"true"}):null,h]}):null,B==="loading"?(0,ne.jsx)("p",{className:"art-note",children:a}):null,B==="failed"?(0,ne.jsx)("p",{className:"art-note",children:i}):null,(0,ne.jsx)("div",{className:"art-docpage",style:ce,children:(0,ne.jsx)("div",{className:"art-doc-mount",ref:c})})]})}function Ha(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 Tr="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'",Sr=["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 Ft="<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 kr(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function $a(e){return e.replace(/<meta\b[^>]*http-equiv\s*=\s*["']?refresh["']?[^>]*>/gi,"").replace(/<meta\b[^>]*content\s*=\s*["'][^"']*url\s*=[^>]*>/gi,"")}function Nr(e,t,r,n,a="",i="auto"){let s='<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">'+(r===null?"":`<meta http-equiv="Content-Security-Policy" content="${kr(r)}">`)+`<title>${kr(n)}</title><style data-artifact-tokens>${t}</style>`+a;return`<!doctype html><html${Ha(e)?` ${lt}="${i}"`:""}><head>${s}</head><body>${$a(e)}</body></html>`}var Cr="allow-scripts",Va="allow-scripts allow-modals",Wa=3e4,_a="<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>",Ua=4e3;function gt(e,t,r,n="auto",a=!1){return Nr(e,t,Tr,r,a?_a:"",n)}function Ar(e){if(e===null||typeof e!="object")return;let t={...e};return typeof t.dshArtifactSelection=="string"?t.dshArtifactSelection.slice(0,Ua):void 0}function Rr(e){let t=/<\/head>/i.test(e)?e.replace(/<\/head>/i,`${Ft}</head>`):`${Ft}${e}`,r=URL.createObjectURL(new Blob([t],{type:"text/html"})),n=document.createElement("iframe");n.setAttribute("sandbox",Va),n.setAttribute("aria-hidden","true"),n.tabIndex=-1,n.style.cssText="position:fixed;left:-10000px;top:0;width:800px;height:1000px;border:0;";let a=!1,i=()=>{a||(a=!0,clearTimeout(d),window.removeEventListener("message",s),n.remove(),URL.revokeObjectURL(r))},s=u=>{u.source===n.contentWindow&&u.data==="dsh-artifact-printed"&&i()};window.addEventListener("message",s);let d=setTimeout(i,Wa);n.addEventListener("load",()=>{n.contentWindow?.postMessage("dsh-artifact-print","*")},{once:!0}),n.src=r,document.body.appendChild(n)}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","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":"Make a dashboard page that shows ","prompt.explainer":"Explainer","prompt.explainerText":"Make a one-page visual explainer of ","prompt.report":"Report","prompt.reportText":"Write a report document about ","prompt.brief":"Project brief","prompt.briefText":"Write a project brief with context, goal, scope, and open questions for ","filter.scope":"Filter by storage","filter.type":"Filter by type","tab.mode":"Page view","tab.manualSave":"Page 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","panel.workspace":"Project","action.back":"Back","scope.workspace":"This project","scope.library":"Library","scope.workspaceHint":"Stored in the Harness home for this workspace.","scope.libraryHint":"Stored in your profile and shared by every project.","type.page":"Page","type.doc":"Document","type.all":"All types","filter.all":"All","gallery.search":"Search artifacts","gallery.searchLabel":"Search by title","gallery.create":"New artifact","gallery.newPage":"New page","gallery.newDoc":"New document","gallery.design":"Design system","gallery.refresh":"Refresh","gallery.more":"Show more","gallery.truncated":"Only the first 500 artifacts are scanned.","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.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.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.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.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.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"},Pr={"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","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":"\u5236\u4F5C\u4E00\u4E2A\u4EEA\u8868\u76D8\u9875\u9762\uFF0C\u5C55\u793A","prompt.explainer":"\u56FE\u89E3\u8BF4\u660E","prompt.explainerText":"\u5236\u4F5C\u4E00\u9875\u53EF\u89C6\u5316\u8BF4\u660E\uFF0C\u4E3B\u9898\u662F","prompt.report":"\u62A5\u544A","prompt.reportText":"\u5199\u4E00\u4EFD\u62A5\u544A\u6587\u6863\uFF0C\u4E3B\u9898\u662F","prompt.brief":"\u9879\u76EE\u7B80\u4ECB","prompt.briefText":"\u5199\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.scope":"\u6309\u5B58\u50A8\u4F4D\u7F6E\u7B5B\u9009","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.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","panel.workspace":"\u9879\u76EE","action.back":"\u8FD4\u56DE","scope.workspace":"\u5F53\u524D\u9879\u76EE","scope.library":"\u8D44\u6599\u5E93","scope.workspaceHint":"\u4FDD\u5B58\u5728 Harness \u4E3B\u76EE\u5F55\u4E2D\uFF0C\u4EC5\u5C5E\u4E8E\u5F53\u524D\u5DE5\u4F5C\u533A\u3002","scope.libraryHint":"\u4FDD\u5B58\u5728\u4E2A\u4EBA\u914D\u7F6E\u4E2D\uFF0C\u6240\u6709\u9879\u76EE\u5171\u4EAB\u3002","type.page":"\u9875\u9762","type.doc":"\u6587\u6863","type.all":"\u5168\u90E8\u7C7B\u578B","filter.all":"\u5168\u90E8","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.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.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.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.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.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.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.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 bt(e,t,r=Date.now()){let n=Math.max(0,r-Date.parse(t)),a=Math.floor(n/6e4);if(a<1)return e("time.justNow");if(a<60)return e("time.minutes",{count:a});let i=Math.floor(a/60);if(i<24)return e("time.hours",{count:i});let s=Math.floor(i/24);return s<7?e("time.days",{count:s}):new Date(t).toLocaleDateString()}var Z=require("react/jsx-runtime");function qa(e,t){let r=t.source.origin==="agent"?e("history.byAgent"):e("history.byUser"),n=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`${r} \xB7 ${n} \xB7 ${bt(e,t.createdAt)}`}function Dr({t:e,versions:t,failed:r,current:n,selected:a,onSelect:i}){return(0,Z.jsxs)("div",{className:"art-history-body",children:[t===null?(0,Z.jsx)("p",{className:"art-note",children:e("empty.loading")}):null,r?(0,Z.jsx)("p",{className:"art-note",children:e("error.generic")}):null,!r&&t!==null&&t.length<=1?(0,Z.jsx)("p",{className:"art-note",children:e("history.empty")}):null,t?.map(s=>(0,Z.jsxs)("button",{type:"button",className:"art-version","aria-current":s.version===a?"true":void 0,onClick:()=>i(s.version),children:[(0,Z.jsxs)("span",{className:"art-version-top",children:[(0,Z.jsx)("span",{children:e("tab.versionOf",{version:s.version})}),s.version===n?(0,Z.jsx)("span",{className:"art-badge",children:e("history.current")}):null]}),(0,Z.jsx)("span",{className:"art-version-sub",children:qa(e,s)})]},s.version))]})}var oe=require("react");var Te=require("react/jsx-runtime");function yt({content:e,designCss:t,title:r,frameTitle:n,dark:a=!1,onSelectionText:i}){let[s,d]=(0,oe.useState)(null),[u,f]=(0,oe.useState)(!1),b=(0,oe.useRef)(0),y=(0,oe.useRef)(null),h=(0,oe.useRef)(i);h.current=i;let k=i!==void 0;return(0,oe.useEffect)(()=>{b.current=0,f(!1);let c=URL.createObjectURL(new Blob([gt(e,t,r,a?"dark":"light",k)],{type:"text/html"}));return d(c),()=>URL.revokeObjectURL(c)},[e,t,r,a,k]),(0,oe.useEffect)(()=>{if(!k)return;let c=g=>{if(y.current===null||b.current>1||g.source!==y.current.contentWindow)return;let M=Ar(g.data);M!==void 0&&h.current?.(M)};return window.addEventListener("message",c),()=>window.removeEventListener("message",c)},[k]),u?(0,Te.jsx)("div",{className:"art-center",role:"alert",children:r}):s===null?null:(0,Te.jsx)("iframe",{ref:y,className:"art-frame",title:n,sandbox:Cr,referrerPolicy:"no-referrer",src:s,onLoad:()=>{b.current+=1,b.current>1&&f(!0)}},s)}function Lr({value:e,readOnly:t,label:r,hint:n,onChange:a,onSave:i,onSelectionText:s}){let d=u=>{t||s?.(u.value.slice(u.selectionStart,u.selectionEnd))};return(0,Te.jsxs)("div",{className:"art-source-wrap",children:[n===void 0?null:(0,Te.jsx)("div",{className:"art-code-bar",children:(0,Te.jsx)("span",{children:n})}),(0,Te.jsx)("textarea",{className:"art-source","aria-label":r,spellCheck:!1,readOnly:t,value:e,autoFocus:!t,onChange:u=>{a(u.target.value),s?.("")},onSelect:u=>d(u.currentTarget),onMouseUp:u=>d(u.currentTarget),onKeyUp:u=>d(u.currentTarget),onKeyDown:u=>{if((u.ctrlKey||u.metaKey)&&u.key.toLowerCase()==="s"){u.preventDefault(),i();return}if(u.key==="Tab"&&!u.shiftKey&&!t){u.preventDefault();let f=u.currentTarget,b=f.selectionStart,y=f.selectionEnd,h=e.slice(0,b)+" "+e.slice(y);a(h),requestAnimationFrame(()=>f.setSelectionRange(b+2,b+2))}}})]})}function jt(e,t=2e3){let r=e.replace(/\r\n/g,`
23
+ `).replace(/[ \t]+\n/g,`
24
+ `).replace(/\n{3,}/g,`
25
+
26
+ `).trim();return r.length<=t?{text:r,truncated:!1}:{text:r.slice(0,t).trimEnd(),truncated:!0}}function Mr(e,t){let r=t.version===t.current?"agent.reference":"agent.referenceOld";return`${e(r,{title:t.title,id:t.id,version:t.version,current:t.current})} `}function Ht(e,t){return e===""?t:`${e.split(`
27
+ `).map(r=>`> ${r}`).join(`
28
+ `)}
29
+
30
+ ${t}`}var zr=require("react"),Ir="data-ds-dark-theme";function Ka(){return typeof document<"u"&&document.body?.hasAttribute(Ir)===!0}function Ga(e){if(typeof document>"u"||document.body===null)return()=>{};let t=new MutationObserver(e);return t.observe(document.body,{attributes:!0,attributeFilter:[Ir]}),()=>t.disconnect()}function je(){return(0,zr.useSyncExternalStore)(Ga,Ka,()=>!1)}var o=require("react/jsx-runtime");function Ge({label:e,icon:t,onClick:r,pressed:n,disabled:a,buttonRef:i}){return(0,o.jsx)(m.Tooltip,{label:e,side:"bottom",portal:!0,children:(0,o.jsx)(m.Button,{ref:i,size:"sm",className:"art-icon-button","aria-label":e,"aria-pressed":n,disabled:a,onClick:r,children:t})})}function Ya({quote:e,askLabel:t,dismissLabel:r,onAsk:n,onDismiss:a}){return(0,o.jsxs)("div",{className:"art-selection-bar",role:"toolbar","aria-label":t,children:[(0,o.jsx)("span",{className:"art-selection-quote",title:e,children:e}),(0,o.jsx)(m.Button,{size:"sm",variant:"primary",icon:(0,o.jsx)(m.IconSparkleRegular,{size:14}),onClick:n,children:t}),(0,o.jsx)(Ge,{label:r,icon:(0,o.jsx)(m.IconCloseOutlineRegular,{size:14}),onClick:a})]})}function Xa({label:e,closeLabel:t,overlay:r,onClose:n,children:a}){let i=(0,v.useRef)(null);return(0,v.useEffect)(()=>{i.current?.querySelector("[data-drawer-initial]")?.focus()??i.current?.querySelector(".art-version, button")?.focus()},[e]),(0,v.useEffect)(()=>{if(!r)return;let s=d=>{let u=i.current;u===null||d.target instanceof Node&&u.contains(d.target)||u.querySelector("button")?.focus()};return document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)},[r]),(0,o.jsxs)("div",{className:"art-drawer-layer","data-overlay":r?"true":void 0,children:[r?(0,o.jsx)("div",{className:"art-drawer-scrim","aria-hidden":"true",onPointerDown:n}):null,(0,o.jsxs)("aside",{ref:i,className:"art-drawer",role:"dialog","aria-modal":r?"true":void 0,"aria-label":e,onKeyDown:s=>{if(s.key==="Escape"){s.preventDefault(),s.stopPropagation(),n();return}if(s.key!=="Tab"||!r)return;let d=[...i.current?.querySelectorAll("button:not(:disabled)")??[]],u=d[0],f=d[d.length-1];u===void 0||f===void 0||(s.shiftKey&&document.activeElement===u?(s.preventDefault(),f.focus()):!s.shiftKey&&document.activeElement===f&&(s.preventDefault(),u.focus()))},children:[(0,o.jsxs)("div",{className:"art-drawer-head",children:[(0,o.jsx)("h2",{children:e}),(0,o.jsx)(Ge,{label:t,icon:(0,o.jsx)(m.IconCloseOutlineRegular,{size:14}),onClick:n})]}),(0,o.jsx)("div",{className:"art-drawer-body",children:a})]})]})}function $t(e){let t=e.useTabInfo(),r=ke(t.tab.contentId??t.tab.navigation?.address),n=e.useWorkspaces(a=>a.items.find(i=>r?.scope==="workspace"&&i.workspaceId===r.workspaceId)?.title);return r===void 0?(0,o.jsx)("section",{className:"art-root",children:(0,o.jsx)("p",{className:"art-note",children:e.t("error.notFound")})}):(0,o.jsx)(Br,{t:e.t,address:r,useTabInfo:e.useTabInfo,onBack:t.tab.actions?.close,workspaceName:n,inputActions:e.inputActions},z(r))}function Or({t:e,address:t,onBack:r,workspaceName:n}){return(0,o.jsx)(Br,{t:e,address:t,onBack:r,workspaceName:n,back:!0},z(t))}var Qa=()=>{};function Br({t:e,address:t,useTabInfo:r,onBack:n,workspaceName:a,back:i,inputActions:s}){let{model:d,state:u}=xr(t),{payload:f,draft:b,saving:y,conflict:h,failure:k}=u,c=d.where,g=t.id,M=je(),[E,P]=(0,v.useState)("preview"),[F,se]=(0,v.useState)(!1),[B,te]=(0,v.useState)(!1),[X,xe]=(0,v.useState)(!1),[le,ce]=(0,v.useState)(null),[re,Q]=(0,v.useState)(!1),[j,x]=(0,v.useState)(!1),[C,I]=(0,v.useState)(null),[O,H]=(0,v.useState)(null),[St,Pe]=(0,v.useState)(!1),[S,K]=(0,v.useState)(""),[De,de]=(0,v.useState)(null),[Je,Ze]=(0,v.useState)(!1),[ae,we]=(0,v.useState)(!1),[Le,pe]=(0,v.useState)(null),[Xt,Nt]=(0,v.useState)(null),[Qt,Ve]=(0,v.useState)(null),ue=(0,v.useRef)(0),et=(0,v.useRef)(null),Jt=(0,v.useRef)(null),Zt=(0,v.useRef)(null),Ct=(0,v.useRef)(!1),tt=yr(g),er=(r??Qa)();(0,v.useEffect)(()=>{f!==null&&tt>f.version&&b===null&&!y&&!h&&Ve(tt),d.externalVersion(tt)},[tt,d,y,f?.version,b,h]),(0,v.useEffect)(()=>{h&&Ve(null)},[h]),(0,v.useEffect)(()=>{pe(null)},[f?.version,C?.version,u.revision]);let oa=f!==null,Me=(0,v.useCallback)(()=>{let p=et.current,T=p===null?0:p.clientWidth;xe(T>0?T<=600:window.innerWidth<=600)},[]);(0,v.useEffect)(()=>{let p=et.current;if(p===null)return;Me();let T=new ResizeObserver(Me);return T.observe(p),window.addEventListener("resize",Me),()=>{T.disconnect(),window.removeEventListener("resize",Me)}},[oa,Me]);let Ne=(0,v.useCallback)(p=>{d.getSnapshot().draft!==null||d.getSnapshot().saving?de({run:p}):p()},[d]),At=(0,v.useCallback)(()=>{++ue.current,x(!1),I(null),pe(null),H(null),Ve(null)},[]),rt=(0,v.useCallback)(async()=>{At(),await d.discardAndReload()},[d,At]);(0,v.useEffect)(()=>er?.tab.actions?.bindCommands({refresh:()=>Ne(rt)}),[er?.tab.actions,Ne,rt]),(0,v.useEffect)(()=>{if(f?.manifest.type!=="doc"||b===null||h||y)return;let p=setTimeout(()=>void d.save(),1200);return()=>clearTimeout(p)},[b,h,y,d,f?.manifest.type]),(0,v.useEffect)(()=>{if(!B||f===null)return;let p=new AbortController;return ce(null),Q(!1),L.history(c,g,p.signal).then(T=>{p.signal.aborted||ce(T.versions)}).catch(()=>{p.signal.aborted||Q(!0)}),()=>p.abort()},[B,f?.version,d]),(0,v.useEffect)(()=>()=>{++ue.current},[]),(0,v.useEffect)(()=>{if(B){Ct.current=!0;return}Ct.current&&(Ct.current=!1,Zt.current?.focus())},[B]),(0,v.useEffect)(()=>{if(E!=="source"||f?.manifest.type!=="page")return;let p=()=>{let T=Jt.current,W=window.getSelection();if(T===null||W===null||W.anchorNode===null||!T.contains(W.anchorNode))return;let ze=jt(W.toString());pe(ze.text===""?null:ze)};return document.addEventListener("selectionchange",p),()=>document.removeEventListener("selectionchange",p)},[E,f?.manifest.type]);let tr=()=>{++ue.current,x(!1),I(null),te(!1)},Rt=()=>{Me(),++ue.current,x(!1),I(null),H(null),te(!0)},rr=async p=>{let T=++ue.current;if(H(null),pe(null),p===f?.version){x(!1),I(null);return}x(!0);try{let W=await L.get(c,g,p);T===ue.current&&I(W)}catch(W){T===ue.current&&$(e(V(U(W))))}finally{T===ue.current&&x(!1)}},ar=async()=>j?null:C!==null?C.version:await d.save()?d.getSnapshot().payload?.version??null:null,nr=async p=>{if(!ae){we(!0);try{let T=await ar();if(T===null)return;if(p==="print")Rr((await L.printable(c,g,T)).html);else{let W=await L.exportFile(c,g,p,T);mr(W),$(e("export.done",{name:W.fileName,path:W.path}))}}catch(T){$(e(V(U(T))))}finally{we(!1)}}},ia=async()=>{S.trim()===""||y||await d.save(S.trim())&&Pe(!1)},sa=async()=>{if(C===null||ae)return;let p=C.version;Ne(async()=>{we(!0);try{let T=await L.restore(c,g,p,d.getSnapshot().payload?.version??0);Ae(g,T.manifest.version),me(),At(),await d.load()}catch(T){$(e(V(U(T))))}finally{we(!1)}})},Et=async(p,T)=>{try{await navigator.clipboard.writeText(p),$(e(T))}catch{Nt(p)}},Pt=async p=>{if(!(ae||h||j||f===null)){we(!0);try{let T=await ar();if(T===null)return;let W=d.getSnapshot().payload??f,ze=Mr(e,{title:W.manifest.title,id:g,version:T,current:W.version}),nt=p?.text??"";if(pe(null),s===void 0){await Et(Ht(nt,ze),"agent.copied");return}if((nt===""||s.insertQuote(nt))&&s.insertText(ze,s.captureInsertion())){$(e(p?.truncated===!0?"agent.addedTruncated":"agent.added"));return}await Et(Ht(nt,ze),"agent.insertFailed")}finally{we(!1)}}},Dt=(0,v.useCallback)(p=>{let T=jt(p);pe(T.text===""?null:T)},[]),la=async()=>{if(O==="version"){H(null);return}if(f!==null){try{let p=await L.history(c,g);ce(p.versions)}catch(p){$(e(V(U(p))));return}H("version")}};if(f===null)return(0,o.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",ref:et,children:(0,o.jsxs)("div",{className:"art-center",role:k===void 0?"status":"alert",children:[(0,o.jsx)("p",{className:"art-center-hint",children:e(k===void 0?"empty.loading":V(k))}),(0,o.jsxs)("div",{className:"art-center-actions",children:[k===void 0?null:(0,o.jsx)(m.Button,{size:"sm",variant:"outline",onClick:()=>void d.load(),children:e("action.retry")}),n===void 0?null:(0,o.jsx)(m.Button,{size:"sm",variant:"outline",onClick:n,children:e("tab.close")})]})]})});let Ce=f.manifest.type,at=C?.content??b??f.content,We=C!==null,ca=C?.version??f.version,da=e(y?"tab.saving":h?"tab.conflictTitle":j?"empty.loading":C!==null?"tab.readOnly":k!==void 0?"tab.saveFailed":b!==null?"tab.unsaved":"tab.saved"),pa=h||k!==void 0&&!y?"error":y?"warn":void 0,ua=t.scope==="workspace"?a??t.workspaceId:e("scope.library"),fa=E==="source"&&!We&&(F||b!==null),or=[...lr[Ce].map(p=>({id:p,label:e(`export.${p}`)})),{type:"separator",id:"export-gap"},{id:"print",label:e("export.print")}],ir=p=>{H(null),p==="print"?nr("print"):(p==="html"||p==="md"||p==="docx")&&nr(p)},ma=[...X?[...or,{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}],ga=p=>{H(null),p==="rename"?(K(f.manifest.title),Pe(!0)):p==="reload"?Ne(rt):p==="delete"?Ze(!0):ir(p)},ba=[...(le??[]).map(p=>({id:"v"+p.version,label:e("tab.versionOf",{version:p.version})+(p.version===f.version?" \xB7 "+e("tab.currentVersion"):"")})),{type:"separator",id:"versions-gap"},{id:"all",label:e("tab.allVersions")}],ya=p=>{H(null),p==="all"?Rt():rr(Number(p.slice(1)))},ha=(0,o.jsx)(m.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,o.jsx)(m.IconSparkleRegular,{size:14}),disabled:ae||h||j,onClick:()=>void Pt(Le),children:e("agent.ask")});return(0,o.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"","data-artifact-id":g,"aria-busy":ae,ref:et,children:[(0,o.jsxs)("header",{className:"art-header art-editor-header",children:[(0,o.jsxs)("div",{className:"art-heading",children:[!i||n===void 0?null:(0,o.jsx)(Ge,{label:e("action.back"),icon:(0,o.jsx)(m.IconChevronLeftOutlineRegular,{size:16}),onClick:()=>Ne(n)}),(0,o.jsxs)("div",{className:"art-identity",children:[(0,o.jsx)("h1",{className:"art-title",title:f.manifest.title,children:f.manifest.title}),(0,o.jsxs)("div",{className:"art-meta",children:[(0,o.jsxs)("span",{className:"art-meta-text",children:[ua,t.scope==="workspace"?" \xB7 "+e("scope.workspace"):null]}),(0,o.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,o.jsx)(m.Menu,{open:O==="version",onClose:()=>H(null),items:ba,onSelect:ya,portal:!0,autoFocus:!0,anchor:(0,o.jsxs)("button",{type:"button",className:"art-version-button","aria-label":e("tab.versionPicker"),"aria-haspopup":"menu","aria-expanded":O==="version",onClick:()=>void la(),children:[e("gallery.version",{version:ca}),(0,o.jsx)(m.IconChevronDownOutlineRegular,{size:12})]})}),(0,o.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,o.jsx)("span",{className:"art-save-status","data-tone":pa,"aria-live":"polite",children:da})]})]})]}),(0,o.jsxs)("div",{className:"art-actions art-editor-actions",children:[Ce!=="page"?null:(0,o.jsx)(m.SegmentedControl,{id:"art-mode-"+g,className:"art-segment",label:e("tab.mode"),value:E,options:[{value:"preview",label:e("tab.preview")},{value:"source",label:e("tab.source")}],onChange:p=>{P(p),pe(null)}}),b===null||We?null:(0,o.jsx)(Ge,{label:e("tab.save"),icon:(0,o.jsx)(m.IconSaveOutlineRegular,{size:16}),disabled:h,onClick:()=>void d.save()}),(0,o.jsx)(Ge,{buttonRef:Zt,label:e("tab.history"),icon:(0,o.jsx)(m.IconClockOutlineRegular,{size:16}),pressed:B,onClick:()=>{B?tr():Rt()}}),X?null:(0,o.jsx)(m.Menu,{open:O==="export",onClose:()=>H(null),items:or,onSelect:ir,align:"end",portal:!0,autoFocus:!0,anchor:(0,o.jsx)(m.Button,{size:"sm",icon:(0,o.jsx)(m.IconDownloadOutlineRegular,{size:14}),"aria-label":e("tab.export"),"aria-haspopup":"menu","aria-expanded":O==="export",disabled:ae||j,onClick:()=>H(O==="export"?null:"export"),children:e("tab.export")})}),ha,(0,o.jsx)(m.Menu,{open:O==="more",onClose:()=>H(null),items:ma,onSelect:ga,align:"end",portal:!0,autoFocus:!0,anchor:(0,o.jsx)(m.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.more"),"aria-haspopup":"menu","aria-expanded":O==="more",onClick:()=>H(O==="more"?null:"more"),children:(0,o.jsx)(m.IconEllipsisOutlineRegular,{size:14})})})]})]}),St?(0,o.jsxs)("form",{className:"art-inline-form",onSubmit:p=>{p.preventDefault(),ia()},children:[(0,o.jsx)("input",{"aria-label":e("tab.rename"),value:S,maxLength:120,autoFocus:!0,onChange:p=>K(p.target.value),onKeyDown:p=>{p.key==="Escape"&&Pe(!1)}}),(0,o.jsx)(m.Button,{type:"submit",size:"sm",variant:"primary",disabled:y||h,children:e("tab.save")}),(0,o.jsx)(m.Button,{size:"sm",variant:"outline",onClick:()=>Pe(!1),children:e("create.cancel")})]}):null,Qt===null?null:(0,o.jsxs)("div",{className:"art-bar",role:"status",children:[(0,o.jsx)("span",{children:e("tab.agentUpdate",{version:Qt})}),(0,o.jsxs)("span",{className:"art-bar-actions",children:[(0,o.jsx)(m.Button,{size:"sm",variant:"outline",onClick:()=>{Ve(null),Rt()},children:e("tab.viewHistory")}),(0,o.jsx)(m.Button,{size:"sm",onClick:()=>Ve(null),children:e("tab.dismiss")})]})]}),h?(0,o.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"alert",children:[(0,o.jsxs)("span",{className:"art-bar-text",children:[(0,o.jsx)("strong",{children:e("tab.conflictTitle")}),(0,o.jsx)("span",{children:e("tab.conflictHint")})]}),(0,o.jsxs)("span",{className:"art-bar-actions",children:[(0,o.jsx)(m.Button,{size:"sm",variant:"outline",onClick:()=>void Et(b??"","action.copied"),children:e("tab.copyDraft")}),(0,o.jsx)(m.Button,{size:"sm",variant:"outline",onClick:()=>Ne(rt),children:e("tab.discardReload")})]})]}):null,!h&&k!==void 0?(0,o.jsxs)("div",{className:"art-bar","data-tone":"error",role:"alert",children:[(0,o.jsx)("span",{children:e(V(k))}),(0,o.jsx)(m.Button,{size:"sm",variant:"outline",onClick:()=>void d.save(),children:e("action.retry")})]}):null,C===null?null:(0,o.jsxs)("div",{className:"art-bar",role:"status",children:[(0,o.jsx)("span",{children:e("tab.viewingOld",{version:C.version,current:f.version})}),(0,o.jsxs)("span",{className:"art-bar-actions",children:[(0,o.jsx)(m.Button,{size:"sm",variant:"outline",onClick:()=>{++ue.current,x(!1),I(null),pe(null)},children:e("tab.backToCurrent")}),(0,o.jsx)(m.Button,{size:"sm",variant:"outline",disabled:ae,onClick:()=>void sa(),children:e("tab.restoreThis")})]})]}),(0,o.jsxs)("div",{className:"art-body",children:[(0,o.jsxs)("div",{className:"art-stage",role:Ce==="page"?"tabpanel":void 0,id:Ce==="page"?"art-mode-"+g+"-"+E+"-panel":void 0,"aria-labelledby":Ce==="page"?"art-mode-"+g+"-"+E:void 0,children:[Ce!=="page"||Le===null||B?null:(0,o.jsx)(Ya,{quote:Le.text,askLabel:e("agent.ask"),dismissLabel:e("tab.dismiss"),onAsk:()=>void Pt(Le),onDismiss:()=>pe(null)}),Ce==="doc"?(0,o.jsx)(mt,{markdown:at,revision:(C?.version??0)+":"+u.revision,editable:!We&&!h,label:f.manifest.title,loadingLabel:e("empty.loading"),failedLabel:e("error.generic"),design:f.design,dark:M,t:e,onChange:p=>d.edit(p),onSave:()=>void d.save(),onSelectionText:Dt,selectionAction:Le===null?null:(0,o.jsx)(m.Button,{size:"sm",variant:"primary",icon:(0,o.jsx)(m.IconSparkleRegular,{size:14}),onMouseDown:p=>p.preventDefault(),onClick:()=>void Pt(Le),children:e("agent.ask")})}):E==="preview"?(0,o.jsx)(yt,{content:at,designCss:f.designCss,title:f.manifest.title,frameTitle:e("tab.frameTitle",{title:f.manifest.title}),dark:M,onSelectionText:Dt}):fa?(0,o.jsx)(Lr,{value:at,readOnly:!1,label:e("tab.source"),hint:e("tab.manualSave"),onChange:p=>d.edit(p),onSave:()=>void d.save(),onSelectionText:Dt}):(0,o.jsxs)("div",{className:"art-code",ref:Jt,children:[(0,o.jsxs)("div",{className:"art-code-bar",children:[(0,o.jsx)("span",{children:e(We?"tab.readOnly":"tab.codeHint")}),We?null:(0,o.jsx)(m.Button,{size:"sm",variant:"outline",icon:(0,o.jsx)(m.IconEditOutlineRegular,{size:14}),onClick:()=>se(!0),children:e("tab.editSource")})]}),(0,o.jsx)(m.CodeBlock,{code:at,lang:"html",lineNumbers:!0,showHeader:!1,wrap:!0,className:"art-code-block",copyLabel:e("code.copy"),copiedLabel:e("action.copied")})]})]}),B?(0,o.jsx)(Xa,{label:e("history.title"),closeLabel:e("history.close"),overlay:X,onClose:tr,children:(0,o.jsx)(Dr,{t:e,versions:le,failed:re,current:f.version,selected:C?.version??f.version,onSelect:p=>void rr(p)})}):null]}),(0,o.jsx)(m.Modal,{open:De!==null,onClose:()=>de(null),title:e("tab.leaveTitle"),closeLabel:e("dialog.close"),description:e(h?"tab.conflictHint":"tab.leaveHint"),footer:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(m.Button,{variant:"outline",disabled:ae,onClick:()=>de(null),children:e("create.cancel")}),(0,o.jsx)(m.Button,{variant:"outline",disabled:y||ae,onClick:()=>{let p=De?.run;de(null),p!==void 0&&d.discardAndReload().then(p)},children:e("tab.discardContinue")}),(0,o.jsx)(m.Button,{variant:"primary",disabled:h||ae,onClick:async()=>{we(!0);let p=await d.save();we(!1);let T=De?.run;p&&T!==void 0&&(de(null),await T())},children:e("tab.saveContinue")})]}),children:k===void 0?null:(0,o.jsx)("p",{className:"art-modal-error",role:"alert",children:e(V(k))})}),(0,o.jsx)(m.Modal,{open:Je,onClose:()=>Ze(!1),title:e("tab.deleteTitle"),closeLabel:e("dialog.close"),description:e("tab.deleteConfirm",{title:f.manifest.title}),footer:(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(m.Button,{variant:"outline",onClick:()=>Ze(!1),children:e("create.cancel")}),(0,o.jsx)(m.Button,{variant:"primary",onClick:()=>{Ze(!1),Ne(async()=>{try{await L.remove(c,g),me(),n?.()}catch(p){$(e(V(U(p))))}})},children:e("tab.delete")})]})}),(0,o.jsx)(m.Modal,{open:Xt!==null,onClose:()=>Nt(null),title:e("agent.copyTitle"),closeLabel:e("dialog.close"),description:e("action.copyFailed"),footer:(0,o.jsx)(m.Button,{variant:"primary",onClick:()=>Nt(null),children:e("dialog.done")}),children:(0,o.jsx)("textarea",{className:"art-fallback",readOnly:!0,value:Xt??"","aria-label":e("agent.copyTitle"),onFocus:p=>p.currentTarget.select()})})]})}var Fr=Na(require("react"),1),jr=require("@deepseek-ai/dsh-client-ui-primitives"),Re=require("react/jsx-runtime"),ht=class extends Fr.default.Component{constructor(t){super(t),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,Re.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",children:(0,Re.jsxs)("div",{className:"art-center",role:"alert",children:[(0,Re.jsx)("p",{className:"art-center-title",children:this.props.title}),(0,Re.jsx)("p",{className:"art-center-hint",children:this.props.hint}),(0,Re.jsx)(jr.Button,{size:"sm",variant:"outline",onClick:()=>window.location.reload(),children:this.props.reloadLabel})]})}):this.props.children}};var xt=require("react"),He=require("@deepseek-ai/dsh-client-ui-primitives");var po=require("react"),q=require("react/jsx-runtime");function Vt({children:e,size:t=16}){return(0,q.jsx)("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.7,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e})}var vt=({size:e})=>(0,q.jsxs)(Vt,{size:e,children:[(0,q.jsx)("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,q.jsx)("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,q.jsx)("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.5"}),(0,q.jsx)("path",{d:"M17 13.5v7M13.5 17h7"})]}),ie=({size:e})=>(0,q.jsxs)(Vt,{size:e,children:[(0,q.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,q.jsx)("path",{d:"M3.5 8.5h17M9 13l-2 1.8L9 16.5M15 13l2 1.8-2 1.7"})]}),be=({size:e})=>(0,q.jsxs)(Vt,{size:e,children:[(0,q.jsx)("path",{d:"M6.5 3.5h7l4 4v13h-11z"}),(0,q.jsx)("path",{d:"M13.5 3.5v4h4M9 12h6M9 15.5h6"})]});var ye={sidebarRight:null,layout:null};var A=require("react/jsx-runtime");function Ja(e){if(e===null||typeof e!="object")return null;let t={...e},{id:r,type:n,title:a,version:i,workspaceId:s}=t;if(t.kind!=="artifact"||typeof r!="string"||typeof a!="string"||typeof i!="number"||n!=="page"&&n!=="doc")return null;let d=cr(r);return d===void 0?null:d==="workspace"?typeof s!="string"||s===""?null:{id:r,type:n,title:a,version:i,address:{scope:d,workspaceId:s,id:r}}:{id:r,type:n,title:a,version:i,address:{scope:d,id:r}}}function Za(e){return Array.isArray(e)?e.map(t=>{if(t===null||typeof t!="object")return"";let r={...t};return r.type==="text"&&typeof r.text=="string"?r.text:""}).filter(t=>t!=="").join(`
31
+ `).trim():""}function en(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 Hr=new Set;function Wt({t:e,phase:t,toolName:r,block:n}){let a=t==="result"&&n?.isError!==!0?Ja(n?.meta):null,i=(0,xt.useRef)(t!=="result");t!=="result"&&(i.current=!0);let s=r==="artifact_update";if((0,xt.useEffect)(()=>{if(a===null)return;fe(a.id,a.title),Ae(a.id,a.version),me();let u=a.id+":"+a.version;!i.current||Hr.has(u)||(Hr.add(u),ye.sidebarRight?.openResource(z(a.address)))},[a?.id,a?.version,a?.title]),t!=="result"){let u=en(n?.args),f=u===void 0?e(s?"card.updatingUntitled":"card.working"):e(s?"card.updating":"card.creating",{title:u});return(0,A.jsxs)("div",{className:"art-card","data-artifact-card":"working",children:[(0,A.jsx)("span",{className:"art-card-icon",children:(0,A.jsx)(ie,{})}),(0,A.jsx)("span",{className:"art-card-text",children:(0,A.jsx)(He.TextShimmer,{active:!0,className:"art-card-title",children:(0,A.jsx)("span",{role:"status",children:f})})}),(0,A.jsx)(He.StateDot,{state:"ongoing"})]})}if(n?.isError===!0)return(0,A.jsxs)("div",{className:"art-card","data-artifact-card":"error",children:[(0,A.jsx)("span",{className:"art-card-icon","data-tone":"error",children:(0,A.jsx)(ie,{})}),(0,A.jsxs)("span",{className:"art-card-text",children:[(0,A.jsx)("span",{className:"art-card-title",children:e("card.failed")}),(0,A.jsx)("span",{className:"art-card-sub","data-tone":"error",children:Za(n.content)})]})]});if(a===null)return(0,A.jsxs)("div",{className:"art-card","data-artifact-card":"missing",children:[(0,A.jsx)("span",{className:"art-card-icon",children:(0,A.jsx)(ie,{})}),(0,A.jsx)("span",{className:"art-card-sub",children:e("card.missing")})]});let d=z(a.address);return(0,A.jsxs)("button",{type:"button",className:"art-card art-card-open","data-artifact-card":"ready","data-artifact-id":a.id,"aria-label":e("card.openNamed",{title:a.title}),onClick:()=>ye.sidebarRight?.openResource(d),children:[(0,A.jsx)("span",{className:"art-card-icon",children:a.type==="page"?(0,A.jsx)(ie,{}):(0,A.jsx)(be,{})}),(0,A.jsxs)("span",{className:"art-card-text",children:[(0,A.jsx)("span",{className:"art-card-title",title:a.title,children:a.title}),(0,A.jsxs)("span",{className:"art-card-sub",children:[e(s?"card.updated":"card.created")," \xB7 ",e(`type.${a.type}`)," \xB7 ",e("gallery.version",{version:a.version}),a.address.scope==="library"?" \xB7 "+e("scope.library"):""]})]}),(0,A.jsx)("span",{className:"art-card-go","aria-hidden":"true",children:(0,A.jsx)(He.IconChevronRightOutlineRegular,{size:14})})]})}var Xe=require("react"),wt=require("@deepseek-ai/dsh-client-ui-primitives");var $r=require("react");function Vr({sessionId:e,useSessions:t,useWorkspaces:r}){let n=r(i=>i.items),a=t(i=>i.byId[e]);return(0,$r.useMemo)(()=>{let i=typeof a?.cwd=="string"?a.cwd:null,s=n.find(d=>d.sessionIds?.includes(e))??n.find(d=>i!==null&&(i===d.path||i.startsWith(`${d.path}/`)))??null;return{root:i??s?.path??null,workspaceId:s?.workspaceId??null}},[n,a,e])}var Ye="dsh-artifact-studio/artifact",_t="artifact",$e="dsh-artifact-studio-panel";var Ee=require("react/jsx-runtime"),tn=6,Ut=["dashboard","explainer","report","brief"];function rn(e,t){let r=e.filter(a=>a.source.sessionId===t),n=e.filter(a=>a.source.sessionId!==t);return[...r,...n].slice(0,tn)}function Wr(e){let{t,sessionId:r,inputActions:n}=e,i=Vr(e).workspaceId,s=ft(),[d,u]=(0,Xe.useState)(!1),[f,b]=(0,Xe.useState)(null);(0,Xe.useEffect)(()=>{if(!d||i===null)return;let c=new AbortController;return L.list({scope:"workspace",workspaceId:i},{},c.signal).then(g=>{c.signal.aborted||b(rn(g.items,r))}).catch(()=>{c.signal.aborted||b([])}),()=>c.abort()},[d,i,r,s]);let y=i===null?[{type:"label",id:"no-workspace",text:t("empty.noWorkspace")}]:f===null?[{type:"label",id:"loading",text:t("empty.loading")}]:f.length===0?[{type:"label",id:"empty",text:t("composer.empty")}]:f.map(c=>({id:"open:"+c.id,label:c.title,icon:c.type==="page"?(0,Ee.jsx)(ie,{size:14}):(0,Ee.jsx)(be,{size:14})})),h=[{type:"label",id:"recent",text:t("composer.recent")},...y,...n===void 0?[]:[{type:"separator",id:"start-gap"},{type:"label",id:"start",text:t("composer.start")},...Ut.map(c=>({id:"prompt:"+c,label:t(`prompt.${c}`)}))],{type:"separator",id:"all-gap"},{id:"all",label:t("composer.all")}];return(0,Ee.jsx)(wt.Menu,{open:d,onClose:()=>u(!1),items:h,onSelect:c=>{if(u(!1),c==="all"){ye.layout?.selectPanel($e);return}if(c.startsWith("prompt:")&&n!==void 0){n.insertText(t(`prompt.${c.slice(7)}Text`),n.captureInsertion());return}let g=f?.find(M=>"open:"+M.id===c);g===void 0||i===null||(fe(g.id,g.title),ye.sidebarRight?.openResource(z({scope:"workspace",workspaceId:i,id:g.id})))},side:"top",portal:!0,autoFocus:!0,anchor:(0,Ee.jsx)(wt.Tooltip,{label:t("composer.label"),side:"top",portal:!0,children:(0,Ee.jsx)("button",{type:"button",className:"art-composer","aria-label":t("composer.label"),"aria-haspopup":"menu","aria-expanded":d,onClick:()=>u(c=>!c),children:(0,Ee.jsx)(vt,{})})})})}var Y=require("react");var R=require("react"),N=require("@deepseek-ai/dsh-client-ui-primitives");var he=require("react"),kt=require("@deepseek-ai/dsh-client-ui-primitives");var w=require("react/jsx-runtime"),an=["sm","md","lg"],nn=e=>`<!doctype html><html><head><meta name="color-scheme" content="light dark"><style>
32
+ body { margin: 0; padding: 20px; font-family: var(--artifact-font-family); background: var(--artifact-color-surface); color: var(--artifact-color-text); }
33
+ h2 { margin: 0 0 6px; font-family: var(--artifact-font-display); font-size: var(--artifact-font-size-4); letter-spacing: -0.02em; }
34
+ p { margin: 0 0 14px; color: var(--artifact-color-muted); }
35
+ .row { display: flex; gap: 8px; align-items: center; }
36
+ button { padding: 8px 14px; border: 0; border-radius: var(--artifact-radius-md); background: var(--artifact-color-primary); color: var(--artifact-color-surface); font: inherit; }
37
+ .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; }
38
+ code { font-family: var(--artifact-font-mono); font-size: 12px; }
39
+ </style></head><body><h2>${e("design.previewHeading")}</h2><p>${e("design.previewBody")}</p>
40
+ <div class="row"><button>${e("design.previewButton")}</button><span class="tag">+12%</span><code>var(--artifact-color-primary)</code></div></body></html>`;function on(e){return/^#[0-9a-f]{6}$/i.test(e)}function _r({t:e,workspaceId:t}){let[r,n]=(0,he.useState)(null),[a,i]=(0,he.useState)(null),[s,d]=(0,he.useState)(!1),[u,f]=(0,he.useState)(!1),b=je();(0,he.useEffect)(()=>{let c=new AbortController;return L.designSystem(t,c.signal).then(g=>{n(g),i(g.tokens)}).catch(()=>{c.signal.aborted||d(!0)}),()=>c.abort()},[t]);let y=(0,he.useMemo)(()=>a===null?"":dr(a),[a]);if(s)return(0,w.jsx)("p",{className:"art-note",children:e("error.generic")});if(r===null||a===null)return(0,w.jsx)("p",{className:"art-note",children:e("empty.loading")});let h=async c=>{f(!0);try{let g=await L.saveDesignSystem({scope:c,workspaceId:t},a);n(g),i(g.tokens),$(e("design.saved"))}catch(g){$(e(V(U(g))))}finally{f(!1)}},k=async()=>{if(t!==null){f(!0);try{let c=await L.clearDesignSystem(t);n(c),i(c.tokens)}catch(c){$(e(V(U(c))))}finally{f(!1)}}};return(0,w.jsxs)("div",{className:"art-design",children:[(0,w.jsxs)("p",{className:"art-design-source",children:[e("design.hint")," ",e(`design.source.${r.source}`)]}),(0,w.jsxs)("div",{className:"art-design-group",children:[(0,w.jsx)("h3",{children:e("design.preview")}),(0,w.jsx)("div",{className:"art-design-preview",style:{height:150,display:"flex"},children:(0,w.jsx)(yt,{content:nn(e),designCss:y,title:a.name,frameTitle:e("design.preview"),dark:b})})]}),(0,w.jsxs)("label",{className:"art-field",children:[e("design.name"),(0,w.jsx)("input",{type:"text",value:a.name,maxLength:80,onChange:c=>i({...a,name:c.target.value})})]}),["colors","colorsDark"].map(c=>(0,w.jsxs)("div",{className:"art-design-group",children:[(0,w.jsx)("h3",{children:e(c==="colors"?"design.colors":"design.colorsDark")}),(0,w.jsx)("div",{className:"art-swatches",children:_e.map(g=>{let M=E=>{let P={...a[c],[g]:E};i({...a,[c]:P})};return(0,w.jsxs)("div",{className:"art-swatch",children:[(0,w.jsx)("input",{type:"color","aria-label":e(`design.color.${g}`)+" "+e(c==="colors"?"design.colors":"design.colorsDark"),value:on(a[c][g])?a[c][g]:"#000000",onChange:E=>M(E.target.value)}),(0,w.jsxs)("span",{className:"art-swatch-text",children:[e(`design.color.${g}`),(0,w.jsx)("input",{type:"text","aria-label":e(`design.color.${g}`)+" "+e(c==="colors"?"design.colors":"design.colorsDark")+" CSS",value:a[c][g],onChange:E=>M(E.target.value)})]})]},g)})})]},c)),(0,w.jsxs)("div",{className:"art-design-group",children:[(0,w.jsx)("h3",{children:e("design.type")}),(0,w.jsxs)("label",{className:"art-field",children:[e("design.font"),(0,w.jsx)("input",{type:"text",value:a.typography.fontFamily,onChange:c=>i({...a,typography:{...a.typography,fontFamily:c.target.value}})})]}),(0,w.jsxs)("label",{className:"art-field",children:[e("design.display"),(0,w.jsx)("input",{type:"text",value:a.typography.displayFamily,onChange:c=>i({...a,typography:{...a.typography,displayFamily:c.target.value}})})]}),(0,w.jsxs)("label",{className:"art-field",children:[e("design.mono"),(0,w.jsx)("input",{type:"text",value:a.typography.monoFamily,onChange:c=>i({...a,typography:{...a.typography,monoFamily:c.target.value}})})]})]}),(0,w.jsxs)("div",{className:"art-design-group",children:[(0,w.jsx)("h3",{children:e("design.radius")}),(0,w.jsx)("div",{className:"art-radius-row",children:an.map(c=>(0,w.jsxs)("label",{children:[e(`design.radius.${c}`),(0,w.jsx)("input",{type:"number",min:0,max:64,value:a.radius[c],onChange:g=>i({...a,radius:{...a.radius,[c]:Number(g.target.value)||0}})})]},c))})]}),(0,w.jsxs)("label",{className:"art-field",children:[e("design.notes"),(0,w.jsx)("textarea",{value:a.notes,maxLength:4e3,onChange:c=>i({...a,notes:c.target.value})}),(0,w.jsx)("span",{className:"art-field-hint",children:e("design.notesHint")})]}),(0,w.jsxs)("div",{className:"art-design-actions",children:[t===null?null:(0,w.jsx)(kt.Button,{size:"sm",variant:"primary",disabled:u,onClick:()=>void h("workspace"),children:e("design.saveWorkspace")}),(0,w.jsx)(kt.Button,{size:"sm",variant:t===null?"primary":"outline",disabled:u,onClick:()=>void h("library"),children:e("design.saveLibrary")}),r.source==="workspace"&&t!==null?(0,w.jsx)(kt.Button,{size:"sm",variant:"outline",disabled:u,onClick:()=>void k(),children:e("design.clear")}):null]})]})}var Ur=require("react"),qr="dsh-artifact-studio.pins";function sn(){if(typeof window>"u")return new Set;try{let e=window.localStorage.getItem(qr);if(e===null)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(r=>typeof r=="string")):new Set}catch{return new Set}}var Tt=sn(),qt=new Set;function ln(e){return qt.add(e),()=>qt.delete(e)}function Kr(){return(0,Ur.useSyncExternalStore)(ln,()=>Tt,()=>Tt)}function Gr(e){let t=new Set(Tt);t.has(e)?t.delete(e):t.add(e),Tt=t;try{window.localStorage.setItem(qr,JSON.stringify([...t]))}catch{}for(let r of qt)r()}var cn=`<!doctype html>
41
+ <html lang="en">
42
+ <head>
43
+ <meta charset="utf-8">
44
+ <meta name="viewport" content="width=device-width, initial-scale=1">
45
+ <meta name="color-scheme" content="light dark">
46
+ <style>
47
+ body {
48
+ margin: 0;
49
+ font-family: var(--artifact-font-family);
50
+ color: var(--artifact-color-text);
51
+ background: var(--artifact-color-surface);
52
+ }
53
+ main { max-width: 720px; margin: 0 auto; padding: var(--artifact-space-6) var(--artifact-space-4); }
54
+ h1 { font-size: var(--artifact-font-size-5); margin: 0 0 var(--artifact-space-2); letter-spacing: -0.02em; }
55
+ h1 { font-family: var(--artifact-font-display); }
56
+ p { color: var(--artifact-color-muted); line-height: 1.6; }
57
+ </style>
58
+ </head>
59
+ <body>
60
+ <main>
61
+ <h1>{{title}}</h1>
62
+ <p>Select any text and choose Edit with agent, or edit the code yourself.</p>
63
+ </main>
64
+ </body>
65
+ </html>
66
+ `,dn=`# {{title}}
67
+
68
+ Start writing, or select text and choose Edit with agent.
69
+ `;function pn(e){return e.replace(/[&<>"']/g,t=>`&#${t.charCodeAt(0)};`)}function un(e){return e.replace(/[\\`*_\[\]#]/g,t=>`\\${t}`)}function Yr(e,t){return e==="doc"?dn.replace("{{title}}",un(t)):cn.replace("{{title}}",pn(t))}var l=require("react/jsx-runtime"),fn={items:[],total:0,hasMore:!1,truncated:!1};function Kt(e,t){return e.scope==="library"?{manifest:e,address:{scope:"library",id:e.id},where:{scope:"library",workspaceId:t}}:t===null?null:{manifest:e,address:{scope:"workspace",workspaceId:t,id:e.id},where:{scope:"workspace",workspaceId:t}}}function mn(e,t){e!==void 0&&(fe(t.manifest.id,t.manifest.title),e(z(t.address)))}var Qe=new Map,Gt=new Map;function gn(e){let t=z(e.address),r=Qe.get(t);if(r!==void 0&&r.version>=e.manifest.version)return Promise.resolve(r);let n=`${t}:${e.manifest.version}`,a=Gt.get(n);if(a!==void 0)return a;let i=L.get(e.where,e.manifest.id).then(s=>{let d={version:s.version,content:s.content,designCss:s.designCss},u=Qe.get(t);return(u===void 0||u.version<=d.version)&&(Qe.size>=60&&Qe.clear(),Qe.set(t,d)),d}).finally(()=>{Gt.delete(n)});return Gt.set(n,i),i}function bn(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 r of t.querySelectorAll("script, iframe, object, embed, base"))r.remove();for(let r of t.querySelectorAll("*"))for(let n of[...r.attributes]){let a=n.name.toLowerCase();(a.startsWith("on")||a==="srcdoc")&&r.removeAttribute(n.name)}return t.documentElement.outerHTML}function yn(e){let t=e.replace(/```[\s\S]*?```/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/<[^>]+>/g," ").replace(/[#>*_`~]/g," ").replace(/\s+/g," ").trim();return t.length>220?`${t.slice(0,220).trimEnd()}...`:t}function hn({t:e,view:t}){let[r,n]=(0,R.useState)(null),[a,i]=(0,R.useState)(!1),[s,d]=(0,R.useState)(typeof IntersectionObserver>"u"),[u,f]=(0,R.useState)(null),b=(0,R.useRef)(null),y=je(),h=z(t.address),k=t.manifest.title,c=t.manifest.type,g=t.manifest.version;(0,R.useEffect)(()=>{if(s)return;let P=b.current;if(P===null)return;let F=new IntersectionObserver(se=>{se.some(B=>B.isIntersecting)&&(d(!0),F.disconnect())},{rootMargin:"140px"});return F.observe(P),()=>F.disconnect()},[s]),(0,R.useEffect)(()=>{if(!s)return;let P=!1;return gn(t).then(F=>{!P&&F.version===g&&(n(F),i(!1))}).catch(()=>{P||i(!0)}),()=>{P=!0}},[s,h,g]),(0,R.useEffect)(()=>{if(c!=="page"||r===null){f(null);return}let P=URL.createObjectURL(new Blob([gt(bn(r.content),r.designCss,k,y?"dark":"light")],{type:"text/html"}));return f(P),()=>URL.revokeObjectURL(P)},[r,c,k,y]);let M=c==="page"?(0,l.jsx)(ie,{}):(0,l.jsx)(be,{});if(a)return(0,l.jsx)("span",{className:"art-cover",ref:b,"aria-hidden":"true",children:(0,l.jsx)("span",{className:"art-cover-fallback",children:M})});if(c==="page")return(0,l.jsx)("span",{className:"art-cover",ref:b,"aria-hidden":"true",children:u===null?(0,l.jsx)("span",{className:"art-cover-fallback",children:M}):(0,l.jsx)("span",{className:"art-cover-frame-wrap",children:(0,l.jsx)("iframe",{className:"art-cover-frame",src:u,sandbox:"",title:e("gallery.coverTitle",{title:k}),tabIndex:-1,loading:"lazy",referrerPolicy:"no-referrer"})})});let E=r===null?"":yn(r.content);return(0,l.jsx)("span",{className:"art-cover",ref:b,"aria-hidden":"true",children:E===""?(0,l.jsx)("span",{className:"art-cover-fallback",children:M}):(0,l.jsxs)("span",{className:"art-cover-doc",children:[(0,l.jsx)("span",{className:"art-cover-doc-title",children:k}),(0,l.jsx)("span",{className:"art-cover-doc-text",children:E})]})})}function vn({t:e,view:t,pinned:r,onOpen:n}){let a=z(t.address),i=e(r?"gallery.unpin":"gallery.pin",{title:t.manifest.title});return(0,l.jsxs)("li",{className:"art-tile",children:[(0,l.jsxs)("button",{type:"button",className:"art-tile-open",onClick:()=>n(t),children:[(0,l.jsx)(hn,{t:e,view:t}),(0,l.jsxs)("span",{className:"art-tile-body",children:[(0,l.jsx)("span",{className:"art-tile-title",title:t.manifest.title,children:t.manifest.title}),(0,l.jsxs)("span",{className:"art-tile-sub",children:[e(`type.${t.manifest.type}`)," \xB7 ",e("gallery.updated",{time:bt(e,t.manifest.updatedAt)})," \xB7 ",e("gallery.version",{version:t.manifest.version}),t.manifest.scope==="library"?" \xB7 "+e("scope.library"):""]})]})]}),(0,l.jsx)(N.Tooltip,{label:i,side:"left",portal:!0,children:(0,l.jsx)("button",{type:"button",className:"art-tile-pin","aria-label":i,"aria-pressed":r,onClick:()=>Gr(a),children:r?(0,l.jsx)(N.IconPinFillRegular,{size:14}):(0,l.jsx)(N.IconPinOutlineRegular,{size:14})})})]})}function Xr({t:e,heading:t,views:r,pinned:n,onOpen:a}){let i=(0,R.useId)();return r.length===0?null:(0,l.jsxs)("section",{className:"art-section","aria-labelledby":i,children:[(0,l.jsxs)("div",{className:"art-section-head",children:[(0,l.jsx)("h2",{className:"art-section-title",id:i,children:t}),(0,l.jsx)("span",{className:"art-section-hint",children:e("gallery.count",{count:r.length})})]}),(0,l.jsx)("ul",{className:"art-grid",children:r.map(s=>(0,l.jsx)(vn,{t:e,view:s,pinned:n.has(z(s.address)),onOpen:a},z(s.address)))})]})}function Qr(e,t,r,n){let[a,i]=(0,R.useState)({key:"",state:{status:"loading"}}),[s,d]=(0,R.useState)(1),u=(e===null?"none":e.scope+":"+(e.workspaceId??""))+":"+t+":"+(r??""),f=e===null?{status:"ready",page:fn}:a.key===u?a.state:{status:"loading"};return(0,R.useEffect)(()=>d(1),[u,t]),(0,R.useEffect)(()=>{if(e===null)return;let b=new AbortController,y=setTimeout(async()=>{try{let h=[];for(let c=0;c<s&&(h.push(await L.list(e,{query:t,type:r,offset:c*50},b.signal)),!!h[h.length-1]?.hasMore);c+=1);let k=h[h.length-1];if(k===void 0||b.signal.aborted)return;i({key:u,state:{status:"ready",page:{...k,items:h.flatMap(c=>c.items)}}})}catch(h){b.signal.aborted||i({key:u,state:{status:"failed",code:U(h)}})}},t===""?0:180);return()=>{b.abort(),clearTimeout(y)}},[u,t,n,s]),{state:f,more:()=>d(b=>b+1)}}function xn({t:e,scope:t}){let r=async n=>{try{await navigator.clipboard.writeText(n),$(e("gallery.promptCopied"))}catch{$(e("action.copyFailed"))}};return(0,l.jsxs)("div",{className:"art-empty",children:[(0,l.jsx)("p",{className:"art-empty-title",children:e(t==="library"?"empty.libraryTitle":"empty.workspaceTitle")}),(0,l.jsx)("p",{className:"art-empty-hint",children:e(t==="library"?"empty.libraryHint":"empty.workspaceHint")}),(0,l.jsx)("ul",{className:"art-starters",children:Ut.map(n=>(0,l.jsxs)("li",{className:"art-starter",children:[(0,l.jsxs)("span",{className:"art-starter-text",children:[(0,l.jsx)("span",{className:"art-starter-name",children:e(`prompt.${n}`)}),(0,l.jsx)("span",{className:"art-starter-hint",children:e(`prompt.${n}Text`)})]}),(0,l.jsx)(N.Tooltip,{label:e("gallery.copyPrompt"),side:"left",portal:!0,children:(0,l.jsx)(N.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.copyPromptNamed",{name:e(`prompt.${n}`)}),onClick:()=>void r(e(`prompt.${n}Text`)),children:(0,l.jsx)(N.IconCopyOutlineRegular,{size:14})})})]},n))})]})}function Jr({t:e,workspaceId:t,open:r,toolbar:n}){let[a,i]=(0,R.useState)(""),[s,d]=(0,R.useState)("all"),[u,f]=(0,R.useState)(void 0),[b,y]=(0,R.useState)("list"),[h,k]=(0,R.useState)(!1),[c,g]=(0,R.useState)(0),M=ft()+c,E=Kr(),P=Qr(t===null?null:{scope:"workspace",workspaceId:t},a,u,M),F=Qr({scope:"library",workspaceId:t},a,u,M),se=(0,R.useId)(),B=(0,R.useId)(),te=(0,R.useCallback)(S=>mn(r,S),[r]),X=(0,R.useCallback)(async(S,K)=>{if(K==="workspace"&&t===null)return;let De=e(S==="page"?"create.untitledPage":"create.untitledDoc");try{let{manifest:de}=await L.create({scope:K,workspaceId:t},S,De,Yr(S,De));me();let Je=Kt(de,t);Je!==null&&te(Je)}catch(de){$(e(V(U(de))))}},[t,e,te]),xe=s==="library"||t===null?"library":"workspace",le=s!=="library"&&P.state.status==="ready"?P.state.page:null,ce=s!=="workspace"&&F.state.status==="ready"?F.state.page:null,re=s!=="library"&&t!==null&&P.state.status==="loading"||s!=="workspace"&&F.state.status==="loading",Q=s!=="library"&&t!==null&&P.state.status==="failed"?P.state.code:s!=="workspace"&&F.state.status==="failed"?F.state.code:void 0,j=[];for(let S of le?.items??[]){let K=Kt(S,t);K!==null&&j.push(K)}for(let S of ce?.items??[]){let K=Kt(S,t);K!==null&&j.push(K)}j.sort((S,K)=>Date.parse(K.manifest.updatedAt)-Date.parse(S.manifest.updatedAt));let x=j.filter(S=>E.has(z(S.address))),C=j.filter(S=>!E.has(z(S.address))),I=le?.hasMore===!0||ce?.hasMore===!0,O=le?.truncated===!0||ce?.truncated===!0,H=t===null&&s==="workspace",St=s==="library"||t===null?"library":"workspace",Pe=()=>{s!=="library"&&P.more(),s!=="workspace"&&F.more()};return(0,l.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"",children:[(0,l.jsxs)("header",{className:"art-header",children:[(0,l.jsxs)("div",{className:"art-heading",children:[b==="design"?(0,l.jsx)(N.Tooltip,{label:e("panel"),side:"bottom",portal:!0,children:(0,l.jsx)(N.Button,{size:"sm",className:"art-icon-button","aria-label":e("panel"),onClick:()=>y("list"),children:(0,l.jsx)(N.IconChevronLeftOutlineRegular,{size:16})})}):null,(0,l.jsx)("span",{className:"art-title",children:e(b==="design"?"design.title":"panel")})]}),b==="list"?n:null,b==="list"?(0,l.jsxs)("div",{className:"art-actions",children:[(0,l.jsx)(N.Tooltip,{label:e("gallery.design"),side:"bottom",portal:!0,children:(0,l.jsx)(N.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.design"),onClick:()=>y("design"),children:(0,l.jsx)(N.IconSlidersTwoOutlineRegular,{size:16})})}),(0,l.jsx)(N.Tooltip,{label:e("gallery.refresh"),side:"bottom",portal:!0,children:(0,l.jsx)(N.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.refresh"),onClick:()=>g(S=>S+1),children:(0,l.jsx)(N.IconRefreshOutlineRegular,{size:16})})}),(0,l.jsx)(N.Menu,{open:h,onClose:()=>k(!1),align:"end",portal:!0,autoFocus:!0,items:[{id:"page",label:e("gallery.newPage")+" \xB7 "+e(`scope.${xe}`),icon:(0,l.jsx)(ie,{size:14})},{id:"doc",label:e("gallery.newDoc")+" \xB7 "+e(`scope.${xe}`),icon:(0,l.jsx)(be,{size:14})}],onSelect:S=>{k(!1),X(S==="doc"?"doc":"page",xe)},anchor:(0,l.jsx)(N.Button,{size:"sm",variant:"outline",icon:(0,l.jsx)(N.IconPlusOutlineRegular,{size:14}),"aria-haspopup":"menu","aria-expanded":h,onClick:()=>k(S=>!S),children:e("gallery.create")})})]}):null]}),b==="design"?(0,l.jsx)("div",{className:"art-scroll",children:(0,l.jsx)(_r,{t:e,workspaceId:t})}):(0,l.jsx)("div",{className:"art-scroll",children:(0,l.jsxs)("div",{className:"art-gallery",children:[(0,l.jsxs)("div",{className:"art-toolbar",children:[(0,l.jsx)("input",{className:"art-search",type:"search","aria-label":e("gallery.searchLabel"),placeholder:e("gallery.search"),value:a,onChange:S=>i(S.target.value)}),(0,l.jsx)(N.SegmentedControl,{id:B,className:"art-segment",label:e("filter.type"),value:u??"all",options:[{value:"all",label:e("type.all")},{value:"page",label:e("type.page")},{value:"doc",label:e("type.doc")}],onChange:S=>f(S==="all"?void 0:S)}),(0,l.jsx)(N.SegmentedControl,{id:se,className:"art-segment",label:e("filter.scope"),value:s,options:[{value:"all",label:e("filter.all")},{value:"workspace",label:e("scope.workspace")},{value:"library",label:e("scope.library")}],onChange:d})]}),(0,l.jsx)("div",{role:"tabpanel",id:B+"-"+(u??"all")+"-panel","aria-labelledby":B+"-"+(u??"all"),children:(0,l.jsxs)("div",{role:"tabpanel",id:se+"-"+s+"-panel","aria-labelledby":se+"-"+s,children:[re?(0,l.jsx)("p",{className:"art-note",children:e("empty.loading")}):null,!re&&Q!==void 0&&j.length===0?(0,l.jsxs)("div",{className:"art-empty",role:"alert",children:[(0,l.jsx)("p",{className:"art-empty-title",children:e(V(Q))}),(0,l.jsx)(N.Button,{size:"sm",variant:"outline",onClick:()=>g(S=>S+1),children:e("action.retry")})]}):null,!re&&Q!==void 0&&j.length>0?(0,l.jsxs)("div",{className:"art-bar",role:"status",children:[(0,l.jsx)("span",{children:e(V(Q))}),(0,l.jsx)(N.Button,{size:"sm",variant:"outline",onClick:()=>g(S=>S+1),children:e("action.retry")})]}):null,!re&&Q===void 0&&j.length===0?a!==""?(0,l.jsx)("p",{className:"art-note",children:e("empty.noMatch")}):u!==void 0?(0,l.jsx)("p",{className:"art-note",children:e("empty.typeMatch",{type:e(`type.${u}`)})}):H?(0,l.jsx)("p",{className:"art-note",children:e("empty.noWorkspace")}):(0,l.jsx)(xn,{t:e,scope:St}):null,!re&&j.length>0?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(Xr,{t:e,heading:e("gallery.pinned"),views:x,pinned:E,onOpen:te}),C.length===0?(0,l.jsx)("p",{className:"art-note",children:e("gallery.allPinned")}):(0,l.jsx)(Xr,{t:e,heading:e("gallery.recent"),views:C,pinned:E,onOpen:te}),I?(0,l.jsx)("div",{className:"art-gallery-more",children:(0,l.jsx)(N.Button,{size:"sm",variant:"outline",onClick:Pe,children:e("gallery.more")})}):null,O?(0,l.jsx)("p",{className:"art-note",children:e("gallery.truncated")}):null]}):null]})})]})})]})}var ee=require("react/jsx-runtime"),Zr="dsh-artifact-studio.panel.workspace";function ea({t:e,workspaces:t}){let r=(0,Y.useCallback)(y=>t.subscribe(y),[t]),n=(0,Y.useCallback)(()=>t.getSnapshot(),[t]),i=(0,Y.useSyncExternalStore)(r,n,n).items,[s,d]=(0,Y.useState)(()=>{let y=window.localStorage.getItem(Zr);return y===null||y===""?i[0]?.workspaceId??null:y}),[u,f]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{if(i.length===0){s!==null&&d(null);return}(s===null||!i.some(y=>y.workspaceId===s))&&d(i[0]?.workspaceId??null)},[i,s]),(0,Y.useEffect)(()=>{s!==null&&window.localStorage.setItem(Zr,s)},[s]);let b=(0,Y.useMemo)(()=>u===null?void 0:ke(u),[u]);return(0,ee.jsxs)("div",{className:"art-panel-stack",children:[(0,ee.jsx)("div",{className:"art-panel-region",hidden:b!==void 0,children:(0,ee.jsx)(Jr,{t:e,workspaceId:s,open:y=>f(y),toolbar:i.length===0?null:(0,ee.jsxs)("label",{className:"art-workspace",children:[(0,ee.jsx)("span",{className:"art-workspace-label",children:e("panel.workspace")}),(0,ee.jsx)("select",{className:"art-workspace-select","aria-label":e("panel.workspace"),value:s??"",onChange:y=>d(y.target.value===""?null:y.target.value),children:i.map(y=>(0,ee.jsx)("option",{value:y.workspaceId,children:y.title},y.workspaceId))})]})})}),b===void 0?null:(0,ee.jsx)("div",{className:"art-panel-region",children:(0,ee.jsx)(Or,{t:e,address:b,workspaceName:i.find(y=>b.scope==="workspace"&&y.workspaceId===b.workspaceId)?.title,onBack:()=>f(null)})})]})}var ta="dsh-artifact-studio/styles",wn=Sr.split(`
70
+ `).map(e=>{let t=e.indexOf("{"),r=e.slice(0,t).split(",").map(a=>a.trim()).filter(a=>a!=="body"&&a!==".art-docpage");return(r.length===0?".art-docpage":r.map(a=>".art-docpage .art-prose "+a).join(", "))+" "+e.slice(t)}).join(`
71
+ `),kn=`
72
+ .art-root {
73
+ box-sizing: border-box;
74
+ display: flex;
75
+ flex-direction: column;
76
+ height: 100%;
77
+ min-height: 0;
78
+ min-width: 0;
79
+ color: var(--dsw-alias-label-primary);
80
+ background: var(--dsw-alias-bg-base);
81
+ font-size: 13px;
82
+ line-height: 1.5;
83
+ }
84
+ .art-root *, .art-root *::before, .art-root *::after, .art-card * { box-sizing: border-box; }
85
+ .art-root ::selection { background: color-mix(in srgb, var(--dsw-alias-brand-primary) 28%, transparent); }
86
+ .art-root :focus-visible, .art-card :focus-visible, .art-composer:focus-visible {
87
+ outline: 2px solid var(--dsw-alias-brand-primary);
88
+ outline-offset: 1px;
89
+ }
90
+ .art-header {
91
+ flex: none;
92
+ display: flex;
93
+ align-items: center;
94
+ flex-wrap: wrap;
95
+ gap: 12px;
96
+ min-height: 44px;
97
+ padding: 8px 12px;
98
+ border-bottom: .5px solid var(--dsw-alias-border-l2);
99
+ }
100
+ .art-heading { flex: 1 1 auto; min-width: 0; overflow: hidden; display: flex; align-items: center; gap: 8px; }
101
+ .art-title {
102
+ min-width: 0;
103
+ margin: 0;
104
+ overflow: hidden;
105
+ text-overflow: ellipsis;
106
+ white-space: nowrap;
107
+ font-size: 14px;
108
+ font-weight: 600;
109
+ line-height: 1.35;
110
+ color: var(--dsw-alias-label-primary);
111
+ }
112
+ .art-title-input {
113
+ min-width: 0;
114
+ flex: 1;
115
+ height: 26px;
116
+ padding: 0 6px;
117
+ border: 1px solid var(--dsw-alias-brand-primary);
118
+ border-radius: 6px;
119
+ background: var(--dsw-alias-bg-base);
120
+ color: var(--dsw-alias-label-primary);
121
+ font: inherit;
122
+ font-weight: 600;
123
+ }
124
+ .art-meta {
125
+ display: flex;
126
+ align-items: baseline;
127
+ gap: 2px;
128
+ min-width: 0;
129
+ color: var(--dsw-alias-label-secondary);
130
+ font-size: 11px;
131
+ line-height: 1.4;
132
+ font-variant-numeric: tabular-nums;
133
+ }
134
+ .art-meta-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
135
+ .art-save-status { flex: none; white-space: nowrap; }
136
+ .art-save-status[data-tone="warn"] { color: var(--dsw-alias-state-warn-primary); }
137
+ .art-save-status[data-tone="error"] { color: var(--dsw-alias-state-error-primary); }
138
+ .art-actions { flex: none; display: flex; align-items: center; gap: 4px; }
139
+ .art-toolbar {
140
+ flex: none;
141
+ display: flex;
142
+ align-items: center;
143
+ flex-wrap: wrap;
144
+ gap: 8px;
145
+ padding: 10px 0;
146
+ border-bottom: .5px solid var(--dsw-alias-border-l2);
147
+ }
148
+ .art-search {
149
+ flex: 1;
150
+ min-width: 0;
151
+ height: 42px;
152
+ padding: 0 10px;
153
+ border: 1px solid var(--dsw-alias-border-l1);
154
+ border-radius: 7px;
155
+ background: var(--dsw-alias-bg-base);
156
+ color: var(--dsw-alias-label-primary);
157
+ font: inherit;
158
+ }
159
+ .art-search::placeholder { color: var(--dsw-alias-label-secondary); }
160
+ .art-search:focus { outline: none; border-color: var(--dsw-alias-brand-primary); }
161
+ .art-scroll { flex: 1; min-height: 0; overflow: auto; scrollbar-gutter: stable; }
162
+ .art-scroll::-webkit-scrollbar, .art-drawer-body::-webkit-scrollbar { width: 10px; height: 10px; }
163
+ .art-scroll::-webkit-scrollbar-thumb, .art-drawer-body::-webkit-scrollbar-thumb {
164
+ border: 3px solid transparent;
165
+ border-radius: 10px;
166
+ background: color-mix(in srgb, var(--dsw-alias-label-secondary) 40%, transparent) padding-box;
167
+ }
168
+ .art-gallery {
169
+ width: 100%;
170
+ max-width: 860px;
171
+ margin-inline: auto;
172
+ padding: 0 12px 24px;
173
+ }
174
+ .art-section { padding: 4px 0 18px; }
175
+ .art-section-head {
176
+ display: flex;
177
+ align-items: baseline;
178
+ justify-content: space-between;
179
+ gap: 8px;
180
+ padding: 10px 0 6px;
181
+ }
182
+ .art-section-title { margin: 0; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-primary); }
183
+ .art-section-hint { font-size: 11px; color: var(--dsw-alias-label-secondary); }
184
+ .art-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
185
+ .art-tile {
186
+ position: relative;
187
+ min-width: 0;
188
+ overflow: hidden;
189
+ border: .5px solid var(--dsw-alias-border-l1);
190
+ border-radius: 10px;
191
+ background: var(--dsw-alias-bg-layer-1);
192
+ }
193
+ .art-tile:hover { border-color: var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-2); }
194
+ .art-tile-open {
195
+ display: block;
196
+ width: 100%;
197
+ padding: 0;
198
+ border: none;
199
+ border-radius: inherit;
200
+ background: transparent;
201
+ color: inherit;
202
+ font: inherit;
203
+ text-align: left;
204
+ cursor: pointer;
205
+ }
206
+ .art-tile-open:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }
207
+ .art-tile-body { display: flex; flex-direction: column; gap: 3px; padding: 9px 10px 10px; }
208
+ .art-tile-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
209
+ .art-tile-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--dsw-alias-label-secondary); }
210
+ .art-tile-pin {
211
+ position: absolute;
212
+ z-index: 2;
213
+ top: 6px;
214
+ right: 6px;
215
+ display: inline-flex;
216
+ align-items: center;
217
+ justify-content: center;
218
+ width: 26px;
219
+ height: 26px;
220
+ padding: 0;
221
+ border: none;
222
+ border-radius: 6px;
223
+ background: color-mix(in srgb, var(--dsw-alias-bg-base) 82%, transparent);
224
+ color: var(--dsw-alias-label-secondary);
225
+ cursor: pointer;
226
+ opacity: .72;
227
+ }
228
+ .art-tile-pin:hover, .art-tile-pin:focus-visible { opacity: 1; background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); }
229
+ .art-tile-pin[aria-pressed="true"] { opacity: 1; color: var(--dsw-alias-brand-primary); }
230
+ .art-tile-pin svg { width: 15px; height: 15px; }
231
+ .art-cover { display: block; position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--dsw-alias-bg-layer-2); border-bottom: .5px solid var(--dsw-alias-border-l1); }
232
+ .art-cover-frame-wrap { display: block; width: 274px; height: 205px; margin: 0 auto; overflow: hidden; }
233
+ .art-cover-frame { display: block; width: 720px; height: 540px; border: 0; transform: scale(.38); transform-origin: top left; pointer-events: none; background: var(--dsw-static-neutral-00); }
234
+ .art-cover-fallback { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--dsw-alias-label-secondary); }
235
+ .art-cover-fallback svg { width: 26px; height: 26px; opacity: .55; }
236
+ .art-cover-doc { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 14px 14px 10px; background: var(--dsw-alias-bg-base); }
237
+ .art-cover-doc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
238
+ .art-cover-doc-text { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 6; -webkit-box-orient: vertical; font-size: 11px; line-height: 1.6; color: var(--dsw-alias-label-secondary); }
239
+ .art-gallery-more { display: flex; justify-content: center; padding: 4px 0 10px; }
240
+ .art-empty {
241
+ display: flex;
242
+ flex-direction: column;
243
+ align-items: flex-start;
244
+ gap: 6px;
245
+ margin: 2px 0 6px;
246
+ padding: 14px;
247
+ border: 1px dashed var(--dsw-alias-border-l1);
248
+ border-radius: 10px;
249
+ color: var(--dsw-alias-label-secondary);
250
+ }
251
+ .art-empty-title { margin: 0; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-primary); }
252
+ .art-empty-hint { margin: 0; font-size: 12px; line-height: 1.55; max-width: 44ch; }
253
+ .art-empty-actions { display: flex; gap: 6px; margin-top: 4px; }
254
+ .art-center {
255
+ flex: 1;
256
+ display: flex;
257
+ flex-direction: column;
258
+ align-items: center;
259
+ justify-content: center;
260
+ gap: 8px;
261
+ padding: 24px;
262
+ text-align: center;
263
+ color: var(--dsw-alias-label-secondary);
264
+ }
265
+ .art-center-title { margin: 0; font-size: 13px; font-weight: 600; color: var(--dsw-alias-label-primary); }
266
+ .art-center-hint { margin: 0; max-width: 40ch; font-size: 12px; line-height: 1.55; }
267
+ .art-note { margin: 0; padding: 4px 8px; font-size: 11px; color: var(--dsw-alias-label-secondary); }
268
+ .art-body { flex: 1; min-height: 0; min-width: 0; display: flex; }
269
+ .art-stage { position: relative; flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--dsw-alias-bg-layer-1); }
270
+ .art-drawer-layer { flex: none; display: flex; min-width: 0; min-height: 0; }
271
+ .art-drawer-layer[data-overlay="true"] { position: absolute; inset: 0; z-index: 30; justify-content: flex-end; }
272
+ .art-drawer {
273
+ flex: none;
274
+ display: flex;
275
+ flex-direction: column;
276
+ width: 300px;
277
+ min-width: 0;
278
+ min-height: 0;
279
+ border-left: .5px solid var(--dsw-alias-border-l2);
280
+ background: var(--dsw-alias-bg-base);
281
+ }
282
+ .art-drawer-layer[data-overlay="true"] .art-drawer { position: relative; z-index: 1; width: min(320px, 100%); }
283
+ .art-drawer-scrim { position: absolute; inset: 0; background: var(--dsw-alias-bg-mask-2); }
284
+ .art-drawer-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 12px; border-bottom: .5px solid var(--dsw-alias-border-l2); }
285
+ .art-drawer-head h2 { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.4; }
286
+ .art-drawer-body { flex: 1; min-height: 0; overflow: auto; }
287
+ /* The iframe canvas is the artifact's, not plugin chrome: HTML paints white by default, so a page that sets no background must not inherit the host theme. */
288
+ .art-frame { flex: 1; width: 100%; min-height: 0; border: none; background: var(--dsw-static-neutral-00); }
289
+ .art-source {
290
+ flex: 1;
291
+ min-height: 0;
292
+ width: 100%;
293
+ padding: 12px 14px;
294
+ border: none;
295
+ resize: none;
296
+ background: var(--dsw-alias-bg-base);
297
+ color: var(--dsw-alias-label-primary);
298
+ font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
299
+ font-size: 12px;
300
+ line-height: 1.6;
301
+ tab-size: 2;
302
+ }
303
+ .art-source:focus { outline: none; }
304
+ .art-prose ul[data-type="taskList"] { list-style: none; padding-left: .2em; }
305
+ .art-prose ul[data-type="taskList"] li { display: flex; gap: 8px; }
306
+ .art-prose ul[data-type="taskList"] li > label { flex: none; margin-top: .2em; }
307
+ .art-prose ul[data-type="taskList"] li > div { flex: 1; }
308
+ .art-history-body { display: flex; flex-direction: column; min-height: 0; }
309
+ .art-version {
310
+ display: flex;
311
+ flex-direction: column;
312
+ gap: 2px;
313
+ width: 100%;
314
+ padding: 8px 12px;
315
+ border: none;
316
+ background: transparent;
317
+ color: inherit;
318
+ font: inherit;
319
+ text-align: left;
320
+ cursor: pointer;
321
+ }
322
+ .art-version:hover { background: var(--dsw-alias-bg-layer-1); }
323
+ .art-version[aria-current="true"] { background: var(--dsw-alias-bg-layer-2); }
324
+ .art-version-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
325
+ .art-version-sub { font-size: 11px; color: var(--dsw-alias-label-secondary); }
326
+ .art-bar {
327
+ flex: none;
328
+ display: flex;
329
+ align-items: center;
330
+ justify-content: space-between;
331
+ gap: 10px;
332
+ padding: 8px 12px;
333
+ border-bottom: .5px solid var(--dsw-alias-border-l2);
334
+ background: var(--dsw-alias-bg-layer-2);
335
+ font-size: 12px;
336
+ }
337
+ .art-bar[data-tone="warn"] { background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 14%, var(--dsw-alias-bg-base)); }
338
+ .art-bar[data-tone="error"] { background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 12%, var(--dsw-alias-bg-base)); }
339
+ .art-bar-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
340
+ .art-bar-text strong { font-weight: 600; }
341
+ .art-bar-actions { flex: none; display: flex; gap: 6px; }
342
+ .art-status {
343
+ flex: none;
344
+ display: flex;
345
+ align-items: center;
346
+ justify-content: space-between;
347
+ gap: 10px;
348
+ height: 28px;
349
+ padding: 0 12px;
350
+ border-top: .5px solid var(--dsw-alias-border-l2);
351
+ color: var(--dsw-alias-label-secondary);
352
+ font-size: 11px;
353
+ white-space: nowrap;
354
+ }
355
+ .art-status span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
356
+ .art-relative { position: relative; }
357
+ .art-form { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-bottom: .5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-1); }
358
+ .art-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dsw-alias-label-secondary); }
359
+ .art-field input[type="text"], .art-field textarea {
360
+ height: 30px;
361
+ padding: 0 9px;
362
+ border: 1px solid var(--dsw-alias-border-l1);
363
+ border-radius: 7px;
364
+ background: var(--dsw-alias-bg-base);
365
+ color: var(--dsw-alias-label-primary);
366
+ font: inherit;
367
+ font-size: 13px;
368
+ }
369
+ .art-field textarea { height: 84px; padding: 8px 9px; resize: vertical; line-height: 1.5; }
370
+ .art-field input:focus, .art-field textarea:focus { outline: none; border-color: var(--dsw-alias-brand-primary); }
371
+ .art-field-hint { font-size: 11px; color: var(--dsw-alias-label-secondary); }
372
+ .art-form-actions { display: flex; justify-content: flex-end; gap: 6px; }
373
+ .art-radio { display: flex; gap: 6px; }
374
+ .art-design { display: flex; flex-direction: column; gap: 18px; padding: 14px 14px 40px; }
375
+ .art-design-group { display: flex; flex-direction: column; gap: 8px; }
376
+ .art-design-group h3 { margin: 0; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-primary); }
377
+ .art-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
378
+ .art-swatch {
379
+ display: flex;
380
+ align-items: center;
381
+ gap: 8px;
382
+ padding: 6px 8px;
383
+ border: 1px solid var(--dsw-alias-border-l1);
384
+ border-radius: 8px;
385
+ }
386
+ .art-swatch input[type="color"] { flex: none; width: 26px; height: 26px; padding: 0; border: none; border-radius: 6px; background: none; cursor: pointer; }
387
+ .art-swatch-text { display: flex; flex-direction: column; min-width: 0; font-size: 11px; color: var(--dsw-alias-label-secondary); }
388
+ .art-swatch-text input {
389
+ width: 100%;
390
+ min-width: 0;
391
+ padding: 0;
392
+ border: none;
393
+ background: transparent;
394
+ color: var(--dsw-alias-label-primary);
395
+ font-family: ui-monospace, Menlo, Consolas, monospace;
396
+ font-size: 12px;
397
+ }
398
+ .art-swatch-text input:focus { outline: none; }
399
+ .art-radius-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
400
+ .art-radius-row label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--dsw-alias-label-secondary); }
401
+ .art-radius-row input {
402
+ height: 28px;
403
+ padding: 0 8px;
404
+ border: 1px solid var(--dsw-alias-border-l1);
405
+ border-radius: 6px;
406
+ background: var(--dsw-alias-bg-base);
407
+ color: var(--dsw-alias-label-primary);
408
+ font: inherit;
409
+ font-variant-numeric: tabular-nums;
410
+ }
411
+ .art-design-preview { overflow: hidden; border: 1px solid var(--dsw-alias-border-l1); border-radius: 10px; }
412
+ .art-design-source { font-size: 12px; color: var(--dsw-alias-label-secondary); }
413
+ .art-design-actions { display: flex; flex-wrap: wrap; gap: 6px; }
414
+ .art-composer {
415
+ display: inline-flex;
416
+ align-items: center;
417
+ justify-content: center;
418
+ width: 28px;
419
+ height: 28px;
420
+ padding: 0;
421
+ border: none;
422
+ border-radius: 7px;
423
+ background: transparent;
424
+ color: var(--dsw-alias-label-secondary);
425
+ cursor: pointer;
426
+ }
427
+ .art-composer:hover { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
428
+ .art-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
429
+ .art-chip svg { flex: none; width: 14px; height: 14px; color: var(--dsw-alias-label-secondary); }
430
+ .art-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
431
+ .art-workspace { display: flex; align-items: center; gap: 6px; margin-left: auto; min-width: 0; }
432
+ .art-workspace-label { font-size: 11px; color: var(--dsw-alias-label-secondary); white-space: nowrap; }
433
+ .art-workspace-select {
434
+ max-width: 180px; min-width: 90px; height: 26px; padding: 0 6px;
435
+ border: .5px solid var(--dsw-alias-border-l2); border-radius: 6px;
436
+ background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary);
437
+ font: inherit; font-size: 12px;
438
+ }
439
+ .art-panel-stack, .art-panel-region { height: 100%; min-height: 0; min-width: 0; }
440
+ .art-panel-region[hidden] { display: none; }
441
+ .art-root { container-type: inline-size; }
442
+ .art-editor-header { position: relative; flex-wrap: wrap; padding: 8px 12px; gap: 10px; }
443
+ .art-identity { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }
444
+ .art-identity .art-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
445
+ .art-editor-actions { margin-left: auto; flex: none; flex-wrap: wrap; justify-content: flex-end; }
446
+ .art-inline-form { display: flex; gap: 6px; padding: 8px 12px; }
447
+ .art-inline-form input { min-width: 0; flex: 1; padding: 4px 8px; background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); border: 1px solid var(--dsw-alias-border-l1); border-radius: 6px; font: inherit; }
448
+ .art-selection-bar {
449
+ position: absolute;
450
+ z-index: 12;
451
+ left: 50%;
452
+ bottom: 14px;
453
+ transform: translateX(-50%);
454
+ display: flex;
455
+ align-items: center;
456
+ gap: 8px;
457
+ width: max-content;
458
+ max-width: min(620px, calc(100% - 24px));
459
+ padding: 7px 8px 7px 11px;
460
+ border: .5px solid var(--dsw-alias-border-l2);
461
+ border-radius: 10px;
462
+ background: var(--dsw-alias-bg-overlay);
463
+ box-shadow: 0 8px 24px color-mix(in srgb, var(--dsw-alias-label-primary) 18%, transparent);
464
+ }
465
+ .art-selection-quote { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dsw-alias-label-secondary); }
466
+ .art-selection-bar .art-button { flex: none; }
467
+ .art-version-button {
468
+ display: inline-flex;
469
+ align-items: center;
470
+ gap: 1px;
471
+ height: 20px;
472
+ padding: 0 4px;
473
+ border: .5px solid var(--dsw-alias-border-l1);
474
+ border-radius: 5px;
475
+ background: transparent;
476
+ color: var(--dsw-alias-label-secondary);
477
+ font: inherit;
478
+ font-size: 11px;
479
+ font-variant-numeric: tabular-nums;
480
+ cursor: pointer;
481
+ }
482
+ .art-version-button:hover, .art-version-button[aria-expanded="true"] { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
483
+ .art-version-button svg { width: 12px; height: 12px; }
484
+ .art-root { position: relative; }
485
+ .art-bar { flex-wrap: wrap; }
486
+ .art-bar-actions { flex-wrap: wrap; }
487
+ .art-search { flex-basis: 140px; }
488
+ .art-source:focus-visible, .art-prose:focus-visible, .art-swatch-text input:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }
489
+ .art-status { height: 28px; padding: 0 12px; }
490
+ @container (max-width: 600px) {
491
+ .art-editor-header .art-heading { flex-basis: 100%; }
492
+ .art-editor-actions { width: 100%; justify-content: flex-end; }
493
+ .art-editor-actions .art-segment { margin-right: auto; }
494
+ .art-drawer-layer { position: absolute; inset: 0; z-index: 30; justify-content: flex-end; }
495
+ .art-drawer { width: min(320px, 100%); }
496
+ .art-workspace-label { display: none; }
497
+ .art-docpage { padding: 28px 20px 64px; }
498
+ }
499
+ @container (max-width: 520px) {
500
+ .art-toolbar { flex-direction: column; align-items: stretch; }
501
+ .art-search { width: 100%; flex: none; }
502
+ .art-toolbar .art-segment { align-self: flex-start; }
503
+ .art-gallery { padding: 0 10px 18px; }
504
+ .art-grid { grid-template-columns: 1fr; }
505
+ .art-cover { aspect-ratio: 16 / 10; }
506
+ .art-selection-bar { left: 8px; right: 8px; width: auto; max-width: none; transform: none; }
507
+ .art-selection-quote { flex: 1; }
508
+ }
509
+ @media (pointer: coarse) { .art-icon-button, .art-tile-pin, .art-composer { min-height: 44px; min-width: 44px; } }
510
+ @media (prefers-reduced-motion: no-preference) {
511
+ .art-tile, .art-tile-pin, .art-version, .art-card-open { transition: background-color .12s ease-out, color .12s ease-out, border-color .12s ease-out, opacity .12s ease-out; }
512
+ .art-doc-toolbar { animation: art-rise .14s cubic-bezier(.16, 1, .3, 1); }
513
+ }
514
+ @keyframes art-rise { from { opacity: 0; transform: translate(-50%, 4px); } to { opacity: 1; transform: translate(-50%, 0); } }
515
+ .art-icon-button { flex: none; }
516
+ .art-icon-button[aria-pressed="true"] { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
517
+ .art-meta-dot { color: var(--dsw-alias-label-tertiary, var(--dsw-alias-label-secondary)); padding: 0 2px; }
518
+ .art-ask { flex: none; }
519
+ .art-center-actions { display: flex; gap: 8px; }
520
+ .art-modal-error { margin: 0; color: var(--dsw-alias-state-error-primary); font-size: 13px; }
521
+ .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; }
522
+ .art-code, .art-source-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--dsw-alias-bg-base); }
523
+ .art-code { overflow: auto; }
524
+ .art-code-bar { flex: none; position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; padding: 6px 12px; border-bottom: .5px solid var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary); font-size: 12px; }
525
+ .art-code-block { margin: 0; border: none; border-radius: 0; }
526
+ .art-code pre.prim-code { margin: 0; padding: 12px 14px; white-space: pre-wrap; font: 12px/1.6 ui-monospace, Menlo, Consolas, monospace; }
527
+ .art-doc { position: relative; flex: 1; min-height: 0; overflow: auto; background: var(--dsw-alias-bg-layer-1); }
528
+ .art-docpage { box-sizing: border-box; width: min(100%, 820px); min-height: calc(100% - 32px); margin: 16px auto; padding: 56px 64px 96px; border-radius: var(--dsw-radius-md, 12px); background: var(--artifact-color-surface, var(--dsw-alias-bg-base)); box-shadow: 0 0 0 .5px var(--dsw-alias-border-l1), 0 1px 3px color-mix(in srgb, var(--dsw-alias-label-primary) 6%, transparent); }
529
+ .art-doc-mount { max-width: 70ch; margin: 0 auto; }
530
+ .art-prose, .art-prose:focus-visible { outline: none; }
531
+ .art-prose > :first-child { margin-top: 0; }
532
+ .art-prose ul[data-type="taskList"] { list-style: none; padding-left: .2em; }
533
+ .art-prose ul[data-type="taskList"] li { display: flex; gap: 8px; }
534
+ .art-prose ul[data-type="taskList"] li > label { flex: none; margin-top: .25em; }
535
+ .art-prose ul[data-type="taskList"] li > div { flex: 1; }
536
+ .art-prose ::selection { background: color-mix(in srgb, var(--artifact-color-primary, var(--dsw-alias-brand-primary)) 24%, transparent); }
537
+ .art-doc-toolbar { position: absolute; z-index: 15; display: flex; flex-wrap: wrap; justify-content: center; max-width: calc(100% - 16px); align-items: center; gap: 2px; padding: 4px; border-radius: var(--dsw-radius-md, 12px); background: var(--dsw-alias-bg-overlay, var(--dsw-alias-bg-base)); box-shadow: 0 0 0 .5px var(--dsw-alias-border-l2), 0 8px 24px color-mix(in srgb, var(--dsw-alias-label-primary) 16%, transparent); transform: translateX(-50%); white-space: nowrap; }
538
+ .art-doc-toolbar [aria-pressed="true"] { background: var(--dsw-alias-bg-layer-2); color: var(--dsw-alias-label-primary); }
539
+ .art-doc-toolbar-gap { width: .5px; align-self: stretch; margin: 2px 4px; background: var(--dsw-alias-border-l2); }
540
+ .art-card { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; max-width: 480px; padding: 10px 12px 10px 10px; border: .5px solid var(--dsw-alias-border-l1); border-radius: 16px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: inherit; font-size: 13px; text-align: left; }
541
+ .art-card-open { cursor: pointer; }
542
+ .art-card-open:hover { border-color: var(--dsw-alias-border-l2); background: var(--dsw-alias-bg-layer-2); }
543
+ .art-card-open:hover .art-card-go { color: var(--dsw-alias-label-primary); transform: translateX(1px); }
544
+ .art-card-icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; border: .5px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary); }
545
+ .art-card-icon[data-tone="error"] { color: var(--dsw-alias-state-error-primary); }
546
+ .art-card-icon svg { width: 18px; height: 18px; }
547
+ .art-card-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
548
+ .art-card-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
549
+ .art-card-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--dsw-alias-label-secondary); }
550
+ .art-card-sub[data-tone="error"] { color: var(--dsw-alias-state-error-primary); white-space: normal; }
551
+ .art-card-go { display: flex; color: var(--dsw-alias-label-secondary); transition: transform .12s ease-out, color .12s ease-out; }
552
+ .art-composer svg { width: 16px; height: 16px; }
553
+ .art-empty { align-items: stretch; }
554
+ .art-starters { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin: 10px 0 0; padding: 0; }
555
+ .art-starter { display: flex; align-items: flex-start; gap: 8px; padding: 10px 8px 10px 12px; border: .5px solid var(--dsw-alias-border-l1); border-radius: 12px; background: var(--dsw-alias-bg-base); }
556
+ .art-starter-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
557
+ .art-starter-name { font-size: 13px; font-weight: 600; color: var(--dsw-alias-label-primary); }
558
+ .art-starter-hint { font-size: 12px; line-height: 1.5; color: var(--dsw-alias-label-secondary); }
559
+ .art-tile-pin svg { width: 14px; height: 14px; }
560
+ `;function ra(){if(typeof document>"u"||document.querySelector(`style[data-plugin-css="${ta}"]`)!==null)return;let e=document.createElement("style");e.dataset.plugin="dsh-artifact-studio",e.dataset.pluginCss=ta,e.textContent=kn+wn,document.head.appendChild(e)}var ve=require("react/jsx-runtime");var Se="artifacts",na=["artifact_create","artifact_update"],Tn=["connection","slots","locale","sidebarRightTabs","sidebarRight","workspaces"];function Sn(e){if(e===null||typeof e!="object"||!("selectPanel"in e))return null;let{selectPanel:t}=e;return typeof t!="function"?null:{selectPanel:r=>{t.call(e,r)}}}function Yt(e){return function(r){return(0,ve.jsx)(ht,{title:r.t("error.surface"),hint:r.t("error.surfaceHint"),reloadLabel:r.t("action.reloadWindow"),children:(0,ve.jsx)(e,{...r})})}}function Nn(){let e=hr();return e===null?null:(0,ve.jsx)(aa.Toast,{text:e.message,onDone:()=>It(e.seq)},e.seq)}function Cn({useTabInfo:e}){let{tab:t}=e(),r=ke(t.contentId??t.navigation?.address),n=br(r?.id);return(0,ve.jsxs)("span",{className:"art-chip",children:[(0,ve.jsx)(be,{}),(0,ve.jsx)("span",{children:n??r?.id??""})]})}function An(e){ra(),e.effect(vr,"dsh-artifact-studio: unsaved draft guard"),ur(e.connection),ye.sidebarRight=e.sidebarRight,ye.layout=Sn(e.get("layout")),e.locale.register(Se,"en",Er),e.locale.register(Se,"zh",Pr);let t=e.locale.bind(Se),r=(s,d)=>t(s,d);e.effect(()=>e.sidebarRightTabs.register({id:Ye,kind:_t,priority:"extension",patterns:["dsh-resource://artifact/**"],canOpen:s=>ke(s)!==void 0,title:s=>{let d=ke(s);return d===void 0?"":gr(d.id)??d.id}}),"dsh-artifact-studio: artifact tab type");let n=()=>({t:r});e.effect(()=>()=>It(),"dsh-artifact-studio: notification cleanup"),e.slots.inject("shell.overlay",()=>e.slots.register({name:"shell.overlay",id:"dsh-artifact-studio.notice"},Nn)),e.slots.inject("sidebar.right.pane.tab",()=>e.slots.register({name:"sidebar.right.pane.tab",key:Ye,locale:Se,inject:n},Yt($t))),e.slots.inject("sidebar.right.pane.tab.title",()=>e.slots.register({name:"sidebar.right.pane.tab.title",key:Ye,locale:Se,inject:n},Cn));for(let s of na)e.slots.inject("tool.call.toolview",()=>e.slots.register({name:"tool.call.toolview",key:s,locale:Se,inject:n},Yt(Wt)));e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"dsh-artifact-studio",order:40,locale:Se,inject:n},Wr));function a({size:s}){return(0,ve.jsx)(vt,{size:s})}let i=()=>({t:r,workspaces:e.workspaces.list});e.slots.inject("main",()=>e.slots.register({name:"main",key:$e,locale:Se,inject:i},Yt(ea))),e.slots.inject("sidebar.panellist",()=>e.slots.register({name:"sidebar.panellist",id:$e,order:10,label:()=>r("panel")},a))}
561
+
562
+ return module.exports;
563
+ },
564
+ });