dsh-artifact-studio 0.3.2 → 0.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/THIRD_PARTY_NOTICES.md +297 -0
- package/assets/canvas.engine.js +6601 -0
- package/assets/canvaskit.wasm +0 -0
- package/assets/fonts/Inter-Bold.ttf +0 -0
- package/assets/fonts/Inter-ExtraBold.ttf +0 -0
- package/assets/fonts/Inter-Medium.ttf +0 -0
- package/assets/fonts/Inter-Regular.ttf +0 -0
- package/assets/fonts/Inter-SemiBold.ttf +0 -0
- package/assets/fonts/NotoNaskhArabic-Regular.ttf +0 -0
- package/assets/fonts/Roboto-Bold.woff2 +0 -0
- package/assets/fonts/Roboto-Medium.woff2 +0 -0
- package/assets/fonts/Roboto-Regular.woff2 +0 -0
- package/assets/icons.json +42204 -0
- package/client.canvas.js +11 -0
- package/client.doc.js +79 -67
- package/client.js +154 -17
- package/dist/contract.js +22 -2
- package/dist/host/index.js +2 -0
- package/dist/host/lib/assets.js +88 -0
- package/dist/host/lib/design-render.js +254 -0
- package/dist/host/lib/export.js +21 -3
- package/dist/host/lib/fsutil.js +4 -1
- package/dist/host/lib/rpc.js +3 -0
- package/dist/host/lib/service.js +272 -11
- package/dist/host/lib/skill.js +30 -3
- package/dist/host/lib/store.js +9 -0
- package/dist/host/lib/tools.js +40 -12
- package/dist/host/worker/design-worker.js +215 -0
- package/dist/host/worker/protocol.js +1 -0
- package/dist/icon-set.js +81 -0
- package/package.json +14 -3
package/client.js
CHANGED
|
@@ -4,31 +4,39 @@ window.__ModuleLoader__.load({
|
|
|
4
4
|
var module = { exports: {} };
|
|
5
5
|
var exports = module.exports;
|
|
6
6
|
globalThis.__dshArtifactsRequireAsync = require.async;
|
|
7
|
-
"use strict";var
|
|
7
|
+
"use strict";var Rn=Object.create;var wt=Object.defineProperty;var An=Object.getOwnPropertyDescriptor;var zn=Object.getOwnPropertyNames;var Dn=Object.getPrototypeOf,Pn=Object.prototype.hasOwnProperty;var Mn=(e,t)=>{for(var a in t)wt(e,a,{get:t[a],enumerable:!0})},Va=(e,t,a,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of zn(t))!Pn.call(e,n)&&n!==a&&wt(e,n,{get:()=>t[n],enumerable:!(r=An(t,n))||r.enumerable});return e};var Ln=(e,t,a)=>(a=e!=null?Rn(Dn(e)):{},Va(t||!e||!e.__esModule?wt(a,"default",{value:e,enumerable:!0}):a,e)),On=e=>Va(wt({},"__esModule",{value:!0}),e);var ei={};Mn(ei,{ARTIFACT_ID:()=>ct,ARTIFACT_KIND:()=>va,ArtifactCard:()=>ha,ArtifactTab:()=>ba,CARD_TOOLS:()=>sn,DocView:()=>Pt,PANEL_ID:()=>Xe,apply:()=>Jo,inject:()=>Yo});module.exports=On(ei);var on=require("@deepseek-ai/dsh-client-ui-primitives");var Fn=["page","doc","design"];function jn(e){return Fn.some(t=>t===e)}var _a={page:["html"],doc:["md","docx","html"],design:["png","svg","fig"]};var kt=/^art_(ws|lib)_[a-z0-9]{10,32}$/;var nt=["primary","accent","surface","text","muted"];function ra(e){if(e===null||typeof e!="object")return!1;let t={...e};return typeof t.pages=="number"&&typeof t.nodes=="number"&&t.types!==null&&typeof t.types=="object"&&Array.isArray(t.fonts)&&t.fonts.every(a=>typeof a=="string")&&Array.isArray(t.warnings)&&t.warnings.every(a=>typeof a=="string")}function na(e){if(e===null||typeof e!="object")return!1;let t="origin"in e?e.origin:void 0,a="action"in e?e.action:void 0;return(t==="agent"||t==="user")&&(a==="create"||a==="update"||a==="restore")}function Nt(e){if(e===null||typeof e!="object")return!1;let t={...e};return t.schemaVersion===1&&typeof t.id=="string"&&kt.test(t.id)&&(t.scope==="workspace"||t.scope==="library")&&typeof t.type=="string"&&jn(t.type)&&typeof t.title=="string"&&typeof t.createdAt=="string"&&typeof t.updatedAt=="string"&&typeof t.version=="number"&&Number.isInteger(t.version)&&t.version>=1&&typeof t.contentFile=="string"&&typeof t.contentBytes=="number"&&typeof t.contentHash=="string"&&na(t.source)}var Tt="dsh-resource://artifact/",St="data-artifact-theme";function q(e){return e.scope==="workspace"?`${Tt}workspace/${encodeURIComponent(e.workspaceId)}/${e.id}`:`${Tt}library/${e.id}`}function Ee(e){if(typeof e!="string"||!e.startsWith(Tt))return;let t=e.slice(Tt.length).split("/");if(t[0]==="library"&&t.length===2){let a=t[1]??"";return kt.test(a)&&a.startsWith("art_lib_")?{scope:"library",id:a}:void 0}if(t[0]==="workspace"&&t.length===3){let a=t[2]??"",r;try{r=decodeURIComponent(t[1]??"")}catch{return}return r===""||!kt.test(a)||!a.startsWith("art_ws_")?void 0:{scope:"workspace",workspaceId:r,id:a}}}function Ua(e){if(kt.test(e))return e.startsWith("art_ws_")?"workspace":"library"}function $a(e){let t=[];for(let r of nt)t.push(`--artifact-color-${r}: ${e.colors[r]};`);t.push(`--artifact-font-family: ${e.typography.fontFamily};`),t.push(`--artifact-font-display: ${e.typography.displayFamily};`),t.push(`--artifact-font-mono: ${e.typography.monoFamily};`),e.typography.scale.forEach((r,n)=>t.push(`--artifact-font-size-${n}: ${r}px;`)),t.push(`--artifact-space-unit: ${e.spacing.unit}px;`),e.spacing.scale.forEach((r,n)=>t.push(`--artifact-space-${n}: ${r}px;`));for(let[r,n]of Object.entries(e.radius))t.push(`--artifact-radius-${r}: ${n}px;`);let a=nt.map(r=>`--artifact-color-${r}: ${e.colorsDark[r]};`).join(`
|
|
8
8
|
`);return[`:root {
|
|
9
9
|
${t.join(`
|
|
10
10
|
`)}
|
|
11
|
-
}`,`:root[${
|
|
11
|
+
}`,`:root[${St}="dark"] {
|
|
12
12
|
color-scheme: dark;
|
|
13
|
-
${
|
|
13
|
+
${a}
|
|
14
14
|
}`,`@media (prefers-color-scheme: dark) {
|
|
15
|
-
:root[${
|
|
15
|
+
:root[${St}="auto"] {
|
|
16
16
|
color-scheme: dark;
|
|
17
|
-
${
|
|
17
|
+
${a.replace(/\n /g,`
|
|
18
18
|
`)}
|
|
19
19
|
}
|
|
20
20
|
}`].join(`
|
|
21
|
-
`)}function pr(e,t){let r=t?e.colorsDark:e.colors,a={"--artifact-font-family":e.typography.fontFamily,"--artifact-font-display":e.typography.displayFamily,"--artifact-font-mono":e.typography.monoFamily};for(let n of $e)a[`--artifact-color-${n}`]=r[n];e.typography.scale.forEach((n,o)=>{a[`--artifact-font-size-${o}`]=`${n}px`}),e.spacing.scale.forEach((n,o)=>{a[`--artifact-space-${o}`]=`${n}px`});for(let[n,o]of Object.entries(e.radius))a[`--artifact-radius-${n}`]=`${o}px`;return a}var Da="/artifacts-rpc",Ie=class extends Error{code;details;constructor(t,r,a){super(r),this.name="ArtifactCallError",this.code=t,this.details=a}},Mt=null;function ur(e){Mt=e}async function Q(e,t,r,a){if(Mt===null)throw new Ie("artifact/not-ready","The artifact channel is not ready.",{});let n=await Mt.rpc.call(Da,e,t,a);if(!n.ok)throw new Ie(n.error.code,n.error.message,n.error.details);if(!r(n.value))throw new Ie("artifact/bad-response",`The ${e} response has an unexpected shape.`,{});return n.value}function K(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Ma(e){return K(e)&&Array.isArray(e.items)&&e.items.every(it)&&typeof e.total=="number"&&typeof e.hasMore=="boolean"}function za(e){return K(e)&&it(e.manifest)&&typeof e.content=="string"&&typeof e.version=="number"&&typeof e.designCss=="string"&&fr(e.design)}function st(e){return K(e)&&it(e.manifest)}function Oa(e){return K(e)&&typeof e.version=="number"&&typeof e.createdAt=="string"&&typeof e.contentHash=="string"&&typeof e.contentBytes=="number"&&Lt(e.source)}function ja(e){return K(e)&&Array.isArray(e.versions)&&e.versions.every(Oa)}function Ba(e){return K(e)&&e.trashed===!0&&typeof e.trashPath=="string"}function Fa(e){return K(e)&&typeof e.path=="string"&&typeof e.bytes=="number"&&typeof e.fileName=="string"&&typeof e.mediaType=="string"&&typeof e.data=="string"}function Ha(e){return K(e)&&typeof e.html=="string"}function fr(e){return K(e)&&e.schemaVersion===1&&typeof e.name=="string"&&K(e.colors)&&K(e.colorsDark)&&K(e.typography)&&K(e.spacing)&&K(e.radius)}function Dt(e){return K(e)&&fr(e.tokens)&&(e.source==="workspace"||e.source==="library"||e.source==="default")&&typeof e.css=="string"}function te(e){return{scope:e.scope,...e.workspaceId===null?{}:{workspaceId:e.workspaceId}}}var z={list:(e,t,r)=>Q("list",{...te(e),...t},Ma,r),get:(e,t,r,a)=>Q("get",{...te(e),id:t,...r===void 0?{}:{version:r}},za,a),create:(e,t,r,a)=>Q("create",{...te(e),type:t,title:r,content:a},st),update:(e,t,r,a,n)=>Q("update",{...te(e),id:t,baseVersion:r,content:a,...n===void 0?{}:{title:n}},st),rename:(e,t,r,a)=>Q("update",{...te(e),id:t,baseVersion:r,title:a},st),remove:(e,t)=>Q("delete",{...te(e),id:t},Ba),history:(e,t,r)=>Q("history",{...te(e),id:t},ja,r),restore:(e,t,r,a)=>Q("restore",{...te(e),id:t,version:r,baseVersion:a},st),exportFile:(e,t,r,a)=>Q("export",{...te(e),id:t,format:r,version:a},Fa),printable:(e,t,r)=>Q("printable",{...te(e),id:t,version:r},Ha),designSystem:(e,t)=>Q("designSystem",e===null?{}:{workspaceId:e},Dt,t),saveDesignSystem:(e,t)=>Q("saveDesignSystem",{...te(e),tokens:t},Dt),clearDesignSystem:e=>Q("clearDesignSystem",{workspaceId:e,scope:"workspace"},Dt)};function Y(e){return e instanceof Ie?e.code:void 0}function X(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 o=0;o<t.length;o+=1)r[o]=t.charCodeAt(o);let a=URL.createObjectURL(new Blob([r],{type:e.mediaType})),n=document.createElement("a");n.href=a,n.download=e.fileName,n.rel="noopener",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(a),3e4)}var Me=require("react");var We=require("react");function ct(e){let t=e,r=new Set;return{get:()=>t,set(a){t=a;for(let n of r)n()},subscribe(a){return r.add(a),()=>r.delete(a)}}}var Le=ct(new Map);function de(e,t){if(Le.get().get(e)===t)return;let r=new Map(Le.get());r.set(e,t),Le.set(r)}function gr(e){return Le.get().get(e)}function br(e){return(0,We.useSyncExternalStore)(Le.subscribe,()=>e===void 0?void 0:Le.get().get(e))}var _e=ct(new Map);function Se(e,t){if((_e.get().get(e)??0)>=t)return;let r=new Map(_e.get());r.set(e,t),_e.set(r)}function yr(e){return(0,We.useSyncExternalStore)(_e.subscribe,()=>e===void 0?0:_e.get().get(e)??0)}var lt=ct(0);function pe(){lt.set(lt.get()+1)}function dt(){return(0,We.useSyncExternalStore)(lt.subscribe,lt.get)}var De=ct(null);function W(e){De.set({seq:(De.get()?.seq??0)+1,message:e})}function hr(){return(0,We.useSyncExternalStore)(De.subscribe,De.get)}function zt(e){let t=De.get();t===null||e!==void 0&&t.seq!==e||De.set(null)}var ue=new Map,Ot;function vr(){Ot?.();let e=t=>{[...ue.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 jt=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=H(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?ue.set(this.key,this):this.mounts===0&&ue.get(this.key)===this&&ue.delete(this.key);for(let r of this.listeners)r()}attach(){return this.mounts+=1,ue.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&&ue.get(this.key)===this&&ue.delete(this.key)}}async load(){let t=++this.readSequence;this.publish({loading:!0,failure:void 0});try{let r=await z.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}),de(this.address.id,r.manifest.title),Se(this.address.id,r.version)}catch(r){t===this.readSequence&&this.publish({loading:!1,failure:Y(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,a=r??t.content,n=this.renameTo,{manifest:o}=await z.update(this.where,this.address.id,t.version,a,n);this.renameTo===n&&(this.renameTo=void 0),this.accept(o,a,this.state.draft===r?null:this.state.draft)}return!0}catch(t){let r=Y(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,a){let n=this.state.payload;n!==null&&(++this.readSequence,this.publish({payload:{...n,manifest:t,content:r,version:t.version},draft:a,conflict:!1,loading:!1}),de(t.id,t.title),Se(t.id,t.version),pe())}};function xr(e){let t=H(e),r=(0,Me.useMemo)(()=>{let n=ue.get(t);if(n!==void 0)return n;let o=new jt(e);return ue.set(t,o),o},[t]),a=(0,Me.useSyncExternalStore)(r.subscribe,r.getSnapshot,r.getSnapshot);return(0,Me.useEffect)(()=>r.attach(),[r]),{model:r,state:a}}var v=require("react"),b=require("@deepseek-ai/dsh-client-ui-primitives");var D=require("react"),wr=require("@deepseek-ai/dsh-client-ui-primitives");var oe=require("react/jsx-runtime"),Ue=null;function Va(){if(Ue===null){let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")return Promise.reject(new Error("The document editor loader is unavailable."));Ue=e("./client.doc.js"),Ue.catch(()=>{Ue=null})}return Ue}var $a=["heading","bold","italic","bulletList","orderedList","codeBlock"];function _a(e){let t=window.getSelection(),r=e.getBoundingClientRect(),n=(t!==null&&t.rangeCount>0?t.getRangeAt(0):null)?.getBoundingClientRect();if(n===void 0||n.width===0&&n.height===0)return{top:e.scrollTop+8,left:16};let o=Math.min(Math.max(n.left-r.left+n.width/2,120),Math.max(r.width-120,120));return{top:Math.max(n.top-r.top+e.scrollTop-46,e.scrollTop+4),left:o}}function pt({markdown:e,revision:t,editable:r,label:a,loadingLabel:n,failedLabel:o,onChange:s,onSave:l,onSelectionText:f,t:u,design:h,dark:w=!1,selectionAction:k}){let S=(0,D.useRef)(null),m=(0,D.useRef)(null),d=(0,D.useRef)(null),y=(0,D.useRef)(s);y.current=s;let E=(0,D.useRef)(f);E.current=f;let I=(0,D.useRef)({markdown:e,editable:r,label:a});I.current={markdown:e,editable:r,label:a};let[O,Z]=(0,D.useState)([]),[M,J]=(0,D.useState)("loading"),[$,_]=(0,D.useState)(null),A=(0,D.useRef)(null);(0,D.useLayoutEffect)(()=>{let x=A.current,g=S.current;if(x===null||g===null||$===null)return;let L=x.offsetWidth/2,j=g.clientWidth,F=L*2+16>=j?j/2:Math.min(Math.max($.left,L+8),j-L-8);x.style.left=F+"px"});let q=(0,D.useMemo)(()=>h===void 0?{}:{...pr(h,w),colorScheme:w?"dark":"light"},[h,w]),V=x=>{E.current?.(x);let g=S.current;_(x===""||g===null?null:_a(g))},ae=(0,D.useRef)(V);ae.current=V,(0,D.useEffect)(()=>{let x=!1;return Va().then(g=>{x||m.current===null||(d.current=g.mountDocEditor({element:m.current,...I.current,onChange:L=>y.current(L),onSelectionChange:Z,onSelectionText:L=>ae.current(L)}),J("ready"))}).catch(()=>{x||J("failed")}),()=>{x=!0,d.current?.destroy(),d.current=null}},[]),(0,D.useEffect)(()=>{let x=d.current;x!==null&&x.getMarkdown()!==e&&x.setMarkdown(e)},[t,e]),(0,D.useEffect)(()=>{d.current?.setEditable(r)},[r]),(0,D.useEffect)(()=>{let x=()=>{let g=d.current,L=S.current,j=window.getSelection();g===null||L===null||j!==null&&j.anchorNode!==null&&!L.contains(j.anchorNode)||ae.current(g.getSelectionText())};return document.addEventListener("selectionchange",x),()=>document.removeEventListener("selectionchange",x)},[]);let ee=$!==null&&u!==void 0&&(r||k!=null);return(0,oe.jsxs)("div",{className:"art-doc",ref:S,"data-doc-revision":t,onKeyDown:x=>{(x.ctrlKey||x.metaKey)&&x.key.toLowerCase()==="s"&&(x.preventDefault(),l()),x.key==="Escape"&&$!==null&&_(null)},children:[ee?(0,oe.jsxs)("div",{ref:A,className:"art-doc-toolbar",role:"toolbar","aria-label":u("format.toolbar"),style:{top:$.top,left:$.left},children:[r?$a.map(x=>(0,oe.jsx)(wr.Button,{size:"sm",variant:"ghost","aria-pressed":O.includes(x),disabled:M!=="ready",onMouseDown:g=>g.preventDefault(),onClick:()=>d.current?.format(x),children:u(`format.${x}`)},x)):null,r&&k!=null?(0,oe.jsx)("span",{className:"art-doc-toolbar-gap","aria-hidden":"true"}):null,k]}):null,M==="loading"?(0,oe.jsx)("p",{className:"art-note",children:n}):null,M==="failed"?(0,oe.jsx)("p",{className:"art-note",children:o}):null,(0,oe.jsx)("div",{className:"art-docpage",style:q,children:(0,oe.jsx)("div",{className:"art-doc-mount",ref:m})})]})}function Wa(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 Bt="<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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Ua(e){return e.replace(/<meta\b[^>]*http-equiv\s*=\s*["']?refresh["']?[^>]*>/gi,"").replace(/<meta\b[^>]*content\s*=\s*["'][^"']*url\s*=[^>]*>/gi,"")}function Cr(e,t,r,a,n="",o="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(a)}</title><style data-artifact-tokens>${t}</style>`+n;return`<!doctype html><html${Wa(e)?` ${ot}="${o}"`:""}><head>${s}</head><body>${Ua(e)}</body></html>`}var Nr="allow-scripts",qa="allow-scripts allow-modals",Ga=3e4,Ka="<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>",Ya=4e3;function ut(e,t,r,a="auto",n=!1){return Cr(e,t,Tr,r,n?Ka:"",a)}function Ar(e){if(e===null||typeof e!="object")return;let t={...e};return typeof t.dshArtifactSelection=="string"?t.dshArtifactSelection.slice(0,Ya):void 0}function Rr(e){let t=/<\/head>/i.test(e)?e.replace(/<\/head>/i,`${Bt}</head>`):`${Bt}${e}`,r=URL.createObjectURL(new Blob([t],{type:"text/html"})),a=document.createElement("iframe");a.setAttribute("sandbox",qa),a.setAttribute("aria-hidden","true"),a.tabIndex=-1,a.style.cssText="position:fixed;left:-10000px;top:0;width:800px;height:1000px;border:0;";let n=!1,o=()=>{n||(n=!0,clearTimeout(l),window.removeEventListener("message",s),a.remove(),URL.revokeObjectURL(r))},s=f=>{f.source===a.contentWindow&&f.data==="dsh-artifact-printed"&&o()};window.addEventListener("message",s);let l=setTimeout(o,Ga);a.addEventListener("load",()=>{a.contentWindow?.postMessage("dsh-artifact-print","*")},{once:!0}),a.src=r,document.body.appendChild(a)}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":"Create an artifact page: a dashboard that shows ","prompt.explainer":"Explainer","prompt.explainerText":"Create an artifact page: a one-page visual explainer of ","prompt.report":"Report","prompt.reportText":"Create an artifact doc: a report about ","prompt.brief":"Project brief","prompt.briefText":"Create an artifact doc: a project brief with context, goal, scope, and open questions for ","filter.type":"Filter by type","tab.mode":"Page view","tab.manualSave":"Page source saves with Save or Ctrl/Cmd+S.","tab.versionPicker":"Choose version","tab.currentVersion":"current","tab.allVersions":"All versions","tab.agentUpdate":"Updated to v{version}","tab.viewHistory":"View history","tab.dismiss":"Dismiss","tab.leaveTitle":"Keep your changes?","tab.leaveHint":"Save your changes before continuing, or discard them. Cancel keeps you here.","tab.discardContinue":"Discard and continue","tab.saveContinue":"Save and continue","tab.copyDraft":"Copy my draft","tab.discardReload":"Discard mine and reload","history.close":"Close history","action.copied":"Copied","action.copyFailed":"Copy was blocked. Select the text and copy it manually.","format.toolbar":"Document formatting","format.heading":"Heading","format.bold":"Bold","format.italic":"Italic","format.bulletList":"Bullet list","format.orderedList":"Numbered list","format.codeBlock":"Code block",panel:"Artifacts","action.back":"Back","scope.label":"Scope","scope.all":"All projects","scope.workspace":"This project","scope.library":"Library","type.page":"Page","type.doc":"Document","type.all":"All types","gallery.search":"Search artifacts","gallery.searchLabel":"Search by title","gallery.create":"New artifact","gallery.newPage":"New page","gallery.newDoc":"New document","gallery.design":"Design system","gallery.refresh":"Refresh","gallery.more":"Show more","gallery.truncated":"Only the first 500 artifacts are scanned.","gallery.failedProjects":"Some sources could not be loaded.","gallery.version":"v{version}","gallery.updated":"Updated {time}","gallery.count":"{count} artifacts","gallery.pinned":"Pinned","gallery.recent":"Recently updated","gallery.coverTitle":"Preview of {title}","gallery.coverFailed":"Preview unavailable","gallery.pin":"Pin {title}","gallery.unpin":"Unpin {title}","gallery.allPinned":"Everything here is pinned.","empty.workspaceTitle":"No artifacts in this project yet","empty.workspaceHint":"Ask the agent for a dashboard, report, or one-pager, or start one here.","empty.allTitle":"No artifacts yet","empty.allHint":"Artifacts from every project and your library appear here.","empty.libraryTitle":"Your library is empty","empty.libraryHint":"Library artifacts follow you to every project. Ask the agent to save one to the library.","empty.noMatch":"Nothing matches that search.","empty.typeMatch":"No {type} artifacts match the filter.","empty.noWorkspace":"Open a session in a workspace to see its artifacts.","empty.loading":"Loading...","create.title":"New {type}","create.name":"Title","create.scope":"Save to","create.submit":"Create","create.cancel":"Cancel","create.untitledPage":"Untitled page","create.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.saveWorkspaceNamed":"Save for {name}","design.saveLibrary":"Save to library","design.clear":"Remove project override","design.saved":"Design system saved","design.preview":"Preview","design.previewHeading":"Quarterly review","design.previewBody":"Revenue grew in every region this quarter.","design.previewButton":"Primary action","card.created":"Created","card.updated":"Updated","card.working":"Writing the artifact...","card.failed":"The artifact was not saved","card.missing":"This result has no artifact details.","composer.label":"Artifacts","error.generic":"Something went wrong. Try again.","error.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":"\u521B\u5EFA\u4E00\u4E2A artifact \u9875\u9762\uFF1A\u4E00\u4E2A\u4EEA\u8868\u76D8\uFF0C\u5C55\u793A","prompt.explainer":"\u56FE\u89E3\u8BF4\u660E","prompt.explainerText":"\u521B\u5EFA\u4E00\u4E2A artifact \u9875\u9762\uFF1A\u4E00\u9875\u53EF\u89C6\u5316\u8BF4\u660E\uFF0C\u4E3B\u9898\u662F","prompt.report":"\u62A5\u544A","prompt.reportText":"\u521B\u5EFA\u4E00\u4E2A artifact \u6587\u6863\uFF1A\u4E00\u4EFD\u62A5\u544A\uFF0C\u4E3B\u9898\u662F","prompt.brief":"\u9879\u76EE\u7B80\u4ECB","prompt.briefText":"\u521B\u5EFA\u4E00\u4E2A artifact \u6587\u6863\uFF1A\u4E00\u4EFD\u9879\u76EE\u7B80\u4ECB\uFF0C\u5305\u542B\u80CC\u666F\u3001\u76EE\u6807\u3001\u8303\u56F4\u548C\u5F85\u5B9A\u95EE\u9898\uFF0C\u9879\u76EE\u662F","filter.type":"\u6309\u7C7B\u578B\u7B5B\u9009","tab.mode":"\u9875\u9762\u89C6\u56FE","tab.manualSave":"\u9875\u9762\u6E90\u7801\u9700\u70B9\u51FB\u4FDD\u5B58\u6216\u6309 Ctrl/Cmd+S\u3002","tab.versionPicker":"\u9009\u62E9\u7248\u672C","tab.currentVersion":"\u5F53\u524D","tab.allVersions":"\u5168\u90E8\u7248\u672C","tab.agentUpdate":"\u5DF2\u66F4\u65B0\u5230 v{version}","tab.viewHistory":"\u67E5\u770B\u5386\u53F2","tab.dismiss":"\u5173\u95ED","tab.leaveTitle":"\u4FDD\u7559\u66F4\u6539\uFF1F","tab.leaveHint":"\u7EE7\u7EED\u524D\u4FDD\u5B58\u66F4\u6539\uFF0C\u6216\u653E\u5F03\u66F4\u6539\u3002\u53D6\u6D88\u5C06\u4FDD\u7559\u5F53\u524D\u7F16\u8F91\u3002","tab.discardContinue":"\u653E\u5F03\u5E76\u7EE7\u7EED","tab.saveContinue":"\u4FDD\u5B58\u5E76\u7EE7\u7EED","tab.copyDraft":"\u590D\u5236\u6211\u7684\u8349\u7A3F","tab.discardReload":"\u653E\u5F03\u6211\u7684\u66F4\u6539\u5E76\u91CD\u65B0\u52A0\u8F7D","history.close":"\u5173\u95ED\u5386\u53F2","action.copied":"\u5DF2\u590D\u5236","action.copyFailed":"\u590D\u5236\u88AB\u963B\u6B62\u3002\u8BF7\u9009\u4E2D\u6587\u672C\u540E\u624B\u52A8\u590D\u5236\u3002","format.toolbar":"\u6587\u6863\u683C\u5F0F","format.heading":"\u6807\u9898","format.bold":"\u7C97\u4F53","format.italic":"\u659C\u4F53","format.bulletList":"\u9879\u76EE\u7B26\u53F7\u5217\u8868","format.orderedList":"\u7F16\u53F7\u5217\u8868","format.codeBlock":"\u4EE3\u7801\u5757",panel:"\u4EA7\u7269","action.back":"\u8FD4\u56DE","scope.label":"\u8303\u56F4","scope.all":"\u5168\u90E8\u9879\u76EE","scope.workspace":"\u5F53\u524D\u9879\u76EE","scope.library":"\u8D44\u6599\u5E93","type.page":"\u9875\u9762","type.doc":"\u6587\u6863","type.all":"\u5168\u90E8\u7C7B\u578B","gallery.search":"\u641C\u7D22\u4EA7\u7269","gallery.searchLabel":"\u6309\u6807\u9898\u641C\u7D22","gallery.create":"\u65B0\u5EFA\u4EA7\u7269","gallery.newPage":"\u65B0\u5EFA\u9875\u9762","gallery.newDoc":"\u65B0\u5EFA\u6587\u6863","gallery.design":"\u8BBE\u8BA1\u7CFB\u7EDF","gallery.refresh":"\u5237\u65B0","gallery.more":"\u663E\u793A\u66F4\u591A","gallery.truncated":"\u4EC5\u626B\u63CF\u524D 500 \u4E2A\u4EA7\u7269\u3002","gallery.failedProjects":"\u90E8\u5206\u6765\u6E90\u52A0\u8F7D\u5931\u8D25\u3002","gallery.version":"v{version}","gallery.updated":"\u66F4\u65B0\u4E8E {time}","gallery.count":"{count} \u4E2A\u4EA7\u7269","gallery.pinned":"\u5DF2\u7F6E\u9876","gallery.recent":"\u6700\u8FD1\u66F4\u65B0","gallery.coverTitle":"{title} \u7684\u9884\u89C8","gallery.coverFailed":"\u9884\u89C8\u4E0D\u53EF\u7528","gallery.pin":"\u7F6E\u9876 {title}","gallery.unpin":"\u53D6\u6D88\u7F6E\u9876 {title}","gallery.allPinned":"\u8FD9\u91CC\u7684\u4EA7\u7269\u90FD\u5DF2\u7F6E\u9876\u3002","empty.workspaceTitle":"\u672C\u9879\u76EE\u8FD8\u6CA1\u6709\u4EA7\u7269","empty.workspaceHint":"\u8BA9\u667A\u80FD\u4F53\u751F\u6210\u4EEA\u8868\u76D8\u3001\u62A5\u544A\u6216\u5355\u9875\uFF0C\u6216\u5728\u8FD9\u91CC\u65B0\u5EFA\u3002","empty.allTitle":"\u8FD8\u6CA1\u6709\u4EA7\u7269","empty.allHint":"\u8FD9\u91CC\u663E\u793A\u6240\u6709\u9879\u76EE\u548C\u8D44\u6599\u5E93\u4E2D\u7684\u4EA7\u7269\u3002","empty.libraryTitle":"\u8D44\u6599\u5E93\u4E3A\u7A7A","empty.libraryHint":"\u8D44\u6599\u5E93\u4E2D\u7684\u4EA7\u7269\u5728\u6240\u6709\u9879\u76EE\u53EF\u7528\u3002\u8BA9\u667A\u80FD\u4F53\u628A\u4EA7\u7269\u4FDD\u5B58\u5230\u8D44\u6599\u5E93\u3002","empty.noMatch":"\u6CA1\u6709\u5339\u914D\u7684\u4EA7\u7269\u3002","empty.typeMatch":"\u6CA1\u6709\u7B26\u5408\u7C7B\u578B\u7B5B\u9009\u7684{type}\u4EA7\u7269\u3002","empty.noWorkspace":"\u5728\u5DE5\u4F5C\u533A\u4E2D\u6253\u5F00\u4F1A\u8BDD\u4EE5\u67E5\u770B\u5176\u4EA7\u7269\u3002","empty.loading":"\u52A0\u8F7D\u4E2D...","create.title":"\u65B0\u5EFA{type}","create.name":"\u6807\u9898","create.scope":"\u4FDD\u5B58\u5230","create.submit":"\u521B\u5EFA","create.cancel":"\u53D6\u6D88","create.untitledPage":"\u672A\u547D\u540D\u9875\u9762","create.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.saveWorkspaceNamed":"\u4FDD\u5B58\u5230 {name}","design.saveLibrary":"\u4FDD\u5B58\u5230\u8D44\u6599\u5E93","design.clear":"\u79FB\u9664\u9879\u76EE\u8986\u76D6","design.saved":"\u8BBE\u8BA1\u7CFB\u7EDF\u5DF2\u4FDD\u5B58","design.preview":"\u9884\u89C8","design.previewHeading":"\u5B63\u5EA6\u56DE\u987E","design.previewBody":"\u672C\u5B63\u5EA6\u5404\u533A\u57DF\u6536\u5165\u5747\u6709\u589E\u957F\u3002","design.previewButton":"\u4E3B\u8981\u64CD\u4F5C","card.created":"\u5DF2\u521B\u5EFA","card.updated":"\u5DF2\u66F4\u65B0","card.working":"\u6B63\u5728\u5199\u5165\u4EA7\u7269...","card.failed":"\u4EA7\u7269\u672A\u4FDD\u5B58","card.missing":"\u6B64\u7ED3\u679C\u6CA1\u6709\u4EA7\u7269\u4FE1\u606F\u3002","composer.label":"\u4EA7\u7269","error.generic":"\u51FA\u9519\u4E86\uFF0C\u8BF7\u91CD\u8BD5\u3002","error.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 ft(e,t,r=Date.now()){let a=Math.max(0,r-Date.parse(t)),n=Math.floor(a/6e4);if(n<1)return e("time.justNow");if(n<60)return e("time.minutes",{count:n});let o=Math.floor(n/60);if(o<24)return e("time.hours",{count:o});let s=Math.floor(o/24);return s<7?e("time.days",{count:s}):new Date(t).toLocaleDateString()}var re=require("react/jsx-runtime");function Xa(e,t){let r=t.source.origin==="agent"?e("history.byAgent"):e("history.byUser"),a=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 ${a} \xB7 ${ft(e,t.createdAt)}`}function Ir({t:e,versions:t,failed:r,current:a,selected:n,onSelect:o}){return(0,re.jsxs)("div",{className:"art-history-body",children:[t===null?(0,re.jsx)("p",{className:"art-note",children:e("empty.loading")}):null,r?(0,re.jsx)("p",{className:"art-note",children:e("error.generic")}):null,!r&&t!==null&&t.length<=1?(0,re.jsx)("p",{className:"art-note",children:e("history.empty")}):null,t?.map(s=>(0,re.jsxs)("button",{type:"button",className:"art-version","aria-current":s.version===n?"true":void 0,onClick:()=>o(s.version),children:[(0,re.jsxs)("span",{className:"art-version-top",children:[(0,re.jsx)("span",{children:e("tab.versionOf",{version:s.version})}),s.version===a?(0,re.jsx)("span",{className:"art-badge",children:e("history.current")}):null]}),(0,re.jsx)("span",{className:"art-version-sub",children:Xa(e,s)})]},s.version))]})}var ie=require("react");var ve=require("react/jsx-runtime");function mt({content:e,designCss:t,title:r,frameTitle:a,dark:n=!1,onSelectionText:o}){let[s,l]=(0,ie.useState)(null),[f,u]=(0,ie.useState)(!1),h=(0,ie.useRef)(0),w=(0,ie.useRef)(null),k=(0,ie.useRef)(o);k.current=o;let S=o!==void 0;return(0,ie.useEffect)(()=>{h.current=0,u(!1);let m=URL.createObjectURL(new Blob([ut(e,t,r,n?"dark":"light",S)],{type:"text/html"}));return l(m),()=>URL.revokeObjectURL(m)},[e,t,r,n,S]),(0,ie.useEffect)(()=>{if(!S)return;let m=d=>{if(w.current===null||h.current>1||d.source!==w.current.contentWindow)return;let y=Ar(d.data);y!==void 0&&k.current?.(y)};return window.addEventListener("message",m),()=>window.removeEventListener("message",m)},[S]),f?(0,ve.jsx)("div",{className:"art-center",role:"alert",children:r}):s===null?null:(0,ve.jsx)("iframe",{ref:w,className:"art-frame",title:a,sandbox:Nr,referrerPolicy:"no-referrer",src:s,onLoad:()=>{h.current+=1,h.current>1&&u(!0)}},s)}function Lr({value:e,readOnly:t,label:r,hint:a,onChange:n,onSave:o,onSelectionText:s}){let l=f=>{t||s?.(f.value.slice(f.selectionStart,f.selectionEnd))};return(0,ve.jsxs)("div",{className:"art-source-wrap",children:[a===void 0?null:(0,ve.jsx)("div",{className:"art-code-bar",children:(0,ve.jsx)("span",{children:a})}),(0,ve.jsx)("textarea",{className:"art-source","aria-label":r,spellCheck:!1,readOnly:t,value:e,autoFocus:!t,onChange:f=>{n(f.target.value),s?.("")},onSelect:f=>l(f.currentTarget),onMouseUp:f=>l(f.currentTarget),onKeyUp:f=>l(f.currentTarget),onKeyDown:f=>{if((f.ctrlKey||f.metaKey)&&f.key.toLowerCase()==="s"){f.preventDefault(),o();return}if(f.key==="Tab"&&!f.shiftKey&&!t){f.preventDefault();let u=f.currentTarget,h=u.selectionStart,w=u.selectionEnd,k=e.slice(0,h)+" "+e.slice(w);n(k),requestAnimationFrame(()=>u.setSelectionRange(h+2,h+2))}}})]})}function Ft(e,t=2e3){let r=e.replace(/\r\n/g,`
|
|
21
|
+
`)}function Wa(e,t){let a=t?e.colorsDark:e.colors,r={"--artifact-font-family":e.typography.fontFamily,"--artifact-font-display":e.typography.displayFamily,"--artifact-font-mono":e.typography.monoFamily};for(let n of nt)r[`--artifact-color-${n}`]=a[n];e.typography.scale.forEach((n,o)=>{r[`--artifact-font-size-${o}`]=`${n}px`}),e.spacing.scale.forEach((n,o)=>{r[`--artifact-space-${o}`]=`${n}px`});for(let[n,o]of Object.entries(e.radius))r[`--artifact-radius-${n}`]=`${o}px`;return r}var Bn="/artifacts-rpc",Fe=class extends Error{code;details;constructor(t,a,r){super(a),this.name="ArtifactCallError",this.code=t,this.details=r}},ia=null;function Ga(e){ia=e}async function ne(e,t,a,r){if(ia===null)throw new Fe("artifact/not-ready","The artifact channel is not ready.",{});let n=await ia.rpc.call(Bn,e,t,r);if(!n.ok)throw new Fe(n.error.code,n.error.message,n.error.details);if(!a(n.value))throw new Fe("artifact/bad-response",`The ${e} response has an unexpected shape.`,{});return n.value}function X(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Hn(e){return X(e)&&Array.isArray(e.items)&&e.items.every(Nt)&&typeof e.total=="number"&&typeof e.hasMore=="boolean"}function Vn(e){return X(e)&&Nt(e.manifest)&&typeof e.content=="string"&&typeof e.version=="number"&&typeof e.designCss=="string"&&qa(e.design)&&(e.designInfo===void 0||ra(e.designInfo))}function Ct(e){return X(e)&&Nt(e.manifest)}function _n(e){return X(e)&&typeof e.version=="number"&&typeof e.createdAt=="string"&&typeof e.contentHash=="string"&&typeof e.contentBytes=="number"&&na(e.source)}function Un(e){return X(e)&&Array.isArray(e.versions)&&e.versions.every(_n)}function $n(e){return X(e)&&e.trashed===!0&&typeof e.trashPath=="string"}function Wn(e){return X(e)&&typeof e.path=="string"&&typeof e.bytes=="number"&&typeof e.fileName=="string"&&typeof e.mediaType=="string"&&typeof e.data=="string"}function Gn(e){return X(e)&&typeof e.html=="string"}function qn(e){return X(e)&&typeof e.mediaType=="string"&&typeof e.data=="string"&&typeof e.width=="number"&&typeof e.height=="number"&&ra(e.info)}function qa(e){return X(e)&&e.schemaVersion===1&&typeof e.name=="string"&&X(e.colors)&&X(e.colorsDark)&&X(e.typography)&&X(e.spacing)&&X(e.radius)}function oa(e){return X(e)&&qa(e.tokens)&&(e.source==="workspace"||e.source==="library"||e.source==="default")&&typeof e.css=="string"}function se(e){return{scope:e.scope,...e.workspaceId===null?{}:{workspaceId:e.workspaceId}}}var U={list:(e,t,a)=>ne("list",{...se(e),...t},Hn,a),get:(e,t,a,r)=>ne("get",{...se(e),id:t,...a===void 0?{}:{version:a}},Vn,r),create:(e,t,a,r)=>ne("create",{...se(e),type:t,title:a,content:r},Ct),update:(e,t,a,r,n)=>ne("update",{...se(e),id:t,baseVersion:a,content:r,...n===void 0?{}:{title:n}},Ct),rename:(e,t,a,r)=>ne("update",{...se(e),id:t,baseVersion:a,title:r},Ct),remove:(e,t)=>ne("delete",{...se(e),id:t},$n),history:(e,t,a)=>ne("history",{...se(e),id:t},Un,a),restore:(e,t,a,r)=>ne("restore",{...se(e),id:t,version:a,baseVersion:r},Ct),exportFile:(e,t,a,r)=>ne("export",{...se(e),id:t,format:a,version:r},Wn),printable:(e,t,a)=>ne("printable",{...se(e),id:t,version:a},Gn),preview:(e,t,a,r)=>ne("preview",{...se(e),id:t,...a===void 0?{}:{version:a}},qn,r),designSystem:(e,t)=>ne("designSystem",e===null?{}:{workspaceId:e},oa,t),saveDesignSystem:(e,t)=>ne("saveDesignSystem",{...se(e),tokens:t},oa),clearDesignSystem:e=>ne("clearDesignSystem",{workspaceId:e,scope:"workspace"},oa)};function Z(e){return e instanceof Fe?e.code:void 0}function J(e){switch(e){case"artifact/not-found":return"error.notFound";case"artifact/stale-version":return"error.stale";case"artifact/too-large":return"error.tooLarge";case"artifact/no-workspace":return"error.noWorkspace";case"artifact/forbidden-path":return"error.forbidden";case"artifact/corrupt":return"error.corrupt";case"artifact/invalid-tokens":return"error.tokens";case"artifact/library-unavailable":return"error.library";case"artifact/design-invalid":return"error.designInvalid";case"artifact/design-icon-unsupported":return"error.designIcon";case"artifact/design-icon-not-found":return"error.designIconNotFound";case"artifact/design-render-failed":return"error.designRender";case"artifact/design-timeout":return"error.designTimeout";case"artifact/design-unavailable":return"error.designUnavailable";case"artifact/unsupported-type":return"error.unsupportedType";default:return"error.generic"}}function sa(e){if(!(!(e instanceof Fe)||!e.code.startsWith("artifact/design-")))return e.message===""?void 0:e.message}function Ka(e,t){return sa(t)??e(J(Z(t)))}function Ya(e){let t=atob(e.data),a=new Uint8Array(t.length);for(let o=0;o<t.length;o+=1)a[o]=t.charCodeAt(o);let r=URL.createObjectURL(new Blob([a],{type:e.mediaType})),n=document.createElement("a");n.href=r,n.download=e.fileName,n.rel="noopener",document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(r),3e4)}var Ke=require("react");var it=require("react");function Et(e){let t=e,a=new Set;return{get:()=>t,set(r){t=r;for(let n of a)n()},subscribe(r){return a.add(r),()=>a.delete(r)}}}var Ge=Et(new Map);function xe(e,t){if(Ge.get().get(e)===t)return;let a=new Map(Ge.get());a.set(e,t),Ge.set(a)}function Qa(e){return Ge.get().get(e)}function Xa(e){return(0,it.useSyncExternalStore)(Ge.subscribe,()=>e===void 0?void 0:Ge.get().get(e))}var ot=Et(new Map);function je(e,t){if((ot.get().get(e)??0)>=t)return;let a=new Map(ot.get());a.set(e,t),ot.set(a)}function Za(e){return(0,it.useSyncExternalStore)(ot.subscribe,()=>e===void 0?0:ot.get().get(e)??0)}var It=Et(0);function we(){It.set(It.get()+1)}function Rt(){return(0,it.useSyncExternalStore)(It.subscribe,It.get)}var qe=Et(null);function Q(e){qe.set({seq:(qe.get()?.seq??0)+1,message:e})}function Ja(){return(0,it.useSyncExternalStore)(qe.subscribe,qe.get)}function la(e){let t=qe.get();t===null||e!==void 0&&t.seq!==e||qe.set(null)}var ke=new Map,ca;function er(){ca?.();let e=t=>{[...ke.values()].some(a=>a.getSnapshot().draft!==null||a.getSnapshot().saving)&&(t.preventDefault(),t.returnValue="")};return window.addEventListener("beforeunload",e),ca=()=>window.removeEventListener("beforeunload",e),ca}var da=class{state={payload:null,draft:null,loading:!0,saving:!1,conflict:!1,revision:0};listeners=new Set;pending=null;readSequence=0;mounts=0;renameTo;where;key;address;constructor(t){this.address=t,this.key=q(t),this.where={scope:t.scope,workspaceId:t.scope==="workspace"?t.workspaceId:null}}getSnapshot=()=>this.state;subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));publish(t){this.state={...this.state,...t},this.state.draft!==null||this.state.saving?ke.set(this.key,this):this.mounts===0&&ke.get(this.key)===this&&ke.delete(this.key);for(let a of this.listeners)a()}attach(){return this.mounts+=1,ke.set(this.key,this),this.mounts===1&&(this.state.payload===null||this.state.draft===null)&&this.load(),()=>{this.mounts-=1,this.mounts===0&&this.state.draft===null&&!this.state.saving&&ke.get(this.key)===this&&ke.delete(this.key)}}async load(){let t=++this.readSequence;this.publish({loading:!0,failure:void 0,failureMessage:void 0});try{let a=await U.get(this.where,this.address.id);if(t!==this.readSequence)return;if(this.state.draft!==null&&this.state.payload!==null){this.publish({loading:!1,conflict:a.version!==this.state.payload.version});return}this.publish({payload:a,loading:!1,conflict:!1,failure:void 0,revision:this.state.revision+1}),xe(this.address.id,a.manifest.title),je(this.address.id,a.version)}catch(a){t===this.readSequence&&this.publish({loading:!1,failure:Z(a)??"artifact/storage-failure",failureMessage:void 0})}}edit(t){this.publish({draft:t,failure:void 0,failureMessage:void 0})}async discardAndReload(){this.pending!==null&&await this.pending,this.publish({draft:null,conflict:!1,failure:void 0,failureMessage:void 0}),await this.load()}externalVersion(t){this.state.payload===null||t<=this.state.payload.version||this.state.saving||(this.state.draft!==null?this.publish({conflict:!0}):this.load())}save(t){return t!==void 0&&(this.renameTo=t),this.pending!==null?this.pending:this.state.conflict||this.state.payload===null?Promise.resolve(!1):(this.pending=Promise.resolve().then(()=>this.drain()),this.pending)}async drain(){this.publish({saving:!0,failure:void 0,failureMessage:void 0});try{for(;this.state.draft!==null||this.renameTo!==void 0;){let t=this.state.payload;if(t===null||this.state.conflict)return!1;let a=this.state.draft,r=a??t.content,n=this.renameTo,{manifest:o}=await U.update(this.where,this.address.id,t.version,r,n);this.renameTo===n&&(this.renameTo=void 0),this.accept(o,r,this.state.draft===a?null:this.state.draft)}return!0}catch(t){let a=Z(t)??"artifact/storage-failure";return this.renameTo=void 0,this.publish({failure:a,failureMessage:a.startsWith("artifact/design-")?sa(t):void 0,conflict:a==="artifact/stale-version"}),!1}finally{this.pending=null,this.publish({saving:!1})}}accept(t,a,r){let n=this.state.payload;n!==null&&(++this.readSequence,this.publish({payload:{...n,manifest:t,content:a,version:t.version},draft:r,conflict:!1,loading:!1}),xe(t.id,t.title),je(t.id,t.version),we())}};function tr(e){let t=q(e),a=(0,Ke.useMemo)(()=>{let n=ke.get(t);if(n!==void 0)return n;let o=new da(e);return ke.set(t,o),o},[t]),r=(0,Ke.useSyncExternalStore)(a.subscribe,a.getSnapshot,a.getSnapshot);return(0,Ke.useEffect)(()=>a.attach(),[a]),{model:a,state:r}}var k=require("react"),h=require("@deepseek-ai/dsh-client-ui-primitives");var le=require("react"),me=require("@deepseek-ai/dsh-client-ui-primitives");var pi=require("react"),v=require("react/jsx-runtime");function K({children:e,size:t=16}){return(0,v.jsx)("svg",{viewBox:"0 0 24 24",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e})}var At=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,v.jsx)("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,v.jsx)("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.5"}),(0,v.jsx)("path",{d:"M17 13.5v7M13.5 17h7"})]}),fe=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,v.jsx)("path",{d:"M3.5 8.5h17M9 13l-2 1.8L9 16.5M15 13l2 1.8-2 1.7"})]}),Te=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("path",{d:"M6.5 3.5h7l4 4v13h-11z"}),(0,v.jsx)("path",{d:"M13.5 3.5v4h4M9 12h6M9 15.5h6"})]}),Be=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,v.jsx)("path",{d:"M3.5 14.5l4.5-4.5 4 4 3-3 5 5"}),(0,v.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.2"})]}),ar=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("path",{d:"M20.5 12a8.5 8.5 0 1 1-8.5-8.5c4.7 0 8.5 3.4 8.5 7.6 0 2.1-1.7 3.8-3.8 3.8h-1.4c-1 0-1.9.8-1.9 1.8 0 .8.5 1.3.5 2.1 0 1-.7 1.7-1.9 1.7Z"}),(0,v.jsx)("circle",{cx:"7.6",cy:"10",r:"1.1",fill:"currentColor",stroke:"none"}),(0,v.jsx)("circle",{cx:"10",cy:"6.8",r:"1.1",fill:"currentColor",stroke:"none"}),(0,v.jsx)("circle",{cx:"14",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),(0,v.jsx)("circle",{cx:"17",cy:"10.2",r:"1.1",fill:"currentColor",stroke:"none"})]}),rr=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M7 3v18M17 3v18M3 7h18M3 17h18"})}),nr=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M5 6h14M12 6v13"})}),or=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"3.5",y:"3.5",width:"11",height:"11",rx:"2"}),(0,v.jsx)("circle",{cx:"15.5",cy:"15.5",r:"5"})]}),ir=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"3.5",y:"3.5",width:"12",height:"12",rx:"2"}),(0,v.jsx)("path",{d:"M8.5 8.5h12v12h-12z"})]}),sr=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M5 3.5l12.5 8.2-5.7 1.2L14 19l-2.4 1-2.1-5.1L5 18.2z"})}),lr=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M8 12V5.5a1.5 1.5 0 0 1 3 0V11M11 10.5V4.5a1.5 1.5 0 0 1 3 0V11M14 10.5V6.5a1.5 1.5 0 0 1 3 0V13c0 4-2.4 7-6 7-3.3 0-4.6-1.6-6.5-5.2L3.2 11.5a1.5 1.5 0 0 1 2.5-1.6L8 12.5"})}),cr=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"4.5",y:"4.5",width:"15",height:"15",rx:"2"}),(0,v.jsx)("path",{d:"M8.5 4.5v15M15.5 4.5v15M4.5 8.5h15M4.5 15.5h15"})]}),dr=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M4.5 6.5h15M12 6.5v12"})}),pr=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M4 9.5h9.5a5.5 5.5 0 0 1 0 11H9M4 9.5l4-4M4 9.5l4 4"})}),ur=({size:e})=>(0,v.jsx)(K,{size:e,children:(0,v.jsx)("path",{d:"M20 9.5h-9.5a5.5 5.5 0 0 0 0 11H15M20 9.5l-4-4M20 9.5l-4 4"})}),fr=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,v.jsx)("circle",{cx:"12",cy:"12",r:"2.6"})]}),mr=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("path",{d:"M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12Z"}),(0,v.jsx)("path",{d:"M4 4l16 16"})]}),gr=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"5",y:"10.5",width:"14",height:"9.5",rx:"2"}),(0,v.jsx)("path",{d:"M8 10.5V7a4 4 0 0 1 8 0v3.5"})]}),yr=({size:e})=>(0,v.jsxs)(K,{size:e,children:[(0,v.jsx)("rect",{x:"5",y:"10.5",width:"14",height:"9.5",rx:"2"}),(0,v.jsx)("path",{d:"M8 10.5V7a4 4 0 0 1 7.4-2"})]});var F=require("react/jsx-runtime"),zt=null;function Kn(e){return e===null||typeof e!="object"?!1:typeof{...e}.mountDesignCanvas=="function"}async function Yn(){return zt??=(async()=>{let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")throw new Error("The canvas loader is unavailable.");let t=await e("./client.canvas.js");if(!Kn(t))throw new Error("The canvas engine did not load.");return t})(),zt.catch(()=>{zt=null}),zt}var Qn=[{value:"select",label:"canvas.select",icon:(0,F.jsx)(sr,{size:16})},{value:"hand",label:"canvas.hand",icon:(0,F.jsx)(lr,{size:16})},{value:"frame",label:"canvas.frame",icon:(0,F.jsx)(cr,{size:16})},{value:"text",label:"canvas.text",icon:(0,F.jsx)(dr,{size:16})}];function br({t:e,source:t,revision:a,title:r,mode:n,onChange:o,onSave:l,onFailure:s,onHandle:g,onSelection:d,attempt:b,fallback:T}){let w=(0,le.useRef)(null),c=(0,le.useRef)(null),u=(0,le.useRef)(t),p=(0,le.useRef)({onChange:o,onSave:l,onFailure:s,onHandle:g,onSelection:d});p.current={onChange:o,onSave:l,onFailure:s,onHandle:g,onSelection:d};let[y,z]=(0,le.useState)({status:"loading"}),[N,j]=(0,le.useState)(null);(0,le.useEffect)(()=>{let C=w.current;if(C===null)return;let L=!1,B=null;return z({status:"loading"}),j(null),(async()=>{try{let I=await Yn();if(L)return;let H=await I.mountDesignCanvas({element:C,source:u.current,mode:n,onChange:V=>{u.current=V,p.current.onChange(V)},onSave:()=>p.current.onSave(),onFailure:V=>{z({status:"failed"}),p.current.onFailure(V)},t:e});if(L){H.destroy();return}c.current=H,p.current.onFailure(null),p.current.onHandle(H),z({status:"ready"});let W=H.getSnapshot();j(W),p.current.onSelection(W.selection),B=H.subscribe(V=>{j(V),p.current.onSelection(V.selection)})}catch(I){L||(z({status:"failed"}),p.current.onFailure(I instanceof Error?I.message:String(I)))}})(),()=>{L=!0,B?.(),c.current?.destroy(),c.current=null,p.current.onHandle(null)}},[b]),(0,le.useEffect)(()=>{let C=c.current;C===null||t===u.current||(u.current=t,C.setSource(t))},[a,t]),(0,le.useEffect)(()=>{c.current?.setMode(n)},[n]);let D=y.status==="ready",_=Qn.map(C=>(0,F.jsx)(me.Tooltip,{label:e(C.label),side:"top",portal:!0,children:(0,F.jsx)(me.Button,{size:"sm",className:"art-dock-button","aria-label":e(C.label),"aria-pressed":N?.tool===C.value,onClick:()=>c.current?.setTool(C.value),children:C.icon})},C.value));return(0,F.jsx)("div",{className:"art-canvas",children:(0,F.jsxs)("div",{className:"art-canvas-stage",children:[(0,F.jsx)("div",{className:"art-canvas-mount",ref:w,role:"application","aria-label":r,tabIndex:0,hidden:y.status==="failed","data-ready":D?"1":void 0}),D?null:(0,F.jsx)("div",{className:"art-canvas-fallback",children:T}),y.status==="loading"?(0,F.jsx)("div",{className:"art-canvas-opening",role:"status",children:e("canvas.opening")}):null,D&&N!==null&&N.rows.length===0?(0,F.jsx)("p",{className:"art-canvas-empty",children:e("canvas.empty")}):null,D?(0,F.jsxs)("div",{className:"art-canvas-dock",role:"toolbar","aria-label":e("canvas.toolbar"),children:[n==="edit"?(0,F.jsxs)(F.Fragment,{children:[_,(0,F.jsx)("span",{className:"art-dock-divider","aria-hidden":"true"}),(0,F.jsx)(me.Tooltip,{label:e("canvas.undo"),side:"top",portal:!0,children:(0,F.jsx)(me.Button,{size:"sm",className:"art-dock-button","aria-label":e("canvas.undo"),disabled:N?.canUndo===!1,onClick:()=>c.current?.undo(),children:(0,F.jsx)(pr,{size:16})})}),(0,F.jsx)(me.Tooltip,{label:e("canvas.redo"),side:"top",portal:!0,children:(0,F.jsx)(me.Button,{size:"sm",className:"art-dock-button","aria-label":e("canvas.redo"),disabled:N?.canRedo===!1,onClick:()=>c.current?.redo(),children:(0,F.jsx)(ur,{size:16})})}),(0,F.jsx)("span",{className:"art-dock-divider","aria-hidden":"true"})]}):null,(0,F.jsx)(me.ZoomControls,{className:"art-dock-zoom",zoom:N?.zoom??1,fit:{label:e("canvas.fit"),selected:N?.fit??!1,onSelect:()=>c.current?.zoomToFit()},labels:{controls:e("canvas.zoomControls"),out:e("canvas.zoomOut"),into:e("canvas.zoomIn"),menu:e("canvas.zoomMenu"),value:C=>e("canvas.zoomValue",{percent:C})},visible:D,onZoom:C=>c.current?.setZoom(C),onActiveChange:()=>{}})]}):null]})})}var de=require("react"),Re=require("@deepseek-ai/dsh-client-ui-primitives");var x=require("react/jsx-runtime"),Xn=["Inter","Roboto","Noto Naskh Arabic"],Zn=[400,500,600,700];function Dt(e){switch(e){case"FRAME":case"SECTION":return(0,x.jsx)(rr,{size:14});case"TEXT":return(0,x.jsx)(nr,{size:14});case"GROUP":case"COMPONENT":case"COMPONENT_SET":case"INSTANCE":return(0,x.jsx)(ir,{size:14});default:return(0,x.jsx)(or,{size:14})}}function pa(e,t){switch(t){case"FRAME":return e("layer.type.frame");case"SECTION":return e("layer.type.section");case"TEXT":return e("layer.type.text");case"RECTANGLE":return e("layer.type.rectangle");case"ELLIPSE":return e("layer.type.ellipse");case"LINE":return e("layer.type.line");case"VECTOR":case"STAR":case"POLYGON":return e("layer.type.vector");case"GROUP":return e("layer.type.group");case"COMPONENT":case"COMPONENT_SET":return e("layer.type.component");case"INSTANCE":return e("layer.type.instance");default:return e("layer.type.other")}}function Jn({t:e,label:t,value:a,mixed:r,min:n,max:o,step:l=1,onPreview:s,onCommit:g}){let[d,b]=(0,de.useState)(""),T=(0,de.useRef)(!1),w=(0,de.useRef)(0),c=(0,de.useRef)(!1),u=(0,de.useRef)(!1),p=a===null?"":String(a);(0,de.useEffect)(()=>{T.current||b(a===null?"":String(a))},[a]);let y=()=>b(a===null?"":String(a)),z=()=>{T.current=!1;let N=Number(d);if(d.trim()===""||!Number.isFinite(N)){y(),c.current&&g(w.current,w.current),c.current=!1;return}c.current&&g(N,w.current),c.current=!1};return(0,x.jsxs)("label",{className:"art-inspector-field",children:[(0,x.jsx)("span",{className:"art-inspector-field-label",children:t}),(0,x.jsx)(Re.Input,{className:"art-inspector-input","aria-label":t,type:"number",inputMode:"decimal",min:n,max:o,step:l,value:d,placeholder:r||p===""?e("panel.mixed"):void 0,onFocus:()=>{T.current=!0,w.current=a??0,c.current=!1,b(a===null?"":String(a))},onChange:N=>{let j=N.target.value;b(j);let D=Number(j);j.trim()!==""&&Number.isFinite(D)&&(c.current=!0,s(D))},onBlur:()=>{if(u.current){u.current=!1,T.current=!1,y();return}z()},onKeyDown:N=>{N.key==="Enter"?(N.preventDefault(),N.currentTarget.blur()):N.key==="Escape"&&(N.preventDefault(),y(),c.current&&g(w.current,w.current),c.current=!1,u.current=!0,N.currentTarget.blur())}})]})}function eo({t:e,handle:t,snapshot:a}){let[r,n]=(0,de.useState)(null),[o,l]=(0,de.useState)(""),s=a.rows,g=s.findIndex(c=>c.selected),d=c=>{let u=s[c];u!==void 0&&t.select(u.id,"replace")},b=c=>{l(c.name),n(c.id)},T=c=>{let u=o.trim();n(null),u!==""&&u!==c.name&&t.rename(c.id,u)},w=c=>{let u=g===-1?void 0:s[g];if(c.key==="ArrowDown"){c.preventDefault(),d(g===-1?0:Math.min(g+1,s.length-1));return}if(c.key==="ArrowUp"){c.preventDefault(),d(g===-1?s.length-1:Math.max(g-1,0));return}if(u!==void 0){if(c.key==="ArrowLeft"){if(c.preventDefault(),u.hasChildren&&u.expanded){t.toggleExpand(u.id);return}for(let p=g-1;p>=0;p-=1)if(s[p].level<u.level){t.select(s[p].id,"replace");return}return}if(c.key==="ArrowRight"){if(c.preventDefault(),u.hasChildren&&!u.expanded)t.toggleExpand(u.id);else{let p=s[g+1];p!==void 0&&p.level>u.level&&t.select(p.id,"replace")}return}c.key==="Enter"&&(c.preventDefault(),b(u))}};return s.length===0?(0,x.jsx)("p",{className:"art-inspector-empty",children:e("panel.none")}):(0,x.jsx)("div",{className:"art-layer-tree",role:"tree","aria-label":e("panel.layers"),tabIndex:0,onKeyDown:w,children:s.map(c=>(0,x.jsxs)("div",{className:"art-layer-row"+(c.selected?" is-selected":""),"data-layer-id":c.id,role:"treeitem","aria-level":c.level,"aria-selected":c.selected,"aria-expanded":c.hasChildren?c.expanded:void 0,style:{paddingInlineStart:(c.level-1)*14+6},onClick:u=>{u.shiftKey?t.select(c.id,"range"):u.metaKey||u.ctrlKey?t.select(c.id,"add"):t.select(c.id,"replace")},onDoubleClick:()=>b(c),children:[c.hasChildren?(0,x.jsx)("button",{type:"button",className:"art-layer-caret","aria-label":e(c.expanded?"panel.collapse":"panel.expand"),onClick:u=>{u.stopPropagation(),t.toggleExpand(c.id)},children:c.expanded?(0,x.jsx)(Re.IconChevronDownOutlineRegular,{size:12}):(0,x.jsx)(Re.IconChevronRightOutlineRegular,{size:12})}):(0,x.jsx)("span",{className:"art-layer-caret","aria-hidden":"true"}),(0,x.jsx)("span",{className:"art-layer-icon","aria-hidden":"true",children:Dt(c.type)}),r===c.id?(0,x.jsx)("input",{className:"art-layer-rename","aria-label":e("panel.rename"),autoFocus:!0,value:o,onChange:u=>l(u.target.value),onClick:u=>u.stopPropagation(),onBlur:()=>T(c),onKeyDown:u=>{u.key==="Enter"?(u.preventDefault(),T(c)):u.key==="Escape"&&(u.preventDefault(),n(null))}}):(0,x.jsx)("span",{className:"art-layer-name",title:c.name,children:c.name}),(0,x.jsxs)("span",{className:"art-layer-actions",children:[(0,x.jsx)("button",{type:"button",className:"art-layer-action","aria-label":e(c.visible?"panel.hide":"panel.show"),"aria-pressed":!c.visible,onClick:u=>{u.stopPropagation(),t.toggleVisibility(c.id)},children:c.visible?(0,x.jsx)(fr,{size:13}):(0,x.jsx)(mr,{size:13})}),(0,x.jsx)("button",{type:"button",className:"art-layer-action","aria-label":e(c.locked?"panel.unlock":"panel.lock"),"aria-pressed":c.locked,onClick:u=>{u.stopPropagation(),t.toggleLock(c.id)},children:c.locked?(0,x.jsx)(gr,{size:13}):(0,x.jsx)(yr,{size:13})})]})]},c.id))})}function to({t:e,handle:t,snapshot:a}){let r=a.properties;if(r.ids.length===0)return(0,x.jsx)("p",{className:"art-inspector-empty",children:e("panel.selectLayerHint")});let n=(o,l,s,g={})=>(0,x.jsx)(Jn,{t:e,label:l,value:s,mixed:s===null,...g,onPreview:d=>t.preview(o,d),onCommit:(d,b)=>t.commit(o,d,b)});return(0,x.jsxs)("div",{className:"art-inspector-properties",children:[(0,x.jsxs)("div",{className:"art-inspector-node",children:[(0,x.jsx)("span",{className:"art-inspector-node-icon","aria-hidden":"true",children:Dt(r.type??"")}),(0,x.jsx)("span",{className:"art-inspector-node-name",title:r.name??"",children:r.name}),(0,x.jsx)("span",{className:"art-inspector-node-type",children:pa(e,r.type??"")})]}),(0,x.jsxs)("section",{className:"art-inspector-group",children:[(0,x.jsx)("h3",{className:"art-inspector-heading",children:e("panel.positionSize")}),(0,x.jsxs)("div",{className:"art-inspector-grid",children:[n("x",e("panel.x"),r.x),n("y",e("panel.y"),r.y),n("width",e("panel.w"),r.width,{min:1}),n("height",e("panel.h"),r.height,{min:1}),n("rotation",e("panel.rotation"),r.rotation),n("radius",e("panel.radius"),r.radius,{min:0})]})]}),(0,x.jsxs)("section",{className:"art-inspector-group",children:[(0,x.jsx)("h3",{className:"art-inspector-heading",children:e("panel.appearance")}),(0,x.jsxs)("div",{className:"art-inspector-appearance",children:[n("opacity",e("panel.opacity"),r.opacity,{min:0,max:100}),(0,x.jsxs)("label",{className:"art-inspector-switch",children:[(0,x.jsx)("span",{className:"art-inspector-field-label",children:e("panel.visible")}),(0,x.jsx)(Re.Switch,{checked:r.visible===!0,label:e("panel.visible"),onChange:o=>t.setVisible(o)})]})]})]}),a.isText&&r.text!==null?(0,x.jsxs)("section",{className:"art-inspector-group",children:[(0,x.jsx)("h3",{className:"art-inspector-heading",children:e("panel.text")}),(0,x.jsxs)("div",{className:"art-inspector-grid",children:[(0,x.jsxs)("label",{className:"art-inspector-field",children:[(0,x.jsx)("span",{className:"art-inspector-field-label",children:e("panel.family")}),(0,x.jsx)("select",{className:"art-inspector-select","aria-label":e("panel.family"),value:r.text.family,onChange:o=>t.setFamily(o.target.value),children:Xn.map(o=>(0,x.jsx)("option",{value:o,children:o},o))})]}),(0,x.jsxs)("label",{className:"art-inspector-field",children:[(0,x.jsx)("span",{className:"art-inspector-field-label",children:e("panel.weight")}),(0,x.jsx)("select",{className:"art-inspector-select","aria-label":e("panel.weight"),value:String(r.text.weight),onChange:o=>t.setWeight(Number(o.target.value)),children:Zn.map(o=>(0,x.jsx)("option",{value:String(o),children:String(o)},o))})]}),n("fontSize",e("panel.fontSize"),r.text.fontSize,{min:1})]})]}):(0,x.jsx)("p",{className:"art-inspector-hint",children:e("panel.selectTextHint")})]})}function hr({t:e,handle:t,snapshot:a,tab:r}){return t===null||a===null?(0,x.jsx)("p",{className:"art-inspector-empty",children:e("canvas.opening")}):r==="layers"?(0,x.jsx)(eo,{t:e,handle:t,snapshot:a}):(0,x.jsx)(to,{t:e,handle:t,snapshot:a})}var st=require("react"),vr=require("@deepseek-ai/dsh-client-ui-primitives");var ie=require("react/jsx-runtime");function ua({t:e,where:t,id:a,version:r,title:n}){let[o,l]=(0,st.useState)({status:"loading"}),[s,g]=(0,st.useState)(0);if((0,st.useEffect)(()=>{let b=new AbortController;return l({status:"loading"}),U.preview(t,a,r,b.signal).then(T=>{b.signal.aborted||l({status:"ready",preview:T})}).catch(T=>{b.signal.aborted||l({status:"failed",message:Ka(e,T)})}),()=>b.abort()},[t.scope,t.workspaceId,a,r,s,e]),o.status==="loading")return(0,ie.jsx)("div",{className:"art-design-state",role:"status","aria-busy":"true",children:e("preview.loading")});if(o.status==="failed")return(0,ie.jsxs)("div",{className:"art-design-state",role:"alert",children:[(0,ie.jsx)("span",{className:"art-design-error",children:o.message}),(0,ie.jsx)(vr.Button,{size:"sm",variant:"outline",onClick:()=>g(b=>b+1),children:e("preview.retry")})]});let{preview:d}=o;return(0,ie.jsxs)("div",{className:"art-design-preview",children:[(0,ie.jsx)("div",{className:"art-design-canvas",children:(0,ie.jsx)("img",{className:"art-design-image",src:`data:${d.mediaType};base64,${d.data}`,alt:n,width:d.width,height:d.height})}),d.info.warnings.length===0?null:(0,ie.jsxs)("div",{className:"art-design-warnings",role:"note",children:[(0,ie.jsx)("span",{className:"art-design-warnings-title",children:e("preview.warnings")}),(0,ie.jsx)("ul",{children:d.info.warnings.map(b=>(0,ie.jsx)("li",{children:b},b))})]})]})}var $=require("react"),xr=require("@deepseek-ai/dsh-client-ui-primitives");var ge=require("react/jsx-runtime"),lt=null;function ao(){if(lt===null){let e=globalThis.__dshArtifactsRequireAsync;if(typeof e!="function")return Promise.reject(new Error("The document editor loader is unavailable."));lt=e("./client.doc.js"),lt.catch(()=>{lt=null})}return lt}var ro=["heading","bold","italic","bulletList","orderedList","codeBlock"];function no(e){let t=window.getSelection(),a=e.getBoundingClientRect(),n=(t!==null&&t.rangeCount>0?t.getRangeAt(0):null)?.getBoundingClientRect();if(n===void 0||n.width===0&&n.height===0)return{top:e.scrollTop+8,left:16};let o=Math.min(Math.max(n.left-a.left+n.width/2,120),Math.max(a.width-120,120));return{top:Math.max(n.top-a.top+e.scrollTop-46,e.scrollTop+4),left:o}}function Pt({markdown:e,revision:t,editable:a,label:r,loadingLabel:n,failedLabel:o,onChange:l,onSave:s,onSelectionText:g,t:d,design:b,dark:T=!1,selectionAction:w}){let c=(0,$.useRef)(null),u=(0,$.useRef)(null),p=(0,$.useRef)(null),y=(0,$.useRef)(l);y.current=l;let z=(0,$.useRef)(g);z.current=g;let N=(0,$.useRef)({markdown:e,editable:a,label:r});N.current={markdown:e,editable:a,label:r};let[j,D]=(0,$.useState)([]),[_,C]=(0,$.useState)("loading"),[L,B]=(0,$.useState)(null),I=(0,$.useRef)(null);(0,$.useLayoutEffect)(()=>{let R=I.current,S=c.current;if(R===null||S===null||L===null)return;let G=R.offsetWidth/2,ae=S.clientWidth,Me=G*2+16>=ae?ae/2:Math.min(Math.max(L.left,G+8),ae-G-8);R.style.left=Me+"px"});let H=(0,$.useMemo)(()=>b===void 0?{}:{...Wa(b,T),colorScheme:T?"dark":"light"},[b,T]),W=R=>{z.current?.(R);let S=c.current;B(R===""||S===null?null:no(S))},V=(0,$.useRef)(W);V.current=W,(0,$.useEffect)(()=>{let R=!1;return ao().then(S=>{R||u.current===null||(p.current=S.mountDocEditor({element:u.current,...N.current,onChange:G=>y.current(G),onSelectionChange:D,onSelectionText:G=>V.current(G)}),C("ready"))}).catch(()=>{R||C("failed")}),()=>{R=!0,p.current?.destroy(),p.current=null}},[]),(0,$.useEffect)(()=>{let R=p.current;R!==null&&R.getMarkdown()!==e&&R.setMarkdown(e)},[t,e]),(0,$.useEffect)(()=>{p.current?.setEditable(a)},[a]),(0,$.useEffect)(()=>{let R=()=>{let S=p.current,G=c.current,ae=window.getSelection();S===null||G===null||ae!==null&&ae.anchorNode!==null&&!G.contains(ae.anchorNode)||V.current(S.getSelectionText())};return document.addEventListener("selectionchange",R),()=>document.removeEventListener("selectionchange",R)},[]);let Pe=L!==null&&d!==void 0&&(a||w!=null);return(0,ge.jsxs)("div",{className:"art-doc",ref:c,"data-doc-revision":t,onKeyDown:R=>{(R.ctrlKey||R.metaKey)&&R.key.toLowerCase()==="s"&&(R.preventDefault(),s()),R.key==="Escape"&&L!==null&&B(null)},children:[Pe?(0,ge.jsxs)("div",{ref:I,className:"art-doc-toolbar",role:"toolbar","aria-label":d("format.toolbar"),style:{top:L.top,left:L.left},children:[a?ro.map(R=>(0,ge.jsx)(xr.Button,{size:"sm",variant:"ghost","aria-pressed":j.includes(R),disabled:_!=="ready",onMouseDown:S=>S.preventDefault(),onClick:()=>p.current?.format(R),children:d(`format.${R}`)},R)):null,a&&w!=null?(0,ge.jsx)("span",{className:"art-doc-toolbar-gap","aria-hidden":"true"}):null,w]}):null,_==="loading"?(0,ge.jsx)("p",{className:"art-note",children:n}):null,_==="failed"?(0,ge.jsx)("p",{className:"art-note",children:o}):null,(0,ge.jsx)("div",{className:"art-docpage",style:H,children:(0,ge.jsx)("div",{className:"art-doc-mount",ref:u})})]})}function oo(e){return/<meta\b[^>]*name\s*=\s*["']?color-scheme["']?[^>]*content\s*=\s*["'][^"']*\bdark\b/i.test(e)||/<meta\b[^>]*content\s*=\s*["'][^"']*\bdark\b[^"']*["'][^>]*name\s*=\s*["']?color-scheme/i.test(e)}var kr="default-src 'none'; img-src data: blob:; media-src data: blob:; style-src 'unsafe-inline'; script-src 'unsafe-inline' 'unsafe-eval'; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; base-uri 'none'; form-action 'none'",Tr=["body, .art-docpage { color: var(--artifact-color-text); font-family: var(--artifact-font-family); font-size: 16px; line-height: 1.65; }","h1, h2, h3, h4 { font-family: var(--artifact-font-display); font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; margin: 1.8em 0 0.5em; color: var(--artifact-color-text); text-wrap: balance; }","h1 { font-size: 2.1em; margin-top: 0; }","h2 { font-size: 1.45em; }","h3 { font-size: 1.15em; }","p, ul, ol, blockquote, table, pre { margin: 0 0 1em; }","a { color: var(--artifact-color-primary); text-underline-offset: 2px; }","strong { font-weight: 650; }","code { font-family: var(--artifact-font-mono); font-size: 0.88em; padding: 0.1em 0.35em; border-radius: var(--artifact-radius-sm); background: color-mix(in srgb, var(--artifact-color-text) 7%, transparent); }","pre { font-family: var(--artifact-font-mono); font-size: 0.86em; line-height: 1.55; padding: 14px 16px; border-radius: var(--artifact-radius-md); background: color-mix(in srgb, var(--artifact-color-text) 6%, transparent); overflow: auto; }","pre code { padding: 0; background: none; font-size: 1em; }","blockquote { padding: 0 0 0 16px; border-left: 3px solid var(--artifact-color-accent); color: var(--artifact-color-muted); }","ul, ol { padding-left: 1.4em; }","li + li { margin-top: 0.25em; }","table { border-collapse: collapse; width: 100%; font-size: 0.94em; font-variant-numeric: tabular-nums; }","th, td { padding: 8px 10px; border-bottom: 1px solid color-mix(in srgb, var(--artifact-color-text) 14%, transparent); text-align: left; vertical-align: top; }","th { font-weight: 600; color: var(--artifact-color-muted); border-bottom-color: color-mix(in srgb, var(--artifact-color-text) 28%, transparent); }","hr { border: none; border-top: 1px solid color-mix(in srgb, var(--artifact-color-text) 14%, transparent); margin: 2em 0; }"].join(`
|
|
22
|
+
`);var fa="<script>addEventListener('message',function(e){if(e.source!==parent||e.data!=='dsh-artifact-print')return;addEventListener('afterprint',function(){parent.postMessage('dsh-artifact-printed','*')},{once:true});print()})<\/script>";function wr(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function io(e){return e.replace(/<meta\b[^>]*http-equiv\s*=\s*["']?refresh["']?[^>]*>/gi,"").replace(/<meta\b[^>]*content\s*=\s*["'][^"']*url\s*=[^>]*>/gi,"")}function Sr(e,t,a,r,n="",o="auto"){let l='<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">'+(a===null?"":`<meta http-equiv="Content-Security-Policy" content="${wr(a)}">`)+`<title>${wr(r)}</title><style data-artifact-tokens>${t}</style>`+n;return`<!doctype html><html${oo(e)?` ${St}="${o}"`:""}><head>${l}</head><body>${io(e)}</body></html>`}var Nr="allow-scripts",so="allow-scripts allow-modals",lo=3e4,co="<script>(function(){var t;document.addEventListener('selectionchange',function(){clearTimeout(t);t=setTimeout(function(){var s=String(getSelection()||'');parent.postMessage({dshArtifactSelection:s.slice(0,4000)},'*')},150)})})()<\/script>",po=4e3;function Mt(e,t,a,r="auto",n=!1){return Sr(e,t,kr,a,n?co:"",r)}function Cr(e){if(e===null||typeof e!="object")return;let t={...e};return typeof t.dshArtifactSelection=="string"?t.dshArtifactSelection.slice(0,po):void 0}function Ir(e){let t=/<\/head>/i.test(e)?e.replace(/<\/head>/i,`${fa}</head>`):`${fa}${e}`,a=URL.createObjectURL(new Blob([t],{type:"text/html"})),r=document.createElement("iframe");r.setAttribute("sandbox",so),r.setAttribute("aria-hidden","true"),r.tabIndex=-1,r.style.cssText="position:fixed;left:-10000px;top:0;width:800px;height:1000px;border:0;";let n=!1,o=()=>{n||(n=!0,clearTimeout(s),window.removeEventListener("message",l),r.remove(),URL.revokeObjectURL(a))},l=g=>{g.source===r.contentWindow&&g.data==="dsh-artifact-printed"&&o()};window.addEventListener("message",l);let s=setTimeout(o,lo);r.addEventListener("load",()=>{r.contentWindow?.postMessage("dsh-artifact-print","*")},{once:!0}),r.src=a,document.body.appendChild(r)}var Er={"agent.ask":"Edit with agent","agent.reference":'In artifact "{title}" ({id}, v{version}):',"agent.referenceOld":'In artifact "{title}" ({id}, v{version}, the current version is v{current}):',"agent.added":"Added to your message. Describe the change, then send.","agent.addedTruncated":"Added to your message. The selection was shortened to 2,000 characters.","agent.insertFailed":"The message box is busy, so the request was copied instead.","agent.copied":"Copied. Paste it into a conversation, then send.","agent.copyTitle":"Copy the request","card.creating":"Creating {title}","card.updating":"Updating {title}","card.updatingUntitled":"Updating the artifact","card.openNamed":"Open {title}","tab.codeHint":"Read-only code. Select text to ask the agent about it.","tab.editSource":"Edit code","tab.deleteTitle":"Move to trash?","code.copy":"Copy code","dialog.close":"Close","dialog.done":"Done","design.colorsDark":"Dark colors","panel.layers":"Layers","panel.properties":"Properties","panel.none":"No layers","panel.mixed":"Mixed","panel.expand":"Expand","panel.collapse":"Collapse","panel.show":"Show","panel.hide":"Hide","panel.lock":"Lock","panel.unlock":"Unlock","panel.rename":"Rename layer","panel.x":"X","panel.y":"Y","panel.rotation":"Rotate","panel.radius":"Radius","panel.opacity":"Opacity","panel.visible":"Visible","panel.hidden":"Hidden","panel.family":"Font family","panel.weight":"Weight","panel.fontSize":"Size","panel.w":"W","panel.h":"H","panel.positionSize":"Position and size","panel.appearance":"Appearance","panel.text":"Text","panel.selectLayerHint":"Select a layer to see its properties.","panel.selectTextHint":"Select a text layer to change its font, weight, and size.","layer.parentLine":"{type} in {parent}","layer.type.frame":"Frame","layer.type.section":"Section","layer.type.text":"Text","layer.type.rectangle":"Rectangle","layer.type.ellipse":"Ellipse","layer.type.line":"Line","layer.type.vector":"Vector","layer.type.group":"Group","layer.type.component":"Component","layer.type.instance":"Instance","layer.type.other":"Layer","canvas.viewMode":"View","canvas.editMode":"Edit","canvas.opening":"Opening the canvas\u2026","canvas.startFailed":"The canvas did not start. Showing the saved image.","canvas.empty":"This mockup has no layers yet. Switch to Edit to draw one.","canvas.zoomControls":"Zoom","canvas.zoomOut":"Zoom out","canvas.zoomIn":"Zoom in","canvas.zoomMenu":"Zoom level","canvas.zoomValue":"{percent}%","canvas.inspector":"Inspector","canvas.closeInspector":"Close inspector","canvas.inspectorTabs":"Inspector sections","canvas.editOldVersion":"Old versions open in View only. Restore this version to edit.","agent.quoteDesign":`Layer "{name}"
|
|
23
|
+
Path: {path}
|
|
24
|
+
|
|
25
|
+
Design JSX:`,"agent.quoteCut":"The Design JSX was shortened to {limit} characters.","agent.addedTruncatedDesign":"Added to your message. The layer's code was shortened to 4,000 characters.","canvas.toolbar":"Canvas tools","canvas.tools":"Tool","canvas.select":"Select","canvas.hand":"Hand","canvas.frame":"Frame","canvas.text":"Text","canvas.undo":"Undo","canvas.redo":"Redo","canvas.fit":"Fit","preview.loading":"Rendering the mockup\u2026","preview.retry":"Render again","preview.warnings":"Preview warnings","error.designIconNotFound":"That icon is not in the bundled set. Use an mdi: name from Material Design Icons.","design.display":"Heading font stack","composer.recent":"This project","composer.empty":"No artifacts yet","composer.start":"Start with","composer.all":"All artifacts","gallery.copyPrompt":"Copy prompt","gallery.copyPromptNamed":"Copy the {name} prompt","gallery.promptCopied":"Prompt copied. Paste it into a conversation.","prompt.dashboard":"Dashboard","prompt.dashboardText":"Create an artifact page: a dashboard that shows ","prompt.explainer":"Explainer","prompt.explainerText":"Create an artifact page: a one-page visual explainer of ","prompt.report":"Report","prompt.reportText":"Create an artifact doc: a report about ","prompt.brief":"Project brief","prompt.briefText":"Create an artifact doc: a project brief with context, goal, scope, and open questions for ","filter.type":"Filter by type","tab.mode":"Page view","tab.manualSave":"Page source saves with Save or Ctrl/Cmd+S.","tab.manualSaveDesign":"Mockup source saves with Save or Ctrl/Cmd+S.","tab.versionPicker":"Choose version","tab.currentVersion":"current","tab.allVersions":"All versions","tab.agentUpdate":"Updated to v{version}","tab.viewHistory":"View history","tab.dismiss":"Dismiss","tab.leaveTitle":"Keep your changes?","tab.leaveHint":"Save your changes before continuing, or discard them. Cancel keeps you here.","tab.discardContinue":"Discard and continue","tab.saveContinue":"Save and continue","tab.copyDraft":"Copy my draft","tab.discardReload":"Discard mine and reload","history.close":"Close history","action.copied":"Copied","action.copyFailed":"Copy was blocked. Select the text and copy it manually.","format.toolbar":"Document formatting","format.heading":"Heading","format.bold":"Bold","format.italic":"Italic","format.bulletList":"Bullet list","format.orderedList":"Numbered list","format.codeBlock":"Code block",panel:"Artifacts","action.back":"Back","scope.label":"Scope","scope.all":"All projects","scope.workspace":"This project","scope.library":"Library","type.page":"Page","type.doc":"Document","type.design":"Mockup","type.all":"All types","gallery.search":"Search artifacts","gallery.searchLabel":"Search by title","gallery.create":"New artifact","gallery.newPage":"New page","gallery.newDoc":"New document","gallery.newDesign":"New mockup","gallery.design":"Design system","gallery.refresh":"Refresh","gallery.more":"Show more","gallery.truncated":"Only the first 500 artifacts are scanned.","gallery.failedProjects":"Some sources could not be loaded.","gallery.version":"v{version}","gallery.updated":"Updated {time}","gallery.count":"{count} artifacts","gallery.pinned":"Pinned","gallery.recent":"Recently updated","gallery.coverTitle":"Preview of {title}","gallery.coverFailed":"Preview unavailable","gallery.pin":"Pin {title}","gallery.unpin":"Unpin {title}","gallery.allPinned":"Everything here is pinned.","empty.workspaceTitle":"No artifacts in this project yet","empty.workspaceHint":"Ask the agent for a dashboard, report, or one-pager, or start one here.","empty.allTitle":"No artifacts yet","empty.allHint":"Artifacts from every project and your library appear here.","empty.libraryTitle":"Your library is empty","empty.libraryHint":"Library artifacts follow you to every project. Ask the agent to save one to the library.","empty.noMatch":"Nothing matches that search.","empty.typeMatch":"No {type} artifacts match the filter.","empty.noWorkspace":"Open a session in a workspace to see its artifacts.","empty.loading":"Loading...","create.title":"New {type}","create.name":"Title","create.scope":"Save to","create.submit":"Create","create.cancel":"Cancel","create.untitledPage":"Untitled page","create.untitledDesign":"Untitled mockup","create.untitledDoc":"Untitled document","tab.preview":"Preview","tab.source":"Code","tab.history":"History","tab.export":"Export","tab.reload":"Reload","tab.rename":"Rename","tab.delete":"Move to trash","tab.deleteConfirm":'"{title}" moves to the trash. Its files stay there for 7 days.',"tab.save":"Save","tab.saving":"Saving...","tab.saved":"Saved","tab.readOnly":"Read-only","tab.saveFailed":"Save failed","tab.unsaved":"Unsaved changes","tab.frameTitle":"Artifact preview: {title}","tab.versionOf":"Version {version}","tab.viewingOld":"Viewing version {version}. The current version is {current}.","tab.backToCurrent":"Back to current","tab.restoreThis":"Restore this version","tab.conflictTitle":"This artifact changed","tab.conflictHint":"A newer version was saved while you were editing. Your draft is kept here. Copy it before discarding, then reload the latest version.","tab.deleted":"This artifact is no longer here","tab.deletedHint":"It was moved to the trash or deleted.","tab.close":"Close tab","history.title":"Versions","history.current":"Current","history.byAgent":"Agent","history.byUser":"You","history.restored":"Restored from v{version}","history.created":"Created","history.updated":"Edited","history.empty":"No earlier versions.","export.html":"HTML file","export.png":"PNG image","export.svg":"SVG image","export.fig":"OpenPencil document (.fig)","export.md":"Markdown file","export.docx":"Word document","export.print":"Print or save as PDF","export.done":"Saved {name} to {path}","design.title":"Design system","design.hint":"Pages and documents use these values through CSS variables.","design.source.workspace":"This project overrides the library.","design.source.library":"Inherited from your library.","design.source.default":"Built-in defaults. Save to start your own.","design.name":"Name","design.colors":"Colors","design.color.primary":"Primary","design.color.accent":"Accent","design.color.surface":"Surface","design.color.text":"Text","design.color.muted":"Muted","design.type":"Typography","design.font":"Body font stack","design.mono":"Code font stack","design.radius":"Corner radius","design.radius.sm":"Small","design.radius.md":"Medium","design.radius.lg":"Large","design.notes":"Notes for the agent","design.notesHint":"Tone, layout rules, or brand guidance the agent reads before it designs.","design.saveWorkspace":"Save for this project","design.saveWorkspaceNamed":"Save for {name}","design.saveLibrary":"Save to library","design.clear":"Remove project override","design.saved":"Design system saved","design.preview":"Preview","design.previewHeading":"Quarterly review","design.previewBody":"Revenue grew in every region this quarter.","design.previewButton":"Primary action","card.created":"Created","card.updated":"Updated","card.working":"Writing the artifact...","card.failed":"The artifact was not saved","card.missing":"This result has no artifact details.","composer.label":"Artifacts","error.generic":"Something went wrong. Try again.","error.designInvalid":"The mockup source is not valid.","error.designIcon":"The mockup cannot use that icon.","error.designRender":"The mockup could not be rendered.","error.designTimeout":"The mockup took too long to render.","error.designUnavailable":"This runtime cannot render mockups.","error.unsupportedType":"That action is not available for this artifact.","error.notFound":"This artifact no longer exists.","error.stale":"The artifact changed. Reload to continue.","error.tooLarge":"The content is over the 2 MiB limit.","error.noWorkspace":"This session has no workspace.","error.forbidden":"That path is not allowed.","error.corrupt":"The artifact files are damaged.","error.tokens":"A design value is not valid CSS.","error.library":"The library folder cannot be created.","error.surface":"The artifact panel failed to draw.","error.surfaceHint":"Reload the window. Your artifacts are safe on disk.","action.retry":"Retry","action.reloadWindow":"Reload window","time.justNow":"just now","time.minutes":"{count} min ago","time.hours":"{count} h ago","time.days":"{count} d ago"},Rr={"agent.ask":"\u8BA9\u667A\u80FD\u4F53\u4FEE\u6539","agent.reference":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0Cv{version}\uFF09\u4E2D\uFF1A","agent.referenceOld":"\u5728\u4EA7\u7269\u201C{title}\u201D\uFF08{id}\uFF0Cv{version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A v{current}\uFF09\u4E2D\uFF1A","agent.added":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u63CF\u8FF0\u8981\u4FEE\u6539\u7684\u5185\u5BB9\u540E\u53D1\u9001\u3002","agent.addedTruncated":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u9009\u4E2D\u7684\u6587\u672C\u5DF2\u7F29\u77ED\u4E3A 2,000 \u4E2A\u5B57\u7B26\u3002","agent.insertFailed":"\u6D88\u606F\u6846\u6B63\u5FD9\uFF0C\u5DF2\u6539\u4E3A\u590D\u5236\u8BF7\u6C42\u3002","agent.copied":"\u5DF2\u590D\u5236\u3002\u7C98\u8D34\u5230\u5BF9\u8BDD\u4E2D\u540E\u53D1\u9001\u3002","agent.copyTitle":"\u590D\u5236\u8BF7\u6C42","card.creating":"\u6B63\u5728\u521B\u5EFA {title}","card.updating":"\u6B63\u5728\u66F4\u65B0 {title}","card.updatingUntitled":"\u6B63\u5728\u66F4\u65B0\u4EA7\u7269","card.openNamed":"\u6253\u5F00 {title}","tab.codeHint":"\u53EA\u8BFB\u4EE3\u7801\u3002\u9009\u4E2D\u6587\u672C\u5373\u53EF\u8BA9\u667A\u80FD\u4F53\u5904\u7406\u3002","tab.editSource":"\u7F16\u8F91\u4EE3\u7801","tab.deleteTitle":"\u79FB\u5230\u56DE\u6536\u7AD9\uFF1F","code.copy":"\u590D\u5236\u4EE3\u7801","dialog.close":"\u5173\u95ED","dialog.done":"\u5B8C\u6210","design.colorsDark":"\u6DF1\u8272\u914D\u8272","panel.layers":"\u56FE\u5C42","panel.properties":"\u5C5E\u6027","panel.none":"\u6CA1\u6709\u56FE\u5C42","panel.mixed":"\u6DF7\u5408","panel.expand":"\u5C55\u5F00","panel.collapse":"\u6298\u53E0","panel.show":"\u663E\u793A","panel.hide":"\u9690\u85CF","panel.lock":"\u9501\u5B9A","panel.unlock":"\u89E3\u9501","panel.rename":"\u91CD\u547D\u540D\u56FE\u5C42","panel.x":"X","panel.y":"Y","panel.rotation":"\u65CB\u8F6C","panel.radius":"\u5706\u89D2","panel.opacity":"\u4E0D\u900F\u660E\u5EA6","panel.visible":"\u53EF\u89C1","panel.hidden":"\u5DF2\u9690\u85CF","panel.family":"\u5B57\u4F53","panel.weight":"\u5B57\u91CD","panel.fontSize":"\u5B57\u53F7","panel.w":"\u5BBD","panel.h":"\u9AD8","panel.positionSize":"\u4F4D\u7F6E\u548C\u5C3A\u5BF8","panel.appearance":"\u5916\u89C2","panel.text":"\u6587\u672C","panel.selectLayerHint":"\u9009\u62E9\u4E00\u4E2A\u56FE\u5C42\u4EE5\u67E5\u770B\u5176\u5C5E\u6027\u3002","panel.selectTextHint":"\u9009\u62E9\u6587\u672C\u56FE\u5C42\u53EF\u4FEE\u6539\u5B57\u4F53\u3001\u5B57\u91CD\u548C\u5B57\u53F7\u3002","layer.parentLine":"{type}\uFF0C\u4F4D\u4E8E {parent}","layer.type.frame":"\u6846\u67B6","layer.type.section":"\u5206\u533A","layer.type.text":"\u6587\u672C","layer.type.rectangle":"\u77E9\u5F62","layer.type.ellipse":"\u692D\u5706","layer.type.line":"\u7EBF","layer.type.vector":"\u77E2\u91CF","layer.type.group":"\u7F16\u7EC4","layer.type.component":"\u7EC4\u4EF6","layer.type.instance":"\u5B9E\u4F8B","layer.type.other":"\u56FE\u5C42","canvas.viewMode":"\u67E5\u770B","canvas.editMode":"\u7F16\u8F91","canvas.opening":"\u6B63\u5728\u6253\u5F00\u753B\u5E03\u2026","canvas.startFailed":"\u753B\u5E03\u672A\u80FD\u542F\u52A8\uFF0C\u73B0\u663E\u793A\u5DF2\u4FDD\u5B58\u7684\u56FE\u7247\u3002","canvas.empty":"\u6B64\u539F\u578B\u8FD8\u6CA1\u6709\u56FE\u5C42\u3002\u5207\u6362\u5230\u7F16\u8F91\u6A21\u5F0F\u5373\u53EF\u7ED8\u5236\u3002","canvas.zoomControls":"\u7F29\u653E","canvas.zoomOut":"\u7F29\u5C0F","canvas.zoomIn":"\u653E\u5927","canvas.zoomMenu":"\u7F29\u653E\u7EA7\u522B","canvas.zoomValue":"{percent}%","canvas.inspector":"\u68C0\u67E5\u5668","canvas.closeInspector":"\u5173\u95ED\u68C0\u67E5\u5668","canvas.inspectorTabs":"\u68C0\u67E5\u5668\u5206\u533A","canvas.editOldVersion":"\u65E7\u7248\u672C\u4EC5\u53EF\u67E5\u770B\u3002\u6062\u590D\u6B64\u7248\u672C\u540E\u624D\u80FD\u7F16\u8F91\u3002","agent.quoteDesign":`\u56FE\u5C42\u201C{name}\u201D
|
|
26
|
+
\u8DEF\u5F84\uFF1A{path}
|
|
27
|
+
|
|
28
|
+
\u8BBE\u8BA1 JSX\uFF1A`,"agent.quoteCut":"\u8BBE\u8BA1 JSX \u5DF2\u7F29\u77ED\u4E3A {limit} \u4E2A\u5B57\u7B26\u3002","agent.addedTruncatedDesign":"\u5DF2\u52A0\u5165\u6D88\u606F\u6846\u3002\u56FE\u5C42\u4EE3\u7801\u5DF2\u7F29\u77ED\u4E3A 4,000 \u4E2A\u5B57\u7B26\u3002","canvas.toolbar":"\u753B\u5E03\u5DE5\u5177","canvas.tools":"\u5DE5\u5177","canvas.select":"\u9009\u62E9","canvas.hand":"\u6293\u624B","canvas.frame":"\u6846\u67B6","canvas.text":"\u6587\u672C","canvas.undo":"\u64A4\u9500","canvas.redo":"\u91CD\u505A","canvas.fit":"\u9002\u5E94","preview.loading":"\u6B63\u5728\u6E32\u67D3\u539F\u578B\u2026","preview.retry":"\u91CD\u65B0\u6E32\u67D3","preview.warnings":"\u9884\u89C8\u8B66\u544A","error.designIconNotFound":"\u8BE5\u56FE\u6807\u4E0D\u5728\u5185\u7F6E\u56FE\u6807\u96C6\u4E2D\u3002\u8BF7\u4F7F\u7528 Material Design Icons \u7684 mdi: \u540D\u79F0\u3002","design.display":"\u6807\u9898\u5B57\u4F53\u6808","composer.recent":"\u5F53\u524D\u9879\u76EE","composer.empty":"\u8FD8\u6CA1\u6709\u4EA7\u7269","composer.start":"\u4ECE\u8FD9\u91CC\u5F00\u59CB","composer.all":"\u5168\u90E8\u4EA7\u7269","gallery.copyPrompt":"\u590D\u5236\u63D0\u793A\u8BCD","gallery.copyPromptNamed":"\u590D\u5236\u201C{name}\u201D\u63D0\u793A\u8BCD","gallery.promptCopied":"\u63D0\u793A\u8BCD\u5DF2\u590D\u5236\u3002\u7C98\u8D34\u5230\u5BF9\u8BDD\u4E2D\u5373\u53EF\u3002","prompt.dashboard":"\u4EEA\u8868\u76D8","prompt.dashboardText":"\u521B\u5EFA\u4E00\u4E2A artifact \u9875\u9762\uFF1A\u4E00\u4E2A\u4EEA\u8868\u76D8\uFF0C\u5C55\u793A","prompt.explainer":"\u56FE\u89E3\u8BF4\u660E","prompt.explainerText":"\u521B\u5EFA\u4E00\u4E2A artifact \u9875\u9762\uFF1A\u4E00\u9875\u53EF\u89C6\u5316\u8BF4\u660E\uFF0C\u4E3B\u9898\u662F","prompt.report":"\u62A5\u544A","prompt.reportText":"\u521B\u5EFA\u4E00\u4E2A artifact \u6587\u6863\uFF1A\u4E00\u4EFD\u62A5\u544A\uFF0C\u4E3B\u9898\u662F","prompt.brief":"\u9879\u76EE\u7B80\u4ECB","prompt.briefText":"\u521B\u5EFA\u4E00\u4E2A artifact \u6587\u6863\uFF1A\u4E00\u4EFD\u9879\u76EE\u7B80\u4ECB\uFF0C\u5305\u542B\u80CC\u666F\u3001\u76EE\u6807\u3001\u8303\u56F4\u548C\u5F85\u5B9A\u95EE\u9898\uFF0C\u9879\u76EE\u662F","filter.type":"\u6309\u7C7B\u578B\u7B5B\u9009","tab.mode":"\u9875\u9762\u89C6\u56FE","tab.manualSave":"\u9875\u9762\u6E90\u7801\u9700\u70B9\u51FB\u4FDD\u5B58\u6216\u6309 Ctrl/Cmd+S\u3002","tab.manualSaveDesign":"\u539F\u578B\u6E90\u7801\u9700\u70B9\u51FB\u4FDD\u5B58\u6216\u6309 Ctrl/Cmd+S\u3002","tab.versionPicker":"\u9009\u62E9\u7248\u672C","tab.currentVersion":"\u5F53\u524D","tab.allVersions":"\u5168\u90E8\u7248\u672C","tab.agentUpdate":"\u5DF2\u66F4\u65B0\u5230 v{version}","tab.viewHistory":"\u67E5\u770B\u5386\u53F2","tab.dismiss":"\u5173\u95ED","tab.leaveTitle":"\u4FDD\u7559\u66F4\u6539\uFF1F","tab.leaveHint":"\u7EE7\u7EED\u524D\u4FDD\u5B58\u66F4\u6539\uFF0C\u6216\u653E\u5F03\u66F4\u6539\u3002\u53D6\u6D88\u5C06\u4FDD\u7559\u5F53\u524D\u7F16\u8F91\u3002","tab.discardContinue":"\u653E\u5F03\u5E76\u7EE7\u7EED","tab.saveContinue":"\u4FDD\u5B58\u5E76\u7EE7\u7EED","tab.copyDraft":"\u590D\u5236\u6211\u7684\u8349\u7A3F","tab.discardReload":"\u653E\u5F03\u6211\u7684\u66F4\u6539\u5E76\u91CD\u65B0\u52A0\u8F7D","history.close":"\u5173\u95ED\u5386\u53F2","action.copied":"\u5DF2\u590D\u5236","action.copyFailed":"\u590D\u5236\u88AB\u963B\u6B62\u3002\u8BF7\u9009\u4E2D\u6587\u672C\u540E\u624B\u52A8\u590D\u5236\u3002","format.toolbar":"\u6587\u6863\u683C\u5F0F","format.heading":"\u6807\u9898","format.bold":"\u7C97\u4F53","format.italic":"\u659C\u4F53","format.bulletList":"\u9879\u76EE\u7B26\u53F7\u5217\u8868","format.orderedList":"\u7F16\u53F7\u5217\u8868","format.codeBlock":"\u4EE3\u7801\u5757",panel:"\u4EA7\u7269","action.back":"\u8FD4\u56DE","scope.label":"\u8303\u56F4","scope.all":"\u5168\u90E8\u9879\u76EE","scope.workspace":"\u5F53\u524D\u9879\u76EE","scope.library":"\u8D44\u6599\u5E93","type.page":"\u9875\u9762","type.doc":"\u6587\u6863","type.design":"\u539F\u578B","type.all":"\u5168\u90E8\u7C7B\u578B","gallery.search":"\u641C\u7D22\u4EA7\u7269","gallery.searchLabel":"\u6309\u6807\u9898\u641C\u7D22","gallery.create":"\u65B0\u5EFA\u4EA7\u7269","gallery.newPage":"\u65B0\u5EFA\u9875\u9762","gallery.newDoc":"\u65B0\u5EFA\u6587\u6863","gallery.newDesign":"\u65B0\u5EFA\u539F\u578B","gallery.design":"\u8BBE\u8BA1\u7CFB\u7EDF","gallery.refresh":"\u5237\u65B0","gallery.more":"\u663E\u793A\u66F4\u591A","gallery.truncated":"\u4EC5\u626B\u63CF\u524D 500 \u4E2A\u4EA7\u7269\u3002","gallery.failedProjects":"\u90E8\u5206\u6765\u6E90\u52A0\u8F7D\u5931\u8D25\u3002","gallery.version":"v{version}","gallery.updated":"\u66F4\u65B0\u4E8E {time}","gallery.count":"{count} \u4E2A\u4EA7\u7269","gallery.pinned":"\u5DF2\u7F6E\u9876","gallery.recent":"\u6700\u8FD1\u66F4\u65B0","gallery.coverTitle":"{title} \u7684\u9884\u89C8","gallery.coverFailed":"\u9884\u89C8\u4E0D\u53EF\u7528","gallery.pin":"\u7F6E\u9876 {title}","gallery.unpin":"\u53D6\u6D88\u7F6E\u9876 {title}","gallery.allPinned":"\u8FD9\u91CC\u7684\u4EA7\u7269\u90FD\u5DF2\u7F6E\u9876\u3002","empty.workspaceTitle":"\u672C\u9879\u76EE\u8FD8\u6CA1\u6709\u4EA7\u7269","empty.workspaceHint":"\u8BA9\u667A\u80FD\u4F53\u751F\u6210\u4EEA\u8868\u76D8\u3001\u62A5\u544A\u6216\u5355\u9875\uFF0C\u6216\u5728\u8FD9\u91CC\u65B0\u5EFA\u3002","empty.allTitle":"\u8FD8\u6CA1\u6709\u4EA7\u7269","empty.allHint":"\u8FD9\u91CC\u663E\u793A\u6240\u6709\u9879\u76EE\u548C\u8D44\u6599\u5E93\u4E2D\u7684\u4EA7\u7269\u3002","empty.libraryTitle":"\u8D44\u6599\u5E93\u4E3A\u7A7A","empty.libraryHint":"\u8D44\u6599\u5E93\u4E2D\u7684\u4EA7\u7269\u5728\u6240\u6709\u9879\u76EE\u53EF\u7528\u3002\u8BA9\u667A\u80FD\u4F53\u628A\u4EA7\u7269\u4FDD\u5B58\u5230\u8D44\u6599\u5E93\u3002","empty.noMatch":"\u6CA1\u6709\u5339\u914D\u7684\u4EA7\u7269\u3002","empty.typeMatch":"\u6CA1\u6709\u7B26\u5408\u7C7B\u578B\u7B5B\u9009\u7684{type}\u4EA7\u7269\u3002","empty.noWorkspace":"\u5728\u5DE5\u4F5C\u533A\u4E2D\u6253\u5F00\u4F1A\u8BDD\u4EE5\u67E5\u770B\u5176\u4EA7\u7269\u3002","empty.loading":"\u52A0\u8F7D\u4E2D...","create.title":"\u65B0\u5EFA{type}","create.name":"\u6807\u9898","create.scope":"\u4FDD\u5B58\u5230","create.submit":"\u521B\u5EFA","create.cancel":"\u53D6\u6D88","create.untitledPage":"\u672A\u547D\u540D\u9875\u9762","create.untitledDesign":"\u672A\u547D\u540D\u539F\u578B","create.untitledDoc":"\u672A\u547D\u540D\u6587\u6863","tab.preview":"\u9884\u89C8","tab.source":"\u4EE3\u7801","tab.history":"\u5386\u53F2","tab.export":"\u5BFC\u51FA","tab.reload":"\u91CD\u65B0\u52A0\u8F7D","tab.rename":"\u91CD\u547D\u540D","tab.delete":"\u79FB\u5230\u56DE\u6536\u7AD9","tab.deleteConfirm":"\u201C{title}\u201D\u5C06\u79FB\u5230\u56DE\u6536\u7AD9\uFF0C\u6587\u4EF6\u4F1A\u4FDD\u7559 7 \u5929\u3002","tab.save":"\u4FDD\u5B58","tab.saving":"\u6B63\u5728\u4FDD\u5B58...","tab.saved":"\u5DF2\u4FDD\u5B58","tab.readOnly":"\u53EA\u8BFB","tab.saveFailed":"\u4FDD\u5B58\u5931\u8D25","tab.unsaved":"\u6709\u672A\u4FDD\u5B58\u7684\u66F4\u6539","tab.frameTitle":"\u4EA7\u7269\u9884\u89C8\uFF1A{title}","tab.versionOf":"\u7248\u672C {version}","tab.viewingOld":"\u6B63\u5728\u67E5\u770B\u7248\u672C {version}\uFF0C\u5F53\u524D\u7248\u672C\u4E3A {current}\u3002","tab.backToCurrent":"\u56DE\u5230\u5F53\u524D\u7248\u672C","tab.restoreThis":"\u6062\u590D\u6B64\u7248\u672C","tab.conflictTitle":"\u6B64\u4EA7\u7269\u5DF2\u66F4\u6539","tab.conflictHint":"\u7F16\u8F91\u671F\u95F4\u4FDD\u5B58\u4E86\u66F4\u65B0\u7248\u672C\u3002\u8349\u7A3F\u4ECD\u4FDD\u7559\u5728\u8FD9\u91CC\u3002\u653E\u5F03\u524D\u53EF\u5148\u590D\u5236\u8349\u7A3F\uFF0C\u518D\u91CD\u65B0\u52A0\u8F7D\u6700\u65B0\u7248\u672C\u3002","tab.deleted":"\u6B64\u4EA7\u7269\u5DF2\u4E0D\u5B58\u5728","tab.deletedHint":"\u5B83\u5DF2\u88AB\u79FB\u5230\u56DE\u6536\u7AD9\u6216\u5220\u9664\u3002","tab.close":"\u5173\u95ED\u6807\u7B7E\u9875","history.title":"\u7248\u672C","history.current":"\u5F53\u524D","history.byAgent":"\u667A\u80FD\u4F53","history.byUser":"\u4F60","history.restored":"\u4ECE v{version} \u6062\u590D","history.created":"\u521B\u5EFA","history.updated":"\u7F16\u8F91","history.empty":"\u6CA1\u6709\u66F4\u65E9\u7684\u7248\u672C\u3002","export.html":"HTML \u6587\u4EF6","export.png":"PNG \u56FE\u7247","export.svg":"SVG \u56FE\u7247","export.fig":"OpenPencil \u6587\u6863\uFF08.fig\uFF09","export.md":"Markdown \u6587\u4EF6","export.docx":"Word \u6587\u6863","export.print":"\u6253\u5370\u6216\u53E6\u5B58\u4E3A PDF","export.done":"\u5DF2\u5C06 {name} \u4FDD\u5B58\u5230 {path}","design.title":"\u8BBE\u8BA1\u7CFB\u7EDF","design.hint":"\u9875\u9762\u548C\u6587\u6863\u901A\u8FC7 CSS \u53D8\u91CF\u4F7F\u7528\u8FD9\u4E9B\u503C\u3002","design.source.workspace":"\u672C\u9879\u76EE\u8986\u76D6\u4E86\u8D44\u6599\u5E93\u8BBE\u7F6E\u3002","design.source.library":"\u7EE7\u627F\u81EA\u8D44\u6599\u5E93\u3002","design.source.default":"\u5185\u7F6E\u9ED8\u8BA4\u503C\u3002\u4FDD\u5B58\u540E\u5373\u53EF\u81EA\u5B9A\u4E49\u3002","design.name":"\u540D\u79F0","design.colors":"\u989C\u8272","design.color.primary":"\u4E3B\u8272","design.color.accent":"\u5F3A\u8C03\u8272","design.color.surface":"\u5E95\u8272","design.color.text":"\u6587\u5B57","design.color.muted":"\u6B21\u8981","design.type":"\u5B57\u4F53","design.font":"\u6B63\u6587\u5B57\u4F53","design.mono":"\u4EE3\u7801\u5B57\u4F53","design.radius":"\u5706\u89D2","design.radius.sm":"\u5C0F","design.radius.md":"\u4E2D","design.radius.lg":"\u5927","design.notes":"\u7ED9\u667A\u80FD\u4F53\u7684\u8BF4\u660E","design.notesHint":"\u667A\u80FD\u4F53\u8BBE\u8BA1\u524D\u4F1A\u8BFB\u53D6\u7684\u8BED\u6C14\u3001\u6392\u7248\u89C4\u5219\u6216\u54C1\u724C\u89C4\u8303\u3002","design.saveWorkspace":"\u4FDD\u5B58\u5230\u672C\u9879\u76EE","design.saveWorkspaceNamed":"\u4FDD\u5B58\u5230 {name}","design.saveLibrary":"\u4FDD\u5B58\u5230\u8D44\u6599\u5E93","design.clear":"\u79FB\u9664\u9879\u76EE\u8986\u76D6","design.saved":"\u8BBE\u8BA1\u7CFB\u7EDF\u5DF2\u4FDD\u5B58","design.preview":"\u9884\u89C8","design.previewHeading":"\u5B63\u5EA6\u56DE\u987E","design.previewBody":"\u672C\u5B63\u5EA6\u5404\u533A\u57DF\u6536\u5165\u5747\u6709\u589E\u957F\u3002","design.previewButton":"\u4E3B\u8981\u64CD\u4F5C","card.created":"\u5DF2\u521B\u5EFA","card.updated":"\u5DF2\u66F4\u65B0","card.working":"\u6B63\u5728\u5199\u5165\u4EA7\u7269...","card.failed":"\u4EA7\u7269\u672A\u4FDD\u5B58","card.missing":"\u6B64\u7ED3\u679C\u6CA1\u6709\u4EA7\u7269\u4FE1\u606F\u3002","composer.label":"\u4EA7\u7269","error.generic":"\u51FA\u9519\u4E86\uFF0C\u8BF7\u91CD\u8BD5\u3002","error.designInvalid":"\u539F\u578B\u6E90\u7801\u65E0\u6548\u3002","error.designIcon":"\u8BE5\u539F\u578B\u65E0\u6CD5\u4F7F\u7528\u6B64\u56FE\u6807\u3002","error.designRender":"\u539F\u578B\u65E0\u6CD5\u6E32\u67D3\u3002","error.designTimeout":"\u539F\u578B\u6E32\u67D3\u8D85\u65F6\u3002","error.designUnavailable":"\u6B64\u8FD0\u884C\u65F6\u65E0\u6CD5\u6E32\u67D3\u539F\u578B\u3002","error.unsupportedType":"\u8BE5\u4EA7\u7269\u4E0D\u652F\u6301\u6B64\u64CD\u4F5C\u3002","error.notFound":"\u6B64\u4EA7\u7269\u5DF2\u4E0D\u5B58\u5728\u3002","error.stale":"\u4EA7\u7269\u5DF2\u66F4\u6539\uFF0C\u8BF7\u91CD\u65B0\u52A0\u8F7D\u3002","error.tooLarge":"\u5185\u5BB9\u8D85\u8FC7 2 MiB \u4E0A\u9650\u3002","error.noWorkspace":"\u6B64\u4F1A\u8BDD\u6CA1\u6709\u5DE5\u4F5C\u533A\u3002","error.forbidden":"\u4E0D\u5141\u8BB8\u8BBF\u95EE\u8BE5\u8DEF\u5F84\u3002","error.corrupt":"\u4EA7\u7269\u6587\u4EF6\u5DF2\u635F\u574F\u3002","error.tokens":"\u67D0\u4E2A\u8BBE\u8BA1\u503C\u4E0D\u662F\u6709\u6548\u7684 CSS\u3002","error.library":"\u65E0\u6CD5\u521B\u5EFA\u8D44\u6599\u5E93\u6587\u4EF6\u5939\u3002","error.surface":"\u4EA7\u7269\u9762\u677F\u7ED8\u5236\u5931\u8D25\u3002","error.surfaceHint":"\u8BF7\u91CD\u65B0\u52A0\u8F7D\u7A97\u53E3\u3002\u4F60\u7684\u4EA7\u7269\u4ECD\u5B89\u5168\u4FDD\u5B58\u5728\u78C1\u76D8\u4E0A\u3002","action.retry":"\u91CD\u8BD5","action.reloadWindow":"\u91CD\u65B0\u52A0\u8F7D\u7A97\u53E3","time.justNow":"\u521A\u521A","time.minutes":"{count} \u5206\u949F\u524D","time.hours":"{count} \u5C0F\u65F6\u524D","time.days":"{count} \u5929\u524D"};function Lt(e,t,a=Date.now()){let r=Math.max(0,a-Date.parse(t)),n=Math.floor(r/6e4);if(n<1)return e("time.justNow");if(n<60)return e("time.minutes",{count:n});let o=Math.floor(n/60);if(o<24)return e("time.hours",{count:o});let l=Math.floor(o/24);return l<7?e("time.days",{count:l}):new Date(t).toLocaleDateString()}var pe=require("react/jsx-runtime");function uo(e,t){let a=t.source.origin==="agent"?e("history.byAgent"):e("history.byUser"),r=t.source.action==="restore"&&t.source.restoredFrom!==void 0?e("history.restored",{version:t.source.restoredFrom}):t.source.action==="create"?e("history.created"):e("history.updated");return`${a} \xB7 ${r} \xB7 ${Lt(e,t.createdAt)}`}function Ar({t:e,versions:t,failed:a,current:r,selected:n,onSelect:o}){return(0,pe.jsxs)("div",{className:"art-history-body",children:[t===null?(0,pe.jsx)("p",{className:"art-note",children:e("empty.loading")}):null,a?(0,pe.jsx)("p",{className:"art-note",children:e("error.generic")}):null,!a&&t!==null&&t.length<=1?(0,pe.jsx)("p",{className:"art-note",children:e("history.empty")}):null,t?.map(l=>(0,pe.jsxs)("button",{type:"button",className:"art-version","aria-current":l.version===n?"true":void 0,onClick:()=>o(l.version),children:[(0,pe.jsxs)("span",{className:"art-version-top",children:[(0,pe.jsx)("span",{children:e("tab.versionOf",{version:l.version})}),l.version===r?(0,pe.jsx)("span",{className:"art-badge",children:e("history.current")}):null]}),(0,pe.jsx)("span",{className:"art-version-sub",children:uo(e,l)})]},l.version))]})}var ye=require("react");var Ae=require("react/jsx-runtime");function Ot({content:e,designCss:t,title:a,frameTitle:r,dark:n=!1,onSelectionText:o}){let[l,s]=(0,ye.useState)(null),[g,d]=(0,ye.useState)(!1),b=(0,ye.useRef)(0),T=(0,ye.useRef)(null),w=(0,ye.useRef)(o);w.current=o;let c=o!==void 0;return(0,ye.useEffect)(()=>{b.current=0,d(!1);let u=URL.createObjectURL(new Blob([Mt(e,t,a,n?"dark":"light",c)],{type:"text/html"}));return s(u),()=>URL.revokeObjectURL(u)},[e,t,a,n,c]),(0,ye.useEffect)(()=>{if(!c)return;let u=p=>{if(T.current===null||b.current>1||p.source!==T.current.contentWindow)return;let y=Cr(p.data);y!==void 0&&w.current?.(y)};return window.addEventListener("message",u),()=>window.removeEventListener("message",u)},[c]),g?(0,Ae.jsx)("div",{className:"art-center",role:"alert",children:a}):l===null?null:(0,Ae.jsx)("iframe",{ref:T,className:"art-frame",title:r,sandbox:Nr,referrerPolicy:"no-referrer",src:l,onLoad:()=>{b.current+=1,b.current>1&&d(!0)}},l)}function zr({value:e,readOnly:t,label:a,hint:r,onChange:n,onSave:o,onSelectionText:l}){let s=g=>{t||l?.(g.value.slice(g.selectionStart,g.selectionEnd))};return(0,Ae.jsxs)("div",{className:"art-source-wrap",children:[r===void 0?null:(0,Ae.jsx)("div",{className:"art-code-bar",children:(0,Ae.jsx)("span",{children:r})}),(0,Ae.jsx)("textarea",{className:"art-source","aria-label":a,spellCheck:!1,readOnly:t,value:e,autoFocus:!t,onChange:g=>{n(g.target.value),l?.("")},onSelect:g=>s(g.currentTarget),onMouseUp:g=>s(g.currentTarget),onKeyUp:g=>s(g.currentTarget),onKeyDown:g=>{if((g.ctrlKey||g.metaKey)&&g.key.toLowerCase()==="s"){g.preventDefault(),o();return}if(g.key==="Tab"&&!g.shiftKey&&!t){g.preventDefault();let d=g.currentTarget,b=d.selectionStart,T=d.selectionEnd,w=e.slice(0,b)+" "+e.slice(T);n(w),requestAnimationFrame(()=>d.setSelectionRange(b+2,b+2))}}})]})}function ma(e,t=2e3){let a=e.replace(/\r\n/g,`
|
|
23
29
|
`).replace(/[ \t]+\n/g,`
|
|
24
30
|
`).replace(/\n{3,}/g,`
|
|
25
31
|
|
|
26
|
-
`).trim();return
|
|
27
|
-
|
|
32
|
+
`).trim();return a.length<=t?{text:a,truncated:!1}:{text:a.slice(0,t).trimEnd(),truncated:!0}}function Dr(e,t){let a=t.version===t.current?"agent.reference":"agent.referenceOld";return`${e(a,{title:t.title,id:t.id,version:t.version,current:t.current})} `}function ga(e,t){let r=e("agent.quoteDesign",{name:t.name,path:t.path})+"\n\n```jsx\n"+t.jsx+"\n```";if(r.length<=4e3)return{text:r,truncated:!1};let n=`
|
|
33
|
+
|
|
34
|
+
`+e("agent.quoteCut",{limit:4e3});return{text:r.slice(0,4e3-n.length).trimEnd()+n,truncated:!0}}function ya(e,t){return e===""?t:`${e.split(`
|
|
35
|
+
`).map(a=>`> ${a}`).join(`
|
|
28
36
|
`)}
|
|
29
37
|
|
|
30
|
-
${t}`}var Mr=require("react"),zr="data-ds-dark-theme";function Qa(){return typeof document<"u"&&document.body?.hasAttribute(zr)===!0}function Za(e){if(typeof document>"u"||document.body===null)return()=>{};let t=new MutationObserver(e);return t.observe(document.body,{attributes:!0,attributeFilter:[zr]}),()=>t.disconnect()}function ze(){return(0,Mr.useSyncExternalStore)(Za,Qa,()=>!1)}var i=require("react/jsx-runtime");function qe({label:e,icon:t,onClick:r,pressed:a,disabled:n,buttonRef:o}){return(0,i.jsx)(b.Tooltip,{label:e,side:"bottom",portal:!0,children:(0,i.jsx)(b.Button,{ref:o,size:"sm",className:"art-icon-button","aria-label":e,"aria-pressed":a,disabled:n,onClick:r,children:t})})}function Ja({quote:e,askLabel:t,dismissLabel:r,onAsk:a,onDismiss:n}){return(0,i.jsxs)("div",{className:"art-selection-bar",role:"toolbar","aria-label":t,children:[(0,i.jsx)("span",{className:"art-selection-quote",title:e,children:e}),(0,i.jsx)(b.Button,{size:"sm",variant:"primary",icon:(0,i.jsx)(b.IconSparkleRegular,{size:14}),onClick:a,children:t}),(0,i.jsx)(qe,{label:r,icon:(0,i.jsx)(b.IconCloseOutlineRegular,{size:14}),onClick:n})]})}function en({label:e,closeLabel:t,overlay:r,onClose:a,children:n}){let o=(0,v.useRef)(null);return(0,v.useEffect)(()=>{o.current?.querySelector("[data-drawer-initial]")?.focus()??o.current?.querySelector(".art-version, button")?.focus()},[e]),(0,v.useEffect)(()=>{if(!r)return;let s=l=>{let f=o.current;f===null||l.target instanceof Node&&f.contains(l.target)||f.querySelector("button")?.focus()};return document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)},[r]),(0,i.jsxs)("div",{className:"art-drawer-layer","data-overlay":r?"true":void 0,children:[r?(0,i.jsx)("div",{className:"art-drawer-scrim","aria-hidden":"true",onPointerDown:a}):null,(0,i.jsxs)("aside",{ref:o,className:"art-drawer",role:"dialog","aria-modal":r?"true":void 0,"aria-label":e,onKeyDown:s=>{if(s.key==="Escape"){s.preventDefault(),s.stopPropagation(),a();return}if(s.key!=="Tab"||!r)return;let l=[...o.current?.querySelectorAll("button:not(:disabled)")??[]],f=l[0],u=l[l.length-1];f===void 0||u===void 0||(s.shiftKey&&document.activeElement===f?(s.preventDefault(),u.focus()):!s.shiftKey&&document.activeElement===u&&(s.preventDefault(),f.focus()))},children:[(0,i.jsxs)("div",{className:"art-drawer-head",children:[(0,i.jsx)("h2",{children:e}),(0,i.jsx)(qe,{label:t,icon:(0,i.jsx)(b.IconCloseOutlineRegular,{size:14}),onClick:a})]}),(0,i.jsx)("div",{className:"art-drawer-body",children:n})]})]})}function Vt(e){let t=e.useTabInfo(),r=he(t.tab.contentId??t.tab.navigation?.address),a=e.useWorkspaces(n=>n.items.find(o=>r?.scope==="workspace"&&o.workspaceId===r.workspaceId)?.title);return r===void 0?(0,i.jsx)("section",{className:"art-root",children:(0,i.jsx)("p",{className:"art-note",children:e.t("error.notFound")})}):(0,i.jsx)(jr,{t:e.t,address:r,useTabInfo:e.useTabInfo,onBack:t.tab.actions?.close,workspaceName:a,inputActions:e.inputActions},H(r))}function Or({t:e,address:t,onBack:r,workspaceName:a}){return(0,i.jsx)(jr,{t:e,address:t,onBack:r,workspaceName:a,back:!0},H(t))}var tn=()=>{};function jr({t:e,address:t,useTabInfo:r,onBack:a,workspaceName:n,back:o,inputActions:s}){let{model:l,state:f}=xr(t),{payload:u,draft:h,saving:w,conflict:k,failure:S}=f,m=l.where,d=t.id,y=ze(),[E,I]=(0,v.useState)("preview"),[O,Z]=(0,v.useState)(!1),[M,J]=(0,v.useState)(!1),[$,_]=(0,v.useState)(!1),[A,q]=(0,v.useState)(null),[V,ae]=(0,v.useState)(!1),[ee,x]=(0,v.useState)(!1),[g,L]=(0,v.useState)(null),[j,F]=(0,v.useState)(null),[Tt,we]=(0,v.useState)(!1),[Be,Yt]=(0,v.useState)(""),[St,Fe]=(0,v.useState)(null),[la,Xe]=(0,v.useState)(!1),[ne,ye]=(0,v.useState)(!1),[Re,le]=(0,v.useState)(null),[Xt,Ct]=(0,v.useState)(null),[Qt,He]=(0,v.useState)(null),ce=(0,v.useRef)(0),Qe=(0,v.useRef)(null),Zt=(0,v.useRef)(null),Jt=(0,v.useRef)(null),Nt=(0,v.useRef)(!1),Ze=yr(d),er=(r??tn)();(0,v.useEffect)(()=>{u!==null&&Ze>u.version&&h===null&&!w&&!k&&He(Ze),l.externalVersion(Ze)},[Ze,l,w,u?.version,h,k]),(0,v.useEffect)(()=>{k&&He(null)},[k]),(0,v.useEffect)(()=>{le(null)},[u?.version,g?.version,f.revision]);let ca=u!==null,Ee=(0,v.useCallback)(()=>{let p=Qe.current,C=p===null?0:p.clientWidth;_(C>0?C<=600:window.innerWidth<=600)},[]);(0,v.useEffect)(()=>{let p=Qe.current;if(p===null)return;Ee();let C=new ResizeObserver(Ee);return C.observe(p),window.addEventListener("resize",Ee),()=>{C.disconnect(),window.removeEventListener("resize",Ee)}},[ca,Ee]);let ke=(0,v.useCallback)(p=>{l.getSnapshot().draft!==null||l.getSnapshot().saving?Fe({run:p}):p()},[l]),At=(0,v.useCallback)(()=>{++ce.current,x(!1),L(null),le(null),F(null),He(null)},[]),Je=(0,v.useCallback)(async()=>{At(),await l.discardAndReload()},[l,At]);(0,v.useEffect)(()=>er?.tab.actions?.bindCommands({refresh:()=>ke(Je)}),[er?.tab.actions,ke,Je]),(0,v.useEffect)(()=>{if(u?.manifest.type!=="doc"||h===null||k||w)return;let p=setTimeout(()=>void l.save(),1200);return()=>clearTimeout(p)},[h,k,w,l,u?.manifest.type]),(0,v.useEffect)(()=>{if(!M||u===null)return;let p=new AbortController;return q(null),ae(!1),z.history(m,d,p.signal).then(C=>{p.signal.aborted||q(C.versions)}).catch(()=>{p.signal.aborted||ae(!0)}),()=>p.abort()},[M,u?.version,l]),(0,v.useEffect)(()=>()=>{++ce.current},[]),(0,v.useEffect)(()=>{if(M){Nt.current=!0;return}Nt.current&&(Nt.current=!1,Jt.current?.focus())},[M]),(0,v.useEffect)(()=>{if(E!=="source"||u?.manifest.type!=="page")return;let p=()=>{let C=Zt.current,G=window.getSelection();if(C===null||G===null||G.anchorNode===null||!C.contains(G.anchorNode))return;let Pe=Ft(G.toString());le(Pe.text===""?null:Pe)};return document.addEventListener("selectionchange",p),()=>document.removeEventListener("selectionchange",p)},[E,u?.manifest.type]);let tr=()=>{++ce.current,x(!1),L(null),J(!1)},Rt=()=>{Ee(),++ce.current,x(!1),L(null),F(null),J(!0)},rr=async p=>{let C=++ce.current;if(F(null),le(null),p===u?.version){x(!1),L(null);return}x(!0);try{let G=await z.get(m,d,p);C===ce.current&&L(G)}catch(G){C===ce.current&&W(e(X(Y(G))))}finally{C===ce.current&&x(!1)}},ar=async()=>ee?null:g!==null?g.version:await l.save()?l.getSnapshot().payload?.version??null:null,nr=async p=>{if(!ne){ye(!0);try{let C=await ar();if(C===null)return;if(p==="print")Rr((await z.printable(m,d,C)).html);else{let G=await z.exportFile(m,d,p,C);mr(G),W(e("export.done",{name:G.fileName,path:G.path}))}}catch(C){W(e(X(Y(C))))}finally{ye(!1)}}},da=async()=>{Be.trim()===""||w||await l.save(Be.trim())&&we(!1)},pa=async()=>{if(g===null||ne)return;let p=g.version;ke(async()=>{ye(!0);try{let C=await z.restore(m,d,p,l.getSnapshot().payload?.version??0);Se(d,C.manifest.version),pe(),At(),await l.load()}catch(C){W(e(X(Y(C))))}finally{ye(!1)}})},Et=async(p,C)=>{try{await navigator.clipboard.writeText(p),W(e(C))}catch{Ct(p)}},Pt=async p=>{if(!(ne||k||ee||u===null)){ye(!0);try{let C=await ar();if(C===null)return;let G=l.getSnapshot().payload??u,Pe=Dr(e,{title:G.manifest.title,id:d,version:C,current:G.version}),tt=p?.text??"";if(le(null),s===void 0){await Et(Ht(tt,Pe),"agent.copied");return}if((tt===""||s.insertQuote(tt))&&s.insertText(Pe,s.captureInsertion())){W(e(p?.truncated===!0?"agent.addedTruncated":"agent.added"));return}await Et(Ht(tt,Pe),"agent.insertFailed")}finally{ye(!1)}}},It=(0,v.useCallback)(p=>{let C=Ft(p);le(C.text===""?null:C)},[]),ua=async()=>{if(j==="version"){F(null);return}if(u!==null){try{let p=await z.history(m,d);q(p.versions)}catch(p){W(e(X(Y(p))));return}F("version")}};if(u===null)return(0,i.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",ref:Qe,children:(0,i.jsxs)("div",{className:"art-center",role:S===void 0?"status":"alert",children:[(0,i.jsx)("p",{className:"art-center-hint",children:e(S===void 0?"empty.loading":X(S))}),(0,i.jsxs)("div",{className:"art-center-actions",children:[S===void 0?null:(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>void l.load(),children:e("action.retry")}),a===void 0?null:(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:a,children:e("tab.close")})]})]})});let Te=u.manifest.type,et=g?.content??h??u.content,Ve=g!==null,fa=g?.version??u.version,ma=e(w?"tab.saving":k?"tab.conflictTitle":ee?"empty.loading":g!==null?"tab.readOnly":S!==void 0?"tab.saveFailed":h!==null?"tab.unsaved":"tab.saved"),ga=k||S!==void 0&&!w?"error":w?"warn":void 0,ba=t.scope==="workspace"?n??t.workspaceId:e("scope.library"),ya=E==="source"&&!Ve&&(O||h!==null),or=[...lr[Te].map(p=>({id:p,label:e(`export.${p}`)})),{type:"separator",id:"export-gap"},{id:"print",label:e("export.print")}],ir=p=>{F(null),p==="print"?nr("print"):(p==="html"||p==="md"||p==="docx")&&nr(p)},ha=[...$?[...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}],va=p=>{F(null),p==="rename"?(Yt(u.manifest.title),we(!0)):p==="reload"?ke(Je):p==="delete"?Xe(!0):ir(p)},xa=[...(A??[]).map(p=>({id:"v"+p.version,label:e("tab.versionOf",{version:p.version})+(p.version===u.version?" \xB7 "+e("tab.currentVersion"):"")})),{type:"separator",id:"versions-gap"},{id:"all",label:e("tab.allVersions")}],wa=p=>{F(null),p==="all"?Rt():rr(Number(p.slice(1)))},ka=(0,i.jsx)(b.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,i.jsx)(b.IconSparkleRegular,{size:14}),disabled:ne||k||ee,onClick:()=>void Pt(Re),children:e("agent.ask")});return(0,i.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"","data-artifact-id":d,"aria-busy":ne,ref:Qe,children:[(0,i.jsxs)("header",{className:"art-header art-editor-header",children:[(0,i.jsxs)("div",{className:"art-heading",children:[!o||a===void 0?null:(0,i.jsx)(qe,{label:e("action.back"),icon:(0,i.jsx)(b.IconChevronLeftOutlineRegular,{size:16}),onClick:()=>ke(a)}),(0,i.jsxs)("div",{className:"art-identity",children:[(0,i.jsx)("h1",{className:"art-title",title:u.manifest.title,children:u.manifest.title}),(0,i.jsxs)("div",{className:"art-meta",children:[(0,i.jsxs)("span",{className:"art-meta-text",children:[ba,t.scope==="workspace"?" \xB7 "+e("scope.workspace"):null]}),(0,i.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,i.jsx)(b.Menu,{open:j==="version",onClose:()=>F(null),items:xa,onSelect:wa,portal:!0,autoFocus:!0,anchor:(0,i.jsxs)("button",{type:"button",className:"art-version-button","aria-label":e("tab.versionPicker"),"aria-haspopup":"menu","aria-expanded":j==="version",onClick:()=>void ua(),children:[e("gallery.version",{version:fa}),(0,i.jsx)(b.IconChevronDownOutlineRegular,{size:12})]})}),(0,i.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,i.jsx)("span",{className:"art-save-status","data-tone":ga,"aria-live":"polite",children:ma})]})]})]}),(0,i.jsxs)("div",{className:"art-actions art-editor-actions",children:[Te!=="page"?null:(0,i.jsx)(b.SegmentedControl,{id:"art-mode-"+d,className:"art-segment",label:e("tab.mode"),value:E,options:[{value:"preview",label:e("tab.preview")},{value:"source",label:e("tab.source")}],onChange:p=>{I(p),le(null)}}),h===null||Ve?null:(0,i.jsx)(qe,{label:e("tab.save"),icon:(0,i.jsx)(b.IconSaveOutlineRegular,{size:16}),disabled:k,onClick:()=>void l.save()}),(0,i.jsx)(qe,{buttonRef:Jt,label:e("tab.history"),icon:(0,i.jsx)(b.IconClockOutlineRegular,{size:16}),pressed:M,onClick:()=>{M?tr():Rt()}}),$?null:(0,i.jsx)(b.Menu,{open:j==="export",onClose:()=>F(null),items:or,onSelect:ir,align:"end",portal:!0,autoFocus:!0,anchor:(0,i.jsx)(b.Button,{size:"sm",icon:(0,i.jsx)(b.IconDownloadOutlineRegular,{size:14}),"aria-label":e("tab.export"),"aria-haspopup":"menu","aria-expanded":j==="export",disabled:ne||ee,onClick:()=>F(j==="export"?null:"export"),children:e("tab.export")})}),ka,(0,i.jsx)(b.Menu,{open:j==="more",onClose:()=>F(null),items:ha,onSelect:va,align:"end",portal:!0,autoFocus:!0,anchor:(0,i.jsx)(b.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.more"),"aria-haspopup":"menu","aria-expanded":j==="more",onClick:()=>F(j==="more"?null:"more"),children:(0,i.jsx)(b.IconEllipsisOutlineRegular,{size:14})})})]})]}),Tt?(0,i.jsxs)("form",{className:"art-inline-form",onSubmit:p=>{p.preventDefault(),da()},children:[(0,i.jsx)("input",{"aria-label":e("tab.rename"),value:Be,maxLength:120,autoFocus:!0,onChange:p=>Yt(p.target.value),onKeyDown:p=>{p.key==="Escape"&&we(!1)}}),(0,i.jsx)(b.Button,{type:"submit",size:"sm",variant:"primary",disabled:w||k,children:e("tab.save")}),(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>we(!1),children:e("create.cancel")})]}):null,Qt===null?null:(0,i.jsxs)("div",{className:"art-bar",role:"status",children:[(0,i.jsx)("span",{children:e("tab.agentUpdate",{version:Qt})}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>{He(null),Rt()},children:e("tab.viewHistory")}),(0,i.jsx)(b.Button,{size:"sm",onClick:()=>He(null),children:e("tab.dismiss")})]})]}),k?(0,i.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"alert",children:[(0,i.jsxs)("span",{className:"art-bar-text",children:[(0,i.jsx)("strong",{children:e("tab.conflictTitle")}),(0,i.jsx)("span",{children:e("tab.conflictHint")})]}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>void Et(h??"","action.copied"),children:e("tab.copyDraft")}),(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>ke(Je),children:e("tab.discardReload")})]})]}):null,!k&&S!==void 0?(0,i.jsxs)("div",{className:"art-bar","data-tone":"error",role:"alert",children:[(0,i.jsx)("span",{children:e(X(S))}),(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>void l.save(),children:e("action.retry")})]}):null,g===null?null:(0,i.jsxs)("div",{className:"art-bar",role:"status",children:[(0,i.jsx)("span",{children:e("tab.viewingOld",{version:g.version,current:u.version})}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(b.Button,{size:"sm",variant:"outline",onClick:()=>{++ce.current,x(!1),L(null),le(null)},children:e("tab.backToCurrent")}),(0,i.jsx)(b.Button,{size:"sm",variant:"outline",disabled:ne,onClick:()=>void pa(),children:e("tab.restoreThis")})]})]}),(0,i.jsxs)("div",{className:"art-body",children:[(0,i.jsxs)("div",{className:"art-stage",role:Te==="page"?"tabpanel":void 0,id:Te==="page"?"art-mode-"+d+"-"+E+"-panel":void 0,"aria-labelledby":Te==="page"?"art-mode-"+d+"-"+E:void 0,children:[Te!=="page"||Re===null||M?null:(0,i.jsx)(Ja,{quote:Re.text,askLabel:e("agent.ask"),dismissLabel:e("tab.dismiss"),onAsk:()=>void Pt(Re),onDismiss:()=>le(null)}),Te==="doc"?(0,i.jsx)(pt,{markdown:et,revision:(g?.version??0)+":"+f.revision,editable:!Ve&&!k,label:u.manifest.title,loadingLabel:e("empty.loading"),failedLabel:e("error.generic"),design:u.design,dark:y,t:e,onChange:p=>l.edit(p),onSave:()=>void l.save(),onSelectionText:It,selectionAction:Re===null?null:(0,i.jsx)(b.Button,{size:"sm",variant:"primary",icon:(0,i.jsx)(b.IconSparkleRegular,{size:14}),onMouseDown:p=>p.preventDefault(),onClick:()=>void Pt(Re),children:e("agent.ask")})}):E==="preview"?(0,i.jsx)(mt,{content:et,designCss:u.designCss,title:u.manifest.title,frameTitle:e("tab.frameTitle",{title:u.manifest.title}),dark:y,onSelectionText:It}):ya?(0,i.jsx)(Lr,{value:et,readOnly:!1,label:e("tab.source"),hint:e("tab.manualSave"),onChange:p=>l.edit(p),onSave:()=>void l.save(),onSelectionText:It}):(0,i.jsxs)("div",{className:"art-code",ref:Zt,children:[(0,i.jsxs)("div",{className:"art-code-bar",children:[(0,i.jsx)("span",{children:e(Ve?"tab.readOnly":"tab.codeHint")}),Ve?null:(0,i.jsx)(b.Button,{size:"sm",variant:"outline",icon:(0,i.jsx)(b.IconEditOutlineRegular,{size:14}),onClick:()=>Z(!0),children:e("tab.editSource")})]}),(0,i.jsx)(b.CodeBlock,{code:et,lang:"html",lineNumbers:!0,showHeader:!1,wrap:!0,className:"art-code-block",copyLabel:e("code.copy"),copiedLabel:e("action.copied")})]})]}),M?(0,i.jsx)(en,{label:e("history.title"),closeLabel:e("history.close"),overlay:$,onClose:tr,children:(0,i.jsx)(Ir,{t:e,versions:A,failed:V,current:u.version,selected:g?.version??u.version,onSelect:p=>void rr(p)})}):null]}),(0,i.jsx)(b.Modal,{open:St!==null,onClose:()=>Fe(null),title:e("tab.leaveTitle"),closeLabel:e("dialog.close"),description:e(k?"tab.conflictHint":"tab.leaveHint"),footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(b.Button,{variant:"outline",disabled:ne,onClick:()=>Fe(null),children:e("create.cancel")}),(0,i.jsx)(b.Button,{variant:"outline",disabled:w||ne,onClick:()=>{let p=St?.run;Fe(null),p!==void 0&&l.discardAndReload().then(p)},children:e("tab.discardContinue")}),(0,i.jsx)(b.Button,{variant:"primary",disabled:k||ne,onClick:async()=>{ye(!0);let p=await l.save();ye(!1);let C=St?.run;p&&C!==void 0&&(Fe(null),await C())},children:e("tab.saveContinue")})]}),children:S===void 0?null:(0,i.jsx)("p",{className:"art-modal-error",role:"alert",children:e(X(S))})}),(0,i.jsx)(b.Modal,{open:la,onClose:()=>Xe(!1),title:e("tab.deleteTitle"),closeLabel:e("dialog.close"),description:e("tab.deleteConfirm",{title:u.manifest.title}),footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(b.Button,{variant:"outline",onClick:()=>Xe(!1),children:e("create.cancel")}),(0,i.jsx)(b.Button,{variant:"primary",onClick:()=>{Xe(!1),ke(async()=>{try{await z.remove(m,d),pe(),a?.()}catch(p){W(e(X(Y(p))))}})},children:e("tab.delete")})]})}),(0,i.jsx)(b.Modal,{open:Xt!==null,onClose:()=>Ct(null),title:e("agent.copyTitle"),closeLabel:e("dialog.close"),description:e("action.copyFailed"),footer:(0,i.jsx)(b.Button,{variant:"primary",onClick:()=>Ct(null),children:e("dialog.done")}),children:(0,i.jsx)("textarea",{className:"art-fallback",readOnly:!0,value:Xt??"","aria-label":e("agent.copyTitle"),onFocus:p=>p.currentTarget.select()})})]})}var Br=Ea(require("react"),1),Fr=require("@deepseek-ai/dsh-client-ui-primitives"),Ce=require("react/jsx-runtime"),gt=class extends Br.default.Component{constructor(t){super(t),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,Ce.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",children:(0,Ce.jsxs)("div",{className:"art-center",role:"alert",children:[(0,Ce.jsx)("p",{className:"art-center-title",children:this.props.title}),(0,Ce.jsx)("p",{className:"art-center-hint",children:this.props.hint}),(0,Ce.jsx)(Fr.Button,{size:"sm",variant:"outline",onClick:()=>window.location.reload(),children:this.props.reloadLabel})]})}):this.props.children}};var ht=require("react"),Oe=require("@deepseek-ai/dsh-client-ui-primitives");var yo=require("react"),B=require("react/jsx-runtime");function bt({children:e,size:t=16}){return(0,B.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 yt=({size:e})=>(0,B.jsxs)(bt,{size:e,children:[(0,B.jsx)("rect",{x:"3.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,B.jsx)("rect",{x:"13.5",y:"3.5",width:"7",height:"7",rx:"1.5"}),(0,B.jsx)("rect",{x:"3.5",y:"13.5",width:"7",height:"7",rx:"1.5"}),(0,B.jsx)("path",{d:"M17 13.5v7M13.5 17h7"})]}),se=({size:e})=>(0,B.jsxs)(bt,{size:e,children:[(0,B.jsx)("rect",{x:"3.5",y:"4.5",width:"17",height:"15",rx:"2"}),(0,B.jsx)("path",{d:"M3.5 8.5h17M9 13l-2 1.8L9 16.5M15 13l2 1.8-2 1.7"})]}),fe=({size:e})=>(0,B.jsxs)(bt,{size:e,children:[(0,B.jsx)("path",{d:"M6.5 3.5h7l4 4v13h-11z"}),(0,B.jsx)("path",{d:"M13.5 3.5v4h4M9 12h6M9 15.5h6"})]}),Hr=({size:e})=>(0,B.jsxs)(bt,{size:e,children:[(0,B.jsx)("path",{d:"M20.5 12a8.5 8.5 0 1 1-8.5-8.5c4.7 0 8.5 3.4 8.5 7.6 0 2.1-1.7 3.8-3.8 3.8h-1.4c-1 0-1.9.8-1.9 1.8 0 .8.5 1.3.5 2.1 0 1-.7 1.7-1.9 1.7Z"}),(0,B.jsx)("circle",{cx:"7.6",cy:"10",r:"1.1",fill:"currentColor",stroke:"none"}),(0,B.jsx)("circle",{cx:"10",cy:"6.8",r:"1.1",fill:"currentColor",stroke:"none"}),(0,B.jsx)("circle",{cx:"14",cy:"7",r:"1.1",fill:"currentColor",stroke:"none"}),(0,B.jsx)("circle",{cx:"17",cy:"10.2",r:"1.1",fill:"currentColor",stroke:"none"})]});var me={sidebarRight:null,layout:null};var R=require("react/jsx-runtime");function rn(e){if(e===null||typeof e!="object")return null;let t={...e},{id:r,type:a,title:n,version:o,workspaceId:s}=t;if(t.kind!=="artifact"||typeof r!="string"||typeof n!="string"||typeof o!="number"||a!=="page"&&a!=="doc")return null;let l=cr(r);return l===void 0?null:l==="workspace"?typeof s!="string"||s===""?null:{id:r,type:a,title:n,version:o,address:{scope:l,workspaceId:s,id:r}}:{id:r,type:a,title:n,version:o,address:{scope:l,id:r}}}function an(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
|
|
38
|
+
${t}`}var Pr=require("react"),Mr="data-ds-dark-theme";function fo(){return typeof document<"u"&&document.body?.hasAttribute(Mr)===!0}function mo(e){if(typeof document>"u"||document.body===null)return()=>{};let t=new MutationObserver(e);return t.observe(document.body,{attributes:!0,attributeFilter:[Mr]}),()=>t.disconnect()}function Ye(){return(0,Pr.useSyncExternalStore)(mo,fo,()=>!1)}var i=require("react/jsx-runtime");function He({label:e,icon:t,onClick:a,pressed:r,disabled:n,buttonRef:o}){return(0,i.jsx)(h.Tooltip,{label:e,side:"bottom",portal:!0,children:(0,i.jsx)(h.Button,{ref:o,size:"sm",className:"art-icon-button","aria-label":e,"aria-pressed":r,disabled:n,onClick:a,children:t})})}function go({quote:e,askLabel:t,dismissLabel:a,onAsk:r,onDismiss:n}){return(0,i.jsxs)("div",{className:"art-selection-bar",role:"toolbar","aria-label":t,children:[(0,i.jsx)("span",{className:"art-selection-quote",title:e,children:e}),(0,i.jsx)(h.Button,{size:"sm",variant:"primary",icon:(0,i.jsx)(h.IconSparkleRegular,{size:14}),onClick:r,children:t}),(0,i.jsx)(He,{label:a,icon:(0,i.jsx)(h.IconCloseOutlineRegular,{size:14}),onClick:n})]})}function yo({t:e,layer:t,askLabel:a,dismissLabel:r,onAsk:n,onDismiss:o}){let l=pa(e,t.type);return(0,i.jsxs)("div",{className:"art-selection-bar art-layer-bar",role:"toolbar","aria-label":a,children:[(0,i.jsx)("span",{className:"art-layer-bar-glyph","aria-hidden":"true",children:Dt(t.type)}),(0,i.jsxs)("span",{className:"art-layer-bar-text",children:[(0,i.jsx)("span",{className:"art-layer-bar-name",title:t.name,children:t.name}),(0,i.jsx)("span",{className:"art-layer-bar-sub",children:t.parentName===""?l:e("layer.parentLine",{type:l,parent:t.parentName})})]}),(0,i.jsx)(h.Button,{size:"sm",variant:"primary",icon:(0,i.jsx)(h.IconSparkleRegular,{size:14}),onClick:n,children:a}),(0,i.jsx)(He,{label:r,icon:(0,i.jsx)(h.IconCloseOutlineRegular,{size:14}),onClick:o})]})}function bo({label:e,closeLabel:t,overlay:a,onClose:r,head:n,children:o}){let l=(0,k.useRef)(null);return(0,k.useEffect)(()=>{l.current?.querySelector("[data-drawer-initial]")?.focus()??l.current?.querySelector(".art-version, button")?.focus()},[e]),(0,k.useEffect)(()=>{if(!a)return;let s=g=>{let d=l.current;d===null||g.target instanceof Node&&d.contains(g.target)||d.querySelector("button")?.focus()};return document.addEventListener("focusin",s),()=>document.removeEventListener("focusin",s)},[a]),(0,i.jsxs)("div",{className:"art-drawer-layer","data-overlay":a?"true":void 0,children:[a?(0,i.jsx)("div",{className:"art-drawer-scrim","aria-hidden":"true",onPointerDown:r}):null,(0,i.jsxs)("aside",{ref:l,className:"art-drawer",role:"dialog","aria-modal":a?"true":void 0,"aria-label":e,onKeyDown:s=>{if(s.key==="Escape"){s.preventDefault(),s.stopPropagation(),r();return}if(s.key!=="Tab"||!a)return;let g=[...l.current?.querySelectorAll("button:not(:disabled)")??[]],d=g[0],b=g[g.length-1];d===void 0||b===void 0||(s.shiftKey&&document.activeElement===d?(s.preventDefault(),b.focus()):!s.shiftKey&&document.activeElement===b&&(s.preventDefault(),d.focus()))},children:[(0,i.jsxs)("div",{className:"art-drawer-head",children:[n??(0,i.jsx)("h2",{children:e}),(0,i.jsx)(He,{label:t,icon:(0,i.jsx)(h.IconCloseOutlineRegular,{size:14}),onClick:r})]}),(0,i.jsx)("div",{className:"art-drawer-body",children:o})]})]})}function ba(e){let t=e.useTabInfo(),a=Ee(t.tab.contentId??t.tab.navigation?.address),r=e.useWorkspaces(n=>n.items.find(o=>a?.scope==="workspace"&&o.workspaceId===a.workspaceId)?.title);return a===void 0?(0,i.jsx)("section",{className:"art-root",children:(0,i.jsx)("p",{className:"art-note",children:e.t("error.notFound")})}):(0,i.jsx)(Or,{t:e.t,address:a,useTabInfo:e.useTabInfo,onBack:t.tab.actions?.close,workspaceName:r,inputActions:e.inputActions},q(a))}function Lr({t:e,address:t,onBack:a,workspaceName:r}){return(0,i.jsx)(Or,{t:e,address:t,onBack:a,workspaceName:r,back:!0},q(t))}var ho=()=>{};function Or({t:e,address:t,useTabInfo:a,onBack:r,workspaceName:n,back:o,inputActions:l}){let{model:s,state:g}=tr(t),{payload:d,draft:b,saving:T,conflict:w,failure:c,failureMessage:u}=g,p=s.where,y=t.id,z=Ye(),[N,j]=(0,k.useState)("view"),[D,_]=(0,k.useState)(!1),[C,L]=(0,k.useState)(!1),[B,I]=(0,k.useState)(!1),[H,W]=(0,k.useState)("layers"),[V,Pe]=(0,k.useState)(null),[R,S]=(0,k.useState)(null),[G,ae]=(0,k.useState)([]),[Me,ft]=(0,k.useState)(null),[mt,$t]=(0,k.useState)(0),[Wt,ln]=(0,k.useState)(!1),[Ca,Gt]=(0,k.useState)(null),[cn,Ia]=(0,k.useState)(!1),[Ze,Le]=(0,k.useState)(!1),[re,Ue]=(0,k.useState)(null),[be,oe]=(0,k.useState)(null),[dn,gt]=(0,k.useState)(!1),[qt,Ea]=(0,k.useState)(""),[Kt,Je]=(0,k.useState)(null),[pn,yt]=(0,k.useState)(!1),[ue,Ie]=(0,k.useState)(!1),[$e,he]=(0,k.useState)(null),[Ra,Yt]=(0,k.useState)(null),[Aa,et]=(0,k.useState)(null),ve=(0,k.useRef)(0),bt=(0,k.useRef)(null),za=(0,k.useRef)(null),Da=(0,k.useRef)(null),Qt=(0,k.useRef)(!1),ht=Za(y),Pa=(a??ho)();(0,k.useEffect)(()=>{d!==null&&ht>d.version&&b===null&&!T&&!w&&et(ht),s.externalVersion(ht)},[ht,s,T,d?.version,b,w]),(0,k.useEffect)(()=>{w&&et(null)},[w]),(0,k.useEffect)(()=>{he(null),ae([])},[d?.version,re?.version,g.revision]),(0,k.useEffect)(()=>{if(V===null){S(null);return}return S(V.getSnapshot()),V.subscribe(S)},[V]);let Ma=re!==null;(0,k.useEffect)(()=>{Ma&&N==="edit"&&(j("view"),I(!1))},[Ma,N]);let un=d!==null,We=(0,k.useCallback)(()=>{let f=bt.current,A=f===null?0:f.clientWidth;ln(A>0?A<=600:window.innerWidth<=600)},[]);(0,k.useEffect)(()=>{let f=bt.current;if(f===null)return;We();let A=new ResizeObserver(We);return A.observe(f),window.addEventListener("resize",We),()=>{A.disconnect(),window.removeEventListener("resize",We)}},[un,We]);let Oe=(0,k.useCallback)(f=>{s.getSnapshot().draft!==null||s.getSnapshot().saving?Je({run:f}):f()},[s]),Xt=(0,k.useCallback)(()=>{++ve.current,Le(!1),Ue(null),he(null),oe(null),et(null)},[]),vt=(0,k.useCallback)(async()=>{Xt(),await s.discardAndReload()},[s,Xt]);(0,k.useEffect)(()=>Pa?.tab.actions?.bindCommands({refresh:()=>Oe(vt)}),[Pa?.tab.actions,Oe,vt]),(0,k.useEffect)(()=>{if(d?.manifest.type!=="doc"||b===null||w||T)return;let f=setTimeout(()=>void s.save(),1200);return()=>clearTimeout(f)},[b,w,T,s,d?.manifest.type]),(0,k.useEffect)(()=>{if(!C||d===null)return;let f=new AbortController;return Gt(null),Ia(!1),U.history(p,y,f.signal).then(A=>{f.signal.aborted||Gt(A.versions)}).catch(()=>{f.signal.aborted||Ia(!0)}),()=>f.abort()},[C,d?.version,s]),(0,k.useEffect)(()=>()=>{++ve.current},[]),(0,k.useEffect)(()=>{if(C){Qt.current=!0;return}Qt.current&&(Qt.current=!1,Da.current?.focus())},[C]),(0,k.useEffect)(()=>{if(N!=="source"||d?.manifest.type!=="page")return;let f=()=>{let A=za.current,te=window.getSelection();if(A===null||te===null||te.anchorNode===null||!A.contains(te.anchorNode))return;let rt=ma(te.toString());he(rt.text===""?null:rt)};return document.addEventListener("selectionchange",f),()=>document.removeEventListener("selectionchange",f)},[N,d?.manifest.type]);let fn=(0,k.useCallback)(f=>Pe(f),[]),mn=(0,k.useCallback)(f=>ae(f),[]),gn=(0,k.useCallback)(f=>ft(f),[]),yn=()=>I(!1),La=()=>{++ve.current,Le(!1),Ue(null),L(!1)},Zt=()=>{We(),++ve.current,Le(!1),Ue(null),oe(null),I(!1),L(!0)},Oa=async f=>{let A=++ve.current;if(oe(null),he(null),f===d?.version){Le(!1),Ue(null);return}Le(!0);try{let te=await U.get(p,y,f);A===ve.current&&Ue(te)}catch(te){A===ve.current&&Q(e(J(Z(te))))}finally{A===ve.current&&Le(!1)}},Fa=async()=>Ze?null:re!==null?re.version:await s.save()?s.getSnapshot().payload?.version??null:null,ja=async f=>{if(!ue){Ie(!0);try{let A=await Fa();if(A===null)return;if(f==="print")Ir((await U.printable(p,y,A)).html);else{let te=await U.exportFile(p,y,f,A);Ya(te),Q(e("export.done",{name:te.fileName,path:te.path}))}}catch(A){Q(e(J(Z(A))))}finally{Ie(!1)}}},bn=async()=>{qt.trim()===""||T||await s.save(qt.trim())&>(!1)},hn=async()=>{if(re===null||ue)return;let f=re.version;Oe(async()=>{Ie(!0);try{let A=await U.restore(p,y,f,s.getSnapshot().payload?.version??0);je(y,A.manifest.version),we(),Xt(),await s.load()}catch(A){Q(e(J(Z(A))))}finally{Ie(!1)}})},Jt=async(f,A)=>{try{await navigator.clipboard.writeText(f),Q(e(A))}catch{Yt(f)}},tt=async(f,A="agent.addedTruncated")=>{if(!(ue||w||Ze||d===null)){Ie(!0);try{let te=await Fa();if(te===null)return;let rt=s.getSnapshot().payload??d,aa=Dr(e,{title:rt.manifest.title,id:y,version:te,current:rt.version}),xt=f?.text??"";if(he(null),ae([]),V?.clearSelection(),l===void 0){await Jt(ya(xt,aa),"agent.copied");return}if((xt===""||l.insertQuote(xt))&&l.insertText(aa,l.captureInsertion())){Q(e(f?.truncated===!0?A:"agent.added"));return}await Jt(ya(xt,aa),"agent.insertFailed")}finally{Ie(!1)}}},ea=(0,k.useCallback)(f=>{let A=ma(f);he(A.text===""?null:A)},[]),vn=async()=>{if(be==="version"){oe(null);return}if(d!==null){try{let f=await U.history(p,y);Gt(f.versions)}catch(f){Q(e(J(Z(f))));return}oe("version")}};if(d===null)return(0,i.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",ref:bt,children:(0,i.jsxs)("div",{className:"art-center",role:c===void 0?"status":"alert",children:[(0,i.jsx)("p",{className:"art-center-hint",children:e(c===void 0?"empty.loading":J(c))}),(0,i.jsxs)("div",{className:"art-center-actions",children:[c===void 0?null:(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>void s.load(),children:e("action.retry")}),r===void 0?null:(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:r,children:e("tab.close")})]})]})});let Y=d.manifest.type,at=re?.content??b??d.content,ce=re!==null,ta=re?.version??d.version,xn=e(T?"tab.saving":w?"tab.conflictTitle":Ze?"empty.loading":re!==null?"tab.readOnly":c!==void 0?"tab.saveFailed":b!==null?"tab.unsaved":"tab.saved"),wn=w||c!==void 0&&!T?"error":T?"warn":void 0,kn=t.scope==="workspace"?n??t.workspaceId:e("scope.library"),Tn=N==="source"&&!ce&&(D||b!==null),Ba=[..._a[Y].map(f=>({id:f,label:e(`export.${f}`)})),...Y==="design"?[]:[{type:"separator",id:"export-gap"},{id:"print",label:e("export.print")}]],Ha=f=>{oe(null),ja(f==="print"?"print":f)},Sn=[...Wt?[...Ba,{type:"separator",id:"more-gap"}]:[],{id:"rename",label:e("tab.rename")},{id:"reload",label:e("tab.reload")},{type:"separator",id:"danger-gap"},{id:"delete",label:e("tab.delete"),danger:!0}],Nn=f=>{oe(null),f==="rename"?(Ea(d.manifest.title),gt(!0)):f==="reload"?Oe(vt):f==="delete"?yt(!0):Ha(f)},Cn=[...(Ca??[]).map(f=>({id:"v"+f.version,label:e("tab.versionOf",{version:f.version})+(f.version===d.version?" \xB7 "+e("tab.currentVersion"):"")})),{type:"separator",id:"versions-gap"},{id:"all",label:e("tab.allVersions")}],In=f=>{oe(null),f==="all"?Zt():Oa(Number(f.slice(1)))},En=(0,i.jsx)(h.Button,{size:"sm",variant:"primary",className:"art-ask",icon:(0,i.jsx)(h.IconSparkleRegular,{size:14}),disabled:ue||w||Ze,onClick:()=>{if(Y==="design"){let f=V?.quoteSelection();if(f!=null){tt(ga(e,f),"agent.addedTruncatedDesign");return}}tt($e)},children:e("agent.ask")});return(0,i.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"","data-artifact-id":y,"aria-busy":ue,ref:bt,children:[(0,i.jsxs)("header",{className:"art-header art-editor-header",children:[(0,i.jsxs)("div",{className:"art-heading",children:[!o||r===void 0?null:(0,i.jsx)(He,{label:e("action.back"),icon:(0,i.jsx)(h.IconChevronLeftOutlineRegular,{size:16}),onClick:()=>Oe(r)}),(0,i.jsxs)("div",{className:"art-identity",children:[(0,i.jsx)("h1",{className:"art-title",title:d.manifest.title,children:d.manifest.title}),(0,i.jsxs)("div",{className:"art-meta",children:[(0,i.jsxs)("span",{className:"art-meta-text",children:[kn,t.scope==="workspace"?" \xB7 "+e("scope.workspace"):null]}),(0,i.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,i.jsx)(h.Menu,{open:be==="version",onClose:()=>oe(null),items:Cn,onSelect:In,portal:!0,autoFocus:!0,anchor:(0,i.jsxs)("button",{type:"button",className:"art-version-button","aria-label":e("tab.versionPicker"),"aria-haspopup":"menu","aria-expanded":be==="version",onClick:()=>void vn(),children:[e("gallery.version",{version:ta}),(0,i.jsx)(h.IconChevronDownOutlineRegular,{size:12})]})}),(0,i.jsx)("span",{className:"art-meta-dot","aria-hidden":"true",children:"\xB7"}),(0,i.jsx)("span",{className:"art-save-status","data-tone":wn,"aria-live":"polite",children:xn})]})]})]}),(0,i.jsxs)("div",{className:"art-actions art-editor-actions",children:[Y==="doc"?null:(0,i.jsx)(h.SegmentedControl,{id:"art-mode-"+y,className:"art-segment",label:e("tab.mode"),value:N,options:Y==="design"?[{value:"view",label:e("canvas.viewMode")},{value:"edit",label:e("canvas.editMode"),disabled:ce,title:ce?e("canvas.editOldVersion"):void 0},{value:"source",label:e("tab.source")}]:[{value:"view",label:e("tab.preview")},{value:"source",label:e("tab.source")}],onChange:f=>{j(f),he(null),I(Y==="design"&&f==="edit"&&!ce)}}),Y==="design"&&N==="edit"&&!ce?(0,i.jsx)(He,{label:e("canvas.inspector"),icon:(0,i.jsx)(h.IconSlidersTwoOutlineRegular,{size:16}),pressed:B,onClick:()=>{B?I(!1):(L(!1),I(!0))}}):null,b===null||ce?null:(0,i.jsx)(He,{label:e("tab.save"),icon:(0,i.jsx)(h.IconSaveOutlineRegular,{size:16}),disabled:w,onClick:()=>void s.save()}),(0,i.jsx)(He,{buttonRef:Da,label:e("tab.history"),icon:(0,i.jsx)(h.IconClockOutlineRegular,{size:16}),pressed:C,onClick:()=>{C?La():Zt()}}),Wt?null:(0,i.jsx)(h.Menu,{open:be==="export",onClose:()=>oe(null),items:Ba,onSelect:Ha,align:"end",portal:!0,autoFocus:!0,anchor:(0,i.jsx)(h.Button,{size:"sm",icon:(0,i.jsx)(h.IconDownloadOutlineRegular,{size:14}),"aria-label":e("tab.export"),"aria-haspopup":"menu","aria-expanded":be==="export",disabled:ue||Ze,onClick:()=>oe(be==="export"?null:"export"),children:e("tab.export")})}),En,(0,i.jsx)(h.Menu,{open:be==="more",onClose:()=>oe(null),items:Sn,onSelect:Nn,align:"end",portal:!0,autoFocus:!0,anchor:(0,i.jsx)(h.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.more"),"aria-haspopup":"menu","aria-expanded":be==="more",onClick:()=>oe(be==="more"?null:"more"),children:(0,i.jsx)(h.IconEllipsisOutlineRegular,{size:14})})})]})]}),dn?(0,i.jsxs)("form",{className:"art-inline-form",onSubmit:f=>{f.preventDefault(),bn()},children:[(0,i.jsx)("input",{"aria-label":e("tab.rename"),value:qt,maxLength:120,autoFocus:!0,onChange:f=>Ea(f.target.value),onKeyDown:f=>{f.key==="Escape"&>(!1)}}),(0,i.jsx)(h.Button,{type:"submit",size:"sm",variant:"primary",disabled:T||w,children:e("tab.save")}),(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>gt(!1),children:e("create.cancel")})]}):null,Aa===null?null:(0,i.jsxs)("div",{className:"art-bar",role:"status",children:[(0,i.jsx)("span",{children:e("tab.agentUpdate",{version:Aa})}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>{et(null),Zt()},children:e("tab.viewHistory")}),(0,i.jsx)(h.Button,{size:"sm",onClick:()=>et(null),children:e("tab.dismiss")})]})]}),w?(0,i.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"alert",children:[(0,i.jsxs)("span",{className:"art-bar-text",children:[(0,i.jsx)("strong",{children:e("tab.conflictTitle")}),(0,i.jsx)("span",{children:e("tab.conflictHint")})]}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>void Jt(b??"","action.copied"),children:e("tab.copyDraft")}),(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>Oe(vt),children:e("tab.discardReload")})]})]}):null,!w&&c!==void 0?(0,i.jsxs)("div",{className:"art-bar","data-tone":"error",role:"alert",children:[(0,i.jsx)("span",{children:u??e(J(c))}),(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>void s.save(),children:e("action.retry")})]}):null,re===null?null:(0,i.jsxs)("div",{className:"art-bar",role:"status",children:[(0,i.jsx)("span",{children:e("tab.viewingOld",{version:re.version,current:d.version})}),(0,i.jsxs)("span",{className:"art-bar-actions",children:[(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>{++ve.current,Le(!1),Ue(null),he(null)},children:e("tab.backToCurrent")}),(0,i.jsx)(h.Button,{size:"sm",variant:"outline",disabled:ue,onClick:()=>void hn(),children:e("tab.restoreThis")})]})]}),Y!=="design"||Me===null?null:(0,i.jsxs)("div",{className:"art-bar","data-tone":"error",role:"alert",children:[(0,i.jsx)("span",{children:e("canvas.startFailed")}),(0,i.jsx)("span",{className:"art-bar-actions",children:(0,i.jsx)(h.Button,{size:"sm",variant:"outline",onClick:()=>{ft(null),$t(f=>f+1)},children:e("action.retry")})})]}),(0,i.jsxs)("div",{className:"art-body",children:[(0,i.jsxs)("div",{className:"art-stage",role:Y==="doc"?void 0:"tabpanel",id:Y==="doc"?void 0:"art-mode-"+y+"-"+N+"-panel","aria-labelledby":Y==="doc"?void 0:"art-mode-"+y+"-"+N,children:[Y==="page"&&$e!==null&&!C?(0,i.jsx)(go,{quote:$e.text,askLabel:e("agent.ask"),dismissLabel:e("tab.dismiss"),onAsk:()=>void tt($e),onDismiss:()=>he(null)}):null,Y==="design"&&N!=="source"&&!ce&&G[0]!==void 0?(0,i.jsx)(yo,{t:e,layer:G[0],askLabel:e("agent.ask"),dismissLabel:e("tab.dismiss"),onAsk:()=>{let f=V?.quoteSelection();f!=null&&tt(ga(e,f),"agent.addedTruncatedDesign")},onDismiss:()=>V?.clearSelection()}):null,Y==="doc"?(0,i.jsx)(Pt,{markdown:at,revision:(re?.version??0)+":"+g.revision,editable:!ce&&!w,label:d.manifest.title,loadingLabel:e("empty.loading"),failedLabel:e("error.generic"),design:d.design,dark:z,t:e,onChange:f=>s.edit(f),onSave:()=>void s.save(),onSelectionText:ea,selectionAction:$e===null?null:(0,i.jsx)(h.Button,{size:"sm",variant:"primary",icon:(0,i.jsx)(h.IconSparkleRegular,{size:14}),onMouseDown:f=>f.preventDefault(),onClick:()=>void tt($e),children:e("agent.ask")})}):N!=="source"?Y==="design"?ce?(0,i.jsx)(ua,{t:e,where:p,id:y,version:ta,title:d.manifest.title}):(0,i.jsx)(br,{t:e,source:at,revision:"0:"+g.revision,title:d.manifest.title,mode:N==="edit"?"edit":"view",onChange:f=>s.edit(f),onSave:()=>void s.save(),onFailure:gn,onHandle:fn,onSelection:mn,attempt:mt,fallback:(0,i.jsx)(ua,{t:e,where:p,id:y,version:ta,title:d.manifest.title})}):(0,i.jsx)(Ot,{content:at,designCss:d.designCss,title:d.manifest.title,frameTitle:e("tab.frameTitle",{title:d.manifest.title}),dark:z,onSelectionText:ea}):Tn?(0,i.jsx)(zr,{value:at,readOnly:!1,label:e("tab.source"),hint:e(Y==="design"?"tab.manualSaveDesign":"tab.manualSave"),onChange:f=>s.edit(f),onSave:()=>void s.save(),onSelectionText:ea}):(0,i.jsxs)("div",{className:"art-code",ref:za,children:[(0,i.jsxs)("div",{className:"art-code-bar",children:[(0,i.jsx)("span",{children:e(ce?"tab.readOnly":"tab.codeHint")}),ce?null:(0,i.jsx)(h.Button,{size:"sm",variant:"outline",icon:(0,i.jsx)(h.IconEditOutlineRegular,{size:14}),onClick:()=>_(!0),children:e("tab.editSource")})]}),(0,i.jsx)(h.CodeBlock,{code:at,lang:Y==="design"?"jsx":"html",lineNumbers:!0,showHeader:!1,wrap:!0,className:"art-code-block",copyLabel:e("code.copy"),copiedLabel:e("action.copied")})]})]}),!C&&!B?null:(0,i.jsx)(bo,{label:e(C?"history.title":"canvas.inspector"),closeLabel:e(C?"history.close":"canvas.closeInspector"),overlay:Wt,onClose:C?La:yn,head:C?void 0:(0,i.jsx)(h.SegmentedTabs,{className:"art-inspector-tabs",items:[{value:"layers",label:e("panel.layers"),id:"art-inspector-"+y+"-layers-tab",panelId:"art-inspector-"+y+"-layers"},{value:"properties",label:e("panel.properties"),id:"art-inspector-"+y+"-properties-tab",panelId:"art-inspector-"+y+"-properties"}],value:H,onChange:W,label:e("canvas.inspectorTabs"),size:"sm"}),children:C?(0,i.jsx)(Ar,{t:e,versions:Ca,failed:cn,current:d.version,selected:re?.version??d.version,onSelect:f=>void Oa(f)}):(0,i.jsx)("div",{className:"art-inspector",role:"tabpanel",id:"art-inspector-"+y+"-"+H,"aria-labelledby":"art-inspector-"+y+"-"+H+"-tab",children:(0,i.jsx)(hr,{t:e,handle:V,snapshot:R,tab:H})})})]}),(0,i.jsx)(h.Modal,{open:Kt!==null,onClose:()=>Je(null),title:e("tab.leaveTitle"),closeLabel:e("dialog.close"),description:e(w?"tab.conflictHint":"tab.leaveHint"),footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(h.Button,{variant:"outline",disabled:ue,onClick:()=>Je(null),children:e("create.cancel")}),(0,i.jsx)(h.Button,{variant:"outline",disabled:T||ue,onClick:()=>{let f=Kt?.run;Je(null),f!==void 0&&s.discardAndReload().then(f)},children:e("tab.discardContinue")}),(0,i.jsx)(h.Button,{variant:"primary",disabled:w||ue,onClick:async()=>{Ie(!0);let f=await s.save();Ie(!1);let A=Kt?.run;f&&A!==void 0&&(Je(null),await A())},children:e("tab.saveContinue")})]}),children:c===void 0?null:(0,i.jsx)("p",{className:"art-modal-error",role:"alert",children:u??e(J(c))})}),(0,i.jsx)(h.Modal,{open:pn,onClose:()=>yt(!1),title:e("tab.deleteTitle"),closeLabel:e("dialog.close"),description:e("tab.deleteConfirm",{title:d.manifest.title}),footer:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(h.Button,{variant:"outline",onClick:()=>yt(!1),children:e("create.cancel")}),(0,i.jsx)(h.Button,{variant:"primary",onClick:()=>{yt(!1),Oe(async()=>{try{await U.remove(p,y),we(),r?.()}catch(f){Q(e(J(Z(f))))}})},children:e("tab.delete")})]})}),(0,i.jsx)(h.Modal,{open:Ra!==null,onClose:()=>Yt(null),title:e("agent.copyTitle"),closeLabel:e("dialog.close"),description:e("action.copyFailed"),footer:(0,i.jsx)(h.Button,{variant:"primary",onClick:()=>Yt(null),children:e("dialog.done")}),children:(0,i.jsx)("textarea",{className:"art-fallback",readOnly:!0,value:Ra??"","aria-label":e("agent.copyTitle"),onFocus:f=>f.currentTarget.select()})})]})}var Fr=Ln(require("react"),1),jr=require("@deepseek-ai/dsh-client-ui-primitives"),Ve=require("react/jsx-runtime"),Ft=class extends Fr.default.Component{constructor(t){super(t),this.state={failed:!1}}static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,Ve.jsx)("section",{className:"art-root","data-dsh-artifact-studio":"",children:(0,Ve.jsxs)("div",{className:"art-center",role:"alert",children:[(0,Ve.jsx)("p",{className:"art-center-title",children:this.props.title}),(0,Ve.jsx)("p",{className:"art-center-hint",children:this.props.hint}),(0,Ve.jsx)(jr.Button,{size:"sm",variant:"outline",onClick:()=>window.location.reload(),children:this.props.reloadLabel})]})}):this.props.children}};var jt=require("react"),Qe=require("@deepseek-ai/dsh-client-ui-primitives");var Se={sidebarRight:null,layout:null};var M=require("react/jsx-runtime");function vo(e){if(e===null||typeof e!="object")return null;let t={...e},{id:a,type:r,title:n,version:o,workspaceId:l}=t;if(t.kind!=="artifact"||typeof a!="string"||typeof n!="string"||typeof o!="number"||r!=="page"&&r!=="doc"&&r!=="design")return null;let s=Ua(a);return s===void 0?null:s==="workspace"?typeof l!="string"||l===""?null:{id:a,type:r,title:n,version:o,address:{scope:s,workspaceId:l,id:a}}:{id:a,type:r,title:n,version:o,address:{scope:s,id:a}}}function xo(e){return Array.isArray(e)?e.map(t=>{if(t===null||typeof t!="object")return"";let a={...t};return a.type==="text"&&typeof a.text=="string"?a.text:""}).filter(t=>t!=="").join(`
|
|
39
|
+
`).trim():""}function wo(e){if(e===null||typeof e!="object")return;let t={...e};return typeof t.title=="string"&&t.title.trim()!==""?t.title.trim():void 0}var Br=new Set;function ha({t:e,phase:t,toolName:a,block:r}){let n=t==="result"&&r?.isError!==!0?vo(r?.meta):null,o=(0,jt.useRef)(t!=="result");t!=="result"&&(o.current=!0);let l=a==="artifact_update";if((0,jt.useEffect)(()=>{if(n===null)return;xe(n.id,n.title),je(n.id,n.version),we();let g=n.id+":"+n.version;!o.current||Br.has(g)||(Br.add(g),Se.sidebarRight?.openResource(q(n.address)))},[n?.id,n?.version,n?.title]),t!=="result"){let g=wo(r?.args),d=g===void 0?e(l?"card.updatingUntitled":"card.working"):e(l?"card.updating":"card.creating",{title:g});return(0,M.jsxs)("div",{className:"art-card","data-artifact-card":"working",children:[(0,M.jsx)("span",{className:"art-card-icon",children:(0,M.jsx)(fe,{})}),(0,M.jsx)("span",{className:"art-card-text",children:(0,M.jsx)(Qe.TextShimmer,{active:!0,className:"art-card-title",children:(0,M.jsx)("span",{role:"status",children:d})})}),(0,M.jsx)(Qe.StateDot,{state:"ongoing"})]})}if(r?.isError===!0)return(0,M.jsxs)("div",{className:"art-card","data-artifact-card":"error",children:[(0,M.jsx)("span",{className:"art-card-icon","data-tone":"error",children:(0,M.jsx)(fe,{})}),(0,M.jsxs)("span",{className:"art-card-text",children:[(0,M.jsx)("span",{className:"art-card-title",children:e("card.failed")}),(0,M.jsx)("span",{className:"art-card-sub","data-tone":"error",children:xo(r.content)})]})]});if(n===null)return(0,M.jsxs)("div",{className:"art-card","data-artifact-card":"missing",children:[(0,M.jsx)("span",{className:"art-card-icon",children:(0,M.jsx)(fe,{})}),(0,M.jsx)("span",{className:"art-card-sub",children:e("card.missing")})]});let s=q(n.address);return(0,M.jsxs)("button",{type:"button",className:"art-card art-card-open","data-artifact-card":"ready","data-artifact-id":n.id,"aria-label":e("card.openNamed",{title:n.title}),onClick:()=>Se.sidebarRight?.openResource(s),children:[(0,M.jsx)("span",{className:"art-card-icon",children:n.type==="page"?(0,M.jsx)(fe,{}):n.type==="doc"?(0,M.jsx)(Te,{}):(0,M.jsx)(Be,{})}),(0,M.jsxs)("span",{className:"art-card-text",children:[(0,M.jsx)("span",{className:"art-card-title",title:n.title,children:n.title}),(0,M.jsxs)("span",{className:"art-card-sub",children:[e(l?"card.updated":"card.created")," \xB7 ",e(`type.${n.type}`)," \xB7 ",e("gallery.version",{version:n.version}),n.address.scope==="library"?" \xB7 "+e("scope.library"):""]})]}),(0,M.jsx)("span",{className:"art-card-go","aria-hidden":"true",children:(0,M.jsx)(Qe.IconChevronRightOutlineRegular,{size:14})})]})}var dt=require("react"),Bt=require("@deepseek-ai/dsh-client-ui-primitives");var Hr=require("react");function Vr({sessionId:e,useSessions:t,useWorkspaces:a}){let r=a(o=>o.items),n=t(o=>o.byId[e]);return(0,Hr.useMemo)(()=>{let o=typeof n?.cwd=="string"?n.cwd:null,l=r.find(s=>s.sessionIds?.includes(e))??r.find(s=>o!==null&&(o===s.path||o.startsWith(`${s.path}/`)))??null;return{root:o??l?.path??null,workspaceId:l?.workspaceId??null}},[r,n,e])}var ct="dsh-artifact-studio/artifact",va="artifact",Xe="dsh-artifact-studio-panel";var ze=require("react/jsx-runtime"),ko=6,xa=["dashboard","explainer","report","brief"];function To(e,t){let a=e.filter(n=>n.source.sessionId===t),r=e.filter(n=>n.source.sessionId!==t);return[...a,...r].slice(0,ko)}function _r(e){let{t,sessionId:a,inputActions:r}=e,o=Vr(e).workspaceId,l=Rt(),[s,g]=(0,dt.useState)(!1),[d,b]=(0,dt.useState)(null);(0,dt.useEffect)(()=>{if(!s||o===null)return;let u=new AbortController;return U.list({scope:"workspace",workspaceId:o},{},u.signal).then(p=>{u.signal.aborted||b(To(p.items,a))}).catch(()=>{u.signal.aborted||b([])}),()=>u.abort()},[s,o,a,l]);let T=o===null?[{type:"label",id:"no-workspace",text:t("empty.noWorkspace")}]:d===null?[{type:"label",id:"loading",text:t("empty.loading")}]:d.length===0?[{type:"label",id:"empty",text:t("composer.empty")}]:d.map(u=>({id:"open:"+u.id,label:u.title,icon:u.type==="page"?(0,ze.jsx)(fe,{size:14}):u.type==="doc"?(0,ze.jsx)(Te,{size:14}):(0,ze.jsx)(Be,{size:14})})),w=[{type:"label",id:"recent",text:t("composer.recent")},...T,...r===void 0?[]:[{type:"separator",id:"start-gap"},{type:"label",id:"start",text:t("composer.start")},...xa.map(u=>({id:"prompt:"+u,label:t(`prompt.${u}`)}))],{type:"separator",id:"all-gap"},{id:"all",label:t("composer.all")}];return(0,ze.jsx)(Bt.Menu,{open:s,onClose:()=>g(!1),items:w,onSelect:u=>{if(g(!1),u==="all"){Se.layout?.selectPanel(Xe);return}if(u.startsWith("prompt:")&&r!==void 0){r.insertText(t(`prompt.${u.slice(7)}Text`),r.captureInsertion());return}let p=d?.find(y=>"open:"+y.id===u);p===void 0||o===null||(xe(p.id,p.title),Se.sidebarRight?.openResource(q({scope:"workspace",workspaceId:o,id:p.id})))},side:"top",portal:!0,autoFocus:!0,anchor:(0,ze.jsx)(Bt.Tooltip,{label:t("composer.label"),side:"top",portal:!0,children:(0,ze.jsx)("button",{type:"button",className:"art-composer","aria-label":t("composer.label"),"aria-haspopup":"menu","aria-expanded":s,onClick:()=>g(u=>!u),children:(0,ze.jsx)(At,{})})})})}var ee=require("react");var O=require("react"),P=require("@deepseek-ai/dsh-client-ui-primitives");var Ne=require("react"),Ht=require("@deepseek-ai/dsh-client-ui-primitives");var E=require("react/jsx-runtime"),So=["sm","md","lg"],No=e=>`<!doctype html><html><head><meta name="color-scheme" content="light dark"><style>
|
|
32
40
|
body { margin: 0; padding: 20px; font-family: var(--artifact-font-family); background: var(--artifact-color-surface); color: var(--artifact-color-text); }
|
|
33
41
|
h2 { margin: 0 0 6px; font-family: var(--artifact-font-display); font-size: var(--artifact-font-size-4); letter-spacing: -0.02em; }
|
|
34
42
|
p { margin: 0 0 14px; color: var(--artifact-color-muted); }
|
|
@@ -37,7 +45,7 @@ button { padding: 8px 14px; border: 0; border-radius: var(--artifact-radius-md);
|
|
|
37
45
|
.tag { padding: 3px 8px; border-radius: var(--artifact-radius-sm); background: color-mix(in srgb, var(--artifact-color-accent) 18%, transparent); color: var(--artifact-color-accent); font-size: 12px; }
|
|
38
46
|
code { font-family: var(--artifact-font-mono); font-size: 12px; }
|
|
39
47
|
</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
|
|
48
|
+
<div class="row"><button>${e("design.previewButton")}</button><span class="tag">+12%</span><code>var(--artifact-color-primary)</code></div></body></html>`;function Co(e){return/^#[0-9a-f]{6}$/i.test(e)}function Ur({t:e,workspaceId:t,workspaceTitle:a}){let[r,n]=(0,Ne.useState)(null),[o,l]=(0,Ne.useState)(null),[s,g]=(0,Ne.useState)(!1),[d,b]=(0,Ne.useState)(!1),T=Ye();(0,Ne.useEffect)(()=>{let p=new AbortController;return U.designSystem(t,p.signal).then(y=>{n(y),l(y.tokens)}).catch(()=>{p.signal.aborted||g(!0)}),()=>p.abort()},[t]);let w=(0,Ne.useMemo)(()=>o===null?"":$a(o),[o]);if(s)return(0,E.jsx)("p",{className:"art-note",children:e("error.generic")});if(r===null||o===null)return(0,E.jsx)("p",{className:"art-note",children:e("empty.loading")});let c=async p=>{b(!0);try{let y=await U.saveDesignSystem({scope:p,workspaceId:t},o);n(y),l(y.tokens),Q(e("design.saved"))}catch(y){Q(e(J(Z(y))))}finally{b(!1)}},u=async()=>{if(t!==null){b(!0);try{let p=await U.clearDesignSystem(t);n(p),l(p.tokens)}catch(p){Q(e(J(Z(p))))}finally{b(!1)}}};return(0,E.jsxs)("div",{className:"art-design",children:[(0,E.jsxs)("p",{className:"art-design-source",children:[e("design.hint")," ",e(`design.source.${r.source}`)]}),(0,E.jsxs)("div",{className:"art-design-group",children:[(0,E.jsx)("h3",{children:e("design.preview")}),(0,E.jsx)("div",{className:"art-design-preview",style:{height:150,display:"flex"},children:(0,E.jsx)(Ot,{content:No(e),designCss:w,title:o.name,frameTitle:e("design.preview"),dark:T})})]}),(0,E.jsxs)("label",{className:"art-field",children:[e("design.name"),(0,E.jsx)("input",{type:"text",value:o.name,maxLength:80,onChange:p=>l({...o,name:p.target.value})})]}),["colors","colorsDark"].map(p=>(0,E.jsxs)("div",{className:"art-design-group",children:[(0,E.jsx)("h3",{children:e(p==="colors"?"design.colors":"design.colorsDark")}),(0,E.jsx)("div",{className:"art-swatches",children:nt.map(y=>{let z=N=>{let j={...o[p],[y]:N};l({...o,[p]:j})};return(0,E.jsxs)("div",{className:"art-swatch",children:[(0,E.jsx)("input",{type:"color","aria-label":e(`design.color.${y}`)+" "+e(p==="colors"?"design.colors":"design.colorsDark"),value:Co(o[p][y])?o[p][y]:"#000000",onChange:N=>z(N.target.value)}),(0,E.jsxs)("span",{className:"art-swatch-text",children:[e(`design.color.${y}`),(0,E.jsx)("input",{type:"text","aria-label":e(`design.color.${y}`)+" "+e(p==="colors"?"design.colors":"design.colorsDark")+" CSS",value:o[p][y],onChange:N=>z(N.target.value)})]})]},y)})})]},p)),(0,E.jsxs)("div",{className:"art-design-group",children:[(0,E.jsx)("h3",{children:e("design.type")}),(0,E.jsxs)("label",{className:"art-field",children:[e("design.font"),(0,E.jsx)("input",{type:"text",value:o.typography.fontFamily,onChange:p=>l({...o,typography:{...o.typography,fontFamily:p.target.value}})})]}),(0,E.jsxs)("label",{className:"art-field",children:[e("design.display"),(0,E.jsx)("input",{type:"text",value:o.typography.displayFamily,onChange:p=>l({...o,typography:{...o.typography,displayFamily:p.target.value}})})]}),(0,E.jsxs)("label",{className:"art-field",children:[e("design.mono"),(0,E.jsx)("input",{type:"text",value:o.typography.monoFamily,onChange:p=>l({...o,typography:{...o.typography,monoFamily:p.target.value}})})]})]}),(0,E.jsxs)("div",{className:"art-design-group",children:[(0,E.jsx)("h3",{children:e("design.radius")}),(0,E.jsx)("div",{className:"art-radius-row",children:So.map(p=>(0,E.jsxs)("label",{children:[e(`design.radius.${p}`),(0,E.jsx)("input",{type:"number",min:0,max:64,value:o.radius[p],onChange:y=>l({...o,radius:{...o.radius,[p]:Number(y.target.value)||0}})})]},p))})]}),(0,E.jsxs)("label",{className:"art-field",children:[e("design.notes"),(0,E.jsx)("textarea",{value:o.notes,maxLength:4e3,onChange:p=>l({...o,notes:p.target.value})}),(0,E.jsx)("span",{className:"art-field-hint",children:e("design.notesHint")})]}),(0,E.jsxs)("div",{className:"art-design-actions",children:[t===null?null:(0,E.jsx)(Ht.Button,{size:"sm",variant:"primary",disabled:d,onClick:()=>void c("workspace"),children:a===void 0?e("design.saveWorkspace"):e("design.saveWorkspaceNamed",{name:a})}),(0,E.jsx)(Ht.Button,{size:"sm",variant:t===null?"primary":"outline",disabled:d,onClick:()=>void c("library"),children:e("design.saveLibrary")}),r.source==="workspace"&&t!==null?(0,E.jsx)(Ht.Button,{size:"sm",variant:"outline",disabled:d,onClick:()=>void u(),children:e("design.clear")}):null]})]})}var $r=require("react"),Wr="dsh-artifact-studio.pins";function Io(){if(typeof window>"u")return new Set;try{let e=window.localStorage.getItem(Wr);if(e===null)return new Set;let t=JSON.parse(e);return Array.isArray(t)?new Set(t.filter(a=>typeof a=="string")):new Set}catch{return new Set}}var Vt=Io(),wa=new Set;function Eo(e){return wa.add(e),()=>wa.delete(e)}function Gr(){return(0,$r.useSyncExternalStore)(Eo,()=>Vt,()=>Vt)}function qr(e){let t=new Set(Vt);t.has(e)?t.delete(e):t.add(e),Vt=t;try{window.localStorage.setItem(Wr,JSON.stringify([...t]))}catch{}for(let a of wa)a()}var Ro=`<!doctype html>
|
|
41
49
|
<html lang="en">
|
|
42
50
|
<head>
|
|
43
51
|
<meta charset="utf-8">
|
|
@@ -63,12 +71,20 @@ code { font-family: var(--artifact-font-mono); font-size: 12px; }
|
|
|
63
71
|
</main>
|
|
64
72
|
</body>
|
|
65
73
|
</html>
|
|
66
|
-
`,
|
|
74
|
+
`,Ao=`# {{title}}
|
|
67
75
|
|
|
68
76
|
Start writing, or select text and choose Edit with agent.
|
|
69
|
-
`;function gn(e){return e.replace(/[&<>"']/g,t=>`&#${t.charCodeAt(0)};`)}function bn(e){return e.replace(/[\\`*_\[\]#]/g,t=>`\\${t}`)}function Xr(e,t){return e==="doc"?mn.replace("{{title}}",bn(t)):fn.replace("{{title}}",gn(t))}var c=require("react/jsx-runtime");function kt(e){return e.kind==="workspace"?"ws:"+e.workspaceId:e.kind}function Gt(e){if(e==="all")return{kind:"all"};if(e==="library")return{kind:"library"};if(e==null||!e.startsWith("ws:"))return;let t=e.slice(3);return t===""?void 0:{kind:"workspace",workspaceId:t}}function Zr(e,t,r){return e.scope==="library"?{manifest:e,address:{scope:"library",id:e.id},where:{scope:"library",workspaceId:t},project:null}:r===null?null:{manifest:e,address:{scope:"workspace",workspaceId:r.workspaceId,id:e.id},where:{scope:"workspace",workspaceId:r.workspaceId},project:r.title}}function yn(e,t){e!==void 0&&(de(t.manifest.id,t.manifest.title),e(H(t.address)))}function Jr(e){let t=H(e.address);return e.manifest.scope==="library"?t+"@"+(e.where.workspaceId??""):t}var Ye=new Map,qt=new Map;function hn(e){let t=Jr(e),r=Ye.get(t);if(r!==void 0&&r.version>=e.manifest.version)return Promise.resolve(r);let a=t+":"+e.manifest.version,n=qt.get(a);if(n!==void 0)return n;let o=z.get(e.where,e.manifest.id).then(s=>{let l={version:s.version,content:s.content,designCss:s.designCss},f=Ye.get(t);return(f===void 0||f.version<=l.version)&&(Ye.size>=60&&Ye.clear(),Ye.set(t,l)),l}).finally(()=>{qt.delete(a)});return qt.set(a,o),o}function vn(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 a of[...r.attributes]){let n=a.name.toLowerCase();(n.startsWith("on")||n==="srcdoc")&&r.removeAttribute(a.name)}return t.documentElement.outerHTML}function xn(e){let t=e.replace(/\x60{3}[\s\S]*?\x60{3}/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/<[^>]+>/g," ").replace(/[#>*_\x60~]/g," ").replace(/\s+/g," ").trim();return t.length>220?t.slice(0,220).trimEnd()+"...":t}function wn({t:e,view:t}){let[r,a]=(0,P.useState)(null),[n,o]=(0,P.useState)(!1),[s,l]=(0,P.useState)(typeof IntersectionObserver>"u"),[f,u]=(0,P.useState)(null),h=(0,P.useRef)(null),w=ze(),k=Jr(t),S=t.manifest.title,m=t.manifest.type,d=t.manifest.version;(0,P.useEffect)(()=>{if(s)return;let I=h.current;if(I===null)return;let O=new IntersectionObserver(Z=>{Z.some(M=>M.isIntersecting)&&(l(!0),O.disconnect())},{rootMargin:"140px"});return O.observe(I),()=>O.disconnect()},[s]),(0,P.useEffect)(()=>{if(!s)return;let I=!1;return hn(t).then(O=>{!I&&O.version===d&&(a(O),o(!1))}).catch(()=>{I||o(!0)}),()=>{I=!0}},[s,k,d]),(0,P.useEffect)(()=>{if(m!=="page"||r===null){u(null);return}let I=URL.createObjectURL(new Blob([ut(vn(r.content),r.designCss,S,w?"dark":"light")],{type:"text/html"}));return u(I),()=>URL.revokeObjectURL(I)},[r,m,S,w]);let y=m==="page"?(0,c.jsx)(se,{}):(0,c.jsx)(fe,{});if(n)return(0,c.jsx)("span",{className:"art-cover",ref:h,"aria-hidden":"true",children:(0,c.jsx)("span",{className:"art-cover-fallback",children:y})});if(m==="page")return(0,c.jsx)("span",{className:"art-cover",ref:h,"aria-hidden":"true",children:f===null?(0,c.jsx)("span",{className:"art-cover-fallback",children:y}):(0,c.jsx)("span",{className:"art-cover-frame-wrap",children:(0,c.jsx)("iframe",{className:"art-cover-frame",src:f,sandbox:"",title:e("gallery.coverTitle",{title:S}),tabIndex:-1,loading:"lazy",referrerPolicy:"no-referrer"})})});let E=r===null?"":xn(r.content);return(0,c.jsx)("span",{className:"art-cover",ref:h,"aria-hidden":"true",children:E===""?(0,c.jsx)("span",{className:"art-cover-fallback",children:y}):(0,c.jsxs)("span",{className:"art-cover-doc",children:[(0,c.jsx)("span",{className:"art-cover-doc-title",children:S}),(0,c.jsx)("span",{className:"art-cover-doc-text",children:E})]})})}function kn({t:e,view:t,pinned:r,onOpen:a,showProject:n}){let o=H(t.address),s=e(r?"gallery.unpin":"gallery.pin",{title:t.manifest.title}),l=t.manifest.scope==="library"?" \xB7 "+e("scope.library"):n&&t.project!==null?" \xB7 "+t.project:"";return(0,c.jsxs)("li",{className:"art-tile",children:[(0,c.jsxs)("button",{type:"button",className:"art-tile-open",onClick:()=>a(t),children:[(0,c.jsx)(wn,{t:e,view:t}),(0,c.jsxs)("span",{className:"art-tile-body",children:[(0,c.jsx)("span",{className:"art-tile-title",title:t.manifest.title,children:t.manifest.title}),(0,c.jsxs)("span",{className:"art-tile-sub",children:[e(`type.${t.manifest.type}`)," \xB7 ",e("gallery.updated",{time:ft(e,t.manifest.updatedAt)})," \xB7 ",e("gallery.version",{version:t.manifest.version}),l]})]})]}),(0,c.jsx)(N.Tooltip,{label:s,side:"left",portal:!0,children:(0,c.jsx)("button",{type:"button",className:"art-tile-pin","aria-label":s,"aria-pressed":r,onClick:()=>Yr(o),children:r?(0,c.jsx)(N.IconPinFillRegular,{size:14}):(0,c.jsx)(N.IconPinOutlineRegular,{size:14})})})]})}function Qr({t:e,heading:t,views:r,pinned:a,onOpen:n,showProject:o}){let s=(0,P.useId)();return r.length===0?null:(0,c.jsxs)("section",{className:"art-section","aria-labelledby":s,children:[(0,c.jsxs)("div",{className:"art-section-head",children:[(0,c.jsx)("h2",{className:"art-section-title",id:s,children:t}),(0,c.jsx)("span",{className:"art-section-hint",children:e("gallery.count",{count:r.length})})]}),(0,c.jsx)("ul",{className:"art-grid",children:r.map(l=>(0,c.jsx)(kn,{t:e,view:l,pinned:a.has(H(l.address)),onOpen:n,showProject:o},H(l.address)))})]})}function Tn(e,t,r){let a={where:{scope:"library",workspaceId:r},project:null};if(e.kind==="library")return[a];if(e.kind==="workspace"){let n=t.find(o=>o.workspaceId===e.workspaceId);return n===void 0?[]:[{where:{scope:"workspace",workspaceId:n.workspaceId},project:n}]}return[...t.map(n=>({where:{scope:"workspace",workspaceId:n.workspaceId},project:n})),a]}var Sn=12;function Cn(e,t,r,a,n,o){let[s,l]=(0,P.useState)(1),[f,u]=(0,P.useState)({key:"",state:{status:"loading"}}),h=t.map(m=>m.workspaceId+":"+m.title).join(","),w=kt(e)+":"+h+":"+(r??"")+":"+a+":"+(n??""),k=e.kind==="all",S=f.key===w?f.state:{status:"loading"};return(0,P.useEffect)(()=>l(1),[w,a]),(0,P.useEffect)(()=>{let m=Tn(e,t,r);if(m.length===0){u({key:w,state:{status:"ready",items:[],hasMore:!1,truncated:!1,failed:0}});return}let d=new AbortController,y=setTimeout(async()=>{let E=k?Sn:void 0,I=await Promise.all(m.map(async _=>{let A=[];for(let q=0;q<s;q+=1)try{let V=await z.list(_.where,{query:a,type:n,offset:q*(E??50),...E===void 0?{}:{limit:E}},d.signal);if(A.push(V),!V.hasMore)break}catch(V){return{loaded:A,failed:!0,code:Y(V)}}return{loaded:A,failed:!1}}));if(d.signal.aborted)return;let O=[],Z=!1,M=!1,J=0,$;if(I.forEach((_,A)=>{let q=m[A];if(q===void 0)return;_.failed&&(J+=1,$===void 0&&($=_.code));let V=_.loaded[_.loaded.length-1];if(V!==void 0){V.hasMore&&(Z=!0),V.truncated&&(M=!0);for(let ae of _.loaded)for(let ee of ae.items){let x=Zr(ee,r,q.project);x!==null&&O.push(x)}}}),J===m.length){u({key:w,state:{status:"failed",code:$}});return}O.sort((_,A)=>Date.parse(A.manifest.updatedAt)-Date.parse(_.manifest.updatedAt)),u({key:w,state:{status:"ready",items:O,hasMore:Z,truncated:M,failed:J}})},a===""?0:180);return()=>{d.abort(),clearTimeout(y)}},[w,o,s]),{state:S,more:()=>l(m=>m+1)}}function Nn({t:e,variant:t}){let r=t==="all"?"empty.allTitle":t==="library"?"empty.libraryTitle":"empty.workspaceTitle",a=t==="all"?"empty.allHint":t==="library"?"empty.libraryHint":"empty.workspaceHint",n=async o=>{try{await navigator.clipboard.writeText(o),W(e("gallery.promptCopied"))}catch{W(e("action.copyFailed"))}};return(0,c.jsxs)("div",{className:"art-empty",children:[(0,c.jsx)("p",{className:"art-empty-title",children:e(r)}),(0,c.jsx)("p",{className:"art-empty-hint",children:e(a)}),(0,c.jsx)("ul",{className:"art-starters",children:Wt.map(o=>(0,c.jsxs)("li",{className:"art-starter",children:[(0,c.jsxs)("span",{className:"art-starter-text",children:[(0,c.jsx)("span",{className:"art-starter-name",children:e(`prompt.${o}`)}),(0,c.jsx)("span",{className:"art-starter-hint",children:e(`prompt.${o}Text`)})]}),(0,c.jsx)(N.Tooltip,{label:e("gallery.copyPrompt"),side:"left",portal:!0,children:(0,c.jsx)(N.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.copyPromptNamed",{name:e(`prompt.${o}`)}),onClick:()=>void n(e(`prompt.${o}Text`)),children:(0,c.jsx)(N.IconCopyOutlineRegular,{size:14})})})]},o))})]})}function ea({t:e,projects:t,scope:r,contextWorkspaceId:a,onScopeChange:n,open:o}){let[s,l]=(0,P.useState)(""),[f,u]=(0,P.useState)(void 0),[h,w]=(0,P.useState)("list"),[k,S]=(0,P.useState)(!1),[m,d]=(0,P.useState)(0),y=dt()+m,E=Kr(),I=Cn(r,t,a,s,f,y),O=(0,P.useId)(),Z=t.find(g=>g.workspaceId===a)??null,M=r.kind==="library"?null:a,J=M===null?null:t.find(g=>g.workspaceId===M)??null,$=r.kind==="library"||Z===null?"library":"workspace",_=$==="library"?e("scope.library"):Z?.title??e("scope.library"),A=I.state,q=A.status==="ready"?A.items:[],V=(0,P.useCallback)(g=>yn(o,g),[o]),ae=(0,P.useCallback)(async(g,L)=>{if(L==="workspace"&&a===null)return;let j=e(g==="page"?"create.untitledPage":"create.untitledDoc");try{let{manifest:F}=await z.create({scope:L,workspaceId:a},g,j,Xr(g,j));pe();let Tt=L==="workspace"?t.find(Be=>Be.workspaceId===a)??null:null,we=Zr(F,a,Tt);we!==null&&V(we)}catch(F){W(e(X(Y(F))))}},[a,t,e,V]),ee=q.filter(g=>E.has(H(g.address))),x=q.filter(g=>!E.has(H(g.address)));return(0,c.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"",children:[(0,c.jsxs)("header",{className:"art-header",children:[(0,c.jsxs)("div",{className:"art-heading",children:[h==="design"?(0,c.jsx)(N.Tooltip,{label:e("panel"),side:"bottom",portal:!0,children:(0,c.jsx)(N.Button,{size:"sm",className:"art-icon-button","aria-label":e("panel"),onClick:()=>w("list"),children:(0,c.jsx)(N.IconChevronLeftOutlineRegular,{size:16})})}):null,(0,c.jsx)("span",{className:"art-title",children:e(h==="design"?"design.title":"panel")})]}),h==="list"?(0,c.jsxs)("label",{className:"art-workspace",children:[(0,c.jsx)("span",{className:"art-workspace-label",children:e("scope.label")}),(0,c.jsxs)("select",{className:"art-workspace-select","aria-label":e("scope.label"),value:kt(r),onChange:g=>{let L=Gt(g.target.value);L!==void 0&&n(L)},children:[(0,c.jsx)("option",{value:"all",children:e("scope.all")}),t.map(g=>(0,c.jsx)("option",{value:"ws:"+g.workspaceId,children:g.title},g.workspaceId)),(0,c.jsx)("option",{value:"library",children:e("scope.library")})]})]}):null,h==="list"?(0,c.jsxs)("div",{className:"art-actions",children:[(0,c.jsx)(N.Tooltip,{label:e("gallery.design"),side:"bottom",portal:!0,children:(0,c.jsx)(N.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.design"),onClick:()=>w("design"),children:(0,c.jsx)(Hr,{size:16})})}),(0,c.jsx)(N.Tooltip,{label:e("gallery.refresh"),side:"bottom",portal:!0,children:(0,c.jsx)(N.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.refresh"),onClick:()=>d(g=>g+1),children:(0,c.jsx)(N.IconRefreshOutlineRegular,{size:16})})}),(0,c.jsx)(N.Menu,{open:k,onClose:()=>S(!1),align:"end",portal:!0,autoFocus:!0,items:[{id:"page",label:e("gallery.newPage")+" \xB7 "+_,icon:(0,c.jsx)(se,{size:14})},{id:"doc",label:e("gallery.newDoc")+" \xB7 "+_,icon:(0,c.jsx)(fe,{size:14})}],onSelect:g=>{S(!1),ae(g==="doc"?"doc":"page",$)},anchor:(0,c.jsx)(N.Button,{size:"sm",variant:"outline",icon:(0,c.jsx)(N.IconPlusOutlineRegular,{size:14}),"aria-haspopup":"menu","aria-expanded":k,onClick:()=>S(g=>!g),children:e("gallery.create")})})]}):null]}),h==="design"?(0,c.jsx)("div",{className:"art-scroll",children:(0,c.jsx)(Ur,{t:e,workspaceId:M,workspaceTitle:J?.title})}):(0,c.jsx)("div",{className:"art-scroll",children:(0,c.jsxs)("div",{className:"art-gallery",children:[(0,c.jsxs)("div",{className:"art-toolbar",children:[(0,c.jsx)("input",{className:"art-search",type:"search","aria-label":e("gallery.searchLabel"),placeholder:e("gallery.search"),value:s,onChange:g=>l(g.target.value)}),(0,c.jsx)(N.SegmentedControl,{id:O,className:"art-segment",label:e("filter.type"),value:f??"all",options:[{value:"all",label:e("type.all")},{value:"page",label:e("type.page")},{value:"doc",label:e("type.doc")}],onChange:g=>u(g==="all"?void 0:g)})]}),(0,c.jsxs)("div",{role:"tabpanel",id:O+"-"+(f??"all")+"-panel","aria-labelledby":O+"-"+(f??"all"),children:[A.status==="loading"?(0,c.jsx)("p",{className:"art-note",children:e("empty.loading")}):null,A.status==="failed"?(0,c.jsxs)("div",{className:"art-empty",role:"alert",children:[(0,c.jsx)("p",{className:"art-empty-title",children:e(X(A.code))}),(0,c.jsx)(N.Button,{size:"sm",variant:"outline",onClick:()=>d(g=>g+1),children:e("action.retry")})]}):null,A.status==="ready"&&A.failed>0?(0,c.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"status",children:[(0,c.jsx)("span",{children:e("gallery.failedProjects")}),(0,c.jsx)(N.Button,{size:"sm",variant:"outline",onClick:()=>d(g=>g+1),children:e("action.retry")})]}):null,A.status==="ready"&&A.items.length===0&&A.failed===0?s!==""?(0,c.jsx)("p",{className:"art-note",children:e("empty.noMatch")}):f!==void 0?(0,c.jsx)("p",{className:"art-note",children:e("empty.typeMatch",{type:e(`type.${f}`)})}):(0,c.jsx)(Nn,{t:e,variant:r.kind}):null,A.status==="ready"&&A.items.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(Qr,{t:e,heading:e("gallery.pinned"),views:ee,pinned:E,onOpen:V,showProject:r.kind==="all"}),x.length===0?(0,c.jsx)("p",{className:"art-note",children:e("gallery.allPinned")}):(0,c.jsx)(Qr,{t:e,heading:e("gallery.recent"),views:x,pinned:E,onOpen:V,showProject:r.kind==="all"}),A.hasMore?(0,c.jsx)("div",{className:"art-gallery-more",children:(0,c.jsx)(N.Button,{size:"sm",variant:"outline",onClick:I.more,children:e("gallery.more")})}):null,A.truncated?(0,c.jsx)("p",{className:"art-note",children:e("gallery.truncated")}):null]}):null]})]})})]})}var Ae=require("react/jsx-runtime"),ta="dsh-artifact-studio.panel.scope",ra="dsh-artifact-studio.panel.workspace";function aa({t:e,workspaces:t}){let r=(0,U.useCallback)(y=>t.subscribe(y),[t]),a=(0,U.useCallback)(()=>t.getSnapshot(),[t]),o=(0,U.useSyncExternalStore)(r,a,a).items,s=(0,U.useMemo)(()=>o.map(({workspaceId:y,title:E})=>({workspaceId:y,title:E})),[o]),[l,f]=(0,U.useState)(()=>Gt(window.localStorage.getItem(ta))??{kind:"all"}),[u,h]=(0,U.useState)(()=>{let y=window.localStorage.getItem(ra);return y===null||y===""?null:y}),[w,k]=(0,U.useState)(null),S=l.kind==="workspace"?o.find(y=>y.workspaceId===l.workspaceId):void 0,m=S!==void 0?S.workspaceId:u!==null&&o.some(y=>y.workspaceId===u)?u:o[0]?.workspaceId??null;(0,U.useEffect)(()=>{if(o.length!==0){if(l.kind==="workspace"&&!o.some(y=>y.workspaceId===l.workspaceId)){f({kind:"all"});return}m!==null&&m!==u&&h(m)}},[o,l,m,u]),(0,U.useEffect)(()=>{window.localStorage.setItem(ta,kt(l))},[l]),(0,U.useEffect)(()=>{u!==null&&window.localStorage.setItem(ra,u)},[u]);let d=(0,U.useMemo)(()=>w===null?void 0:he(w),[w]);return(0,Ae.jsxs)("div",{className:"art-panel-stack",children:[(0,Ae.jsx)("div",{className:"art-panel-region",hidden:d!==void 0,children:(0,Ae.jsx)(ea,{t:e,projects:s,scope:l,contextWorkspaceId:m,onScopeChange:f,open:y=>k(y)})}),d===void 0?null:(0,Ae.jsx)("div",{className:"art-panel-region",children:(0,Ae.jsx)(Or,{t:e,address:d,workspaceName:o.find(y=>d.scope==="workspace"&&y.workspaceId===d.workspaceId)?.title,onBack:()=>k(null)})})]})}var na="dsh-artifact-studio/styles",An=Sr.split(`
|
|
70
|
-
|
|
71
|
-
|
|
77
|
+
`,zo=`<Frame w={720} p={40} bg="#ffffff" flex="col" gap={12}>
|
|
78
|
+
<Text size={13} weight={600} color="#2856c7">DESIGN</Text>
|
|
79
|
+
<Text size={40} weight={700} color="#16181d">{{title}}</Text>
|
|
80
|
+
<Text size={16} color="#5b6170">Edit the source, or ask the agent for a change.</Text>
|
|
81
|
+
<Frame w={148} h={44} bg="#2856c7" rounded={10} flex="col" items="center" justify="center">
|
|
82
|
+
<Text size={15} weight={600} color="#ffffff">Get started</Text>
|
|
83
|
+
</Frame>
|
|
84
|
+
</Frame>
|
|
85
|
+
`;function Do(e){return e.replace(/[&<>"']/g,t=>`&#${t.charCodeAt(0)};`)}function Po(e){return e.replace(/[\\`*_\[\]#]/g,t=>`\\${t}`)}function Mo(e){return e.replace(/[{}<>]/g," ")}function Kr(e,t){return e==="doc"?Ao.replace("{{title}}",Po(t)):e==="design"?zo.replace("{{title}}",Mo(t)):Ro.replace("{{title}}",Do(t))}var m=require("react/jsx-runtime");function Ut(e){return e.kind==="workspace"?"ws:"+e.workspaceId:e.kind}function Sa(e){if(e==="all")return{kind:"all"};if(e==="library")return{kind:"library"};if(e==null||!e.startsWith("ws:"))return;let t=e.slice(3);return t===""?void 0:{kind:"workspace",workspaceId:t}}function Xr(e,t,a){return e.scope==="library"?{manifest:e,address:{scope:"library",id:e.id},where:{scope:"library",workspaceId:t},project:null}:a===null?null:{manifest:e,address:{scope:"workspace",workspaceId:a.workspaceId,id:e.id},where:{scope:"workspace",workspaceId:a.workspaceId},project:a.title}}function Lo(e,t){e!==void 0&&(xe(t.manifest.id,t.manifest.title),e(q(t.address)))}function Zr(e){let t=q(e.address);return e.manifest.scope==="library"?t+"@"+(e.where.workspaceId??""):t}var pt=new Map,ka=new Map,Oo=2,_t=new Map,ut=[],Ta=0;function Yr(){for(;Ta<Oo&&ut.length>0;){let e=ut.shift();if(e===void 0)return;Ta+=1,e.start()}}function Fo(e){let t={start:()=>{e().finally(()=>{Ta-=1,Yr()})}};return ut.push(t),Yr(),()=>{let a=ut.indexOf(t);a!==-1&&ut.splice(a,1)}}function jo(e){let t=Zr(e),a=pt.get(t);if(a!==void 0&&a.version>=e.manifest.version)return Promise.resolve(a);let r=t+":"+e.manifest.version,n=ka.get(r);if(n!==void 0)return n;let o=U.get(e.where,e.manifest.id).then(l=>{let s={version:l.version,content:l.content,designCss:l.designCss},g=pt.get(t);return(g===void 0||g.version<=s.version)&&(pt.size>=60&&pt.clear(),pt.set(t,s)),s}).finally(()=>{ka.delete(r)});return ka.set(r,o),o}function Bo(e){if(typeof DOMParser>"u")return e.replace(/<script\b[^>]*>[\s\S]*?<\/script\s*>/gi,"").replace(/<script\b[^>]*\/?>/gi,"").replace(/\son[a-z]+\s*=\s*"[^"]*"/gi,"");let t=new DOMParser().parseFromString(e,"text/html");for(let a of t.querySelectorAll("script, iframe, object, embed, base"))a.remove();for(let a of t.querySelectorAll("*"))for(let r of[...a.attributes]){let n=r.name.toLowerCase();(n.startsWith("on")||n==="srcdoc")&&a.removeAttribute(r.name)}return t.documentElement.outerHTML}function Ho(e){let t=e.replace(/\x60{3}[\s\S]*?\x60{3}/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/<[^>]+>/g," ").replace(/[#>*_\x60~]/g," ").replace(/\s+/g," ").trim();return t.length>220?t.slice(0,220).trimEnd()+"...":t}function Vo({t:e,view:t}){let[a,r]=(0,O.useState)(null),[n,o]=(0,O.useState)(!1),[l,s]=(0,O.useState)(typeof IntersectionObserver>"u"),[g,d]=(0,O.useState)(null),[b,T]=(0,O.useState)(null),w=(0,O.useRef)(null),c=Ye(),u=Zr(t),p=t.manifest.title,y=t.manifest.type,z=t.manifest.version;(0,O.useEffect)(()=>{if(l)return;let D=w.current;if(D===null)return;let _=new IntersectionObserver(C=>{C.some(L=>L.isIntersecting)&&(s(!0),_.disconnect())},{rootMargin:"140px"});return _.observe(D),()=>_.disconnect()},[l]),(0,O.useEffect)(()=>{if(!l||y!=="design")return;let D=u+"@"+z,_=_t.get(D);if(_!==void 0){T(_),o(!1);return}let C=new AbortController,L=!1,B=Fo(async()=>{try{let I=await U.preview(t.where,t.manifest.id,z,C.signal);if(L)return;let H="data:"+I.mediaType+";base64,"+I.data;_t.size>=40&&_t.clear(),_t.set(D,H),T(H),o(!1)}catch{L||o(!0)}});return()=>{L=!0,C.abort(),B()}},[l,u,z,y]),(0,O.useEffect)(()=>{if(!l||y==="design")return;let D=!1;return jo(t).then(_=>{!D&&_.version===z&&(r(_),o(!1))}).catch(()=>{D||o(!0)}),()=>{D=!0}},[l,u,z]),(0,O.useEffect)(()=>{if(y!=="page"||a===null){d(null);return}let D=URL.createObjectURL(new Blob([Mt(Bo(a.content),a.designCss,p,c?"dark":"light")],{type:"text/html"}));return d(D),()=>URL.revokeObjectURL(D)},[a,y,p,c]);let N=y==="page"?(0,m.jsx)(fe,{}):y==="doc"?(0,m.jsx)(Te,{}):(0,m.jsx)(Be,{});if(n)return(0,m.jsx)("span",{className:"art-cover",ref:w,"aria-hidden":"true",children:(0,m.jsx)("span",{className:"art-cover-fallback",children:N})});if(y==="design")return(0,m.jsx)("span",{className:"art-cover",ref:w,"aria-hidden":"true",children:b===null?(0,m.jsx)("span",{className:"art-cover-fallback",children:N}):(0,m.jsx)("img",{className:"art-cover-design",src:b,alt:""})});if(y==="page")return(0,m.jsx)("span",{className:"art-cover",ref:w,"aria-hidden":"true",children:g===null?(0,m.jsx)("span",{className:"art-cover-fallback",children:N}):(0,m.jsx)("span",{className:"art-cover-frame-wrap",children:(0,m.jsx)("iframe",{className:"art-cover-frame",src:g,sandbox:"",title:e("gallery.coverTitle",{title:p}),tabIndex:-1,loading:"lazy",referrerPolicy:"no-referrer"})})});let j=a===null?"":Ho(a.content);return(0,m.jsx)("span",{className:"art-cover",ref:w,"aria-hidden":"true",children:j===""?(0,m.jsx)("span",{className:"art-cover-fallback",children:N}):(0,m.jsxs)("span",{className:"art-cover-doc",children:[(0,m.jsx)("span",{className:"art-cover-doc-title",children:p}),(0,m.jsx)("span",{className:"art-cover-doc-text",children:j})]})})}function _o({t:e,view:t,pinned:a,onOpen:r,showProject:n}){let o=q(t.address),l=e(a?"gallery.unpin":"gallery.pin",{title:t.manifest.title}),s=t.manifest.scope==="library"?" \xB7 "+e("scope.library"):n&&t.project!==null?" \xB7 "+t.project:"";return(0,m.jsxs)("li",{className:"art-tile",children:[(0,m.jsxs)("button",{type:"button",className:"art-tile-open",onClick:()=>r(t),children:[(0,m.jsx)(Vo,{t:e,view:t}),(0,m.jsxs)("span",{className:"art-tile-body",children:[(0,m.jsx)("span",{className:"art-tile-title",title:t.manifest.title,children:t.manifest.title}),(0,m.jsxs)("span",{className:"art-tile-sub",children:[e(`type.${t.manifest.type}`)," \xB7 ",e("gallery.updated",{time:Lt(e,t.manifest.updatedAt)})," \xB7 ",e("gallery.version",{version:t.manifest.version}),s]})]})]}),(0,m.jsx)(P.Tooltip,{label:l,side:"left",portal:!0,children:(0,m.jsx)("button",{type:"button",className:"art-tile-pin","aria-label":l,"aria-pressed":a,onClick:()=>qr(o),children:a?(0,m.jsx)(P.IconPinFillRegular,{size:14}):(0,m.jsx)(P.IconPinOutlineRegular,{size:14})})})]})}function Qr({t:e,heading:t,views:a,pinned:r,onOpen:n,showProject:o}){let l=(0,O.useId)();return a.length===0?null:(0,m.jsxs)("section",{className:"art-section","aria-labelledby":l,children:[(0,m.jsxs)("div",{className:"art-section-head",children:[(0,m.jsx)("h2",{className:"art-section-title",id:l,children:t}),(0,m.jsx)("span",{className:"art-section-hint",children:e("gallery.count",{count:a.length})})]}),(0,m.jsx)("ul",{className:"art-grid",children:a.map(s=>(0,m.jsx)(_o,{t:e,view:s,pinned:r.has(q(s.address)),onOpen:n,showProject:o},q(s.address)))})]})}function Uo(e,t,a){let r={where:{scope:"library",workspaceId:a},project:null};if(e.kind==="library")return[r];if(e.kind==="workspace"){let n=t.find(o=>o.workspaceId===e.workspaceId);return n===void 0?[]:[{where:{scope:"workspace",workspaceId:n.workspaceId},project:n}]}return[...t.map(n=>({where:{scope:"workspace",workspaceId:n.workspaceId},project:n})),r]}var $o=12;function Wo(e,t,a,r,n,o){let[l,s]=(0,O.useState)(1),[g,d]=(0,O.useState)({key:"",state:{status:"loading"}}),b=t.map(u=>u.workspaceId+":"+u.title).join(","),T=Ut(e)+":"+b+":"+(a??"")+":"+r+":"+(n??""),w=e.kind==="all",c=g.key===T?g.state:{status:"loading"};return(0,O.useEffect)(()=>s(1),[T,r]),(0,O.useEffect)(()=>{let u=Uo(e,t,a);if(u.length===0){d({key:T,state:{status:"ready",items:[],hasMore:!1,truncated:!1,failed:0}});return}let p=new AbortController,y=setTimeout(async()=>{let z=w?$o:void 0,N=await Promise.all(u.map(async B=>{let I=[];for(let H=0;H<l;H+=1)try{let W=await U.list(B.where,{query:r,type:n,offset:H*(z??50),...z===void 0?{}:{limit:z}},p.signal);if(I.push(W),!W.hasMore)break}catch(W){return{loaded:I,failed:!0,code:Z(W)}}return{loaded:I,failed:!1}}));if(p.signal.aborted)return;let j=[],D=!1,_=!1,C=0,L;if(N.forEach((B,I)=>{let H=u[I];if(H===void 0)return;B.failed&&(C+=1,L===void 0&&(L=B.code));let W=B.loaded[B.loaded.length-1];if(W!==void 0){W.hasMore&&(D=!0),W.truncated&&(_=!0);for(let V of B.loaded)for(let Pe of V.items){let R=Xr(Pe,a,H.project);R!==null&&j.push(R)}}}),C===u.length){d({key:T,state:{status:"failed",code:L}});return}j.sort((B,I)=>Date.parse(I.manifest.updatedAt)-Date.parse(B.manifest.updatedAt)),d({key:T,state:{status:"ready",items:j,hasMore:D,truncated:_,failed:C}})},r===""?0:180);return()=>{p.abort(),clearTimeout(y)}},[T,o,l]),{state:c,more:()=>s(u=>u+1)}}function Go({t:e,variant:t}){let a=t==="all"?"empty.allTitle":t==="library"?"empty.libraryTitle":"empty.workspaceTitle",r=t==="all"?"empty.allHint":t==="library"?"empty.libraryHint":"empty.workspaceHint",n=async o=>{try{await navigator.clipboard.writeText(o),Q(e("gallery.promptCopied"))}catch{Q(e("action.copyFailed"))}};return(0,m.jsxs)("div",{className:"art-empty",children:[(0,m.jsx)("p",{className:"art-empty-title",children:e(a)}),(0,m.jsx)("p",{className:"art-empty-hint",children:e(r)}),(0,m.jsx)("ul",{className:"art-starters",children:xa.map(o=>(0,m.jsxs)("li",{className:"art-starter",children:[(0,m.jsxs)("span",{className:"art-starter-text",children:[(0,m.jsx)("span",{className:"art-starter-name",children:e(`prompt.${o}`)}),(0,m.jsx)("span",{className:"art-starter-hint",children:e(`prompt.${o}Text`)})]}),(0,m.jsx)(P.Tooltip,{label:e("gallery.copyPrompt"),side:"left",portal:!0,children:(0,m.jsx)(P.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.copyPromptNamed",{name:e(`prompt.${o}`)}),onClick:()=>void n(e(`prompt.${o}Text`)),children:(0,m.jsx)(P.IconCopyOutlineRegular,{size:14})})})]},o))})]})}function Jr({t:e,projects:t,scope:a,contextWorkspaceId:r,onScopeChange:n,open:o}){let[l,s]=(0,O.useState)(""),[g,d]=(0,O.useState)(void 0),[b,T]=(0,O.useState)("list"),[w,c]=(0,O.useState)(!1),[u,p]=(0,O.useState)(0),y=Rt()+u,z=Gr(),N=Wo(a,t,r,l,g,y),j=(0,O.useId)(),D=t.find(S=>S.workspaceId===r)??null,_=a.kind==="library"?null:r,C=_===null?null:t.find(S=>S.workspaceId===_)??null,L=a.kind==="library"||D===null?"library":"workspace",B=L==="library"?e("scope.library"):D?.title??e("scope.library"),I=N.state,H=I.status==="ready"?I.items:[],W=(0,O.useCallback)(S=>Lo(o,S),[o]),V=(0,O.useCallback)(async(S,G)=>{if(G==="workspace"&&r===null)return;let ae=e(S==="page"?"create.untitledPage":S==="doc"?"create.untitledDoc":"create.untitledDesign");try{let{manifest:Me}=await U.create({scope:G,workspaceId:r},S,ae,Kr(S,ae));we();let ft=G==="workspace"?t.find($t=>$t.workspaceId===r)??null:null,mt=Xr(Me,r,ft);mt!==null&&W(mt)}catch(Me){Q(e(J(Z(Me))))}},[r,t,e,W]),Pe=H.filter(S=>z.has(q(S.address))),R=H.filter(S=>!z.has(q(S.address)));return(0,m.jsxs)("section",{className:"art-root","data-dsh-artifact-studio":"",children:[(0,m.jsxs)("header",{className:"art-header",children:[(0,m.jsxs)("div",{className:"art-heading",children:[b==="design"?(0,m.jsx)(P.Tooltip,{label:e("panel"),side:"bottom",portal:!0,children:(0,m.jsx)(P.Button,{size:"sm",className:"art-icon-button","aria-label":e("panel"),onClick:()=>T("list"),children:(0,m.jsx)(P.IconChevronLeftOutlineRegular,{size:16})})}):null,(0,m.jsx)("span",{className:"art-title",children:e(b==="design"?"design.title":"panel")})]}),b==="list"?(0,m.jsxs)("label",{className:"art-workspace",children:[(0,m.jsx)("span",{className:"art-workspace-label",children:e("scope.label")}),(0,m.jsxs)("select",{className:"art-workspace-select","aria-label":e("scope.label"),value:Ut(a),onChange:S=>{let G=Sa(S.target.value);G!==void 0&&n(G)},children:[(0,m.jsx)("option",{value:"all",children:e("scope.all")}),t.map(S=>(0,m.jsx)("option",{value:"ws:"+S.workspaceId,children:S.title},S.workspaceId)),(0,m.jsx)("option",{value:"library",children:e("scope.library")})]})]}):null,b==="list"?(0,m.jsxs)("div",{className:"art-actions",children:[(0,m.jsx)(P.Tooltip,{label:e("gallery.design"),side:"bottom",portal:!0,children:(0,m.jsx)(P.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.design"),onClick:()=>T("design"),children:(0,m.jsx)(ar,{size:16})})}),(0,m.jsx)(P.Tooltip,{label:e("gallery.refresh"),side:"bottom",portal:!0,children:(0,m.jsx)(P.Button,{size:"sm",className:"art-icon-button","aria-label":e("gallery.refresh"),onClick:()=>p(S=>S+1),children:(0,m.jsx)(P.IconRefreshOutlineRegular,{size:16})})}),(0,m.jsx)(P.Menu,{open:w,onClose:()=>c(!1),align:"end",portal:!0,autoFocus:!0,items:[{id:"page",label:e("gallery.newPage")+" \xB7 "+B,icon:(0,m.jsx)(fe,{size:14})},{id:"doc",label:e("gallery.newDoc")+" \xB7 "+B,icon:(0,m.jsx)(Te,{size:14})},{id:"design",label:e("gallery.newDesign")+" \xB7 "+B,icon:(0,m.jsx)(Be,{size:14})}],onSelect:S=>{c(!1),V(S==="doc"?"doc":S==="design"?"design":"page",L)},anchor:(0,m.jsx)(P.Button,{size:"sm",variant:"outline",icon:(0,m.jsx)(P.IconPlusOutlineRegular,{size:14}),"aria-haspopup":"menu","aria-expanded":w,onClick:()=>c(S=>!S),children:e("gallery.create")})})]}):null]}),b==="design"?(0,m.jsx)("div",{className:"art-scroll",children:(0,m.jsx)(Ur,{t:e,workspaceId:_,workspaceTitle:C?.title})}):(0,m.jsx)("div",{className:"art-scroll",children:(0,m.jsxs)("div",{className:"art-gallery",children:[(0,m.jsxs)("div",{className:"art-toolbar",children:[(0,m.jsx)("input",{className:"art-search",type:"search","aria-label":e("gallery.searchLabel"),placeholder:e("gallery.search"),value:l,onChange:S=>s(S.target.value)}),(0,m.jsx)(P.SegmentedControl,{id:j,className:"art-segment",label:e("filter.type"),value:g??"all",options:[{value:"all",label:e("type.all")},{value:"page",label:e("type.page")},{value:"doc",label:e("type.doc")},{value:"design",label:e("type.design")}],onChange:S=>d(S==="all"?void 0:S)})]}),(0,m.jsxs)("div",{role:"tabpanel",id:j+"-"+(g??"all")+"-panel","aria-labelledby":j+"-"+(g??"all"),children:[I.status==="loading"?(0,m.jsx)("p",{className:"art-note",children:e("empty.loading")}):null,I.status==="failed"?(0,m.jsxs)("div",{className:"art-empty",role:"alert",children:[(0,m.jsx)("p",{className:"art-empty-title",children:e(J(I.code))}),(0,m.jsx)(P.Button,{size:"sm",variant:"outline",onClick:()=>p(S=>S+1),children:e("action.retry")})]}):null,I.status==="ready"&&I.failed>0?(0,m.jsxs)("div",{className:"art-bar","data-tone":"warn",role:"status",children:[(0,m.jsx)("span",{children:e("gallery.failedProjects")}),(0,m.jsx)(P.Button,{size:"sm",variant:"outline",onClick:()=>p(S=>S+1),children:e("action.retry")})]}):null,I.status==="ready"&&I.items.length===0&&I.failed===0?l!==""?(0,m.jsx)("p",{className:"art-note",children:e("empty.noMatch")}):g!==void 0?(0,m.jsx)("p",{className:"art-note",children:e("empty.typeMatch",{type:e(`type.${g}`)})}):(0,m.jsx)(Go,{t:e,variant:a.kind}):null,I.status==="ready"&&I.items.length>0?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(Qr,{t:e,heading:e("gallery.pinned"),views:Pe,pinned:z,onOpen:W,showProject:a.kind==="all"}),R.length===0?(0,m.jsx)("p",{className:"art-note",children:e("gallery.allPinned")}):(0,m.jsx)(Qr,{t:e,heading:e("gallery.recent"),views:R,pinned:z,onOpen:W,showProject:a.kind==="all"}),I.hasMore?(0,m.jsx)("div",{className:"art-gallery-more",children:(0,m.jsx)(P.Button,{size:"sm",variant:"outline",onClick:N.more,children:e("gallery.more")})}):null,I.truncated?(0,m.jsx)("p",{className:"art-note",children:e("gallery.truncated")}):null]}):null]})]})})]})}var _e=require("react/jsx-runtime"),en="dsh-artifact-studio.panel.scope",tn="dsh-artifact-studio.panel.workspace";function an({t:e,workspaces:t}){let a=(0,ee.useCallback)(y=>t.subscribe(y),[t]),r=(0,ee.useCallback)(()=>t.getSnapshot(),[t]),o=(0,ee.useSyncExternalStore)(a,r,r).items,l=(0,ee.useMemo)(()=>o.map(({workspaceId:y,title:z})=>({workspaceId:y,title:z})),[o]),[s,g]=(0,ee.useState)(()=>Sa(window.localStorage.getItem(en))??{kind:"all"}),[d,b]=(0,ee.useState)(()=>{let y=window.localStorage.getItem(tn);return y===null||y===""?null:y}),[T,w]=(0,ee.useState)(null),c=s.kind==="workspace"?o.find(y=>y.workspaceId===s.workspaceId):void 0,u=c!==void 0?c.workspaceId:d!==null&&o.some(y=>y.workspaceId===d)?d:o[0]?.workspaceId??null;(0,ee.useEffect)(()=>{if(o.length!==0){if(s.kind==="workspace"&&!o.some(y=>y.workspaceId===s.workspaceId)){g({kind:"all"});return}u!==null&&u!==d&&b(u)}},[o,s,u,d]),(0,ee.useEffect)(()=>{window.localStorage.setItem(en,Ut(s))},[s]),(0,ee.useEffect)(()=>{d!==null&&window.localStorage.setItem(tn,d)},[d]);let p=(0,ee.useMemo)(()=>T===null?void 0:Ee(T),[T]);return(0,_e.jsxs)("div",{className:"art-panel-stack",children:[(0,_e.jsx)("div",{className:"art-panel-region",hidden:p!==void 0,children:(0,_e.jsx)(Jr,{t:e,projects:l,scope:s,contextWorkspaceId:u,onScopeChange:g,open:y=>w(y)})}),p===void 0?null:(0,_e.jsx)("div",{className:"art-panel-region",children:(0,_e.jsx)(Lr,{t:e,address:p,workspaceName:o.find(y=>p.scope==="workspace"&&y.workspaceId===p.workspaceId)?.title,onBack:()=>w(null)})})]})}var rn="dsh-artifact-studio/styles",qo=Tr.split(`
|
|
86
|
+
`).map(e=>{let t=e.indexOf("{"),a=e.slice(0,t).split(",").map(n=>n.trim()).filter(n=>n!=="body"&&n!==".art-docpage");return(a.length===0?".art-docpage":a.map(n=>".art-docpage .art-prose "+n).join(", "))+" "+e.slice(t)}).join(`
|
|
87
|
+
`),Ko=`
|
|
72
88
|
.art-root {
|
|
73
89
|
box-sizing: border-box;
|
|
74
90
|
display: flex;
|
|
@@ -233,6 +249,7 @@ Start writing, or select text and choose Edit with agent.
|
|
|
233
249
|
.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
250
|
.art-cover-fallback { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; color: var(--dsw-alias-label-secondary); }
|
|
235
251
|
.art-cover-fallback svg { width: 26px; height: 26px; opacity: .55; }
|
|
252
|
+
.art-cover-design { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--dsw-alias-bg-document-preview, var(--dsw-alias-bg-layer-2)); }
|
|
236
253
|
.art-cover-doc { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 14px 14px 10px; background: var(--dsw-alias-bg-base); }
|
|
237
254
|
.art-cover-doc-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
|
|
238
255
|
.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); }
|
|
@@ -284,6 +301,17 @@ Start writing, or select text and choose Edit with agent.
|
|
|
284
301
|
.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
302
|
.art-drawer-head h2 { margin: 0; font-size: 13px; font-weight: 600; line-height: 1.4; }
|
|
286
303
|
.art-drawer-body { flex: 1; min-height: 0; overflow: auto; }
|
|
304
|
+
|
|
305
|
+
/* Design previews are rendered on the host; the plugin only frames the image. */
|
|
306
|
+
.art-design-preview { flex: 1; min-height: 0; overflow: auto; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; background: var(--dsw-alias-bg-layer-1); }
|
|
307
|
+
.art-design-canvas { display: flex; justify-content: center; width: 100%; }
|
|
308
|
+
.art-design-image { display: block; max-width: 100%; height: auto; border-radius: 10px; background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, .14), 0 10px 30px rgba(0, 0, 0, .10); }
|
|
309
|
+
.art-design-state { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; color: var(--dsw-alias-label-secondary); font-size: 12px; text-align: center; }
|
|
310
|
+
.art-design-error { max-width: 52ch; color: var(--dsw-alias-label-primary); line-height: 1.5; }
|
|
311
|
+
.art-design-warnings { width: 100%; max-width: 720px; padding: 10px 12px; border: .5px solid var(--dsw-alias-border-l2); border-radius: 8px; background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary); font-size: 12px; }
|
|
312
|
+
.art-design-warnings-title { display: block; margin-bottom: 4px; font-weight: 600; color: var(--dsw-alias-label-primary); }
|
|
313
|
+
.art-design-warnings ul { margin: 0; padding-left: 18px; }
|
|
314
|
+
|
|
287
315
|
/* 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
316
|
.art-frame { flex: 1; width: 100%; min-height: 0; border: none; background: var(--dsw-static-neutral-00); }
|
|
289
317
|
.art-source {
|
|
@@ -495,6 +523,9 @@ Start writing, or select text and choose Edit with agent.
|
|
|
495
523
|
.art-drawer { width: min(320px, 100%); }
|
|
496
524
|
.art-workspace-label { display: none; }
|
|
497
525
|
.art-docpage { padding: 28px 20px 64px; }
|
|
526
|
+
.art-canvas-dock { gap: 0; padding: 3px 4px; max-width: calc(100% - 12px); }
|
|
527
|
+
.art-dock-divider { margin: 0 2px; }
|
|
528
|
+
.art-layer-bar { bottom: 54px; }
|
|
498
529
|
}
|
|
499
530
|
@container (max-width: 520px) {
|
|
500
531
|
.art-toolbar { flex-direction: column; align-items: stretch; }
|
|
@@ -557,7 +588,113 @@ Start writing, or select text and choose Edit with agent.
|
|
|
557
588
|
.art-starter-name { font-size: 13px; font-weight: 600; color: var(--dsw-alias-label-primary); }
|
|
558
589
|
.art-starter-hint { font-size: 12px; line-height: 1.5; color: var(--dsw-alias-label-secondary); }
|
|
559
590
|
.art-tile-pin svg { width: 14px; height: 14px; }
|
|
560
|
-
|
|
591
|
+
.art-canvas { flex: 1; min-height: 0; display: flex; flex-direction: column; }
|
|
592
|
+
.art-canvas-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--dsw-alias-bg-document-preview, var(--dsw-alias-bg-layer-1)); }
|
|
593
|
+
.art-canvas-mount { position: absolute; inset: 0; }
|
|
594
|
+
.art-canvas-mount[hidden] { display: none; }
|
|
595
|
+
.art-canvas-mount:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }
|
|
596
|
+
.art-canvas-fallback { position: absolute; inset: 0; display: flex; overflow: auto; }
|
|
597
|
+
.art-canvas-opening {
|
|
598
|
+
position: absolute;
|
|
599
|
+
z-index: 3;
|
|
600
|
+
top: 10px;
|
|
601
|
+
left: 12px;
|
|
602
|
+
padding: 3px 8px;
|
|
603
|
+
border: .5px solid var(--dsw-alias-border-l2);
|
|
604
|
+
border-radius: 6px;
|
|
605
|
+
background: var(--dsw-alias-bg-base);
|
|
606
|
+
color: var(--dsw-alias-label-secondary);
|
|
607
|
+
font-size: 12px;
|
|
608
|
+
}
|
|
609
|
+
.art-canvas-empty {
|
|
610
|
+
position: absolute;
|
|
611
|
+
z-index: 2;
|
|
612
|
+
inset: 0;
|
|
613
|
+
display: flex;
|
|
614
|
+
align-items: center;
|
|
615
|
+
justify-content: center;
|
|
616
|
+
margin: 0;
|
|
617
|
+
padding: 24px;
|
|
618
|
+
color: var(--dsw-alias-label-secondary);
|
|
619
|
+
font-size: 12px;
|
|
620
|
+
text-align: center;
|
|
621
|
+
pointer-events: none;
|
|
622
|
+
}
|
|
623
|
+
.art-canvas-dock {
|
|
624
|
+
position: absolute;
|
|
625
|
+
z-index: 3;
|
|
626
|
+
left: 50%;
|
|
627
|
+
bottom: 14px;
|
|
628
|
+
transform: translateX(-50%);
|
|
629
|
+
display: flex;
|
|
630
|
+
align-items: center;
|
|
631
|
+
gap: 2px;
|
|
632
|
+
max-width: calc(100% - 20px);
|
|
633
|
+
padding: 4px 6px;
|
|
634
|
+
border: .5px solid var(--dsw-alias-border-l3);
|
|
635
|
+
border-radius: var(--dsw-radius-lg);
|
|
636
|
+
background: var(--dsw-alias-bg-layer-1);
|
|
637
|
+
box-shadow: 0 8px 24px color-mix(in srgb, var(--dsw-alias-label-primary) 18%, transparent);
|
|
638
|
+
}
|
|
639
|
+
.art-dock-button { flex: none; width: 28px; padding: 0; }
|
|
640
|
+
.art-dock-button[aria-pressed="true"] { background: var(--dsw-alias-interactive-bg-hover-accent); color: var(--dsw-alias-label-primary); }
|
|
641
|
+
.art-dock-divider { flex: none; width: .5px; height: 20px; margin: 0 4px; background: var(--dsw-alias-border-l2); }
|
|
642
|
+
.art-canvas-dock .art-dock-zoom,
|
|
643
|
+
.art-canvas-dock .art-dock-zoom.visible {
|
|
644
|
+
position: static;
|
|
645
|
+
inset: auto;
|
|
646
|
+
transform: none;
|
|
647
|
+
opacity: 1;
|
|
648
|
+
pointer-events: auto;
|
|
649
|
+
padding: 0;
|
|
650
|
+
border: 0;
|
|
651
|
+
border-radius: 0;
|
|
652
|
+
background: transparent;
|
|
653
|
+
box-shadow: none;
|
|
654
|
+
transition: none;
|
|
655
|
+
}
|
|
656
|
+
.art-layer-bar { bottom: 62px; gap: 8px; max-width: min(560px, calc(100% - 24px)); }
|
|
657
|
+
.art-layer-bar-glyph { flex: none; display: flex; color: var(--dsw-alias-label-secondary); }
|
|
658
|
+
.art-layer-bar-text { display: flex; flex-direction: column; min-width: 0; gap: 0; }
|
|
659
|
+
.art-layer-bar-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; color: var(--dsw-alias-label-primary); }
|
|
660
|
+
.art-layer-bar-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--dsw-alias-label-secondary); }
|
|
661
|
+
.art-inspector { display: flex; flex-direction: column; min-height: 0; height: 100%; }
|
|
662
|
+
.art-inspector-tabs { flex: 1; min-width: 0; }
|
|
663
|
+
.art-layer-tree { flex: 1; min-height: 0; overflow: auto; padding: 4px 6px 10px; outline: none; }
|
|
664
|
+
.art-layer-tree:focus-visible { outline: 2px solid var(--dsw-alias-brand-primary); outline-offset: -2px; }
|
|
665
|
+
.art-layer-row { display: flex; align-items: center; gap: 4px; height: 28px; padding-inline-end: 4px; border-radius: 6px; color: var(--dsw-alias-label-primary); font-size: 12px; }
|
|
666
|
+
.art-layer-row:hover, .art-layer-row:focus-within { background: var(--dsw-alias-interactive-bg-hover); }
|
|
667
|
+
.art-layer-row.is-selected { background: var(--dsw-alias-interactive-bg-hover-accent); }
|
|
668
|
+
.art-layer-caret { flex: none; display: flex; align-items: center; justify-content: center; width: 16px; height: 16px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--dsw-alias-label-secondary); cursor: pointer; }
|
|
669
|
+
.art-layer-icon { flex: none; display: flex; color: var(--dsw-alias-label-secondary); }
|
|
670
|
+
.art-layer-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
671
|
+
.art-layer-rename { flex: 1; min-width: 0; height: 20px; padding: 0 4px; border: .5px solid var(--dsw-alias-brand-primary); border-radius: 4px; background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-primary); font: inherit; font-size: 12px; }
|
|
672
|
+
.art-layer-actions { display: none; flex: none; gap: 2px; }
|
|
673
|
+
.art-layer-row:hover .art-layer-actions, .art-layer-row:focus-within .art-layer-actions, .art-layer-row.is-selected .art-layer-actions { display: flex; }
|
|
674
|
+
.art-layer-action { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--dsw-alias-label-secondary); cursor: pointer; }
|
|
675
|
+
.art-layer-action:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }
|
|
676
|
+
.art-inspector-empty { margin: 0; padding: 14px 12px; color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 1.55; }
|
|
677
|
+
.art-inspector-properties { display: flex; flex-direction: column; gap: 14px; padding: 10px 12px 16px; font-variant-numeric: tabular-nums; }
|
|
678
|
+
.art-inspector-node { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
679
|
+
.art-inspector-node-icon { flex: none; display: flex; color: var(--dsw-alias-label-secondary); }
|
|
680
|
+
.art-inspector-node-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
|
|
681
|
+
.art-inspector-node-type { flex: none; color: var(--dsw-alias-label-secondary); font-size: 11px; }
|
|
682
|
+
.art-inspector-group { display: flex; flex-direction: column; gap: 6px; }
|
|
683
|
+
.art-inspector-heading { margin: 0; font-size: 11px; font-weight: 600; color: var(--dsw-alias-label-secondary); }
|
|
684
|
+
.art-inspector-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
|
|
685
|
+
.art-inspector-field { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
686
|
+
.art-inspector-field-label { flex: none; color: var(--dsw-alias-label-tertiary); font-size: 11px; }
|
|
687
|
+
.art-inspector .art-inspector-input { flex: 1; min-width: 0; height: 28px; padding: 0 6px; border-radius: 6px; }
|
|
688
|
+
.art-inspector .art-inspector-input input { font-size: 12px; }
|
|
689
|
+
.art-inspector-appearance { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
|
|
690
|
+
.art-inspector-switch { display: flex; align-items: center; gap: 6px; height: 28px; }
|
|
691
|
+
.art-inspector-select { width: 100%; min-width: 0; height: 28px; padding: 0 6px; border: .5px solid var(--dsw-alias-border-l2); border-radius: 6px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; }
|
|
692
|
+
.art-inspector-hint { margin: 0; color: var(--dsw-alias-label-secondary); font-size: 12px; line-height: 1.55; }
|
|
693
|
+
.op-root { display: flex; width: 100%; height: 100%; min-width: 0; }
|
|
694
|
+
.op-canvas { position: relative; flex: 1; min-width: 0; height: 100%; }
|
|
695
|
+
.op-surface { width: 100%; height: 100%; }
|
|
696
|
+
.op-bridge { display: none; }
|
|
697
|
+
`;function nn(){if(typeof document>"u"||document.querySelector(`style[data-plugin-css="${rn}"]`)!==null)return;let e=document.createElement("style");e.dataset.plugin="dsh-artifact-studio",e.dataset.pluginCss=rn,e.textContent=Ko+qo,document.head.appendChild(e)}var Ce=require("react/jsx-runtime");var De="artifacts",sn=["artifact_create","artifact_update"],Yo=["connection","slots","locale","sidebarRightTabs","sidebarRight","workspaces"];function Qo(e){if(e===null||typeof e!="object"||!("selectPanel"in e))return null;let{selectPanel:t}=e;return typeof t!="function"?null:{selectPanel:a=>{t.call(e,a)}}}function Na(e){return function(a){return(0,Ce.jsx)(Ft,{title:a.t("error.surface"),hint:a.t("error.surfaceHint"),reloadLabel:a.t("action.reloadWindow"),children:(0,Ce.jsx)(e,{...a})})}}function Xo(){let e=Ja();return e===null?null:(0,Ce.jsx)(on.Toast,{text:e.message,onDone:()=>la(e.seq)},e.seq)}function Zo({useTabInfo:e}){let{tab:t}=e(),a=Ee(t.contentId??t.navigation?.address),r=Xa(a?.id);return(0,Ce.jsxs)("span",{className:"art-chip",children:[(0,Ce.jsx)(Te,{}),(0,Ce.jsx)("span",{children:r??a?.id??""})]})}function Jo(e){nn(),e.effect(er,"dsh-artifact-studio: unsaved draft guard"),Ga(e.connection),Se.sidebarRight=e.sidebarRight,Se.layout=Qo(e.get("layout")),e.locale.register(De,"en",Er),e.locale.register(De,"zh",Rr);let t=e.locale.bind(De),a=(l,s)=>t(l,s);e.effect(()=>e.sidebarRightTabs.register({id:ct,kind:va,priority:"extension",patterns:["dsh-resource://artifact/**"],canOpen:l=>Ee(l)!==void 0,title:l=>{let s=Ee(l);return s===void 0?"":Qa(s.id)??s.id}}),"dsh-artifact-studio: artifact tab type");let r=()=>({t:a});e.effect(()=>()=>la(),"dsh-artifact-studio: notification cleanup"),e.slots.inject("shell.overlay",()=>e.slots.register({name:"shell.overlay",id:"dsh-artifact-studio.notice"},Xo)),e.slots.inject("sidebar.right.pane.tab",()=>e.slots.register({name:"sidebar.right.pane.tab",key:ct,locale:De,inject:r},Na(ba))),e.slots.inject("sidebar.right.pane.tab.title",()=>e.slots.register({name:"sidebar.right.pane.tab.title",key:ct,locale:De,inject:r},Zo));for(let l of sn)e.slots.inject("tool.call.toolview",()=>e.slots.register({name:"tool.call.toolview",key:l,locale:De,inject:r},Na(ha)));e.slots.inject("conversation.input.left",()=>e.slots.register({name:"conversation.input.left",id:"dsh-artifact-studio",order:40,locale:De,inject:r},_r));function n({size:l}){return(0,Ce.jsx)(At,{size:l})}let o=()=>({t:a,workspaces:e.workspaces.list});e.slots.inject("main",()=>e.slots.register({name:"main",key:Xe,locale:De,inject:o},Na(an))),e.slots.inject("sidebar.panellist",()=>e.slots.register({name:"sidebar.panellist",id:Xe,order:10,label:()=>a("panel")},n))}
|
|
561
698
|
|
|
562
699
|
return module.exports;
|
|
563
700
|
},
|