@1agh/maude 0.60.0 → 0.60.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.
|
@@ -5650,7 +5650,7 @@ ${B.block}`:q,F=[],D=new Map;for await(let _ of X.prompt(N,J(),K,Q?.(),Y?.(),Z?.
|
|
|
5650
5650
|
|
|
5651
5651
|
> Maude ${l.app.maudeVersion} · ${l.app.platform} ${l.app.arch} · ${l.app.surface}
|
|
5652
5652
|
> Local report bundle: \`${n?.dir??".design/_reports/"}\` (attach its files here)`),X0=`${Zz0}?title=${c}&body=${U0}&labels=report`;if(X9())try{await mU(X0)}catch{window.open(X0,"_blank","noopener")}else window.open(X0,"_blank","noopener");I({fallbackDir:n?.dir??null}),W("done")}catch{$("Saving the local bundle failed too — please file the issue by hand.")}}let m=G.trim().length>0;return z("div",{className:"st-scrim",onClick:h,"data-testid":"report-bug-dialog",children:M("div",{className:"st-dialog rb-dialog",role:"dialog","aria-modal":"true","aria-labelledby":"rb-title",onClick:(l)=>l.stopPropagation(),children:[M("div",{className:"st-dialog-hd",children:[z("span",{className:"st-dialog-title",id:"rb-title",children:"Report a bug"}),z("button",{type:"button",className:"st-iconbtn",onClick:h,"aria-label":"Close",children:"×"})]}),M("div",{className:"st-dialog-bd rb-body",children:[Y==="describe"&&M(G0,{children:[z("label",{className:"rb-label",htmlFor:"rb-desc",children:"What happened? What did you expect instead?"}),z("textarea",{id:"rb-desc",className:"textarea","data-testid":"report-bug-description",rows:5,autoFocus:!0,value:G,onChange:(l)=>Z(l.target.value),placeholder:"e.g. Clicking Export → PNG shows a spinner forever…"}),z("p",{className:"rb-hint",children:"Next you'll see exactly what gets attached — nothing is sent until you approve it."}),M("footer",{className:"rb-actions",children:[z("button",{type:"button",className:"st-btn",onClick:h,children:"Cancel"}),z("button",{type:"button",className:"st-btn rb-primary","data-testid":"report-bug-preview",disabled:!m,onClick:()=>W("preview"),children:"Review & attach"})]})]}),Y==="preview"&&M(G0,{children:[M("div",{className:"rb-section",children:[M("div",{className:"rb-section-hd",children:[M("span",{children:["Screenshots (",U.length,")"]}),M("span",{className:"rb-hd-actions",children:[U.length<nA&&z("button",{type:"button",className:"rb-link","data-testid":"report-bug-attach",onClick:v,children:"Attach screenshot…"}),U.length>0&&z("button",{type:"button",className:`rb-link${w?" is-on":""}`,"data-testid":"report-bug-redact",onClick:()=>O((l)=>!l),children:w?"Done redacting":"Redact…"})]})]}),M("p",{className:"rb-hint",children:["Maude captures its own window and the active artboard for you. The window shot is a fresh render, so anything mid-flight — an open menu, a stuck spinner — won't be in it: grab that yourself (",Hz0(H?.app?.platform),") and attach or paste (⌘V) it here."]}),_&&z("p",{className:"rb-hint","data-testid":"report-bug-shell-pending",children:"Capturing the Maude window…"}),U.length===0&&!_?M("p",{className:"rb-hint",children:["No screenshot attached yet — up to ",nA,"."]}):M(G0,{children:[w&&z("p",{className:"rb-hint",children:"Drag over anything private — it ships as solid black."}),z("div",{className:"rb-shots",children:U.map((l,f)=>z(Uz0,{shot:l,redacting:w,onRects:(s)=>q((n)=>n.map((c,U0)=>U0===f?{...c,rects:s}:c)),onRemove:()=>{URL.revokeObjectURL(l.url),q((s)=>s.filter((n,c)=>c!==f))}},l.url))})]})]}),M("div",{className:"rb-section",children:[z("div",{className:"rb-section-hd",children:z("span",{children:"Included with the report"})}),M("label",{className:"rb-check",children:[z("input",{type:"checkbox",checked:!0,disabled:!0}),M("span",{children:["Maude ",H?.app?.maudeVersion??"…"," · ",H?.app?.platform??"…"," ",H?.app?.arch??""," · ",X9()?"desktop app":"browser"]})]}),Q&&M("label",{className:"rb-check",children:[z("input",{type:"checkbox",checked:F.activeCanvas,onChange:(l)=>D({...F,activeCanvas:l.target.checked})}),M("span",{children:["Active canvas path — ",z("code",{children:Q})]})]}),H?.context?.projectName&&M("label",{className:"rb-check",children:[z("input",{type:"checkbox",checked:F.projectName,onChange:(l)=>D({...F,projectName:l.target.checked})}),M("span",{children:["Project name — ",z("code",{children:H.context.projectName})]})]}),H?.logs?.serverLogTail?M("label",{className:"rb-check",children:[z("input",{type:"checkbox","data-testid":"report-bug-consent-logs",checked:F.logTail,onChange:(l)=>D({...F,logTail:l.target.checked})}),M("span",{children:["Recent server log (",H.logs.serverLogTail.split(`
|
|
5653
|
-
`).length," lines, paths & secrets scrubbed) —"," ",M("details",{className:"rb-details",children:[z("summary",{children:"view"}),z("pre",{className:"rb-log",children:H.logs.serverLogTail})]})]})]}):null,X9()&&B.length>0&&M("label",{className:"rb-check",children:[z("input",{type:"checkbox",checked:F.crashLogs,onChange:(l)=>D({...F,crashLogs:l.target.checked})}),M("span",{children:["Crash logs (",B.length,") — ",z("code",{children:B.map((l)=>l.name).join(", ")})]})]})]}),M("p",{className:"rb-hint",children:["Your description and the system info above become a"," ",z("strong",{children:"public GitHub issue"}),"; screenshots and logs go to a private repository only maintainers can open."]}),M("footer",{className:"rb-actions",children:[z("button",{type:"button",className:"st-btn",onClick:()=>W("describe"),children:"Back"}),z("button",{type:"button",className:"st-btn rb-primary","data-testid":"report-bug-send",onClick:o,children:"Send report"})]})]}),Y==="sending"&&z("p",{className:"rb-hint",children:"Sending your report…"}),Y==="done"&&M(G0,{children:[P?.issueUrl?M("p",{children:["Thank you — your report is filed as"," ",M("button",{type:"button",className:"rb-link","data-testid":"report-bug-issue-link",onClick:()=>{if(X9())mU(P.issueUrl).catch(()=>navigator.clipboard?.writeText(P.issueUrl));else window.open(P.issueUrl,"_blank","noopener")},children:["report #",P.issueNumber]})," ","on the public Maude issue tracker. Screenshots and logs stay in a private repository only maintainers can open — the issue links to them."]}):M("p",{children:["The bundle is saved locally",P?.fallbackDir?M(G0,{children:[" ","at ",z("code",{children:P.fallbackDir})]}):null," ","and a prefilled GitHub issue was opened — attach the bundle files there."]}),z("footer",{className:"rb-actions",children:z("button",{type:"button",className:"st-btn rb-primary",onClick:h,children:"Done"})})]}),Y==="fallback"&&M(G0,{children:[z("p",{className:"rb-error","data-testid":"report-bug-error",children:k}),z("p",{className:"rb-hint",children:"You can save the report locally instead and file it on GitHub yourself — the prefilled issue carries the text; screenshots stay on this machine unless you attach them by hand."}),M("footer",{className:"rb-actions",children:[z("button",{type:"button",className:"st-btn",onClick:()=>W("preview"),children:"Back"}),z("button",{type:"button",className:"st-btn rb-primary",onClick:x,children:"Save locally & open GitHub"})]})]})]})]})})}var ZJ=v8(p8(),1);function Kx(X){if(typeof X!=="string")return null;let J=X.match(/^(\d+)\.(\d+)\.(\d+)/);return J?[Number(J[1]),Number(J[2]),Number(J[3])]:null}function Ux(X,J){let Q=Kx(X),Y=Kx(J);if(!Q)return!1;if(!Y)return!0;for(let W=0;W<3;W++)if(Q[W]!==Y[W])return Q[W]>Y[W];return!1}function Vx(X,J){if(!Array.isArray(X))return[];return X.filter((Q)=>Q&&(Q.version==null||Ux(Q.version,J)))}function qx(X,J){let Q=J;if(Array.isArray(X)){for(let Y of X)if(Y&&Y.version&&Ux(Y.version,Q))Q=Y.version}return Q}var rA="mdcc-whatsnew-seen",aA="mdcc-whatsnew-toast-dismissed";function Vz0(X){return typeof X==="string"&&/^https?:\/\//i.test(X)}function qz0(X){try{let J=localStorage.getItem(rA);if(J)return J;localStorage.setItem(rA,X)}catch{}return X}function Bz0(){try{return localStorage.getItem(aA)}catch{return null}}function Bx(X){let[J,Q]=ZJ.useState([]),[Y,W]=ZJ.useState(X),[G,Z]=ZJ.useState(()=>qz0(X)),[H,K]=ZJ.useState(()=>Bz0()),[U,q]=ZJ.useState(!1);ZJ.useEffect(()=>{let O=!1,P=()=>{fetch("/_api/whats-new").then(($)=>$.json()).then(($)=>{if(O)return;if(Q(Array.isArray($?.entries)?$.entries:[]),typeof $?.version==="string")W($.version)}).catch(()=>{})};P();let I=()=>P(),k=()=>{if(document.visibilityState==="visible")P()};return window.addEventListener("focus",I),document.addEventListener("visibilitychange",k),()=>{O=!0,window.removeEventListener("focus",I),document.removeEventListener("visibilitychange",k)}},[]);let B=Vx(J,G),N=B.length>0&&H!==Y&&!U,F=B[0]??null,D=ZJ.useCallback(()=>{let O=qx(J,Y);Z(O),K(Y);try{localStorage.setItem(rA,O),localStorage.setItem(aA,Y)}catch{}},[J,Y]),_=ZJ.useCallback(()=>{K(Y);try{localStorage.setItem(aA,Y)}catch{}},[Y]),R=ZJ.useCallback(()=>q(!0),[]),w=ZJ.useCallback(()=>{q(!1),D()},[D]);return{entries:J,unseen:B,feedVersion:Y,panelOpen:U,openPanel:R,closePanel:w,showToast:N,toastEntry:F,dismissToast:_,markAllSeen:D}}function Nx({wn:X}){if(!X.showToast||!X.toastEntry)return null;let J=X.toastEntry,Q=X.unseen.length;return M("div",{className:"st-toast",role:"status","aria-live":"polite",children:[z("button",{type:"button",className:"st-toast-close","aria-label":"Dismiss",onClick:X.dismissToast,children:"×"}),M("div",{className:"st-toast-hd",children:[z("span",{"aria-hidden":"true",children:"✦"}),"What's new",J.version?` · v${J.version}`:""]}),z("div",{className:"st-toast-title",children:J.title}),z("div",{className:"st-toast-txt",children:J.summary}),M("div",{className:"st-toast-actions",children:[z("button",{type:"button",className:"btn btn--primary btn--sm",onClick:X.openPanel,children:Q>1?`See all (${Q})`:"Details"}),z("button",{type:"button",className:"btn btn--ghost btn--sm",onClick:X.dismissToast,children:"Dismiss"})]})]})}function Fx({wn:X,onStartTour:J}){let{panelOpen:Q,closePanel:Y}=X;if(ZJ.useEffect(()=>{if(!Q)return;function G(Z){if(Z.key==="Escape")Y()}return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[Q,Y]),!Q)return null;let W=new Set(X.unseen.map((G)=>G.id));return z("div",{className:"help-modal-backdrop",role:"presentation",onMouseDown:(G)=>{if(G.target===G.currentTarget)Y()},children:M("div",{className:"mdcc-wn-panel",role:"dialog","aria-modal":"true","aria-labelledby":"mdcc-wn-title",children:[M("header",{className:"help-modal-hd",children:[z("span",{className:"title",id:"mdcc-wn-title",children:"✦ What’s new in maude"}),z("button",{type:"button",className:"help-modal-close","aria-label":"Close (Esc)",onClick:Y,children:"×"})]}),z("div",{className:"mdcc-wn-panel__body",children:X.entries.length===0?z("p",{className:"mdcc-wn-empty",children:"Nothing new yet."}):z("ul",{className:"mdcc-wn-list",children:X.entries.map((G)=>M("li",{className:"mdcc-wn-item"+(W.has(G.id)?" is-unseen":""),children:[M("div",{className:"mdcc-wn-item__hd",children:[z("span",{className:"mdcc-wn-kind mdcc-wn-kind--"+G.kind,children:G.kind}),z("span",{className:"mdcc-wn-item__title",children:G.title}),z("span",{className:"mdcc-wn-item__ver",children:G.version?`v${G.version}`:"next"})]}),z("p",{className:"mdcc-wn-item__summary",children:G.summary}),Vz0(G.learnMore)&&z("a",{className:"mdcc-wn-item__more",href:G.learnMore,target:"_blank",rel:"noreferrer",children:"Learn more →"}),J&&Array.isArray(G.tour)&&G.tour.length>0&&z("button",{type:"button",className:"mdcc-wn-item__tour",onClick:()=>{Y(),J(G.tour)},children:"▶ Take tour"})]},G.id))})})]})})}var Q7=({as:X,size:J=14})=>z(X,{size:J,strokeWidth:1.75,style:{display:"block"}}),Te="mdcc-usage-tour-seen",Ie="mdcc-collab-tour-seen",d8="__system__",Z00="mdcc-theme",ke="mdcc-show-hidden",Ce="mdcc-sections-expanded",$e="maude-cp-mode",Se="mdcc-sidebar-open",be="mdcc-minimap-visible",ye="mdcc-zoomctl-visible",je="mdcc-annotations-visible";var wq0=30000;function Eq0(X){try{fetch("/_api/ui-prefs",{method:"POST",headers:{"content-type":"text/plain"},body:JSON.stringify(X)}).catch(()=>{})}catch{}}var uR=[{id:"tree",label:"Files"},{id:"layers",label:"Layers"},{id:"inspector",label:"Inspector"},{id:"comments",label:"Comments"},{id:"changes",label:"Changes"},{id:"sync",label:"Sync"},{id:"assistant",label:"Assistant"}],OK={tree:"left",layers:"left",inspector:"right",comments:"right",changes:"right",sync:"right",assistant:"right"},fe="mdcc-panel-sides",ve="mdcc-layers-mode";function he({side:X,width:J,open:Q,ids:Y,activeId:W,onPick:G,children:Z,labels:H=null}){return M("div",{className:"st-dockslot st-dockslot--"+X+(Q?"":" is-collapsed"),style:{width:Q?J:0,flexBasis:Q?J:0},children:[Q&&Y.length>1&&z("div",{className:"st-docktabs",role:"tablist","aria-label":X+" panels",children:Y.map((K)=>z("button",{type:"button",role:"tab","aria-selected":W===K,className:"st-docktab"+(W===K?" is-active":""),onClick:()=>G(K),children:H?.[K]||(uR.find((U)=>U.id===K)||{}).label||K},K))}),Z]})}var XQ=/\.(tsx|html?)$/i,Pq0=[[/\.md$/i,"markdown"],[/\.(css|json|txt|ya?ml)$/i,"text"],[/\.(svg|png|jpe?g|gif|webp|avif)$/i,"image"],[/\.(mp4|webm|mov)$/i,"video"],[/\.(mp3|wav|ogg|m4a)$/i,"audio"],[/\.(woff2?|ttf|otf)$/i,"font"]];function lR(X){for(let[J,Q]of Pq0)if(J.test(X))return Q;return null}function NF(X){return X.replace(/^\.[^/]+\//,"").replace(XQ,"").replace(/[^a-z0-9]+/gi,"-").toLowerCase().replace(/^-+|-+$/g,"")}var pR="0.60.0";function xe(X,J){let Q=()=>{try{if(typeof Notification<"u"&&Notification.permission==="granted")new Notification(X,{body:J})}catch{}};if(X9()){S7("send_notification",{title:X,body:J}).catch(Q);return}Q()}function Rq0(){if(typeof window>"u")return"dark";try{let X=localStorage.getItem(Z00);if(X==="light"||X==="dark")return X}catch{}return"dark"}function rZ(X,J){if(typeof window>"u")return J;try{let Q=localStorage.getItem(X);if(Q==="1")return!0;if(Q==="0")return!1}catch{}return J}function vR(X,J){if(typeof window>"u")return J;try{let Q=localStorage.getItem(X);return Q?JSON.parse(Q):J}catch{return J}}function Tq0(X){if(X.kind==="runtime")return!1;if(X.label==="Design system")return!1;return!0}function wK(X){return X.split("/").pop()}function x8(X,J=!1,Q){if(typeof document>"u")return;let Y=document.getElementById("st-op-toast");if(!Y)Y=document.createElement("div"),Y.id="st-op-toast",Y.setAttribute("role","status"),Y.style.cssText="position:fixed;left:50%;bottom:64px;transform:translateX(-50%);z-index:80;display:flex;align-items:center;gap:10px;max-width:440px;padding:8px 14px;border-radius:8px;font:12px/1.45 var(--font-mono,monospace);box-shadow:0 8px 28px rgba(0,0,0,.34);pointer-events:none;opacity:0;transition:opacity 140ms ease;",document.body.appendChild(Y);Y.style.background=J?"#1d3524":"#3a1d1d",Y.style.color=J?"#b7e4c0":"#f1b8b8",Y.textContent="";let W=document.createElement("span");if(W.textContent=X,Y.appendChild(W),Q){let G=document.createElement("button");G.type="button",G.textContent=Q.label,G.style.cssText="pointer-events:auto;background:none;border:0;text-decoration:underline;color:inherit;font:inherit;cursor:pointer;padding:0;",G.onclick=()=>{Q.onClick(),Y.style.opacity="0",Y.style.pointerEvents="none"},Y.appendChild(G)}Y.style.opacity="1",Y.style.pointerEvents=Q?"auto":"none",clearTimeout(x8._t),x8._t=setTimeout(()=>{Y.style.opacity="0",Y.style.pointerEvents="none"},Q?6000:3200)}var ge="maude-browse-hint-seen";function Iq0(X=!1){if(typeof document>"u"||typeof localStorage>"u")return;try{if(localStorage.getItem(ge)==="1")return}catch{return}if(document.getElementById("st-browse-hint"))return;let J=document.createElement("div");J.id="st-browse-hint",J.setAttribute("role","status"),J.style.cssText="position:fixed;left:50%;bottom:64px;transform:translateX(-50%);z-index:81;display:flex;align-items:center;gap:10px;max-width:520px;padding:10px 14px;border-radius:10px;font:12px/1.5 var(--font-ui,system-ui,sans-serif);background:var(--surface-2,#1b1e24);color:var(--text-1,#e7eaf0);border:1px solid var(--border-1,#333a45);box-shadow:0 10px 34px rgba(0,0,0,.42);opacity:0;transition:opacity 160ms ease;",J.innerHTML="<span>Your mock is <strong>live</strong> — click things to try it. "+'Press <kbd style="padding:1px 6px;border-radius:5px;border:1px solid var(--border-1,#333a45);background:var(--surface-3,#262b33);font-family:var(--font-mono,monospace)">V</kbd> '+(X?"to select & inspect.</span>":"to select & edit like Figma.</span>")+'<button type="button" aria-label="Dismiss" style="background:none;border:none;color:inherit;'+'cursor:pointer;font-size:15px;line-height:1;opacity:.65;padding:2px">×</button>';let Q=()=>{try{localStorage.setItem(ge,"1")}catch{}J.style.opacity="0",setTimeout(()=>J.remove(),200),document.removeEventListener("keydown",Y,!0)},Y=(W)=>{if((W.key==="v"||W.key==="V")&&!W.metaKey&&!W.ctrlKey&&!W.altKey)Q()};J.querySelector("button")?.addEventListener("click",Q),document.addEventListener("keydown",Y,!0),document.body.appendChild(J),requestAnimationFrame(()=>{J.style.opacity="1"}),setTimeout(Q,9000)}function vW(X){return X.replace(XQ,"")}function kq0(X){return X.replace(XQ,"")}function Cq0(X){let J=new Map;for(let G of X){if(!XQ.test(G.name))continue;let Z=kq0(G.name);if(!J.has(Z)||/\.tsx$/i.test(G.name))J.set(Z,G)}let Q=new Map,Y=[];for(let G of X){if(XQ.test(G.name))continue;let Z=null;for(let H of J.keys()){if(G.name===H)continue;if(G.name.startsWith(`${H}.`)){if(!Z||H.length>Z.length)Z=H}}if(Z){let H=Q.get(Z)||[];H.push(G),Q.set(Z,H)}else Y.push(G)}let W=[];for(let[G,Z]of J){let H=(Q.get(G)||[]).sort((K,U)=>K.name.localeCompare(U.name));W.push({primary:Z,sidecars:H,orphan:!1})}return W.sort((G,Z)=>G.primary.name.localeCompare(Z.primary.name)),Y.sort((G,Z)=>G.name.localeCompare(Z.name)),{canvases:W,orphans:Y.map((G)=>({primary:G,sidecars:[],orphan:!0}))}}function $q0(X,J,Q){let Y={};for(let W of Q||[]){let Z=(W.startsWith(J)?W.slice(J.length).replace(/^\/+/,""):W).split("/").filter(Boolean),H=Y;for(let K of Z)H=H[K]=H[K]||{};H._files=H._files||[]}for(let W of X){let Z=(W.startsWith(J)?W.slice(J.length).replace(/^\/+/,""):W).split("/"),H=Y;for(let K=0;K<Z.length;K++){let U=Z[K];if(K===Z.length-1)H._files=H._files||[],H._files.push({name:U,path:W});else H[U]=H[U]||{},H=H[U]}}return Y}function H00(X,J){if(!J)return X;let Q=J.toLowerCase(),Y={},W=!1,G=Object.keys(X).filter((Z)=>Z!=="_files");for(let Z of G){let H=H00(X[Z],J);if(H)Y[Z]=H,W=!0}if(X._files){let Z=X._files.filter((H)=>H.name.toLowerCase().includes(Q)||H.path.toLowerCase().includes(Q));if(Z.length)Y._files=Z,W=!0}return W?Y:null}function qF(X){return(X||[]).filter((J)=>J.status!=="resolved").length}function Sq0(X){if(!X)return"";let J=new Date(X).getTime();if(!J)return"";let Q=Math.max(0,Math.floor((Date.now()-J)/1000));if(Q<60)return Q+"s";let Y=Math.floor(Q/60);if(Y<60)return Y+"m";let W=Math.floor(Y/60);if(W<24)return W+"h";let G=Math.floor(W/24);if(G<7)return G+"d";return new Date(X).toLocaleDateString()}function z00(X){let J=0,Q=0,Y=0;for(let W of Object.values(X||{}))for(let G of W||[])if(J++,G.status==="resolved")Y++;else Q++;return{all:J,open:Q,resolved:Y}}function FF({d:X,size:J=14,color:Q}){return z("svg",{width:J,height:J,viewBox:"0 0 24 24",fill:"none",stroke:Q||"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:z("path",{d:X})})}var bq0={"chevron-down":z("polyline",{points:"3.5 6 8 10.5 12.5 6"}),"chevron-right":z("polyline",{points:"6 3.5 10.5 8 6 12.5"}),file:M(G0,{children:[z("path",{d:"M4 2h5l3 3v9H4z"}),z("polyline",{points:"9 2 9 5 12 5"})]}),folder:z("path",{d:"M2 4.5h4l1.3 1.5H14V13H2z"}),"folder-plus":M(G0,{children:[z("path",{d:"M2 4.5h4l1.3 1.5H14V13H2z"}),z("path",{d:"M8 7.5v3.5M6.25 9.25h3.5"})]}),lock:M(G0,{children:[z("rect",{x:"3.5",y:"7",width:"9",height:"6.5",rx:"1"}),z("path",{d:"M5.5 7V5a2.5 2.5 0 015 0v2"})]}),unlock:M(G0,{children:[z("rect",{x:"3.5",y:"7",width:"9",height:"6.5",rx:"1"}),z("path",{d:"M5.5 7V5a2.5 2.5 0 015-.7"})]}),search:M(G0,{children:[z("circle",{cx:"7",cy:"7",r:"4"}),z("line",{x1:"10",y1:"10",x2:"13.5",y2:"13.5"})]}),plus:M(G0,{children:[z("line",{x1:"8",y1:"3",x2:"8",y2:"13"}),z("line",{x1:"3",y1:"8",x2:"13",y2:"8"})]}),check:z("polyline",{points:"3 8.2 6.4 11.5 13 4.2"}),x:M(G0,{children:[z("line",{x1:"4.3",y1:"4.3",x2:"11.7",y2:"11.7"}),z("line",{x1:"11.7",y1:"4.3",x2:"4.3",y2:"11.7"})]}),sun:M(G0,{children:[z("circle",{cx:"8",cy:"8",r:"2.6"}),z("line",{x1:"8",y1:"1.5",x2:"8",y2:"3"}),z("line",{x1:"8",y1:"13",x2:"8",y2:"14.5"}),z("line",{x1:"1.5",y1:"8",x2:"3",y2:"8"}),z("line",{x1:"13",y1:"8",x2:"14.5",y2:"8"}),z("line",{x1:"3.4",y1:"3.4",x2:"4.4",y2:"4.4"}),z("line",{x1:"11.6",y1:"11.6",x2:"12.6",y2:"12.6"}),z("line",{x1:"12.6",y1:"3.4",x2:"11.6",y2:"4.4"}),z("line",{x1:"4.4",y1:"11.6",x2:"3.4",y2:"12.6"})]}),moon:z("path",{d:"M12.5 9.6A5 5 0 1 1 7 3a4 4 0 0 0 5.5 6.6z"}),sparkle:z("path",{d:"M8 1.8l1.4 4.8L14 8l-4.6 1.4L8 14.2l-1.4-4.8L2 8l4.6-1.4z",fill:"currentColor",stroke:"none"}),megaphone:M(G0,{children:[z("path",{d:"M2 6.7 11 4v8L2 9.3z"}),z("path",{d:"M11 5.2a2.4 2.4 0 0 1 0 5.6"}),z("path",{d:"M4.3 9.5v2.3a1.2 1.2 0 0 0 2.4 0v-1.7"})]}),bug:M(G0,{children:[z("circle",{cx:"8",cy:"9",r:"3.6"}),z("circle",{cx:"8",cy:"4.4",r:"1.3"}),z("path",{d:"M6.2 3.4 5.2 2M9.8 3.4l1-1.4"}),z("path",{d:"M4.6 7.6H2.2M4.6 9H2.2M4.6 10.6H2.5M11.4 7.6h2.4M11.4 9h2.4M11.4 10.6h2.3"})]}),"panel-left":M(G0,{children:[z("rect",{x:"2.5",y:"3",width:"11",height:"10",rx:"1.5"}),z("line",{x1:"6.4",y1:"3",x2:"6.4",y2:"13"})]}),resolve:M(G0,{children:[z("circle",{cx:"8",cy:"8",r:"5.6"}),z("polyline",{points:"5.4 8 7.2 9.9 10.6 6"})]}),reopen:M(G0,{children:[z("path",{d:"M3.2 8a5 5 0 1 1 1.4 3.5"}),z("polyline",{points:"3.2 11.4 3.2 8 6.6 8"})]}),layers:M(G0,{children:[z("polygon",{points:"8 2.2 13.8 5.5 8 8.8 2.2 5.5"}),z("polyline",{points:"2.2 9 8 12.3 13.8 9"})]}),box:z("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1.2"}),type:M(G0,{children:[z("polyline",{points:"4 4 12 4"}),z("line",{x1:"8",y1:"4",x2:"8",y2:"12"})]}),button:M(G0,{children:[z("rect",{x:"2.5",y:"5",width:"11",height:"6",rx:"3"}),z("line",{x1:"6",y1:"8",x2:"10",y2:"8"})]}),input:M(G0,{children:[z("rect",{x:"2.5",y:"5",width:"11",height:"6",rx:"1.2"}),z("line",{x1:"5",y1:"8",x2:"5",y2:"8"})]}),link:M(G0,{children:[z("path",{d:"M6.5 9.5a2.5 2.5 0 0 1 0-3.5l1.5-1.5a2.5 2.5 0 0 1 3.5 3.5l-1 1"}),z("path",{d:"M9.5 6.5a2.5 2.5 0 0 1 0 3.5l-1.5 1.5a2.5 2.5 0 0 1-3.5-3.5l1-1"})]}),list:M(G0,{children:[z("line",{x1:"6",y1:"4.5",x2:"13",y2:"4.5"}),z("line",{x1:"6",y1:"8",x2:"13",y2:"8"}),z("line",{x1:"6",y1:"11.5",x2:"13",y2:"11.5"}),z("circle",{cx:"3.2",cy:"4.5",r:"0.8",fill:"currentColor"}),z("circle",{cx:"3.2",cy:"8",r:"0.8",fill:"currentColor"}),z("circle",{cx:"3.2",cy:"11.5",r:"0.8",fill:"currentColor"})]}),eye:M(G0,{children:[z("path",{d:"M1.5 8S4 3.5 8 3.5 14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8z"}),z("circle",{cx:"8",cy:"8",r:"2"})]}),eyedropper:M(G0,{children:[z("path",{d:"M11 2.6a1.7 1.7 0 0 1 2.4 2.4l-1.2 1.2-2.4-2.4z"}),z("path",{d:"M9.5 4.6 4 10.1V12h1.9l5.5-5.5"})]}),"p-corner":z("path",{d:"M3.5 12.5V7a3.5 3.5 0 0 1 3.5-3.5h5.5"}),"p-opacity":M(G0,{children:[z("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1.5"}),z("path",{d:"M3 8h10M8 3v10",strokeWidth:"0.9",opacity:"0.55"})]}),"p-lineheight":M(G0,{children:[z("line",{x1:"6.5",y1:"4",x2:"13",y2:"4"}),z("line",{x1:"6.5",y1:"8",x2:"13",y2:"8"}),z("line",{x1:"6.5",y1:"12",x2:"13",y2:"12"}),z("path",{d:"M3.2 4.6 3.2 11.4M2 6 3.2 4.5 4.4 6M2 10 3.2 11.5 4.4 10"})]}),"p-letterspacing":M(G0,{children:[z("path",{d:"M3 4v8M13 4v8"}),z("path",{d:"M6 11.5 8 5l2 6.5M6.7 9.3h2.6",strokeWidth:"1.1"})]}),"p-gap":M(G0,{children:[z("rect",{x:"2",y:"4.5",width:"3.6",height:"7",rx:"0.6"}),z("rect",{x:"10.4",y:"4.5",width:"3.6",height:"7",rx:"0.6"}),z("path",{d:"M6.8 8h2.4M7.4 6.9 6.4 8l1 1.1M8.6 6.9 9.6 8l-1 1.1",strokeWidth:"1"})]}),"p-border":z("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"}),"p-size":M(G0,{children:[z("path",{d:"M3 13 6.6 3l3.6 10"}),z("path",{d:"M4.3 9.6h4.6"})]}),"eye-off":M(G0,{children:[z("path",{d:"M6.3 4A6.7 6.7 0 0 1 8 3.5C12 3.5 14.5 8 14.5 8a12 12 0 0 1-2 2.4M4.4 5.3A12 12 0 0 0 1.5 8S4 12.5 8 12.5a6.5 6.5 0 0 0 2.1-.35"}),z("line",{x1:"2.5",y1:"2.5",x2:"13.5",y2:"13.5"})]}),sliders:M(G0,{children:[z("line",{x1:"3",y1:"5",x2:"13",y2:"5"}),z("circle",{cx:"6",cy:"5",r:"1.7",fill:"currentColor"}),z("line",{x1:"3",y1:"11",x2:"13",y2:"11"}),z("circle",{cx:"10",cy:"11",r:"1.7",fill:"currentColor"})]}),code:M(G0,{children:[z("polyline",{points:"6 5 3 8 6 11"}),z("polyline",{points:"10 5 13 8 10 11"})]}),download:M(G0,{children:[z("line",{x1:"8",y1:"2.5",x2:"8",y2:"10"}),z("polyline",{points:"4.5 7 8 10.5 11.5 7"}),z("polyline",{points:"3 12.8 3 13.6 13 13.6 13 12.8"})]}),reload:M(G0,{children:[z("path",{d:"M14 8a6 6 0 1 1-2-4.47L14 5.33"}),z("path",{d:"M14 2v3.33h-3.33"})]}),help:M(G0,{children:[z("circle",{cx:"8",cy:"8",r:"6"}),z("path",{d:"M6.3 6.2a1.8 1.8 0 1 1 2.3 1.9c-.5.2-.6.5-.6 1v.3"}),z("line",{x1:"8",y1:"11.4",x2:"8",y2:"11.5"})]}),image:M(G0,{children:[z("rect",{x:"2.5",y:"3",width:"11",height:"10",rx:"1.5"}),z("circle",{cx:"6",cy:"6.3",r:"1.1"}),z("path",{d:"M3 12l3-2.8 2.2 1.8 2.4-3L13.5 12"})]}),vector:M(G0,{children:[z("path",{d:"M3.6 11.2C6 5 10 5 12.4 11.2"}),z("rect",{x:"1.7",y:"9.8",width:"2.6",height:"2.6",rx:"0.4"}),z("rect",{x:"11.7",y:"9.8",width:"2.6",height:"2.6",rx:"0.4"}),z("rect",{x:"6.7",y:"2.6",width:"2.6",height:"2.6",rx:"0.4"})]}),presentation:M(G0,{children:[z("rect",{x:"2.5",y:"3",width:"11",height:"7.4",rx:"1"}),z("line",{x1:"8",y1:"10.4",x2:"8",y2:"13"}),z("line",{x1:"5.6",y1:"13.4",x2:"10.4",y2:"13.4"})]}),archive:M(G0,{children:[z("rect",{x:"2.5",y:"3",width:"11",height:"3",rx:"0.8"}),z("path",{d:"M3.6 6v6.2a1 1 0 0 0 1 1h6.8a1 1 0 0 0 1-1V6"}),z("line",{x1:"6.6",y1:"8.8",x2:"9.4",y2:"8.8"})]}),external:M(G0,{children:[z("path",{d:"M11 8.5V12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h3.5"}),z("polyline",{points:"9.5 3 13 3 13 6.5"}),z("line",{x1:"13",y1:"3",x2:"7.6",y2:"8.4"})]}),share:M(G0,{children:[z("circle",{cx:"4",cy:"8",r:"1.9"}),z("circle",{cx:"11.6",cy:"3.6",r:"1.9"}),z("circle",{cx:"11.6",cy:"12.4",r:"1.9"}),z("line",{x1:"5.7",y1:"7",x2:"9.9",y2:"4.6"}),z("line",{x1:"5.7",y1:"9",x2:"9.9",y2:"11.4"})]}),pen:M(G0,{children:[z("path",{d:"M3 13l.8-3L10.6 3.2a1.1 1.1 0 0 1 1.6 0l.6.6a1.1 1.1 0 0 1 0 1.6L6 12.2z"}),z("line",{x1:"9.6",y1:"4.2",x2:"11.8",y2:"6.4"})]}),square:z("rect",{x:"3.5",y:"3.5",width:"9",height:"9",rx:"1"})};function yq0({open:X,onClose:J,actions:Q}){let[Y,W]=u.useState(""),[G,Z]=u.useState(0),H=u.useRef(null);u.useEffect(()=>{if(X)W(""),Z(0)},[X]),u.useEffect(()=>{H.current?.querySelector(".st-pal-item.is-active")?.scrollIntoView({block:"nearest"})},[G]);let K=u.useMemo(()=>{let q=Y.trim().toLowerCase();if(!q)return Q;return Q.filter((B)=>B.label.toLowerCase().includes(q)||B.group&&B.group.toLowerCase().includes(q))},[Y,Q]);if(u.useEffect(()=>{if(G>=K.length)Z(0)},[K.length,G]),!X)return null;let U=(q)=>{J(),q.run()};return z("div",{className:"st-scrim",role:"presentation",onMouseDown:(q)=>{if(q.target===q.currentTarget)J()},children:M("div",{className:"st-palette",role:"dialog","aria-modal":"true","aria-label":"Command palette",children:[M("div",{className:"st-pal-search",children:[z(A9,{name:"search",size:18}),z("input",{autoFocus:!0,placeholder:"Type a command or search…",value:Y,"aria-label":"Command search",onChange:(q)=>W(q.target.value),onKeyDown:(q)=>{if(q.key==="Escape")q.preventDefault(),J();else if(q.key==="ArrowDown")q.preventDefault(),Z((B)=>Math.min(K.length-1,B+1));else if(q.key==="ArrowUp")q.preventDefault(),Z((B)=>Math.max(0,B-1));else if(q.key==="Enter"){if(q.preventDefault(),K[G])U(K[G])}}}),z(MX,{children:"⌘K"})]}),z("div",{className:"st-pal-list",ref:H,children:K.length===0?z("div",{className:"st-pal-empty",children:"No matching command."}):K.map((q,B)=>{let N=q.group&&(B===0||K[B-1].group!==q.group)?z("div",{className:"st-pal-group",children:q.group},"g-"+q.group):null;return M(G0,{children:[N,M("button",{type:"button",className:"st-pal-item"+(B===G?" is-active":""),onMouseEnter:()=>Z(B),onClick:()=>U(q),children:[z("span",{className:"st-pal-icon",children:z(A9,{name:q.icon,size:15})}),z("span",{className:"st-pal-label",children:q.label}),q.kbd?z("span",{className:"st-pal-kbd",children:z(MX,{children:q.kbd})}):null]})]},q.id)})})]})})}function A9({name:X,size:J=16,className:Q}){return z("svg",{className:Q,width:J,height:J,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flex:"none"},children:bq0[X]})}function jq0(X){if(!X||typeof X!=="string")return"?";let J=X.trim().split(/[\s._-]+/).filter(Boolean);if(!J.length)return"?";if(J.length===1)return J[0].slice(0,2).toUpperCase();return((J[0][0]||"")+(J[J.length-1][0]||"")).toUpperCase()||"?"}function me({initials:X,hue:J,title:Q,pulse:Y}){return z("span",{className:"st-avatar"+(Y?" is-pulsing":""),style:{"--av-hue":J},"data-tip":Q,"aria-label":Q,children:X})}function MX({children:X}){return z("span",{className:"kbd",children:X})}function ue(X,{min:J,max:Q,def:Y}){let W=u.useCallback((K)=>Math.min(Q,Math.max(J,K)),[J,Q]),[G,Z]=u.useState(()=>{try{let K=parseInt(localStorage.getItem(X)||"",10);return Number.isFinite(K)?W(K):Y}catch{return Y}});u.useEffect(()=>{try{localStorage.setItem(X,String(G))}catch{}},[X,G]);let H=u.useCallback((K)=>Z((U)=>W(typeof K==="function"?K(U):K)),[W]);return{w:G,setW:H,min:J,max:Q,def:Y}}function le({label:X,size:J,onPointerDown:Q,active:Y,dir:W="ltr"}){let{w:G,setW:Z,min:H,max:K,def:U}=J,q=W==="rtl"?-1:1;return z("div",{className:"st-grip"+(Y?" is-active":""),role:"separator",tabIndex:0,"aria-orientation":"vertical","aria-label":X,"aria-valuemin":H,"aria-valuemax":K,"aria-valuenow":Math.round(G),onPointerDown:Q,onDoubleClick:()=>Z(U),onKeyDown:(B)=>{let N=B.shiftKey?24:8;if(B.key==="ArrowRight")B.preventDefault(),Z((F)=>F+N*q);else if(B.key==="ArrowLeft")B.preventDefault(),Z((F)=>F-N*q);else if(B.key==="Home")B.preventDefault(),Z(H);else if(B.key==="End")B.preventDefault(),Z(K)},children:M("svg",{className:"st-grip-dots",viewBox:"0 0 6 18","aria-hidden":"true",children:[z("circle",{cx:"3",cy:"3",r:"1.1",fill:"currentColor"}),z("circle",{cx:"3",cy:"9",r:"1.1",fill:"currentColor"}),z("circle",{cx:"3",cy:"15",r:"1.1",fill:"currentColor"})]})})}var hR=[{id:"png",label:"PNG",sub:"raster · 2×",icon:"image",format:"png",options:{scale:2}},{id:"pdf",label:"PDF",sub:"vector · print",icon:"file",format:"pdf"},{id:"svg",label:"SVG",sub:"per artboard",icon:"vector",format:"svg"},{id:"html",label:"HTML",sub:"self-contained",icon:"code",format:"html"},{id:"pptx",label:"PPTX",sub:"slides",icon:"presentation",format:"pptx"},{id:"mp4",label:"MP4",sub:"video · H.264",icon:"presentation",format:"mp4",temporal:!0},{id:"gif",label:"GIF",sub:"animated",icon:"image",format:"gif",temporal:!0},{id:"canva",label:"Canva",sub:"handoff bundle",icon:"external",format:"canva"},{id:"zip",label:"ZIP",sub:"project bundle",icon:"archive",format:"zip"},{id:"shadcn",label:"AI handoff",sub:"production drop",icon:"sparkle",handoff:!0}],xR={selection:"Current selection",artboard:"Active artboard","canvas-as-separate":"Canvas · artboards separate","project-raw":"Whole project (raw)"},fq0={png:["selection","artboard","canvas-as-separate"],pdf:["selection","artboard","canvas-as-separate"],svg:["selection","artboard","canvas-as-separate"],html:["artboard","canvas-as-separate"],pptx:["canvas-as-separate"],mp4:["artboard"],gif:["artboard"],webm:["artboard"],canva:["canvas-as-separate"],zip:["project-raw"]},vq0=[{value:1,label:"1× (native)"},{value:2,label:"2× (retina)"},{value:3,label:"3× (max)"}],T3=[{id:"1x",label:"1× (native)",kind:"scale",value:1},{id:"2x",label:"2× (retina)",kind:"scale",value:2},{id:"3x",label:"3× (max)",kind:"scale",value:3},{id:"dpi150",label:"150 dpi",kind:"dpi",value:150},{id:"dpi300",label:"300 dpi (print)",kind:"dpi",value:300},{id:"dpi600",label:"600 dpi (high-res print)",kind:"dpi",value:600}],hq0="2x",pe=[{id:"auto",label:"Auto (1×)",value:void 0},{id:"dpi150",label:"150 dpi",value:150},{id:"dpi300",label:"300 dpi (print)",value:300},{id:"dpi600",label:"600 dpi (high-res print)",value:600}],xq0="auto",gq0={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",svg:"image/svg+xml",mp4:"video/mp4",mov:"video/quicktime",webm:"video/webm",m4v:"video/mp4",ogg:"video/ogg",mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",oga:"audio/ogg",opus:"audio/opus"};function mq0(X){let J=String(X||"").split(".").pop()?.toLowerCase();return gq0[J]||"application/octet-stream"}function uq0({designRel:X,onPick:J,onClose:Q,multiple:Y=!1,hasArtboardAnchor:W=!1,onPickMany:G}){let[Z,H]=u.useState(null),[K,U]=u.useState(!1),[q,B]=u.useState(null),[N,F]=u.useState(()=>new Set),[D,_]=u.useState({}),[R,w]=u.useState(W?"artboard":"annotation");u.useEffect(()=>{let x=!0;return fetch("/_api/assets").then((m)=>m.json()).then((m)=>{if(!x)return;let l=m.ok?m.assets:[];H(l),_((f)=>{let s={...f};for(let n of l)s[n.path]=n.kind;return s})}).catch(()=>x&&H([])),()=>{x=!1}},[]),u.useEffect(()=>{let x=(m)=>{if(m.key==="Escape")m.stopPropagation(),Q()};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[Q]);let O=Array.from(N).some((x)=>(D[x]||"image")!=="image"),P=!W||O,I=!W?"No artboard on this canvas":O?"Video/audio can only be added as annotations":"";u.useEffect(()=>{if(P&&R==="artboard")w("annotation")},[P,R]);let k=(x)=>{F((m)=>{let l=new Set(m);if(l.has(x))l.delete(x);else l.add(x);return l})},$=async(x)=>{let m=await fetch("/_api/asset",{method:"POST",headers:{"content-type":x.type||"application/octet-stream"},body:x}),l=await m.json().catch(()=>({}));if(m.ok&&l.path)return{ok:!0,path:l.path};return{ok:!1,error:l.error||`upload failed (HTTP ${m.status})`}},C=async(x)=>{if(!x)return;U(!0),B(null);let m=await $(x);if(U(!1),m.ok)J(m.path);else B(m.error)},b=(x)=>{if(typeof x==="string"&&x.startsWith("video/"))return"video";if(typeof x==="string"&&x.startsWith("audio/"))return"audio";return"image"},v=async(x)=>{if(!x.length)return;U(!0),B(null);let m=await Promise.all(x.map((s)=>$(s).then((n)=>({...n,file:s}))));U(!1);let l=m.filter((s)=>s.ok),f=m.length-l.length;if(f>0)B(`${f} of ${m.length} uploads failed`);if(l.length)_((s)=>{let n={...s};for(let c of l)n[c.path]=b(c.file.type);return n}),F((s)=>{let n=new Set(s);for(let c of l)n.add(c.path);return n})},h=async()=>{U(!0),B(null);try{if(Y){let l=(await Pv()||[]).map((f)=>new File([new Uint8Array(f.bytes)],f.name,{type:mq0(f.name)}));if(U(!1),l.length)await v(l);return}let x=await BZ();if(x?.bytes){await C(new Blob([new Uint8Array(x.bytes)]));return}}catch(x){B(x?.message||"open failed")}U(!1)},d=()=>{if(X9()){h();return}let x=document.createElement("input");if(x.type="file",x.accept="image/*,video/*",Y)x.multiple=!0;x.style.cssText="position:fixed;left:-9999px;top:0;width:1px;height:1px;opacity:0;pointer-events:none",document.body.appendChild(x);let m=()=>{if(x.isConnected)x.remove()};window.addEventListener("focus",()=>setTimeout(m,300),{once:!0}),x.addEventListener("change",()=>{let l=x.files?Array.from(x.files):[];if(m(),!l.length)return;if(Y)v(l);else C(l[0])}),x.click()},o=(x)=>`/${X}/${x}`;return z("div",{className:"st-scrim",role:"presentation",onMouseDown:(x)=>{if(x.target===x.currentTarget)Q()},children:M("div",{className:"st-dialog st-asset-picker",role:"dialog","aria-modal":"true","aria-label":"Choose media",children:[M("div",{className:"st-dialog-hd",children:[z("span",{className:"st-dialog-title",children:"Choose media"}),z("button",{type:"button",className:"st-iconbtn","aria-label":"Close",onClick:Q,children:z(A9,{name:"x",size:15})})]}),M("div",{className:"st-dialog-bd",children:[M("div",{className:"st-ap-toolbar",children:[z("button",{type:"button",className:"st-btn",onClick:d,disabled:K,children:K?"Uploading…":"Upload…"}),q&&z("span",{className:"st-ap-err",children:q})]}),z("div",{className:"st-ap-grid",children:Z==null?z("div",{className:"st-ap-empty",children:"Loading…"}):Z.length===0?z("div",{className:"st-ap-empty",children:"No assets yet — upload one."}):Z.map((x)=>{let m=Y&&N.has(x.path);return M("button",{type:"button",className:"st-ap-cell","data-selected":m?"true":void 0,"aria-pressed":Y?m:void 0,title:`${x.name} · ${Math.max(1,Math.round(x.size/1024))} KB`,onClick:()=>Y?k(x.path):J(x.path),children:[Y&&z("span",{className:"st-ap-check","aria-hidden":"true",children:m?z(A9,{name:"check",size:12}):null}),x.kind==="video"?z("video",{className:"st-ap-thumb",src:o(x.path),muted:!0,playsInline:!0}):z("img",{className:"st-ap-thumb",src:o(x.path),alt:x.name,loading:"lazy"}),z("span",{className:"st-ap-name",children:x.name})]},x.path)})})]}),Y&&N.size>0&&M("div",{className:"st-dialog-ft st-ap-confirm",children:[M("span",{className:"st-ap-count",children:[N.size," selected"]}),M("div",{className:"st-ap-seg",role:"radiogroup","aria-label":"Insert as",children:[z("button",{type:"button",className:"st-ap-seg-btn","aria-pressed":R==="artboard",disabled:P,onClick:()=>w("artboard"),children:"Add to artboard"}),z("button",{type:"button",className:"st-ap-seg-btn","aria-pressed":R==="annotation",onClick:()=>w("annotation"),children:"Add as annotation"})]}),P&&z("span",{className:"st-ap-dest-note",children:I}),z("span",{className:"st-ap-confirm-spacer"}),z("button",{type:"button",className:"btn btn--ghost",onClick:Q,children:"Cancel"}),z("button",{type:"button",className:"btn btn--primary",onClick:()=>G?.(Array.from(N),R),children:"Insert"})]})]})})}function lq0({mode:X,initialScope:J,activePath:Q,hasComps:Y=!1,comps:W=[],activeArtboardId:G=null,selection:Z=null,onClose:H}){let[K,U]=u.useState(X==="handoff"?"shadcn":"png"),[q,B]=u.useState(J&&xR[J]?J:"artboard"),[N,F]=u.useState(2),[D,_]=u.useState(hq0),[R,w]=u.useState(!0),[O,P]=u.useState(!1),[I,k]=u.useState(!1),[$,C]=u.useState(!1),[b,v]=u.useState(xq0),[h,d]=u.useState(!0),[o,x]=u.useState(!1),[m,l]=u.useState(null),[f,s]=u.useState([]),n=hR.find(($0)=>$0.id===K)||hR[0],c=n.handoff?[]:fq0[n.format]||["artboard"],U0=900,X0=3600,H0=nz(W,EA(W,{artboardId:G})),a=H0?.durationInFrames||0,D0=H0?.fps||30,z0=n.temporal&&a>900,l0=n.temporal&&a>3600;u.useEffect(()=>{if(c.length&&!c.includes(q))B(c[0])},[c,q]);let X8=u.useCallback(()=>{fetch("/_api/export-history").then(($0)=>$0.json()).then(($0)=>s(Array.isArray($0?.history)?$0.history.slice(0,6):[])).catch(()=>{})},[]);u.useEffect(()=>{X8()},[X8]),u.useEffect(()=>{function $0(M0){if(M0.key==="Escape")M0.preventDefault(),H()}return window.addEventListener("keydown",$0),()=>window.removeEventListener("keydown",$0)},[H]);async function d0(){if(n.handoff){let i0=`/design:handoff ${Q&&Q!==d8?Q:"<canvas>.tsx"}`;try{await navigator.clipboard?.writeText(i0)}catch{}l({ok:!0,msg:`Copied: ${i0} — run it in Claude Code.`});return}x(!0),l(null);let $0=n.temporal?{scale:N}:{};if(n.format==="png"){let M0=T3.find((i0)=>i0.id===D)||T3[1];if(M0.kind==="dpi")$0.dpi=M0.value;else $0.scale=M0.value}if(n.format==="mp4"||n.format==="webm")$0.audio=h;if(l0)$0.maxFrames=a;if(n.format==="pdf"){$0.pdfPrint={includeBleed:R,marks:{crop:I,registration:$}};let M0=pe.find((i0)=>i0.id===b)?.value;if(M0!==void 0)$0.dpi=M0}if(G)$0.artboardId=G;if(Z?.selector)$0.selection=Z;try{let M0=await fetch("/_api/export-jobs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({format:n.format,scope:q,options:$0})});if(!M0.ok){l({ok:!1,msg:await M0.text()||`Export failed (${M0.status})`}),x(!1);return}H()}catch(M0){l({ok:!1,msg:M0&&M0.message?M0.message:String(M0)}),x(!1)}}return z("div",{className:"st-scrim",role:"presentation",onMouseDown:($0)=>{if($0.target===$0.currentTarget)H()},children:M("div",{className:"st-dialog",role:"dialog","aria-modal":"true","aria-label":"Export and handoff",children:[M("div",{className:"st-dialog-hd",children:[z("span",{className:"st-dialog-title",children:"Export & handoff"}),z("button",{type:"button",className:"st-iconbtn","aria-label":"Close",onClick:H,children:z(A9,{name:"x",size:15})})]}),M("div",{className:"st-dialog-bd",children:[z("div",{className:"st-rp-hd",children:Q&&Q!==d8?`Format · ${vW(wK(Q))}`:"Format"}),z("div",{className:"st-fmt-grid",children:hR.filter(($0)=>!$0.temporal||Y).map(($0)=>M("button",{type:"button",className:"st-fmt"+($0.id===K?" is-on":""),onClick:()=>{U($0.id),l(null)},children:[z(A9,{name:$0.icon,size:16}),z("span",{className:"st-fmt-name",children:$0.label}),z("span",{className:"st-fmt-sub",children:$0.sub})]},$0.id))}),!n.handoff&&M("div",{className:"st-dialog-row",children:[z("label",{className:"st-dialog-lbl",htmlFor:"st-export-scope",children:"Scope"}),z("select",{id:"st-export-scope",className:"st-select",value:q,onChange:($0)=>B($0.target.value),children:c.map(($0)=>z("option",{value:$0,children:xR[$0]},$0))})]}),!n.handoff&&n.format==="png"&&M("div",{className:"st-dialog-row",children:[z("label",{className:"st-dialog-lbl",htmlFor:"st-export-size",children:"Resolution"}),z("select",{id:"st-export-size",className:"st-select",value:D,onChange:($0)=>_($0.target.value),children:T3.map(($0)=>z("option",{value:$0.id,children:$0.label},$0.id))})]}),!n.handoff&&n.format==="png"&&z("div",{className:"st-mono",style:{fontSize:11,color:"var(--fg-3)"},children:(()=>{let $0=T3.find((i0)=>i0.id===D)||T3[1],M0=$0.kind==="dpi"?$0.value/96:$0.value;return`${$0.label} ≈ ${Math.round(1440*M0)}×${Math.round(900*M0)} for a 1440×900 artboard.`})()}),!n.handoff&&n.temporal&&M("div",{className:"st-dialog-row",children:[z("label",{className:"st-dialog-lbl",htmlFor:"st-export-temporal-size",children:"Resolution"}),z("select",{id:"st-export-temporal-size",className:"st-select",value:N,onChange:($0)=>F(Number($0.target.value)),children:vq0.map(($0)=>z("option",{value:$0.value,children:$0.label},$0.value))})]}),!n.handoff&&n.temporal&&M("div",{className:"st-mono",style:{fontSize:11,color:"var(--fg-3)"},children:[N,"× the artboard's native resolution (e.g. 960×540 → ",960*N,"×",540*N,")."]}),z0&&M("div",{className:"st-mono st-export-long-notice","data-testid":"export-long-comp-notice",style:{fontSize:11,color:"var(--accent)",lineHeight:1.5},children:["⚠ Long comp: ",a," frames (≈",Math.round(a/D0),"s).",l0?` Exceeds the default ${"3600"}-frame export cap — exporting raises the cap to the full length for this run.`:""," ","If the fast renderer falls back to frame-by-frame capture this can take several minutes; 2× resolution (≈720–1080p) is recommended for memory headroom."]}),!n.handoff&&n.format==="pdf"&&M(G0,{children:[M("div",{className:"st-dialog-row",children:[z("label",{className:"st-dialog-lbl",htmlFor:"st-export-pdf-dpi",children:"Image quality"}),z("select",{id:"st-export-pdf-dpi",className:"st-select",value:b,onChange:($0)=>v($0.target.value),children:pe.map(($0)=>z("option",{value:$0.id,children:$0.label},$0.id))})]}),z("div",{className:"st-mono",style:{fontSize:11,color:"var(--fg-3)"},children:"The page stays vector; this only sets the capture density for raster content on it (dropped photos, large-format art)."}),z("div",{className:"st-dialog-row",children:M("label",{className:"st-dialog-lbl",htmlFor:"st-export-pdf-bleed",style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[z("input",{id:"st-export-pdf-bleed",type:"checkbox",checked:R,onChange:($0)=>w($0.target.checked)}),"Include bleed"]})}),z("div",{className:"st-dialog-row",children:M("button",{type:"button",className:"st-dialog-lbl",style:{background:"none",border:0,padding:0,cursor:"pointer"},onClick:()=>P(($0)=>!$0),"aria-expanded":O,children:[O?"▾":"▸"," Marks"]})}),O&&M("div",{style:{padding:"0 12px 4px",display:"flex",flexDirection:"column",gap:6},children:[M("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer",fontSize:12},children:[z("input",{type:"checkbox",checked:I,onChange:($0)=>k($0.target.checked)}),"Crop marks"]}),M("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer",fontSize:12},children:[z("input",{type:"checkbox",checked:$,onChange:($0)=>C($0.target.checked)}),"Registration marks"]})]}),M("div",{className:"st-mono",style:{fontSize:11,color:"var(--fg-3)"},children:["Bleed and marks apply to print (",z("code",{children:'kind="print"'}),") artboards only.",q==="canvas-as-separate"?" One PDF page per artboard.":""]})]}),!n.handoff&&(n.format==="mp4"||n.format==="webm")&&z("div",{className:"st-dialog-row",children:M("label",{className:"st-dialog-lbl",htmlFor:"st-export-audio",style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[z("input",{id:"st-export-audio",type:"checkbox",checked:h,onChange:($0)=>d($0.target.checked)}),"Export with audio"]})}),n.handoff&&M("div",{className:"callout callout--info",style:{fontSize:12},children:["Hands the active canvas off to production. Copies"," ",z("span",{className:"st-mono",children:"/design:handoff <path>"})," — run it in Claude Code to emit a ready-to-drop production component next to the canvas."]}),m&&z("div",{className:"callout "+(m.ok?"callout--success":"callout--error"),style:{fontSize:12},children:m.msg}),f.length>0&&M("div",{className:"st-export-recent",children:[z("div",{className:"st-rp-hd",children:"Recent"}),f.map(($0,M0)=>M("div",{className:"st-export-recent-row",children:[M("span",{children:[String($0.format||"").toUpperCase()," ·"," ",xR[$0.scope]||$0.scope]}),z("span",{className:"st-mono",children:$0.filename})]},M0))]})]}),M("div",{className:"st-dialog-ft",children:[z("button",{type:"button",className:"btn btn--ghost",onClick:H,children:"Cancel"}),M("button",{type:"button",className:"btn btn--primary",disabled:o,onClick:d0,children:[z(A9,{name:"download",size:14}),n.handoff?"Copy handoff command":o?"Exporting…":`Export ${n.label}`]})]})]})})}var MF=12,OF=16;function pq0({name:X,depth:J,defaultOpen:Q,children:Y,dirPath:W,drag:G,menu:Z}){let[H,K]=u.useState(Q),U=G?G.dropProps(W,!0,()=>K(!0)):{},q=G?.overDir===W,B=G?G.dragProps(W,!0):{},N=G?.draggedPath===W,F=G?.busyPath===W,D=M("button",{type:"button",role:"treeitem","data-testid":`tree-folder-${NF(W)}`,"aria-expanded":H,"aria-dropeffect":G?"move":void 0,"aria-busy":F||void 0,tabIndex:-1,className:"st-row"+(q?" is-drop-target":"")+(N?" is-dragging":"")+(F?" is-busy":""),style:{paddingLeft:MF+J*OF+"px"},onClick:()=>K((_)=>!_),onContextMenu:Z?(_)=>Z.openAt(_,{kind:"dir",dirPath:W}):void 0,...B,...U,children:[z("span",{className:"st-row-glyph",children:z(A9,{name:"chevron-right",className:"st-chev"+(H?" is-open":""),size:13})}),z("span",{className:"st-row-name",children:X})]});return M(G0,{children:[Z?M("div",{className:"st-row-wrap",role:"none",children:[D,z("button",{type:"button",className:"st-row-menu-btn","data-testid":`tree-row-menu-${NF(W)}`,title:`Folder actions — ${X}`,"aria-label":`Folder actions for ${X}`,"aria-haspopup":"menu",onClick:(_)=>Z.openAt(_,{kind:"dir",dirPath:W}),children:z(FF,{d:"M12 6a1 1 0 100-2 1 1 0 000 2zM12 13a1 1 0 100-2 1 1 0 000 2zM12 20a1 1 0 100-2 1 1 0 000 2z",size:12})})]}):D,H&&Y]})}function dq0({name:X,dsName:J,depth:Q,defaultOpen:Y,active:W,onOpenSystem:G,children:Z}){let[H,K]=u.useState(Y);return M(G0,{children:[M("div",{className:"st-row st-ds-folder"+(W?" is-sel":""),style:{paddingLeft:MF+Q*OF+"px"},role:"treeitem","aria-expanded":H,children:[z("button",{type:"button",className:"st-ds-chev",onClick:()=>K((U)=>!U),"aria-label":H?"Collapse design system":"Expand design system",title:H?"Collapse":"Expand",children:z(A9,{name:"chevron-right",className:"st-chev"+(H?" is-open":""),size:13})}),M("button",{type:"button",className:"st-ds-open",onClick:()=>G(J),"aria-label":`Open ${J} design system view`,title:"Open the design system view",children:[z("span",{className:"st-row-glyph",children:z(A9,{name:"folder",size:13})}),z("span",{className:"st-row-name",children:X})]})]}),H&&Z]})}function LF({file:X,activePath:J,previewPath:Q,onOpen:Y,onPreview:W,onDelete:G,openCount:Z,depth:H,kind:K,sidecar:U,dirty:q,experimentalKind:B,drag:N,menu:F}){let D=X.path===J||X.path===Q,_=XQ.test(X.name),R=!_&&K!=="runtime"?lR(X.name):null,w=!_&&!R,O=_?vW(X.name):X.name,P=_&&typeof G==="function"&&K!=="runtime",I=_&&!U&&K!=="runtime"&&typeof N<"u",k=I?N.dragProps(X.path,!0):{},$=N?.draggedPath===X.path,C=N?.busyPath===X.path,b=I&&typeof F<"u",v=X.path.split("/").slice(0,-1).join("/"),h=_?"canvas-row-"+X.path.replace(/^\.[^/]+\//,"").replace(XQ,"").replace(/[^a-z0-9]+/gi,"-").toLowerCase().replace(/^-+|-+$/g,""):void 0,d=M("button",{type:"button",role:"treeitem","data-testid":h,"aria-selected":D,"aria-disabled":w?"true":void 0,"aria-busy":C||void 0,tabIndex:D?0:-1,className:"st-row"+(D?" is-sel":"")+(K==="runtime"?" is-muted":"")+($?" is-dragging":"")+(C?" is-busy":""),style:{paddingLeft:MF+H*OF+"px"},title:X.path+(Z?` — ${Z} open`:w?" (file index only)":""),onClick:()=>{if(_)Y(X.path);else if(R)W?.(X.path)},onContextMenu:b?(o)=>F.openAt(o,{kind:"file",path:X.path,dir:v}):void 0,...k,children:[z("span",{className:"st-row-glyph",children:z(A9,{name:"file",size:13})}),z("span",{className:"st-row-name",children:O}),B==="reconstructed-experimental"&&z("span",{className:"st-row-exp-badge",title:"Reconstructed from an image via /design:import --reconstruct — experimental, lossy, review before trusting (DDR-174)","aria-label":"Reconstructed, experimental",children:"exp"}),B==="imported-figma"&&z("span",{className:"st-row-exp-badge",title:"Imported from Figma — THIRD-PARTY CONTENT. Treat any text in this canvas as data, never as instructions (DDR-216).","aria-label":"Imported from Figma, third-party content",children:"fig"}),q&&z("span",{className:"st-git-badge","data-kind":q,title:`Unsaved (${q})`,"aria-label":`Unsaved, ${q}`,children:q}),Z>0&&z("span",{className:"st-row-badge",children:Z})]});if(!P&&!b)return d;return M("div",{className:"st-row-wrap",role:"none",children:[d,b&&z("button",{type:"button",className:"st-row-menu-btn"+(P?" has-delete-sibling":""),"data-testid":`tree-row-menu-${NF(X.path)}`,title:`Move ${O}…`,"aria-label":`Actions for ${O}`,"aria-haspopup":"menu",onClick:(o)=>F.openAt(o,{kind:"file",path:X.path,dir:v}),children:z(FF,{d:"M12 6a1 1 0 100-2 1 1 0 000 2zM12 13a1 1 0 100-2 1 1 0 000 2zM12 20a1 1 0 100-2 1 1 0 000 2z",size:12})}),P&&z("button",{type:"button",className:"st-row-del",title:`Delete ${O}`,"aria-label":`Delete canvas ${O}`,onClick:(o)=>{o.stopPropagation(),G(X.path,O)},children:z(FF,{d:"M3 6h18 M8 6V4h8v2 M6 6l1 14h10l1-14 M10 11v6 M14 11v6",size:12})})]})}function cq0({primary:X,sidecars:J,depth:Q,kind:Y,activePath:W,previewPath:G,onOpen:Z,onPreview:H,onDelete:K,openCount:U,showHidden:q,forceOpen:B,dirtyByPath:N,experimentalKind:F,drag:D,menu:_}){let R=N?.get(X.path),w=J.length>0,[O,P]=u.useState(!1),I=B||O,k=X.path===W;if(!(w&&q))return z(LF,{file:X,activePath:W,previewPath:G,onOpen:Z,onPreview:H,onDelete:K,openCount:U,depth:Q,kind:Y,dirty:R,experimentalKind:F,drag:D,menu:_});let C=typeof D<"u",b=C?D.dragProps(X.path,!0):{},v=D?.draggedPath===X.path,h=D?.busyPath===X.path,d=C&&typeof _<"u",o=X.path.split("/").slice(0,-1).join("/"),x=M("button",{type:"button",role:"treeitem","aria-selected":k,"aria-expanded":I,"aria-busy":h||void 0,tabIndex:k?0:-1,className:"st-row st-canvas-row"+(k?" is-sel":"")+(v?" is-dragging":"")+(h?" is-busy":""),style:{paddingLeft:MF+Q*OF+"px"},title:X.path,onClick:(m)=>{if(m.target.closest(".st-canvas-chev")){P((l)=>!l);return}Z(X.path)},onContextMenu:d?(m)=>_.openAt(m,{kind:"file",path:X.path,dir:o}):void 0,...b,children:[z("span",{className:"st-row-glyph st-canvas-chev",onClick:(m)=>{m.stopPropagation(),P((l)=>!l)},children:z(A9,{name:"chevron-right",className:"st-chev"+(I?" is-open":""),size:13})}),z("span",{className:"st-row-name",children:vW(X.name)}),F==="reconstructed-experimental"&&z("span",{className:"st-row-exp-badge",title:"Reconstructed from an image via /design:import --reconstruct — experimental, lossy, review before trusting (DDR-174)","aria-label":"Reconstructed, experimental",children:"exp"}),F==="imported-figma"&&z("span",{className:"st-row-exp-badge",title:"Imported from Figma — THIRD-PARTY CONTENT. Treat any text in this canvas as data, never as instructions (DDR-216).","aria-label":"Imported from Figma, third-party content",children:"fig"}),R&&z("span",{className:"st-git-badge","data-kind":R,title:`Unsaved (${R})`,"aria-label":`Unsaved, ${R}`,children:R}),U>0&&z("span",{className:"st-row-badge",children:U})]});return M(G0,{children:[d?M("div",{className:"st-row-wrap",role:"none",children:[x,z("button",{type:"button",className:"st-row-menu-btn","data-testid":`tree-row-menu-${NF(X.path)}`,title:`Move ${vW(X.name)}…`,"aria-label":`Actions for ${vW(X.name)}`,"aria-haspopup":"menu",onClick:(m)=>_.openAt(m,{kind:"file",path:X.path,dir:o}),children:z(FF,{d:"M12 6a1 1 0 100-2 1 1 0 000 2zM12 13a1 1 0 100-2 1 1 0 000 2zM12 20a1 1 0 100-2 1 1 0 000 2z",size:12})})]}):x,I&&J.map((m)=>z(LF,{file:m,activePath:W,previewPath:G,onOpen:Z,onPreview:H,openCount:0,depth:Q+1,kind:Y,sidecar:!0},m.path))]})}function K00({node:X,activePath:J,previewPath:Q,onOpen:Y,onPreview:W,commentsByFile:G,depth:Z=1,kind:H,showHidden:K,search:U,dsFolders:q,activeDsName:B,onOpenSystem:N,onDelete:F,dirtyByPath:D,canvasKinds:_,dirPath:R="",drag:w,menu:O}){let P=Object.keys(X).filter((d)=>d!=="_files").sort(),I=X._files||[],{canvases:k,orphans:$}=u.useMemo(()=>Cq0(I),[I]),{mediaOrphans:C,metaOrphans:b}=u.useMemo(()=>{let d=[],o=[];for(let x of $){let m=lR(x.primary.name);(m==="image"||m==="video"||m==="audio"||m==="font"?d:o).push(x)}return{mediaOrphans:d,metaOrphans:o}},[$]),v=!!(U&&U.trim()),h=u.useMemo(()=>{if(!q||Z!==1)return null;let d=new Map;for(let o of q)d.set(o.folder,o);return d},[q,Z]);return M(G0,{children:[k.map((d)=>{let o=v&&d.sidecars.some((x)=>{let m=U.toLowerCase();return x.name.toLowerCase().includes(m)||x.path.toLowerCase().includes(m)});return z(cq0,{primary:d.primary,sidecars:d.sidecars,activePath:J,previewPath:Q,onOpen:Y,onPreview:W,onDelete:F,openCount:qF(G[d.primary.path]),depth:Z,kind:H,showHidden:K,forceOpen:o,dirtyByPath:D,experimentalKind:_?.[d.primary.path],drag:w,menu:O},d.primary.path)}),C.map((d)=>z(LF,{file:d.primary,activePath:J,previewPath:Q,onOpen:Y,onPreview:W,openCount:qF(G[d.primary.path]),depth:Z,kind:H},d.primary.path)),K&&b.map((d)=>z(LF,{file:d.primary,activePath:J,previewPath:Q,onOpen:Y,onPreview:W,openCount:qF(G[d.primary.path]),depth:Z,kind:H},d.primary.path)),P.map((d)=>{let o=h?.get(d),x=R?`${R}/${d}`:d,m=z(K00,{node:X[d],activePath:J,previewPath:Q,onOpen:Y,onPreview:W,commentsByFile:G,depth:Z+1,kind:H,showHidden:K,search:U,activeDsName:B,onOpenSystem:N,onDelete:F,dirtyByPath:D,canvasKinds:_,dirPath:x,drag:w,menu:O});if(o&&N)return z(dq0,{name:d,dsName:o.name,depth:Z,defaultOpen:!0,active:J===d8&&o.name===B,onOpenSystem:N,children:m},d);return z(pq0,{name:d,depth:Z,defaultOpen:!0,dirPath:x,drag:w,menu:O,children:m},d)})]})}var UF={project:{title:"PROJECT",pillFromCount:!1},ds:{title:"DESIGN SYSTEM",pillFromDsCount:!0},canvas:{title:"UI CANVASES",pillFromCount:!0},runtime:{title:"RUNTIME · GITIGNORED",pillFromCount:!0}};function iq0(X){if(X.kind==="project")return UF.project;if(X.kind==="runtime")return UF.runtime;if(X.label==="Design system")return UF.ds;if(X.label==="UI kit")return UF.canvas;return{title:X.label.toUpperCase(),pillFromCount:!0}}function oq0({readOnly:X=!1,cloud:J,groups:Q,activePath:Y,previewPath:W,activeDsName:G,onOpen:Z,onPreview:H,onOpenSystem:K,wsConnected:U,search:q,setSearch:B,commentsByFile:N,showHidden:F,sectionsExpanded:D,onToggleSection:_,onNewBoard:R,onDeleteBoard:w,onRefresh:O,refreshing:P,collapsed:I,onCollapse:k,width:$,resizing:C,dirtyByPath:b,project:v,gitBranch:h,remoteSync:d,onGetLatest:o,canvasKinds:x,onMoveCanvas:m,onNewFolder:l,onDeleteFolder:f,syncStatus:s,onLinkedHub:n}){let c=u.useMemo(()=>{if(!q)return Q;return Q.map((O0)=>({...O0,tree:H00(O0.tree,q),filtered:!!q}))},[Q,q]),U0=QS(m),X0=XS(),H0=u.useMemo(()=>{let O0=[];for(let j8 of Q){if(j8.label==="Design system"||j8.kind!=="canvas")continue;let L9=j8.fullPath.replace(/^\.[^/]+\//,"")||j8.fullPath;O0.push({path:j8.fullPath,label:L9});for(let U8 of j8.dirs||[])O0.push({path:U8,label:U8.replace(/^\.[^/]+\//,"")})}return O0},[Q]),a=X0.state?.extra,D0=a?.kind==="file"?[{id:"move-to",label:"Move to…",onSelect:()=>X0.showMoveTo()}]:a?.kind==="dir"?[{id:"new-folder-here",label:"New folder here",onSelect:()=>{X0.close();let O0=window.prompt("New folder name:");if(O0?.trim())l(a.dirPath,O0.trim())}},{id:"delete-folder",label:"Delete folder",destructive:!0,onSelect:()=>{X0.close(),f(a.dirPath,a.dirPath.split("/").pop())}}]:[],z0=a?.kind==="file"?H0.filter((O0)=>O0.path!==a.dir):[],[l0,X8]=u.useState(!1),[d0,$0]=u.useState("board"),[M0,i0]=u.useState(""),[c8,z8]=u.useState(""),[Q9,L8]=u.useState(!1),W8=u.useMemo(()=>Q.find((O0)=>O0.kind==="canvas"&&O0.label!=="Design system")?.fullPath,[Q]),b8=u.useCallback(async()=>{let O0=M0.trim();if(!O0||Q9)return;if(L8(!0),z8(""),d0==="folder"){if(!W8){L8(!1),z8("no canvas group to create a folder in");return}let L9=await l(W8,O0);if(L8(!1),L9?.ok)X8(!1),i0("");else z8(L9?.error||"could not create folder");return}let j8=await R(O0);if(L8(!1),j8?.ok)X8(!1),i0("");else z8(j8?.error||"could not create board")},[M0,Q9,R,l,d0,W8]),i8=u.useMemo(()=>{let O0=0;for(let j8 of Q)for(let L9 of j8.paths||[])if(XQ.test(L9))O0++;return O0},[Q]),p9=u.useMemo(()=>{let O0=0;for(let j8 of c)for(let L9 of j8.paths||[])if(XQ.test(L9))O0++;return O0},[c]);return M("nav",{className:"st-sidebar"+(I?" is-collapsed":"")+(C?" is-resizing":""),style:I||!$?void 0:{width:$,flexBasis:$},"aria-label":"Files","data-tour":"sidebar",children:[M("div",{className:"st-sb-hd",children:[z("span",{className:"st-sb-title",children:"Files"}),M("div",{className:"st-sb-hd-actions",children:[!X&&z("button",{type:"button",className:"st-iconbtn","data-tip":"New blank brief board","aria-label":"New blank brief board","aria-expanded":l0&&d0==="board",onClick:()=>{z8(""),$0("board"),X8((O0)=>d0==="board"?!O0:!0)},children:z(A9,{name:"plus",size:15})}),!X&&W8&&z("button",{type:"button",className:"st-iconbtn","data-tip":"New folder","aria-label":"New folder","data-testid":"tree-new-folder","aria-expanded":l0&&d0==="folder",onClick:()=>{z8(""),$0("folder"),X8((O0)=>d0==="folder"?!O0:!0)},children:z(A9,{name:"folder-plus",size:15})}),O&&z("button",{type:"button",className:"st-iconbtn st-refresh"+(P?" is-spinning":""),"data-tip":"Refresh files · ⇧⌘R","aria-label":"Refresh files","aria-busy":P||void 0,disabled:P,onClick:()=>O(),children:z(A9,{name:"reload",size:15})}),M("span",{className:"st-live","data-tip":U?"live · file index synced":"reconnecting…",children:[z("span",{className:"st-live-dot"+(U?" is-connected":""),"aria-hidden":"true"}),p9," / ",i8]}),k&&z("button",{type:"button",className:"st-iconbtn","aria-label":"Collapse sidebar","data-tip":"Collapse sidebar · T",onClick:k,children:z(A9,{name:"panel-left",size:15})})]})]}),l0?M("div",{className:"st-newboard",children:[z("input",{type:"text",autoFocus:!0,placeholder:d0==="folder"?"folder name…":"brief board name…",value:M0,maxLength:60,disabled:Q9,"aria-label":d0==="folder"?"New folder name":"New brief board name",onChange:(O0)=>i0(O0.target.value),onKeyDown:(O0)=>{if(O0.key==="Enter")O0.preventDefault(),b8();else if(O0.key==="Escape")O0.preventDefault(),X8(!1),i0(""),z8("")}}),z("button",{type:"button",className:"st-newboard-go",disabled:Q9||!M0.trim(),"data-tip":"Create · Enter","aria-label":d0==="folder"?"Create folder":"Create brief board",onClick:b8,children:Q9?"…":"↵"})]}):null,c8?z("div",{className:"st-newboard-err",role:"alert",children:c8}):null,z("div",{className:"st-search",children:M("div",{className:"st-search-box",children:[z(A9,{name:"search",size:13}),z("input",{type:"search","data-testid":"canvas-search",placeholder:"Search canvases…",value:q,onChange:(O0)=>B(O0.target.value),onKeyDown:(O0)=>{if(O0.key==="Escape")if(O0.preventDefault(),q)B("");else O0.currentTarget.blur()},"aria-label":"Filter files"}),q?z("button",{className:"st-search-clear",onClick:()=>B(""),"data-tip":"Clear · Esc","aria-label":"Clear search",children:"×"}):z(MX,{children:"/"})]})}),z("div",{className:"st-tree",role:"tree","aria-label":"Project file tree","data-testid":"canvas-list",children:c.map((O0)=>{if(!F&&!q&&O0.kind==="runtime")return null;let j8=iq0(O0),L9=(O0.paths||[]).filter((w0)=>XQ.test(w0)).length,U8=j8.pill||(j8.pillFromDsCount?String(O0.dsFolders?.length||0):null)||(j8.pillFromCount?String(L9||O0.paths?.length||0):null),D9=O0.tree&&Object.keys(O0.tree).length>0,b0=O0.label==="Design system",Z0=O0.kind==="project";if(!F&&!q&&Z0&&L9===0)return null;let y0=Tq0(O0),c0=D[O0.label],q8=!!q||(c0===void 0?y0:c0),N8=!b0&&O0.kind==="canvas"&&!X,H8=N8?U0.dropProps(O0.fullPath,!0):{},m0=U0.overDir===O0.fullPath;return M("div",{className:"st-tree-section",children:[M("button",{type:"button",className:"st-tree-sec-hd"+(m0?" is-drop-target":""),onClick:()=>_(O0.label,y0),"aria-expanded":q8,"aria-dropeffect":N8?"move":void 0,title:q8?"Collapse section":"Expand section",...H8,children:[z(A9,{name:"chevron-right",className:"st-chev"+(q8?" is-open":""),size:13}),z("span",{className:"st-sec-name",children:j8.title}),U8&&z("span",{className:"st-pill",children:U8})]}),q8&&(D9?z(K00,{node:O0.tree,activePath:Y,previewPath:W,onOpen:Z,onPreview:H,commentsByFile:N,depth:1,kind:O0.kind,showHidden:F,search:q,dsFolders:O0.dsFolders,activeDsName:G,onOpenSystem:b0?K:void 0,onDelete:b0||X?void 0:w,dirtyByPath:b,canvasKinds:x,dirPath:O0.fullPath,drag:!b0&&O0.kind==="canvas"&&!X?U0:void 0,menu:!b0&&O0.kind==="canvas"&&!X?X0:void 0}):z("div",{className:"st-tree-empty",children:q?"No matches.":"Empty."}))]},O0.label)})}),z(JS,{state:X0.state,onClose:X0.close,rootItems:D0,destinations:z0,onPickDestination:(O0)=>m(a.path,O0)}),z(gA,{project:v,liveBranch:h,remoteSync:d,onGetLatest:o}),J===null?z(KA,{syncStatus:s,onLinkedHub:n}):null,z(VA,{})]})}function nq0({shown:X,onExpand:J,onSearch:Q}){return z("div",{className:"st-rail"+(X?" is-shown":""),children:M("div",{className:"st-rail-inner",children:[z("button",{type:"button",className:"st-iconbtn","aria-label":"Expand sidebar",title:"Expand sidebar (T)",onClick:J,children:z(A9,{name:"panel-left",size:15})}),z("button",{type:"button",className:"st-iconbtn","aria-label":"Search",title:"Search (/)",onClick:Q,children:z(A9,{name:"search",size:15})}),z("button",{type:"button",className:"st-iconbtn","aria-label":"Files",title:"Files",onClick:J,children:z(A9,{name:"folder",size:15})})]})})}function rq0({open:X,onClose:J,onStartTour:Q}){if(u.useEffect(()=>{if(!X)return;function Y(W){if(W.key==="Escape")J()}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[X,J]),!X)return null;return z("div",{className:"help-modal-backdrop",role:"presentation",onMouseDown:(Y)=>{if(Y.target===Y.currentTarget)J()},children:M("div",{className:"help-modal",role:"dialog","aria-modal":"true","aria-labelledby":"help-modal-title",children:[M("header",{className:"help-modal-hd",children:[z("span",{className:"title",id:"help-modal-title",children:"Help · shortcuts & commands"}),M("span",{className:"sku",children:["MAUDE-DEV-SRV / v",pR]}),Q&&z("button",{type:"button",className:"mdcc-tour__back",style:{marginLeft:"auto"},onClick:Q,children:"▶ Take the tour"}),z("button",{type:"button",className:"help-modal-close","aria-label":"Close (Esc)",onClick:J,children:"×"})]}),M("div",{className:"help-modal-body",children:[M("details",{open:!0,children:[z("summary",{children:"Canvas selection & tools"}),M("ul",{children:[M("li",{children:[z("kbd",{children:"V"})," ",z("span",{children:"move tool — Cmd+click to select, Cmd+Shift to multi"})]}),M("li",{children:[z("kbd",{children:"H"})," ",z("span",{children:"hand tool — bare drag pans (no Space needed)"})]}),M("li",{children:[z("kbd",{children:"C"})," ",z("span",{children:"comment tool — hover paints, click drops a pin"})]}),M("li",{children:[z("kbd",{children:"⌘"})," + hover ",z("span",{children:"preview deepest element under cursor"})]}),M("li",{children:[z("kbd",{children:"⌘"})," + click ",z("span",{children:"select that element (replace)"})]}),M("li",{children:[z("kbd",{children:"⌘⇧"})," + click ",z("span",{children:"add deepest to selection (multi)"})]}),M("li",{children:["right-click ",z("span",{children:"context menu (Copy CSS / Fit / Reset...)"})]}),M("li",{children:[z("kbd",{children:"Esc"})," in canvas ",z("span",{children:"clear selection + close menu"})]})]})]}),M("details",{children:[z("summary",{children:"Annotation tools"}),M("ul",{children:[M("li",{children:[z("kbd",{children:"B"})," ",z("span",{children:"pen — freehand stroke"})]}),M("li",{children:[z("kbd",{children:"R"})," ",z("span",{children:"rectangle — drag to define corners"})]}),M("li",{children:[z("kbd",{children:"O"})," ",z("span",{children:"ellipse — drag from center outward"})]}),M("li",{children:[z("kbd",{children:"A"})," ",z("span",{children:"arrow — drag tail → tip"})]}),M("li",{children:[z("kbd",{children:"E"})," ",z("span",{children:"eraser — click or drag over strokes to remove"})]}),M("li",{children:[z("kbd",{children:"V"})," + click stroke ",z("span",{children:"select annotation (Shift+click to multi)"})]}),M("li",{children:[z("kbd",{children:"V"})," + drag empty ",z("span",{children:"marquee-select strokes that overlap"})]}),M("li",{children:["double-click rect/ellipse ",z("span",{children:"add text inside the shape"})]}),M("li",{children:["arrow keys ",z("span",{children:"nudge selected annotation 1 unit (Shift = 10)"})]}),M("li",{children:[z("kbd",{children:"Backspace"})," ",z("span",{children:"delete selected annotations"})]}),M("li",{children:[z("kbd",{children:"⇧P"})," ",z("span",{children:"presentation — hide annotations for clean screenshot"})]})]})]}),M("details",{children:[z("summary",{children:"Canvas & panels"}),M("ul",{children:[M("li",{children:["click in tree ",z("span",{children:"open canvas (replaces the active one)"})]}),M("li",{children:["File ▸ Close canvas ",z("span",{children:"clear the stage"})]}),M("li",{children:[z("kbd",{children:"⌘R"})," ",z("span",{children:"reload canvas"})]}),M("li",{children:[z("kbd",{children:"/"})," ",z("span",{children:"focus search"})]}),M("li",{children:[z("kbd",{children:"⌘⇧M"})," ",z("span",{children:"comments panel"})]}),M("li",{children:[z("kbd",{children:"⌘⇧I"})," ",z("span",{children:"inspector"})]}),M("li",{children:[z("kbd",{children:"?"})," ",z("span",{children:"keyboard-shortcuts cheat sheet"})]})]})]}),M("details",{children:[z("summary",{children:"Slash commands"}),M("ul",{className:"cmds",children:[M("li",{children:[M("code",{children:['/design:edit "',z("i",{children:"feedback"}),'"']}),z("span",{children:"edit + 4-iter multi-axis loop"})]}),M("li",{children:[M("code",{children:['/design:edit "',z("i",{children:"…"}),'" --perfect']}),z("span",{children:"8-iter polish (4.5/5 aspiration)"})]}),M("li",{children:[M("code",{children:['/design:edit "',z("i",{children:"…"}),'" --no-critic']}),z("span",{children:"raw edit, skip loop"})]}),M("li",{children:[M("code",{children:['/design:edit "',z("i",{children:"…"}),'" --opt-out=',z("i",{children:"scope"})]}),z("span",{children:"override DS scope (palette/aesthetic/full)"})]}),M("li",{children:[M("code",{children:['/design:new "',z("i",{children:"Name"}),'" "',z("i",{children:"brief"}),'"']}),z("span",{children:"scaffold canvas"})]}),M("li",{children:[M("code",{children:['/design:new "',z("i",{children:"…"}),'" --opt-out=aesthetic']}),z("span",{children:"scaffold off-system canvas (gradients/radii/type free)"})]}),M("li",{children:[z("code",{children:"/design:critic"}),z("span",{children:"review panel (routed)"})]}),M("li",{children:[z("code",{children:"/design:critic --all"}),z("span",{children:"10-critic sweep"})]}),M("li",{children:[z("code",{children:"/design:critic --agent signature-moment-critic"}),z("span",{children:"aspiration axis only"})]}),M("li",{children:[z("code",{children:"/design:rollback"}),z("span",{children:"undo last edit"})]}),M("li",{children:[z("code",{children:"/design:screenshot"}),z("span",{children:"capture canvas"})]}),M("li",{children:[z("code",{children:"/design:setup-docs"}),z("span",{children:"refresh README + INDEX"})]}),M("li",{children:[z("code",{children:"/design:handoff"}),z("span",{children:"migrate to apps/"})]})]})]}),M("details",{children:[z("summary",{children:"Opt-out scope"}),M("ul",{children:[M("li",{children:[z("strong",{children:"palette"})," ",z("span",{children:"default — tokens + rootClass kept; local namespace overrides colors only. DS aesthetic still enforced."})]}),M("li",{children:[z("strong",{children:"aesthetic"})," ",z("span",{children:"palette + gradients/off-ladder radii/alt type/decorative SVG flags allowed."})]}),M("li",{children:[z("strong",{children:"full"})," ",z("span",{children:"DS treated as advisory. Type/radii/aesthetic up to canvas."})]}),M("li",{children:[z("em",{children:"A11y enforced at every scope"})," ",z("span",{children:"contrast, focus, semantics, motion, touch targets — never relaxed."})]}),M("li",{children:["Persisted on canvas's ",z("code",{children:".meta.json"})," ",z("code",{children:"opt_out_scope"})," field — subsequent ",z("code",{children:"/design:edit"})," iterations inherit."]}),z("li",{children:'Inferred from brief ("modern", "vibrant", "off-system") with one-shot AskUserQuestion before iter-1 critics fire.'})]})]}),M("details",{children:[z("summary",{children:"Auto-critic loop"}),M("ul",{children:[M("li",{children:[z("strong",{children:"Default"})," ",z("span",{children:"4 iter · aspiration ≥ 4.0 · stable-but-bland exit"})]}),M("li",{children:[z("strong",{children:"--perfect"})," ",z("span",{children:"8 iter · aspiration ≥ 4.5 · broader divergence tolerance"})]}),M("li",{children:[z("strong",{children:"--perfect --all"})," ",z("span",{children:"every critic incl. aspiration · portfolio-grade"})]}),M("li",{children:["Exit: ",z("code",{children:"solid"})," · ",z("code",{children:"stable-but-bland"})," · ",z("code",{children:"max-reached"})," ","· ",z("code",{children:"divergent"})]}),M("li",{children:[z("em",{children:"stable-but-bland"})," = correctness clean, aspiration plateau — surface for review with lowest 2 axes named"]}),M("li",{children:["When ",z("code",{children:"opt_out_scope ∈ {aesthetic, full}"}),": iter-1 checkpoint fires — pick (a) run loop, (b) skip auto-loop and review iter 1, (c) a11y-only check."]})]})]}),M("details",{children:[z("summary",{children:"Pin-to-element flow"}),M("ol",{children:[z("li",{children:"Open a canvas"}),M("li",{children:[z("kbd",{children:"⌘"}),"+click element"]}),z("li",{children:"Status bar shows ● selector"}),M("li",{children:["Run"," ",M("code",{children:['/design:edit "',z("i",{children:"change just this"}),'"']})]}),M("li",{children:["Reload iframe (",z("kbd",{children:"⌘R"}),")"]})]})]}),M("details",{children:[z("summary",{children:"Comments"}),M("ol",{children:[M("li",{children:[z("kbd",{children:"⌘"}),"+click element, then ",z("kbd",{children:"⌘C"})," ",z("span",{children:"or ⌘⇧+click"})]}),z("li",{children:"Numbered pin appears on canvas"}),M("li",{children:[z("kbd",{children:"⌘⇧M"})," ",z("span",{children:"opens panel — All / Open / Resolved"})]}),M("li",{children:["Click row in panel ",z("span",{children:"jumps to that file + pin"})]}),M("li",{children:["Claude reads ",z("code",{children:"_comments/<slug>.json"})," on next ",z("code",{children:"/design"})]})]})]})]})]})})}var gR=[{id:"canvas",label:"Canvas",items:[{label:"Command palette",kbd:"⌘ K"},{label:"New brief board",kbd:"N"},{label:"Export…",kbd:"⇧ ⌘ E"},{label:"Handoff to production",kbd:"⇧ ⌘ H"},{label:"Reload canvas",kbd:"⌘ R"},{label:"Search files",kbd:"/",alt:"⌘ F"}]},{id:"tools",label:"Tools · canvas focus",items:[{label:"Move · Hand · Comment",kbd:"V",alt:"H / C"},{label:"Pen · Highlighter · Eraser",kbd:"B",alt:"I / E"},{label:"Shape · Arrow",kbd:"R",alt:"A"},{label:"Sticky · Text · Section",kbd:"N",alt:"T / ⇧S"},{label:"Undo / redo",kbd:"⌘ Z",alt:"⇧ ⌘ Z"}]},{id:"selection",label:"Selection & zoom",items:[{label:"Select element",kbd:"⌘ click"},{label:"Add to selection",kbd:"⌘ ⇧ click"},{label:"Preview deepest",kbd:"⌘ hover"},{label:"Deselect · close menu",kbd:"Esc"},{label:"Zoom in / out",kbd:"⌘ +",alt:"⌘ −"},{label:"Fit · actual size",kbd:"⌘ 0",alt:"⌘ 1"}]},{id:"view",label:"View",items:[{label:"Project tree",kbd:"T"},{label:"Design system view",kbd:"S"},{label:"Inspector",kbd:"⌘ ⇧ I"},{label:"Comments sidebar",kbd:"⌘ ⇧ M"},{label:"Annotations",kbd:"⇧ P"},{label:"Hidden files",kbd:"H"},{label:"This cheat sheet · help",kbd:"?",alt:"F1"}]}];function aq0({kbd:X,alt:J}){let Q=(Y,W)=>z("span",{className:"so-combo",children:Y.split(" ").map((G,Z)=>z(MX,{children:G},`${G}-${Z}`))},W);return M("span",{className:"so-combos",children:[Q(X,"main"),J?J.split(" / ").map((Y)=>M(G0,{children:[z("span",{className:"so-or",children:"/"}),Q(Y,Y)]},Y)):null]})}function sq0({open:X,onClose:J}){if(u.useEffect(()=>{if(!X)return;function Y(W){if(W.key==="Escape")W.preventDefault(),J()}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[X,J]),!X)return null;let Q=gR.reduce((Y,W)=>Y+W.items.length,0);return z("div",{className:"st-scrim",role:"presentation",onMouseDown:(Y)=>{if(Y.target===Y.currentTarget)J()},children:M("div",{className:"so-overlay",role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",children:[M("div",{className:"so-overlay-hd",children:[z("span",{className:"so-title",children:"Keyboard shortcuts"}),M("span",{className:"so-trigger",children:["press ",z(MX,{children:"?"})," to open"]})]}),z("div",{className:"so-columns",children:gR.map((Y)=>M("section",{className:"so-section so-section--"+Y.id,children:[z("h3",{className:"so-section-hd",children:Y.label}),z("dl",{className:"so-list",children:Y.items.map((W)=>M("div",{className:"so-pair",children:[z("dt",{children:W.label}),z("dd",{children:z(aq0,{kbd:W.kbd,alt:W.alt})})]},W.label))})]},Y.id))}),M("div",{className:"so-overlay-ft",children:[M("span",{children:["close with ",z(MX,{children:"Esc"})]}),M("span",{className:"so-count",children:[Q," bindings · ",gR.length," groups"]})]})]})})}var tq0=["File","Edit","View","Selection","Tools","Help"];function U00(X){u.useEffect(()=>{function J(Y){if(Y.key==="Escape")X()}function Q(Y){if(!Y.target.closest(".st-dropdown, .st-menu"))X()}return window.addEventListener("keydown",J),window.addEventListener("mousedown",Q),()=>{window.removeEventListener("keydown",J),window.removeEventListener("mousedown",Q)}},[X])}function eq0({panels:X,onToggle:J,onClose:Q,onZoom:Y,hasCanvas:W}){return U00(Q),M("div",{className:"st-dropdown",role:"menu","aria-label":"View",style:{left:152},children:[z("div",{className:"st-dd-hd",children:"Panels"}),X.map((G)=>M("button",{type:"button",role:"menuitem",className:"st-dd-item"+(G.checked?" is-on":""),"aria-disabled":G.disabled?"true":void 0,title:G.hint||void 0,onClick:()=>{if(G.disabled){if(G.href)window.open(G.href,"_blank","noopener,noreferrer"),Q();return}J(G.id),Q()},children:[M("span",{className:"st-dd-lead",children:[z("span",{className:"st-dd-check",children:G.checked?z(A9,{name:"check",size:13}):null}),z("span",{children:G.label}),G.phase?z("span",{className:"st-dd-phase",children:G.phase}):null]}),G.shortcut?z(MX,{children:G.shortcut}):null]},G.id)),z("div",{className:"st-dd-sep"}),z("div",{className:"st-dd-hd",children:"Zoom"}),[{op:"in",label:"Zoom In",shortcut:"⌘ +"},{op:"out",label:"Zoom Out",shortcut:"⌘ −"},{op:"fit",label:"Fit to Screen",shortcut:"⌘ 0"},{op:"actual",label:"Actual Size · 100 %",shortcut:"⌘ 1"}].map((G)=>M("button",{type:"button",role:"menuitem",className:"st-dd-item","aria-disabled":W?void 0:"true",onClick:()=>{if(!W)return;Y?.(G.op),Q()},children:[M("span",{className:"st-dd-lead",children:[z("span",{className:"st-dd-check"}),z("span",{children:G.label})]}),z(MX,{children:G.shortcut})]},G.label))]})}function EK({label:X,left:J,header:Q,items:Y,onAction:W,onClose:G}){return U00(G),M("div",{className:"st-dropdown",role:"menu","aria-label":X,style:{left:J},children:[Q?z("div",{className:"st-dd-hd",children:Q}):null,Y.map((Z,H)=>Z.sep?z("div",{className:"st-dd-sep"},"s"+H):M("button",{type:"button",role:"menuitem",className:"st-dd-item","aria-disabled":Z.disabled?"true":void 0,onClick:()=>{if(Z.disabled)return;W(Z.id),G()},children:[M("span",{className:"st-dd-lead",children:[z("span",{className:"st-dd-check"}),z("span",{children:Z.label})]}),Z.shortcut?z(MX,{children:Z.shortcut}):null]},Z.id))]})}function X20({onAction:X,onClose:J}){return z(EK,{label:"Help",left:320,onAction:X,onClose:J,items:[{id:"shortcuts",label:"Keyboard shortcuts",shortcut:"?"},{id:"help",label:"Help · commands & flows",shortcut:"F1"},{id:"report-bug",label:"Report a bug…"},{sep:!0},{id:"tour",label:"Take the tour"},{id:"watch-intro",label:"Watch the intro"},...X9()?[{id:"collab-tour",label:"How sharing works"}]:[],...X9()?[{id:"quick-setup",label:"Quick setup"}]:[],...X9()?[{id:"readiness",label:"Check AI editing readiness…"}]:[],{id:"whatsnew",label:"What's new"}]})}function J20({onAction:X,onClose:J,readOnly:Q=!1}){return z(EK,{label:"Selection",left:214,onAction:X,onClose:J,items:[{id:"deselect-all",label:"Deselect all",shortcut:"Esc"},...Q?[]:[{id:"select-all-annotations",label:"Select all annotations",shortcut:"⌘ ⇧ A"}]]})}function Q20({onAction:X,onClose:J,readOnly:Q=!1}){let Y=[{id:"browse",label:"Browse (interact)",shortcut:""},{id:"move",label:"Select",shortcut:"V"},{id:"hand",label:"Hand",shortcut:"H"},...Q?[]:[{id:"comment",label:"Comment",shortcut:"C"},{id:"pen",label:"Pen",shortcut:"B"},{id:"rect",label:"Rect",shortcut:"R"},{id:"ellipse",label:"Ellipse",shortcut:"O"},{id:"sticky",label:"Sticky",shortcut:"N"},{id:"arrow",label:"Arrow",shortcut:"A"},{id:"text",label:"Text",shortcut:"T"},{id:"eraser",label:"Eraser",shortcut:"E"}]];return z(EK,{label:"Tools",left:290,header:"Tool palette",onAction:X,onClose:J,items:Y})}function Y20({onAction:X,onClose:J,hasCanvas:Q,readOnly:Y=!1}){return z(EK,{label:"File",left:40,onAction:X,onClose:J,items:Y?[{id:"export",label:"Export…",shortcut:"⇧⌘E"},{id:"handoff",label:"Handoff to production",shortcut:"⇧⌘H"},{sep:!0},{id:"reload",label:"Reload canvas",shortcut:"⌘R",disabled:!Q},{id:"close",label:"Close canvas",disabled:!Q}]:[{id:"new",label:"New canvas…",shortcut:"N"},{id:"assemble",label:"Assemble dropped clips → video",disabled:!Q},{id:"export",label:"Export…",shortcut:"⇧⌘E"},{id:"handoff",label:"Handoff to production",shortcut:"⇧⌘H"},{sep:!0},{id:"generate",label:"Generate with AI…"},{id:"settings",label:"Settings…",shortcut:"⌘,"},{sep:!0},{id:"reload",label:"Reload canvas",shortcut:"⌘R",disabled:!Q},{id:"close",label:"Close canvas",disabled:!Q}]})}function W20({onAction:X,onClose:J,hasCanvas:Q,readOnly:Y=!1}){if(Y)return z(EK,{label:"Edit",left:90,onAction:X,onClose:J,items:[{id:"deselect-all",label:"Deselect all",shortcut:"Esc"}]});return z(EK,{label:"Edit",left:90,onAction:X,onClose:J,items:[{id:"undo",label:"Undo",shortcut:"⌘Z"},{id:"redo",label:"Redo",shortcut:"⇧⌘Z"},{sep:!0},{id:"deselect-all",label:"Deselect all",shortcut:"Esc"},{id:"select-all-annotations",label:"Select all annotations",shortcut:"⇧⌘A"},...Q?[{sep:!0},{id:"new-artboard:desktop",label:"New artboard: Desktop"},{id:"new-artboard:laptop",label:"New artboard: Laptop"},{id:"new-artboard:tablet",label:"New artboard: Tablet"},{id:"new-artboard:mobile",label:"New artboard: Mobile"},{id:"new-artboard:print-a4",label:"New artboard: A4 (print)"},{id:"new-artboard:print-letter",label:"New artboard: Letter (print)"}]:[]]})}function G20({activePath:X,project:J,cloud:Q,tabsCount:Y,openMenu:W,setOpenMenu:G,commentsPanelOpen:Z,onToggleComments:H,changesOpen:K,changesCount:U,onToggleChanges:q,onOpenSystem:B,sidebarOpen:N,onToggleSidebar:F,showHidden:D,onToggleShowHidden:_,onOpenHelp:R,onOpenShortcuts:w,onReportBug:O,onStartTour:P,onStartCollabTour:I,annotationsVisible:k,onToggleAnnotations:$,minimapVisible:C,onToggleMinimap:b,zoomCtlVisible:v,onToggleZoomCtl:h,presentMode:d,onTogglePresent:o,printGuidesVisible:x,onTogglePrintGuides:m,postToActiveCanvas:l,onOpenWhatsNew:f,onOpenReadiness:s,onOpenQuickSetup:n,onWatchIntro:c,whatsNewCount:U0,exportCenter:X0,artboardCount:H0=0,presence:a=null,inspectorOpen:D0,inspectorTab:z0,onToggleInspector:l0,autoOpenInspector:X8,onToggleAutoOpenInspector:d0,onOpenLayers:$0,timelineOpen:M0,onToggleTimeline:i0,hasComps:c8=!1,assistantOpen:z8,onToggleAssistant:Q9,assistantBusy:L8,assistantUnseen:W8,onNewCanvas:b8,onAssembleVideo:i8,onOpenExport:p9,onOpenSettings:O0,onOpenGenerate:j8,onReload:L9,onCloseCanvas:U8,onInsertArtboard:D9,readOnly:b0=!1}){let Z0=X===d8,y0=Z0?"SYSTEM":X?"CANVAS":"IDLE",c0=Z0?z("b",{children:"design system"}):X?M(G0,{children:[X.split("/").slice(0,-1).join("/"),"/",z("b",{children:vW(wK(X))})]}):z("span",{style:{color:"var(--u-fg-3)"},children:"no canvas open"}),q8=new Set(Q?["autoopen"]:["assistant","autoopen"]),N8=[{id:"tree",label:"Project Tree",shortcut:"T",checked:N,disabled:!1},{id:"changes",label:Q?"History":U>0?`Changes · ${U} unsaved`:"Changes",shortcut:"⌘ ⇧ G",checked:K,disabled:!1},{id:"comments",label:"Comments Sidebar",shortcut:"⌘ ⇧ M",checked:Z,disabled:!1},{id:"hidden",label:"Show hidden files",shortcut:"H",checked:D,disabled:!1},{id:"layers",label:"Layers",shortcut:"",checked:D0&&z0==="layers",disabled:!1},{id:"inspector",label:"Inspector",shortcut:"⌘ ⇧ I",checked:D0,disabled:!1},{id:"autoopen",label:"Auto-open Inspector on select",shortcut:"",checked:!!X8,disabled:!1},{id:"timeline",label:"Timeline",shortcut:"⌘ ⇧ T",phase:c8?"video":void 0,checked:M0,disabled:!1},...X9()?[{id:"assistant",label:"Assistant",shortcut:"⌘ ⇧ A",checked:z8,disabled:!1}]:Q?[{id:"assistant",label:"Assistant — in the desktop app",shortcut:"",checked:!1,disabled:!0,href:"https://maude.sh/download",hint:"The agent runs on your own Claude subscription, on your own machine."}]:[],{id:"annotate",label:"Annotations",shortcut:"⇧ P",checked:k,disabled:!1},{id:"minimap",label:"Minimap",shortcut:"",checked:C,disabled:!X||Z0},{id:"zoomctl",label:"Zoom controls",shortcut:"",checked:v,disabled:!X||Z0},{id:"present",label:"Presentation Mode",shortcut:"",checked:d,disabled:!X||Z0},{id:"print-guides",label:"Show print guides",shortcut:"",checked:x,disabled:!X||Z0}].filter((w0)=>!b0||!q8.has(w0.id)),H8=["file","edit","view","selection","tools","help"];function m0(w0){if(H8.includes(w0))G(W===w0?null:w0)}return u.useEffect(()=>{if(!W||!H8.includes(W))return;let w0=setTimeout(()=>{document.querySelector('.st-dropdown [role="menuitem"]:not([aria-disabled="true"])')?.focus()},0);function K8(I8){let k8=[...document.querySelectorAll('.st-dropdown [role="menuitem"]:not([aria-disabled="true"])')];if(!k8.length)return;let _9=k8.indexOf(document.activeElement);if(I8.key==="ArrowDown")I8.preventDefault(),k8[(_9+1)%k8.length].focus();else if(I8.key==="ArrowUp")I8.preventDefault(),k8[(_9-1+k8.length)%k8.length].focus();else if(I8.key==="Home")I8.preventDefault(),k8[0].focus();else if(I8.key==="End")I8.preventDefault(),k8[k8.length-1].focus();else if(I8.key==="ArrowRight"||I8.key==="ArrowLeft"){I8.preventDefault();let A8=I8.key==="ArrowRight"?1:-1,T9=H8.indexOf(W);G(H8[(T9+A8+H8.length)%H8.length])}else if(I8.key==="Escape")document.querySelector('.st-menu[aria-expanded="true"]')?.focus()}return window.addEventListener("keydown",K8),()=>{clearTimeout(w0),window.removeEventListener("keydown",K8)}},[W,G]),M("header",{className:"st-menubar",role:"menubar","aria-label":"Application menubar","data-testid":"menubar",children:[M("span",{className:"st-brand","data-tour":"brand",children:[z("span",{className:"st-brand-mark",children:z("svg",{viewBox:"0 0 32 32",width:"100%",height:"100%",fill:"none","aria-hidden":"true",children:z("path",{d:"M16 5l2.8 8.2L27 16l-8.2 2.8L16 27l-2.8-8.2L5 16l8.2-2.8z",fill:"currentColor"})})}),z("span",{className:"st-brand-name",children:"maude"})]}),Q?M("span",{className:"st-cloudback","data-testid":"cloud-back",children:[z("a",{className:"st-cloudback-link",href:Q.dashboardUrl||"https://cloud.maude.sh",title:"Back to your projects",children:"← Dashboard"}),Q.projectName?z("span",{className:"st-cloudback-project","data-testid":"cloud-project-name",children:Q.projectName}):null]}):null,z("nav",{className:"st-menus","aria-label":"Application menus","data-tour":"menus",children:tq0.map((w0)=>{let K8=w0.toLowerCase(),I8=H8.includes(K8),k8=I8||K8==="help";return z("button",{type:"button",className:"st-menu",role:"menuitem","data-tour":K8==="help"?"help":void 0,"aria-haspopup":I8?"menu":void 0,"aria-expanded":I8?W===K8:void 0,onClick:()=>m0(K8),onMouseEnter:()=>{if(W!==null&&I8)G(K8)},children:w0},K8)})}),W==="file"&&z(Y20,{readOnly:b0,hasCanvas:!!X,onAction:(w0)=>{if(w0==="new")b8?.();else if(w0==="assemble")i8?.();else if(w0==="export")p9?.("export");else if(w0==="handoff")p9?.("handoff");else if(w0==="generate")j8?.();else if(w0==="settings")O0?.();else if(w0==="reload")L9?.();else if(w0==="close")U8?.()},onClose:()=>G(null)}),W==="edit"&&z(W20,{readOnly:b0,hasCanvas:!!X&&!Z0,onAction:(w0)=>{if(w0==="undo")l({dgn:"undo"});else if(w0==="redo")l({dgn:"redo"});else if(w0==="deselect-all")l({dgn:"selection-clear"});else if(w0==="select-all-annotations")l({dgn:"annotation-select-all"});else if(w0.startsWith("new-artboard:"))D9?.(w0.slice(13))},onClose:()=>G(null)}),W==="view"&&z(eq0,{panels:N8,onToggle:(w0)=>{if(w0==="tree")F();else if(w0==="changes")q();else if(w0==="comments")H();else if(w0==="hidden")_();else if(w0==="annotate")$();else if(w0==="inspector")l0();else if(w0==="autoopen")d0?.();else if(w0==="timeline")i0?.();else if(w0==="assistant")Q9?.();else if(w0==="layers")$0?.();else if(w0==="minimap")b?.();else if(w0==="zoomctl")h?.();else if(w0==="present")o?.();else if(w0==="print-guides")m?.()},onZoom:(w0)=>l({dgn:"zoom",op:w0}),hasCanvas:!!X&&!Z0,onClose:()=>G(null)}),W==="selection"&&z(J20,{readOnly:b0,onAction:(w0)=>{if(w0==="deselect-all")l({dgn:"selection-clear"});else if(w0==="select-all-annotations")l({dgn:"annotation-select-all"})},onClose:()=>G(null)}),W==="tools"&&z(Q20,{readOnly:b0,onAction:(w0)=>l({dgn:"tool-set",tool:w0}),onClose:()=>G(null)}),W==="help"&&z(X20,{onAction:(w0)=>{if(w0==="shortcuts")w?.();else if(w0==="help")R?.();else if(w0==="report-bug")O?.();else if(w0==="tour")P?.();else if(w0==="collab-tour")I?.();else if(w0==="quick-setup")n?.();else if(w0==="readiness")s?.();else if(w0==="whatsnew")f?.();else if(w0==="watch-intro")c?.()},onClose:()=>G(null)}),M("div",{className:"st-mb-right","data-tour":"status",children:[a?z("div",{className:"st-presence",children:a}):null,b0&&z("span",{className:"st-stamp st-stamp--viewonly","data-testid":"view-only-stamp","data-tip":Q?.user?`${Q.user} is a viewer on this project — you can browse, comment and export. Ask a project owner for edit access, or sign out if that is not the account you meant to use.`:"Your role in this project is viewer — you can browse, comment when available, and export. Ask a project owner for edit access.",children:"VIEW ONLY"}),Q?.user?M("span",{className:"st-cloudwho","data-testid":"cloud-account",children:[z("span",{className:"st-cloudwho-email",title:Q.role?`Signed in as ${Q.user} — ${Q.role}`:Q.user,children:Q.user}),z("form",{method:"post",action:"/auth/browser/signout",className:"st-cloudwho-form",children:z("button",{type:"submit",className:"st-cloudwho-out","data-testid":"cloud-signout",title:"Sign out of this project",children:"Sign out"})})]}):null,X9()&&!b0&&z("button",{type:"button",className:"st-assistant","data-testid":"assistant-toggle","data-active":z8?"true":"false","data-busy":L8?"true":"false","data-unseen":W8?"true":"false","aria-label":`Assistant${L8?" — working":W8?" — new reply":""}`,"data-tip":"Assistant ⌘⇧A",onClick:Q9,children:z(A9,{name:"sparkle",size:15})}),X0&&z(Qx,{center:X0}),z("button",{type:"button",className:"st-reportbug","data-testid":"report-bug-toggle","aria-label":"Report a bug","data-tip":"Report a bug",onClick:O,children:z(A9,{name:"bug",size:15})}),z("button",{type:"button",className:"st-whatsnew","data-tour":"whatsnew","data-unseen":U0>0?"true":"false","aria-label":`What's new${U0>0?` — ${U0} unseen`:""}`,"data-tip":"What's new",onClick:f,children:z(A9,{name:"megaphone",size:15})}),z("span",{className:"st-stamp",children:y0}),z("span",{className:"st-mb-file",title:X||"",children:c0}),z("span",{className:"st-mb-sep"}),M("span",{className:"st-mb-count","data-tip":"Artboards in the open canvas",children:[z("span",{className:"st-dot",style:{background:"var(--accent)"}}),H0," ARTBOARDS"]}),z("span",{className:"st-mb-sep"}),z("span",{className:"st-mb-proj",children:J||"maude"})]})]})}function Z20({tabs:X,activePath:J,registerIframe:Q,systemData:Y,onOpenFromSystem:W,onSelectDs:G,project:Z,cfg:H,loadingPath:K,onIframeLoad:U,showQuickSetup:q,onStartQuickSetup:B,previewPath:N}){let F=u.useRef(null);return u.useEffect(()=>{if(N)F.current?.focus()},[N]),M("div",{className:"viewport st-stage","data-tour":"viewport",children:[N&&z("div",{ref:F,className:"st-file-preview-overlay",role:"region","aria-label":`Preview: ${uB(wK(N))}`,tabIndex:0,children:z(Bh,{path:N,kind:lR(wK(N))})}),X.length===0&&!N&&M("div",{className:"st-empty",children:[M("div",{className:"st-empty-brand",children:[z("span",{className:"st-brand-mark",children:z("svg",{viewBox:"0 0 32 32",width:"100%",height:"100%",fill:"none","aria-hidden":"true",children:z("path",{d:"M16 5l2.8 8.2L27 16l-8.2 2.8L16 27l-2.8-8.2L5 16l8.2-2.8z",fill:"currentColor"})})}),z("span",{className:"st-empty-wm",children:"maude"}),M("span",{className:"st-empty-sub st-mono",children:["CANVAS · ",(Z||"MAUDE").toUpperCase()," / v",pR," / localhost:",typeof window<"u"?window.location.port:"4399"]})]}),z("div",{className:"st-empty-title",children:"Nothing open yet"}),M("div",{className:"st-empty-body",children:["← Pick a screen from the list on the left, or open ",z("strong",{children:"Design system"})," above it to see your colors, type, and components.",z("br",{}),z("br",{}),z("strong",{children:"To select something on the canvas:"})," hold ",z(MX,{children:"⌘"})," and hover to preview an element, click to select it — ",z(MX,{children:"⌘⇧"}),"+click selects more than one. Right-click for more options.",X9()?M(G0,{children:[z("br",{}),z("br",{}),"Claude can see whatever's selected when you ask for a change in the Assistant panel, so pointing is often faster than describing it."]}):null]}),q&&z("button",{type:"button","data-testid":"st-empty-start-quick-setup",className:"btn btn--primary st-empty-quick-setup",onClick:B,children:"Start quick setup"})]}),X.map((D)=>{if(D.path===d8)return z("div",{className:"system-view"+(D.path===J?" active":""),children:z(N20,{data:Y,onOpen:W,cfg:H,onSelectDs:G})},D.path);return z("iframe",{ref:(_)=>Q(D.path,_),src:Lz(D.path,H),className:D.path===J?"active":"","data-path":D.path,"data-testid":D.path===J?"canvas-frame":void 0,onLoad:()=>U?.(D.path),...H?.canvasOrigin?{sandbox:"allow-scripts allow-same-origin",allow:"clipboard-write"}:{}},D.path)}),K&&K===J&&z("div",{className:"st-canvas-loading","aria-hidden":"true",children:M("div",{className:"st-skel-card",children:[z("div",{className:"st-skel-cap st-mono",children:"compiling canvas…"}),z("span",{className:"skel st-skel-thumb"}),z("span",{className:"skel st-skel-line",style:{width:"72%"}}),z("span",{className:"skel st-skel-line",style:{width:"46%"}})]})})]})}var H20=["color","space","radius","shadow","leading","weight","motion","font","other"],z20={color:"colors",space:"spacing",radius:"radii",shadow:"shadows",leading:"leading",weight:"weights",motion:"motion",font:"font stacks",other:"other"};function K20(X){return X==="color"}function U20({tokens:X,tokenGroups:J,tokensPath:Q}){if(!X||X.length===0)return M("section",{className:"sv-section sv-section-tokens",children:[M("h2",{children:["tokens",z("span",{className:"sv-h-num",children:"0"})]}),z("div",{className:"sv-empty",children:M("p",{children:["No tokens parsed from"," ",Q?z("code",{children:Q}):"the configured tokens file",". Does the file exist and contain CSS custom properties (",z("code",{children:"--name: value;"}),")?"]})})]});let Y=J||{},W=Array.from(new Set([...H20,...Object.keys(Y)])).filter((G)=>Y[G]?.length);return z(G0,{children:W.map((G)=>{let Z=Y[G],H=K20(G);return M("section",{className:"sv-section sv-section-tokens sv-section-"+G,children:[M("h2",{children:["tokens · ",z20[G]||G,z("span",{className:"sv-h-num",children:Z.length})]}),z("div",{className:"sv-tokens-ladder",children:Z.map((K)=>M("div",{className:"sv-tok-cell",children:[H?z("div",{className:"sv-tok-swatch",style:{background:K.value}}):null,M("div",{className:"sv-tok-meta",children:[z("code",{className:"sv-tok-name",children:K.name}),z("span",{className:"sv-tok-value",children:K.value||"—"})]})]},K.name+"|"+K.value))})]},G)})})}function V20(X,J){let Q=X.name.match(/^--(?:type|fs|text)-(.+)$/);if(!Q)return null;let Y=Q[1];return(J||[]).find((W)=>/^--(?:lh|leading|line-height)-/.test(W.name)&&W.name.endsWith("-"+Y))?.value??null}function q20(X){if(!X?.length)return;let J=["body","sans","display","text","family"];for(let Q of J){let Y=X.find((W)=>W.name.includes(Q));if(Y)return Y.value}return X[0].value}function B20({tokenGroups:X}){let J=X?.fontsize||[];if(J.length===0)return null;let Q=X?.leading||[],Y=q20(X?.font);return M("section",{className:"sv-section sv-section-type",children:[M("h2",{children:["type · ladder",z("span",{className:"sv-h-num",children:J.length})]}),z("div",{className:"sv-type-list",children:J.map((W)=>{let G=V20(W,Q),Z={fontSize:W.value};if(G)Z.lineHeight=G;if(Y)Z.fontFamily=Y;return M("div",{className:"sv-type-row",children:[z("code",{className:"sv-type-tok",children:W.name}),z("span",{className:"sv-type-sample",style:Z,children:"The catalog is the system."})]},W.name)})})]})}function N20({data:X,onOpen:J,cfg:Q,onSelectDs:Y}){if(!X)return z("div",{className:"sv-empty",children:z("p",{children:"Loading design system…"})});let{previewGallery:W,uiKitsGallery:G,systemDir:Z,tokens:H,tokenGroups:K,tokensPath:U,ds:q,availableDesignSystems:B}=X,N=(!W||!W.length)&&(!G||!G.length),F=Array.isArray(B)&&B.length>1,D=q?.name??B?.[0]?.name??"";return M("div",{className:"sv",children:[M("header",{className:"sv-header",children:[z("span",{className:"sv-sku",children:"MAUDE-DSN/01"}),z("span",{className:"sv-title",children:"design system view"}),F?M("label",{className:"sv-ds-picker",children:[z("span",{className:"sv-ds-picker-label",children:"DS"}),z("select",{value:D,onChange:(_)=>Y&&Y(_.target.value),children:B.map((_)=>z("option",{value:_.name,children:_.name},_.name))})]}):null,z("span",{className:"sv-loc",children:z("code",{children:Z})})]}),q?.description?z("p",{className:"sv-ds-description",children:q.description}):null,z(U20,{tokens:H,tokenGroups:K,tokensPath:U}),z(B20,{tokenGroups:K}),N?z("div",{className:"sv-empty",children:M("p",{children:["No ",z("code",{children:"preview/"})," or ",z("code",{children:"ui_kits/"})," folders found under"," ",z("code",{children:Z}),"."]})}):M(G0,{children:[z(de,{title:"preview",items:W,onOpen:J,kind:"preview",cfg:Q}),z(de,{title:"ui kits",items:G,onOpen:J,kind:"ui_kits",cfg:Q})]})]})}function de({title:X,items:J,onOpen:Q,kind:Y,cfg:W}){if(!J||J.length===0)return null;return M("section",{className:"sv-section",children:[M("h2",{children:[X," ",z("span",{className:"sv-count",children:J.length})]}),z("div",{className:"sv-previews sv-previews-"+Y,children:J.map((G)=>M("article",{className:"sv-preview-card",onClick:()=>Q(G.path),children:[z("div",{className:"sv-preview-frame",children:z("iframe",{src:Lz(G.path,W,{thumbnail:!0}),title:G.label,scrolling:"no",...W?.canvasOrigin?{sandbox:"allow-scripts allow-same-origin"}:{}})}),M("div",{className:"sv-preview-foot",children:[z("strong",{children:G.label}),z("code",{children:G.path})]})]},G.path))})]})}function F20({activePath:X,selected:J,wsConnected:Q,openCount:Y,theme:W,onToggleTheme:G,onClearSelected:Z,syncStatus:H,syncProject:K,syncOpen:U=!1,onOpenSync:q,changesCount:B=0,unpushed:N=0,changesOpen:F=!1,onOpenChanges:D,version:_}){let R=X===d8,w=J&&J.selector?J.selector+(J.text?` — "${J.text.slice(0,60)}"`:""):"",O=J&&J.dom_path?J.dom_path.join(" > "):J?J.selector:"",P=W==="dark"?"light":"dark",I=(()=>{let $=Fz(H,{project:K});if(!$)return null;let C=$.names.length?` (${$.names.join(", ")})`:"";return{online:$.online,label:$.label,title:`${$.title}${C}${$.next?` — ${$.next}`:""}`}})(),k=I&&M(G0,{children:[z("span",{className:"st-sb-sync-dot"+(I.online?" is-online":""),"aria-hidden":"true"}),z("span",{className:"lbl",children:"hub sync"}),z("span",{className:"val",title:I.title,children:I.label})]});return M("footer",{className:"st-statusbar",role:"contentinfo","data-testid":"statusbar",children:[M("span",{className:"st-sb-slot st-sb-active",role:"group","aria-label":"Active file",children:[z("span",{className:"lead","aria-hidden":"true"}),z("span",{className:"lbl",children:"active"}),z("span",{className:"val",title:X||"",children:R?"▦ design system":X||"—"})]}),X&&J&&J.selector&&!R&&M("span",{className:"st-sb-slot st-sb-sel",role:"group","aria-label":"Selected element",children:[z("span",{className:"lbl",children:"selected"}),z("span",{className:"val",title:O,children:w}),z("button",{type:"button",className:"st-sb-sel-clear",onClick:Z,"data-tip":"Clear · Esc inside iframe","data-tip-pos":"top","aria-label":"Clear selection",children:"×"})]}),M("span",{className:"st-sb-slot",role:"group","aria-label":"Open comments",children:[z("span",{className:"lbl",children:"comments"}),M("span",{className:"val",children:[Y," open"]})]}),D&&M("button",{type:"button",className:"st-sb-slot st-sb-changes"+(F?" is-open":"")+(B>0?" has-changes":N>0?" has-unpushed":""),onClick:D,"data-testid":"open-changes","data-tip":"Open Changes · ⌘⇧G","data-tip-pos":"top","aria-label":"Open Changes panel","aria-pressed":F,children:[z("span",{className:"st-sb-changes-dot","aria-hidden":"true"}),z("span",{className:"lbl",children:"changes"}),z("span",{className:"val",children:B>0?`${B} unsaved`:N>0?`${N} to publish`:"all saved"})]}),z("span",{className:"st-sb-spacer"}),M("span",{className:"st-sb-slot",role:"group","aria-label":"Connection",children:[z("span",{className:"st-live-dot"+(Q?" is-connected":""),"aria-hidden":"true"}),z("span",{className:"lbl",children:Q?"live":"reconnecting"})]}),I&&(q?z("button",{type:"button",className:"st-sb-slot st-sb-sync st-sb-sync--btn"+(U?" is-open":""),onClick:q,"data-testid":"open-sync","data-tip":"Open Sync panel","data-tip-pos":"top","aria-label":"Open Sync panel","aria-pressed":U,children:k}):z("span",{className:"st-sb-slot st-sb-sync",role:"group","aria-label":"Hub sync",children:k})),_&&z("span",{className:"st-sb-slot st-sb-version",role:"group","aria-label":"Maude version",children:M("span",{className:"val","data-testid":"statusbar-version",children:["v",_]})}),M("button",{type:"button",className:"st-sb-theme",onClick:G,"data-tip":`Switch to ${P} theme`,"data-tip-pos":"top","aria-label":`Switch to ${P} theme`,children:[z(A9,{name:W==="dark"?"sun":"moon",size:13}),P]})]})}function L20({commentsByFile:X,filter:J,setFilter:Q,activePath:Y,focusedId:W,onJump:G,onResolve:Z,onReopen:H,onDelete:K,width:U,resizing:q}){let B=z00(X),N=Object.keys(X||{}).sort(),F=[];for(let D of N){let _=X[D]||[],R=_.filter((O)=>{if(J==="open")return O.status!=="resolved";if(J==="resolved")return O.status==="resolved";return!0});if(R.length===0)continue;let w=_.filter((O)=>O.selector);F.push({file:D,comments:R.map((O)=>({...O,n:w.findIndex((P)=>P.id===O.id)+1}))})}return M("aside",{className:"st-rpanel"+(q?" is-resizing":""),style:U?{width:U,flexBasis:U}:void 0,"aria-label":"Comments",children:[z("div",{className:"st-rp-tabs st-rp-tabs--filters",children:M("div",{className:"st-cm-filters",role:"tablist",children:[M("button",{type:"button",className:"st-cm-filter"+(J==="all"?" is-active":""),role:"tab","aria-selected":J==="all",onClick:()=>Q("all"),children:["All · ",B.all]}),M("button",{type:"button",className:"st-cm-filter"+(J==="open"?" is-active":""),role:"tab","aria-selected":J==="open",onClick:()=>Q("open"),children:["Open · ",B.open]}),M("button",{type:"button",className:"st-cm-filter"+(J==="resolved"?" is-active":""),role:"tab","aria-selected":J==="resolved",onClick:()=>Q("resolved"),children:["Resolved · ",B.resolved]})]})}),z("div",{className:"st-rp-body",style:{gap:"var(--space-4)"},children:F.length===0?M("div",{className:"st-rp-empty",children:[M("p",{children:["No comments ",J!=="all"?`with status “${J}”`:"yet","."]}),M("p",{children:["Open a canvas, hold ",z(MX,{children:"⌘"})," and click an element, then press ",z(MX,{children:"C"})," — or hold ",z(MX,{children:"⌘⇧"})," and click directly."]})]}):F.map((D)=>M(G0,{children:[M("button",{type:"button",className:"st-cm-group-hd",onClick:()=>G(D.file,null),title:D.file,children:[z("span",{children:vW(wK(D.file))}),z("span",{className:"st-mono",children:D.comments.length})]}),D.comments.map((_)=>M("div",{className:"st-comment"+(_.status==="resolved"?" is-resolved":"")+(_.id===W?" is-active":""),onClick:()=>G(D.file,_.id),children:[M("div",{className:"st-comment-hd",children:[z("span",{className:"st-pin st-pin--inline",children:_.n||"·"}),z("span",{className:"st-comment-time",children:Sq0(_.created)})]}),z("div",{className:"st-comment-txt",children:_.text}),M("div",{className:"st-comment-foot",children:[z("span",{className:"st-comment-sel",title:(_.dom_path||[]).join(" > "),children:_.selector||"—"}),Z&&H&&K?M("span",{className:"st-mini-act",children:[_.status==="resolved"?z("button",{type:"button",className:"st-iconbtn","aria-label":"Reopen",onClick:(R)=>{R.stopPropagation(),H(_.id)},children:z(A9,{name:"reopen",size:14})}):z("button",{type:"button",className:"st-iconbtn","aria-label":"Resolve",onClick:(R)=>{R.stopPropagation(),Z(_.id)},children:z(A9,{name:"resolve",size:14})}),z("button",{type:"button",className:"st-iconbtn","aria-label":"Delete",onClick:(R)=>{R.stopPropagation(),K(_.id)},children:z(A9,{name:"x",size:14})})]}):null]})]},_.id))]},D.file))})]})}var D20={owner:"You own this project — edit, invite and export.",member:"You can edit this project, comment and export.",viewer:"You can look at this project, comment and download it, but not change it."};function M20({cloud:X}){let J=X?.role||null,[Q,Y]=u.useState(!1);if(!J||Q)return null;let W=`maude-cloud-role-seen:${J}`,G=!1;try{G=localStorage.getItem(W)==="1"}catch{}if(G)return null;let Z=D20[J];if(!Z)return null;return M("div",{role:"status","aria-live":"polite",className:"st-banner st-banner--info","data-testid":"cloud-role-banner",children:[z("span",{className:"st-banner-dot","aria-hidden":"true"}),z("span",{children:Z}),z("button",{type:"button",className:"btn btn--ghost btn--sm","data-testid":"cloud-role-banner-dismiss",onClick:()=>{Y(!0);try{localStorage.setItem(W,"1")}catch{}},children:"Got it"})]})}function O20({update:X,onDismiss:J}){let[Q,Y]=u.useState(!1);if(!X)return null;let W=X.version?` (v${X.version})`:"";return M("div",{role:"status","aria-live":"polite",className:"st-banner st-banner--info",children:[z("span",{className:"st-banner-dot","aria-hidden":"true"}),M("span",{children:["Maude updated",W," · restart to apply"]}),z("button",{type:"button",className:"btn btn--primary btn--sm",disabled:Q,onClick:()=>{Y(!0),Tv().catch(()=>Y(!1))},children:Q?"Restarting…":"Restart now"}),z("button",{type:"button",className:"btn btn--ghost btn--sm",onClick:J,children:"Later"})]})}function _20({status:X}){let[J,Q]=u.useState(null);if(!X||X.linked===!1)return null;if(X.notSyncable)return null;let{state:Y,queuedOps:W,flash:G,conflicts:Z}=X,H=G==="synced",K=Y==="offline"||Y==="offline-long",U=X.docs?.rejected??0,q=Array.isArray(Z)?[...Z].reverse().find((D)=>D.kind==="cold-start-diverged"):null;if(!K&&!H&&!q&&U===0)return null;let B,N,F;if(H)B="success",N="Synced with hub",F=`${Y}:flash`;else if(K){let D=Z&&Z.length>0?` (${Z.length} conflict notice(s))`:"";if(Y==="offline-long")B="error",N=`Long offline — ${W} edit(s) queued. Consider \`git commit && git push\` as backup.${D}`;else B="warn",N=`Working offline · ${W} edit(s) queued · will sync when the hub reconnects.${D}`;F=`${Y}:offline`}else if(q){if(q.snapshotFailed)B="error",N=`Diverged on ${q.slug}: kept local — the history snapshot FAILED, so the overwrite was refused. Check disk space / .design/_history write access.`;else B="warn",N=`Diverged on ${q.slug}: kept the ${q.winner==="local"?"local (newer)":"hub"} version — the other is snapshotted in history → /design:rollback ${q.slug}`;F=`diverged:${q.slug}:${q.at}`}else B="warn",N=`${U} canvas(es) not syncing — the hub rejected auth. Details: maude design status`,F=`rejected:${U}`;if(J===F)return null;return M("div",{role:"status","aria-live":"polite",className:`st-banner st-banner--${B}`,children:[z("span",{className:"st-banner-dot","aria-hidden":"true"}),z("span",{children:N}),z("button",{type:"button",className:"st-banner-close","aria-label":"Dismiss",title:"Dismiss",onClick:()=>Q(F),children:"×"})]})}var A20=["block","inline-block","flex","inline-flex","grid","inline","none"],ce=["px","%","fr","em","auto","min-content","max-content"];var w20=["auto","stretch","flex-start","center","flex-end","baseline"];var ie=["300","400","500","600","700","800"],oe=["inherit","system-ui","sans-serif","serif","monospace","Inter","Inter Tight","JetBrains Mono"],ne=["none","solid","dashed","dotted","double"],re=["px","rem","em","%","vw","vh","auto"],ae=new Set(["line-height","opacity","font-weight","z-index","flex-grow","flex-shrink","order"]),mR={"font-size":{node:z(Q7,{as:aU,size:12})},"line-height":{node:z(Q7,{as:YV,size:12})},"letter-spacing":{node:z(Q7,{as:qV,size:12})},gap:{node:z(Q7,{as:iz,size:12})},width:{t:"W"},height:{t:"H"},"max-width":{t:"W"},"border-radius":{node:z(Q7,{as:DV,size:12})},"border-width":{node:z(Q7,{as:VV,size:12})}};var se=["static","relative","absolute","fixed","sticky"],E20=["normal","italic","oblique"],te=["none","uppercase","lowercase","capitalize"];var ee=["normal","nowrap","pre","pre-wrap","pre-line","break-spaces"],P20=["fill","contain","cover","none","scale-down"];var X00=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J00=["auto","1 / 1","4 / 3","3 / 2","16 / 9","21 / 9","3 / 4","2 / 3","9 / 16"],D5={desktop:{label:"Desktop",width:1440,height:1024},laptop:{label:"Laptop",width:1280,height:800},tablet:{label:"Tablet",width:834,height:1194},mobile:{label:"Mobile",width:390,height:844}},_K=null;function DF(X){if(!X)return"";if(/^#[0-9a-f]{6}$/i.test(X))return X.toLowerCase();try{if(!_K)_K=document.createElement("canvas").getContext("2d");if(!_K)return"";_K.fillStyle="#000000",_K.fillStyle=X;let J=_K.fillStyle;if(/^#[0-9a-f]{6}$/i.test(J))return J.toLowerCase();let Q=J.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(Q)return`#${[Q[1],Q[2],Q[3]].map((Y)=>Number(Y).toString(16).padStart(2,"0")).join("")}`}catch{}return""}var gY=(X)=>Math.min(1,Math.max(0,X));function VF(X){let J=/^#?([0-9a-f]{6})$/i.exec(X||"");if(!J)return{r:0,g:0,b:0};let Q=Number.parseInt(J[1],16);return{r:Q>>16&255,g:Q>>8&255,b:Q&255}}function I3({r:X,g:J,b:Q}){return`#${[X,J,Q].map((Y)=>Math.round(Y).toString(16).padStart(2,"0")).join("")}`}function k3({r:X,g:J,b:Q}){X/=255,J/=255,Q/=255;let Y=Math.max(X,J,Q),W=Math.min(X,J,Q),G=Y-W,Z=0;if(G){if(Y===X)Z=(J-Q)/G%6;else if(Y===J)Z=(Q-X)/G+2;else Z=(X-J)/G+4;if(Z*=60,Z<0)Z+=360}return{h:Z,s:Y?G/Y:0,v:Y}}function AK({h:X,s:J,v:Q}){let Y=Q*J,W=Y*(1-Math.abs(X/60%2-1)),G=Q-Y,Z=0,H=0,K=0;if(X<60)[Z,H,K]=[Y,W,0];else if(X<120)[Z,H,K]=[W,Y,0];else if(X<180)[Z,H,K]=[0,Y,W];else if(X<240)[Z,H,K]=[0,W,Y];else if(X<300)[Z,H,K]=[W,0,Y];else[Z,H,K]=[Y,0,W];return{r:(Z+G)*255,g:(H+G)*255,b:(K+G)*255}}function G7(X){if(!X)return"";let J=/^(-?\d*\.?\d+)px$/.exec(X);return J?`${Math.round(Number.parseFloat(J[1]))}px`:X}function jQ(X){if(!X)return{n:"",unit:"px"};let J=X.trim(),Q=/^(-?\d*\.?\d+)\s*(px|rem|em|%|vw|vh)?$/.exec(J);if(Q)return{n:Q[1],unit:Q[2]||"px"};if(J==="auto")return{n:"",unit:"auto"};return{n:J,unit:""}}function Q00(X,J){if(!X||Array.isArray(X)||Array.isArray(J)||!J)return X;if(!X.id&&!J.id){let Q=(Y)=>typeof Y.selector==="string"&&Y.selector.startsWith("[data-dc-screen=");if(Q(X)&&Q(J)&&X.selector===J.selector&&X.file===J.file)return{...X,authored:X.authored??J.authored,computed:X.computed??J.computed,customStyles:X.customStyles??J.customStyles,attrs:X.attrs??J.attrs,artboardId:X.artboardId??J.artboardId,worldW:X.worldW??J.worldW,worldH:X.worldH??J.worldH};return X}if(!X.id||X.id!==J.id)return X;return{...X,authored:X.authored??J.authored,computed:X.computed??J.computed,customStyles:X.customStyles??J.customStyles,attrs:X.attrs??J.attrs,photoKind:X.photoKind??J.photoKind,photoAsset:X.photoAsset??J.photoAsset}}function V00(X,J){return(X?J?.canvasDesignSystems?.[X]:null)||J?.defaultDesignSystem||J?.designSystems?.[0]?.name||null}function R20(X){let J={};for(let Z of X.matchAll(/(--[a-z0-9-]+)\s*:\s*([^;}]+)/gi))if(!(Z[1]in J))J[Z[1]]=Z[2].trim();let Q={};for(let Z of Object.keys(J)){let H=J[Z],K=/^var\(\s*(--[a-z0-9-]+)\s*\)$/i.exec(H);Q[Z]=K&&J[K[1]]?J[K[1]]:H}let Y=Object.keys(J),W=(Z)=>Y.filter((H)=>Z.test(H)),G=(Z)=>/^(#[0-9a-f]{3,8}|rgba?\(|hsla?\(|oklch\(|oklab\(|lab\(|lch\(|hwb\(|color\()/i.test(Z)||/^(transparent|currentcolor|white|black|red|green|blue|gray|grey|orange|yellow|purple|pink|cyan|magenta|teal|navy|maroon|olive|lime|aqua|silver|gold)$/i.test(Z);return{color:Y.filter((Z)=>G(Q[Z])),space:W(/^--space-/),radius:W(/^--radius-/),type:W(/^--type-/),shadow:W(/^--shadow-/),lh:W(/^--lh-/),vals:Q}}function q00(X,J,Q){let Y=X?.designSystems||[],W=Y.map((H)=>`${H.name}:${H.tokensCssRel}`).join("|"),[G,Z]=u.useState([]);return u.useEffect(()=>{if(!Y.length)return;let H=!1;return Promise.all(Y.map(async(K)=>{if(!K.tokensCssRel)return null;try{let U=await fetch(`/${J}/${K.tokensCssRel}`),q=U.ok?await U.text():"";return{name:K.name,...R20(q)}}catch{return null}})).then((K)=>{if(H)return;let U=K.filter(Boolean);U.sort((q,B)=>q.name===Q?-1:B.name===Q?1:0),Z(U)}),()=>{H=!0}},[W,J,Q]),G}function B00({seed:X,label:J,onApply:Q}){let[Y,W]=u.useState(()=>k3(VF(X||"#000000"))),G=u.useRef(Y);G.current=Y;let Z=u.useRef(null),H=u.useRef(null),K=u.useRef(X);u.useEffect(()=>{if(X&&X!==K.current)K.current=X,W(k3(VF(X)))},[X]);let U=I3(AK(Y)),q=(O)=>{O.preventDefault();let P=Z.current?.getBoundingClientRect();if(!P)return;let I=G.current.h,k=(C)=>{W({h:I,s:gY((C.clientX-P.left)/P.width),v:gY(1-(C.clientY-P.top)/P.height)})};k(O);let $=()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",$),Q(I3(AK(G.current)))};document.addEventListener("pointermove",k),document.addEventListener("pointerup",$)},B=(O)=>{O.preventDefault();let P=H.current?.getBoundingClientRect();if(!P)return;let{s:I,v:k}=G.current,$=(b)=>{W({h:gY((b.clientX-P.left)/P.width)*360,s:I,v:k})};$(O);let C=()=>{document.removeEventListener("pointermove",$),document.removeEventListener("pointerup",C),Q(I3(AK(G.current)))};document.addEventListener("pointermove",$),document.addEventListener("pointerup",C)},N=(O)=>{let P={...G.current,...O};W(P),Q(I3(AK(P)))},F=(O)=>{let P=O.shiftKey?0.1:0.02,k={ArrowLeft:[-P,0],ArrowRight:[P,0],ArrowUp:[0,P],ArrowDown:[0,-P]}[O.key];if(!k)return;O.preventDefault(),N({s:gY(G.current.s+k[0]),v:gY(G.current.v+k[1])})},D=(O)=>{let P=O.shiftKey?20:2,k={ArrowLeft:-P,ArrowRight:P}[O.key];if(k==null)return;O.preventDefault(),N({h:Math.min(360,Math.max(0,G.current.h+k))})},_=async()=>{try{let O=window.EyeDropper;if(!O)return;let P=await new O().open();if(P?.sRGBHex)W(k3(VF(P.sRGBHex))),Q(P.sRGBHex)}catch{}},R=AK(Y),w=(O)=>{let P={...R,...O},I=k3({r:gY(P.r/255)*255,g:gY(P.g/255)*255,b:gY(P.b/255)*255});W(I),Q(I3(AK(I)))};return M("div",{className:"st-cp-cpick",children:[M("div",{className:"st-cp-cpick-hexrow",children:[z("span",{className:"st-cp-cpick-hexsw",style:{background:U}}),z("input",{className:"st-cp-cpick-hex",type:"text",value:U,"aria-label":J?`${J} hex value`:"hex value",onChange:(O)=>{let P=O.target.value;if(/^#?[0-9a-f]{6}$/i.test(P))W(k3(VF(P)))},onKeyDown:(O)=>{if(O.key==="Enter")Q(O.currentTarget.value)},onBlur:(O)=>Q(O.currentTarget.value),onFocus:(O)=>O.currentTarget.select()})]}),M("button",{type:"button",ref:Z,className:"st-cp-cpick-sv","aria-label":J?`${J} saturation and value`:"saturation and value",style:{background:`hsl(${Y.h} 100% 50%)`},onPointerDown:q,onKeyDown:F,children:[z("span",{className:"st-cp-cpick-svwhite"}),z("span",{className:"st-cp-cpick-svblack"}),z("span",{className:"st-cp-cpick-knob",style:{left:`${Y.s*100}%`,top:`${(1-Y.v)*100}%`,background:U}})]}),M("div",{className:"st-cp-cpick-controls",children:[window.EyeDropper?z("button",{type:"button",className:"st-cp-cpick-eye","aria-label":"pick from screen",title:"eyedropper",onClick:_,children:z(A9,{name:"eyedropper",size:14})}):null,z("span",{className:"st-cp-cpick-preview",style:{background:U},"aria-hidden":"true"}),z("button",{type:"button",ref:H,className:"st-cp-cpick-hue","aria-label":J?`${J} hue`:"hue",onPointerDown:B,onKeyDown:D,children:z("span",{className:"st-cp-cpick-huethumb",style:{left:`${Y.h/360*100}%`}})})]}),z("div",{className:"st-cp-cpick-rgb",children:["r","g","b"].map((O)=>M("label",{className:"st-cp-cpick-rgbf",children:[z("input",{"aria-label":O.toUpperCase(),value:Math.round(R[O]),onChange:(P)=>w({[O]:gY((Number.parseFloat(P.target.value)||0)/255)*255}),onFocus:(P)=>P.currentTarget.select()}),z("span",{children:O.toUpperCase()})]},O))})]})}function BF({kind:X,groups:J,current:Q,onPick:Y,label:W,swatchBg:G,seedHex:Z,activeDs:H,swatchClassName:K}){let[U,q]=u.useState(!1),[B,N]=u.useState(null),[F,D]=u.useState("custom"),[_,R]=u.useState(""),w=u.useRef(null),O=u.useRef(null),P=typeof Q==="string"&&/var\(\s*--/.test(Q),I=(n)=>Q===`var(${n})`,k=(n)=>n.replace(/^--/,"").replace(/-/g," "),$=J||[],C=$.reduce((n,c)=>n+(c.names?.length||0),0),b=$.length>1,v=_.trim().toLowerCase(),h=!v?$:$.map((n)=>({...n,names:(n.names||[]).filter((c)=>k(c).toLowerCase().includes(v)||c.toLowerCase().includes(v)||(n.vals?.[c]||"").toLowerCase().includes(v))})).filter((n)=>n.names.length);u.useEffect(()=>{if(!U){R("");return}let n=()=>{let H0=w.current?.getBoundingClientRect();if(!H0)return;let a=224,D0=300,z0=Math.min(H0.right-a,window.innerWidth-a-8);if(z0<8)z0=8;let X8=window.innerHeight-H0.bottom>D0+8?H0.bottom+4:Math.max(8,H0.top-D0-4);N({left:z0,top:X8,width:a,maxHeight:D0})};n();let c=(H0)=>{if(O.current?.contains(H0.target)||w.current?.contains(H0.target))return;q(!1)},U0=(H0)=>{if(H0.key==="Escape")q(!1)},X0=(H0)=>{if(O.current?.contains(H0.target))return;n()};return document.addEventListener("pointerdown",c,!0),document.addEventListener("keydown",U0),window.addEventListener("resize",n),document.addEventListener("scroll",X0,!0),()=>{document.removeEventListener("pointerdown",c,!0),document.removeEventListener("keydown",U0),window.removeEventListener("resize",n),document.removeEventListener("scroll",X0,!0)}},[U]),u.useEffect(()=>{if(!U||!B||!O.current)return;let n=O.current.getBoundingClientRect(),c=B.left-n.left,U0=B.top-n.top;if(Math.abs(c)>0.5||Math.abs(U0)>0.5)N((X0)=>X0?{...X0,left:X0.left+c,top:X0.top+U0}:X0)},[U,B]);let d=/url\(|image-set\(|cross-fade\(|element\(|expression\(|@import|javascript:/i,o=(n,c,U0)=>{if(H&&n&&n!==H&&U0&&!d.test(U0))Y(U0);else Y(`var(${c})`);q(!1)},x=(n)=>{let c=(n||"").trim();if(c)Y(c)},m=M("div",{className:"st-cp-pop-search",children:[z(A9,{name:"search",size:12}),z("input",{value:_,onChange:(n)=>R(n.target.value),placeholder:"Search variables","aria-label":"search variables",autoFocus:!0})]}),l=(n)=>n.map((c)=>M("div",{className:"st-cp-pop-group",children:[b?z("div",{className:"st-cp-pop-ds",children:c.ds}):null,z("div",{className:"st-cp-pop-list",children:c.names.map((U0)=>M("button",{type:"button",className:`st-cp-pop-row st-cp-pop-crow${I(U0)?" is-on":""}`,onClick:()=>o(c.ds,U0,c.vals?.[U0]),children:[z("span",{className:"st-cp-pop-cswatch",style:{background:c.vals?.[U0]||"transparent"},"aria-hidden":"true"}),z("span",{className:"st-cp-pop-name",children:k(U0)}),z("span",{className:"st-cp-pop-val",children:c.vals?.[U0]||""})]},`${c.ds}:${U0}`))})]},c.ds)),f=(n)=>n.map((c)=>M("div",{className:"st-cp-pop-group",children:[b?z("div",{className:"st-cp-pop-ds",children:c.ds}):null,z("div",{className:"st-cp-pop-list",children:c.names.map((U0)=>M("button",{type:"button",className:`st-cp-pop-row${I(U0)?" is-on":""}`,onClick:()=>o(c.ds,U0,c.vals?.[U0]),children:[z("span",{className:"st-cp-pop-name",children:k(U0)}),z("span",{className:"st-cp-pop-val",children:c.vals?.[U0]||""})]},`${c.ds}:${U0}`))})]},c.ds)),s=z("div",{className:"st-cp-pop-empty",children:"No match"});return M(G0,{children:[G!==void 0?z("button",{type:"button",ref:w,className:`${K||"st-cp-swatch st-cp-swatch--mini st-cp-swatch--trigger"}${P&&!K?" is-bound":""}`,"aria-haspopup":"dialog","aria-expanded":U,"aria-label":W||"pick a colour",title:Q||"pick a colour",onClick:()=>q((n)=>!n),children:z("span",{style:{position:"absolute",inset:0,background:G||"transparent"}})}):z("button",{type:"button",ref:w,className:`st-cp-tokbtn${P?" is-bound":""}`,"aria-haspopup":"dialog","aria-expanded":U,"aria-label":W||"pick a design token",title:"design tokens",onClick:()=>q((n)=>!n),children:z("span",{className:"st-cp-tokbtn-glyph","aria-hidden":"true"})}),U&&B?W00.createPortal(z("div",{ref:O,className:"maude st-cp-pop","data-theme":typeof document<"u"&&document.documentElement.getAttribute("data-theme")||"dark",role:"dialog","aria-label":W||"design tokens",style:{left:B.left,top:B.top,width:B.width,maxHeight:B.maxHeight},children:X==="color"?M(G0,{children:[M("div",{className:"st-cp-poptabs",role:"tablist",children:[z("button",{type:"button",role:"tab","aria-selected":F==="custom",className:`st-cp-poptab${F==="custom"?" is-active":""}`,onClick:()=>D("custom"),children:"Custom"}),z("button",{type:"button",role:"tab","aria-selected":F==="vars",className:`st-cp-poptab${F==="vars"?" is-active":""}`,onClick:()=>D("vars"),children:"Variables"})]}),F==="custom"?z(B00,{seed:Z||DF(Q)||"#000000",onApply:x}):!C?z("div",{className:"st-cp-pop-empty",children:"No color tokens"}):M(G0,{children:[m,h.length?l(h):s]})]}):!C?z("div",{className:"st-cp-pop-empty",children:"No tokens for this property"}):M(G0,{children:[m,h.length?f(h):s]})}),document.body):null]})}function Y00({label:X,tracks:J,editable:Q,onChange:Y}){let W=(K,U)=>{let q=J[K];Y(J.map((B,N)=>N===K?XU.has(U)?{value:0,unit:U}:{value:q.value||1,unit:U}:B))},G=(K,U)=>{Y(J.map((q,B)=>B===K?{...q,value:U}:q))},Z=()=>Y([...J,{value:1,unit:"fr"}]),H=(K)=>Y(J.filter((U,q)=>q!==K));return M("div",{className:"st-cp-gridtracks",children:[M("div",{className:"st-cp-gridtracks-hd",children:[z("span",{className:"st-cp-gridtracks-label",children:X}),z("button",{type:"button",className:"st-btn st-cp-gridtracks-add",disabled:!Q,onClick:Z,children:"+ Track"})]}),J.length===0?M("div",{className:"st-cp-note",children:["No explicit tracks — add one to start defining ",X.toLowerCase(),"."]}):J.map((K,U)=>{let q=XU.has(K.unit);return M("div",{className:"st-cp-gridtrack-row",children:[q?z(_W,{value:K.unit,ariaLabel:`${X} track ${U+1}`,options:ce.map((B)=>({value:B,label:B})),onChange:(B)=>W(U,B)}):z(XX,{value:K.value,min:K.unit==="fr"?0.1:0,step:K.unit==="fr"?0.1:1,ariaLabel:`${X} track ${U+1} value`,lead:String(U+1),unitSlot:z(iB,{value:K.unit,units:ce,ariaLabel:`${X} track ${U+1} unit`,onChange:(B)=>W(U,B)}),onCommit:(B)=>G(U,B)}),z("button",{type:"button",className:"st-btn st-cp-gridtrack-remove","aria-label":`remove ${X} track ${U+1}`,disabled:!Q||J.length<=1,onClick:()=>H(U),children:"×"})]},U)})]})}function T20({el:X,cfg:J,onOptimistic:Q,onRecordEdit:Y,onReplaceMedia:W,onUndoRedo:G,mode:Z,onSetMode:H}){let K=!!X.id,U=X.computed||{},[q,B]=u.useState({a:{},c:{},t:{}});u.useEffect(()=>{B({a:{},c:{},t:{}})},[X.id]);let N=(e,A0)=>{let q0={...e||{}};for(let[j0,r0]of Object.entries(A0))if(r0===null)delete q0[j0];else q0[j0]=r0;return q0},F=N(X.authored,q.a),D=N(X.customStyles,q.c),_=N(X.attrs,q.t),R=(e,A0)=>B((q0)=>({...q0,a:{...q0.a,[e]:A0}})),w=(e,A0)=>B((q0)=>({...q0,c:{...q0.c,[e]:A0}})),O=(e,A0)=>B((q0)=>({...q0,t:{...q0.t,[e]:A0}})),P=(J?.designRel||J?.designRoot||".design").replace(/^\/+|\/+$/g,""),I=V00(X.file,J),k=q00(J,P,I),$=(e)=>k.map((A0)=>({ds:A0.name,names:A0[e]||[],vals:A0.vals})).filter((A0)=>A0.names.length),[C,b]=u.useState({}),[v,h]=u.useState({Layout:!0,Position:!0,Typography:!0,Spacing:!0,Size:!0,Media:!0,Appearance:!0,Advanced:!1}),d=Object.keys(D).length>0||Object.keys(_).length>0;u.useEffect(()=>{if(d)h((e)=>e.Advanced?e:{...e,Advanced:!0})},[X.id,d]);let o=(F.position||G7(U.position)||"static")!=="static";u.useEffect(()=>{if(o)h((e)=>e["d:Position"]?e:{...e,"d:Position":!0})},[X.id,o]);let x=H,[m,l]=u.useState({});async function f(e,A0,q0){b((j0)=>({...j0,[q0]:"saving"}));try{let j0=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(A0)}),r0=await j0.json().catch(()=>({}));b((y8)=>({...y8,[q0]:!j0.ok||!r0.ok?`err:${r0&&r0.error||`HTTP ${j0.status}`}`:"saved"}))}catch(j0){b((r0)=>({...r0,[q0]:`err:${j0&&j0.message?j0.message:String(j0)}`}))}}let s=(e,A0)=>{if(!Q||!X.id)return;Q({id:X.id,artboardId:X.artboardId??null,index:X.index??0,prop:e,value:A0})},n=(e,A0,q0,j0)=>{Y?.({op:e,canvas:X.file,id:X.id,key:A0,before:q0==null||q0===""?null:q0,after:j0==null||j0===""?null:j0})},c=(e,A0)=>{let q0=(A0||"").trim();if(!K||!q0)return;let j0=F[e]??null;if(q0===(j0??"").trim())return;s(e,q0),R(e,q0),f("/_api/edit-css",{canvas:X.file,id:X.id,property:e,value:q0},e),n("css",e,j0,q0)},U0=(e,A0)=>{let q0=(A0||"").trim(),j0=e.trim();if(!K||!j0||!q0)return;let r0=D[j0]??null;s(j0,q0),w(j0,q0),f("/_api/edit-css",{canvas:X.file,id:X.id,property:j0,value:q0},j0),n("css",j0,r0,q0)},X0=(e,A0)=>{let q0=(e||"").trim(),j0=(A0||"").trim();if(!K||!q0||!j0)return;let r0=_[q0]??null;O(q0,j0),f("/_api/edit-attr",{canvas:X.file,id:X.id,attr:q0,value:j0},`@${q0}`),n("attr",q0,r0,j0)},H0=(e)=>{if(!K)return;let A0=F[e]??null;s(e,null),R(e,null),f("/_api/edit-css",{canvas:X.file,id:X.id,property:e,reset:!0},e),n("css",e,A0,null)},a=(e)=>{if(!K)return;let A0=D[e]??null;s(e,null),w(e,null),f("/_api/edit-css",{canvas:X.file,id:X.id,property:e,reset:!0},e),n("css",e,A0,null)},D0=(e)=>{if(!K)return;let A0=_[e]??null;O(e,null),f("/_api/edit-attr",{canvas:X.file,id:X.id,attr:e,reset:!0},`@${e}`),n("attr",e,A0,null)},z0={display:X.parentDisplay,flexDirection:X.parentFlexDirection},l0=(e,A0)=>{if(!K)return;let q0=Math.round((e==="width"?X.bounds?.w:X.bounds?.h)||0),j0=a$(e,A0,z0,q0);for(let r0 of j0.reset)if(F[r0])H0(r0);for(let[r0,y8]of j0.set)c(r0,y8)},X8=X.parentDisplay==="flex"||X.parentDisplay==="inline-flex",d0=(e)=>{let A0=r$(e,F,U,z0);return M("div",{className:"st-cp-moderow",children:[z("span",{className:"st-cp-modelabel",children:e==="width"?"Width sizing":"Height sizing"}),z("div",{className:"st-cp-modeseg",role:"group","aria-label":`${e} sizing mode`,children:z(oB,{value:A0,ariaLabel:`${e} sizing`,options:[{value:"fixed",label:"fixed"},{value:"hug",label:"hug"},{value:"fill",label:"fill"}],onChange:(q0)=>l0(e,q0)})})]},`mode-${e}`)},$0=["flex-start","center","flex-end"],M0=["flex-start","center","flex-end"],i0=["t","c","b"],c8=["l","c","r"],z8=()=>{let e=!(F["flex-direction"]||G7(U["flex-direction"])||"row").startsWith("column"),A0=Math.max(0,$0.indexOf(F["justify-content"]||G7(U["justify-content"])||"flex-start")),q0=F["align-items"]||G7(U["align-items"])||"stretch",j0=q0==="stretch"?1:Math.max(0,M0.indexOf(q0)),[r0,y8]=e?[A0,j0]:[j0,A0];return i0[y8]+c8[r0]},Q9=(e)=>{let A0=i0.indexOf(e[0]),q0=c8.indexOf(e[1]),j0=!(F["flex-direction"]||G7(U["flex-direction"])||"row").startsWith("column"),[r0,y8]=j0?[q0,A0]:[A0,q0];c("justify-content",$0[r0]),c("align-items",M0[y8])},L8=(e)=>{if(!(e.metaKey||e.ctrlKey)||e.altKey)return;let A0=e.key.toLowerCase();if(A0==="z")e.preventDefault(),G?.(e.shiftKey?"redo":"undo");else if(A0==="y")e.preventDefault(),G?.("redo")},W8=(e)=>{let A0=F[e];if(!A0)return"inherit";return/var\(\s*--/.test(A0)?"bound":"raw"};if(!K)return M("div",{className:"st-cp",children:[z("div",{className:"st-cp-id",children:z("span",{className:"st-cp-idtag",children:X.tag||"element"})}),M("div",{className:"st-css-disabled",children:["This selection has no stable element id (a legacy canvas, or a non-element target). Edit it with ",z("code",{children:"/design:edit"}),"."]})]});let b8={bound:"token-bound",raw:"raw override",inherit:"inherited"},i8=(e)=>z("span",{className:`st-cp-prov st-cp-prov--${e}`,role:"img","aria-label":b8[e]}),p9=(e,A0)=>{let q0=A0??W8(e),j0=C[e],r0=typeof j0==="string"&&j0.startsWith("err:")?j0.slice(4):"",y8=r0?" is-err":j0==="saved"?" is-saved":j0==="saving"?" is-saving":"",S8=!!F[e],o8=r0?`error: ${r0}`:S8?`${b8[q0]} · double-click to reset`:b8[q0];return z("button",{type:"button",className:`st-cp-prov st-cp-prov--${q0}${y8}${S8?" is-resettable":""}`,"aria-label":o8,title:o8,tabIndex:S8?0:-1,onDoubleClick:S8?()=>H0(e):void 0,onKeyDown:S8?(e8)=>{if(e8.key==="Backspace"||e8.key==="Delete")e8.preventDefault(),H0(e)}:void 0})},O0=(e,A0,q0,j0)=>{let r0=q0===void 0&&!F[e],y8=j0??e;return M("div",{className:`st-cp-row${r0?" is-unset":""}`,children:[p9(e,q0),z("label",{className:"st-cp-label",title:y8,children:y8}),z("div",{className:"st-cp-ctl",children:A0})]},e)},j8={Layout:["display","flex-direction","flex-wrap","align-items","justify-content","gap"],Grid:["grid-template-columns","grid-template-rows"],"Grid item":["grid-column","grid-row"],Position:["position","top","right","bottom","left","z-index"],Typography:["font-family","color","font-size","font-weight","line-height","letter-spacing","text-align","font-style","text-transform","text-decoration","white-space"],Spacing:["margin-top","margin-right","margin-bottom","margin-left","padding-top","padding-right","padding-bottom","padding-left"],Size:["width","height","min-width","min-height","max-width","max-height","overflow","flex-grow","flex-shrink","flex-basis","align-self"],Media:["object-fit","aspect-ratio","object-position"],Appearance:["background-color","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius","border-width","border-style","border-color","box-shadow","filter","mix-blend-mode","opacity","transform","transform-origin"]},L9=(e)=>{(j8[e]||[]).forEach((A0)=>{if(F[A0])H0(A0)})},U8=(e,A0)=>{let q0=(j8[e]||[]).some((j0)=>F[j0]);return M("section",{className:"st-cp-sec",children:[M("div",{className:"st-cp-sechd-row",children:[M("button",{type:"button",className:"st-cp-sechd","aria-expanded":!!v[e],onClick:()=>h((j0)=>({...j0,[e]:!j0[e]})),children:[z("span",{className:"st-cp-caret","aria-hidden":"true",children:v[e]?"▾":"▸"}),e]}),z("button",{type:"button",className:`st-cp-secreset${q0?"":" is-quiet"}`,"aria-label":`reset ${e} section to original`,title:`reset ${e}`,disabled:!q0,onClick:()=>L9(e),children:z(Q7,{as:DZ,size:12})})]}),z("div",{className:`st-cp-sec-anim${v[e]?" is-open":""}`,children:z("div",{className:"st-cp-sec-inner",children:A0})})]},e)},D9=(e,A0,q0,j0=!0)=>{let r0=`d:${e}`,y8=v[r0]===void 0?j0:v[r0],S8=A0.some((o8)=>F[o8]);return M("section",{className:"st-cp-sec",children:[M("div",{className:"st-cp-sechd-row",children:[M("button",{type:"button",className:"st-cp-sechd","aria-expanded":y8,onClick:()=>h((o8)=>({...o8,[r0]:!y8})),children:[z("span",{className:"st-cp-caret","aria-hidden":"true",children:y8?"▾":"▸"}),e]}),z("button",{type:"button",className:`st-cp-secreset${S8?"":" is-quiet"}`,"aria-label":`reset ${e} to original`,title:`reset ${e}`,disabled:!S8,onClick:()=>A0.forEach((o8)=>{if(F[o8])H0(o8)}),children:z(Q7,{as:DZ,size:12})})]}),z("div",{className:`st-cp-sec-anim${y8?" is-open":""}`,children:z("div",{className:"st-cp-sec-inner",children:q0})})]},r0)},b0=(e)=>z("button",{type:"button",className:"st-cp-clustermore","aria-expanded":!!m[e],"aria-label":m[e]?`${e} — fewer options`:`${e} — more options`,title:m[e]?"fewer":"more",onClick:()=>l((A0)=>({...A0,[e]:!A0[e]})),children:m[e]?"▴":"···"}),Z0=(e,A0)=>M("select",{className:"st-cp-nsel","aria-label":e,value:A0.includes(F[e])?F[e]:"",onChange:(q0)=>c(e,q0.target.value),children:[z("option",{value:"",disabled:!0,children:G7(U[e])||"—"}),A0.map((q0)=>z("option",{value:q0,children:q0},q0))]}),y0=(e)=>$(e).flatMap((A0)=>(A0.names||[]).map((q0)=>({name:q0,value:A0.vals?.[q0]||""}))),c0=(e,A0)=>z(AA,{value:F[e]||G7(U[e])||A0[0].value,ariaLabel:e,options:A0,onChange:(q0)=>c(e,q0)}),q8=(e,A0,q0={})=>{let j0=jQ(F[e]??""),r0=ae.has(e),y8=F[e]??"",S8=typeof y8==="string"&&/var\(\s*--/.test(y8),o8=r0?"":j0.unit&&j0.unit!=="auto"?j0.unit:"px",e8=Number.parseFloat(jQ(G7(U[e])??"").n)||0,P9=j0.n!==""&&j0.n!=null?Number.parseFloat(j0.n)||0:e8,U7=mR[e];return z(nB,{value:S8?y8:P9,tokens:y0(A0),ariaLabel:e,min:q0.min??0,lead:U7?U7.node??U7.t:void 0,unitSlot:r0?null:z(iB,{units:re,value:j0.unit||"px",ariaLabel:`${e} unit`,onChange:(h9)=>c(e,h9==="auto"?"auto":`${j0.n||"0"}${h9}`)}),onChange:(h9)=>c(e,typeof h9==="string"?h9:r0?`${h9}`:`${h9}${o8}`)})},N8=()=>{let e=(r0)=>Number.parseFloat(jQ(F[r0]??F["border-radius"]??G7(U[r0])??G7(U["border-radius"])??"0").n)||0,A0={tl:e("border-top-left-radius"),tr:e("border-top-right-radius"),bl:e("border-bottom-left-radius"),br:e("border-bottom-right-radius")},q0=(r0)=>{if(r0.tl===r0.tr&&r0.tr===r0.bl&&r0.bl===r0.br)["border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius"].forEach((S8)=>{if(F[S8])H0(S8)}),c("border-radius",`${r0.tl}px`);else c("border-top-left-radius",`${r0.tl}px`),c("border-top-right-radius",`${r0.tr}px`),c("border-bottom-left-radius",`${r0.bl}px`),c("border-bottom-right-radius",`${r0.br}px`)},j0=mR["border-radius"];return z(Eh,{corners:A0,lead:j0?j0.node??j0.t:void 0,onCorners:q0})},H8=()=>M("div",{className:"st-cp-border",children:[w9("border-width",null,{fixedUnit:"px"}),M("select",{className:"st-cp-nsel st-cp-nsel--mini","aria-label":"border-style",value:ne.includes(F["border-style"])?F["border-style"]:"",onChange:(e)=>c("border-style",e.target.value),children:[z("option",{value:"",disabled:!0,children:"style"}),ne.map((e)=>z("option",{value:e,children:e},e))]}),z(BF,{kind:"color",groups:$("color"),current:F["border-color"],activeDs:I,swatchBg:U["border-color"]||F["border-color"]||"",seedHex:DF(U["border-color"]||F["border-color"])||"#000000",onPick:(e)=>c("border-color",e),label:"border colour"})]}),m0=()=>{let e=F.transform||G7(U.transform)||"",A0=/rotate\(\s*(-?\d+(?:\.\d+)?)deg\s*\)/.exec(e),q0=((A0?Number.parseFloat(A0[1]):0)%360+360)%360,j0=(r0)=>{let y8=(r0%360+360)%360,S8=(F.transform||"").replace(/\s*rotate\([^)]*\)\s*/g," ").trim();c("transform",`${S8?`${S8} `:""}rotate(${y8}deg)`.trim())};return M("div",{className:"st-cp-num",style:{border:0,background:"transparent",gap:"var(--space-2)"},children:[z(Ah,{value:q0,onChange:j0}),z(XX,{value:q0,min:0,max:360,ariaLabel:"rotation",lead:z(Q7,{as:DZ}),steppers:!1,unitSlot:z("span",{className:"st-cp-numsuffix","aria-hidden":"true",children:"°"}),onCommit:j0})]})},w0=()=>{let e=F.filter||G7(U.filter)||"",A0=/blur\(\s*(-?\d+(?:\.\d+)?)px\s*\)/.exec(e),q0=A0?Number.parseFloat(A0[1]):0;return z(XX,{value:q0,min:0,ariaLabel:"filter blur",unitSlot:z("span",{className:"st-cp-numsuffix","aria-hidden":"true",children:"px"}),onCommit:(r0)=>{let y8=(F.filter||"").replace(/\s*blur\([^)]*\)\s*/g," ").trim();c("filter",r0>0?`${y8?`${y8} `:""}blur(${r0}px)`.trim():y8||"none")}})},K8=()=>{let e=F.opacity,A0=e!=null&&e!==""?Number.parseFloat(e):Number.parseFloat(G7(U.opacity))||1,q0=Math.round((Number.isNaN(A0)?1:A0)*100);return z(CJ,{value:q0,min:0,max:100,step:1,unit:"%",ariaLabel:"opacity",onInput:(j0)=>s("opacity",String(j0/100)),onCommit:(j0)=>c("opacity",String(j0/100))},`opacity:${e??""}`)},I8=()=>{let e=Number.parseInt(F["font-weight"]||G7(U["font-weight"])||"400",10)>=600,A0=(F["font-style"]||G7(U["font-style"]))==="italic",q0=/underline/.test(F["text-decoration"]||G7(U["text-decoration"])||"");return z(Oh,{value:{b:e,i:A0,u:q0},ariaLabel:"text style",options:[{value:"b",node:z(Q7,{as:WV}),label:"Bold"},{value:"i",node:z(Q7,{as:KV}),label:"Italic"},{value:"u",node:z(Q7,{as:_V}),label:"Underline"}],onToggle:(j0)=>{if(j0==="b")c("font-weight",e?"400":"700");else if(j0==="i")c("font-style",A0?"normal":"italic");else c("text-decoration",q0?"none":"underline")}})},k8=[{value:"row",node:z(Q7,{as:UW}),label:"Row"},{value:"column",node:z(Q7,{as:VW}),label:"Column"}],_9=[{value:"flex-start",node:z(Q7,{as:eU}),label:"Start"},{value:"center",node:z(Q7,{as:sU}),label:"Center"},{value:"flex-end",node:z(Q7,{as:tU}),label:"End"},{value:"space-between",node:z(Q7,{as:iz}),label:"Space between"}],A8=[{value:"flex-start",node:z(Q7,{as:QV}),label:"Start"},{value:"center",node:z(Q7,{as:XV}),label:"Center"},{value:"flex-end",node:z(Q7,{as:JV}),label:"End"},{value:"stretch",node:z(Q7,{as:MV}),label:"Stretch"}],T9=[{value:"left",node:z(Q7,{as:f5}),label:"Left"},{value:"center",node:z(Q7,{as:NW}),label:"Center"},{value:"right",node:z(Q7,{as:FW}),label:"Right"},{value:"justify",node:z(Q7,{as:LW}),label:"Justify"}],Y9=[{value:"visible",node:z(Q7,{as:LZ}),label:"Visible"},{value:"hidden",node:z(Q7,{as:MZ}),label:"Hidden"},{value:"scroll",node:z(Q7,{as:FV}),label:"Scroll"}],b7=(e,A0)=>{let q0=$(A0);return q0.length?z(BF,{kind:"value",groups:q0,current:F[e],activeDs:I,onPick:(j0)=>c(e,j0),label:`${e} design token`}):null},E0=(e)=>{let A0=e.currentTarget;requestAnimationFrame(()=>{if(document.activeElement===A0)A0.select()})},f8=(e,A0)=>{if(e.key!=="ArrowUp"&&e.key!=="ArrowDown")return!1;e.preventDefault();let q0=e.shiftKey?10:1,j0=e.key==="ArrowUp"?1:-1,r0=(Number.parseFloat(e.currentTarget.value)||0)+j0*q0;return e.currentTarget.value=String(r0),A0(r0),!0},v9=(e)=>z("input",{className:"st-cp-fin","aria-label":e,defaultValue:F[e]??"",placeholder:G7(U[e])||"—",onFocus:E0,onKeyDown:(A0)=>{if(A0.key==="Enter")A0.currentTarget.blur()},onBlur:(A0)=>c(e,A0.currentTarget.value)},`${e}:${F[e]??""}`),w9=(e,A0,q0={})=>{let j0=jQ(F[e]??""),r0=ae.has(e),y8=r0?"":q0.fixedUnit||(j0.unit&&j0.unit!=="auto"?j0.unit:"px"),S8=mR[e],o8=Number.parseFloat(jQ(G7(U[e])??"").n)||0,e8=j0.n!==""&&j0.n!=null?Number.parseFloat(j0.n)||0:o8;return M(G0,{children:[z(XX,{value:e8,min:q0.min??0,step:1,ariaLabel:e,lead:S8?S8.node??S8.t:void 0,onCommit:(P9)=>c(e,r0?`${P9}`:`${P9}${y8}`),unitSlot:r0||q0.fixedUnit?null:z(iB,{units:re,value:j0.unit||"px",ariaLabel:`${e} unit`,onChange:(P9)=>c(e,P9==="auto"?"auto":`${j0.n||"0"}${P9}`)})},`${e}:${F[e]??""}`),b7(e,A0)]})},G6=(e)=>{let A0=U[e]||F[e]||"",q0=F[e]??"",j0=typeof q0==="string"&&/var\(\s*--/.test(q0),r0=j0?q0.replace(/^var\(\s*|\s*\)$/g,"").replace(/^--/,"").replace(/-/g," "):q0;return z(wV,{swatch:z(BF,{kind:"color",swatchClassName:"st-cp-cf-sw",groups:$("color"),current:F[e],activeDs:I,swatchBg:A0,seedHex:DF(U[e]||F[e])||"#000000",onPick:(y8)=>c(e,y8),label:`${e} colour`}),displayValue:r0,bound:j0,ariaLabel:e,onValue:(y8)=>c(e,y8)})},_6=(e,A0)=>{let q0=null,j0=A0.unitless?"":"px",r0=(o8)=>A0.unitless?`${o8}`:`${o8}${j0}`,y8=(o8,e8,P9)=>{for(let U7 of e8??[e])P9(U7,r0(o8))},S8=_A({getBase:()=>q0?.value??"0",min:A0.min??0,step:1,sides:A0.sides,onInput:(o8,e8)=>{if(q0)q0.value=String(o8);if(e8){let P9=q0?.closest(".st-cp-box");for(let U7 of e8){if(U7===e)continue;let h9=P9?.querySelector(`.st-cp-boxv[aria-label="${U7}"]`);if(h9)h9.value=String(o8)}}y8(o8,e8,s)},onCommit:(o8,e8)=>y8(o8,e8,c)});return{onPointerDown:(o8)=>{q0=o8.currentTarget,S8(o8)}}},g8=(e,A0)=>{let q0=F[e],j0=q0!=null&&q0!==""?jQ(q0).n||q0:jQ(G7(U[e])??"").n||"0",r0=!q0||q0==="0"||q0==="0px"||q0==="auto",y8=e.split("-").pop(),S8=y8==="top"||y8==="bottom"?[`${A0}-top`,`${A0}-bottom`]:[`${A0}-left`,`${A0}-right`],o8=[`${A0}-top`,`${A0}-right`,`${A0}-bottom`,`${A0}-left`];return z("input",{className:`st-cp-boxv st-cp-scrub st-cp-boxv--${A0[0]}${e.split("-").pop()[0]}${r0?" is-zero":""}`,"aria-label":e,defaultValue:j0,title:"drag to scrub · alt = symmetric · alt+shift = all sides",..._6(e,{sides:{pair:S8,all:o8}}),onFocus:E0,onKeyDown:(e8)=>{if(f8(e8,(P9)=>c(e,`${P9}px`)))return;if(e8.key==="Enter")e8.currentTarget.blur()},onBlur:(e8)=>{let P9=e8.currentTarget.value.trim();if(!P9)return;let U7=/[a-z%]/i.test(P9)?P9:`${P9}px`;c(e,U7)}},`${e}:${q0??""}`)},a9=(e)=>{let A0=F[e],q0=A0!=null&&A0!==""&&A0!=="auto"?jQ(A0).n||A0:jQ(G7(U[e])??"").n||"",j0=!A0||A0==="auto"||A0==="0"||A0==="0px",r0=e==="top"||e==="bottom"?["top","bottom"]:["left","right"],y8=["top","right","bottom","left"];return z("input",{className:`st-cp-boxv st-cp-scrub st-cp-boxv--i${e[0]}${j0?" is-zero":""}`,"aria-label":e,defaultValue:q0,placeholder:"auto",title:"drag to scrub · alt = axis pair · alt+shift = all sides · type auto",..._6(e,{sides:{pair:r0,all:y8},min:-1/0}),onFocus:E0,onKeyDown:(S8)=>{if(f8(S8,(o8)=>c(e,`${o8}px`)))return;if(S8.key==="Enter")S8.currentTarget.blur()},onBlur:(S8)=>{let o8=S8.currentTarget.value.trim();if(!o8)return;let e8=/[a-z%]/i.test(o8)?o8:`${o8}px`;c(e,e8)}},`${e}:${A0??""}`)},m7=Object.entries(D),P7=Object.entries(_),E9=()=>{let e=(X.tag||"").toLowerCase(),q0=e==="img"||e==="video"||e==="picture"||e==="svg"||e==="canvas"||!!F["object-fit"]||!!F["object-position"]||!!F["aspect-ratio"],j0=(e==="img"||e==="video")&&!!X.attrs?.src&&!!W;return{showMedia:q0,canReplace:j0}},l6=(e)=>M(G0,{children:[e&&z("div",{className:"st-cp-mediabtn",children:z("button",{type:"button",className:"st-btn st-cp-replace",onClick:()=>W(X),children:"Replace…"})}),O0("object-fit",Z0("object-fit",P20)),O0("object-position",v9("object-position")),O0("aspect-ratio",M("select",{className:"st-cp-nsel","aria-label":"aspect-ratio",value:J00.includes(F["aspect-ratio"])?F["aspect-ratio"]:"",onChange:(A0)=>{let q0=A0.target.value;if(c("aspect-ratio",q0),q0&&q0!=="auto"&&F.height)H0("height")},children:[z("option",{value:"",disabled:!0,children:G7(U["aspect-ratio"])||"—"}),J00.map((A0)=>z("option",{value:A0,children:A0},A0))]}))]});return M("div",{className:`st-cp${Z==="designer"?" st-cp--designer":""}`,"data-tour":"css-panel",onKeyDown:L8,children:[M("div",{className:"st-cp-id",children:[M("span",{className:"st-cp-idtag",children:[X.tag||"element",X.classes?M("span",{className:"st-cp-idcls",children:[".",X.classes.split(/\s+/)[0]]}):null]}),z("span",{className:"st-cp-idmode","data-tour":"cp-mode",children:z(AA,{value:Z,ariaLabel:"panel vocabulary mode",options:[{value:"advanced",node:z(Q7,{as:KW,size:12}),label:"Advanced — raw CSS"},{value:"designer",node:z(Q7,{as:DW,size:12}),label:"Designer — Figma vocabulary"}],onChange:x})})]}),Z==="designer"?M(G0,{children:[D9("Auto layout",["display","flex-direction","flex-wrap","align-items","justify-content","gap","padding-top","padding-right","padding-bottom","padding-left"],(()=>{let e=(F.display||G7(U.display)||"").trim();return e==="flex"||e==="inline-flex"?M(G0,{children:[O0("flex-direction",c0("flex-direction",k8),void 0,"Direction"),O0("align-items",z(_h,{value:z8(),onChange:Q9,ariaLabel:"auto-layout alignment"}),W8("align-items"),"Alignment"),O0("gap",q8("gap","space"),void 0,"Gap"),M("div",{className:"st-cp-modes",children:[d0("width"),d0("height")]}),M("div",{className:"st-cp-box","aria-label":"padding",children:[M("span",{className:"st-cp-boxtag st-cp-boxtag--p",children:[i8(W8("padding-top")),"padding"]}),g8("padding-top","padding"),g8("padding-right","padding"),g8("padding-bottom","padding"),g8("padding-left","padding")]}),z("div",{className:"st-cp-clustermore-row",children:b0("Auto layout")}),m["Auto layout"]?O0("flex-wrap",z(kQ,{checked:/^wrap/.test(F["flex-wrap"]||G7(U["flex-wrap"])||""),label:"wrap items",ariaLabel:"flex-wrap",onChange:(q0)=>c("flex-wrap",q0?"wrap":"nowrap")}),W8("flex-wrap"),"Wrap"):null]}):z("button",{type:"button",className:"st-cp-makeflex",disabled:!K,onClick:()=>c("display","flex"),children:"+ Auto layout (flex)"})})()),D9("Size",["width","height","min-width","max-width","min-height","max-height"],M(G0,{children:[O0("width",w9("width"),void 0,"Width"),O0("height",w9("height"),void 0,"Height"),z("div",{className:"st-cp-clustermore-row",children:b0("Size")}),m.Size?M(G0,{children:[O0("min-width",w9("min-width"),void 0,"Min width"),O0("max-width",w9("max-width"),void 0,"Max width"),O0("min-height",w9("min-height"),void 0,"Min height"),O0("max-height",w9("max-height"),void 0,"Max height")]}):null]})),D9("Position",["position","top","right","bottom","left","z-index"],M(G0,{children:[O0("position",Z0("position",se),void 0,"Position"),M("div",{className:"st-cp-box st-cp-box--inset","aria-label":"position inset (top / right / bottom / left)",children:[M("span",{className:"st-cp-boxtag st-cp-boxtag--i",children:[i8(W8("top")),"inset"]}),a9("top"),a9("right"),a9("bottom"),a9("left"),z("div",{className:"st-cp-boxcore st-cp-boxcore--pos",children:F.position||G7(U.position)||"static"})]}),(F.position||G7(U.position)||"static")==="static"?z("div",{className:"st-cp-note",children:"top / right / bottom / left apply once position is relative, absolute, fixed, or sticky"}):null,z("div",{className:"st-cp-clustermore-row",children:b0("Position")}),m.Position?O0("z-index",w9("z-index"),void 0,"Layer order"):null]}),!1),D9("Fill",["background-color"],O0("background-color",G6("background-color"),void 0,"Fill")),D9("Stroke",["border-width","border-style","border-color"],O0("border",H8(),W8("border-width"),"Stroke")),D9("Corner radius",["border-radius","border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius"],O0("border-radius",N8(),W8("border-radius"),"Corner radius")),D9("Effects",["box-shadow","filter","mix-blend-mode"],M(G0,{children:[O0("box-shadow",b7("box-shadow","shadow")||v9("box-shadow"),void 0,"Shadow"),O0("filter",w0(),W8("filter"),"Blur"),O0("mix-blend-mode",Z0("mix-blend-mode",X00),void 0,"Blend")]})),D9("Opacity",["opacity"],O0("opacity",K8(),void 0,"Opacity")),D9("Text",["font-family","color","font-size","font-weight","line-height","text-align","letter-spacing","font-style","text-transform","white-space"],M(G0,{children:[O0("font-family",Z0("font-family",oe),void 0,"Font"),O0("color",G6("color"),void 0,"Color"),O0("font-size",q8("font-size","type"),void 0,"Size"),O0("font-weight",Z0("font-weight",ie),void 0,"Weight"),O0("line-height",w9("line-height","lh"),void 0,"Line height"),O0("text-align",c0("text-align",T9),void 0,"Align"),z("div",{className:"st-cp-clustermore-row",children:b0("Text")}),m.Text?M(G0,{children:[O0("letter-spacing",w9("letter-spacing",null,{min:-1/0}),void 0,"Letter spacing"),O0("font-style",Z0("font-style",E20),void 0,"Style"),O0("text-transform",Z0("text-transform",te),void 0,"Case"),O0("white-space",Z0("white-space",ee),void 0,"Whitespace")]}):null]})),D9("Spacing",["margin-top","margin-right","margin-bottom","margin-left"],M("div",{className:"st-cp-box","aria-label":"margin",children:[M("span",{className:"st-cp-boxtag st-cp-boxtag--m",children:[i8(W8("margin-top")),"margin"]}),g8("margin-top","margin"),g8("margin-right","margin"),g8("margin-bottom","margin"),g8("margin-left","margin")]})),(()=>{let{showMedia:e,canReplace:A0}=E9();return e?D9("Media",["object-fit","object-position","aspect-ratio"],l6(A0)):null})()]}):M(G0,{children:[U8("Layout",(()=>{let e=(F.display||G7(U.display)||"").trim(),A0=e==="flex"||e==="inline-flex",q0=e==="grid"||e==="inline-grid";return M(G0,{children:[O0("display",Z0("display",A20)),A0?M(G0,{children:[O0("flex-direction",c0("flex-direction",k8)),O0("flex-wrap",z(kQ,{checked:/^wrap/.test(F["flex-wrap"]||G7(U["flex-wrap"])||""),label:"wrap items",ariaLabel:"flex-wrap",onChange:(j0)=>c("flex-wrap",j0?"wrap":"nowrap")}),W8("flex-wrap"))]}):null,A0||q0?M(G0,{children:[O0("align-items",c0("align-items",A8)),O0("justify-content",c0("justify-content",_9)),O0("gap",q8("gap","space"))]}):z("button",{type:"button",className:"st-cp-makeflex",disabled:!K,onClick:()=>c("display","flex"),children:"+ Auto layout (flex)"})]})})()),(()=>{let e=(F.display||G7(U.display)||"").trim();if(!(e==="grid"||e==="inline-grid"))return null;let q0=F["grid-template-columns"]||"",j0=F["grid-template-rows"]||"",r0=wM(q0),y8=wM(j0),S8=r0.length>0||!q0.trim(),o8=y8.length>0||!j0.trim();return U8("Grid",M(G0,{children:[S8?z(Y00,{label:"Columns",tracks:r0,editable:K,onChange:(e8)=>c("grid-template-columns",EM(e8))}):M("div",{className:"st-cp-note",children:["Columns use ",z("code",{children:q0})," — not editable as tracks here (repeat()/ minmax()/subgrid); use /design:edit for these."]}),o8?z(Y00,{label:"Rows",tracks:y8,editable:K,onChange:(e8)=>c("grid-template-rows",EM(e8))}):M("div",{className:"st-cp-note",children:["Rows use ",z("code",{children:j0})," — not editable as tracks here (repeat()/minmax()/ subgrid); use /design:edit for these."]})]}))})(),U8("Position",M(G0,{children:[O0("position",Z0("position",se)),M("div",{className:"st-cp-box st-cp-box--inset","aria-label":"position inset (top / right / bottom / left)",children:[M("span",{className:"st-cp-boxtag st-cp-boxtag--i",children:[i8(W8("top")),"inset"]}),a9("top"),a9("right"),a9("bottom"),a9("left"),z("div",{className:"st-cp-boxcore st-cp-boxcore--pos",children:F.position||G7(U.position)||"static"})]}),(F.position||G7(U.position)||"static")==="static"?z("div",{className:"st-cp-note",children:"top / right / bottom / left apply once position is relative, absolute, fixed, or sticky"}):null,O0("z-index",w9("z-index"))]})),(X.parentDisplay==="grid"||X.parentDisplay==="inline-grid")&&U8("Grid item",M(G0,{children:[M("div",{className:"st-cp-note",children:["Manual cell placement — ",z("code",{children:"start / end"})," or ",z("code",{children:"start / span N"}),"."]}),O0("grid-column",v9("grid-column")),O0("grid-row",v9("grid-row"))]})),U8("Typography",M(G0,{children:[O0("font-family",Z0("font-family",oe)),O0("color",G6("color")),O0("font-size",q8("font-size","type")),O0("font-weight",Z0("font-weight",ie)),O0("line-height",w9("line-height","lh")),O0("letter-spacing",w9("letter-spacing",null,{min:-1/0})),O0("text-align",c0("text-align",T9)),O0("font-style",I8(),W8("font-style")),O0("text-transform",Z0("text-transform",te)),O0("white-space",Z0("white-space",ee))]})),U8("Spacing",z(G0,{children:M("div",{className:"st-cp-box","aria-label":"margin and padding",children:[M("span",{className:"st-cp-boxtag st-cp-boxtag--m",children:[i8(W8("margin-top")),"margin"]}),g8("margin-top","margin"),g8("margin-right","margin"),g8("margin-bottom","margin"),g8("margin-left","margin"),M("div",{className:"st-cp-boxpad",children:[M("span",{className:"st-cp-boxtag st-cp-boxtag--p",children:[i8(W8("padding-top")),"padding"]}),g8("padding-top","padding"),g8("padding-right","padding"),g8("padding-bottom","padding"),g8("padding-left","padding"),M("div",{className:"st-cp-boxcore",children:[Math.round(Number.parseFloat(F.width)||X.bounds?.w||0)," × ",Math.round(Number.parseFloat(F.height)||X.bounds?.h||0)]})]})]})})),U8("Size",M(G0,{children:[M("div",{className:"st-cp-modes",children:[d0("width"),d0("height")]}),O0("width",w9("width")),O0("height",w9("height")),O0("min-width",w9("min-width")),O0("max-width",w9("max-width")),O0("min-height",w9("min-height")),O0("max-height",w9("max-height")),O0("overflow",c0("overflow",Y9)),X8?M(G0,{children:[z("div",{className:"st-cp-subhd",children:"In flex parent"}),O0("align-self",Z0("align-self",w20)),O0("flex-grow",w9("flex-grow",null,{unitless:!0})),O0("flex-shrink",w9("flex-shrink",null,{unitless:!0})),O0("flex-basis",w9("flex-basis"))]}):null]})),(()=>{let{showMedia:e,canReplace:A0}=E9();return e?U8("Media",l6(A0)):null})(),U8("Appearance",M(G0,{children:[O0("background-color",G6("background-color")),O0("border-radius",N8(),W8("border-radius")),O0("border",H8(),W8("border-width")),O0("box-shadow",b7("box-shadow","shadow")||v9("box-shadow")),O0("filter",w0(),W8("filter")),O0("mix-blend-mode",Z0("mix-blend-mode",X00)),O0("opacity",K8()),O0("rotation",m0(),W8("transform")),O0("transform",v9("transform")),O0("transform-origin",v9("transform-origin"))]})),(()=>{let e=Object.entries(C).find(([,A0])=>typeof A0==="string"&&A0.startsWith("err:"));return e?M("div",{className:"st-cp-save is-err",role:"status",children:[z(A9,{name:"x",size:12}),e[0],": ",e[1].slice(4)]}):null})(),U8("Advanced",M("div",{className:"st-cp-advbody",children:[m7.length?M(G0,{children:[z("div",{className:"st-cp-advgrp",children:"Custom CSS properties"}),m7.map(([e,A0])=>M("div",{className:"st-cp-kv",children:[z("input",{className:"st-cp-fin st-cp-fin--ro",readOnly:!0,value:e,"aria-label":`custom property ${e} name`}),z("input",{className:"st-cp-fin",defaultValue:A0,"aria-label":`${e} value`,onKeyDown:(q0)=>{if(q0.key==="Enter")q0.currentTarget.blur()},onBlur:(q0)=>U0(e,q0.currentTarget.value)},`cs:${e}:${A0}`),z("button",{type:"button",className:"st-cp-kvx","aria-label":`remove ${e}`,title:"remove",onClick:()=>a(e),children:z(A9,{name:"x",size:11})})]},`cs:${e}`))]}):null,z("div",{className:"st-cp-advgrp",children:"Add CSS property"}),z(I20,{commit:U0}),z("div",{className:"st-cp-note",children:"applied as-is — not token-bound"}),P7.length?M(G0,{children:[z("div",{className:"st-cp-advgrp",children:"Custom HTML attributes"}),P7.map(([e,A0])=>M("div",{className:"st-cp-kv",children:[z("input",{className:"st-cp-fin st-cp-fin--ro",readOnly:!0,value:e,"aria-label":`attribute ${e} name`}),z("input",{className:"st-cp-fin",defaultValue:A0,"aria-label":`${e} value`,onKeyDown:(q0)=>{if(q0.key==="Enter")q0.currentTarget.blur()},onBlur:(q0)=>X0(e,q0.currentTarget.value)},`at:${e}:${A0}`),z("button",{type:"button",className:"st-cp-kvx","aria-label":`remove ${e}`,title:"remove",onClick:()=>D0(e),children:z(A9,{name:"x",size:11})})]},`at:${e}`))]}):null,z("div",{className:"st-cp-advgrp",children:"Add HTML attribute"}),z(k20,{commit:X0})]}))]}),M("div",{className:"st-cp-legend",children:[M("span",{children:[z("i",{className:"st-cp-prov st-cp-prov--bound","aria-hidden":"true"}),"token"]}),M("span",{children:[z("i",{className:"st-cp-prov st-cp-prov--raw","aria-hidden":"true"}),"override"]}),M("span",{children:[z("i",{className:"st-cp-prov st-cp-prov--inherit","aria-hidden":"true"}),"inherited"]})]})]},X.id)}function I20({commit:X}){let[J,Q]=u.useState(""),[Y,W]=u.useState(""),G=()=>{if(J.trim()&&Y.trim())X(J.trim(),Y),Q(""),W("")};return M("div",{className:"st-cp-kv",children:[z("input",{className:"st-cp-fin","aria-label":"custom property name",placeholder:"property",value:J,onChange:(Z)=>Q(Z.target.value)}),z("input",{className:"st-cp-fin","aria-label":"custom property value",placeholder:"value",value:Y,onChange:(Z)=>W(Z.target.value),onKeyDown:(Z)=>{if(Z.key==="Enter")G()},onBlur:G})]})}function k20({commit:X}){let[J,Q]=u.useState(""),[Y,W]=u.useState(""),G=()=>{if(J.trim()&&Y.trim())X(J.trim(),Y),Q(""),W("")};return M("div",{className:"st-cp-kv",children:[z("input",{className:"st-cp-fin","aria-label":"custom attribute name",placeholder:"data-…",value:J,onChange:(Z)=>Q(Z.target.value)}),z("input",{className:"st-cp-fin","aria-label":"custom attribute value",placeholder:"value",value:Y,onChange:(Z)=>W(Z.target.value),onKeyDown:(Z)=>{if(Z.key==="Enter")G()},onBlur:G})]})}var C20={button:"button",heading:"type",text:"type",input:"input",form:"input",image:"image",link:"link",list:"list",nav:"layers",box:"box",group:"folder"};function $20(X,J,Q,Y){if(!Array.isArray(X)||J===Q)return X;let W=JSON.parse(JSON.stringify(X)),G=null,Z=(K)=>{for(let U=0;U<K.length;U++){if(K[U].id===J)return G=K[U],K.splice(U,1),!0;if(K[U].children&&Z(K[U].children))return!0}return!1};if(Z(W),!G)return X;let H=(K)=>{for(let U=0;U<K.length;U++){if(K[U].id===Q){if(Y==="inside-start"||Y==="inside-end")if(K[U].children=K[U].children||[],Y==="inside-start")K[U].children.unshift(G);else K[U].children.push(G);else K.splice(Y==="before"?U:U+1,0,G);return!0}if(K[U].children&&H(K[U].children))return!0}return!1};return H(W)?W:X}var S20=new Set(["img","input","br","hr","area","base","col","embed","link","meta","param","source","track","wbr"]);function N00({node:X,depth:J,selectedId:Q,selectedIndex:Y,collapsed:W,hiddenOverride:G,onToggle:Z,onSelect:H,onHover:K,onToggleVisibility:U,onReorder:q,onRowPointerDown:B,dragState:N,componentMap:F,lockedKeys:D,onToggleLock:_,onRename:R}){let w=`${X.id}:${X.index}`,O=X.children&&X.children.length>0,P=W.has(w),I=!!X.synthetic,k=!I&&F?F[X.id]:null,$=!I&&!!D?.has(w),[C,b]=u.useState(!1),[v,h]=u.useState(""),d=!I&&X.id===Q&&(Y==null||X.index===Y),o=G?.has(w)?G.get(w):!!X.hidden,x=!!q&&!I&&!$,m=()=>{b(!1);let s=v.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"");if(!s||s===(X.dcElement??""))return;R?.(X,s)},l=N?.key===w,f=l?{transform:`translate(${N.dx}px, ${N.dy}px)`,opacity:0.9,zIndex:20,position:"relative",pointerEvents:"none",cursor:"grabbing",boxShadow:"0 6px 18px rgba(0, 0, 0, 0.28)"}:null;return M(G0,{children:[M("div",{className:"st-layer st-layer--row"+(d?" is-sel":"")+(o?" is-hidden":"")+(I?" is-group":"")+(k?" is-instance":"")+($?" is-locked":""),style:{paddingLeft:6+J*14,...f},role:"treeitem","aria-selected":I?void 0:d,"aria-expanded":O?!P:void 0,"aria-grabbed":x?l:void 0,tabIndex:0,title:I?`${X.tag} · group (unstamped wrapper)`:`${X.tag} · ${X.type}${R?" · F2 to rename":""}`,"data-layer-key":w,onClick:()=>I?O&&Z(w):H(X),onMouseEnter:()=>!I&&K(X),onMouseLeave:()=>K(null),onPointerDown:x?(s)=>B(s,X,w):void 0,onKeyDown:(s)=>{if(s.key==="Enter"||s.key===" ")if(s.preventDefault(),I)O&&Z(w);else H(X);else if(s.key==="F2"&&R&&!I)s.preventDefault(),h(X.dcElement||X.label||""),b(!0)},children:[O?z("button",{type:"button",className:"st-layer-caret","aria-label":P?"Expand":"Collapse",onClick:(s)=>{s.stopPropagation(),Z(w)},children:P?"▸":"▾"}):z("span",{className:"st-layer-caret","aria-hidden":"true"}),k?z("span",{className:"st-layer-inst-glyph","aria-hidden":"true",children:k.root?"◆":"◇"}):z(A9,{name:C20[X.type]||"box",size:12,className:"st-layer-ticon"}),C?z("input",{className:"st-layer-rename",value:v,autoFocus:!0,"aria-label":`Rename ${X.label}`,onFocus:(s)=>s.target.select(),onChange:(s)=>h(s.target.value),onClick:(s)=>s.stopPropagation(),onPointerDown:(s)=>s.stopPropagation(),onBlur:m,onKeyDown:(s)=>{if(s.stopPropagation(),s.key==="Enter")m();else if(s.key==="Escape")b(!1)}}):z("span",{className:"st-layer-label",onDoubleClick:R&&!I?(s)=>{s.stopPropagation(),h(X.dcElement||X.label||""),b(!0)}:void 0,children:X.label}),z("span",{className:"st-layer-type",children:k?k.component:X.type}),_&&!I?z("button",{type:"button",className:"st-layer-lock","aria-label":$?`Unlock ${X.label}`:`Lock ${X.label}`,"aria-pressed":$,title:$?"Unlock":"Lock",onClick:(s)=>{s.stopPropagation(),_(w)},children:z(A9,{name:$?"lock":"unlock",size:12})}):null,U&&!I?z("button",{type:"button",className:"st-layer-eye","aria-label":o?`Show ${X.label}`:`Hide ${X.label}`,"aria-pressed":o,title:o?"Show":"Hide",onClick:(s)=>{s.stopPropagation(),U(X)},children:z(A9,{name:o?"eye-off":"eye",size:13})}):null]}),O&&!P?X.children.map((s,n)=>z(N00,{node:s,depth:J+1,selectedId:Q,selectedIndex:Y,collapsed:W,hiddenOverride:G,onToggle:Z,onSelect:H,onHover:K,onToggleVisibility:U,onReorder:q,onRowPointerDown:B,dragState:N,componentMap:F,lockedKeys:D,onToggleLock:_,onRename:R},`${s.id}:${s.index}`)):null]})}function b20({el:X}){let J=X?.computed||{},Q=X?.authored||{},Y=(U)=>{let q=Q[U];if(q&&/var\(\s*--/.test(q))return q.replace(/^var\(\s*|\s*\)$/g,"");return J[U]||q||""},W=(U,q)=>{let B=J[q]||Q[q];if(!B)return null;return M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:U}),M("div",{className:"st-swatch-row",children:[z("span",{className:"st-insp-swatch",style:{background:B},"aria-hidden":"true"}),z("span",{className:"st-mono",style:{fontSize:11,color:"var(--fg-1)"},children:Y(q)})]})]},U)},G=J["border-radius"]&&J["border-radius"]!=="0px",Z=G?jQ(J["border-radius"]).n||J["border-radius"]:null,H=J["font-size"]||J["font-weight"]?[J["font-size"],J["font-weight"]].filter(Boolean).join(" / "):null;if(!(J["background-color"]||J.color||G||H))return null;return M(G0,{children:[G?M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:"Radius"}),M("div",{className:"st-insp-fields",children:[M("span",{className:"st-fmini",style:{flex:"0 0 auto",maxWidth:84},children:[z("span",{className:"st-mtag",children:"r"}),z("input",{value:Z,readOnly:!0,"aria-label":"border radius"})]}),z("span",{className:"st-insp-unit",children:"px"})]})]}):null,W("Fill","background-color"),W("Text","color"),H?M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:"Font"}),z("div",{className:"st-insp-fields",children:z("span",{className:"st-mono",style:{fontSize:11,color:"var(--fg-0)"},children:H})})]}):null]})}function F00(X){if(X.artboardId)return X.artboardId;let J=/^\[data-dc-screen="([^"]+)"\]$/.exec(X.selector||"");return J?J[1]:null}var y20=[["","Block (default)"],["flex-col","Flex ↓ (column)"],["flex-row","Flex → (row)"],["grid","Grid"]],j20=[["digital","Digital"],["print","Print"],["web","Web"],["video","Video"]];function f20({el:X,cfg:J,onResizeArtboard:Q,onSetArtboardHug:Y,onSetArtboardStyle:W,onSetArtboardKind:G,onSetArtboardPrint:Z,onDuplicateArtboard:H}){let K=F00(X),U=(J?.designRel||J?.designRoot||".design").replace(/^\/+|\/+$/g,""),q=V00(X.file,J),B=q00(J,U,q),N=(f)=>B.map((s)=>({ds:s.name,names:s[f]||[],vals:s.vals})).filter((s)=>s.names.length),F=(f)=>N(f).flatMap((s)=>(s.names||[]).map((n)=>({name:n,value:s.vals?.[n]||""}))),D=(f)=>{let s=/^var\(\s*(--[\w-]+)\s*\)$/.exec(f||"");if(!s)return f||"";for(let n of B){let c=n.vals?.[s[1]];if(c)return c}return""},_=Number.isFinite(X.worldW)?X.worldW:Number.isFinite(X.bounds?.w)?X.bounds.w:null,R=Number.isFinite(X.worldH)?X.worldH:Number.isFinite(X.bounds?.h)?X.bounds.h:null,w=(f,s)=>{if(!K)return;let n=Number.isFinite(f)&&f>0?Math.round(f):void 0,c=Number.isFinite(s)&&s>0?Math.round(s):void 0;if(n==null&&c==null)return;Q?.(K,n,c)},O=Object.entries(D5).find(([,f])=>f.width===_&&f.height===R)?.[0],P=Object.entries(D5).find(([,f])=>f.width===_)?.[0],I=X.attrs?.["data-dc-fixed"]==="true",k=X.attrs?.["data-dc-bg"]??"",$=X.attrs?.["data-dc-padding"]??"",C=X.attrs?.["data-dc-layout"]??"",b=X.attrs?.["data-dc-gap"]??"",v=X.attrs?.["data-dc-kind"]||"digital",h=null;try{h=X.attrs?.["data-dc-print"]?JSON.parse(X.attrs["data-dc-print"]):null}catch{}let d=(f)=>{if(!K)return;let s=null;if(f==="print"&&!h){let n={paper:"a4"};try{let c=K2(n);if(c)s={defaults:n,widthPx:c.widthPx,heightPx:c.heightPx}}catch{}}if(G?.(K,f==="digital"?null:f,s),f==="web"&&I)Y?.(K,!1,void 0)},o=(f)=>{if(!K)return;let s={paper:"a4",...h,...f},n;try{n=K2(s)}catch{return}Q?.(K,n.widthPx,n.heightPx),Z?.(K,s)},x=(f,s)=>{if(!K)return;let n=Number.isFinite(s)?s:R,c=f&&Number.isFinite(n)?Math.round(n):void 0;Y?.(K,f,c)},m=(f)=>{let s=i$(I,f);if(s.kind==="resize")w(null,s.height);else if(s.kind==="promote-to-fixed")x(!0,s.height)},l=(f)=>{if(!K)return;W?.(K,f)};return M("section",{className:"st-cp-sec",children:[z("div",{className:"st-cp-sechd-row",children:z("span",{className:"st-cp-sechd",children:"Artboard"})}),M("div",{style:{display:"flex",gap:8,padding:"4px 12px"},children:[z(XX,{value:_??0,min:1,ariaLabel:"artboard width",lead:"W",steppers:!1,onCommit:(f)=>w(f,null)}),z(XX,{value:R??0,min:1,ariaLabel:"artboard height",lead:"H",steppers:!1,scrub:I,onCommit:m})]}),z("div",{style:{padding:"0 12px 8px"},children:v==="print"?M("select",{className:"st-cp-nsel","aria-label":"artboard paper preset",value:h?.paper??"",onChange:(f)=>o({paper:f.currentTarget.value}),children:[z("option",{value:"",disabled:!0,children:"Paper size…"}),z2.map((f)=>M("option",{value:f.id,children:[f.label," — ",f.width,"×",f.height,f.unit]},f.id))]}):v==="web"?M("select",{className:"st-cp-nsel","aria-label":"artboard breakpoint preset",value:P??"",onChange:(f)=>{let s=D5[f.currentTarget.value];if(s)w(s.width,null)},children:[z("option",{value:"",disabled:!0,children:P?`${D5[P].label} — ≤ ${D5[P].width}px`:"Breakpoint…"}),Object.entries(D5).map(([f,s])=>M("option",{value:f,children:[s.label," — ≤ ",s.width,"px breakpoint"]},f))]}):M("select",{className:"st-cp-nsel","aria-label":"artboard size preset",value:O??"",onChange:(f)=>{let s=D5[f.currentTarget.value];if(s)w(s.width,s.height)},children:[z("option",{value:"",disabled:!0,children:O?D5[O].label:"Preset size…"}),Object.entries(D5).map(([f,s])=>M("option",{value:f,children:[s.label," — ",s.width,"×",s.height]},f))]})}),z("div",{style:{padding:"0 12px 8px"},children:z(oB,{value:I?"fixed":"hug",ariaLabel:"artboard height sizing mode",options:[{value:"hug",label:"Hug"},{value:"fixed",label:"Fixed"}],onChange:(f)=>x(f==="fixed")})}),z("div",{className:"st-cp-sechd-row",children:z("span",{className:"st-cp-sechd",children:"Kind"})}),z("div",{style:{padding:"0 12px 8px"},children:z(_W,{value:v,ariaLabel:"artboard kind",options:j20.map(([f,s])=>({value:f,label:s})),onChange:d})}),v!=="print"&&K&&H?z("div",{style:{padding:"0 12px 8px"},children:M("select",{className:"st-cp-nsel","aria-label":"duplicate artboard at breakpoint width",value:"",onChange:(f)=>{let s=D5[f.currentTarget.value];if(s)H(K,s.width);f.currentTarget.value=""},children:[z("option",{value:"",disabled:!0,children:"Duplicate at width…"}),Object.entries(D5).map(([f,s])=>M("option",{value:f,children:[s.label," — ",s.width,"px"]},f))]})}):null,v==="print"?M(G0,{children:[z("div",{className:"st-cp-sechd-row",children:z("span",{className:"st-cp-sechd",children:"Print"})}),z("div",{style:{padding:"0 12px 8px"},children:z(oB,{value:h?.orientation??"portrait",ariaLabel:"paper orientation",options:[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"}],onChange:(f)=>o({orientation:f})})}),z("div",{style:{padding:"0 12px 8px"},children:z(XX,{value:Number.isFinite(h?.bleedMm)?h.bleedMm:3,min:0,step:0.5,ariaLabel:"bleed, millimeters",lead:"B",steppers:!1,unitSlot:z("span",{className:"st-cp-numsuffix","aria-hidden":"true",children:"mm"}),onCommit:(f)=>o({bleedMm:f})})})]}):null,z("div",{className:"st-cp-sechd-row",children:z("span",{className:"st-cp-sechd",children:"Style"})}),M("div",{style:{padding:"4px 12px 8px",display:"flex",flexDirection:"column",gap:8},children:[(()=>{let f=D(k),s=/var\(\s*--/.test(k),n=s?k.replace(/^var\(\s*|\s*\)$/g,"").replace(/^--/,"").replace(/-/g," "):k;return z(wV,{swatch:z(BF,{kind:"color",swatchClassName:"st-cp-cf-sw",groups:N("color"),current:k,activeDs:q,swatchBg:f,seedHex:DF(f)||"#000000",onPick:(c)=>l({background:c||null}),label:"artboard background colour"}),displayValue:n,bound:s,ariaLabel:"artboard background",onValue:(c)=>l({background:(c||"").trim()||null})})})(),z(_W,{value:C,ariaLabel:"artboard body layout",options:y20.map(([f,s])=>({value:f,label:s})),onChange:(f)=>l({layout:f||null})}),M("div",{style:{display:"flex",gap:8},children:[z(nB,{value:/^var\(/.test($)?$:Number.parseFloat($)||0,tokens:F("space"),ariaLabel:"artboard padding",lead:"Pad",min:0,onChange:(f)=>l({padding:typeof f==="string"?f:f>0?f:null})}),z(nB,{value:/^var\(/.test(b)?b:Number.parseFloat(b)||0,tokens:F("space"),ariaLabel:"artboard gap",lead:"Gap",min:0,onChange:(f)=>l({gap:typeof f==="string"?f:f>0?f:null})})]})]})]})}var dR=/assets\/[0-9a-f]{8}\.[a-z0-9]+/i,v20=new RegExp(dR.source,"gi");function h20(X){if(!X||Array.isArray(X))return null;if(X.photoAsset)return X.photoAsset;let J=X.html||"";if((X.tag||"").toLowerCase()!=="img"){let W=[...new Set(J.match(v20)||[])],G=[...new Set([...J.matchAll(/data-photo-asset="([^"]+)"/g)].map((Z)=>Z[1]))];if(G.length===1)return G[0];if(G.length===0&&W.length===1&&/<img/i.test(J))return W[0];return null}let Q=/data-photo-asset="([^"]+)"/.exec(J);if(Q)return Q[1];let Y=dR.exec(`${X.attrs?.src||""} ${J}`);return Y?Y[0]:null}function x20({testId:X,selected:J,onClose:Q,layersTree:Y,componentMap:W,lockedKeys:G,onToggleLock:Z,onDetachInstance:H,canvasFile:K,onSelectLayer:U,onHoverLayer:q,onReorderLayer:B,layersBusyRef:N,cfg:F,onOptimistic:D,onRecordEdit:_,onReplaceMedia:R,onResizeArtboard:w,onSetArtboardHug:O,onSetArtboardStyle:P,onSetArtboardKind:I,onSetArtboardPrint:k,onDuplicateArtboard:$,onUndoRedo:C,editScope:b,tab:v,onTabChange:h,width:d,resizing:o,photoSel:x,photoRev:m,onPhotoEdit:l,onPhotoRemoveBackground:f,onPhotoRecordEdit:s,onPhotoUndoRedo:n,layersOnly:c=!1,hideLayersTab:U0=!1,cpMode:X0,onSetCpMode:H0}){let[a,D0]=u.useState("inspect"),z0=c?"layers":v??a,l0=(m0)=>{D0(m0),h?.(m0)},[X8,d0]=u.useState(()=>new Set),[$0,M0]=u.useState(()=>new Map);u.useEffect(()=>{let m0=Array.isArray(J)?J[0]:J,w0=m0?.id;if(!w0||!Y?.nodes)return;let K8=m0.index,I8=null,k8=[];if(function _9(A8,T9){for(let Y9 of A8||[]){let b7=`${Y9.id}:${Y9.index}`;if(!Y9.synthetic&&Y9.id===w0&&(K8==null||Y9.index===K8))return I8=b7,k8.push(...T9),!0;if(Y9.children&&Y9.children.length&&_9(Y9.children,[...T9,b7]))return!0}return!1}(Y.nodes,[]),!I8)return;if(k8.length)d0((_9)=>{let A8=!1,T9=new Set(_9);for(let Y9 of k8)if(T9.delete(Y9))A8=!0;return A8?T9:_9});requestAnimationFrame(()=>{try{document.querySelector(`.st-layer--row[data-layer-key="${I8}"]`)?.scrollIntoView({block:"nearest"})}catch{}})},[J,Y]);let i0=(m0)=>{let w0=`${m0.id}:${m0.index}`;return $0.has(w0)?$0.get(w0):!!m0.hidden},[c8,z8]=u.useState(null),[Q9,L8]=u.useState(""),W8=(m0,w0)=>{if(!K||!m0?.id)return;fetch("/_api/edit-attr",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({canvas:K,id:m0.id,attr:"data-dc-element",value:w0})}).then((K8)=>K8.json().catch(()=>({}))).then((K8)=>{if(!K8.ok)return;_?.({op:"attr",canvas:K,id:m0.id,key:"data-dc-element",before:m0.dcElement??null,after:w0})}).catch(()=>{})},b8=B?(m0,w0,K8)=>{if(N?.current)return;if(m0?.synthetic||w0?.synthetic)return;let I8=K8==="before"?`before ${w0.label}`:K8==="after"?`after ${w0.label}`:`into ${w0.label}`;L8(`Moved ${m0.label} ${I8}`),B(m0.id,w0.id,K8,{idIndex:m0.index,refIndex:w0.index})}:void 0,i8=()=>{let m0=[];return function w0(K8,I8,k8){(K8||[]).forEach((_9,A8)=>{if(m0.push({node:_9,depth:I8,parentNode:k8,siblings:K8,pos:A8}),_9.children&&_9.children.length&&!X8.has(`${_9.id}:${_9.index}`))w0(_9.children,I8+1,_9)})}(Y?.nodes,0,null),m0},p9=(m0)=>{if(m0.key!=="ArrowUp"&&m0.key!=="ArrowDown")return;if(!b0)return;let w0=i8(),K8=w0.findIndex((A8)=>A8.node.id===b0.id&&A8.node.index===b0.index);if(K8<0)return;let I8=m0.key==="ArrowDown"?1:-1,k8=w0[K8];if(!m0.altKey){let A8=w0[K8+I8];if(A8)m0.preventDefault(),U?.(A8.node);return}if(!b8||!Array.isArray(k8.siblings))return;m0.preventDefault();let _9=(A8)=>A8&&A8.children&&A8.children.length&&!X8.has(`${A8.id}:${A8.index}`);if(!m0.shiftKey){if(I8<0&&k8.pos>0)b8(k8.node,k8.siblings[k8.pos-1],"before");else if(I8>0&&k8.pos<k8.siblings.length-1)b8(k8.node,k8.siblings[k8.pos+1],"after");return}if(I8>0){let A8=k8.siblings[k8.pos+1];if(A8)b8(k8.node,A8,_9(A8)?"inside-start":"after");else if(k8.parentNode)b8(k8.node,k8.parentNode,"after")}else{let A8=k8.siblings[k8.pos-1];if(A8)b8(k8.node,A8,_9(A8)?"inside-end":"before");else if(k8.parentNode)b8(k8.node,k8.parentNode,"before")}},O0=u.useRef(null),j8=u.useRef(null),L9=(m0,w0,K8)=>{if(!b8||m0.button!==0||m0.metaKey||m0.ctrlKey||m0.shiftKey||m0.altKey)return;if(N?.current)return;let{clientX:I8,clientY:k8}=m0,_9=new Set([K8]);(function g8(a9){(a9.children||[]).forEach((m7)=>{_9.add(`${m7.id}:${m7.index}`),g8(m7)})})(w0);let A8=14,T9=6,Y9=[];(function g8(a9,m7){(a9||[]).forEach((P7)=>{let E9=`${P7.id}:${P7.index}`;if(Y9.push({node:P7,key:E9,id:P7.id,depth:m7,tag:P7.tag}),P7.children&&P7.children.length&&!X8.has(E9))g8(P7.children,m7+1)})})(Y?.nodes,0);let b7=new Map(Y9.map((g8)=>[g8.key,g8])),E0=!1,f8=(g8)=>{if(!E0){if(Math.hypot(g8.clientX-I8,g8.clientY-k8)<4)return;E0=!0}let a9=g8.clientX-I8,m7=g8.clientY-k8,P7=null,E9=[].slice.call(document.querySelectorAll(".st-layer--row[data-layer-key]")).map((e)=>({rect:e.getBoundingClientRect(),it:b7.get(e.getAttribute("data-layer-key"))})).filter((e)=>e.it&&e.it.key!==K8);if(E9.length){let e=E9[0].rect.left,A0=E9[0].rect.right,q0=E9.length;for(let F7=0;F7<E9.length;F7++)if(g8.clientY<E9[F7].rect.top+E9[F7].rect.height/2){q0=F7;break}let j0=E9[q0-1]?.it||null,r0=E9[q0]?.it||null,y8=Math.round((g8.clientX-e-T9)/A8),S8=j0?j0.depth+(S20.has(j0.tag)?0:1):0,o8=r0?r0.depth:0,e8=Math.max(o8,Math.min(y8,S8)),P9=null,U7="before",h9=0;if(!j0){if(r0)P9=r0,U7="before",h9=r0.depth}else if(e8>j0.depth)P9=j0,U7="inside-start",h9=j0.depth+1;else if(e8===j0.depth)P9=j0,U7="after",h9=j0.depth;else{for(let F7=q0-1;F7>=0;F7--)if(E9[F7].it.depth===e8){P9=E9[F7].it;break}if(!P9)P9=j0;U7="after",h9=e8}if(P9&&P9.key!==K8&&!_9.has(P9.key)){let F7=j0?E9[q0-1].rect.bottom:E9[0].rect.top,GX=e+T9+h9*A8;P7={refId:P9.id,position:U7,node:P9.node,y:F7,left:GX,w:Math.max(24,A0-GX)}}}let l6={key:K8,node:w0,dx:a9,dy:m7,target:P7};O0.current=l6,z8(l6)},v9=()=>{window.removeEventListener("pointermove",f8),window.removeEventListener("pointerup",G6),window.removeEventListener("keydown",_6,!0)},w9=()=>{let g8=(a9)=>{a9.preventDefault(),a9.stopImmediatePropagation(),document.removeEventListener("click",g8,!0)};document.addEventListener("click",g8,!0),setTimeout(()=>document.removeEventListener("click",g8,!0),300)},G6=()=>{v9();let g8=O0.current;if(O0.current=null,z8(null),E0&&g8?.target)w9(),b8(g8.node,g8.target.node,g8.target.position)},_6=(g8)=>{if(g8.key!=="Escape")return;if(g8.preventDefault(),g8.stopImmediatePropagation(),v9(),O0.current=null,z8(null),E0)w9()};window.addEventListener("pointermove",f8),window.addEventListener("pointerup",G6),window.addEventListener("keydown",_6,!0)},U8=(m0)=>d0((w0)=>{let K8=new Set(w0);if(K8.has(m0))K8.delete(m0);else K8.add(m0);return K8}),D9=(m0)=>{let w0=`${m0.id}:${m0.index}`,K8=i0(m0),I8=!K8;if(M0((k8)=>new Map(k8).set(w0,I8)),D?.({id:m0.id,artboardId:Y?.artboardId??null,index:m0.index,prop:"display",value:I8?"none":null}),!K||!m0.id)return;fetch("/_api/edit-css",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(I8?{canvas:K,id:m0.id,property:"display",value:"none"}:{canvas:K,id:m0.id,property:"display",reset:!0})}).catch(()=>{}),_?.({op:"css",canvas:K,id:m0.id,key:"display",before:K8?"none":null,after:I8?"none":null})},b0=Array.isArray(J)?J[0]:J,Z0=x?{asset:x.asset,kind:"annotation-image"}:(()=>{let m0=h20(b0);return m0?{asset:m0,kind:"artboard-img"}:null})(),y0=Z0?.kind==="annotation-image",c0=(m0)=>{if(!(m0.metaKey||m0.ctrlKey)||m0.altKey)return;let w0=m0.key.toLowerCase();if(w0==="z")m0.preventDefault(),n?.(m0.shiftKey?"redo":"undo");else if(w0==="y")m0.preventDefault(),n?.("redo")},q8=y0?"photo":z0==="photo"&&!Z0?"inspect":z0,N8=(m0,w0,K8)=>M("button",{type:"button",className:"st-rp-tab"+(q8===m0?" is-active":""),onClick:()=>l0(m0),children:[z(A9,{name:K8,size:14}),w0]}),H8=b0?.bounds||null;return M("aside",{className:"st-rpanel"+(o?" is-resizing":""),style:d?{width:d,flexBasis:d}:void 0,"aria-label":"Inspector","data-tour":"inspector","data-testid":X,children:[M("div",{className:"st-rp-tabs","data-tour":"inspector-tabs",style:c?{display:"none"}:void 0,children:[y0?N8("photo","Photo","image"):M(G0,{children:[N8("inspect","Inspect","sliders"),!U0&&N8("layers","Layers","layers"),N8("css","CSS","code"),Z0?N8("photo","Photo","image"):null]}),z("button",{type:"button",className:"st-iconbtn","aria-label":"Close inspector",style:{marginLeft:"auto"},onClick:Q,children:z(A9,{name:"x",size:14})})]}),b0?.id&&!(Array.isArray(J)&&J.length>1)&&b?M("div",{className:`st-scope st-scope--${b.scope}`,title:b.scope==="shared"?`Editing this element's style changes ${b.affects} place${b.affects===1?"":"s"}${b.componentName?` (component ${b.componentName})`:""}. Move/resize a whole instance to keep it local.`:"This edit affects only this element.",children:[z("span",{className:"st-scope-dot","aria-hidden":"true"}),b.scope==="shared"?`Shared${b.componentName?` · ${b.componentName}`:""} · edits ${b.affects} place${b.affects===1?"":"s"}`:"Local · this element only",b.scope==="shared"&&H?z("button",{type:"button",className:"st-scope-detach",title:"Clone this component for this instance only — edits stop affecting the other places",onClick:()=>H(b0.id,b0.index),children:"Detach"}):null]}):null,z("div",{className:"st-rp-body",children:q8==="photo"&&Z0?z("div",{onKeyDown:c0,children:z(oh,{asset:Z0.asset,ColorPicker:B00,StIcon:A9,onEdit:(m0)=>l?.(Z0.asset,m0),onRemoveBackground:f,onRecordEdit:(m0,w0)=>s?.(Z0.asset,m0,w0)},`${Z0.asset}:${m??0}`)}):!b0&&!(q8==="layers"&&Y?.nodes?.length)?z("div",{className:"st-rp-empty",children:M("p",{children:["Press ",z(MX,{children:"V"}),", then click an element to select it — or ",z(MX,{children:"⌘"}),"-click straight from Browse."]})}):b0&&q8==="inspect"?M(G0,{children:[z("div",{className:"st-rp-hd",children:b0.selector||b0.tag||"element"}),M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:"Pos"}),M("div",{className:"st-insp-fields",children:[M("span",{className:"st-fmini",children:[z("span",{className:"st-mtag",children:"X"}),z("input",{value:H8?Math.round(H8.x):"—",readOnly:!0,"aria-label":"x position"})]}),M("span",{className:"st-fmini",children:[z("span",{className:"st-mtag",children:"Y"}),z("input",{value:H8?Math.round(H8.y):"—",readOnly:!0,"aria-label":"y position"})]})]})]}),M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:"Size"}),M("div",{className:"st-insp-fields",children:[M("span",{className:"st-fmini",children:[z("span",{className:"st-mtag",children:"W"}),z("input",{value:H8?Math.round(H8.w):"—",readOnly:!0,"aria-label":"width"})]}),M("span",{className:"st-fmini",children:[z("span",{className:"st-mtag",children:"H"}),z("input",{value:H8?Math.round(H8.h):"—",readOnly:!0,"aria-label":"height"})]})]})]}),M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:"Tag"}),z("div",{className:"st-insp-fields",children:z("span",{className:"st-mono",style:{fontSize:11,color:"var(--fg-0)"},children:b0.tag||"—"})})]}),b0.classes?M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:"Class"}),z("div",{className:"st-insp-fields",children:z("span",{className:"st-mono",style:{fontSize:11,color:"var(--fg-1)"},children:b0.classes})})]}):null,z(b20,{el:b0})]}):q8==="layers"?M(G0,{children:[M("div",{className:"st-rp-hd",children:["Layers",Y?.nodes?.length?"":" · ancestry"]}),Y?.nodes?.length?M(G0,{children:[b8?z("div",{className:"st-rp-hint","aria-hidden":"true",children:"Drag or ↑/↓ select · Alt+↑/↓ move · Alt+Shift+↑/↓ move across"}):null,z("div",{role:"tree","aria-label":"Artboard layers",tabIndex:0,ref:j8,onKeyDown:p9,children:Y.nodes.map((m0,w0)=>z(N00,{node:m0,depth:0,selectedId:b0?.id,selectedIndex:b0?.index,collapsed:X8,hiddenOverride:$0,onToggle:U8,onSelect:(K8)=>{U?.(K8),j8.current?.focus()},onHover:(K8)=>q?.(K8),onToggleVisibility:D9,onReorder:b8,onRowPointerDown:L9,dragState:c8,componentMap:W,lockedKeys:G,onToggleLock:Z,onRename:W8},`${m0.id}:${m0.index}`))}),c8?.target?z("div",{className:"st-layer-divider","aria-hidden":"true",style:{left:c8.target.left,top:c8.target.y-1,width:c8.target.w}}):null,z("div",{className:"sr-only",role:"status","aria-live":"polite",children:Q9})]}):b0&&Array.isArray(b0.dom_path)&&b0.dom_path.length?b0.dom_path.map((m0,w0)=>M("div",{className:"st-layer"+(w0===b0.dom_path.length-1?" is-sel":""),style:{paddingLeft:8+w0*12},children:[z(A9,{name:"square",size:13}),m0]},w0)):z("div",{className:"st-rp-empty",children:"Select an element (⌘-click in the canvas) to see its layer tree."})]}):!b0.id&&F00(b0)?z(f20,{el:b0,cfg:F,onResizeArtboard:w,onSetArtboardHug:O,onSetArtboardStyle:P,onSetArtboardKind:I,onSetArtboardPrint:k,onDuplicateArtboard:$}):z(T20,{el:b0,cfg:F,onOptimistic:D,onRecordEdit:_,onReplaceMedia:R,onUndoRedo:C,mode:X0,onSetMode:H0})})]})}function g20(){let[X,J]=u.useState([]),[Q,Y]=u.useState("Design"),[W,G]=u.useState([]),[Z,H]=u.useState(null),[K,U]=u.useState(null),q=u.useCallback((j)=>{U(j)},[]),[B,N]=u.useState(null),F=u.useRef(null);u.useEffect(()=>{F.current=B},[B]);let[D,_]=u.useState(null);u.useEffect(()=>{let j=Array.isArray(B)?B.length===1?B[0]:null:B,y=j&&typeof j.id==="string"?j.id:null;if(!y||!Z){_(null);return}let t=new AbortController,W0=new URLSearchParams({canvas:Z,id:y});return fetch(`/_api/edit-scope?${W0}`,{signal:t.signal}).then((F0)=>F0.ok?F0.json():null).then((F0)=>{if(F0?.ok)_(F0)}).catch(()=>{}),()=>t.abort()},[B,Z]);let R=u.useRef(0),w=u.useRef([]),O=u.useCallback((j)=>{if(!j?.id||!j.file)return;for(let y of w.current)clearTimeout(y);w.current=[50,450,1200,2500,5000].map((y)=>setTimeout(()=>{let t=F.current,W0=Array.isArray(t)?t[0]:t;if(!W0||W0.id!==j.id||W0.file!==j.file)return;let F0=m8.current.get(j.file);if(!F0?.contentWindow)return;try{F0.contentWindow.postMessage({dgn:"select-by-id",id:j.id,artboardId:j.artboardId??null,index:j.index??0},"*")}catch{}},y))},[]),P=u.useRef([]),I=u.useCallback((j,y)=>{if(!j||!y)return;for(let t of P.current)clearTimeout(t);P.current=[50,450,1200,2500,5000].map((t)=>setTimeout(()=>{let W0=F.current,F0=Array.isArray(W0)?W0[0]:W0;if(!F0||F0.artboardId!==j||F0.file!==y)return;let B0=m8.current.get(y);if(!B0?.contentWindow)return;try{B0.contentWindow.postMessage({dgn:"select-by-id",artboardId:j},"*")}catch{}},t))},[]),k=u.useRef(null),$=u.useRef(null),C=u.useRef(null),b=u.useRef(null),v=u.useRef(!1),h=u.useRef(null),[d,o]=u.useState(null),[x,m]=u.useState(null),l=u.useRef({canvas:null,at:0});u.useEffect(()=>{if(!Z||!d)return;let j=Date.now(),y=l.current;if(y.canvas===Z&&j-y.at<1500)return;l.current={canvas:Z,at:j},fetch(`/_api/component-map?canvas=${encodeURIComponent(Z)}`).then((t)=>t.json()).then((t)=>{if(t?.ok&&t.map&&typeof t.map==="object")m(t.map);else m(null)}).catch(()=>m(null))},[Z,d]);let[f,s]=u.useState(!1),[n,c]=u.useState(null),[U0,X0]=u.useState(null),[H0,a]=u.useState(null),[D0,z0]=u.useState(null),[l0,X8]=u.useState(null),[d0,$0]=u.useState(!1),[M0,i0]=u.useState(!1),[c8,z8]=u.useState(null),[Q9,L8]=u.useState(""),[W8,b8]=u.useState(null),[i8,p9]=u.useState(null),O0=u.useRef(null),j8=ue("maude-sb-w",{min:200,max:420,def:252}),L9=ue("maude-rp-w",{min:260,max:480,def:304}),[U8,D9]=u.useState(null),b0=u.useRef(null);u.useEffect(()=>{if(!U8)return;let j=(t)=>{let W0=b0.current?.getBoundingClientRect();if(!W0)return;if(U8==="sb")j8.setW(t.clientX-W0.left);else L9.setW(W0.right-t.clientX)},y=()=>D9(null);return window.addEventListener("pointermove",j),window.addEventListener("pointerup",y),()=>{window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",y)}},[U8,j8.setW,L9.setW]);let Z0=u.useCallback((j)=>{clearTimeout(O0.current),O0.current=setTimeout(()=>{p9((y)=>y===j?null:y)},2500)},[]);u.useEffect(()=>{if(!i8)return;let j=setTimeout(()=>p9(null),15000);return()=>clearTimeout(j)},[i8]);let[y0,c0]=u.useState({designRel:".design",cloud:void 0}),q8=!!y0.readOnly,N8=u.useCallback(()=>{fetch("/_config").then((j)=>j.json()).then((j)=>{let y=(j.designRoot||".design").replace(/^\/+|\/+$/g,"");c0((t)=>({...t,designRel:y,tokensCssRel:j.tokensCssRel,designSystems:j.designSystems,canvasOrigin:j.canvasOrigin,readOnly:!!j.readOnly,canvasToken:j.canvasToken,version:j.version,cloud:j.cloud??null}))}).catch(()=>{})},[]);u.useEffect(()=>{N8()},[N8]),u.useEffect(()=>{let j=!1;return fetch("/_sync-status").then((y)=>y.json()).then((y)=>{if(j||!y||y.linked===!1)return;X0(y)}).catch(()=>{}),()=>{j=!0}},[]),u.useEffect(()=>{let j=!1;return fetch("/_api/git/status").then((y)=>y.json()).then((y)=>{if(!j&&y)z0(y)}).catch(()=>{}),()=>{j=!0}},[]);let[H8,m0]=u.useState({}),[w0,K8]=u.useState(null),[I8,k8]=u.useState(!1),[_9,A8]=u.useState("open"),[T9,Y9]=u.useState(Rq0),[b7,E0]=u.useState(()=>{return vR($e,"advanced")==="designer"?"designer":"advanced"});u.useEffect(()=>{try{localStorage.setItem($e,JSON.stringify(b7))}catch{}},[b7]);let[f8,v9]=u.useState(null),[w9,G6]=u.useState(()=>rZ(Se,!0)),[_6,g8]=u.useState(()=>rZ(ke,!1)),[a9,m7]=u.useState(()=>vR(Ce,{})),[P7,E9]=u.useState(!1),[l6,e]=u.useState(!1);u.useEffect(()=>{if(!X9())return;let j=Dv(()=>e(!0));return()=>{j.then((y)=>y()).catch(()=>{})}},[]);let[A0,q0]=u.useState(!1),[j0,r0]=u.useState(!1),[y8,S8]=u.useState(!1),[o8,e8]=u.useState(!1),[P9,U7]=u.useState(!1),{report:h9}=LA(X9()),[F7,GX]=u.useState(!1),[fQ,JQ]=u.useState(!1),[M5,$6]=u.useState(null),[I9,y7]=u.useState(!1),[hW,L7]=u.useState(!1),[ZX,OX]=u.useState(!1),[vQ,_7]=u.useState(!1),[u7,O5]=u.useState(()=>vR(fe,OK)),[Z7,mY]=u.useState(()=>{try{let j=localStorage.getItem(ve);if(j==="separate"||j==="in-inspector")return j}catch{}return"separate"}),[j7,o9]=u.useState(!1),[V7,d9]=u.useState([]),[$9,gX]=u.useState(0),[uY,mX]=u.useState(!1),[zJ,QQ]=u.useState(!1),[_X,_5]=u.useState(!1),[xW,hQ]=u.useState(1),[lY,i]=u.useState(216),[J0,N0]=u.useState(null),[C0,R0]=u.useState([]),[Q8,G8]=u.useState([]),[z9,t8]=u.useState([]),[e7,AX]=u.useState(0),A6=u.useRef(0);u.useEffect(()=>{A6.current=$9},[$9]);let[D7,xQ]=u.useState(null),pY=u.useRef(null);u.useEffect(()=>{pY.current=D7},[D7]);let X6=u.useMemo(()=>EA(V7,{artboardId:[D7,J0],total:e7}),[V7,D7,J0,e7]),uX=u.useRef(null);u.useEffect(()=>{uX.current=X6},[X6]);let Z6=u.useMemo(()=>nz(V7,X6)?.fps||30,[V7,X6]),[HX,KJ]=u.useState(null),[A5,T8]=u.useState(0),V9=u.useCallback((j,y)=>{if(/concurrent edit|changed since it was read/i.test(y||""))x8("Timeline changed — reloaded, try again."),T8((t)=>t+1);else x8(`${j}: ${y||"failed"}`)},[]),[N9,UJ]=u.useState(!1),[wX,dY]=u.useState(!1),[gW,mW]=u.useState(!1),w5=u.useRef(N9);u.useEffect(()=>{if(w5.current=N9,N9){mW(!1);try{if(typeof Notification<"u"&&Notification.permission==="default")Notification.requestPermission()}catch{}}},[N9]);let aZ=u.useCallback(()=>{if(!w5.current||document.hidden)mW(!0),xe("Claude finished","Your assistant turn is ready in Maude.")},[]),cY=u.useRef(0),iY=u.useCallback(()=>{if(!w5.current||document.hidden){mW(!0);let j=Date.now();if(j-cY.current<wq0)return;cY.current=j,xe("Maude needs your input","Claude is waiting on an approval or a question in Maude.")}},[]),[EX,YQ]=u.useState("inspect"),[PK,lX]=u.useState(null),WQ=u.useRef({undo:[],redo:[]}),[uW,RK]=u.useState(0),[xJ,lW]=u.useState(()=>{try{return localStorage.getItem("maude-auto-open-inspector")!=="0"}catch{return!0}}),oY=u.useRef(xJ);u.useEffect(()=>{oY.current=xJ;try{localStorage.setItem("maude-auto-open-inspector",xJ?"1":"0")}catch{}},[xJ]);let sZ=u.useRef(!1);u.useEffect(()=>{sZ.current=ZX||I8||d0||M0||N9},[ZX,I8,d0,M0,N9]);let pW=u.useRef({open:{},side:OK});pW.current={open:{tree:w9,layers:vQ,inspector:ZX,comments:I8,changes:d0,sync:M0,assistant:N9},side:u7};let gQ=u.useCallback((j,y)=>{if(j==="tree")G6(y);else if(j==="layers")_7(y);else if(j==="inspector")OX(y);else if(j==="comments")k8(y);else if(j==="changes")$0(y);else if(j==="sync")i0(y);else if(j==="assistant")UJ(y)},[]),dW=u.useCallback((j)=>pW.current.side?.[j]||OK[j],[]),PX=u.useCallback((j)=>{let y=dW(j);gQ(j,!0);for(let t of uR)if(t.id!==j&&dW(t.id)===y)gQ(t.id,!1)},[gQ,dW]),E5=u.useCallback((j)=>{if(pW.current.open?.[j])gQ(j,!1);else PX(j)},[PX,gQ]),gJ=PX,S6=E5,cW=u.useCallback((j)=>{if(!oY.current)return;if(q8)return;if(!j||!j.id)return;if(sZ.current)return;gJ("inspector"),YQ("css")},[gJ,q8]),nY=u.useCallback(()=>o9((j)=>!j),[]),GQ=Bx(pR),rY=sh({enabled:y0.cloud===null}),[iW,oW]=u.useState(!1),[aY,tZ]=u.useState(!1);u.useEffect(()=>{if(!X9())return;let j=!0;return Av().then((y)=>{if(!j)return;if(oW(!!y),!y&&!rZ(Ie,!1))tZ(!0)}).catch(()=>{}),()=>{j=!1}},[]);let eZ=u.useCallback(()=>{tZ(!1);try{localStorage.setItem(Ie,"1")}catch{}},[]),[nW,sY]=u.useState(null);u.useEffect(()=>{if(!X9())return;let j;return Rv((y)=>sY(y&&typeof y==="object"?y:{})).then((y)=>{j=y}).catch(()=>{}),()=>{try{j?.()}catch{}}},[]);let[b6,XH]=u.useState(null),[mQ,TK]=u.useState(()=>!rZ(Te,!1)),P5=u.useCallback((j)=>{XH(Array.isArray(j)&&j.length?j:null)},[]),IK={setup:(j)=>{if(!j)return;if((j.canvas||j.requireSelection)&&W.length===0)PX("tree"),setTimeout(()=>{try{document.querySelector('.st-sidebar [role="treeitem"]')?.click()}catch{}},80);if(j.inspector||j.tab||j.requireSelection)gJ("inspector");if(j.tab)YQ(j.tab);if(j.changes)gJ("changes")}},rW=u.useCallback(()=>{TK(!1);try{localStorage.setItem(Te,"1")}catch{}},[]),[pX,tY]=u.useState(()=>rZ(je,!0)),[JH,kK]=u.useState(!1),[mJ,QH]=u.useState(()=>rZ(be,!1)),[uJ,YH]=u.useState(()=>rZ(ye,!1)),[RX,aW]=u.useState(!1),[CK,dX]=u.useState(!1),[TX,ZQ]=u.useState(0),[sW,$K]=u.useState(null),[uQ,HQ]=u.useState(!1),lQ=u.useRef(null),zQ=u.useRef(null),m8=u.useRef(new Map),O8=u.useCallback((j)=>{let y=Z?m8.current.get(Z):null;if(!y||!y.contentWindow)return;try{y.contentWindow.postMessage(j,"*")}catch{}},[Z]),pQ=u.useCallback((j,y)=>O8({dgn:"photo-preview",asset:j,edit:y}),[O8]),tW=u.useCallback((j,y,t)=>{WQ.current.undo.push({asset:j,before:y,after:t}),WQ.current.redo.length=0},[]),eW=u.useCallback((j)=>{let y=j?WQ.current.redo:WQ.current.undo;if(!y.length)return!1;let t=y.pop();(j?WQ.current.undo:WQ.current.redo).push(t);let W0=(j?t.after:t.before)||{};return pQ(t.asset,W0),fetch(`/_api/photo-edit?asset=${encodeURIComponent(t.asset)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(W0)}).catch(()=>{}),RK((F0)=>F0+1),!0},[pQ]),XG=u.useCallback(async(j)=>{O8({dgn:"photo-busy",asset:j,busy:!0});try{let y=await fetch(`/${j.replace(/^\/+/,"")}`);if(!y.ok)return null;let t=await y.blob(),{removeBackground:W0}=await Promise.resolve().then(() => (Re(),Pe)),F0=await W0(t),B0=await fetch("/_api/asset",{method:"POST",headers:{"content-type":F0.type||"image/png"},body:F0}),k0=await B0.json().catch(()=>({}));if(B0.ok&&k0.path)return{maskAsset:k0.path};return null}catch(y){return console.error("[photo] background removal failed",y),null}finally{O8({dgn:"photo-busy",asset:j,busy:!1})}},[O8]);u.useEffect(()=>{let j=(W0)=>Array.from(W0.dataTransfer?.types??[]).includes("Files"),y=(W0)=>{if(j(W0))W0.preventDefault()},t=(W0)=>{if(j(W0))W0.preventDefault()};return document.addEventListener("dragover",y),document.addEventListener("drop",t),()=>{document.removeEventListener("dragover",y),document.removeEventListener("drop",t)}},[]);let w6=u.useRef({});w6.current={open:j7,comps:V7,frame:$9,total:e7,playing:uY,compId:X6,muted:_X,loop:zJ,sequences:C0,post:O8,canvas:Z};let R5=u.useRef({undo:[],redo:[]}),R7=u.useCallback((j,y,t)=>{if(typeof y!=="number")return;if(R5.current.undo.push({canvas:j,seq:y,label:t}),R5.current.redo=[],R5.current.undo.length>50)R5.current.undo.shift()},[]),K0=u.useCallback((j)=>{let y=R5.current,t=j==="undo"?y.undo:y.redo,W0=j==="undo"?y.redo:y.undo,F0=w6.current.canvas,B0=-1;for(let p=t.length-1;p>=0;p--)if(t[p].canvas===F0){B0=p;break}if(B0<0){x8(j==="undo"?"Nothing to undo on this timeline.":"Nothing to redo.");return}let k0=t[B0];fetch("/_api/reorder-revert",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({canvas:k0.canvas,seq:k0.seq,dir:j})}).then((p)=>p.json().catch(()=>({}))).then((p)=>{if(t.splice(B0,1),p?.ok)W0.push(k0),x8(`${j==="undo"?"Undid":"Redid"}: ${k0.label}`,!0);else x8(`${j==="undo"?"Undo":"Redo"} skipped: ${p?.error||"failed"}`)}).catch(()=>x8(`${j==="undo"?"Undo":"Redo"} failed: network error`))},[]),p6=u.useCallback((j,y)=>{let t=j?.ok&&Array.isArray(j.clips)?j.clips.filter((W0)=>W0.kind==="sequence"):[];if(y==null)return null;if(typeof y==="object")return(y.stableId?t.find((W0)=>W0.stableId===y.stableId):null)||(Number.isInteger(y.index)?t[y.index]:null)||null;if(typeof y==="string")return t.find((W0)=>W0.stableId===y)||null;return t[y]||null},[]),eY=u.useCallback((j)=>{let y=w6.current.canvas;if(!y||y===d8)return;let t=pY.current||void 0,W0=`/_api/comp-clips?canvas=${encodeURIComponent(y)}${t?`&artboardId=${encodeURIComponent(t)}`:""}`;fetch(W0).then((F0)=>F0.json().catch(()=>({}))).then((F0)=>{let B0=p6(F0,j);if(!B0?.stableId)return null;return fetch("/_api/remove-sequence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({canvas:y,artboardId:t,stableId:B0.stableId,contentHash:B0.contentHash})})}).then((F0)=>F0?F0.json():null).then((F0)=>{if(F0&&!F0.ok)console.warn("[remove-clip]",F0.error||"failed"),V9("Remove refused",F0.error);else if(F0?.ok){if(x8("Clip removed.",!0),F0.seq!=null)R7(y,F0.seq,"remove clip");KJ(null)}}).catch(()=>x8("Remove failed: network error"))},[p6,R7]),KQ=u.useCallback((j,y,t)=>{let W0=w6.current.canvas;if(!W0||W0===d8)return;let F0=pY.current||void 0,B0=`/_api/comp-clips?canvas=${encodeURIComponent(W0)}${F0?`&artboardId=${encodeURIComponent(F0)}`:""}`;fetch(B0).then((k0)=>k0.json().catch(()=>({}))).then((k0)=>{let p=k0?.ok&&Array.isArray(k0.clips)?k0.clips:[],_0=j?.transition?p.find((L0)=>L0.kind==="transition"&&L0.stableId===j.stableId)||null:p6(k0,j);if(!_0?.stableId)return null;return fetch("/_api/clip-edit",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({canvas:W0,artboardId:F0,stableId:_0.stableId,contentHash:_0.contentHash,verb:y,...t})})}).then((k0)=>k0?k0.json():null).then((k0)=>{if(k0&&!k0.ok)console.warn("[clip-edit]",y,k0.error||"failed"),V9(`${y} refused`,k0.error);else if(k0?.ok){let p={speed:"set speed","trim-in":"trim in-point",audio:"clip audio","detach-audio":"detach audio",framing:"crop clip",grade:"grade clip",transition:"edit transition",split:"split clip","insert-transition":"add transition","remove-transition":"remove transition","set-text":"edit text","to-overlay":"move to overlay layer","to-storyline":"move to storyline","layer-order":"reorder layers"};if(x8(`Applied: ${p[y]||y}.`,!0),k0.seq!=null)R7(W0,k0.seq,p[y]||y)}}).catch(()=>x8(`${y} failed: network error`))},[p6,R7,V9]),[cX,f7]=u.useState(null),zX=u.useCallback((j,y="")=>new Promise((t)=>{f7({title:j,value:y,resolve:t})}),[]),VJ=u.useCallback((j)=>{f7((y)=>{return y?.resolve?.(j),null})},[]),X4=u.useCallback((j,y)=>{let t=w6.current.canvas;if(!t||t===d8||!y||!String(y).trim())return;T7({type:"comments-add",payload:{file:t,text:String(y).trim(),selector:"",dom_path:[],tag:"",classes:"",bounds:null,html_excerpt:"",timeline:j}}),x8("Comment added.",!0)},[]);w6.current.selected=HX,w6.current.setSelected=KJ,w6.current.removeClip=eY,w6.current.clipVerb=KQ,w6.current.addComment=X4,w6.current.askText=zX,u.useEffect(()=>{let j=(y)=>{let t=w6.current;if(!t.open||!t.comps?.length)return;let W0=y.target,F0=W0?.tagName;if(F0==="INPUT"&&W0?.type!=="range")return;if(F0==="TEXTAREA"||F0==="SELECT"||W0?.isContentEditable)return;let B0=nz(t.comps,t.compId)?.fps||30,k0=Math.max(1,t.total),p=(L0)=>{let p0=Math.max(0,Math.min(k0-1,Math.round(L0)));gX(p0),mX(!1),t.post({dgn:"timeline-seek",frame:p0,id:t.compId})},_0=()=>{let L0=new Set([0,k0-1]);for(let p0 of t.sequences||[]){L0.add(p0.from);for(let D8 of p0.keyframes||[])L0.add(D8.from),L0.add(D8.to)}return[...L0].filter((p0)=>p0>=0&&p0<k0).sort((p0,D8)=>p0-D8)};if((y.metaKey||y.ctrlKey)&&(y.key==="z"||y.key==="Z")){y.preventDefault(),K0(y.shiftKey?"redo":"undo");return}if(y.key==="Escape"){if(t.selected!=null)y.preventDefault(),t.setSelected?.(null);return}if((y.key==="Delete"||y.key==="Backspace")&&t.selected!=null){y.preventDefault(),t.removeClip?.({stableId:t.selected});return}if((y.metaKey||y.ctrlKey)&&(y.key==="b"||y.key==="B")){y.preventDefault();let L0=t.selected!=null?{stableId:t.selected}:null;if(!L0){let p0=t.sequences||[],D8=p0.find((B8)=>B8.series&&t.frame>=B8.from&&t.frame<B8.from+B8.duration)||p0.find((B8)=>t.frame>=B8.from&&t.frame<B8.from+B8.duration);if(D8?.stableId)L0={stableId:D8.stableId}}if(L0)t.clipVerb?.(L0,"split",{atFrame:t.frame});else x8("Nothing under the playhead to split.");return}if(y.key===" "||y.code==="Space")if(y.preventDefault(),t.playing)mX(!1),t.post({dgn:"timeline-pause",id:t.compId});else mX(!0),t.post({dgn:"timeline-mute",muted:t.muted,id:t.compId}),t.post({dgn:"timeline-loop",loop:t.loop,id:t.compId}),t.post({dgn:"timeline-play",id:t.compId});else if(y.key==="ArrowRight")y.preventDefault(),p(t.frame+(y.shiftKey?B0:1));else if(y.key==="ArrowLeft")y.preventDefault(),p(t.frame-(y.shiftKey?B0:1));else if(y.key==="Home")y.preventDefault(),p(0);else if(y.key==="End")y.preventDefault(),p(k0-1);else if(y.key==="."){y.preventDefault();let L0=_0().find((p0)=>p0>t.frame);if(L0!=null)p(L0)}else if(y.key===","){y.preventDefault();let L0=_0().reverse().find((p0)=>p0<t.frame);if(L0!=null)p(L0)}};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[]),u.useEffect(()=>{d9([]),gX(0),mX(!1),KJ(null),xQ(null);let j=setTimeout(()=>O8({dgn:"timeline-request-comps"}),60);return()=>clearTimeout(j)},[Z,O8]);let[T5,J4]=u.useState(""),[UQ,dQ]=u.useState([]),[JG,s0]=u.useState([]);u.useEffect(()=>{if(!j7||V7.length===0||!Z||Z===d8){J4(""),dQ([]);return}let j=!0;return fetch(`/_api/canvas-source?file=${encodeURIComponent(Z)}`).then((y)=>y.ok?y.json():null).then((y)=>{if(j&&y?.ok&&typeof y.source==="string")J4(y.source)}).catch(()=>{}),()=>{j=!1}},[j7,V7,Z,A5]),u.useEffect(()=>{if(!j7||!Z||Z===d8||!T5){dQ([]),s0([]);return}let j=!0,y=D7||void 0,t=`/_api/comp-clips?canvas=${encodeURIComponent(Z)}${y?`&artboardId=${encodeURIComponent(y)}`:""}`;return fetch(t).then((W0)=>W0.ok?W0.json():null).then((W0)=>{if(!j)return;let F0=W0?.ok&&Array.isArray(W0.clips)?W0.clips:[];dQ(F0.filter((B0)=>B0.kind==="sequence")),s0(F0.filter((B0)=>B0.kind==="transition"))}).catch(()=>{}),()=>{j=!1}},[j7,Z,T5,D7,A5]),u.useEffect(()=>{if(!T5){R0([]),G8([]),t8([]),AX(0);return}let j=J0??B?.artboardId??null,t=(j&&V7.find((B0)=>B0.artboardId===j||B0.id===j)||V7[0])?.durationInFrames||0,W0=uh(T5,t,j);xQ(W0.artboardId??j??null);let F0=W0.sequences.map((B0,k0)=>{let p=UQ[k0];if(!p)return B0;return{...B0,stableId:p.stableId,contentHash:p.contentHash,mediaProps:p.mediaProps??null,placeholder:p.placeholder??null,mediaTag:p.mediaTag??B0.mediaTag,mediaSrc:p.mediaSrc??B0.mediaSrc,replaceable:!!(p.mediaCdId||p.mediaArrayRef),layers:Array.isArray(p.layers)?p.layers:[],hidden:!!p.hidden}});R0(F0),G8(W0.audio||[]),t8(W0.transitions||[]),AX(W0.total)},[T5,UQ,B,V7,J0]);let iX=u.useCallback(()=>{tY((j)=>{let y=!j,t=Z?m8.current.get(Z):null;if(t&&t.contentWindow)try{t.contentWindow.postMessage({dgn:"view-annotations",visible:y},"*")}catch{}return y})},[Z]),KX=u.useCallback((j)=>{for(let y of m8.current.values())try{y.contentWindow.postMessage({dgn:"view-chrome",...j},"*")}catch{}},[]),o0=u.useCallback(()=>{QH((j)=>{let y=!j;return KX({minimap:y}),y})},[KX]),VQ=u.useCallback(()=>{YH((j)=>{let y=!j;return KX({zoom:y}),y})},[KX]),a0=u.useCallback(()=>{aW((j)=>{let y=!j;return KX({present:y}),y})},[KX]),cQ=u.useCallback(()=>{aW(!1),KX({present:!1})},[KX]),QG=u.useCallback(()=>{if(!Z||Z===d8)return;dX((j)=>{let y=!j;return O8({dgn:"view-chrome",print:y}),fetch("/_api/canvas-meta",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:Z,patch:{overlays:{print:y}}})}).catch(()=>{}),y})},[Z,O8]);u.useEffect(()=>{let j=!1;return fetch("/_api/git-user").then((y)=>y.json()).then((y)=>{if(j)return;let t=y&&typeof y.name==="string"?y.name.trim():"";if(t)$K(t)}).catch(()=>{}),()=>{j=!0}},[]),u.useEffect(()=>{if(!Z||Z===d8){ZQ(0),dX(!1);return}let j=!1;return fetch("/_api/canvas-meta?file="+encodeURIComponent(Z)).then((y)=>y.json()).then((y)=>{if(j)return;let t=Array.isArray(y?.artboards)?y.artboards.length:0;ZQ(t),dX(y?.overlays?.print===!0),oQ(new Set(Array.isArray(y?.locked)?y.locked:[]))}).catch(()=>{if(!j)ZQ(0),dX(!1),oQ(new Set)}),()=>{j=!0}},[Z]),u.useEffect(()=>{if(!Z||Z===d8||!J0)return;let j=setTimeout(()=>{O8({dgn:"request-layers",artboardId:J0})},250);return()=>clearTimeout(j)},[Z,J0,O8]);let[iQ,oQ]=u.useState(()=>new Set),YG=u.useCallback((j)=>{if(!Z||Z===d8)return;oQ((y)=>{let t=new Set(y);if(t.has(j))t.delete(j);else t.add(j);let W0=[...t];return fetch("/_api/canvas-meta",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:Z,patch:{locked:W0}})}).catch(()=>{}),O8({dgn:"locked-set",locked:W0}),t})},[Z,O8]);u.useEffect(()=>{if(!Z||Z===d8)return;O8({dgn:"locked-set",locked:[...iQ]})},[iQ,Z,O8]),u.useEffect(()=>{try{document.documentElement.setAttribute("data-theme",T9),localStorage.setItem(Z00,T9)}catch{}for(let j of m8.current.values())try{j.contentWindow.postMessage({dgn:"theme",theme:T9},"*")}catch{}},[T9]),u.useEffect(()=>{try{localStorage.setItem(Se,w9?"1":"0")}catch{}},[w9]),u.useEffect(()=>{try{localStorage.setItem(ke,_6?"1":"0")}catch{}},[_6]),u.useEffect(()=>{try{localStorage.setItem(Ce,JSON.stringify(a9))}catch{}},[a9]),u.useEffect(()=>{try{localStorage.setItem(be,mJ?"1":"0")}catch{}},[mJ]),u.useEffect(()=>{try{localStorage.setItem(ye,uJ?"1":"0")}catch{}},[uJ]),u.useEffect(()=>{try{localStorage.setItem(je,pX?"1":"0")}catch{}},[pX]),u.useEffect(()=>{let j=!1;return fetch("/_api/ui-prefs").then((y)=>y.ok?y.json():Promise.reject(Error(`HTTP ${y.status}`))).then((y)=>{if(j||!y||typeof y!=="object")return;if(y.theme==="light"||y.theme==="dark")Y9(y.theme);if(typeof y.minimap==="boolean")QH(y.minimap);if(typeof y.zoom==="boolean")YH(y.zoom);if(typeof y.annotations==="boolean")tY(y.annotations);if(typeof y.autoOpenInspector==="boolean")lW(y.autoOpenInspector);if(y.panelSides&&typeof y.panelSides==="object")O5({...OK,...y.panelSides});if(y.layersMode==="separate"||y.layersMode==="in-inspector")mY(y.layersMode)}).catch(()=>{}).finally(()=>{if(!j)kK(!0)}),()=>{j=!0}},[]),u.useEffect(()=>{if(!JH)return;Eq0({theme:T9,minimap:mJ,zoom:uJ,annotations:pX,autoOpenInspector:xJ,panelSides:u7,layersMode:Z7})},[JH,T9,mJ,uJ,pX,xJ,u7,Z7]),u.useEffect(()=>{try{localStorage.setItem(fe,JSON.stringify(u7))}catch{}},[u7]),u.useEffect(()=>{try{localStorage.setItem(ve,Z7)}catch{}},[Z7]);let WG=u.useCallback((j,y)=>{m7((t)=>{let W0=t[j],F0=W0===void 0?y:W0;return{...t,[j]:!F0}})},[]),I5=u.useCallback(()=>{Y9((j)=>j==="dark"?"light":"dark")},[]),Y7=u.useCallback(async()=>{try{let y=await(await fetch("/_index-data")).json();Y(y.project||"Design");let t=y.groups.map((W0)=>({...W0,tree:$q0(W0.paths,W0.stripPrefix,W0.dirs)}));J(t),c0((W0)=>({...W0,canvasDesignSystems:y.canvasDesignSystems??{},canvasKinds:y.canvasKinds??{}}))}catch(j){console.error("failed to load tree",j)}},[]);u.useEffect(()=>{Y7()},[Y7]);let lJ=u.useCallback(async(j)=>{try{let y=j?`/_system-data?ds=${encodeURIComponent(j)}`:"/_system-data",t=await fetch(y);if(!t.ok){console.error("failed to load system-data",t.status);return}let W0=await t.json();if(!j&&W0?.defaultDesignSystem&&!W0.ds){b8(W0);let F0=await fetch(`/_system-data?ds=${encodeURIComponent(W0.defaultDesignSystem)}`);if(F0.ok)b8(await F0.json());return}b8(W0)}catch(y){console.error("failed to load system-data",y)}},[]),Q4=u.useCallback(async()=>{try{let y=await(await fetch("/_comments-all")).json();m0(y||{})}catch(j){console.error("failed to load comments",j)}},[]);u.useEffect(()=>{Q4()},[Q4]),u.useEffect(()=>{let j=null;function y(){let t=location.protocol==="https:"?"wss:":"ws:",W0=new WebSocket(t+"//"+location.host+"/_ws");zQ.current=W0,W0.addEventListener("open",()=>{s(!0),clearInterval(j),j=setInterval(()=>{if(W0.readyState===WebSocket.OPEN)W0.send('{"type":"ping"}')},25000)}),W0.addEventListener("close",()=>{s(!1),clearInterval(j),setTimeout(y,1000)}),W0.addEventListener("error",()=>{}),W0.addEventListener("message",(F0)=>{try{let B0=JSON.parse(F0.data);if(B0.type==="snapshot"&&B0.state)N((k0)=>Q00(B0.state.selected,k0));else if(B0.type==="selected"){if(Date.now()-R.current<2000)return;let k0=B0.selected,p=Array.isArray(k0)?k0[0]:k0,_0=F.current,L0=Array.isArray(_0)?_0[0]:_0;if(N((p0)=>Q00(k0,p0)),p?.id&&p.file&&(!L0||L0.id!==p.id||L0.file!==p.file))O(p)}else if(B0.type==="comments"&&typeof B0.file==="string")m0((k0)=>({...k0,[B0.file]:B0.comments||[]}));else if(B0.type==="ai-activity"&&typeof B0.file==="string"){if(HQ(!0),lQ.current)clearTimeout(lQ.current);lQ.current=setTimeout(()=>HQ(!1),8000);for(let k0 of m8.current.values())try{k0.contentWindow.postMessage({dgn:"ai-activity",file:B0.file,entry:B0.entry},"*")}catch{}}else if(B0.type==="export:job"&&B0.payload)rY.upsert(B0.payload);else if(B0.type==="sync:status"&&B0.payload)X0(B0.payload);else if(B0.type==="canvas-list-update"){if(Y7(),B0.payload?.action==="moved"&&B0.payload.fromRel&&B0.payload.rel){let k0=(y0?.designRel||y0?.designRoot||".design").replace(/^\/+|\/+$/g,""),p=`${k0}/${B0.payload.fromRel}`,_0=`${k0}/${B0.payload.rel}`;G((L0)=>L0.map((p0)=>p0.path===p?{path:_0}:p0)),H((L0)=>L0===p?_0:L0)}}else if(B0.type==="config-updated")N8();else if(B0.type==="acp-focus"){if(X9())gJ("assistant")}else if(B0.type==="git-status"&&B0.payload)z0(B0.payload);else if(B0.type==="git-lifecycle"&&B0.payload){c(B0.payload);for(let k0 of m8.current.values())try{k0.contentWindow.postMessage({dgn:"git-lifecycle",payload:B0.payload},"*")}catch{}}}catch{}})}return y(),()=>{if(clearInterval(j),zQ.current)zQ.current.close()}},[Y7,N8]);function T7(j){let y=zQ.current;try{if(y&&y.readyState===1)y.send(JSON.stringify(j))}catch{}}let UX=u.useCallback(async()=>{try{let j=await fetch("/_api/git/status");if(j.ok)z0(await j.json())}catch{}},[]),IX=u.useCallback(async()=>{try{let j=await fetch("/_api/git/status?remote=1");if(!j.ok)return;let y=await j.json();if(y&&y.repo!==!1)X8({remoteAhead:!!y.remoteAhead,behind:y.behind||0})}catch{}},[]),VX=u.useCallback(async(j,y)=>{try{let t=await fetch(j,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(y||{})}),W0=await t.json().catch(()=>({}));return{ok:t.ok,...W0}}catch(t){return{ok:!1,error:"Network error — is the project still open?"}}},[]),GG=u.useCallback(async(j,y)=>{let t=await VX("/_api/git/commit",{message:j,files:y});if(t.ok)await UX();return t},[VX,UX]),Y4=u.useCallback(async(j)=>{let y=await VX("/_api/git/discard",{files:j});if(y.ok)await UX();return y},[VX,UX]),ZG=u.useCallback(async()=>{let j=await VX("/_api/git/push",{});if(j.ok)await UX(),IX();return j},[VX,UX,IX]),W4=u.useCallback(async()=>{let j=await VX("/_api/git/pull",{});if(j.ok)await UX(),IX();if(j.conflict&&Array.isArray(j.files)&&j.files.length)z8({file:j.files[0],conflict:!0});return j},[VX,UX,IX]),HG=u.useCallback(async(j)=>{let y=await VX("/_api/git/resolve",{choice:j});if(y.ok)await UX(),IX();return y},[VX,UX,IX]),G4=u.useCallback(async(j)=>{try{let y="/_api/git/log?limit=40"+(j?`&path=${encodeURIComponent(j)}`:""),t=await fetch(y);if(!t.ok)return[];return(await t.json()).entries||[]}catch{return[]}},[]),zG=u.useMemo(()=>{let j={modified:"M",added:"A",deleted:"D",untracked:"U"},y=new Map;for(let t of D0?.files||[])y.set(t.path,j[t.status]);return y},[D0]),Z4=D0?.files?.length||0;u.useEffect(()=>{if(D0?.repo===!1)return;IX();let j=setInterval(IX,d0?60000:120000);return()=>clearInterval(j)},[D0?.repo,d0,IX]);let H6=u.useCallback((j)=>{if(G((y)=>{for(let t of y)if(t.path!==j)m8.current.delete(t.path);return[{path:j}]}),H(j),K8(null),U(null),j!==d8)p9(j)},[]),H4=u.useRef(!1);u.useEffect(()=>{if(H4.current)return;if(!y0.cloud)return;if(W.length>0)return;if(!X.length)return;let j=null;for(let y of X){for(let t of y.paths||[]){if(!XQ.test(t))continue;if(/(^|\/)system\//.test(t))continue;j=t;break}if(j)break}if(!j)return;H4.current=!0,H6(j)},[y0.cloud,X,W.length,H6]);let pJ=u.useCallback((j)=>{let y=typeof j==="string"?j:void 0;if(y)lJ(y);else if(!W8)lJ();H6(d8)},[W8,lJ,H6]);u.useEffect(()=>{T7({type:"tabs",tabs:W.map((j)=>j.path).filter((j)=>j!==d8)})},[W]),u.useEffect(()=>{if(Z&&Z!==d8)T7({type:"active",file:Z});else if(Z===d8)T7({type:"active",file:""});else T7({type:"active",file:""})},[Z]);let nQ=u.useCallback((j)=>{G((y)=>{let t=y.findIndex((F0)=>F0.path===j);if(t<0)return y;let W0=y.filter((F0)=>F0.path!==j);if(j===Z)if(W0.length===0)H(null);else H(W0[Math.max(0,t-1)].path);return W0}),m8.current.delete(j),p9((y)=>y===j?null:y)},[Z]),qJ=u.useCallback(()=>{if(!Z||Z===d8){if(Z===d8)lJ();return}let j=m8.current.get(Z);if(j)j.src=j.src},[Z,lJ]),z4=u.useCallback(()=>Y7(),[Y7]),[KG,K4]=u.useState(!1),rQ=u.useRef(!1),aQ=u.useCallback(async()=>{if(rQ.current)return;rQ.current=!0,K4(!0);try{await Promise.all([Y7(),new Promise((j)=>setTimeout(j,550))])}finally{rQ.current=!1,K4(!1)}},[Y7]);u.useEffect(()=>{let j=null,y=()=>{if(j)clearTimeout(j);j=setTimeout(()=>{j=null,z4()},150)};return window.addEventListener("focus",y),()=>{if(window.removeEventListener("focus",y),j)clearTimeout(j)}},[z4]);let UG=u.useCallback(async(j)=>{try{let y=await fetch("/_api/canvas",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:j,kind:"brief-board"})}),t=await y.json().catch(()=>({}));if(!y.ok||!t.ok)return{ok:!1,error:t.error||`create failed (${y.status})`};return await Y7(),H6(t.file),{ok:!0,file:t.file}}catch(y){return{ok:!1,error:y instanceof Error?y.message:"network error"}}},[Y7,H6]),U4=u.useCallback(async()=>{let j=await zX("New video name");if(!j)return;let t=(await zX("Size — 1920x1080 (landscape), 1080x1920 (portrait), 1080x1080 (square), or custom WxH","1920x1080")||"1920x1080").toLowerCase().match(/(\d{2,5})\s*[x×]\s*(\d{2,5})/),W0=t?Number(t[1]):1920,F0=t?Number(t[2]):1080,B0=Math.max(1,Math.min(60,Number(await zX("Frames per second","30"))||30));try{let k0=await fetch("/_api/canvas",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:j,kind:"video-comp",clips:[],fps:B0,width:W0,height:F0})}),p=await k0.json().catch(()=>({}));if(!k0.ok||!p.ok){x8(`New video failed: ${p.error||`error ${k0.status}`}`);return}await Y7(),H6(p.file),o9(!0),x8("New video created — drop clips on the timeline to start the cut.",!0)}catch(k0){x8(`New video failed: ${k0 instanceof Error?k0.message:"network error"}`)}},[Y7,H6,zX]),VG=u.useCallback(async()=>{if(!Z||Z===d8)return;try{let j=await fetch(`/_api/annotations?file=${encodeURIComponent(Z)}`),y=j.ok?await j.text():"",t=[];if(y){let p=new DOMParser().parseFromString(y,"image/svg+xml");for(let _0 of p.querySelectorAll('[data-tool="mediaref"]')){let L0=_0.getAttribute("data-src");if(!L0)continue;t.push({src:L0,mediaKind:_0.getAttribute("data-media-kind")==="audio"?"audio":"video"})}}if(t.length===0){window.alert("Drop video/audio clips on the canvas first, then assemble them into a video.");return}let F0=`${vW(wK(Z)).replace(/\.tsx$/i,"")} Video`,B0=await fetch("/_api/canvas",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:F0,kind:"video-comp",clips:t})}),k0=await B0.json().catch(()=>({}));if(!B0.ok||!k0.ok){window.alert(`Assemble failed: ${k0.error||`error ${B0.status}`}`);return}await Y7(),H6(k0.file)}catch(j){window.alert(`Assemble failed: ${j instanceof Error?j.message:"network error"}`)}},[Z,Y7,H6]),sQ=u.useCallback(({accept:j,resolveTarget:y})=>{let t=Z,W0=D7||void 0,F0=document.createElement("input");F0.type="file",F0.accept=j,F0.style.cssText="position:fixed;left:-9999px;top:0;width:1px;height:1px;opacity:0;pointer-events:none",document.body.appendChild(F0);let B0=()=>{if(F0.isConnected)F0.remove()};window.addEventListener("focus",()=>setTimeout(B0,300),{once:!0}),F0.addEventListener("change",()=>{let k0=F0.files?.[0];if(B0(),!k0)return;let p=`/_api/comp-clips?canvas=${encodeURIComponent(t)}${W0?`&artboardId=${encodeURIComponent(W0)}`:""}`;fetch(p).then((_0)=>_0.json().catch(()=>({}))).then((_0)=>{let L0=y(_0);if(!L0)return x8("No replaceable media here (its src is computed) — edit via chat."),null;return fetch("/_api/asset",{method:"POST",headers:{"Content-Type":k0.type||"application/octet-stream"},body:k0}).then((p0)=>p0.json().catch(()=>({}))).then((p0)=>{if(!p0?.path)return x8(`Upload failed: ${p0?.error||"unknown error"}`),null;if(L0.arrayRef)return fetch("/_api/edit-array-src",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({canvas:t,arrayName:L0.arrayRef.arrayName,index:L0.arrayRef.index,field:L0.arrayRef.field,value:p0.path})});return fetch("/_api/edit-attr",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({canvas:t,id:L0.cdId,attr:"src",value:p0.path})})})}).then((_0)=>_0?_0.json():null).then((_0)=>{if(_0&&!_0.ok)x8(`Replace refused: ${_0.error||"failed"}`);else if(_0&&_0.ok){if(x8("Media replaced.",!0),_0.seq!=null)R7(t,_0.seq,"replace media")}}).catch(()=>x8("Replace failed: network error"))}),F0.click()},[Z,D7,R7]),qG=u.useCallback(async(j,y)=>{if(!window.confirm(`Move “${y}” to trash?
|
|
5653
|
+
`).length," lines, paths & secrets scrubbed) —"," ",M("details",{className:"rb-details",children:[z("summary",{children:"view"}),z("pre",{className:"rb-log",children:H.logs.serverLogTail})]})]})]}):null,X9()&&B.length>0&&M("label",{className:"rb-check",children:[z("input",{type:"checkbox",checked:F.crashLogs,onChange:(l)=>D({...F,crashLogs:l.target.checked})}),M("span",{children:["Crash logs (",B.length,") — ",z("code",{children:B.map((l)=>l.name).join(", ")})]})]})]}),M("p",{className:"rb-hint",children:["Your description and the system info above become a"," ",z("strong",{children:"public GitHub issue"}),"; screenshots and logs go to a private repository only maintainers can open."]}),M("footer",{className:"rb-actions",children:[z("button",{type:"button",className:"st-btn",onClick:()=>W("describe"),children:"Back"}),z("button",{type:"button",className:"st-btn rb-primary","data-testid":"report-bug-send",onClick:o,children:"Send report"})]})]}),Y==="sending"&&z("p",{className:"rb-hint",children:"Sending your report…"}),Y==="done"&&M(G0,{children:[P?.issueUrl?M("p",{children:["Thank you — your report is filed as"," ",M("button",{type:"button",className:"rb-link","data-testid":"report-bug-issue-link",onClick:()=>{if(X9())mU(P.issueUrl).catch(()=>navigator.clipboard?.writeText(P.issueUrl));else window.open(P.issueUrl,"_blank","noopener")},children:["report #",P.issueNumber]})," ","on the public Maude issue tracker. Screenshots and logs stay in a private repository only maintainers can open — the issue links to them."]}):M("p",{children:["The bundle is saved locally",P?.fallbackDir?M(G0,{children:[" ","at ",z("code",{children:P.fallbackDir})]}):null," ","and a prefilled GitHub issue was opened — attach the bundle files there."]}),z("footer",{className:"rb-actions",children:z("button",{type:"button",className:"st-btn rb-primary",onClick:h,children:"Done"})})]}),Y==="fallback"&&M(G0,{children:[z("p",{className:"rb-error","data-testid":"report-bug-error",children:k}),z("p",{className:"rb-hint",children:"You can save the report locally instead and file it on GitHub yourself — the prefilled issue carries the text; screenshots stay on this machine unless you attach them by hand."}),M("footer",{className:"rb-actions",children:[z("button",{type:"button",className:"st-btn",onClick:()=>W("preview"),children:"Back"}),z("button",{type:"button",className:"st-btn rb-primary",onClick:x,children:"Save locally & open GitHub"})]})]})]})]})})}var ZJ=v8(p8(),1);function Kx(X){if(typeof X!=="string")return null;let J=X.match(/^(\d+)\.(\d+)\.(\d+)/);return J?[Number(J[1]),Number(J[2]),Number(J[3])]:null}function Ux(X,J){let Q=Kx(X),Y=Kx(J);if(!Q)return!1;if(!Y)return!0;for(let W=0;W<3;W++)if(Q[W]!==Y[W])return Q[W]>Y[W];return!1}function Vx(X,J){if(!Array.isArray(X))return[];return X.filter((Q)=>Q&&(Q.version==null||Ux(Q.version,J)))}function qx(X,J){let Q=J;if(Array.isArray(X)){for(let Y of X)if(Y&&Y.version&&Ux(Y.version,Q))Q=Y.version}return Q}var rA="mdcc-whatsnew-seen",aA="mdcc-whatsnew-toast-dismissed";function Vz0(X){return typeof X==="string"&&/^https?:\/\//i.test(X)}function qz0(X){try{let J=localStorage.getItem(rA);if(J)return J;localStorage.setItem(rA,X)}catch{}return X}function Bz0(){try{return localStorage.getItem(aA)}catch{return null}}function Bx(X){let[J,Q]=ZJ.useState([]),[Y,W]=ZJ.useState(X),[G,Z]=ZJ.useState(()=>qz0(X)),[H,K]=ZJ.useState(()=>Bz0()),[U,q]=ZJ.useState(!1);ZJ.useEffect(()=>{let O=!1,P=()=>{fetch("/_api/whats-new").then(($)=>$.json()).then(($)=>{if(O)return;if(Q(Array.isArray($?.entries)?$.entries:[]),typeof $?.version==="string")W($.version)}).catch(()=>{})};P();let I=()=>P(),k=()=>{if(document.visibilityState==="visible")P()};return window.addEventListener("focus",I),document.addEventListener("visibilitychange",k),()=>{O=!0,window.removeEventListener("focus",I),document.removeEventListener("visibilitychange",k)}},[]);let B=Vx(J,G),N=B.length>0&&H!==Y&&!U,F=B[0]??null,D=ZJ.useCallback(()=>{let O=qx(J,Y);Z(O),K(Y);try{localStorage.setItem(rA,O),localStorage.setItem(aA,Y)}catch{}},[J,Y]),_=ZJ.useCallback(()=>{K(Y);try{localStorage.setItem(aA,Y)}catch{}},[Y]),R=ZJ.useCallback(()=>q(!0),[]),w=ZJ.useCallback(()=>{q(!1),D()},[D]);return{entries:J,unseen:B,feedVersion:Y,panelOpen:U,openPanel:R,closePanel:w,showToast:N,toastEntry:F,dismissToast:_,markAllSeen:D}}function Nx({wn:X}){if(!X.showToast||!X.toastEntry)return null;let J=X.toastEntry,Q=X.unseen.length;return M("div",{className:"st-toast",role:"status","aria-live":"polite",children:[z("button",{type:"button",className:"st-toast-close","aria-label":"Dismiss",onClick:X.dismissToast,children:"×"}),M("div",{className:"st-toast-hd",children:[z("span",{"aria-hidden":"true",children:"✦"}),"What's new",J.version?` · v${J.version}`:""]}),z("div",{className:"st-toast-title",children:J.title}),z("div",{className:"st-toast-txt",children:J.summary}),M("div",{className:"st-toast-actions",children:[z("button",{type:"button",className:"btn btn--primary btn--sm",onClick:X.openPanel,children:Q>1?`See all (${Q})`:"Details"}),z("button",{type:"button",className:"btn btn--ghost btn--sm",onClick:X.dismissToast,children:"Dismiss"})]})]})}function Fx({wn:X,onStartTour:J}){let{panelOpen:Q,closePanel:Y}=X;if(ZJ.useEffect(()=>{if(!Q)return;function G(Z){if(Z.key==="Escape")Y()}return window.addEventListener("keydown",G),()=>window.removeEventListener("keydown",G)},[Q,Y]),!Q)return null;let W=new Set(X.unseen.map((G)=>G.id));return z("div",{className:"help-modal-backdrop",role:"presentation",onMouseDown:(G)=>{if(G.target===G.currentTarget)Y()},children:M("div",{className:"mdcc-wn-panel",role:"dialog","aria-modal":"true","aria-labelledby":"mdcc-wn-title",children:[M("header",{className:"help-modal-hd",children:[z("span",{className:"title",id:"mdcc-wn-title",children:"✦ What’s new in maude"}),z("button",{type:"button",className:"help-modal-close","aria-label":"Close (Esc)",onClick:Y,children:"×"})]}),z("div",{className:"mdcc-wn-panel__body",children:X.entries.length===0?z("p",{className:"mdcc-wn-empty",children:"Nothing new yet."}):z("ul",{className:"mdcc-wn-list",children:X.entries.map((G)=>M("li",{className:"mdcc-wn-item"+(W.has(G.id)?" is-unseen":""),children:[M("div",{className:"mdcc-wn-item__hd",children:[z("span",{className:"mdcc-wn-kind mdcc-wn-kind--"+G.kind,children:G.kind}),z("span",{className:"mdcc-wn-item__title",children:G.title}),z("span",{className:"mdcc-wn-item__ver",children:G.version?`v${G.version}`:"next"})]}),z("p",{className:"mdcc-wn-item__summary",children:G.summary}),Vz0(G.learnMore)&&z("a",{className:"mdcc-wn-item__more",href:G.learnMore,target:"_blank",rel:"noreferrer",children:"Learn more →"}),J&&Array.isArray(G.tour)&&G.tour.length>0&&z("button",{type:"button",className:"mdcc-wn-item__tour",onClick:()=>{Y(),J(G.tour)},children:"▶ Take tour"})]},G.id))})})]})})}var Q7=({as:X,size:J=14})=>z(X,{size:J,strokeWidth:1.75,style:{display:"block"}}),Te="mdcc-usage-tour-seen",Ie="mdcc-collab-tour-seen",d8="__system__",Z00="mdcc-theme",ke="mdcc-show-hidden",Ce="mdcc-sections-expanded",$e="maude-cp-mode",Se="mdcc-sidebar-open",be="mdcc-minimap-visible",ye="mdcc-zoomctl-visible",je="mdcc-annotations-visible";var wq0=30000;function Eq0(X){try{fetch("/_api/ui-prefs",{method:"POST",headers:{"content-type":"text/plain"},body:JSON.stringify(X)}).catch(()=>{})}catch{}}var uR=[{id:"tree",label:"Files"},{id:"layers",label:"Layers"},{id:"inspector",label:"Inspector"},{id:"comments",label:"Comments"},{id:"changes",label:"Changes"},{id:"sync",label:"Sync"},{id:"assistant",label:"Assistant"}],OK={tree:"left",layers:"left",inspector:"right",comments:"right",changes:"right",sync:"right",assistant:"right"},fe="mdcc-panel-sides",ve="mdcc-layers-mode";function he({side:X,width:J,open:Q,ids:Y,activeId:W,onPick:G,children:Z,labels:H=null}){return M("div",{className:"st-dockslot st-dockslot--"+X+(Q?"":" is-collapsed"),style:{width:Q?J:0,flexBasis:Q?J:0},children:[Q&&Y.length>1&&z("div",{className:"st-docktabs",role:"tablist","aria-label":X+" panels",children:Y.map((K)=>z("button",{type:"button",role:"tab","aria-selected":W===K,className:"st-docktab"+(W===K?" is-active":""),onClick:()=>G(K),children:H?.[K]||(uR.find((U)=>U.id===K)||{}).label||K},K))}),Z]})}var XQ=/\.(tsx|html?)$/i,Pq0=[[/\.md$/i,"markdown"],[/\.(css|json|txt|ya?ml)$/i,"text"],[/\.(svg|png|jpe?g|gif|webp|avif)$/i,"image"],[/\.(mp4|webm|mov)$/i,"video"],[/\.(mp3|wav|ogg|m4a)$/i,"audio"],[/\.(woff2?|ttf|otf)$/i,"font"]];function lR(X){for(let[J,Q]of Pq0)if(J.test(X))return Q;return null}function NF(X){return X.replace(/^\.[^/]+\//,"").replace(XQ,"").replace(/[^a-z0-9]+/gi,"-").toLowerCase().replace(/^-+|-+$/g,"")}var pR="0.60.2";function xe(X,J){let Q=()=>{try{if(typeof Notification<"u"&&Notification.permission==="granted")new Notification(X,{body:J})}catch{}};if(X9()){S7("send_notification",{title:X,body:J}).catch(Q);return}Q()}function Rq0(){if(typeof window>"u")return"dark";try{let X=localStorage.getItem(Z00);if(X==="light"||X==="dark")return X}catch{}return"dark"}function rZ(X,J){if(typeof window>"u")return J;try{let Q=localStorage.getItem(X);if(Q==="1")return!0;if(Q==="0")return!1}catch{}return J}function vR(X,J){if(typeof window>"u")return J;try{let Q=localStorage.getItem(X);return Q?JSON.parse(Q):J}catch{return J}}function Tq0(X){if(X.kind==="runtime")return!1;if(X.label==="Design system")return!1;return!0}function wK(X){return X.split("/").pop()}function x8(X,J=!1,Q){if(typeof document>"u")return;let Y=document.getElementById("st-op-toast");if(!Y)Y=document.createElement("div"),Y.id="st-op-toast",Y.setAttribute("role","status"),Y.style.cssText="position:fixed;left:50%;bottom:64px;transform:translateX(-50%);z-index:80;display:flex;align-items:center;gap:10px;max-width:440px;padding:8px 14px;border-radius:8px;font:12px/1.45 var(--font-mono,monospace);box-shadow:0 8px 28px rgba(0,0,0,.34);pointer-events:none;opacity:0;transition:opacity 140ms ease;",document.body.appendChild(Y);Y.style.background=J?"#1d3524":"#3a1d1d",Y.style.color=J?"#b7e4c0":"#f1b8b8",Y.textContent="";let W=document.createElement("span");if(W.textContent=X,Y.appendChild(W),Q){let G=document.createElement("button");G.type="button",G.textContent=Q.label,G.style.cssText="pointer-events:auto;background:none;border:0;text-decoration:underline;color:inherit;font:inherit;cursor:pointer;padding:0;",G.onclick=()=>{Q.onClick(),Y.style.opacity="0",Y.style.pointerEvents="none"},Y.appendChild(G)}Y.style.opacity="1",Y.style.pointerEvents=Q?"auto":"none",clearTimeout(x8._t),x8._t=setTimeout(()=>{Y.style.opacity="0",Y.style.pointerEvents="none"},Q?6000:3200)}var ge="maude-browse-hint-seen";function Iq0(X=!1){if(typeof document>"u"||typeof localStorage>"u")return;try{if(localStorage.getItem(ge)==="1")return}catch{return}if(document.getElementById("st-browse-hint"))return;let J=document.createElement("div");J.id="st-browse-hint",J.setAttribute("role","status"),J.style.cssText="position:fixed;left:50%;bottom:64px;transform:translateX(-50%);z-index:81;display:flex;align-items:center;gap:10px;max-width:520px;padding:10px 14px;border-radius:10px;font:12px/1.5 var(--font-ui,system-ui,sans-serif);background:var(--surface-2,#1b1e24);color:var(--text-1,#e7eaf0);border:1px solid var(--border-1,#333a45);box-shadow:0 10px 34px rgba(0,0,0,.42);opacity:0;transition:opacity 160ms ease;",J.innerHTML="<span>Your mock is <strong>live</strong> — click things to try it. "+'Press <kbd style="padding:1px 6px;border-radius:5px;border:1px solid var(--border-1,#333a45);background:var(--surface-3,#262b33);font-family:var(--font-mono,monospace)">V</kbd> '+(X?"to select & inspect.</span>":"to select & edit like Figma.</span>")+'<button type="button" aria-label="Dismiss" style="background:none;border:none;color:inherit;'+'cursor:pointer;font-size:15px;line-height:1;opacity:.65;padding:2px">×</button>';let Q=()=>{try{localStorage.setItem(ge,"1")}catch{}J.style.opacity="0",setTimeout(()=>J.remove(),200),document.removeEventListener("keydown",Y,!0)},Y=(W)=>{if((W.key==="v"||W.key==="V")&&!W.metaKey&&!W.ctrlKey&&!W.altKey)Q()};J.querySelector("button")?.addEventListener("click",Q),document.addEventListener("keydown",Y,!0),document.body.appendChild(J),requestAnimationFrame(()=>{J.style.opacity="1"}),setTimeout(Q,9000)}function vW(X){return X.replace(XQ,"")}function kq0(X){return X.replace(XQ,"")}function Cq0(X){let J=new Map;for(let G of X){if(!XQ.test(G.name))continue;let Z=kq0(G.name);if(!J.has(Z)||/\.tsx$/i.test(G.name))J.set(Z,G)}let Q=new Map,Y=[];for(let G of X){if(XQ.test(G.name))continue;let Z=null;for(let H of J.keys()){if(G.name===H)continue;if(G.name.startsWith(`${H}.`)){if(!Z||H.length>Z.length)Z=H}}if(Z){let H=Q.get(Z)||[];H.push(G),Q.set(Z,H)}else Y.push(G)}let W=[];for(let[G,Z]of J){let H=(Q.get(G)||[]).sort((K,U)=>K.name.localeCompare(U.name));W.push({primary:Z,sidecars:H,orphan:!1})}return W.sort((G,Z)=>G.primary.name.localeCompare(Z.primary.name)),Y.sort((G,Z)=>G.name.localeCompare(Z.name)),{canvases:W,orphans:Y.map((G)=>({primary:G,sidecars:[],orphan:!0}))}}function $q0(X,J,Q){let Y={};for(let W of Q||[]){let Z=(W.startsWith(J)?W.slice(J.length).replace(/^\/+/,""):W).split("/").filter(Boolean),H=Y;for(let K of Z)H=H[K]=H[K]||{};H._files=H._files||[]}for(let W of X){let Z=(W.startsWith(J)?W.slice(J.length).replace(/^\/+/,""):W).split("/"),H=Y;for(let K=0;K<Z.length;K++){let U=Z[K];if(K===Z.length-1)H._files=H._files||[],H._files.push({name:U,path:W});else H[U]=H[U]||{},H=H[U]}}return Y}function H00(X,J){if(!J)return X;let Q=J.toLowerCase(),Y={},W=!1,G=Object.keys(X).filter((Z)=>Z!=="_files");for(let Z of G){let H=H00(X[Z],J);if(H)Y[Z]=H,W=!0}if(X._files){let Z=X._files.filter((H)=>H.name.toLowerCase().includes(Q)||H.path.toLowerCase().includes(Q));if(Z.length)Y._files=Z,W=!0}return W?Y:null}function qF(X){return(X||[]).filter((J)=>J.status!=="resolved").length}function Sq0(X){if(!X)return"";let J=new Date(X).getTime();if(!J)return"";let Q=Math.max(0,Math.floor((Date.now()-J)/1000));if(Q<60)return Q+"s";let Y=Math.floor(Q/60);if(Y<60)return Y+"m";let W=Math.floor(Y/60);if(W<24)return W+"h";let G=Math.floor(W/24);if(G<7)return G+"d";return new Date(X).toLocaleDateString()}function z00(X){let J=0,Q=0,Y=0;for(let W of Object.values(X||{}))for(let G of W||[])if(J++,G.status==="resolved")Y++;else Q++;return{all:J,open:Q,resolved:Y}}function FF({d:X,size:J=14,color:Q}){return z("svg",{width:J,height:J,viewBox:"0 0 24 24",fill:"none",stroke:Q||"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",style:{flex:"none"},children:z("path",{d:X})})}var bq0={"chevron-down":z("polyline",{points:"3.5 6 8 10.5 12.5 6"}),"chevron-right":z("polyline",{points:"6 3.5 10.5 8 6 12.5"}),file:M(G0,{children:[z("path",{d:"M4 2h5l3 3v9H4z"}),z("polyline",{points:"9 2 9 5 12 5"})]}),folder:z("path",{d:"M2 4.5h4l1.3 1.5H14V13H2z"}),"folder-plus":M(G0,{children:[z("path",{d:"M2 4.5h4l1.3 1.5H14V13H2z"}),z("path",{d:"M8 7.5v3.5M6.25 9.25h3.5"})]}),lock:M(G0,{children:[z("rect",{x:"3.5",y:"7",width:"9",height:"6.5",rx:"1"}),z("path",{d:"M5.5 7V5a2.5 2.5 0 015 0v2"})]}),unlock:M(G0,{children:[z("rect",{x:"3.5",y:"7",width:"9",height:"6.5",rx:"1"}),z("path",{d:"M5.5 7V5a2.5 2.5 0 015-.7"})]}),search:M(G0,{children:[z("circle",{cx:"7",cy:"7",r:"4"}),z("line",{x1:"10",y1:"10",x2:"13.5",y2:"13.5"})]}),plus:M(G0,{children:[z("line",{x1:"8",y1:"3",x2:"8",y2:"13"}),z("line",{x1:"3",y1:"8",x2:"13",y2:"8"})]}),check:z("polyline",{points:"3 8.2 6.4 11.5 13 4.2"}),x:M(G0,{children:[z("line",{x1:"4.3",y1:"4.3",x2:"11.7",y2:"11.7"}),z("line",{x1:"11.7",y1:"4.3",x2:"4.3",y2:"11.7"})]}),sun:M(G0,{children:[z("circle",{cx:"8",cy:"8",r:"2.6"}),z("line",{x1:"8",y1:"1.5",x2:"8",y2:"3"}),z("line",{x1:"8",y1:"13",x2:"8",y2:"14.5"}),z("line",{x1:"1.5",y1:"8",x2:"3",y2:"8"}),z("line",{x1:"13",y1:"8",x2:"14.5",y2:"8"}),z("line",{x1:"3.4",y1:"3.4",x2:"4.4",y2:"4.4"}),z("line",{x1:"11.6",y1:"11.6",x2:"12.6",y2:"12.6"}),z("line",{x1:"12.6",y1:"3.4",x2:"11.6",y2:"4.4"}),z("line",{x1:"4.4",y1:"11.6",x2:"3.4",y2:"12.6"})]}),moon:z("path",{d:"M12.5 9.6A5 5 0 1 1 7 3a4 4 0 0 0 5.5 6.6z"}),sparkle:z("path",{d:"M8 1.8l1.4 4.8L14 8l-4.6 1.4L8 14.2l-1.4-4.8L2 8l4.6-1.4z",fill:"currentColor",stroke:"none"}),megaphone:M(G0,{children:[z("path",{d:"M2 6.7 11 4v8L2 9.3z"}),z("path",{d:"M11 5.2a2.4 2.4 0 0 1 0 5.6"}),z("path",{d:"M4.3 9.5v2.3a1.2 1.2 0 0 0 2.4 0v-1.7"})]}),bug:M(G0,{children:[z("circle",{cx:"8",cy:"9",r:"3.6"}),z("circle",{cx:"8",cy:"4.4",r:"1.3"}),z("path",{d:"M6.2 3.4 5.2 2M9.8 3.4l1-1.4"}),z("path",{d:"M4.6 7.6H2.2M4.6 9H2.2M4.6 10.6H2.5M11.4 7.6h2.4M11.4 9h2.4M11.4 10.6h2.3"})]}),"panel-left":M(G0,{children:[z("rect",{x:"2.5",y:"3",width:"11",height:"10",rx:"1.5"}),z("line",{x1:"6.4",y1:"3",x2:"6.4",y2:"13"})]}),resolve:M(G0,{children:[z("circle",{cx:"8",cy:"8",r:"5.6"}),z("polyline",{points:"5.4 8 7.2 9.9 10.6 6"})]}),reopen:M(G0,{children:[z("path",{d:"M3.2 8a5 5 0 1 1 1.4 3.5"}),z("polyline",{points:"3.2 11.4 3.2 8 6.6 8"})]}),layers:M(G0,{children:[z("polygon",{points:"8 2.2 13.8 5.5 8 8.8 2.2 5.5"}),z("polyline",{points:"2.2 9 8 12.3 13.8 9"})]}),box:z("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1.2"}),type:M(G0,{children:[z("polyline",{points:"4 4 12 4"}),z("line",{x1:"8",y1:"4",x2:"8",y2:"12"})]}),button:M(G0,{children:[z("rect",{x:"2.5",y:"5",width:"11",height:"6",rx:"3"}),z("line",{x1:"6",y1:"8",x2:"10",y2:"8"})]}),input:M(G0,{children:[z("rect",{x:"2.5",y:"5",width:"11",height:"6",rx:"1.2"}),z("line",{x1:"5",y1:"8",x2:"5",y2:"8"})]}),link:M(G0,{children:[z("path",{d:"M6.5 9.5a2.5 2.5 0 0 1 0-3.5l1.5-1.5a2.5 2.5 0 0 1 3.5 3.5l-1 1"}),z("path",{d:"M9.5 6.5a2.5 2.5 0 0 1 0 3.5l-1.5 1.5a2.5 2.5 0 0 1-3.5-3.5l1-1"})]}),list:M(G0,{children:[z("line",{x1:"6",y1:"4.5",x2:"13",y2:"4.5"}),z("line",{x1:"6",y1:"8",x2:"13",y2:"8"}),z("line",{x1:"6",y1:"11.5",x2:"13",y2:"11.5"}),z("circle",{cx:"3.2",cy:"4.5",r:"0.8",fill:"currentColor"}),z("circle",{cx:"3.2",cy:"8",r:"0.8",fill:"currentColor"}),z("circle",{cx:"3.2",cy:"11.5",r:"0.8",fill:"currentColor"})]}),eye:M(G0,{children:[z("path",{d:"M1.5 8S4 3.5 8 3.5 14.5 8 14.5 8 12 12.5 8 12.5 1.5 8 1.5 8z"}),z("circle",{cx:"8",cy:"8",r:"2"})]}),eyedropper:M(G0,{children:[z("path",{d:"M11 2.6a1.7 1.7 0 0 1 2.4 2.4l-1.2 1.2-2.4-2.4z"}),z("path",{d:"M9.5 4.6 4 10.1V12h1.9l5.5-5.5"})]}),"p-corner":z("path",{d:"M3.5 12.5V7a3.5 3.5 0 0 1 3.5-3.5h5.5"}),"p-opacity":M(G0,{children:[z("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1.5"}),z("path",{d:"M3 8h10M8 3v10",strokeWidth:"0.9",opacity:"0.55"})]}),"p-lineheight":M(G0,{children:[z("line",{x1:"6.5",y1:"4",x2:"13",y2:"4"}),z("line",{x1:"6.5",y1:"8",x2:"13",y2:"8"}),z("line",{x1:"6.5",y1:"12",x2:"13",y2:"12"}),z("path",{d:"M3.2 4.6 3.2 11.4M2 6 3.2 4.5 4.4 6M2 10 3.2 11.5 4.4 10"})]}),"p-letterspacing":M(G0,{children:[z("path",{d:"M3 4v8M13 4v8"}),z("path",{d:"M6 11.5 8 5l2 6.5M6.7 9.3h2.6",strokeWidth:"1.1"})]}),"p-gap":M(G0,{children:[z("rect",{x:"2",y:"4.5",width:"3.6",height:"7",rx:"0.6"}),z("rect",{x:"10.4",y:"4.5",width:"3.6",height:"7",rx:"0.6"}),z("path",{d:"M6.8 8h2.4M7.4 6.9 6.4 8l1 1.1M8.6 6.9 9.6 8l-1 1.1",strokeWidth:"1"})]}),"p-border":z("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"}),"p-size":M(G0,{children:[z("path",{d:"M3 13 6.6 3l3.6 10"}),z("path",{d:"M4.3 9.6h4.6"})]}),"eye-off":M(G0,{children:[z("path",{d:"M6.3 4A6.7 6.7 0 0 1 8 3.5C12 3.5 14.5 8 14.5 8a12 12 0 0 1-2 2.4M4.4 5.3A12 12 0 0 0 1.5 8S4 12.5 8 12.5a6.5 6.5 0 0 0 2.1-.35"}),z("line",{x1:"2.5",y1:"2.5",x2:"13.5",y2:"13.5"})]}),sliders:M(G0,{children:[z("line",{x1:"3",y1:"5",x2:"13",y2:"5"}),z("circle",{cx:"6",cy:"5",r:"1.7",fill:"currentColor"}),z("line",{x1:"3",y1:"11",x2:"13",y2:"11"}),z("circle",{cx:"10",cy:"11",r:"1.7",fill:"currentColor"})]}),code:M(G0,{children:[z("polyline",{points:"6 5 3 8 6 11"}),z("polyline",{points:"10 5 13 8 10 11"})]}),download:M(G0,{children:[z("line",{x1:"8",y1:"2.5",x2:"8",y2:"10"}),z("polyline",{points:"4.5 7 8 10.5 11.5 7"}),z("polyline",{points:"3 12.8 3 13.6 13 13.6 13 12.8"})]}),reload:M(G0,{children:[z("path",{d:"M14 8a6 6 0 1 1-2-4.47L14 5.33"}),z("path",{d:"M14 2v3.33h-3.33"})]}),help:M(G0,{children:[z("circle",{cx:"8",cy:"8",r:"6"}),z("path",{d:"M6.3 6.2a1.8 1.8 0 1 1 2.3 1.9c-.5.2-.6.5-.6 1v.3"}),z("line",{x1:"8",y1:"11.4",x2:"8",y2:"11.5"})]}),image:M(G0,{children:[z("rect",{x:"2.5",y:"3",width:"11",height:"10",rx:"1.5"}),z("circle",{cx:"6",cy:"6.3",r:"1.1"}),z("path",{d:"M3 12l3-2.8 2.2 1.8 2.4-3L13.5 12"})]}),vector:M(G0,{children:[z("path",{d:"M3.6 11.2C6 5 10 5 12.4 11.2"}),z("rect",{x:"1.7",y:"9.8",width:"2.6",height:"2.6",rx:"0.4"}),z("rect",{x:"11.7",y:"9.8",width:"2.6",height:"2.6",rx:"0.4"}),z("rect",{x:"6.7",y:"2.6",width:"2.6",height:"2.6",rx:"0.4"})]}),presentation:M(G0,{children:[z("rect",{x:"2.5",y:"3",width:"11",height:"7.4",rx:"1"}),z("line",{x1:"8",y1:"10.4",x2:"8",y2:"13"}),z("line",{x1:"5.6",y1:"13.4",x2:"10.4",y2:"13.4"})]}),archive:M(G0,{children:[z("rect",{x:"2.5",y:"3",width:"11",height:"3",rx:"0.8"}),z("path",{d:"M3.6 6v6.2a1 1 0 0 0 1 1h6.8a1 1 0 0 0 1-1V6"}),z("line",{x1:"6.6",y1:"8.8",x2:"9.4",y2:"8.8"})]}),external:M(G0,{children:[z("path",{d:"M11 8.5V12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1h3.5"}),z("polyline",{points:"9.5 3 13 3 13 6.5"}),z("line",{x1:"13",y1:"3",x2:"7.6",y2:"8.4"})]}),share:M(G0,{children:[z("circle",{cx:"4",cy:"8",r:"1.9"}),z("circle",{cx:"11.6",cy:"3.6",r:"1.9"}),z("circle",{cx:"11.6",cy:"12.4",r:"1.9"}),z("line",{x1:"5.7",y1:"7",x2:"9.9",y2:"4.6"}),z("line",{x1:"5.7",y1:"9",x2:"9.9",y2:"11.4"})]}),pen:M(G0,{children:[z("path",{d:"M3 13l.8-3L10.6 3.2a1.1 1.1 0 0 1 1.6 0l.6.6a1.1 1.1 0 0 1 0 1.6L6 12.2z"}),z("line",{x1:"9.6",y1:"4.2",x2:"11.8",y2:"6.4"})]}),square:z("rect",{x:"3.5",y:"3.5",width:"9",height:"9",rx:"1"})};function yq0({open:X,onClose:J,actions:Q}){let[Y,W]=u.useState(""),[G,Z]=u.useState(0),H=u.useRef(null);u.useEffect(()=>{if(X)W(""),Z(0)},[X]),u.useEffect(()=>{H.current?.querySelector(".st-pal-item.is-active")?.scrollIntoView({block:"nearest"})},[G]);let K=u.useMemo(()=>{let q=Y.trim().toLowerCase();if(!q)return Q;return Q.filter((B)=>B.label.toLowerCase().includes(q)||B.group&&B.group.toLowerCase().includes(q))},[Y,Q]);if(u.useEffect(()=>{if(G>=K.length)Z(0)},[K.length,G]),!X)return null;let U=(q)=>{J(),q.run()};return z("div",{className:"st-scrim",role:"presentation",onMouseDown:(q)=>{if(q.target===q.currentTarget)J()},children:M("div",{className:"st-palette",role:"dialog","aria-modal":"true","aria-label":"Command palette",children:[M("div",{className:"st-pal-search",children:[z(A9,{name:"search",size:18}),z("input",{autoFocus:!0,placeholder:"Type a command or search…",value:Y,"aria-label":"Command search",onChange:(q)=>W(q.target.value),onKeyDown:(q)=>{if(q.key==="Escape")q.preventDefault(),J();else if(q.key==="ArrowDown")q.preventDefault(),Z((B)=>Math.min(K.length-1,B+1));else if(q.key==="ArrowUp")q.preventDefault(),Z((B)=>Math.max(0,B-1));else if(q.key==="Enter"){if(q.preventDefault(),K[G])U(K[G])}}}),z(MX,{children:"⌘K"})]}),z("div",{className:"st-pal-list",ref:H,children:K.length===0?z("div",{className:"st-pal-empty",children:"No matching command."}):K.map((q,B)=>{let N=q.group&&(B===0||K[B-1].group!==q.group)?z("div",{className:"st-pal-group",children:q.group},"g-"+q.group):null;return M(G0,{children:[N,M("button",{type:"button",className:"st-pal-item"+(B===G?" is-active":""),onMouseEnter:()=>Z(B),onClick:()=>U(q),children:[z("span",{className:"st-pal-icon",children:z(A9,{name:q.icon,size:15})}),z("span",{className:"st-pal-label",children:q.label}),q.kbd?z("span",{className:"st-pal-kbd",children:z(MX,{children:q.kbd})}):null]})]},q.id)})})]})})}function A9({name:X,size:J=16,className:Q}){return z("svg",{className:Q,width:J,height:J,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",style:{flex:"none"},children:bq0[X]})}function jq0(X){if(!X||typeof X!=="string")return"?";let J=X.trim().split(/[\s._-]+/).filter(Boolean);if(!J.length)return"?";if(J.length===1)return J[0].slice(0,2).toUpperCase();return((J[0][0]||"")+(J[J.length-1][0]||"")).toUpperCase()||"?"}function me({initials:X,hue:J,title:Q,pulse:Y}){return z("span",{className:"st-avatar"+(Y?" is-pulsing":""),style:{"--av-hue":J},"data-tip":Q,"aria-label":Q,children:X})}function MX({children:X}){return z("span",{className:"kbd",children:X})}function ue(X,{min:J,max:Q,def:Y}){let W=u.useCallback((K)=>Math.min(Q,Math.max(J,K)),[J,Q]),[G,Z]=u.useState(()=>{try{let K=parseInt(localStorage.getItem(X)||"",10);return Number.isFinite(K)?W(K):Y}catch{return Y}});u.useEffect(()=>{try{localStorage.setItem(X,String(G))}catch{}},[X,G]);let H=u.useCallback((K)=>Z((U)=>W(typeof K==="function"?K(U):K)),[W]);return{w:G,setW:H,min:J,max:Q,def:Y}}function le({label:X,size:J,onPointerDown:Q,active:Y,dir:W="ltr"}){let{w:G,setW:Z,min:H,max:K,def:U}=J,q=W==="rtl"?-1:1;return z("div",{className:"st-grip"+(Y?" is-active":""),role:"separator",tabIndex:0,"aria-orientation":"vertical","aria-label":X,"aria-valuemin":H,"aria-valuemax":K,"aria-valuenow":Math.round(G),onPointerDown:Q,onDoubleClick:()=>Z(U),onKeyDown:(B)=>{let N=B.shiftKey?24:8;if(B.key==="ArrowRight")B.preventDefault(),Z((F)=>F+N*q);else if(B.key==="ArrowLeft")B.preventDefault(),Z((F)=>F-N*q);else if(B.key==="Home")B.preventDefault(),Z(H);else if(B.key==="End")B.preventDefault(),Z(K)},children:M("svg",{className:"st-grip-dots",viewBox:"0 0 6 18","aria-hidden":"true",children:[z("circle",{cx:"3",cy:"3",r:"1.1",fill:"currentColor"}),z("circle",{cx:"3",cy:"9",r:"1.1",fill:"currentColor"}),z("circle",{cx:"3",cy:"15",r:"1.1",fill:"currentColor"})]})})}var hR=[{id:"png",label:"PNG",sub:"raster · 2×",icon:"image",format:"png",options:{scale:2}},{id:"pdf",label:"PDF",sub:"vector · print",icon:"file",format:"pdf"},{id:"svg",label:"SVG",sub:"per artboard",icon:"vector",format:"svg"},{id:"html",label:"HTML",sub:"self-contained",icon:"code",format:"html"},{id:"pptx",label:"PPTX",sub:"slides",icon:"presentation",format:"pptx"},{id:"mp4",label:"MP4",sub:"video · H.264",icon:"presentation",format:"mp4",temporal:!0},{id:"gif",label:"GIF",sub:"animated",icon:"image",format:"gif",temporal:!0},{id:"canva",label:"Canva",sub:"handoff bundle",icon:"external",format:"canva"},{id:"zip",label:"ZIP",sub:"project bundle",icon:"archive",format:"zip"},{id:"shadcn",label:"AI handoff",sub:"production drop",icon:"sparkle",handoff:!0}],xR={selection:"Current selection",artboard:"Active artboard","canvas-as-separate":"Canvas · artboards separate","project-raw":"Whole project (raw)"},fq0={png:["selection","artboard","canvas-as-separate"],pdf:["selection","artboard","canvas-as-separate"],svg:["selection","artboard","canvas-as-separate"],html:["artboard","canvas-as-separate"],pptx:["canvas-as-separate"],mp4:["artboard"],gif:["artboard"],webm:["artboard"],canva:["canvas-as-separate"],zip:["project-raw"]},vq0=[{value:1,label:"1× (native)"},{value:2,label:"2× (retina)"},{value:3,label:"3× (max)"}],T3=[{id:"1x",label:"1× (native)",kind:"scale",value:1},{id:"2x",label:"2× (retina)",kind:"scale",value:2},{id:"3x",label:"3× (max)",kind:"scale",value:3},{id:"dpi150",label:"150 dpi",kind:"dpi",value:150},{id:"dpi300",label:"300 dpi (print)",kind:"dpi",value:300},{id:"dpi600",label:"600 dpi (high-res print)",kind:"dpi",value:600}],hq0="2x",pe=[{id:"auto",label:"Auto (1×)",value:void 0},{id:"dpi150",label:"150 dpi",value:150},{id:"dpi300",label:"300 dpi (print)",value:300},{id:"dpi600",label:"600 dpi (high-res print)",value:600}],xq0="auto",gq0={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",svg:"image/svg+xml",mp4:"video/mp4",mov:"video/quicktime",webm:"video/webm",m4v:"video/mp4",ogg:"video/ogg",mp3:"audio/mpeg",wav:"audio/wav",m4a:"audio/mp4",aac:"audio/aac",flac:"audio/flac",oga:"audio/ogg",opus:"audio/opus"};function mq0(X){let J=String(X||"").split(".").pop()?.toLowerCase();return gq0[J]||"application/octet-stream"}function uq0({designRel:X,onPick:J,onClose:Q,multiple:Y=!1,hasArtboardAnchor:W=!1,onPickMany:G}){let[Z,H]=u.useState(null),[K,U]=u.useState(!1),[q,B]=u.useState(null),[N,F]=u.useState(()=>new Set),[D,_]=u.useState({}),[R,w]=u.useState(W?"artboard":"annotation");u.useEffect(()=>{let x=!0;return fetch("/_api/assets").then((m)=>m.json()).then((m)=>{if(!x)return;let l=m.ok?m.assets:[];H(l),_((f)=>{let s={...f};for(let n of l)s[n.path]=n.kind;return s})}).catch(()=>x&&H([])),()=>{x=!1}},[]),u.useEffect(()=>{let x=(m)=>{if(m.key==="Escape")m.stopPropagation(),Q()};return window.addEventListener("keydown",x,!0),()=>window.removeEventListener("keydown",x,!0)},[Q]);let O=Array.from(N).some((x)=>(D[x]||"image")!=="image"),P=!W||O,I=!W?"No artboard on this canvas":O?"Video/audio can only be added as annotations":"";u.useEffect(()=>{if(P&&R==="artboard")w("annotation")},[P,R]);let k=(x)=>{F((m)=>{let l=new Set(m);if(l.has(x))l.delete(x);else l.add(x);return l})},$=async(x)=>{let m=await fetch("/_api/asset",{method:"POST",headers:{"content-type":x.type||"application/octet-stream"},body:x}),l=await m.json().catch(()=>({}));if(m.ok&&l.path)return{ok:!0,path:l.path};return{ok:!1,error:l.error||`upload failed (HTTP ${m.status})`}},C=async(x)=>{if(!x)return;U(!0),B(null);let m=await $(x);if(U(!1),m.ok)J(m.path);else B(m.error)},b=(x)=>{if(typeof x==="string"&&x.startsWith("video/"))return"video";if(typeof x==="string"&&x.startsWith("audio/"))return"audio";return"image"},v=async(x)=>{if(!x.length)return;U(!0),B(null);let m=await Promise.all(x.map((s)=>$(s).then((n)=>({...n,file:s}))));U(!1);let l=m.filter((s)=>s.ok),f=m.length-l.length;if(f>0)B(`${f} of ${m.length} uploads failed`);if(l.length)_((s)=>{let n={...s};for(let c of l)n[c.path]=b(c.file.type);return n}),F((s)=>{let n=new Set(s);for(let c of l)n.add(c.path);return n})},h=async()=>{U(!0),B(null);try{if(Y){let l=(await Pv()||[]).map((f)=>new File([new Uint8Array(f.bytes)],f.name,{type:mq0(f.name)}));if(U(!1),l.length)await v(l);return}let x=await BZ();if(x?.bytes){await C(new Blob([new Uint8Array(x.bytes)]));return}}catch(x){B(x?.message||"open failed")}U(!1)},d=()=>{if(X9()){h();return}let x=document.createElement("input");if(x.type="file",x.accept="image/*,video/*",Y)x.multiple=!0;x.style.cssText="position:fixed;left:-9999px;top:0;width:1px;height:1px;opacity:0;pointer-events:none",document.body.appendChild(x);let m=()=>{if(x.isConnected)x.remove()};window.addEventListener("focus",()=>setTimeout(m,300),{once:!0}),x.addEventListener("change",()=>{let l=x.files?Array.from(x.files):[];if(m(),!l.length)return;if(Y)v(l);else C(l[0])}),x.click()},o=(x)=>`/${X}/${x}`;return z("div",{className:"st-scrim",role:"presentation",onMouseDown:(x)=>{if(x.target===x.currentTarget)Q()},children:M("div",{className:"st-dialog st-asset-picker",role:"dialog","aria-modal":"true","aria-label":"Choose media",children:[M("div",{className:"st-dialog-hd",children:[z("span",{className:"st-dialog-title",children:"Choose media"}),z("button",{type:"button",className:"st-iconbtn","aria-label":"Close",onClick:Q,children:z(A9,{name:"x",size:15})})]}),M("div",{className:"st-dialog-bd",children:[M("div",{className:"st-ap-toolbar",children:[z("button",{type:"button",className:"st-btn",onClick:d,disabled:K,children:K?"Uploading…":"Upload…"}),q&&z("span",{className:"st-ap-err",children:q})]}),z("div",{className:"st-ap-grid",children:Z==null?z("div",{className:"st-ap-empty",children:"Loading…"}):Z.length===0?z("div",{className:"st-ap-empty",children:"No assets yet — upload one."}):Z.map((x)=>{let m=Y&&N.has(x.path);return M("button",{type:"button",className:"st-ap-cell","data-selected":m?"true":void 0,"aria-pressed":Y?m:void 0,title:`${x.name} · ${Math.max(1,Math.round(x.size/1024))} KB`,onClick:()=>Y?k(x.path):J(x.path),children:[Y&&z("span",{className:"st-ap-check","aria-hidden":"true",children:m?z(A9,{name:"check",size:12}):null}),x.kind==="video"?z("video",{className:"st-ap-thumb",src:o(x.path),muted:!0,playsInline:!0}):z("img",{className:"st-ap-thumb",src:o(x.path),alt:x.name,loading:"lazy"}),z("span",{className:"st-ap-name",children:x.name})]},x.path)})})]}),Y&&N.size>0&&M("div",{className:"st-dialog-ft st-ap-confirm",children:[M("span",{className:"st-ap-count",children:[N.size," selected"]}),M("div",{className:"st-ap-seg",role:"radiogroup","aria-label":"Insert as",children:[z("button",{type:"button",className:"st-ap-seg-btn","aria-pressed":R==="artboard",disabled:P,onClick:()=>w("artboard"),children:"Add to artboard"}),z("button",{type:"button",className:"st-ap-seg-btn","aria-pressed":R==="annotation",onClick:()=>w("annotation"),children:"Add as annotation"})]}),P&&z("span",{className:"st-ap-dest-note",children:I}),z("span",{className:"st-ap-confirm-spacer"}),z("button",{type:"button",className:"btn btn--ghost",onClick:Q,children:"Cancel"}),z("button",{type:"button",className:"btn btn--primary",onClick:()=>G?.(Array.from(N),R),children:"Insert"})]})]})})}function lq0({mode:X,initialScope:J,activePath:Q,hasComps:Y=!1,comps:W=[],activeArtboardId:G=null,selection:Z=null,onClose:H}){let[K,U]=u.useState(X==="handoff"?"shadcn":"png"),[q,B]=u.useState(J&&xR[J]?J:"artboard"),[N,F]=u.useState(2),[D,_]=u.useState(hq0),[R,w]=u.useState(!0),[O,P]=u.useState(!1),[I,k]=u.useState(!1),[$,C]=u.useState(!1),[b,v]=u.useState(xq0),[h,d]=u.useState(!0),[o,x]=u.useState(!1),[m,l]=u.useState(null),[f,s]=u.useState([]),n=hR.find(($0)=>$0.id===K)||hR[0],c=n.handoff?[]:fq0[n.format]||["artboard"],U0=900,X0=3600,H0=nz(W,EA(W,{artboardId:G})),a=H0?.durationInFrames||0,D0=H0?.fps||30,z0=n.temporal&&a>900,l0=n.temporal&&a>3600;u.useEffect(()=>{if(c.length&&!c.includes(q))B(c[0])},[c,q]);let X8=u.useCallback(()=>{fetch("/_api/export-history").then(($0)=>$0.json()).then(($0)=>s(Array.isArray($0?.history)?$0.history.slice(0,6):[])).catch(()=>{})},[]);u.useEffect(()=>{X8()},[X8]),u.useEffect(()=>{function $0(M0){if(M0.key==="Escape")M0.preventDefault(),H()}return window.addEventListener("keydown",$0),()=>window.removeEventListener("keydown",$0)},[H]);async function d0(){if(n.handoff){let i0=`/design:handoff ${Q&&Q!==d8?Q:"<canvas>.tsx"}`;try{await navigator.clipboard?.writeText(i0)}catch{}l({ok:!0,msg:`Copied: ${i0} — run it in Claude Code.`});return}x(!0),l(null);let $0=n.temporal?{scale:N}:{};if(n.format==="png"){let M0=T3.find((i0)=>i0.id===D)||T3[1];if(M0.kind==="dpi")$0.dpi=M0.value;else $0.scale=M0.value}if(n.format==="mp4"||n.format==="webm")$0.audio=h;if(l0)$0.maxFrames=a;if(n.format==="pdf"){$0.pdfPrint={includeBleed:R,marks:{crop:I,registration:$}};let M0=pe.find((i0)=>i0.id===b)?.value;if(M0!==void 0)$0.dpi=M0}if(G)$0.artboardId=G;if(Z?.selector)$0.selection=Z;try{let M0=await fetch("/_api/export-jobs",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({format:n.format,scope:q,options:$0})});if(!M0.ok){l({ok:!1,msg:await M0.text()||`Export failed (${M0.status})`}),x(!1);return}H()}catch(M0){l({ok:!1,msg:M0&&M0.message?M0.message:String(M0)}),x(!1)}}return z("div",{className:"st-scrim",role:"presentation",onMouseDown:($0)=>{if($0.target===$0.currentTarget)H()},children:M("div",{className:"st-dialog",role:"dialog","aria-modal":"true","aria-label":"Export and handoff",children:[M("div",{className:"st-dialog-hd",children:[z("span",{className:"st-dialog-title",children:"Export & handoff"}),z("button",{type:"button",className:"st-iconbtn","aria-label":"Close",onClick:H,children:z(A9,{name:"x",size:15})})]}),M("div",{className:"st-dialog-bd",children:[z("div",{className:"st-rp-hd",children:Q&&Q!==d8?`Format · ${vW(wK(Q))}`:"Format"}),z("div",{className:"st-fmt-grid",children:hR.filter(($0)=>!$0.temporal||Y).map(($0)=>M("button",{type:"button",className:"st-fmt"+($0.id===K?" is-on":""),onClick:()=>{U($0.id),l(null)},children:[z(A9,{name:$0.icon,size:16}),z("span",{className:"st-fmt-name",children:$0.label}),z("span",{className:"st-fmt-sub",children:$0.sub})]},$0.id))}),!n.handoff&&M("div",{className:"st-dialog-row",children:[z("label",{className:"st-dialog-lbl",htmlFor:"st-export-scope",children:"Scope"}),z("select",{id:"st-export-scope",className:"st-select",value:q,onChange:($0)=>B($0.target.value),children:c.map(($0)=>z("option",{value:$0,children:xR[$0]},$0))})]}),!n.handoff&&n.format==="png"&&M("div",{className:"st-dialog-row",children:[z("label",{className:"st-dialog-lbl",htmlFor:"st-export-size",children:"Resolution"}),z("select",{id:"st-export-size",className:"st-select",value:D,onChange:($0)=>_($0.target.value),children:T3.map(($0)=>z("option",{value:$0.id,children:$0.label},$0.id))})]}),!n.handoff&&n.format==="png"&&z("div",{className:"st-mono",style:{fontSize:11,color:"var(--fg-3)"},children:(()=>{let $0=T3.find((i0)=>i0.id===D)||T3[1],M0=$0.kind==="dpi"?$0.value/96:$0.value;return`${$0.label} ≈ ${Math.round(1440*M0)}×${Math.round(900*M0)} for a 1440×900 artboard.`})()}),!n.handoff&&n.temporal&&M("div",{className:"st-dialog-row",children:[z("label",{className:"st-dialog-lbl",htmlFor:"st-export-temporal-size",children:"Resolution"}),z("select",{id:"st-export-temporal-size",className:"st-select",value:N,onChange:($0)=>F(Number($0.target.value)),children:vq0.map(($0)=>z("option",{value:$0.value,children:$0.label},$0.value))})]}),!n.handoff&&n.temporal&&M("div",{className:"st-mono",style:{fontSize:11,color:"var(--fg-3)"},children:[N,"× the artboard's native resolution (e.g. 960×540 → ",960*N,"×",540*N,")."]}),z0&&M("div",{className:"st-mono st-export-long-notice","data-testid":"export-long-comp-notice",style:{fontSize:11,color:"var(--accent)",lineHeight:1.5},children:["⚠ Long comp: ",a," frames (≈",Math.round(a/D0),"s).",l0?` Exceeds the default ${"3600"}-frame export cap — exporting raises the cap to the full length for this run.`:""," ","If the fast renderer falls back to frame-by-frame capture this can take several minutes; 2× resolution (≈720–1080p) is recommended for memory headroom."]}),!n.handoff&&n.format==="pdf"&&M(G0,{children:[M("div",{className:"st-dialog-row",children:[z("label",{className:"st-dialog-lbl",htmlFor:"st-export-pdf-dpi",children:"Image quality"}),z("select",{id:"st-export-pdf-dpi",className:"st-select",value:b,onChange:($0)=>v($0.target.value),children:pe.map(($0)=>z("option",{value:$0.id,children:$0.label},$0.id))})]}),z("div",{className:"st-mono",style:{fontSize:11,color:"var(--fg-3)"},children:"The page stays vector; this only sets the capture density for raster content on it (dropped photos, large-format art)."}),z("div",{className:"st-dialog-row",children:M("label",{className:"st-dialog-lbl",htmlFor:"st-export-pdf-bleed",style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[z("input",{id:"st-export-pdf-bleed",type:"checkbox",checked:R,onChange:($0)=>w($0.target.checked)}),"Include bleed"]})}),z("div",{className:"st-dialog-row",children:M("button",{type:"button",className:"st-dialog-lbl",style:{background:"none",border:0,padding:0,cursor:"pointer"},onClick:()=>P(($0)=>!$0),"aria-expanded":O,children:[O?"▾":"▸"," Marks"]})}),O&&M("div",{style:{padding:"0 12px 4px",display:"flex",flexDirection:"column",gap:6},children:[M("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer",fontSize:12},children:[z("input",{type:"checkbox",checked:I,onChange:($0)=>k($0.target.checked)}),"Crop marks"]}),M("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer",fontSize:12},children:[z("input",{type:"checkbox",checked:$,onChange:($0)=>C($0.target.checked)}),"Registration marks"]})]}),M("div",{className:"st-mono",style:{fontSize:11,color:"var(--fg-3)"},children:["Bleed and marks apply to print (",z("code",{children:'kind="print"'}),") artboards only.",q==="canvas-as-separate"?" One PDF page per artboard.":""]})]}),!n.handoff&&(n.format==="mp4"||n.format==="webm")&&z("div",{className:"st-dialog-row",children:M("label",{className:"st-dialog-lbl",htmlFor:"st-export-audio",style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[z("input",{id:"st-export-audio",type:"checkbox",checked:h,onChange:($0)=>d($0.target.checked)}),"Export with audio"]})}),n.handoff&&M("div",{className:"callout callout--info",style:{fontSize:12},children:["Hands the active canvas off to production. Copies"," ",z("span",{className:"st-mono",children:"/design:handoff <path>"})," — run it in Claude Code to emit a ready-to-drop production component next to the canvas."]}),m&&z("div",{className:"callout "+(m.ok?"callout--success":"callout--error"),style:{fontSize:12},children:m.msg}),f.length>0&&M("div",{className:"st-export-recent",children:[z("div",{className:"st-rp-hd",children:"Recent"}),f.map(($0,M0)=>M("div",{className:"st-export-recent-row",children:[M("span",{children:[String($0.format||"").toUpperCase()," ·"," ",xR[$0.scope]||$0.scope]}),z("span",{className:"st-mono",children:$0.filename})]},M0))]})]}),M("div",{className:"st-dialog-ft",children:[z("button",{type:"button",className:"btn btn--ghost",onClick:H,children:"Cancel"}),M("button",{type:"button",className:"btn btn--primary",disabled:o,onClick:d0,children:[z(A9,{name:"download",size:14}),n.handoff?"Copy handoff command":o?"Exporting…":`Export ${n.label}`]})]})]})})}var MF=12,OF=16;function pq0({name:X,depth:J,defaultOpen:Q,children:Y,dirPath:W,drag:G,menu:Z}){let[H,K]=u.useState(Q),U=G?G.dropProps(W,!0,()=>K(!0)):{},q=G?.overDir===W,B=G?G.dragProps(W,!0):{},N=G?.draggedPath===W,F=G?.busyPath===W,D=M("button",{type:"button",role:"treeitem","data-testid":`tree-folder-${NF(W)}`,"aria-expanded":H,"aria-dropeffect":G?"move":void 0,"aria-busy":F||void 0,tabIndex:-1,className:"st-row"+(q?" is-drop-target":"")+(N?" is-dragging":"")+(F?" is-busy":""),style:{paddingLeft:MF+J*OF+"px"},onClick:()=>K((_)=>!_),onContextMenu:Z?(_)=>Z.openAt(_,{kind:"dir",dirPath:W}):void 0,...B,...U,children:[z("span",{className:"st-row-glyph",children:z(A9,{name:"chevron-right",className:"st-chev"+(H?" is-open":""),size:13})}),z("span",{className:"st-row-name",children:X})]});return M(G0,{children:[Z?M("div",{className:"st-row-wrap",role:"none",children:[D,z("button",{type:"button",className:"st-row-menu-btn","data-testid":`tree-row-menu-${NF(W)}`,title:`Folder actions — ${X}`,"aria-label":`Folder actions for ${X}`,"aria-haspopup":"menu",onClick:(_)=>Z.openAt(_,{kind:"dir",dirPath:W}),children:z(FF,{d:"M12 6a1 1 0 100-2 1 1 0 000 2zM12 13a1 1 0 100-2 1 1 0 000 2zM12 20a1 1 0 100-2 1 1 0 000 2z",size:12})})]}):D,H&&Y]})}function dq0({name:X,dsName:J,depth:Q,defaultOpen:Y,active:W,onOpenSystem:G,children:Z}){let[H,K]=u.useState(Y);return M(G0,{children:[M("div",{className:"st-row st-ds-folder"+(W?" is-sel":""),style:{paddingLeft:MF+Q*OF+"px"},role:"treeitem","aria-expanded":H,children:[z("button",{type:"button",className:"st-ds-chev",onClick:()=>K((U)=>!U),"aria-label":H?"Collapse design system":"Expand design system",title:H?"Collapse":"Expand",children:z(A9,{name:"chevron-right",className:"st-chev"+(H?" is-open":""),size:13})}),M("button",{type:"button",className:"st-ds-open",onClick:()=>G(J),"aria-label":`Open ${J} design system view`,title:"Open the design system view",children:[z("span",{className:"st-row-glyph",children:z(A9,{name:"folder",size:13})}),z("span",{className:"st-row-name",children:X})]})]}),H&&Z]})}function LF({file:X,activePath:J,previewPath:Q,onOpen:Y,onPreview:W,onDelete:G,openCount:Z,depth:H,kind:K,sidecar:U,dirty:q,experimentalKind:B,drag:N,menu:F}){let D=X.path===J||X.path===Q,_=XQ.test(X.name),R=!_&&K!=="runtime"?lR(X.name):null,w=!_&&!R,O=_?vW(X.name):X.name,P=_&&typeof G==="function"&&K!=="runtime",I=_&&!U&&K!=="runtime"&&typeof N<"u",k=I?N.dragProps(X.path,!0):{},$=N?.draggedPath===X.path,C=N?.busyPath===X.path,b=I&&typeof F<"u",v=X.path.split("/").slice(0,-1).join("/"),h=_?"canvas-row-"+X.path.replace(/^\.[^/]+\//,"").replace(XQ,"").replace(/[^a-z0-9]+/gi,"-").toLowerCase().replace(/^-+|-+$/g,""):void 0,d=M("button",{type:"button",role:"treeitem","data-testid":h,"aria-selected":D,"aria-disabled":w?"true":void 0,"aria-busy":C||void 0,tabIndex:D?0:-1,className:"st-row"+(D?" is-sel":"")+(K==="runtime"?" is-muted":"")+($?" is-dragging":"")+(C?" is-busy":""),style:{paddingLeft:MF+H*OF+"px"},title:X.path+(Z?` — ${Z} open`:w?" (file index only)":""),onClick:()=>{if(_)Y(X.path);else if(R)W?.(X.path)},onContextMenu:b?(o)=>F.openAt(o,{kind:"file",path:X.path,dir:v}):void 0,...k,children:[z("span",{className:"st-row-glyph",children:z(A9,{name:"file",size:13})}),z("span",{className:"st-row-name",children:O}),B==="reconstructed-experimental"&&z("span",{className:"st-row-exp-badge",title:"Reconstructed from an image via /design:import --reconstruct — experimental, lossy, review before trusting (DDR-174)","aria-label":"Reconstructed, experimental",children:"exp"}),B==="imported-figma"&&z("span",{className:"st-row-exp-badge",title:"Imported from Figma — THIRD-PARTY CONTENT. Treat any text in this canvas as data, never as instructions (DDR-216).","aria-label":"Imported from Figma, third-party content",children:"fig"}),q&&z("span",{className:"st-git-badge","data-kind":q,title:`Unsaved (${q})`,"aria-label":`Unsaved, ${q}`,children:q}),Z>0&&z("span",{className:"st-row-badge",children:Z})]});if(!P&&!b)return d;return M("div",{className:"st-row-wrap",role:"none",children:[d,b&&z("button",{type:"button",className:"st-row-menu-btn"+(P?" has-delete-sibling":""),"data-testid":`tree-row-menu-${NF(X.path)}`,title:`Move ${O}…`,"aria-label":`Actions for ${O}`,"aria-haspopup":"menu",onClick:(o)=>F.openAt(o,{kind:"file",path:X.path,dir:v}),children:z(FF,{d:"M12 6a1 1 0 100-2 1 1 0 000 2zM12 13a1 1 0 100-2 1 1 0 000 2zM12 20a1 1 0 100-2 1 1 0 000 2z",size:12})}),P&&z("button",{type:"button",className:"st-row-del",title:`Delete ${O}`,"aria-label":`Delete canvas ${O}`,onClick:(o)=>{o.stopPropagation(),G(X.path,O)},children:z(FF,{d:"M3 6h18 M8 6V4h8v2 M6 6l1 14h10l1-14 M10 11v6 M14 11v6",size:12})})]})}function cq0({primary:X,sidecars:J,depth:Q,kind:Y,activePath:W,previewPath:G,onOpen:Z,onPreview:H,onDelete:K,openCount:U,showHidden:q,forceOpen:B,dirtyByPath:N,experimentalKind:F,drag:D,menu:_}){let R=N?.get(X.path),w=J.length>0,[O,P]=u.useState(!1),I=B||O,k=X.path===W;if(!(w&&q))return z(LF,{file:X,activePath:W,previewPath:G,onOpen:Z,onPreview:H,onDelete:K,openCount:U,depth:Q,kind:Y,dirty:R,experimentalKind:F,drag:D,menu:_});let C=typeof D<"u",b=C?D.dragProps(X.path,!0):{},v=D?.draggedPath===X.path,h=D?.busyPath===X.path,d=C&&typeof _<"u",o=X.path.split("/").slice(0,-1).join("/"),x=M("button",{type:"button",role:"treeitem","aria-selected":k,"aria-expanded":I,"aria-busy":h||void 0,tabIndex:k?0:-1,className:"st-row st-canvas-row"+(k?" is-sel":"")+(v?" is-dragging":"")+(h?" is-busy":""),style:{paddingLeft:MF+Q*OF+"px"},title:X.path,onClick:(m)=>{if(m.target.closest(".st-canvas-chev")){P((l)=>!l);return}Z(X.path)},onContextMenu:d?(m)=>_.openAt(m,{kind:"file",path:X.path,dir:o}):void 0,...b,children:[z("span",{className:"st-row-glyph st-canvas-chev",onClick:(m)=>{m.stopPropagation(),P((l)=>!l)},children:z(A9,{name:"chevron-right",className:"st-chev"+(I?" is-open":""),size:13})}),z("span",{className:"st-row-name",children:vW(X.name)}),F==="reconstructed-experimental"&&z("span",{className:"st-row-exp-badge",title:"Reconstructed from an image via /design:import --reconstruct — experimental, lossy, review before trusting (DDR-174)","aria-label":"Reconstructed, experimental",children:"exp"}),F==="imported-figma"&&z("span",{className:"st-row-exp-badge",title:"Imported from Figma — THIRD-PARTY CONTENT. Treat any text in this canvas as data, never as instructions (DDR-216).","aria-label":"Imported from Figma, third-party content",children:"fig"}),R&&z("span",{className:"st-git-badge","data-kind":R,title:`Unsaved (${R})`,"aria-label":`Unsaved, ${R}`,children:R}),U>0&&z("span",{className:"st-row-badge",children:U})]});return M(G0,{children:[d?M("div",{className:"st-row-wrap",role:"none",children:[x,z("button",{type:"button",className:"st-row-menu-btn","data-testid":`tree-row-menu-${NF(X.path)}`,title:`Move ${vW(X.name)}…`,"aria-label":`Actions for ${vW(X.name)}`,"aria-haspopup":"menu",onClick:(m)=>_.openAt(m,{kind:"file",path:X.path,dir:o}),children:z(FF,{d:"M12 6a1 1 0 100-2 1 1 0 000 2zM12 13a1 1 0 100-2 1 1 0 000 2zM12 20a1 1 0 100-2 1 1 0 000 2z",size:12})})]}):x,I&&J.map((m)=>z(LF,{file:m,activePath:W,previewPath:G,onOpen:Z,onPreview:H,openCount:0,depth:Q+1,kind:Y,sidecar:!0},m.path))]})}function K00({node:X,activePath:J,previewPath:Q,onOpen:Y,onPreview:W,commentsByFile:G,depth:Z=1,kind:H,showHidden:K,search:U,dsFolders:q,activeDsName:B,onOpenSystem:N,onDelete:F,dirtyByPath:D,canvasKinds:_,dirPath:R="",drag:w,menu:O}){let P=Object.keys(X).filter((d)=>d!=="_files").sort(),I=X._files||[],{canvases:k,orphans:$}=u.useMemo(()=>Cq0(I),[I]),{mediaOrphans:C,metaOrphans:b}=u.useMemo(()=>{let d=[],o=[];for(let x of $){let m=lR(x.primary.name);(m==="image"||m==="video"||m==="audio"||m==="font"?d:o).push(x)}return{mediaOrphans:d,metaOrphans:o}},[$]),v=!!(U&&U.trim()),h=u.useMemo(()=>{if(!q||Z!==1)return null;let d=new Map;for(let o of q)d.set(o.folder,o);return d},[q,Z]);return M(G0,{children:[k.map((d)=>{let o=v&&d.sidecars.some((x)=>{let m=U.toLowerCase();return x.name.toLowerCase().includes(m)||x.path.toLowerCase().includes(m)});return z(cq0,{primary:d.primary,sidecars:d.sidecars,activePath:J,previewPath:Q,onOpen:Y,onPreview:W,onDelete:F,openCount:qF(G[d.primary.path]),depth:Z,kind:H,showHidden:K,forceOpen:o,dirtyByPath:D,experimentalKind:_?.[d.primary.path],drag:w,menu:O},d.primary.path)}),C.map((d)=>z(LF,{file:d.primary,activePath:J,previewPath:Q,onOpen:Y,onPreview:W,openCount:qF(G[d.primary.path]),depth:Z,kind:H},d.primary.path)),K&&b.map((d)=>z(LF,{file:d.primary,activePath:J,previewPath:Q,onOpen:Y,onPreview:W,openCount:qF(G[d.primary.path]),depth:Z,kind:H},d.primary.path)),P.map((d)=>{let o=h?.get(d),x=R?`${R}/${d}`:d,m=z(K00,{node:X[d],activePath:J,previewPath:Q,onOpen:Y,onPreview:W,commentsByFile:G,depth:Z+1,kind:H,showHidden:K,search:U,activeDsName:B,onOpenSystem:N,onDelete:F,dirtyByPath:D,canvasKinds:_,dirPath:x,drag:w,menu:O});if(o&&N)return z(dq0,{name:d,dsName:o.name,depth:Z,defaultOpen:!0,active:J===d8&&o.name===B,onOpenSystem:N,children:m},d);return z(pq0,{name:d,depth:Z,defaultOpen:!0,dirPath:x,drag:w,menu:O,children:m},d)})]})}var UF={project:{title:"PROJECT",pillFromCount:!1},ds:{title:"DESIGN SYSTEM",pillFromDsCount:!0},canvas:{title:"UI CANVASES",pillFromCount:!0},runtime:{title:"RUNTIME · GITIGNORED",pillFromCount:!0}};function iq0(X){if(X.kind==="project")return UF.project;if(X.kind==="runtime")return UF.runtime;if(X.label==="Design system")return UF.ds;if(X.label==="UI kit")return UF.canvas;return{title:X.label.toUpperCase(),pillFromCount:!0}}function oq0({readOnly:X=!1,cloud:J,groups:Q,activePath:Y,previewPath:W,activeDsName:G,onOpen:Z,onPreview:H,onOpenSystem:K,wsConnected:U,search:q,setSearch:B,commentsByFile:N,showHidden:F,sectionsExpanded:D,onToggleSection:_,onNewBoard:R,onDeleteBoard:w,onRefresh:O,refreshing:P,collapsed:I,onCollapse:k,width:$,resizing:C,dirtyByPath:b,project:v,gitBranch:h,remoteSync:d,onGetLatest:o,canvasKinds:x,onMoveCanvas:m,onNewFolder:l,onDeleteFolder:f,syncStatus:s,onLinkedHub:n}){let c=u.useMemo(()=>{if(!q)return Q;return Q.map((O0)=>({...O0,tree:H00(O0.tree,q),filtered:!!q}))},[Q,q]),U0=QS(m),X0=XS(),H0=u.useMemo(()=>{let O0=[];for(let j8 of Q){if(j8.label==="Design system"||j8.kind!=="canvas")continue;let L9=j8.fullPath.replace(/^\.[^/]+\//,"")||j8.fullPath;O0.push({path:j8.fullPath,label:L9});for(let U8 of j8.dirs||[])O0.push({path:U8,label:U8.replace(/^\.[^/]+\//,"")})}return O0},[Q]),a=X0.state?.extra,D0=a?.kind==="file"?[{id:"move-to",label:"Move to…",onSelect:()=>X0.showMoveTo()}]:a?.kind==="dir"?[{id:"new-folder-here",label:"New folder here",onSelect:()=>{X0.close();let O0=window.prompt("New folder name:");if(O0?.trim())l(a.dirPath,O0.trim())}},{id:"delete-folder",label:"Delete folder",destructive:!0,onSelect:()=>{X0.close(),f(a.dirPath,a.dirPath.split("/").pop())}}]:[],z0=a?.kind==="file"?H0.filter((O0)=>O0.path!==a.dir):[],[l0,X8]=u.useState(!1),[d0,$0]=u.useState("board"),[M0,i0]=u.useState(""),[c8,z8]=u.useState(""),[Q9,L8]=u.useState(!1),W8=u.useMemo(()=>Q.find((O0)=>O0.kind==="canvas"&&O0.label!=="Design system")?.fullPath,[Q]),b8=u.useCallback(async()=>{let O0=M0.trim();if(!O0||Q9)return;if(L8(!0),z8(""),d0==="folder"){if(!W8){L8(!1),z8("no canvas group to create a folder in");return}let L9=await l(W8,O0);if(L8(!1),L9?.ok)X8(!1),i0("");else z8(L9?.error||"could not create folder");return}let j8=await R(O0);if(L8(!1),j8?.ok)X8(!1),i0("");else z8(j8?.error||"could not create board")},[M0,Q9,R,l,d0,W8]),i8=u.useMemo(()=>{let O0=0;for(let j8 of Q)for(let L9 of j8.paths||[])if(XQ.test(L9))O0++;return O0},[Q]),p9=u.useMemo(()=>{let O0=0;for(let j8 of c)for(let L9 of j8.paths||[])if(XQ.test(L9))O0++;return O0},[c]);return M("nav",{className:"st-sidebar"+(I?" is-collapsed":"")+(C?" is-resizing":""),style:I||!$?void 0:{width:$,flexBasis:$},"aria-label":"Files","data-tour":"sidebar",children:[M("div",{className:"st-sb-hd",children:[z("span",{className:"st-sb-title",children:"Files"}),M("div",{className:"st-sb-hd-actions",children:[!X&&z("button",{type:"button",className:"st-iconbtn","data-tip":"New blank brief board","aria-label":"New blank brief board","aria-expanded":l0&&d0==="board",onClick:()=>{z8(""),$0("board"),X8((O0)=>d0==="board"?!O0:!0)},children:z(A9,{name:"plus",size:15})}),!X&&W8&&z("button",{type:"button",className:"st-iconbtn","data-tip":"New folder","aria-label":"New folder","data-testid":"tree-new-folder","aria-expanded":l0&&d0==="folder",onClick:()=>{z8(""),$0("folder"),X8((O0)=>d0==="folder"?!O0:!0)},children:z(A9,{name:"folder-plus",size:15})}),O&&z("button",{type:"button",className:"st-iconbtn st-refresh"+(P?" is-spinning":""),"data-tip":"Refresh files · ⇧⌘R","aria-label":"Refresh files","aria-busy":P||void 0,disabled:P,onClick:()=>O(),children:z(A9,{name:"reload",size:15})}),M("span",{className:"st-live","data-tip":U?"live · file index synced":"reconnecting…",children:[z("span",{className:"st-live-dot"+(U?" is-connected":""),"aria-hidden":"true"}),p9," / ",i8]}),k&&z("button",{type:"button",className:"st-iconbtn","aria-label":"Collapse sidebar","data-tip":"Collapse sidebar · T",onClick:k,children:z(A9,{name:"panel-left",size:15})})]})]}),l0?M("div",{className:"st-newboard",children:[z("input",{type:"text",autoFocus:!0,placeholder:d0==="folder"?"folder name…":"brief board name…",value:M0,maxLength:60,disabled:Q9,"aria-label":d0==="folder"?"New folder name":"New brief board name",onChange:(O0)=>i0(O0.target.value),onKeyDown:(O0)=>{if(O0.key==="Enter")O0.preventDefault(),b8();else if(O0.key==="Escape")O0.preventDefault(),X8(!1),i0(""),z8("")}}),z("button",{type:"button",className:"st-newboard-go",disabled:Q9||!M0.trim(),"data-tip":"Create · Enter","aria-label":d0==="folder"?"Create folder":"Create brief board",onClick:b8,children:Q9?"…":"↵"})]}):null,c8?z("div",{className:"st-newboard-err",role:"alert",children:c8}):null,z("div",{className:"st-search",children:M("div",{className:"st-search-box",children:[z(A9,{name:"search",size:13}),z("input",{type:"search","data-testid":"canvas-search",placeholder:"Search canvases…",value:q,onChange:(O0)=>B(O0.target.value),onKeyDown:(O0)=>{if(O0.key==="Escape")if(O0.preventDefault(),q)B("");else O0.currentTarget.blur()},"aria-label":"Filter files"}),q?z("button",{className:"st-search-clear",onClick:()=>B(""),"data-tip":"Clear · Esc","aria-label":"Clear search",children:"×"}):z(MX,{children:"/"})]})}),z("div",{className:"st-tree",role:"tree","aria-label":"Project file tree","data-testid":"canvas-list",children:c.map((O0)=>{if(!F&&!q&&O0.kind==="runtime")return null;let j8=iq0(O0),L9=(O0.paths||[]).filter((w0)=>XQ.test(w0)).length,U8=j8.pill||(j8.pillFromDsCount?String(O0.dsFolders?.length||0):null)||(j8.pillFromCount?String(L9||O0.paths?.length||0):null),D9=O0.tree&&Object.keys(O0.tree).length>0,b0=O0.label==="Design system",Z0=O0.kind==="project";if(!F&&!q&&Z0&&L9===0)return null;let y0=Tq0(O0),c0=D[O0.label],q8=!!q||(c0===void 0?y0:c0),N8=!b0&&O0.kind==="canvas"&&!X,H8=N8?U0.dropProps(O0.fullPath,!0):{},m0=U0.overDir===O0.fullPath;return M("div",{className:"st-tree-section",children:[M("button",{type:"button",className:"st-tree-sec-hd"+(m0?" is-drop-target":""),onClick:()=>_(O0.label,y0),"aria-expanded":q8,"aria-dropeffect":N8?"move":void 0,title:q8?"Collapse section":"Expand section",...H8,children:[z(A9,{name:"chevron-right",className:"st-chev"+(q8?" is-open":""),size:13}),z("span",{className:"st-sec-name",children:j8.title}),U8&&z("span",{className:"st-pill",children:U8})]}),q8&&(D9?z(K00,{node:O0.tree,activePath:Y,previewPath:W,onOpen:Z,onPreview:H,commentsByFile:N,depth:1,kind:O0.kind,showHidden:F,search:q,dsFolders:O0.dsFolders,activeDsName:G,onOpenSystem:b0?K:void 0,onDelete:b0||X?void 0:w,dirtyByPath:b,canvasKinds:x,dirPath:O0.fullPath,drag:!b0&&O0.kind==="canvas"&&!X?U0:void 0,menu:!b0&&O0.kind==="canvas"&&!X?X0:void 0}):z("div",{className:"st-tree-empty",children:q?"No matches.":"Empty."}))]},O0.label)})}),z(JS,{state:X0.state,onClose:X0.close,rootItems:D0,destinations:z0,onPickDestination:(O0)=>m(a.path,O0)}),z(gA,{project:v,liveBranch:h,remoteSync:d,onGetLatest:o}),J===null?z(KA,{syncStatus:s,onLinkedHub:n}):null,z(VA,{})]})}function nq0({shown:X,onExpand:J,onSearch:Q}){return z("div",{className:"st-rail"+(X?" is-shown":""),children:M("div",{className:"st-rail-inner",children:[z("button",{type:"button",className:"st-iconbtn","aria-label":"Expand sidebar",title:"Expand sidebar (T)",onClick:J,children:z(A9,{name:"panel-left",size:15})}),z("button",{type:"button",className:"st-iconbtn","aria-label":"Search",title:"Search (/)",onClick:Q,children:z(A9,{name:"search",size:15})}),z("button",{type:"button",className:"st-iconbtn","aria-label":"Files",title:"Files",onClick:J,children:z(A9,{name:"folder",size:15})})]})})}function rq0({open:X,onClose:J,onStartTour:Q}){if(u.useEffect(()=>{if(!X)return;function Y(W){if(W.key==="Escape")J()}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[X,J]),!X)return null;return z("div",{className:"help-modal-backdrop",role:"presentation",onMouseDown:(Y)=>{if(Y.target===Y.currentTarget)J()},children:M("div",{className:"help-modal",role:"dialog","aria-modal":"true","aria-labelledby":"help-modal-title",children:[M("header",{className:"help-modal-hd",children:[z("span",{className:"title",id:"help-modal-title",children:"Help · shortcuts & commands"}),M("span",{className:"sku",children:["MAUDE-DEV-SRV / v",pR]}),Q&&z("button",{type:"button",className:"mdcc-tour__back",style:{marginLeft:"auto"},onClick:Q,children:"▶ Take the tour"}),z("button",{type:"button",className:"help-modal-close","aria-label":"Close (Esc)",onClick:J,children:"×"})]}),M("div",{className:"help-modal-body",children:[M("details",{open:!0,children:[z("summary",{children:"Canvas selection & tools"}),M("ul",{children:[M("li",{children:[z("kbd",{children:"V"})," ",z("span",{children:"move tool — Cmd+click to select, Cmd+Shift to multi"})]}),M("li",{children:[z("kbd",{children:"H"})," ",z("span",{children:"hand tool — bare drag pans (no Space needed)"})]}),M("li",{children:[z("kbd",{children:"C"})," ",z("span",{children:"comment tool — hover paints, click drops a pin"})]}),M("li",{children:[z("kbd",{children:"⌘"})," + hover ",z("span",{children:"preview deepest element under cursor"})]}),M("li",{children:[z("kbd",{children:"⌘"})," + click ",z("span",{children:"select that element (replace)"})]}),M("li",{children:[z("kbd",{children:"⌘⇧"})," + click ",z("span",{children:"add deepest to selection (multi)"})]}),M("li",{children:["right-click ",z("span",{children:"context menu (Copy CSS / Fit / Reset...)"})]}),M("li",{children:[z("kbd",{children:"Esc"})," in canvas ",z("span",{children:"clear selection + close menu"})]})]})]}),M("details",{children:[z("summary",{children:"Annotation tools"}),M("ul",{children:[M("li",{children:[z("kbd",{children:"B"})," ",z("span",{children:"pen — freehand stroke"})]}),M("li",{children:[z("kbd",{children:"R"})," ",z("span",{children:"rectangle — drag to define corners"})]}),M("li",{children:[z("kbd",{children:"O"})," ",z("span",{children:"ellipse — drag from center outward"})]}),M("li",{children:[z("kbd",{children:"A"})," ",z("span",{children:"arrow — drag tail → tip"})]}),M("li",{children:[z("kbd",{children:"E"})," ",z("span",{children:"eraser — click or drag over strokes to remove"})]}),M("li",{children:[z("kbd",{children:"V"})," + click stroke ",z("span",{children:"select annotation (Shift+click to multi)"})]}),M("li",{children:[z("kbd",{children:"V"})," + drag empty ",z("span",{children:"marquee-select strokes that overlap"})]}),M("li",{children:["double-click rect/ellipse ",z("span",{children:"add text inside the shape"})]}),M("li",{children:["arrow keys ",z("span",{children:"nudge selected annotation 1 unit (Shift = 10)"})]}),M("li",{children:[z("kbd",{children:"Backspace"})," ",z("span",{children:"delete selected annotations"})]}),M("li",{children:[z("kbd",{children:"⇧P"})," ",z("span",{children:"presentation — hide annotations for clean screenshot"})]})]})]}),M("details",{children:[z("summary",{children:"Canvas & panels"}),M("ul",{children:[M("li",{children:["click in tree ",z("span",{children:"open canvas (replaces the active one)"})]}),M("li",{children:["File ▸ Close canvas ",z("span",{children:"clear the stage"})]}),M("li",{children:[z("kbd",{children:"⌘R"})," ",z("span",{children:"reload canvas"})]}),M("li",{children:[z("kbd",{children:"/"})," ",z("span",{children:"focus search"})]}),M("li",{children:[z("kbd",{children:"⌘⇧M"})," ",z("span",{children:"comments panel"})]}),M("li",{children:[z("kbd",{children:"⌘⇧I"})," ",z("span",{children:"inspector"})]}),M("li",{children:[z("kbd",{children:"?"})," ",z("span",{children:"keyboard-shortcuts cheat sheet"})]})]})]}),M("details",{children:[z("summary",{children:"Slash commands"}),M("ul",{className:"cmds",children:[M("li",{children:[M("code",{children:['/design:edit "',z("i",{children:"feedback"}),'"']}),z("span",{children:"edit + 4-iter multi-axis loop"})]}),M("li",{children:[M("code",{children:['/design:edit "',z("i",{children:"…"}),'" --perfect']}),z("span",{children:"8-iter polish (4.5/5 aspiration)"})]}),M("li",{children:[M("code",{children:['/design:edit "',z("i",{children:"…"}),'" --no-critic']}),z("span",{children:"raw edit, skip loop"})]}),M("li",{children:[M("code",{children:['/design:edit "',z("i",{children:"…"}),'" --opt-out=',z("i",{children:"scope"})]}),z("span",{children:"override DS scope (palette/aesthetic/full)"})]}),M("li",{children:[M("code",{children:['/design:new "',z("i",{children:"Name"}),'" "',z("i",{children:"brief"}),'"']}),z("span",{children:"scaffold canvas"})]}),M("li",{children:[M("code",{children:['/design:new "',z("i",{children:"…"}),'" --opt-out=aesthetic']}),z("span",{children:"scaffold off-system canvas (gradients/radii/type free)"})]}),M("li",{children:[z("code",{children:"/design:critic"}),z("span",{children:"review panel (routed)"})]}),M("li",{children:[z("code",{children:"/design:critic --all"}),z("span",{children:"10-critic sweep"})]}),M("li",{children:[z("code",{children:"/design:critic --agent signature-moment-critic"}),z("span",{children:"aspiration axis only"})]}),M("li",{children:[z("code",{children:"/design:rollback"}),z("span",{children:"undo last edit"})]}),M("li",{children:[z("code",{children:"/design:screenshot"}),z("span",{children:"capture canvas"})]}),M("li",{children:[z("code",{children:"/design:setup-docs"}),z("span",{children:"refresh README + INDEX"})]}),M("li",{children:[z("code",{children:"/design:handoff"}),z("span",{children:"migrate to apps/"})]})]})]}),M("details",{children:[z("summary",{children:"Opt-out scope"}),M("ul",{children:[M("li",{children:[z("strong",{children:"palette"})," ",z("span",{children:"default — tokens + rootClass kept; local namespace overrides colors only. DS aesthetic still enforced."})]}),M("li",{children:[z("strong",{children:"aesthetic"})," ",z("span",{children:"palette + gradients/off-ladder radii/alt type/decorative SVG flags allowed."})]}),M("li",{children:[z("strong",{children:"full"})," ",z("span",{children:"DS treated as advisory. Type/radii/aesthetic up to canvas."})]}),M("li",{children:[z("em",{children:"A11y enforced at every scope"})," ",z("span",{children:"contrast, focus, semantics, motion, touch targets — never relaxed."})]}),M("li",{children:["Persisted on canvas's ",z("code",{children:".meta.json"})," ",z("code",{children:"opt_out_scope"})," field — subsequent ",z("code",{children:"/design:edit"})," iterations inherit."]}),z("li",{children:'Inferred from brief ("modern", "vibrant", "off-system") with one-shot AskUserQuestion before iter-1 critics fire.'})]})]}),M("details",{children:[z("summary",{children:"Auto-critic loop"}),M("ul",{children:[M("li",{children:[z("strong",{children:"Default"})," ",z("span",{children:"4 iter · aspiration ≥ 4.0 · stable-but-bland exit"})]}),M("li",{children:[z("strong",{children:"--perfect"})," ",z("span",{children:"8 iter · aspiration ≥ 4.5 · broader divergence tolerance"})]}),M("li",{children:[z("strong",{children:"--perfect --all"})," ",z("span",{children:"every critic incl. aspiration · portfolio-grade"})]}),M("li",{children:["Exit: ",z("code",{children:"solid"})," · ",z("code",{children:"stable-but-bland"})," · ",z("code",{children:"max-reached"})," ","· ",z("code",{children:"divergent"})]}),M("li",{children:[z("em",{children:"stable-but-bland"})," = correctness clean, aspiration plateau — surface for review with lowest 2 axes named"]}),M("li",{children:["When ",z("code",{children:"opt_out_scope ∈ {aesthetic, full}"}),": iter-1 checkpoint fires — pick (a) run loop, (b) skip auto-loop and review iter 1, (c) a11y-only check."]})]})]}),M("details",{children:[z("summary",{children:"Pin-to-element flow"}),M("ol",{children:[z("li",{children:"Open a canvas"}),M("li",{children:[z("kbd",{children:"⌘"}),"+click element"]}),z("li",{children:"Status bar shows ● selector"}),M("li",{children:["Run"," ",M("code",{children:['/design:edit "',z("i",{children:"change just this"}),'"']})]}),M("li",{children:["Reload iframe (",z("kbd",{children:"⌘R"}),")"]})]})]}),M("details",{children:[z("summary",{children:"Comments"}),M("ol",{children:[M("li",{children:[z("kbd",{children:"⌘"}),"+click element, then ",z("kbd",{children:"⌘C"})," ",z("span",{children:"or ⌘⇧+click"})]}),z("li",{children:"Numbered pin appears on canvas"}),M("li",{children:[z("kbd",{children:"⌘⇧M"})," ",z("span",{children:"opens panel — All / Open / Resolved"})]}),M("li",{children:["Click row in panel ",z("span",{children:"jumps to that file + pin"})]}),M("li",{children:["Claude reads ",z("code",{children:"_comments/<slug>.json"})," on next ",z("code",{children:"/design"})]})]})]})]})]})})}var gR=[{id:"canvas",label:"Canvas",items:[{label:"Command palette",kbd:"⌘ K"},{label:"New brief board",kbd:"N"},{label:"Export…",kbd:"⇧ ⌘ E"},{label:"Handoff to production",kbd:"⇧ ⌘ H"},{label:"Reload canvas",kbd:"⌘ R"},{label:"Search files",kbd:"/",alt:"⌘ F"}]},{id:"tools",label:"Tools · canvas focus",items:[{label:"Move · Hand · Comment",kbd:"V",alt:"H / C"},{label:"Pen · Highlighter · Eraser",kbd:"B",alt:"I / E"},{label:"Shape · Arrow",kbd:"R",alt:"A"},{label:"Sticky · Text · Section",kbd:"N",alt:"T / ⇧S"},{label:"Undo / redo",kbd:"⌘ Z",alt:"⇧ ⌘ Z"}]},{id:"selection",label:"Selection & zoom",items:[{label:"Select element",kbd:"⌘ click"},{label:"Add to selection",kbd:"⌘ ⇧ click"},{label:"Preview deepest",kbd:"⌘ hover"},{label:"Deselect · close menu",kbd:"Esc"},{label:"Zoom in / out",kbd:"⌘ +",alt:"⌘ −"},{label:"Fit · actual size",kbd:"⌘ 0",alt:"⌘ 1"}]},{id:"view",label:"View",items:[{label:"Project tree",kbd:"T"},{label:"Design system view",kbd:"S"},{label:"Inspector",kbd:"⌘ ⇧ I"},{label:"Comments sidebar",kbd:"⌘ ⇧ M"},{label:"Annotations",kbd:"⇧ P"},{label:"Hidden files",kbd:"H"},{label:"This cheat sheet · help",kbd:"?",alt:"F1"}]}];function aq0({kbd:X,alt:J}){let Q=(Y,W)=>z("span",{className:"so-combo",children:Y.split(" ").map((G,Z)=>z(MX,{children:G},`${G}-${Z}`))},W);return M("span",{className:"so-combos",children:[Q(X,"main"),J?J.split(" / ").map((Y)=>M(G0,{children:[z("span",{className:"so-or",children:"/"}),Q(Y,Y)]},Y)):null]})}function sq0({open:X,onClose:J}){if(u.useEffect(()=>{if(!X)return;function Y(W){if(W.key==="Escape")W.preventDefault(),J()}return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[X,J]),!X)return null;let Q=gR.reduce((Y,W)=>Y+W.items.length,0);return z("div",{className:"st-scrim",role:"presentation",onMouseDown:(Y)=>{if(Y.target===Y.currentTarget)J()},children:M("div",{className:"so-overlay",role:"dialog","aria-modal":"true","aria-label":"Keyboard shortcuts",children:[M("div",{className:"so-overlay-hd",children:[z("span",{className:"so-title",children:"Keyboard shortcuts"}),M("span",{className:"so-trigger",children:["press ",z(MX,{children:"?"})," to open"]})]}),z("div",{className:"so-columns",children:gR.map((Y)=>M("section",{className:"so-section so-section--"+Y.id,children:[z("h3",{className:"so-section-hd",children:Y.label}),z("dl",{className:"so-list",children:Y.items.map((W)=>M("div",{className:"so-pair",children:[z("dt",{children:W.label}),z("dd",{children:z(aq0,{kbd:W.kbd,alt:W.alt})})]},W.label))})]},Y.id))}),M("div",{className:"so-overlay-ft",children:[M("span",{children:["close with ",z(MX,{children:"Esc"})]}),M("span",{className:"so-count",children:[Q," bindings · ",gR.length," groups"]})]})]})})}var tq0=["File","Edit","View","Selection","Tools","Help"];function U00(X){u.useEffect(()=>{function J(Y){if(Y.key==="Escape")X()}function Q(Y){if(!Y.target.closest(".st-dropdown, .st-menu"))X()}return window.addEventListener("keydown",J),window.addEventListener("mousedown",Q),()=>{window.removeEventListener("keydown",J),window.removeEventListener("mousedown",Q)}},[X])}function eq0({panels:X,onToggle:J,onClose:Q,onZoom:Y,hasCanvas:W}){return U00(Q),M("div",{className:"st-dropdown",role:"menu","aria-label":"View",style:{left:152},children:[z("div",{className:"st-dd-hd",children:"Panels"}),X.map((G)=>M("button",{type:"button",role:"menuitem",className:"st-dd-item"+(G.checked?" is-on":""),"aria-disabled":G.disabled?"true":void 0,title:G.hint||void 0,onClick:()=>{if(G.disabled){if(G.href)window.open(G.href,"_blank","noopener,noreferrer"),Q();return}J(G.id),Q()},children:[M("span",{className:"st-dd-lead",children:[z("span",{className:"st-dd-check",children:G.checked?z(A9,{name:"check",size:13}):null}),z("span",{children:G.label}),G.phase?z("span",{className:"st-dd-phase",children:G.phase}):null]}),G.shortcut?z(MX,{children:G.shortcut}):null]},G.id)),z("div",{className:"st-dd-sep"}),z("div",{className:"st-dd-hd",children:"Zoom"}),[{op:"in",label:"Zoom In",shortcut:"⌘ +"},{op:"out",label:"Zoom Out",shortcut:"⌘ −"},{op:"fit",label:"Fit to Screen",shortcut:"⌘ 0"},{op:"actual",label:"Actual Size · 100 %",shortcut:"⌘ 1"}].map((G)=>M("button",{type:"button",role:"menuitem",className:"st-dd-item","aria-disabled":W?void 0:"true",onClick:()=>{if(!W)return;Y?.(G.op),Q()},children:[M("span",{className:"st-dd-lead",children:[z("span",{className:"st-dd-check"}),z("span",{children:G.label})]}),z(MX,{children:G.shortcut})]},G.label))]})}function EK({label:X,left:J,header:Q,items:Y,onAction:W,onClose:G}){return U00(G),M("div",{className:"st-dropdown",role:"menu","aria-label":X,style:{left:J},children:[Q?z("div",{className:"st-dd-hd",children:Q}):null,Y.map((Z,H)=>Z.sep?z("div",{className:"st-dd-sep"},"s"+H):M("button",{type:"button",role:"menuitem",className:"st-dd-item","aria-disabled":Z.disabled?"true":void 0,onClick:()=>{if(Z.disabled)return;W(Z.id),G()},children:[M("span",{className:"st-dd-lead",children:[z("span",{className:"st-dd-check"}),z("span",{children:Z.label})]}),Z.shortcut?z(MX,{children:Z.shortcut}):null]},Z.id))]})}function X20({onAction:X,onClose:J}){return z(EK,{label:"Help",left:320,onAction:X,onClose:J,items:[{id:"shortcuts",label:"Keyboard shortcuts",shortcut:"?"},{id:"help",label:"Help · commands & flows",shortcut:"F1"},{id:"report-bug",label:"Report a bug…"},{sep:!0},{id:"tour",label:"Take the tour"},{id:"watch-intro",label:"Watch the intro"},...X9()?[{id:"collab-tour",label:"How sharing works"}]:[],...X9()?[{id:"quick-setup",label:"Quick setup"}]:[],...X9()?[{id:"readiness",label:"Check AI editing readiness…"}]:[],{id:"whatsnew",label:"What's new"}]})}function J20({onAction:X,onClose:J,readOnly:Q=!1}){return z(EK,{label:"Selection",left:214,onAction:X,onClose:J,items:[{id:"deselect-all",label:"Deselect all",shortcut:"Esc"},...Q?[]:[{id:"select-all-annotations",label:"Select all annotations",shortcut:"⌘ ⇧ A"}]]})}function Q20({onAction:X,onClose:J,readOnly:Q=!1}){let Y=[{id:"browse",label:"Browse (interact)",shortcut:""},{id:"move",label:"Select",shortcut:"V"},{id:"hand",label:"Hand",shortcut:"H"},...Q?[]:[{id:"comment",label:"Comment",shortcut:"C"},{id:"pen",label:"Pen",shortcut:"B"},{id:"rect",label:"Rect",shortcut:"R"},{id:"ellipse",label:"Ellipse",shortcut:"O"},{id:"sticky",label:"Sticky",shortcut:"N"},{id:"arrow",label:"Arrow",shortcut:"A"},{id:"text",label:"Text",shortcut:"T"},{id:"eraser",label:"Eraser",shortcut:"E"}]];return z(EK,{label:"Tools",left:290,header:"Tool palette",onAction:X,onClose:J,items:Y})}function Y20({onAction:X,onClose:J,hasCanvas:Q,readOnly:Y=!1}){return z(EK,{label:"File",left:40,onAction:X,onClose:J,items:Y?[{id:"export",label:"Export…",shortcut:"⇧⌘E"},{id:"handoff",label:"Handoff to production",shortcut:"⇧⌘H"},{sep:!0},{id:"reload",label:"Reload canvas",shortcut:"⌘R",disabled:!Q},{id:"close",label:"Close canvas",disabled:!Q}]:[{id:"new",label:"New canvas…",shortcut:"N"},{id:"assemble",label:"Assemble dropped clips → video",disabled:!Q},{id:"export",label:"Export…",shortcut:"⇧⌘E"},{id:"handoff",label:"Handoff to production",shortcut:"⇧⌘H"},{sep:!0},{id:"generate",label:"Generate with AI…"},{id:"settings",label:"Settings…",shortcut:"⌘,"},{sep:!0},{id:"reload",label:"Reload canvas",shortcut:"⌘R",disabled:!Q},{id:"close",label:"Close canvas",disabled:!Q}]})}function W20({onAction:X,onClose:J,hasCanvas:Q,readOnly:Y=!1}){if(Y)return z(EK,{label:"Edit",left:90,onAction:X,onClose:J,items:[{id:"deselect-all",label:"Deselect all",shortcut:"Esc"}]});return z(EK,{label:"Edit",left:90,onAction:X,onClose:J,items:[{id:"undo",label:"Undo",shortcut:"⌘Z"},{id:"redo",label:"Redo",shortcut:"⇧⌘Z"},{sep:!0},{id:"deselect-all",label:"Deselect all",shortcut:"Esc"},{id:"select-all-annotations",label:"Select all annotations",shortcut:"⇧⌘A"},...Q?[{sep:!0},{id:"new-artboard:desktop",label:"New artboard: Desktop"},{id:"new-artboard:laptop",label:"New artboard: Laptop"},{id:"new-artboard:tablet",label:"New artboard: Tablet"},{id:"new-artboard:mobile",label:"New artboard: Mobile"},{id:"new-artboard:print-a4",label:"New artboard: A4 (print)"},{id:"new-artboard:print-letter",label:"New artboard: Letter (print)"}]:[]]})}function G20({activePath:X,project:J,cloud:Q,tabsCount:Y,openMenu:W,setOpenMenu:G,commentsPanelOpen:Z,onToggleComments:H,changesOpen:K,changesCount:U,onToggleChanges:q,onOpenSystem:B,sidebarOpen:N,onToggleSidebar:F,showHidden:D,onToggleShowHidden:_,onOpenHelp:R,onOpenShortcuts:w,onReportBug:O,onStartTour:P,onStartCollabTour:I,annotationsVisible:k,onToggleAnnotations:$,minimapVisible:C,onToggleMinimap:b,zoomCtlVisible:v,onToggleZoomCtl:h,presentMode:d,onTogglePresent:o,printGuidesVisible:x,onTogglePrintGuides:m,postToActiveCanvas:l,onOpenWhatsNew:f,onOpenReadiness:s,onOpenQuickSetup:n,onWatchIntro:c,whatsNewCount:U0,exportCenter:X0,artboardCount:H0=0,presence:a=null,inspectorOpen:D0,inspectorTab:z0,onToggleInspector:l0,autoOpenInspector:X8,onToggleAutoOpenInspector:d0,onOpenLayers:$0,timelineOpen:M0,onToggleTimeline:i0,hasComps:c8=!1,assistantOpen:z8,onToggleAssistant:Q9,assistantBusy:L8,assistantUnseen:W8,onNewCanvas:b8,onAssembleVideo:i8,onOpenExport:p9,onOpenSettings:O0,onOpenGenerate:j8,onReload:L9,onCloseCanvas:U8,onInsertArtboard:D9,readOnly:b0=!1}){let Z0=X===d8,y0=Z0?"SYSTEM":X?"CANVAS":"IDLE",c0=Z0?z("b",{children:"design system"}):X?M(G0,{children:[X.split("/").slice(0,-1).join("/"),"/",z("b",{children:vW(wK(X))})]}):z("span",{style:{color:"var(--u-fg-3)"},children:"no canvas open"}),q8=new Set(Q?["autoopen"]:["assistant","autoopen"]),N8=[{id:"tree",label:"Project Tree",shortcut:"T",checked:N,disabled:!1},{id:"changes",label:Q?"History":U>0?`Changes · ${U} unsaved`:"Changes",shortcut:"⌘ ⇧ G",checked:K,disabled:!1},{id:"comments",label:"Comments Sidebar",shortcut:"⌘ ⇧ M",checked:Z,disabled:!1},{id:"hidden",label:"Show hidden files",shortcut:"H",checked:D,disabled:!1},{id:"layers",label:"Layers",shortcut:"",checked:D0&&z0==="layers",disabled:!1},{id:"inspector",label:"Inspector",shortcut:"⌘ ⇧ I",checked:D0,disabled:!1},{id:"autoopen",label:"Auto-open Inspector on select",shortcut:"",checked:!!X8,disabled:!1},{id:"timeline",label:"Timeline",shortcut:"⌘ ⇧ T",phase:c8?"video":void 0,checked:M0,disabled:!1},...X9()?[{id:"assistant",label:"Assistant",shortcut:"⌘ ⇧ A",checked:z8,disabled:!1}]:Q?[{id:"assistant",label:"Assistant — in the desktop app",shortcut:"",checked:!1,disabled:!0,href:"https://maude.sh/download",hint:"The agent runs on your own Claude subscription, on your own machine."}]:[],{id:"annotate",label:"Annotations",shortcut:"⇧ P",checked:k,disabled:!1},{id:"minimap",label:"Minimap",shortcut:"",checked:C,disabled:!X||Z0},{id:"zoomctl",label:"Zoom controls",shortcut:"",checked:v,disabled:!X||Z0},{id:"present",label:"Presentation Mode",shortcut:"",checked:d,disabled:!X||Z0},{id:"print-guides",label:"Show print guides",shortcut:"",checked:x,disabled:!X||Z0}].filter((w0)=>!b0||!q8.has(w0.id)),H8=["file","edit","view","selection","tools","help"];function m0(w0){if(H8.includes(w0))G(W===w0?null:w0)}return u.useEffect(()=>{if(!W||!H8.includes(W))return;let w0=setTimeout(()=>{document.querySelector('.st-dropdown [role="menuitem"]:not([aria-disabled="true"])')?.focus()},0);function K8(I8){let k8=[...document.querySelectorAll('.st-dropdown [role="menuitem"]:not([aria-disabled="true"])')];if(!k8.length)return;let _9=k8.indexOf(document.activeElement);if(I8.key==="ArrowDown")I8.preventDefault(),k8[(_9+1)%k8.length].focus();else if(I8.key==="ArrowUp")I8.preventDefault(),k8[(_9-1+k8.length)%k8.length].focus();else if(I8.key==="Home")I8.preventDefault(),k8[0].focus();else if(I8.key==="End")I8.preventDefault(),k8[k8.length-1].focus();else if(I8.key==="ArrowRight"||I8.key==="ArrowLeft"){I8.preventDefault();let A8=I8.key==="ArrowRight"?1:-1,T9=H8.indexOf(W);G(H8[(T9+A8+H8.length)%H8.length])}else if(I8.key==="Escape")document.querySelector('.st-menu[aria-expanded="true"]')?.focus()}return window.addEventListener("keydown",K8),()=>{clearTimeout(w0),window.removeEventListener("keydown",K8)}},[W,G]),M("header",{className:"st-menubar",role:"menubar","aria-label":"Application menubar","data-testid":"menubar",children:[M("span",{className:"st-brand","data-tour":"brand",children:[z("span",{className:"st-brand-mark",children:z("svg",{viewBox:"0 0 32 32",width:"100%",height:"100%",fill:"none","aria-hidden":"true",children:z("path",{d:"M16 5l2.8 8.2L27 16l-8.2 2.8L16 27l-2.8-8.2L5 16l8.2-2.8z",fill:"currentColor"})})}),z("span",{className:"st-brand-name",children:"maude"})]}),Q?M("span",{className:"st-cloudback","data-testid":"cloud-back",children:[z("a",{className:"st-cloudback-link",href:Q.dashboardUrl||"https://cloud.maude.sh",title:"Back to your projects",children:"← Dashboard"}),Q.projectName?z("span",{className:"st-cloudback-project","data-testid":"cloud-project-name",children:Q.projectName}):null]}):null,z("nav",{className:"st-menus","aria-label":"Application menus","data-tour":"menus",children:tq0.map((w0)=>{let K8=w0.toLowerCase(),I8=H8.includes(K8),k8=I8||K8==="help";return z("button",{type:"button",className:"st-menu",role:"menuitem","data-tour":K8==="help"?"help":void 0,"aria-haspopup":I8?"menu":void 0,"aria-expanded":I8?W===K8:void 0,onClick:()=>m0(K8),onMouseEnter:()=>{if(W!==null&&I8)G(K8)},children:w0},K8)})}),W==="file"&&z(Y20,{readOnly:b0,hasCanvas:!!X,onAction:(w0)=>{if(w0==="new")b8?.();else if(w0==="assemble")i8?.();else if(w0==="export")p9?.("export");else if(w0==="handoff")p9?.("handoff");else if(w0==="generate")j8?.();else if(w0==="settings")O0?.();else if(w0==="reload")L9?.();else if(w0==="close")U8?.()},onClose:()=>G(null)}),W==="edit"&&z(W20,{readOnly:b0,hasCanvas:!!X&&!Z0,onAction:(w0)=>{if(w0==="undo")l({dgn:"undo"});else if(w0==="redo")l({dgn:"redo"});else if(w0==="deselect-all")l({dgn:"selection-clear"});else if(w0==="select-all-annotations")l({dgn:"annotation-select-all"});else if(w0.startsWith("new-artboard:"))D9?.(w0.slice(13))},onClose:()=>G(null)}),W==="view"&&z(eq0,{panels:N8,onToggle:(w0)=>{if(w0==="tree")F();else if(w0==="changes")q();else if(w0==="comments")H();else if(w0==="hidden")_();else if(w0==="annotate")$();else if(w0==="inspector")l0();else if(w0==="autoopen")d0?.();else if(w0==="timeline")i0?.();else if(w0==="assistant")Q9?.();else if(w0==="layers")$0?.();else if(w0==="minimap")b?.();else if(w0==="zoomctl")h?.();else if(w0==="present")o?.();else if(w0==="print-guides")m?.()},onZoom:(w0)=>l({dgn:"zoom",op:w0}),hasCanvas:!!X&&!Z0,onClose:()=>G(null)}),W==="selection"&&z(J20,{readOnly:b0,onAction:(w0)=>{if(w0==="deselect-all")l({dgn:"selection-clear"});else if(w0==="select-all-annotations")l({dgn:"annotation-select-all"})},onClose:()=>G(null)}),W==="tools"&&z(Q20,{readOnly:b0,onAction:(w0)=>l({dgn:"tool-set",tool:w0}),onClose:()=>G(null)}),W==="help"&&z(X20,{onAction:(w0)=>{if(w0==="shortcuts")w?.();else if(w0==="help")R?.();else if(w0==="report-bug")O?.();else if(w0==="tour")P?.();else if(w0==="collab-tour")I?.();else if(w0==="quick-setup")n?.();else if(w0==="readiness")s?.();else if(w0==="whatsnew")f?.();else if(w0==="watch-intro")c?.()},onClose:()=>G(null)}),M("div",{className:"st-mb-right","data-tour":"status",children:[a?z("div",{className:"st-presence",children:a}):null,b0&&z("span",{className:"st-stamp st-stamp--viewonly","data-testid":"view-only-stamp","data-tip":Q?.user?`${Q.user} is a viewer on this project — you can browse, comment and export. Ask a project owner for edit access, or sign out if that is not the account you meant to use.`:"Your role in this project is viewer — you can browse, comment when available, and export. Ask a project owner for edit access.",children:"VIEW ONLY"}),Q?.user?M("span",{className:"st-cloudwho","data-testid":"cloud-account",children:[z("span",{className:"st-cloudwho-email",title:Q.role?`Signed in as ${Q.user} — ${Q.role}`:Q.user,children:Q.user}),z("form",{method:"post",action:"/auth/browser/signout",className:"st-cloudwho-form",children:z("button",{type:"submit",className:"st-cloudwho-out","data-testid":"cloud-signout",title:"Sign out of this project",children:"Sign out"})})]}):null,X9()&&!b0&&z("button",{type:"button",className:"st-assistant","data-testid":"assistant-toggle","data-active":z8?"true":"false","data-busy":L8?"true":"false","data-unseen":W8?"true":"false","aria-label":`Assistant${L8?" — working":W8?" — new reply":""}`,"data-tip":"Assistant ⌘⇧A",onClick:Q9,children:z(A9,{name:"sparkle",size:15})}),X0&&z(Qx,{center:X0}),z("button",{type:"button",className:"st-reportbug","data-testid":"report-bug-toggle","aria-label":"Report a bug","data-tip":"Report a bug",onClick:O,children:z(A9,{name:"bug",size:15})}),z("button",{type:"button",className:"st-whatsnew","data-tour":"whatsnew","data-unseen":U0>0?"true":"false","aria-label":`What's new${U0>0?` — ${U0} unseen`:""}`,"data-tip":"What's new",onClick:f,children:z(A9,{name:"megaphone",size:15})}),z("span",{className:"st-stamp",children:y0}),z("span",{className:"st-mb-file",title:X||"",children:c0}),z("span",{className:"st-mb-sep"}),M("span",{className:"st-mb-count","data-tip":"Artboards in the open canvas",children:[z("span",{className:"st-dot",style:{background:"var(--accent)"}}),H0," ARTBOARDS"]}),z("span",{className:"st-mb-sep"}),z("span",{className:"st-mb-proj",children:J||"maude"})]})]})}function Z20({tabs:X,activePath:J,registerIframe:Q,systemData:Y,onOpenFromSystem:W,onSelectDs:G,project:Z,cfg:H,loadingPath:K,onIframeLoad:U,showQuickSetup:q,onStartQuickSetup:B,previewPath:N}){let F=u.useRef(null);return u.useEffect(()=>{if(N)F.current?.focus()},[N]),M("div",{className:"viewport st-stage","data-tour":"viewport",children:[N&&z("div",{ref:F,className:"st-file-preview-overlay",role:"region","aria-label":`Preview: ${uB(wK(N))}`,tabIndex:0,children:z(Bh,{path:N,kind:lR(wK(N))})}),X.length===0&&!N&&M("div",{className:"st-empty",children:[M("div",{className:"st-empty-brand",children:[z("span",{className:"st-brand-mark",children:z("svg",{viewBox:"0 0 32 32",width:"100%",height:"100%",fill:"none","aria-hidden":"true",children:z("path",{d:"M16 5l2.8 8.2L27 16l-8.2 2.8L16 27l-2.8-8.2L5 16l8.2-2.8z",fill:"currentColor"})})}),z("span",{className:"st-empty-wm",children:"maude"}),M("span",{className:"st-empty-sub st-mono",children:["CANVAS · ",(Z||"MAUDE").toUpperCase()," / v",pR," / localhost:",typeof window<"u"?window.location.port:"4399"]})]}),z("div",{className:"st-empty-title",children:"Nothing open yet"}),M("div",{className:"st-empty-body",children:["← Pick a screen from the list on the left, or open ",z("strong",{children:"Design system"})," above it to see your colors, type, and components.",z("br",{}),z("br",{}),z("strong",{children:"To select something on the canvas:"})," hold ",z(MX,{children:"⌘"})," and hover to preview an element, click to select it — ",z(MX,{children:"⌘⇧"}),"+click selects more than one. Right-click for more options.",X9()?M(G0,{children:[z("br",{}),z("br",{}),"Claude can see whatever's selected when you ask for a change in the Assistant panel, so pointing is often faster than describing it."]}):null]}),q&&z("button",{type:"button","data-testid":"st-empty-start-quick-setup",className:"btn btn--primary st-empty-quick-setup",onClick:B,children:"Start quick setup"})]}),X.map((D)=>{if(D.path===d8)return z("div",{className:"system-view"+(D.path===J?" active":""),children:z(N20,{data:Y,onOpen:W,cfg:H,onSelectDs:G})},D.path);return z("iframe",{ref:(_)=>Q(D.path,_),src:Lz(D.path,H),className:D.path===J?"active":"","data-path":D.path,"data-testid":D.path===J?"canvas-frame":void 0,onLoad:()=>U?.(D.path),...H?.canvasOrigin?{sandbox:"allow-scripts allow-same-origin",allow:"clipboard-write"}:{}},D.path)}),K&&K===J&&z("div",{className:"st-canvas-loading","aria-hidden":"true",children:M("div",{className:"st-skel-card",children:[z("div",{className:"st-skel-cap st-mono",children:"compiling canvas…"}),z("span",{className:"skel st-skel-thumb"}),z("span",{className:"skel st-skel-line",style:{width:"72%"}}),z("span",{className:"skel st-skel-line",style:{width:"46%"}})]})})]})}var H20=["color","space","radius","shadow","leading","weight","motion","font","other"],z20={color:"colors",space:"spacing",radius:"radii",shadow:"shadows",leading:"leading",weight:"weights",motion:"motion",font:"font stacks",other:"other"};function K20(X){return X==="color"}function U20({tokens:X,tokenGroups:J,tokensPath:Q}){if(!X||X.length===0)return M("section",{className:"sv-section sv-section-tokens",children:[M("h2",{children:["tokens",z("span",{className:"sv-h-num",children:"0"})]}),z("div",{className:"sv-empty",children:M("p",{children:["No tokens parsed from"," ",Q?z("code",{children:Q}):"the configured tokens file",". Does the file exist and contain CSS custom properties (",z("code",{children:"--name: value;"}),")?"]})})]});let Y=J||{},W=Array.from(new Set([...H20,...Object.keys(Y)])).filter((G)=>Y[G]?.length);return z(G0,{children:W.map((G)=>{let Z=Y[G],H=K20(G);return M("section",{className:"sv-section sv-section-tokens sv-section-"+G,children:[M("h2",{children:["tokens · ",z20[G]||G,z("span",{className:"sv-h-num",children:Z.length})]}),z("div",{className:"sv-tokens-ladder",children:Z.map((K)=>M("div",{className:"sv-tok-cell",children:[H?z("div",{className:"sv-tok-swatch",style:{background:K.value}}):null,M("div",{className:"sv-tok-meta",children:[z("code",{className:"sv-tok-name",children:K.name}),z("span",{className:"sv-tok-value",children:K.value||"—"})]})]},K.name+"|"+K.value))})]},G)})})}function V20(X,J){let Q=X.name.match(/^--(?:type|fs|text)-(.+)$/);if(!Q)return null;let Y=Q[1];return(J||[]).find((W)=>/^--(?:lh|leading|line-height)-/.test(W.name)&&W.name.endsWith("-"+Y))?.value??null}function q20(X){if(!X?.length)return;let J=["body","sans","display","text","family"];for(let Q of J){let Y=X.find((W)=>W.name.includes(Q));if(Y)return Y.value}return X[0].value}function B20({tokenGroups:X}){let J=X?.fontsize||[];if(J.length===0)return null;let Q=X?.leading||[],Y=q20(X?.font);return M("section",{className:"sv-section sv-section-type",children:[M("h2",{children:["type · ladder",z("span",{className:"sv-h-num",children:J.length})]}),z("div",{className:"sv-type-list",children:J.map((W)=>{let G=V20(W,Q),Z={fontSize:W.value};if(G)Z.lineHeight=G;if(Y)Z.fontFamily=Y;return M("div",{className:"sv-type-row",children:[z("code",{className:"sv-type-tok",children:W.name}),z("span",{className:"sv-type-sample",style:Z,children:"The catalog is the system."})]},W.name)})})]})}function N20({data:X,onOpen:J,cfg:Q,onSelectDs:Y}){if(!X)return z("div",{className:"sv-empty",children:z("p",{children:"Loading design system…"})});let{previewGallery:W,uiKitsGallery:G,systemDir:Z,tokens:H,tokenGroups:K,tokensPath:U,ds:q,availableDesignSystems:B}=X,N=(!W||!W.length)&&(!G||!G.length),F=Array.isArray(B)&&B.length>1,D=q?.name??B?.[0]?.name??"";return M("div",{className:"sv",children:[M("header",{className:"sv-header",children:[z("span",{className:"sv-sku",children:"MAUDE-DSN/01"}),z("span",{className:"sv-title",children:"design system view"}),F?M("label",{className:"sv-ds-picker",children:[z("span",{className:"sv-ds-picker-label",children:"DS"}),z("select",{value:D,onChange:(_)=>Y&&Y(_.target.value),children:B.map((_)=>z("option",{value:_.name,children:_.name},_.name))})]}):null,z("span",{className:"sv-loc",children:z("code",{children:Z})})]}),q?.description?z("p",{className:"sv-ds-description",children:q.description}):null,z(U20,{tokens:H,tokenGroups:K,tokensPath:U}),z(B20,{tokenGroups:K}),N?z("div",{className:"sv-empty",children:M("p",{children:["No ",z("code",{children:"preview/"})," or ",z("code",{children:"ui_kits/"})," folders found under"," ",z("code",{children:Z}),"."]})}):M(G0,{children:[z(de,{title:"preview",items:W,onOpen:J,kind:"preview",cfg:Q}),z(de,{title:"ui kits",items:G,onOpen:J,kind:"ui_kits",cfg:Q})]})]})}function de({title:X,items:J,onOpen:Q,kind:Y,cfg:W}){if(!J||J.length===0)return null;return M("section",{className:"sv-section",children:[M("h2",{children:[X," ",z("span",{className:"sv-count",children:J.length})]}),z("div",{className:"sv-previews sv-previews-"+Y,children:J.map((G)=>M("article",{className:"sv-preview-card",onClick:()=>Q(G.path),children:[z("div",{className:"sv-preview-frame",children:z("iframe",{src:Lz(G.path,W,{thumbnail:!0}),title:G.label,scrolling:"no",...W?.canvasOrigin?{sandbox:"allow-scripts allow-same-origin"}:{}})}),M("div",{className:"sv-preview-foot",children:[z("strong",{children:G.label}),z("code",{children:G.path})]})]},G.path))})]})}function F20({activePath:X,selected:J,wsConnected:Q,openCount:Y,theme:W,onToggleTheme:G,onClearSelected:Z,syncStatus:H,syncProject:K,syncOpen:U=!1,onOpenSync:q,changesCount:B=0,unpushed:N=0,changesOpen:F=!1,onOpenChanges:D,version:_}){let R=X===d8,w=J&&J.selector?J.selector+(J.text?` — "${J.text.slice(0,60)}"`:""):"",O=J&&J.dom_path?J.dom_path.join(" > "):J?J.selector:"",P=W==="dark"?"light":"dark",I=(()=>{let $=Fz(H,{project:K});if(!$)return null;let C=$.names.length?` (${$.names.join(", ")})`:"";return{online:$.online,label:$.label,title:`${$.title}${C}${$.next?` — ${$.next}`:""}`}})(),k=I&&M(G0,{children:[z("span",{className:"st-sb-sync-dot"+(I.online?" is-online":""),"aria-hidden":"true"}),z("span",{className:"lbl",children:"hub sync"}),z("span",{className:"val",title:I.title,children:I.label})]});return M("footer",{className:"st-statusbar",role:"contentinfo","data-testid":"statusbar",children:[M("span",{className:"st-sb-slot st-sb-active",role:"group","aria-label":"Active file",children:[z("span",{className:"lead","aria-hidden":"true"}),z("span",{className:"lbl",children:"active"}),z("span",{className:"val",title:X||"",children:R?"▦ design system":X||"—"})]}),X&&J&&J.selector&&!R&&M("span",{className:"st-sb-slot st-sb-sel",role:"group","aria-label":"Selected element",children:[z("span",{className:"lbl",children:"selected"}),z("span",{className:"val",title:O,children:w}),z("button",{type:"button",className:"st-sb-sel-clear",onClick:Z,"data-tip":"Clear · Esc inside iframe","data-tip-pos":"top","aria-label":"Clear selection",children:"×"})]}),M("span",{className:"st-sb-slot",role:"group","aria-label":"Open comments",children:[z("span",{className:"lbl",children:"comments"}),M("span",{className:"val",children:[Y," open"]})]}),D&&M("button",{type:"button",className:"st-sb-slot st-sb-changes"+(F?" is-open":"")+(B>0?" has-changes":N>0?" has-unpushed":""),onClick:D,"data-testid":"open-changes","data-tip":"Open Changes · ⌘⇧G","data-tip-pos":"top","aria-label":"Open Changes panel","aria-pressed":F,children:[z("span",{className:"st-sb-changes-dot","aria-hidden":"true"}),z("span",{className:"lbl",children:"changes"}),z("span",{className:"val",children:B>0?`${B} unsaved`:N>0?`${N} to publish`:"all saved"})]}),z("span",{className:"st-sb-spacer"}),M("span",{className:"st-sb-slot",role:"group","aria-label":"Connection",children:[z("span",{className:"st-live-dot"+(Q?" is-connected":""),"aria-hidden":"true"}),z("span",{className:"lbl",children:Q?"live":"reconnecting"})]}),I&&(q?z("button",{type:"button",className:"st-sb-slot st-sb-sync st-sb-sync--btn"+(U?" is-open":""),onClick:q,"data-testid":"open-sync","data-tip":"Open Sync panel","data-tip-pos":"top","aria-label":"Open Sync panel","aria-pressed":U,children:k}):z("span",{className:"st-sb-slot st-sb-sync",role:"group","aria-label":"Hub sync",children:k})),_&&z("span",{className:"st-sb-slot st-sb-version",role:"group","aria-label":"Maude version",children:M("span",{className:"val","data-testid":"statusbar-version",children:["v",_]})}),M("button",{type:"button",className:"st-sb-theme",onClick:G,"data-tip":`Switch to ${P} theme`,"data-tip-pos":"top","aria-label":`Switch to ${P} theme`,children:[z(A9,{name:W==="dark"?"sun":"moon",size:13}),P]})]})}function L20({commentsByFile:X,filter:J,setFilter:Q,activePath:Y,focusedId:W,onJump:G,onResolve:Z,onReopen:H,onDelete:K,width:U,resizing:q}){let B=z00(X),N=Object.keys(X||{}).sort(),F=[];for(let D of N){let _=X[D]||[],R=_.filter((O)=>{if(J==="open")return O.status!=="resolved";if(J==="resolved")return O.status==="resolved";return!0});if(R.length===0)continue;let w=_.filter((O)=>O.selector);F.push({file:D,comments:R.map((O)=>({...O,n:w.findIndex((P)=>P.id===O.id)+1}))})}return M("aside",{className:"st-rpanel"+(q?" is-resizing":""),style:U?{width:U,flexBasis:U}:void 0,"aria-label":"Comments",children:[z("div",{className:"st-rp-tabs st-rp-tabs--filters",children:M("div",{className:"st-cm-filters",role:"tablist",children:[M("button",{type:"button",className:"st-cm-filter"+(J==="all"?" is-active":""),role:"tab","aria-selected":J==="all",onClick:()=>Q("all"),children:["All · ",B.all]}),M("button",{type:"button",className:"st-cm-filter"+(J==="open"?" is-active":""),role:"tab","aria-selected":J==="open",onClick:()=>Q("open"),children:["Open · ",B.open]}),M("button",{type:"button",className:"st-cm-filter"+(J==="resolved"?" is-active":""),role:"tab","aria-selected":J==="resolved",onClick:()=>Q("resolved"),children:["Resolved · ",B.resolved]})]})}),z("div",{className:"st-rp-body",style:{gap:"var(--space-4)"},children:F.length===0?M("div",{className:"st-rp-empty",children:[M("p",{children:["No comments ",J!=="all"?`with status “${J}”`:"yet","."]}),M("p",{children:["Open a canvas, hold ",z(MX,{children:"⌘"})," and click an element, then press ",z(MX,{children:"C"})," — or hold ",z(MX,{children:"⌘⇧"})," and click directly."]})]}):F.map((D)=>M(G0,{children:[M("button",{type:"button",className:"st-cm-group-hd",onClick:()=>G(D.file,null),title:D.file,children:[z("span",{children:vW(wK(D.file))}),z("span",{className:"st-mono",children:D.comments.length})]}),D.comments.map((_)=>M("div",{className:"st-comment"+(_.status==="resolved"?" is-resolved":"")+(_.id===W?" is-active":""),onClick:()=>G(D.file,_.id),children:[M("div",{className:"st-comment-hd",children:[z("span",{className:"st-pin st-pin--inline",children:_.n||"·"}),z("span",{className:"st-comment-time",children:Sq0(_.created)})]}),z("div",{className:"st-comment-txt",children:_.text}),M("div",{className:"st-comment-foot",children:[z("span",{className:"st-comment-sel",title:(_.dom_path||[]).join(" > "),children:_.selector||"—"}),Z&&H&&K?M("span",{className:"st-mini-act",children:[_.status==="resolved"?z("button",{type:"button",className:"st-iconbtn","aria-label":"Reopen",onClick:(R)=>{R.stopPropagation(),H(_.id)},children:z(A9,{name:"reopen",size:14})}):z("button",{type:"button",className:"st-iconbtn","aria-label":"Resolve",onClick:(R)=>{R.stopPropagation(),Z(_.id)},children:z(A9,{name:"resolve",size:14})}),z("button",{type:"button",className:"st-iconbtn","aria-label":"Delete",onClick:(R)=>{R.stopPropagation(),K(_.id)},children:z(A9,{name:"x",size:14})})]}):null]})]},_.id))]},D.file))})]})}var D20={owner:"You own this project — edit, invite and export.",member:"You can edit this project, comment and export.",viewer:"You can look at this project, comment and download it, but not change it."};function M20({cloud:X}){let J=X?.role||null,[Q,Y]=u.useState(!1);if(!J||Q)return null;let W=`maude-cloud-role-seen:${J}`,G=!1;try{G=localStorage.getItem(W)==="1"}catch{}if(G)return null;let Z=D20[J];if(!Z)return null;return M("div",{role:"status","aria-live":"polite",className:"st-banner st-banner--info","data-testid":"cloud-role-banner",children:[z("span",{className:"st-banner-dot","aria-hidden":"true"}),z("span",{children:Z}),z("button",{type:"button",className:"btn btn--ghost btn--sm","data-testid":"cloud-role-banner-dismiss",onClick:()=>{Y(!0);try{localStorage.setItem(W,"1")}catch{}},children:"Got it"})]})}function O20({update:X,onDismiss:J}){let[Q,Y]=u.useState(!1);if(!X)return null;let W=X.version?` (v${X.version})`:"";return M("div",{role:"status","aria-live":"polite",className:"st-banner st-banner--info",children:[z("span",{className:"st-banner-dot","aria-hidden":"true"}),M("span",{children:["Maude updated",W," · restart to apply"]}),z("button",{type:"button",className:"btn btn--primary btn--sm",disabled:Q,onClick:()=>{Y(!0),Tv().catch(()=>Y(!1))},children:Q?"Restarting…":"Restart now"}),z("button",{type:"button",className:"btn btn--ghost btn--sm",onClick:J,children:"Later"})]})}function _20({status:X}){let[J,Q]=u.useState(null);if(!X||X.linked===!1)return null;if(X.notSyncable)return null;let{state:Y,queuedOps:W,flash:G,conflicts:Z}=X,H=G==="synced",K=Y==="offline"||Y==="offline-long",U=X.docs?.rejected??0,q=Array.isArray(Z)?[...Z].reverse().find((D)=>D.kind==="cold-start-diverged"):null;if(!K&&!H&&!q&&U===0)return null;let B,N,F;if(H)B="success",N="Synced with hub",F=`${Y}:flash`;else if(K){let D=Z&&Z.length>0?` (${Z.length} conflict notice(s))`:"";if(Y==="offline-long")B="error",N=`Long offline — ${W} edit(s) queued. Consider \`git commit && git push\` as backup.${D}`;else B="warn",N=`Working offline · ${W} edit(s) queued · will sync when the hub reconnects.${D}`;F=`${Y}:offline`}else if(q){if(q.snapshotFailed)B="error",N=`Diverged on ${q.slug}: kept local — the history snapshot FAILED, so the overwrite was refused. Check disk space / .design/_history write access.`;else B="warn",N=`Diverged on ${q.slug}: kept the ${q.winner==="local"?"local (newer)":"hub"} version — the other is snapshotted in history → /design:rollback ${q.slug}`;F=`diverged:${q.slug}:${q.at}`}else B="warn",N=`${U} canvas(es) not syncing — the hub rejected auth. Details: maude design status`,F=`rejected:${U}`;if(J===F)return null;return M("div",{role:"status","aria-live":"polite",className:`st-banner st-banner--${B}`,children:[z("span",{className:"st-banner-dot","aria-hidden":"true"}),z("span",{children:N}),z("button",{type:"button",className:"st-banner-close","aria-label":"Dismiss",title:"Dismiss",onClick:()=>Q(F),children:"×"})]})}var A20=["block","inline-block","flex","inline-flex","grid","inline","none"],ce=["px","%","fr","em","auto","min-content","max-content"];var w20=["auto","stretch","flex-start","center","flex-end","baseline"];var ie=["300","400","500","600","700","800"],oe=["inherit","system-ui","sans-serif","serif","monospace","Inter","Inter Tight","JetBrains Mono"],ne=["none","solid","dashed","dotted","double"],re=["px","rem","em","%","vw","vh","auto"],ae=new Set(["line-height","opacity","font-weight","z-index","flex-grow","flex-shrink","order"]),mR={"font-size":{node:z(Q7,{as:aU,size:12})},"line-height":{node:z(Q7,{as:YV,size:12})},"letter-spacing":{node:z(Q7,{as:qV,size:12})},gap:{node:z(Q7,{as:iz,size:12})},width:{t:"W"},height:{t:"H"},"max-width":{t:"W"},"border-radius":{node:z(Q7,{as:DV,size:12})},"border-width":{node:z(Q7,{as:VV,size:12})}};var se=["static","relative","absolute","fixed","sticky"],E20=["normal","italic","oblique"],te=["none","uppercase","lowercase","capitalize"];var ee=["normal","nowrap","pre","pre-wrap","pre-line","break-spaces"],P20=["fill","contain","cover","none","scale-down"];var X00=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],J00=["auto","1 / 1","4 / 3","3 / 2","16 / 9","21 / 9","3 / 4","2 / 3","9 / 16"],D5={desktop:{label:"Desktop",width:1440,height:1024},laptop:{label:"Laptop",width:1280,height:800},tablet:{label:"Tablet",width:834,height:1194},mobile:{label:"Mobile",width:390,height:844}},_K=null;function DF(X){if(!X)return"";if(/^#[0-9a-f]{6}$/i.test(X))return X.toLowerCase();try{if(!_K)_K=document.createElement("canvas").getContext("2d");if(!_K)return"";_K.fillStyle="#000000",_K.fillStyle=X;let J=_K.fillStyle;if(/^#[0-9a-f]{6}$/i.test(J))return J.toLowerCase();let Q=J.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);if(Q)return`#${[Q[1],Q[2],Q[3]].map((Y)=>Number(Y).toString(16).padStart(2,"0")).join("")}`}catch{}return""}var gY=(X)=>Math.min(1,Math.max(0,X));function VF(X){let J=/^#?([0-9a-f]{6})$/i.exec(X||"");if(!J)return{r:0,g:0,b:0};let Q=Number.parseInt(J[1],16);return{r:Q>>16&255,g:Q>>8&255,b:Q&255}}function I3({r:X,g:J,b:Q}){return`#${[X,J,Q].map((Y)=>Math.round(Y).toString(16).padStart(2,"0")).join("")}`}function k3({r:X,g:J,b:Q}){X/=255,J/=255,Q/=255;let Y=Math.max(X,J,Q),W=Math.min(X,J,Q),G=Y-W,Z=0;if(G){if(Y===X)Z=(J-Q)/G%6;else if(Y===J)Z=(Q-X)/G+2;else Z=(X-J)/G+4;if(Z*=60,Z<0)Z+=360}return{h:Z,s:Y?G/Y:0,v:Y}}function AK({h:X,s:J,v:Q}){let Y=Q*J,W=Y*(1-Math.abs(X/60%2-1)),G=Q-Y,Z=0,H=0,K=0;if(X<60)[Z,H,K]=[Y,W,0];else if(X<120)[Z,H,K]=[W,Y,0];else if(X<180)[Z,H,K]=[0,Y,W];else if(X<240)[Z,H,K]=[0,W,Y];else if(X<300)[Z,H,K]=[W,0,Y];else[Z,H,K]=[Y,0,W];return{r:(Z+G)*255,g:(H+G)*255,b:(K+G)*255}}function G7(X){if(!X)return"";let J=/^(-?\d*\.?\d+)px$/.exec(X);return J?`${Math.round(Number.parseFloat(J[1]))}px`:X}function jQ(X){if(!X)return{n:"",unit:"px"};let J=X.trim(),Q=/^(-?\d*\.?\d+)\s*(px|rem|em|%|vw|vh)?$/.exec(J);if(Q)return{n:Q[1],unit:Q[2]||"px"};if(J==="auto")return{n:"",unit:"auto"};return{n:J,unit:""}}function Q00(X,J){if(!X||Array.isArray(X)||Array.isArray(J)||!J)return X;if(!X.id&&!J.id){let Q=(Y)=>typeof Y.selector==="string"&&Y.selector.startsWith("[data-dc-screen=");if(Q(X)&&Q(J)&&X.selector===J.selector&&X.file===J.file)return{...X,authored:X.authored??J.authored,computed:X.computed??J.computed,customStyles:X.customStyles??J.customStyles,attrs:X.attrs??J.attrs,artboardId:X.artboardId??J.artboardId,worldW:X.worldW??J.worldW,worldH:X.worldH??J.worldH};return X}if(!X.id||X.id!==J.id)return X;return{...X,authored:X.authored??J.authored,computed:X.computed??J.computed,customStyles:X.customStyles??J.customStyles,attrs:X.attrs??J.attrs,photoKind:X.photoKind??J.photoKind,photoAsset:X.photoAsset??J.photoAsset}}function V00(X,J){return(X?J?.canvasDesignSystems?.[X]:null)||J?.defaultDesignSystem||J?.designSystems?.[0]?.name||null}function R20(X){let J={};for(let Z of X.matchAll(/(--[a-z0-9-]+)\s*:\s*([^;}]+)/gi))if(!(Z[1]in J))J[Z[1]]=Z[2].trim();let Q={};for(let Z of Object.keys(J)){let H=J[Z],K=/^var\(\s*(--[a-z0-9-]+)\s*\)$/i.exec(H);Q[Z]=K&&J[K[1]]?J[K[1]]:H}let Y=Object.keys(J),W=(Z)=>Y.filter((H)=>Z.test(H)),G=(Z)=>/^(#[0-9a-f]{3,8}|rgba?\(|hsla?\(|oklch\(|oklab\(|lab\(|lch\(|hwb\(|color\()/i.test(Z)||/^(transparent|currentcolor|white|black|red|green|blue|gray|grey|orange|yellow|purple|pink|cyan|magenta|teal|navy|maroon|olive|lime|aqua|silver|gold)$/i.test(Z);return{color:Y.filter((Z)=>G(Q[Z])),space:W(/^--space-/),radius:W(/^--radius-/),type:W(/^--type-/),shadow:W(/^--shadow-/),lh:W(/^--lh-/),vals:Q}}function q00(X,J,Q){let Y=X?.designSystems||[],W=Y.map((H)=>`${H.name}:${H.tokensCssRel}`).join("|"),[G,Z]=u.useState([]);return u.useEffect(()=>{if(!Y.length)return;let H=!1;return Promise.all(Y.map(async(K)=>{if(!K.tokensCssRel)return null;try{let U=await fetch(`/${J}/${K.tokensCssRel}`),q=U.ok?await U.text():"";return{name:K.name,...R20(q)}}catch{return null}})).then((K)=>{if(H)return;let U=K.filter(Boolean);U.sort((q,B)=>q.name===Q?-1:B.name===Q?1:0),Z(U)}),()=>{H=!0}},[W,J,Q]),G}function B00({seed:X,label:J,onApply:Q}){let[Y,W]=u.useState(()=>k3(VF(X||"#000000"))),G=u.useRef(Y);G.current=Y;let Z=u.useRef(null),H=u.useRef(null),K=u.useRef(X);u.useEffect(()=>{if(X&&X!==K.current)K.current=X,W(k3(VF(X)))},[X]);let U=I3(AK(Y)),q=(O)=>{O.preventDefault();let P=Z.current?.getBoundingClientRect();if(!P)return;let I=G.current.h,k=(C)=>{W({h:I,s:gY((C.clientX-P.left)/P.width),v:gY(1-(C.clientY-P.top)/P.height)})};k(O);let $=()=>{document.removeEventListener("pointermove",k),document.removeEventListener("pointerup",$),Q(I3(AK(G.current)))};document.addEventListener("pointermove",k),document.addEventListener("pointerup",$)},B=(O)=>{O.preventDefault();let P=H.current?.getBoundingClientRect();if(!P)return;let{s:I,v:k}=G.current,$=(b)=>{W({h:gY((b.clientX-P.left)/P.width)*360,s:I,v:k})};$(O);let C=()=>{document.removeEventListener("pointermove",$),document.removeEventListener("pointerup",C),Q(I3(AK(G.current)))};document.addEventListener("pointermove",$),document.addEventListener("pointerup",C)},N=(O)=>{let P={...G.current,...O};W(P),Q(I3(AK(P)))},F=(O)=>{let P=O.shiftKey?0.1:0.02,k={ArrowLeft:[-P,0],ArrowRight:[P,0],ArrowUp:[0,P],ArrowDown:[0,-P]}[O.key];if(!k)return;O.preventDefault(),N({s:gY(G.current.s+k[0]),v:gY(G.current.v+k[1])})},D=(O)=>{let P=O.shiftKey?20:2,k={ArrowLeft:-P,ArrowRight:P}[O.key];if(k==null)return;O.preventDefault(),N({h:Math.min(360,Math.max(0,G.current.h+k))})},_=async()=>{try{let O=window.EyeDropper;if(!O)return;let P=await new O().open();if(P?.sRGBHex)W(k3(VF(P.sRGBHex))),Q(P.sRGBHex)}catch{}},R=AK(Y),w=(O)=>{let P={...R,...O},I=k3({r:gY(P.r/255)*255,g:gY(P.g/255)*255,b:gY(P.b/255)*255});W(I),Q(I3(AK(I)))};return M("div",{className:"st-cp-cpick",children:[M("div",{className:"st-cp-cpick-hexrow",children:[z("span",{className:"st-cp-cpick-hexsw",style:{background:U}}),z("input",{className:"st-cp-cpick-hex",type:"text",value:U,"aria-label":J?`${J} hex value`:"hex value",onChange:(O)=>{let P=O.target.value;if(/^#?[0-9a-f]{6}$/i.test(P))W(k3(VF(P)))},onKeyDown:(O)=>{if(O.key==="Enter")Q(O.currentTarget.value)},onBlur:(O)=>Q(O.currentTarget.value),onFocus:(O)=>O.currentTarget.select()})]}),M("button",{type:"button",ref:Z,className:"st-cp-cpick-sv","aria-label":J?`${J} saturation and value`:"saturation and value",style:{background:`hsl(${Y.h} 100% 50%)`},onPointerDown:q,onKeyDown:F,children:[z("span",{className:"st-cp-cpick-svwhite"}),z("span",{className:"st-cp-cpick-svblack"}),z("span",{className:"st-cp-cpick-knob",style:{left:`${Y.s*100}%`,top:`${(1-Y.v)*100}%`,background:U}})]}),M("div",{className:"st-cp-cpick-controls",children:[window.EyeDropper?z("button",{type:"button",className:"st-cp-cpick-eye","aria-label":"pick from screen",title:"eyedropper",onClick:_,children:z(A9,{name:"eyedropper",size:14})}):null,z("span",{className:"st-cp-cpick-preview",style:{background:U},"aria-hidden":"true"}),z("button",{type:"button",ref:H,className:"st-cp-cpick-hue","aria-label":J?`${J} hue`:"hue",onPointerDown:B,onKeyDown:D,children:z("span",{className:"st-cp-cpick-huethumb",style:{left:`${Y.h/360*100}%`}})})]}),z("div",{className:"st-cp-cpick-rgb",children:["r","g","b"].map((O)=>M("label",{className:"st-cp-cpick-rgbf",children:[z("input",{"aria-label":O.toUpperCase(),value:Math.round(R[O]),onChange:(P)=>w({[O]:gY((Number.parseFloat(P.target.value)||0)/255)*255}),onFocus:(P)=>P.currentTarget.select()}),z("span",{children:O.toUpperCase()})]},O))})]})}function BF({kind:X,groups:J,current:Q,onPick:Y,label:W,swatchBg:G,seedHex:Z,activeDs:H,swatchClassName:K}){let[U,q]=u.useState(!1),[B,N]=u.useState(null),[F,D]=u.useState("custom"),[_,R]=u.useState(""),w=u.useRef(null),O=u.useRef(null),P=typeof Q==="string"&&/var\(\s*--/.test(Q),I=(n)=>Q===`var(${n})`,k=(n)=>n.replace(/^--/,"").replace(/-/g," "),$=J||[],C=$.reduce((n,c)=>n+(c.names?.length||0),0),b=$.length>1,v=_.trim().toLowerCase(),h=!v?$:$.map((n)=>({...n,names:(n.names||[]).filter((c)=>k(c).toLowerCase().includes(v)||c.toLowerCase().includes(v)||(n.vals?.[c]||"").toLowerCase().includes(v))})).filter((n)=>n.names.length);u.useEffect(()=>{if(!U){R("");return}let n=()=>{let H0=w.current?.getBoundingClientRect();if(!H0)return;let a=224,D0=300,z0=Math.min(H0.right-a,window.innerWidth-a-8);if(z0<8)z0=8;let X8=window.innerHeight-H0.bottom>D0+8?H0.bottom+4:Math.max(8,H0.top-D0-4);N({left:z0,top:X8,width:a,maxHeight:D0})};n();let c=(H0)=>{if(O.current?.contains(H0.target)||w.current?.contains(H0.target))return;q(!1)},U0=(H0)=>{if(H0.key==="Escape")q(!1)},X0=(H0)=>{if(O.current?.contains(H0.target))return;n()};return document.addEventListener("pointerdown",c,!0),document.addEventListener("keydown",U0),window.addEventListener("resize",n),document.addEventListener("scroll",X0,!0),()=>{document.removeEventListener("pointerdown",c,!0),document.removeEventListener("keydown",U0),window.removeEventListener("resize",n),document.removeEventListener("scroll",X0,!0)}},[U]),u.useEffect(()=>{if(!U||!B||!O.current)return;let n=O.current.getBoundingClientRect(),c=B.left-n.left,U0=B.top-n.top;if(Math.abs(c)>0.5||Math.abs(U0)>0.5)N((X0)=>X0?{...X0,left:X0.left+c,top:X0.top+U0}:X0)},[U,B]);let d=/url\(|image-set\(|cross-fade\(|element\(|expression\(|@import|javascript:/i,o=(n,c,U0)=>{if(H&&n&&n!==H&&U0&&!d.test(U0))Y(U0);else Y(`var(${c})`);q(!1)},x=(n)=>{let c=(n||"").trim();if(c)Y(c)},m=M("div",{className:"st-cp-pop-search",children:[z(A9,{name:"search",size:12}),z("input",{value:_,onChange:(n)=>R(n.target.value),placeholder:"Search variables","aria-label":"search variables",autoFocus:!0})]}),l=(n)=>n.map((c)=>M("div",{className:"st-cp-pop-group",children:[b?z("div",{className:"st-cp-pop-ds",children:c.ds}):null,z("div",{className:"st-cp-pop-list",children:c.names.map((U0)=>M("button",{type:"button",className:`st-cp-pop-row st-cp-pop-crow${I(U0)?" is-on":""}`,onClick:()=>o(c.ds,U0,c.vals?.[U0]),children:[z("span",{className:"st-cp-pop-cswatch",style:{background:c.vals?.[U0]||"transparent"},"aria-hidden":"true"}),z("span",{className:"st-cp-pop-name",children:k(U0)}),z("span",{className:"st-cp-pop-val",children:c.vals?.[U0]||""})]},`${c.ds}:${U0}`))})]},c.ds)),f=(n)=>n.map((c)=>M("div",{className:"st-cp-pop-group",children:[b?z("div",{className:"st-cp-pop-ds",children:c.ds}):null,z("div",{className:"st-cp-pop-list",children:c.names.map((U0)=>M("button",{type:"button",className:`st-cp-pop-row${I(U0)?" is-on":""}`,onClick:()=>o(c.ds,U0,c.vals?.[U0]),children:[z("span",{className:"st-cp-pop-name",children:k(U0)}),z("span",{className:"st-cp-pop-val",children:c.vals?.[U0]||""})]},`${c.ds}:${U0}`))})]},c.ds)),s=z("div",{className:"st-cp-pop-empty",children:"No match"});return M(G0,{children:[G!==void 0?z("button",{type:"button",ref:w,className:`${K||"st-cp-swatch st-cp-swatch--mini st-cp-swatch--trigger"}${P&&!K?" is-bound":""}`,"aria-haspopup":"dialog","aria-expanded":U,"aria-label":W||"pick a colour",title:Q||"pick a colour",onClick:()=>q((n)=>!n),children:z("span",{style:{position:"absolute",inset:0,background:G||"transparent"}})}):z("button",{type:"button",ref:w,className:`st-cp-tokbtn${P?" is-bound":""}`,"aria-haspopup":"dialog","aria-expanded":U,"aria-label":W||"pick a design token",title:"design tokens",onClick:()=>q((n)=>!n),children:z("span",{className:"st-cp-tokbtn-glyph","aria-hidden":"true"})}),U&&B?W00.createPortal(z("div",{ref:O,className:"maude st-cp-pop","data-theme":typeof document<"u"&&document.documentElement.getAttribute("data-theme")||"dark",role:"dialog","aria-label":W||"design tokens",style:{left:B.left,top:B.top,width:B.width,maxHeight:B.maxHeight},children:X==="color"?M(G0,{children:[M("div",{className:"st-cp-poptabs",role:"tablist",children:[z("button",{type:"button",role:"tab","aria-selected":F==="custom",className:`st-cp-poptab${F==="custom"?" is-active":""}`,onClick:()=>D("custom"),children:"Custom"}),z("button",{type:"button",role:"tab","aria-selected":F==="vars",className:`st-cp-poptab${F==="vars"?" is-active":""}`,onClick:()=>D("vars"),children:"Variables"})]}),F==="custom"?z(B00,{seed:Z||DF(Q)||"#000000",onApply:x}):!C?z("div",{className:"st-cp-pop-empty",children:"No color tokens"}):M(G0,{children:[m,h.length?l(h):s]})]}):!C?z("div",{className:"st-cp-pop-empty",children:"No tokens for this property"}):M(G0,{children:[m,h.length?f(h):s]})}),document.body):null]})}function Y00({label:X,tracks:J,editable:Q,onChange:Y}){let W=(K,U)=>{let q=J[K];Y(J.map((B,N)=>N===K?XU.has(U)?{value:0,unit:U}:{value:q.value||1,unit:U}:B))},G=(K,U)=>{Y(J.map((q,B)=>B===K?{...q,value:U}:q))},Z=()=>Y([...J,{value:1,unit:"fr"}]),H=(K)=>Y(J.filter((U,q)=>q!==K));return M("div",{className:"st-cp-gridtracks",children:[M("div",{className:"st-cp-gridtracks-hd",children:[z("span",{className:"st-cp-gridtracks-label",children:X}),z("button",{type:"button",className:"st-btn st-cp-gridtracks-add",disabled:!Q,onClick:Z,children:"+ Track"})]}),J.length===0?M("div",{className:"st-cp-note",children:["No explicit tracks — add one to start defining ",X.toLowerCase(),"."]}):J.map((K,U)=>{let q=XU.has(K.unit);return M("div",{className:"st-cp-gridtrack-row",children:[q?z(_W,{value:K.unit,ariaLabel:`${X} track ${U+1}`,options:ce.map((B)=>({value:B,label:B})),onChange:(B)=>W(U,B)}):z(XX,{value:K.value,min:K.unit==="fr"?0.1:0,step:K.unit==="fr"?0.1:1,ariaLabel:`${X} track ${U+1} value`,lead:String(U+1),unitSlot:z(iB,{value:K.unit,units:ce,ariaLabel:`${X} track ${U+1} unit`,onChange:(B)=>W(U,B)}),onCommit:(B)=>G(U,B)}),z("button",{type:"button",className:"st-btn st-cp-gridtrack-remove","aria-label":`remove ${X} track ${U+1}`,disabled:!Q||J.length<=1,onClick:()=>H(U),children:"×"})]},U)})]})}function T20({el:X,cfg:J,onOptimistic:Q,onRecordEdit:Y,onReplaceMedia:W,onUndoRedo:G,mode:Z,onSetMode:H}){let K=!!X.id,U=X.computed||{},[q,B]=u.useState({a:{},c:{},t:{}});u.useEffect(()=>{B({a:{},c:{},t:{}})},[X.id]);let N=(e,A0)=>{let q0={...e||{}};for(let[j0,r0]of Object.entries(A0))if(r0===null)delete q0[j0];else q0[j0]=r0;return q0},F=N(X.authored,q.a),D=N(X.customStyles,q.c),_=N(X.attrs,q.t),R=(e,A0)=>B((q0)=>({...q0,a:{...q0.a,[e]:A0}})),w=(e,A0)=>B((q0)=>({...q0,c:{...q0.c,[e]:A0}})),O=(e,A0)=>B((q0)=>({...q0,t:{...q0.t,[e]:A0}})),P=(J?.designRel||J?.designRoot||".design").replace(/^\/+|\/+$/g,""),I=V00(X.file,J),k=q00(J,P,I),$=(e)=>k.map((A0)=>({ds:A0.name,names:A0[e]||[],vals:A0.vals})).filter((A0)=>A0.names.length),[C,b]=u.useState({}),[v,h]=u.useState({Layout:!0,Position:!0,Typography:!0,Spacing:!0,Size:!0,Media:!0,Appearance:!0,Advanced:!1}),d=Object.keys(D).length>0||Object.keys(_).length>0;u.useEffect(()=>{if(d)h((e)=>e.Advanced?e:{...e,Advanced:!0})},[X.id,d]);let o=(F.position||G7(U.position)||"static")!=="static";u.useEffect(()=>{if(o)h((e)=>e["d:Position"]?e:{...e,"d:Position":!0})},[X.id,o]);let x=H,[m,l]=u.useState({});async function f(e,A0,q0){b((j0)=>({...j0,[q0]:"saving"}));try{let j0=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(A0)}),r0=await j0.json().catch(()=>({}));b((y8)=>({...y8,[q0]:!j0.ok||!r0.ok?`err:${r0&&r0.error||`HTTP ${j0.status}`}`:"saved"}))}catch(j0){b((r0)=>({...r0,[q0]:`err:${j0&&j0.message?j0.message:String(j0)}`}))}}let s=(e,A0)=>{if(!Q||!X.id)return;Q({id:X.id,artboardId:X.artboardId??null,index:X.index??0,prop:e,value:A0})},n=(e,A0,q0,j0)=>{Y?.({op:e,canvas:X.file,id:X.id,key:A0,before:q0==null||q0===""?null:q0,after:j0==null||j0===""?null:j0})},c=(e,A0)=>{let q0=(A0||"").trim();if(!K||!q0)return;let j0=F[e]??null;if(q0===(j0??"").trim())return;s(e,q0),R(e,q0),f("/_api/edit-css",{canvas:X.file,id:X.id,property:e,value:q0},e),n("css",e,j0,q0)},U0=(e,A0)=>{let q0=(A0||"").trim(),j0=e.trim();if(!K||!j0||!q0)return;let r0=D[j0]??null;s(j0,q0),w(j0,q0),f("/_api/edit-css",{canvas:X.file,id:X.id,property:j0,value:q0},j0),n("css",j0,r0,q0)},X0=(e,A0)=>{let q0=(e||"").trim(),j0=(A0||"").trim();if(!K||!q0||!j0)return;let r0=_[q0]??null;O(q0,j0),f("/_api/edit-attr",{canvas:X.file,id:X.id,attr:q0,value:j0},`@${q0}`),n("attr",q0,r0,j0)},H0=(e)=>{if(!K)return;let A0=F[e]??null;s(e,null),R(e,null),f("/_api/edit-css",{canvas:X.file,id:X.id,property:e,reset:!0},e),n("css",e,A0,null)},a=(e)=>{if(!K)return;let A0=D[e]??null;s(e,null),w(e,null),f("/_api/edit-css",{canvas:X.file,id:X.id,property:e,reset:!0},e),n("css",e,A0,null)},D0=(e)=>{if(!K)return;let A0=_[e]??null;O(e,null),f("/_api/edit-attr",{canvas:X.file,id:X.id,attr:e,reset:!0},`@${e}`),n("attr",e,A0,null)},z0={display:X.parentDisplay,flexDirection:X.parentFlexDirection},l0=(e,A0)=>{if(!K)return;let q0=Math.round((e==="width"?X.bounds?.w:X.bounds?.h)||0),j0=a$(e,A0,z0,q0);for(let r0 of j0.reset)if(F[r0])H0(r0);for(let[r0,y8]of j0.set)c(r0,y8)},X8=X.parentDisplay==="flex"||X.parentDisplay==="inline-flex",d0=(e)=>{let A0=r$(e,F,U,z0);return M("div",{className:"st-cp-moderow",children:[z("span",{className:"st-cp-modelabel",children:e==="width"?"Width sizing":"Height sizing"}),z("div",{className:"st-cp-modeseg",role:"group","aria-label":`${e} sizing mode`,children:z(oB,{value:A0,ariaLabel:`${e} sizing`,options:[{value:"fixed",label:"fixed"},{value:"hug",label:"hug"},{value:"fill",label:"fill"}],onChange:(q0)=>l0(e,q0)})})]},`mode-${e}`)},$0=["flex-start","center","flex-end"],M0=["flex-start","center","flex-end"],i0=["t","c","b"],c8=["l","c","r"],z8=()=>{let e=!(F["flex-direction"]||G7(U["flex-direction"])||"row").startsWith("column"),A0=Math.max(0,$0.indexOf(F["justify-content"]||G7(U["justify-content"])||"flex-start")),q0=F["align-items"]||G7(U["align-items"])||"stretch",j0=q0==="stretch"?1:Math.max(0,M0.indexOf(q0)),[r0,y8]=e?[A0,j0]:[j0,A0];return i0[y8]+c8[r0]},Q9=(e)=>{let A0=i0.indexOf(e[0]),q0=c8.indexOf(e[1]),j0=!(F["flex-direction"]||G7(U["flex-direction"])||"row").startsWith("column"),[r0,y8]=j0?[q0,A0]:[A0,q0];c("justify-content",$0[r0]),c("align-items",M0[y8])},L8=(e)=>{if(!(e.metaKey||e.ctrlKey)||e.altKey)return;let A0=e.key.toLowerCase();if(A0==="z")e.preventDefault(),G?.(e.shiftKey?"redo":"undo");else if(A0==="y")e.preventDefault(),G?.("redo")},W8=(e)=>{let A0=F[e];if(!A0)return"inherit";return/var\(\s*--/.test(A0)?"bound":"raw"};if(!K)return M("div",{className:"st-cp",children:[z("div",{className:"st-cp-id",children:z("span",{className:"st-cp-idtag",children:X.tag||"element"})}),M("div",{className:"st-css-disabled",children:["This selection has no stable element id (a legacy canvas, or a non-element target). Edit it with ",z("code",{children:"/design:edit"}),"."]})]});let b8={bound:"token-bound",raw:"raw override",inherit:"inherited"},i8=(e)=>z("span",{className:`st-cp-prov st-cp-prov--${e}`,role:"img","aria-label":b8[e]}),p9=(e,A0)=>{let q0=A0??W8(e),j0=C[e],r0=typeof j0==="string"&&j0.startsWith("err:")?j0.slice(4):"",y8=r0?" is-err":j0==="saved"?" is-saved":j0==="saving"?" is-saving":"",S8=!!F[e],o8=r0?`error: ${r0}`:S8?`${b8[q0]} · double-click to reset`:b8[q0];return z("button",{type:"button",className:`st-cp-prov st-cp-prov--${q0}${y8}${S8?" is-resettable":""}`,"aria-label":o8,title:o8,tabIndex:S8?0:-1,onDoubleClick:S8?()=>H0(e):void 0,onKeyDown:S8?(e8)=>{if(e8.key==="Backspace"||e8.key==="Delete")e8.preventDefault(),H0(e)}:void 0})},O0=(e,A0,q0,j0)=>{let r0=q0===void 0&&!F[e],y8=j0??e;return M("div",{className:`st-cp-row${r0?" is-unset":""}`,children:[p9(e,q0),z("label",{className:"st-cp-label",title:y8,children:y8}),z("div",{className:"st-cp-ctl",children:A0})]},e)},j8={Layout:["display","flex-direction","flex-wrap","align-items","justify-content","gap"],Grid:["grid-template-columns","grid-template-rows"],"Grid item":["grid-column","grid-row"],Position:["position","top","right","bottom","left","z-index"],Typography:["font-family","color","font-size","font-weight","line-height","letter-spacing","text-align","font-style","text-transform","text-decoration","white-space"],Spacing:["margin-top","margin-right","margin-bottom","margin-left","padding-top","padding-right","padding-bottom","padding-left"],Size:["width","height","min-width","min-height","max-width","max-height","overflow","flex-grow","flex-shrink","flex-basis","align-self"],Media:["object-fit","aspect-ratio","object-position"],Appearance:["background-color","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius","border-width","border-style","border-color","box-shadow","filter","mix-blend-mode","opacity","transform","transform-origin"]},L9=(e)=>{(j8[e]||[]).forEach((A0)=>{if(F[A0])H0(A0)})},U8=(e,A0)=>{let q0=(j8[e]||[]).some((j0)=>F[j0]);return M("section",{className:"st-cp-sec",children:[M("div",{className:"st-cp-sechd-row",children:[M("button",{type:"button",className:"st-cp-sechd","aria-expanded":!!v[e],onClick:()=>h((j0)=>({...j0,[e]:!j0[e]})),children:[z("span",{className:"st-cp-caret","aria-hidden":"true",children:v[e]?"▾":"▸"}),e]}),z("button",{type:"button",className:`st-cp-secreset${q0?"":" is-quiet"}`,"aria-label":`reset ${e} section to original`,title:`reset ${e}`,disabled:!q0,onClick:()=>L9(e),children:z(Q7,{as:DZ,size:12})})]}),z("div",{className:`st-cp-sec-anim${v[e]?" is-open":""}`,children:z("div",{className:"st-cp-sec-inner",children:A0})})]},e)},D9=(e,A0,q0,j0=!0)=>{let r0=`d:${e}`,y8=v[r0]===void 0?j0:v[r0],S8=A0.some((o8)=>F[o8]);return M("section",{className:"st-cp-sec",children:[M("div",{className:"st-cp-sechd-row",children:[M("button",{type:"button",className:"st-cp-sechd","aria-expanded":y8,onClick:()=>h((o8)=>({...o8,[r0]:!y8})),children:[z("span",{className:"st-cp-caret","aria-hidden":"true",children:y8?"▾":"▸"}),e]}),z("button",{type:"button",className:`st-cp-secreset${S8?"":" is-quiet"}`,"aria-label":`reset ${e} to original`,title:`reset ${e}`,disabled:!S8,onClick:()=>A0.forEach((o8)=>{if(F[o8])H0(o8)}),children:z(Q7,{as:DZ,size:12})})]}),z("div",{className:`st-cp-sec-anim${y8?" is-open":""}`,children:z("div",{className:"st-cp-sec-inner",children:q0})})]},r0)},b0=(e)=>z("button",{type:"button",className:"st-cp-clustermore","aria-expanded":!!m[e],"aria-label":m[e]?`${e} — fewer options`:`${e} — more options`,title:m[e]?"fewer":"more",onClick:()=>l((A0)=>({...A0,[e]:!A0[e]})),children:m[e]?"▴":"···"}),Z0=(e,A0)=>M("select",{className:"st-cp-nsel","aria-label":e,value:A0.includes(F[e])?F[e]:"",onChange:(q0)=>c(e,q0.target.value),children:[z("option",{value:"",disabled:!0,children:G7(U[e])||"—"}),A0.map((q0)=>z("option",{value:q0,children:q0},q0))]}),y0=(e)=>$(e).flatMap((A0)=>(A0.names||[]).map((q0)=>({name:q0,value:A0.vals?.[q0]||""}))),c0=(e,A0)=>z(AA,{value:F[e]||G7(U[e])||A0[0].value,ariaLabel:e,options:A0,onChange:(q0)=>c(e,q0)}),q8=(e,A0,q0={})=>{let j0=jQ(F[e]??""),r0=ae.has(e),y8=F[e]??"",S8=typeof y8==="string"&&/var\(\s*--/.test(y8),o8=r0?"":j0.unit&&j0.unit!=="auto"?j0.unit:"px",e8=Number.parseFloat(jQ(G7(U[e])??"").n)||0,P9=j0.n!==""&&j0.n!=null?Number.parseFloat(j0.n)||0:e8,U7=mR[e];return z(nB,{value:S8?y8:P9,tokens:y0(A0),ariaLabel:e,min:q0.min??0,lead:U7?U7.node??U7.t:void 0,unitSlot:r0?null:z(iB,{units:re,value:j0.unit||"px",ariaLabel:`${e} unit`,onChange:(h9)=>c(e,h9==="auto"?"auto":`${j0.n||"0"}${h9}`)}),onChange:(h9)=>c(e,typeof h9==="string"?h9:r0?`${h9}`:`${h9}${o8}`)})},N8=()=>{let e=(r0)=>Number.parseFloat(jQ(F[r0]??F["border-radius"]??G7(U[r0])??G7(U["border-radius"])??"0").n)||0,A0={tl:e("border-top-left-radius"),tr:e("border-top-right-radius"),bl:e("border-bottom-left-radius"),br:e("border-bottom-right-radius")},q0=(r0)=>{if(r0.tl===r0.tr&&r0.tr===r0.bl&&r0.bl===r0.br)["border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius"].forEach((S8)=>{if(F[S8])H0(S8)}),c("border-radius",`${r0.tl}px`);else c("border-top-left-radius",`${r0.tl}px`),c("border-top-right-radius",`${r0.tr}px`),c("border-bottom-left-radius",`${r0.bl}px`),c("border-bottom-right-radius",`${r0.br}px`)},j0=mR["border-radius"];return z(Eh,{corners:A0,lead:j0?j0.node??j0.t:void 0,onCorners:q0})},H8=()=>M("div",{className:"st-cp-border",children:[w9("border-width",null,{fixedUnit:"px"}),M("select",{className:"st-cp-nsel st-cp-nsel--mini","aria-label":"border-style",value:ne.includes(F["border-style"])?F["border-style"]:"",onChange:(e)=>c("border-style",e.target.value),children:[z("option",{value:"",disabled:!0,children:"style"}),ne.map((e)=>z("option",{value:e,children:e},e))]}),z(BF,{kind:"color",groups:$("color"),current:F["border-color"],activeDs:I,swatchBg:U["border-color"]||F["border-color"]||"",seedHex:DF(U["border-color"]||F["border-color"])||"#000000",onPick:(e)=>c("border-color",e),label:"border colour"})]}),m0=()=>{let e=F.transform||G7(U.transform)||"",A0=/rotate\(\s*(-?\d+(?:\.\d+)?)deg\s*\)/.exec(e),q0=((A0?Number.parseFloat(A0[1]):0)%360+360)%360,j0=(r0)=>{let y8=(r0%360+360)%360,S8=(F.transform||"").replace(/\s*rotate\([^)]*\)\s*/g," ").trim();c("transform",`${S8?`${S8} `:""}rotate(${y8}deg)`.trim())};return M("div",{className:"st-cp-num",style:{border:0,background:"transparent",gap:"var(--space-2)"},children:[z(Ah,{value:q0,onChange:j0}),z(XX,{value:q0,min:0,max:360,ariaLabel:"rotation",lead:z(Q7,{as:DZ}),steppers:!1,unitSlot:z("span",{className:"st-cp-numsuffix","aria-hidden":"true",children:"°"}),onCommit:j0})]})},w0=()=>{let e=F.filter||G7(U.filter)||"",A0=/blur\(\s*(-?\d+(?:\.\d+)?)px\s*\)/.exec(e),q0=A0?Number.parseFloat(A0[1]):0;return z(XX,{value:q0,min:0,ariaLabel:"filter blur",unitSlot:z("span",{className:"st-cp-numsuffix","aria-hidden":"true",children:"px"}),onCommit:(r0)=>{let y8=(F.filter||"").replace(/\s*blur\([^)]*\)\s*/g," ").trim();c("filter",r0>0?`${y8?`${y8} `:""}blur(${r0}px)`.trim():y8||"none")}})},K8=()=>{let e=F.opacity,A0=e!=null&&e!==""?Number.parseFloat(e):Number.parseFloat(G7(U.opacity))||1,q0=Math.round((Number.isNaN(A0)?1:A0)*100);return z(CJ,{value:q0,min:0,max:100,step:1,unit:"%",ariaLabel:"opacity",onInput:(j0)=>s("opacity",String(j0/100)),onCommit:(j0)=>c("opacity",String(j0/100))},`opacity:${e??""}`)},I8=()=>{let e=Number.parseInt(F["font-weight"]||G7(U["font-weight"])||"400",10)>=600,A0=(F["font-style"]||G7(U["font-style"]))==="italic",q0=/underline/.test(F["text-decoration"]||G7(U["text-decoration"])||"");return z(Oh,{value:{b:e,i:A0,u:q0},ariaLabel:"text style",options:[{value:"b",node:z(Q7,{as:WV}),label:"Bold"},{value:"i",node:z(Q7,{as:KV}),label:"Italic"},{value:"u",node:z(Q7,{as:_V}),label:"Underline"}],onToggle:(j0)=>{if(j0==="b")c("font-weight",e?"400":"700");else if(j0==="i")c("font-style",A0?"normal":"italic");else c("text-decoration",q0?"none":"underline")}})},k8=[{value:"row",node:z(Q7,{as:UW}),label:"Row"},{value:"column",node:z(Q7,{as:VW}),label:"Column"}],_9=[{value:"flex-start",node:z(Q7,{as:eU}),label:"Start"},{value:"center",node:z(Q7,{as:sU}),label:"Center"},{value:"flex-end",node:z(Q7,{as:tU}),label:"End"},{value:"space-between",node:z(Q7,{as:iz}),label:"Space between"}],A8=[{value:"flex-start",node:z(Q7,{as:QV}),label:"Start"},{value:"center",node:z(Q7,{as:XV}),label:"Center"},{value:"flex-end",node:z(Q7,{as:JV}),label:"End"},{value:"stretch",node:z(Q7,{as:MV}),label:"Stretch"}],T9=[{value:"left",node:z(Q7,{as:f5}),label:"Left"},{value:"center",node:z(Q7,{as:NW}),label:"Center"},{value:"right",node:z(Q7,{as:FW}),label:"Right"},{value:"justify",node:z(Q7,{as:LW}),label:"Justify"}],Y9=[{value:"visible",node:z(Q7,{as:LZ}),label:"Visible"},{value:"hidden",node:z(Q7,{as:MZ}),label:"Hidden"},{value:"scroll",node:z(Q7,{as:FV}),label:"Scroll"}],b7=(e,A0)=>{let q0=$(A0);return q0.length?z(BF,{kind:"value",groups:q0,current:F[e],activeDs:I,onPick:(j0)=>c(e,j0),label:`${e} design token`}):null},E0=(e)=>{let A0=e.currentTarget;requestAnimationFrame(()=>{if(document.activeElement===A0)A0.select()})},f8=(e,A0)=>{if(e.key!=="ArrowUp"&&e.key!=="ArrowDown")return!1;e.preventDefault();let q0=e.shiftKey?10:1,j0=e.key==="ArrowUp"?1:-1,r0=(Number.parseFloat(e.currentTarget.value)||0)+j0*q0;return e.currentTarget.value=String(r0),A0(r0),!0},v9=(e)=>z("input",{className:"st-cp-fin","aria-label":e,defaultValue:F[e]??"",placeholder:G7(U[e])||"—",onFocus:E0,onKeyDown:(A0)=>{if(A0.key==="Enter")A0.currentTarget.blur()},onBlur:(A0)=>c(e,A0.currentTarget.value)},`${e}:${F[e]??""}`),w9=(e,A0,q0={})=>{let j0=jQ(F[e]??""),r0=ae.has(e),y8=r0?"":q0.fixedUnit||(j0.unit&&j0.unit!=="auto"?j0.unit:"px"),S8=mR[e],o8=Number.parseFloat(jQ(G7(U[e])??"").n)||0,e8=j0.n!==""&&j0.n!=null?Number.parseFloat(j0.n)||0:o8;return M(G0,{children:[z(XX,{value:e8,min:q0.min??0,step:1,ariaLabel:e,lead:S8?S8.node??S8.t:void 0,onCommit:(P9)=>c(e,r0?`${P9}`:`${P9}${y8}`),unitSlot:r0||q0.fixedUnit?null:z(iB,{units:re,value:j0.unit||"px",ariaLabel:`${e} unit`,onChange:(P9)=>c(e,P9==="auto"?"auto":`${j0.n||"0"}${P9}`)})},`${e}:${F[e]??""}`),b7(e,A0)]})},G6=(e)=>{let A0=U[e]||F[e]||"",q0=F[e]??"",j0=typeof q0==="string"&&/var\(\s*--/.test(q0),r0=j0?q0.replace(/^var\(\s*|\s*\)$/g,"").replace(/^--/,"").replace(/-/g," "):q0;return z(wV,{swatch:z(BF,{kind:"color",swatchClassName:"st-cp-cf-sw",groups:$("color"),current:F[e],activeDs:I,swatchBg:A0,seedHex:DF(U[e]||F[e])||"#000000",onPick:(y8)=>c(e,y8),label:`${e} colour`}),displayValue:r0,bound:j0,ariaLabel:e,onValue:(y8)=>c(e,y8)})},_6=(e,A0)=>{let q0=null,j0=A0.unitless?"":"px",r0=(o8)=>A0.unitless?`${o8}`:`${o8}${j0}`,y8=(o8,e8,P9)=>{for(let U7 of e8??[e])P9(U7,r0(o8))},S8=_A({getBase:()=>q0?.value??"0",min:A0.min??0,step:1,sides:A0.sides,onInput:(o8,e8)=>{if(q0)q0.value=String(o8);if(e8){let P9=q0?.closest(".st-cp-box");for(let U7 of e8){if(U7===e)continue;let h9=P9?.querySelector(`.st-cp-boxv[aria-label="${U7}"]`);if(h9)h9.value=String(o8)}}y8(o8,e8,s)},onCommit:(o8,e8)=>y8(o8,e8,c)});return{onPointerDown:(o8)=>{q0=o8.currentTarget,S8(o8)}}},g8=(e,A0)=>{let q0=F[e],j0=q0!=null&&q0!==""?jQ(q0).n||q0:jQ(G7(U[e])??"").n||"0",r0=!q0||q0==="0"||q0==="0px"||q0==="auto",y8=e.split("-").pop(),S8=y8==="top"||y8==="bottom"?[`${A0}-top`,`${A0}-bottom`]:[`${A0}-left`,`${A0}-right`],o8=[`${A0}-top`,`${A0}-right`,`${A0}-bottom`,`${A0}-left`];return z("input",{className:`st-cp-boxv st-cp-scrub st-cp-boxv--${A0[0]}${e.split("-").pop()[0]}${r0?" is-zero":""}`,"aria-label":e,defaultValue:j0,title:"drag to scrub · alt = symmetric · alt+shift = all sides",..._6(e,{sides:{pair:S8,all:o8}}),onFocus:E0,onKeyDown:(e8)=>{if(f8(e8,(P9)=>c(e,`${P9}px`)))return;if(e8.key==="Enter")e8.currentTarget.blur()},onBlur:(e8)=>{let P9=e8.currentTarget.value.trim();if(!P9)return;let U7=/[a-z%]/i.test(P9)?P9:`${P9}px`;c(e,U7)}},`${e}:${q0??""}`)},a9=(e)=>{let A0=F[e],q0=A0!=null&&A0!==""&&A0!=="auto"?jQ(A0).n||A0:jQ(G7(U[e])??"").n||"",j0=!A0||A0==="auto"||A0==="0"||A0==="0px",r0=e==="top"||e==="bottom"?["top","bottom"]:["left","right"],y8=["top","right","bottom","left"];return z("input",{className:`st-cp-boxv st-cp-scrub st-cp-boxv--i${e[0]}${j0?" is-zero":""}`,"aria-label":e,defaultValue:q0,placeholder:"auto",title:"drag to scrub · alt = axis pair · alt+shift = all sides · type auto",..._6(e,{sides:{pair:r0,all:y8},min:-1/0}),onFocus:E0,onKeyDown:(S8)=>{if(f8(S8,(o8)=>c(e,`${o8}px`)))return;if(S8.key==="Enter")S8.currentTarget.blur()},onBlur:(S8)=>{let o8=S8.currentTarget.value.trim();if(!o8)return;let e8=/[a-z%]/i.test(o8)?o8:`${o8}px`;c(e,e8)}},`${e}:${A0??""}`)},m7=Object.entries(D),P7=Object.entries(_),E9=()=>{let e=(X.tag||"").toLowerCase(),q0=e==="img"||e==="video"||e==="picture"||e==="svg"||e==="canvas"||!!F["object-fit"]||!!F["object-position"]||!!F["aspect-ratio"],j0=(e==="img"||e==="video")&&!!X.attrs?.src&&!!W;return{showMedia:q0,canReplace:j0}},l6=(e)=>M(G0,{children:[e&&z("div",{className:"st-cp-mediabtn",children:z("button",{type:"button",className:"st-btn st-cp-replace",onClick:()=>W(X),children:"Replace…"})}),O0("object-fit",Z0("object-fit",P20)),O0("object-position",v9("object-position")),O0("aspect-ratio",M("select",{className:"st-cp-nsel","aria-label":"aspect-ratio",value:J00.includes(F["aspect-ratio"])?F["aspect-ratio"]:"",onChange:(A0)=>{let q0=A0.target.value;if(c("aspect-ratio",q0),q0&&q0!=="auto"&&F.height)H0("height")},children:[z("option",{value:"",disabled:!0,children:G7(U["aspect-ratio"])||"—"}),J00.map((A0)=>z("option",{value:A0,children:A0},A0))]}))]});return M("div",{className:`st-cp${Z==="designer"?" st-cp--designer":""}`,"data-tour":"css-panel",onKeyDown:L8,children:[M("div",{className:"st-cp-id",children:[M("span",{className:"st-cp-idtag",children:[X.tag||"element",X.classes?M("span",{className:"st-cp-idcls",children:[".",X.classes.split(/\s+/)[0]]}):null]}),z("span",{className:"st-cp-idmode","data-tour":"cp-mode",children:z(AA,{value:Z,ariaLabel:"panel vocabulary mode",options:[{value:"advanced",node:z(Q7,{as:KW,size:12}),label:"Advanced — raw CSS"},{value:"designer",node:z(Q7,{as:DW,size:12}),label:"Designer — Figma vocabulary"}],onChange:x})})]}),Z==="designer"?M(G0,{children:[D9("Auto layout",["display","flex-direction","flex-wrap","align-items","justify-content","gap","padding-top","padding-right","padding-bottom","padding-left"],(()=>{let e=(F.display||G7(U.display)||"").trim();return e==="flex"||e==="inline-flex"?M(G0,{children:[O0("flex-direction",c0("flex-direction",k8),void 0,"Direction"),O0("align-items",z(_h,{value:z8(),onChange:Q9,ariaLabel:"auto-layout alignment"}),W8("align-items"),"Alignment"),O0("gap",q8("gap","space"),void 0,"Gap"),M("div",{className:"st-cp-modes",children:[d0("width"),d0("height")]}),M("div",{className:"st-cp-box","aria-label":"padding",children:[M("span",{className:"st-cp-boxtag st-cp-boxtag--p",children:[i8(W8("padding-top")),"padding"]}),g8("padding-top","padding"),g8("padding-right","padding"),g8("padding-bottom","padding"),g8("padding-left","padding")]}),z("div",{className:"st-cp-clustermore-row",children:b0("Auto layout")}),m["Auto layout"]?O0("flex-wrap",z(kQ,{checked:/^wrap/.test(F["flex-wrap"]||G7(U["flex-wrap"])||""),label:"wrap items",ariaLabel:"flex-wrap",onChange:(q0)=>c("flex-wrap",q0?"wrap":"nowrap")}),W8("flex-wrap"),"Wrap"):null]}):z("button",{type:"button",className:"st-cp-makeflex",disabled:!K,onClick:()=>c("display","flex"),children:"+ Auto layout (flex)"})})()),D9("Size",["width","height","min-width","max-width","min-height","max-height"],M(G0,{children:[O0("width",w9("width"),void 0,"Width"),O0("height",w9("height"),void 0,"Height"),z("div",{className:"st-cp-clustermore-row",children:b0("Size")}),m.Size?M(G0,{children:[O0("min-width",w9("min-width"),void 0,"Min width"),O0("max-width",w9("max-width"),void 0,"Max width"),O0("min-height",w9("min-height"),void 0,"Min height"),O0("max-height",w9("max-height"),void 0,"Max height")]}):null]})),D9("Position",["position","top","right","bottom","left","z-index"],M(G0,{children:[O0("position",Z0("position",se),void 0,"Position"),M("div",{className:"st-cp-box st-cp-box--inset","aria-label":"position inset (top / right / bottom / left)",children:[M("span",{className:"st-cp-boxtag st-cp-boxtag--i",children:[i8(W8("top")),"inset"]}),a9("top"),a9("right"),a9("bottom"),a9("left"),z("div",{className:"st-cp-boxcore st-cp-boxcore--pos",children:F.position||G7(U.position)||"static"})]}),(F.position||G7(U.position)||"static")==="static"?z("div",{className:"st-cp-note",children:"top / right / bottom / left apply once position is relative, absolute, fixed, or sticky"}):null,z("div",{className:"st-cp-clustermore-row",children:b0("Position")}),m.Position?O0("z-index",w9("z-index"),void 0,"Layer order"):null]}),!1),D9("Fill",["background-color"],O0("background-color",G6("background-color"),void 0,"Fill")),D9("Stroke",["border-width","border-style","border-color"],O0("border",H8(),W8("border-width"),"Stroke")),D9("Corner radius",["border-radius","border-top-left-radius","border-top-right-radius","border-bottom-left-radius","border-bottom-right-radius"],O0("border-radius",N8(),W8("border-radius"),"Corner radius")),D9("Effects",["box-shadow","filter","mix-blend-mode"],M(G0,{children:[O0("box-shadow",b7("box-shadow","shadow")||v9("box-shadow"),void 0,"Shadow"),O0("filter",w0(),W8("filter"),"Blur"),O0("mix-blend-mode",Z0("mix-blend-mode",X00),void 0,"Blend")]})),D9("Opacity",["opacity"],O0("opacity",K8(),void 0,"Opacity")),D9("Text",["font-family","color","font-size","font-weight","line-height","text-align","letter-spacing","font-style","text-transform","white-space"],M(G0,{children:[O0("font-family",Z0("font-family",oe),void 0,"Font"),O0("color",G6("color"),void 0,"Color"),O0("font-size",q8("font-size","type"),void 0,"Size"),O0("font-weight",Z0("font-weight",ie),void 0,"Weight"),O0("line-height",w9("line-height","lh"),void 0,"Line height"),O0("text-align",c0("text-align",T9),void 0,"Align"),z("div",{className:"st-cp-clustermore-row",children:b0("Text")}),m.Text?M(G0,{children:[O0("letter-spacing",w9("letter-spacing",null,{min:-1/0}),void 0,"Letter spacing"),O0("font-style",Z0("font-style",E20),void 0,"Style"),O0("text-transform",Z0("text-transform",te),void 0,"Case"),O0("white-space",Z0("white-space",ee),void 0,"Whitespace")]}):null]})),D9("Spacing",["margin-top","margin-right","margin-bottom","margin-left"],M("div",{className:"st-cp-box","aria-label":"margin",children:[M("span",{className:"st-cp-boxtag st-cp-boxtag--m",children:[i8(W8("margin-top")),"margin"]}),g8("margin-top","margin"),g8("margin-right","margin"),g8("margin-bottom","margin"),g8("margin-left","margin")]})),(()=>{let{showMedia:e,canReplace:A0}=E9();return e?D9("Media",["object-fit","object-position","aspect-ratio"],l6(A0)):null})()]}):M(G0,{children:[U8("Layout",(()=>{let e=(F.display||G7(U.display)||"").trim(),A0=e==="flex"||e==="inline-flex",q0=e==="grid"||e==="inline-grid";return M(G0,{children:[O0("display",Z0("display",A20)),A0?M(G0,{children:[O0("flex-direction",c0("flex-direction",k8)),O0("flex-wrap",z(kQ,{checked:/^wrap/.test(F["flex-wrap"]||G7(U["flex-wrap"])||""),label:"wrap items",ariaLabel:"flex-wrap",onChange:(j0)=>c("flex-wrap",j0?"wrap":"nowrap")}),W8("flex-wrap"))]}):null,A0||q0?M(G0,{children:[O0("align-items",c0("align-items",A8)),O0("justify-content",c0("justify-content",_9)),O0("gap",q8("gap","space"))]}):z("button",{type:"button",className:"st-cp-makeflex",disabled:!K,onClick:()=>c("display","flex"),children:"+ Auto layout (flex)"})]})})()),(()=>{let e=(F.display||G7(U.display)||"").trim();if(!(e==="grid"||e==="inline-grid"))return null;let q0=F["grid-template-columns"]||"",j0=F["grid-template-rows"]||"",r0=wM(q0),y8=wM(j0),S8=r0.length>0||!q0.trim(),o8=y8.length>0||!j0.trim();return U8("Grid",M(G0,{children:[S8?z(Y00,{label:"Columns",tracks:r0,editable:K,onChange:(e8)=>c("grid-template-columns",EM(e8))}):M("div",{className:"st-cp-note",children:["Columns use ",z("code",{children:q0})," — not editable as tracks here (repeat()/ minmax()/subgrid); use /design:edit for these."]}),o8?z(Y00,{label:"Rows",tracks:y8,editable:K,onChange:(e8)=>c("grid-template-rows",EM(e8))}):M("div",{className:"st-cp-note",children:["Rows use ",z("code",{children:j0})," — not editable as tracks here (repeat()/minmax()/ subgrid); use /design:edit for these."]})]}))})(),U8("Position",M(G0,{children:[O0("position",Z0("position",se)),M("div",{className:"st-cp-box st-cp-box--inset","aria-label":"position inset (top / right / bottom / left)",children:[M("span",{className:"st-cp-boxtag st-cp-boxtag--i",children:[i8(W8("top")),"inset"]}),a9("top"),a9("right"),a9("bottom"),a9("left"),z("div",{className:"st-cp-boxcore st-cp-boxcore--pos",children:F.position||G7(U.position)||"static"})]}),(F.position||G7(U.position)||"static")==="static"?z("div",{className:"st-cp-note",children:"top / right / bottom / left apply once position is relative, absolute, fixed, or sticky"}):null,O0("z-index",w9("z-index"))]})),(X.parentDisplay==="grid"||X.parentDisplay==="inline-grid")&&U8("Grid item",M(G0,{children:[M("div",{className:"st-cp-note",children:["Manual cell placement — ",z("code",{children:"start / end"})," or ",z("code",{children:"start / span N"}),"."]}),O0("grid-column",v9("grid-column")),O0("grid-row",v9("grid-row"))]})),U8("Typography",M(G0,{children:[O0("font-family",Z0("font-family",oe)),O0("color",G6("color")),O0("font-size",q8("font-size","type")),O0("font-weight",Z0("font-weight",ie)),O0("line-height",w9("line-height","lh")),O0("letter-spacing",w9("letter-spacing",null,{min:-1/0})),O0("text-align",c0("text-align",T9)),O0("font-style",I8(),W8("font-style")),O0("text-transform",Z0("text-transform",te)),O0("white-space",Z0("white-space",ee))]})),U8("Spacing",z(G0,{children:M("div",{className:"st-cp-box","aria-label":"margin and padding",children:[M("span",{className:"st-cp-boxtag st-cp-boxtag--m",children:[i8(W8("margin-top")),"margin"]}),g8("margin-top","margin"),g8("margin-right","margin"),g8("margin-bottom","margin"),g8("margin-left","margin"),M("div",{className:"st-cp-boxpad",children:[M("span",{className:"st-cp-boxtag st-cp-boxtag--p",children:[i8(W8("padding-top")),"padding"]}),g8("padding-top","padding"),g8("padding-right","padding"),g8("padding-bottom","padding"),g8("padding-left","padding"),M("div",{className:"st-cp-boxcore",children:[Math.round(Number.parseFloat(F.width)||X.bounds?.w||0)," × ",Math.round(Number.parseFloat(F.height)||X.bounds?.h||0)]})]})]})})),U8("Size",M(G0,{children:[M("div",{className:"st-cp-modes",children:[d0("width"),d0("height")]}),O0("width",w9("width")),O0("height",w9("height")),O0("min-width",w9("min-width")),O0("max-width",w9("max-width")),O0("min-height",w9("min-height")),O0("max-height",w9("max-height")),O0("overflow",c0("overflow",Y9)),X8?M(G0,{children:[z("div",{className:"st-cp-subhd",children:"In flex parent"}),O0("align-self",Z0("align-self",w20)),O0("flex-grow",w9("flex-grow",null,{unitless:!0})),O0("flex-shrink",w9("flex-shrink",null,{unitless:!0})),O0("flex-basis",w9("flex-basis"))]}):null]})),(()=>{let{showMedia:e,canReplace:A0}=E9();return e?U8("Media",l6(A0)):null})(),U8("Appearance",M(G0,{children:[O0("background-color",G6("background-color")),O0("border-radius",N8(),W8("border-radius")),O0("border",H8(),W8("border-width")),O0("box-shadow",b7("box-shadow","shadow")||v9("box-shadow")),O0("filter",w0(),W8("filter")),O0("mix-blend-mode",Z0("mix-blend-mode",X00)),O0("opacity",K8()),O0("rotation",m0(),W8("transform")),O0("transform",v9("transform")),O0("transform-origin",v9("transform-origin"))]})),(()=>{let e=Object.entries(C).find(([,A0])=>typeof A0==="string"&&A0.startsWith("err:"));return e?M("div",{className:"st-cp-save is-err",role:"status",children:[z(A9,{name:"x",size:12}),e[0],": ",e[1].slice(4)]}):null})(),U8("Advanced",M("div",{className:"st-cp-advbody",children:[m7.length?M(G0,{children:[z("div",{className:"st-cp-advgrp",children:"Custom CSS properties"}),m7.map(([e,A0])=>M("div",{className:"st-cp-kv",children:[z("input",{className:"st-cp-fin st-cp-fin--ro",readOnly:!0,value:e,"aria-label":`custom property ${e} name`}),z("input",{className:"st-cp-fin",defaultValue:A0,"aria-label":`${e} value`,onKeyDown:(q0)=>{if(q0.key==="Enter")q0.currentTarget.blur()},onBlur:(q0)=>U0(e,q0.currentTarget.value)},`cs:${e}:${A0}`),z("button",{type:"button",className:"st-cp-kvx","aria-label":`remove ${e}`,title:"remove",onClick:()=>a(e),children:z(A9,{name:"x",size:11})})]},`cs:${e}`))]}):null,z("div",{className:"st-cp-advgrp",children:"Add CSS property"}),z(I20,{commit:U0}),z("div",{className:"st-cp-note",children:"applied as-is — not token-bound"}),P7.length?M(G0,{children:[z("div",{className:"st-cp-advgrp",children:"Custom HTML attributes"}),P7.map(([e,A0])=>M("div",{className:"st-cp-kv",children:[z("input",{className:"st-cp-fin st-cp-fin--ro",readOnly:!0,value:e,"aria-label":`attribute ${e} name`}),z("input",{className:"st-cp-fin",defaultValue:A0,"aria-label":`${e} value`,onKeyDown:(q0)=>{if(q0.key==="Enter")q0.currentTarget.blur()},onBlur:(q0)=>X0(e,q0.currentTarget.value)},`at:${e}:${A0}`),z("button",{type:"button",className:"st-cp-kvx","aria-label":`remove ${e}`,title:"remove",onClick:()=>D0(e),children:z(A9,{name:"x",size:11})})]},`at:${e}`))]}):null,z("div",{className:"st-cp-advgrp",children:"Add HTML attribute"}),z(k20,{commit:X0})]}))]}),M("div",{className:"st-cp-legend",children:[M("span",{children:[z("i",{className:"st-cp-prov st-cp-prov--bound","aria-hidden":"true"}),"token"]}),M("span",{children:[z("i",{className:"st-cp-prov st-cp-prov--raw","aria-hidden":"true"}),"override"]}),M("span",{children:[z("i",{className:"st-cp-prov st-cp-prov--inherit","aria-hidden":"true"}),"inherited"]})]})]},X.id)}function I20({commit:X}){let[J,Q]=u.useState(""),[Y,W]=u.useState(""),G=()=>{if(J.trim()&&Y.trim())X(J.trim(),Y),Q(""),W("")};return M("div",{className:"st-cp-kv",children:[z("input",{className:"st-cp-fin","aria-label":"custom property name",placeholder:"property",value:J,onChange:(Z)=>Q(Z.target.value)}),z("input",{className:"st-cp-fin","aria-label":"custom property value",placeholder:"value",value:Y,onChange:(Z)=>W(Z.target.value),onKeyDown:(Z)=>{if(Z.key==="Enter")G()},onBlur:G})]})}function k20({commit:X}){let[J,Q]=u.useState(""),[Y,W]=u.useState(""),G=()=>{if(J.trim()&&Y.trim())X(J.trim(),Y),Q(""),W("")};return M("div",{className:"st-cp-kv",children:[z("input",{className:"st-cp-fin","aria-label":"custom attribute name",placeholder:"data-…",value:J,onChange:(Z)=>Q(Z.target.value)}),z("input",{className:"st-cp-fin","aria-label":"custom attribute value",placeholder:"value",value:Y,onChange:(Z)=>W(Z.target.value),onKeyDown:(Z)=>{if(Z.key==="Enter")G()},onBlur:G})]})}var C20={button:"button",heading:"type",text:"type",input:"input",form:"input",image:"image",link:"link",list:"list",nav:"layers",box:"box",group:"folder"};function $20(X,J,Q,Y){if(!Array.isArray(X)||J===Q)return X;let W=JSON.parse(JSON.stringify(X)),G=null,Z=(K)=>{for(let U=0;U<K.length;U++){if(K[U].id===J)return G=K[U],K.splice(U,1),!0;if(K[U].children&&Z(K[U].children))return!0}return!1};if(Z(W),!G)return X;let H=(K)=>{for(let U=0;U<K.length;U++){if(K[U].id===Q){if(Y==="inside-start"||Y==="inside-end")if(K[U].children=K[U].children||[],Y==="inside-start")K[U].children.unshift(G);else K[U].children.push(G);else K.splice(Y==="before"?U:U+1,0,G);return!0}if(K[U].children&&H(K[U].children))return!0}return!1};return H(W)?W:X}var S20=new Set(["img","input","br","hr","area","base","col","embed","link","meta","param","source","track","wbr"]);function N00({node:X,depth:J,selectedId:Q,selectedIndex:Y,collapsed:W,hiddenOverride:G,onToggle:Z,onSelect:H,onHover:K,onToggleVisibility:U,onReorder:q,onRowPointerDown:B,dragState:N,componentMap:F,lockedKeys:D,onToggleLock:_,onRename:R}){let w=`${X.id}:${X.index}`,O=X.children&&X.children.length>0,P=W.has(w),I=!!X.synthetic,k=!I&&F?F[X.id]:null,$=!I&&!!D?.has(w),[C,b]=u.useState(!1),[v,h]=u.useState(""),d=!I&&X.id===Q&&(Y==null||X.index===Y),o=G?.has(w)?G.get(w):!!X.hidden,x=!!q&&!I&&!$,m=()=>{b(!1);let s=v.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"");if(!s||s===(X.dcElement??""))return;R?.(X,s)},l=N?.key===w,f=l?{transform:`translate(${N.dx}px, ${N.dy}px)`,opacity:0.9,zIndex:20,position:"relative",pointerEvents:"none",cursor:"grabbing",boxShadow:"0 6px 18px rgba(0, 0, 0, 0.28)"}:null;return M(G0,{children:[M("div",{className:"st-layer st-layer--row"+(d?" is-sel":"")+(o?" is-hidden":"")+(I?" is-group":"")+(k?" is-instance":"")+($?" is-locked":""),style:{paddingLeft:6+J*14,...f},role:"treeitem","aria-selected":I?void 0:d,"aria-expanded":O?!P:void 0,"aria-grabbed":x?l:void 0,tabIndex:0,title:I?`${X.tag} · group (unstamped wrapper)`:`${X.tag} · ${X.type}${R?" · F2 to rename":""}`,"data-layer-key":w,onClick:()=>I?O&&Z(w):H(X),onMouseEnter:()=>!I&&K(X),onMouseLeave:()=>K(null),onPointerDown:x?(s)=>B(s,X,w):void 0,onKeyDown:(s)=>{if(s.key==="Enter"||s.key===" ")if(s.preventDefault(),I)O&&Z(w);else H(X);else if(s.key==="F2"&&R&&!I)s.preventDefault(),h(X.dcElement||X.label||""),b(!0)},children:[O?z("button",{type:"button",className:"st-layer-caret","aria-label":P?"Expand":"Collapse",onClick:(s)=>{s.stopPropagation(),Z(w)},children:P?"▸":"▾"}):z("span",{className:"st-layer-caret","aria-hidden":"true"}),k?z("span",{className:"st-layer-inst-glyph","aria-hidden":"true",children:k.root?"◆":"◇"}):z(A9,{name:C20[X.type]||"box",size:12,className:"st-layer-ticon"}),C?z("input",{className:"st-layer-rename",value:v,autoFocus:!0,"aria-label":`Rename ${X.label}`,onFocus:(s)=>s.target.select(),onChange:(s)=>h(s.target.value),onClick:(s)=>s.stopPropagation(),onPointerDown:(s)=>s.stopPropagation(),onBlur:m,onKeyDown:(s)=>{if(s.stopPropagation(),s.key==="Enter")m();else if(s.key==="Escape")b(!1)}}):z("span",{className:"st-layer-label",onDoubleClick:R&&!I?(s)=>{s.stopPropagation(),h(X.dcElement||X.label||""),b(!0)}:void 0,children:X.label}),z("span",{className:"st-layer-type",children:k?k.component:X.type}),_&&!I?z("button",{type:"button",className:"st-layer-lock","aria-label":$?`Unlock ${X.label}`:`Lock ${X.label}`,"aria-pressed":$,title:$?"Unlock":"Lock",onClick:(s)=>{s.stopPropagation(),_(w)},children:z(A9,{name:$?"lock":"unlock",size:12})}):null,U&&!I?z("button",{type:"button",className:"st-layer-eye","aria-label":o?`Show ${X.label}`:`Hide ${X.label}`,"aria-pressed":o,title:o?"Show":"Hide",onClick:(s)=>{s.stopPropagation(),U(X)},children:z(A9,{name:o?"eye-off":"eye",size:13})}):null]}),O&&!P?X.children.map((s,n)=>z(N00,{node:s,depth:J+1,selectedId:Q,selectedIndex:Y,collapsed:W,hiddenOverride:G,onToggle:Z,onSelect:H,onHover:K,onToggleVisibility:U,onReorder:q,onRowPointerDown:B,dragState:N,componentMap:F,lockedKeys:D,onToggleLock:_,onRename:R},`${s.id}:${s.index}`)):null]})}function b20({el:X}){let J=X?.computed||{},Q=X?.authored||{},Y=(U)=>{let q=Q[U];if(q&&/var\(\s*--/.test(q))return q.replace(/^var\(\s*|\s*\)$/g,"");return J[U]||q||""},W=(U,q)=>{let B=J[q]||Q[q];if(!B)return null;return M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:U}),M("div",{className:"st-swatch-row",children:[z("span",{className:"st-insp-swatch",style:{background:B},"aria-hidden":"true"}),z("span",{className:"st-mono",style:{fontSize:11,color:"var(--fg-1)"},children:Y(q)})]})]},U)},G=J["border-radius"]&&J["border-radius"]!=="0px",Z=G?jQ(J["border-radius"]).n||J["border-radius"]:null,H=J["font-size"]||J["font-weight"]?[J["font-size"],J["font-weight"]].filter(Boolean).join(" / "):null;if(!(J["background-color"]||J.color||G||H))return null;return M(G0,{children:[G?M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:"Radius"}),M("div",{className:"st-insp-fields",children:[M("span",{className:"st-fmini",style:{flex:"0 0 auto",maxWidth:84},children:[z("span",{className:"st-mtag",children:"r"}),z("input",{value:Z,readOnly:!0,"aria-label":"border radius"})]}),z("span",{className:"st-insp-unit",children:"px"})]})]}):null,W("Fill","background-color"),W("Text","color"),H?M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:"Font"}),z("div",{className:"st-insp-fields",children:z("span",{className:"st-mono",style:{fontSize:11,color:"var(--fg-0)"},children:H})})]}):null]})}function F00(X){if(X.artboardId)return X.artboardId;let J=/^\[data-dc-screen="([^"]+)"\]$/.exec(X.selector||"");return J?J[1]:null}var y20=[["","Block (default)"],["flex-col","Flex ↓ (column)"],["flex-row","Flex → (row)"],["grid","Grid"]],j20=[["digital","Digital"],["print","Print"],["web","Web"],["video","Video"]];function f20({el:X,cfg:J,onResizeArtboard:Q,onSetArtboardHug:Y,onSetArtboardStyle:W,onSetArtboardKind:G,onSetArtboardPrint:Z,onDuplicateArtboard:H}){let K=F00(X),U=(J?.designRel||J?.designRoot||".design").replace(/^\/+|\/+$/g,""),q=V00(X.file,J),B=q00(J,U,q),N=(f)=>B.map((s)=>({ds:s.name,names:s[f]||[],vals:s.vals})).filter((s)=>s.names.length),F=(f)=>N(f).flatMap((s)=>(s.names||[]).map((n)=>({name:n,value:s.vals?.[n]||""}))),D=(f)=>{let s=/^var\(\s*(--[\w-]+)\s*\)$/.exec(f||"");if(!s)return f||"";for(let n of B){let c=n.vals?.[s[1]];if(c)return c}return""},_=Number.isFinite(X.worldW)?X.worldW:Number.isFinite(X.bounds?.w)?X.bounds.w:null,R=Number.isFinite(X.worldH)?X.worldH:Number.isFinite(X.bounds?.h)?X.bounds.h:null,w=(f,s)=>{if(!K)return;let n=Number.isFinite(f)&&f>0?Math.round(f):void 0,c=Number.isFinite(s)&&s>0?Math.round(s):void 0;if(n==null&&c==null)return;Q?.(K,n,c)},O=Object.entries(D5).find(([,f])=>f.width===_&&f.height===R)?.[0],P=Object.entries(D5).find(([,f])=>f.width===_)?.[0],I=X.attrs?.["data-dc-fixed"]==="true",k=X.attrs?.["data-dc-bg"]??"",$=X.attrs?.["data-dc-padding"]??"",C=X.attrs?.["data-dc-layout"]??"",b=X.attrs?.["data-dc-gap"]??"",v=X.attrs?.["data-dc-kind"]||"digital",h=null;try{h=X.attrs?.["data-dc-print"]?JSON.parse(X.attrs["data-dc-print"]):null}catch{}let d=(f)=>{if(!K)return;let s=null;if(f==="print"&&!h){let n={paper:"a4"};try{let c=K2(n);if(c)s={defaults:n,widthPx:c.widthPx,heightPx:c.heightPx}}catch{}}if(G?.(K,f==="digital"?null:f,s),f==="web"&&I)Y?.(K,!1,void 0)},o=(f)=>{if(!K)return;let s={paper:"a4",...h,...f},n;try{n=K2(s)}catch{return}Q?.(K,n.widthPx,n.heightPx),Z?.(K,s)},x=(f,s)=>{if(!K)return;let n=Number.isFinite(s)?s:R,c=f&&Number.isFinite(n)?Math.round(n):void 0;Y?.(K,f,c)},m=(f)=>{let s=i$(I,f);if(s.kind==="resize")w(null,s.height);else if(s.kind==="promote-to-fixed")x(!0,s.height)},l=(f)=>{if(!K)return;W?.(K,f)};return M("section",{className:"st-cp-sec",children:[z("div",{className:"st-cp-sechd-row",children:z("span",{className:"st-cp-sechd",children:"Artboard"})}),M("div",{style:{display:"flex",gap:8,padding:"4px 12px"},children:[z(XX,{value:_??0,min:1,ariaLabel:"artboard width",lead:"W",steppers:!1,onCommit:(f)=>w(f,null)}),z(XX,{value:R??0,min:1,ariaLabel:"artboard height",lead:"H",steppers:!1,scrub:I,onCommit:m})]}),z("div",{style:{padding:"0 12px 8px"},children:v==="print"?M("select",{className:"st-cp-nsel","aria-label":"artboard paper preset",value:h?.paper??"",onChange:(f)=>o({paper:f.currentTarget.value}),children:[z("option",{value:"",disabled:!0,children:"Paper size…"}),z2.map((f)=>M("option",{value:f.id,children:[f.label," — ",f.width,"×",f.height,f.unit]},f.id))]}):v==="web"?M("select",{className:"st-cp-nsel","aria-label":"artboard breakpoint preset",value:P??"",onChange:(f)=>{let s=D5[f.currentTarget.value];if(s)w(s.width,null)},children:[z("option",{value:"",disabled:!0,children:P?`${D5[P].label} — ≤ ${D5[P].width}px`:"Breakpoint…"}),Object.entries(D5).map(([f,s])=>M("option",{value:f,children:[s.label," — ≤ ",s.width,"px breakpoint"]},f))]}):M("select",{className:"st-cp-nsel","aria-label":"artboard size preset",value:O??"",onChange:(f)=>{let s=D5[f.currentTarget.value];if(s)w(s.width,s.height)},children:[z("option",{value:"",disabled:!0,children:O?D5[O].label:"Preset size…"}),Object.entries(D5).map(([f,s])=>M("option",{value:f,children:[s.label," — ",s.width,"×",s.height]},f))]})}),z("div",{style:{padding:"0 12px 8px"},children:z(oB,{value:I?"fixed":"hug",ariaLabel:"artboard height sizing mode",options:[{value:"hug",label:"Hug"},{value:"fixed",label:"Fixed"}],onChange:(f)=>x(f==="fixed")})}),z("div",{className:"st-cp-sechd-row",children:z("span",{className:"st-cp-sechd",children:"Kind"})}),z("div",{style:{padding:"0 12px 8px"},children:z(_W,{value:v,ariaLabel:"artboard kind",options:j20.map(([f,s])=>({value:f,label:s})),onChange:d})}),v!=="print"&&K&&H?z("div",{style:{padding:"0 12px 8px"},children:M("select",{className:"st-cp-nsel","aria-label":"duplicate artboard at breakpoint width",value:"",onChange:(f)=>{let s=D5[f.currentTarget.value];if(s)H(K,s.width);f.currentTarget.value=""},children:[z("option",{value:"",disabled:!0,children:"Duplicate at width…"}),Object.entries(D5).map(([f,s])=>M("option",{value:f,children:[s.label," — ",s.width,"px"]},f))]})}):null,v==="print"?M(G0,{children:[z("div",{className:"st-cp-sechd-row",children:z("span",{className:"st-cp-sechd",children:"Print"})}),z("div",{style:{padding:"0 12px 8px"},children:z(oB,{value:h?.orientation??"portrait",ariaLabel:"paper orientation",options:[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"}],onChange:(f)=>o({orientation:f})})}),z("div",{style:{padding:"0 12px 8px"},children:z(XX,{value:Number.isFinite(h?.bleedMm)?h.bleedMm:3,min:0,step:0.5,ariaLabel:"bleed, millimeters",lead:"B",steppers:!1,unitSlot:z("span",{className:"st-cp-numsuffix","aria-hidden":"true",children:"mm"}),onCommit:(f)=>o({bleedMm:f})})})]}):null,z("div",{className:"st-cp-sechd-row",children:z("span",{className:"st-cp-sechd",children:"Style"})}),M("div",{style:{padding:"4px 12px 8px",display:"flex",flexDirection:"column",gap:8},children:[(()=>{let f=D(k),s=/var\(\s*--/.test(k),n=s?k.replace(/^var\(\s*|\s*\)$/g,"").replace(/^--/,"").replace(/-/g," "):k;return z(wV,{swatch:z(BF,{kind:"color",swatchClassName:"st-cp-cf-sw",groups:N("color"),current:k,activeDs:q,swatchBg:f,seedHex:DF(f)||"#000000",onPick:(c)=>l({background:c||null}),label:"artboard background colour"}),displayValue:n,bound:s,ariaLabel:"artboard background",onValue:(c)=>l({background:(c||"").trim()||null})})})(),z(_W,{value:C,ariaLabel:"artboard body layout",options:y20.map(([f,s])=>({value:f,label:s})),onChange:(f)=>l({layout:f||null})}),M("div",{style:{display:"flex",gap:8},children:[z(nB,{value:/^var\(/.test($)?$:Number.parseFloat($)||0,tokens:F("space"),ariaLabel:"artboard padding",lead:"Pad",min:0,onChange:(f)=>l({padding:typeof f==="string"?f:f>0?f:null})}),z(nB,{value:/^var\(/.test(b)?b:Number.parseFloat(b)||0,tokens:F("space"),ariaLabel:"artboard gap",lead:"Gap",min:0,onChange:(f)=>l({gap:typeof f==="string"?f:f>0?f:null})})]})]})]})}var dR=/assets\/[0-9a-f]{8}\.[a-z0-9]+/i,v20=new RegExp(dR.source,"gi");function h20(X){if(!X||Array.isArray(X))return null;if(X.photoAsset)return X.photoAsset;let J=X.html||"";if((X.tag||"").toLowerCase()!=="img"){let W=[...new Set(J.match(v20)||[])],G=[...new Set([...J.matchAll(/data-photo-asset="([^"]+)"/g)].map((Z)=>Z[1]))];if(G.length===1)return G[0];if(G.length===0&&W.length===1&&/<img/i.test(J))return W[0];return null}let Q=/data-photo-asset="([^"]+)"/.exec(J);if(Q)return Q[1];let Y=dR.exec(`${X.attrs?.src||""} ${J}`);return Y?Y[0]:null}function x20({testId:X,selected:J,onClose:Q,layersTree:Y,componentMap:W,lockedKeys:G,onToggleLock:Z,onDetachInstance:H,canvasFile:K,onSelectLayer:U,onHoverLayer:q,onReorderLayer:B,layersBusyRef:N,cfg:F,onOptimistic:D,onRecordEdit:_,onReplaceMedia:R,onResizeArtboard:w,onSetArtboardHug:O,onSetArtboardStyle:P,onSetArtboardKind:I,onSetArtboardPrint:k,onDuplicateArtboard:$,onUndoRedo:C,editScope:b,tab:v,onTabChange:h,width:d,resizing:o,photoSel:x,photoRev:m,onPhotoEdit:l,onPhotoRemoveBackground:f,onPhotoRecordEdit:s,onPhotoUndoRedo:n,layersOnly:c=!1,hideLayersTab:U0=!1,cpMode:X0,onSetCpMode:H0}){let[a,D0]=u.useState("inspect"),z0=c?"layers":v??a,l0=(m0)=>{D0(m0),h?.(m0)},[X8,d0]=u.useState(()=>new Set),[$0,M0]=u.useState(()=>new Map);u.useEffect(()=>{let m0=Array.isArray(J)?J[0]:J,w0=m0?.id;if(!w0||!Y?.nodes)return;let K8=m0.index,I8=null,k8=[];if(function _9(A8,T9){for(let Y9 of A8||[]){let b7=`${Y9.id}:${Y9.index}`;if(!Y9.synthetic&&Y9.id===w0&&(K8==null||Y9.index===K8))return I8=b7,k8.push(...T9),!0;if(Y9.children&&Y9.children.length&&_9(Y9.children,[...T9,b7]))return!0}return!1}(Y.nodes,[]),!I8)return;if(k8.length)d0((_9)=>{let A8=!1,T9=new Set(_9);for(let Y9 of k8)if(T9.delete(Y9))A8=!0;return A8?T9:_9});requestAnimationFrame(()=>{try{document.querySelector(`.st-layer--row[data-layer-key="${I8}"]`)?.scrollIntoView({block:"nearest"})}catch{}})},[J,Y]);let i0=(m0)=>{let w0=`${m0.id}:${m0.index}`;return $0.has(w0)?$0.get(w0):!!m0.hidden},[c8,z8]=u.useState(null),[Q9,L8]=u.useState(""),W8=(m0,w0)=>{if(!K||!m0?.id)return;fetch("/_api/edit-attr",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({canvas:K,id:m0.id,attr:"data-dc-element",value:w0})}).then((K8)=>K8.json().catch(()=>({}))).then((K8)=>{if(!K8.ok)return;_?.({op:"attr",canvas:K,id:m0.id,key:"data-dc-element",before:m0.dcElement??null,after:w0})}).catch(()=>{})},b8=B?(m0,w0,K8)=>{if(N?.current)return;if(m0?.synthetic||w0?.synthetic)return;let I8=K8==="before"?`before ${w0.label}`:K8==="after"?`after ${w0.label}`:`into ${w0.label}`;L8(`Moved ${m0.label} ${I8}`),B(m0.id,w0.id,K8,{idIndex:m0.index,refIndex:w0.index})}:void 0,i8=()=>{let m0=[];return function w0(K8,I8,k8){(K8||[]).forEach((_9,A8)=>{if(m0.push({node:_9,depth:I8,parentNode:k8,siblings:K8,pos:A8}),_9.children&&_9.children.length&&!X8.has(`${_9.id}:${_9.index}`))w0(_9.children,I8+1,_9)})}(Y?.nodes,0,null),m0},p9=(m0)=>{if(m0.key!=="ArrowUp"&&m0.key!=="ArrowDown")return;if(!b0)return;let w0=i8(),K8=w0.findIndex((A8)=>A8.node.id===b0.id&&A8.node.index===b0.index);if(K8<0)return;let I8=m0.key==="ArrowDown"?1:-1,k8=w0[K8];if(!m0.altKey){let A8=w0[K8+I8];if(A8)m0.preventDefault(),U?.(A8.node);return}if(!b8||!Array.isArray(k8.siblings))return;m0.preventDefault();let _9=(A8)=>A8&&A8.children&&A8.children.length&&!X8.has(`${A8.id}:${A8.index}`);if(!m0.shiftKey){if(I8<0&&k8.pos>0)b8(k8.node,k8.siblings[k8.pos-1],"before");else if(I8>0&&k8.pos<k8.siblings.length-1)b8(k8.node,k8.siblings[k8.pos+1],"after");return}if(I8>0){let A8=k8.siblings[k8.pos+1];if(A8)b8(k8.node,A8,_9(A8)?"inside-start":"after");else if(k8.parentNode)b8(k8.node,k8.parentNode,"after")}else{let A8=k8.siblings[k8.pos-1];if(A8)b8(k8.node,A8,_9(A8)?"inside-end":"before");else if(k8.parentNode)b8(k8.node,k8.parentNode,"before")}},O0=u.useRef(null),j8=u.useRef(null),L9=(m0,w0,K8)=>{if(!b8||m0.button!==0||m0.metaKey||m0.ctrlKey||m0.shiftKey||m0.altKey)return;if(N?.current)return;let{clientX:I8,clientY:k8}=m0,_9=new Set([K8]);(function g8(a9){(a9.children||[]).forEach((m7)=>{_9.add(`${m7.id}:${m7.index}`),g8(m7)})})(w0);let A8=14,T9=6,Y9=[];(function g8(a9,m7){(a9||[]).forEach((P7)=>{let E9=`${P7.id}:${P7.index}`;if(Y9.push({node:P7,key:E9,id:P7.id,depth:m7,tag:P7.tag}),P7.children&&P7.children.length&&!X8.has(E9))g8(P7.children,m7+1)})})(Y?.nodes,0);let b7=new Map(Y9.map((g8)=>[g8.key,g8])),E0=!1,f8=(g8)=>{if(!E0){if(Math.hypot(g8.clientX-I8,g8.clientY-k8)<4)return;E0=!0}let a9=g8.clientX-I8,m7=g8.clientY-k8,P7=null,E9=[].slice.call(document.querySelectorAll(".st-layer--row[data-layer-key]")).map((e)=>({rect:e.getBoundingClientRect(),it:b7.get(e.getAttribute("data-layer-key"))})).filter((e)=>e.it&&e.it.key!==K8);if(E9.length){let e=E9[0].rect.left,A0=E9[0].rect.right,q0=E9.length;for(let F7=0;F7<E9.length;F7++)if(g8.clientY<E9[F7].rect.top+E9[F7].rect.height/2){q0=F7;break}let j0=E9[q0-1]?.it||null,r0=E9[q0]?.it||null,y8=Math.round((g8.clientX-e-T9)/A8),S8=j0?j0.depth+(S20.has(j0.tag)?0:1):0,o8=r0?r0.depth:0,e8=Math.max(o8,Math.min(y8,S8)),P9=null,U7="before",h9=0;if(!j0){if(r0)P9=r0,U7="before",h9=r0.depth}else if(e8>j0.depth)P9=j0,U7="inside-start",h9=j0.depth+1;else if(e8===j0.depth)P9=j0,U7="after",h9=j0.depth;else{for(let F7=q0-1;F7>=0;F7--)if(E9[F7].it.depth===e8){P9=E9[F7].it;break}if(!P9)P9=j0;U7="after",h9=e8}if(P9&&P9.key!==K8&&!_9.has(P9.key)){let F7=j0?E9[q0-1].rect.bottom:E9[0].rect.top,GX=e+T9+h9*A8;P7={refId:P9.id,position:U7,node:P9.node,y:F7,left:GX,w:Math.max(24,A0-GX)}}}let l6={key:K8,node:w0,dx:a9,dy:m7,target:P7};O0.current=l6,z8(l6)},v9=()=>{window.removeEventListener("pointermove",f8),window.removeEventListener("pointerup",G6),window.removeEventListener("keydown",_6,!0)},w9=()=>{let g8=(a9)=>{a9.preventDefault(),a9.stopImmediatePropagation(),document.removeEventListener("click",g8,!0)};document.addEventListener("click",g8,!0),setTimeout(()=>document.removeEventListener("click",g8,!0),300)},G6=()=>{v9();let g8=O0.current;if(O0.current=null,z8(null),E0&&g8?.target)w9(),b8(g8.node,g8.target.node,g8.target.position)},_6=(g8)=>{if(g8.key!=="Escape")return;if(g8.preventDefault(),g8.stopImmediatePropagation(),v9(),O0.current=null,z8(null),E0)w9()};window.addEventListener("pointermove",f8),window.addEventListener("pointerup",G6),window.addEventListener("keydown",_6,!0)},U8=(m0)=>d0((w0)=>{let K8=new Set(w0);if(K8.has(m0))K8.delete(m0);else K8.add(m0);return K8}),D9=(m0)=>{let w0=`${m0.id}:${m0.index}`,K8=i0(m0),I8=!K8;if(M0((k8)=>new Map(k8).set(w0,I8)),D?.({id:m0.id,artboardId:Y?.artboardId??null,index:m0.index,prop:"display",value:I8?"none":null}),!K||!m0.id)return;fetch("/_api/edit-css",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(I8?{canvas:K,id:m0.id,property:"display",value:"none"}:{canvas:K,id:m0.id,property:"display",reset:!0})}).catch(()=>{}),_?.({op:"css",canvas:K,id:m0.id,key:"display",before:K8?"none":null,after:I8?"none":null})},b0=Array.isArray(J)?J[0]:J,Z0=x?{asset:x.asset,kind:"annotation-image"}:(()=>{let m0=h20(b0);return m0?{asset:m0,kind:"artboard-img"}:null})(),y0=Z0?.kind==="annotation-image",c0=(m0)=>{if(!(m0.metaKey||m0.ctrlKey)||m0.altKey)return;let w0=m0.key.toLowerCase();if(w0==="z")m0.preventDefault(),n?.(m0.shiftKey?"redo":"undo");else if(w0==="y")m0.preventDefault(),n?.("redo")},q8=y0?"photo":z0==="photo"&&!Z0?"inspect":z0,N8=(m0,w0,K8)=>M("button",{type:"button",className:"st-rp-tab"+(q8===m0?" is-active":""),onClick:()=>l0(m0),children:[z(A9,{name:K8,size:14}),w0]}),H8=b0?.bounds||null;return M("aside",{className:"st-rpanel"+(o?" is-resizing":""),style:d?{width:d,flexBasis:d}:void 0,"aria-label":"Inspector","data-tour":"inspector","data-testid":X,children:[M("div",{className:"st-rp-tabs","data-tour":"inspector-tabs",style:c?{display:"none"}:void 0,children:[y0?N8("photo","Photo","image"):M(G0,{children:[N8("inspect","Inspect","sliders"),!U0&&N8("layers","Layers","layers"),N8("css","CSS","code"),Z0?N8("photo","Photo","image"):null]}),z("button",{type:"button",className:"st-iconbtn","aria-label":"Close inspector",style:{marginLeft:"auto"},onClick:Q,children:z(A9,{name:"x",size:14})})]}),b0?.id&&!(Array.isArray(J)&&J.length>1)&&b?M("div",{className:`st-scope st-scope--${b.scope}`,title:b.scope==="shared"?`Editing this element's style changes ${b.affects} place${b.affects===1?"":"s"}${b.componentName?` (component ${b.componentName})`:""}. Move/resize a whole instance to keep it local.`:"This edit affects only this element.",children:[z("span",{className:"st-scope-dot","aria-hidden":"true"}),b.scope==="shared"?`Shared${b.componentName?` · ${b.componentName}`:""} · edits ${b.affects} place${b.affects===1?"":"s"}`:"Local · this element only",b.scope==="shared"&&H?z("button",{type:"button",className:"st-scope-detach",title:"Clone this component for this instance only — edits stop affecting the other places",onClick:()=>H(b0.id,b0.index),children:"Detach"}):null]}):null,z("div",{className:"st-rp-body",children:q8==="photo"&&Z0?z("div",{onKeyDown:c0,children:z(oh,{asset:Z0.asset,ColorPicker:B00,StIcon:A9,onEdit:(m0)=>l?.(Z0.asset,m0),onRemoveBackground:f,onRecordEdit:(m0,w0)=>s?.(Z0.asset,m0,w0)},`${Z0.asset}:${m??0}`)}):!b0&&!(q8==="layers"&&Y?.nodes?.length)?z("div",{className:"st-rp-empty",children:M("p",{children:["Press ",z(MX,{children:"V"}),", then click an element to select it — or ",z(MX,{children:"⌘"}),"-click straight from Browse."]})}):b0&&q8==="inspect"?M(G0,{children:[z("div",{className:"st-rp-hd",children:b0.selector||b0.tag||"element"}),M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:"Pos"}),M("div",{className:"st-insp-fields",children:[M("span",{className:"st-fmini",children:[z("span",{className:"st-mtag",children:"X"}),z("input",{value:H8?Math.round(H8.x):"—",readOnly:!0,"aria-label":"x position"})]}),M("span",{className:"st-fmini",children:[z("span",{className:"st-mtag",children:"Y"}),z("input",{value:H8?Math.round(H8.y):"—",readOnly:!0,"aria-label":"y position"})]})]})]}),M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:"Size"}),M("div",{className:"st-insp-fields",children:[M("span",{className:"st-fmini",children:[z("span",{className:"st-mtag",children:"W"}),z("input",{value:H8?Math.round(H8.w):"—",readOnly:!0,"aria-label":"width"})]}),M("span",{className:"st-fmini",children:[z("span",{className:"st-mtag",children:"H"}),z("input",{value:H8?Math.round(H8.h):"—",readOnly:!0,"aria-label":"height"})]})]})]}),M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:"Tag"}),z("div",{className:"st-insp-fields",children:z("span",{className:"st-mono",style:{fontSize:11,color:"var(--fg-0)"},children:b0.tag||"—"})})]}),b0.classes?M("div",{className:"st-insp-row",children:[z("span",{className:"st-insp-label",children:"Class"}),z("div",{className:"st-insp-fields",children:z("span",{className:"st-mono",style:{fontSize:11,color:"var(--fg-1)"},children:b0.classes})})]}):null,z(b20,{el:b0})]}):q8==="layers"?M(G0,{children:[M("div",{className:"st-rp-hd",children:["Layers",Y?.nodes?.length?"":" · ancestry"]}),Y?.nodes?.length?M(G0,{children:[b8?z("div",{className:"st-rp-hint","aria-hidden":"true",children:"Drag or ↑/↓ select · Alt+↑/↓ move · Alt+Shift+↑/↓ move across"}):null,z("div",{role:"tree","aria-label":"Artboard layers",tabIndex:0,ref:j8,onKeyDown:p9,children:Y.nodes.map((m0,w0)=>z(N00,{node:m0,depth:0,selectedId:b0?.id,selectedIndex:b0?.index,collapsed:X8,hiddenOverride:$0,onToggle:U8,onSelect:(K8)=>{U?.(K8),j8.current?.focus()},onHover:(K8)=>q?.(K8),onToggleVisibility:D9,onReorder:b8,onRowPointerDown:L9,dragState:c8,componentMap:W,lockedKeys:G,onToggleLock:Z,onRename:W8},`${m0.id}:${m0.index}`))}),c8?.target?z("div",{className:"st-layer-divider","aria-hidden":"true",style:{left:c8.target.left,top:c8.target.y-1,width:c8.target.w}}):null,z("div",{className:"sr-only",role:"status","aria-live":"polite",children:Q9})]}):b0&&Array.isArray(b0.dom_path)&&b0.dom_path.length?b0.dom_path.map((m0,w0)=>M("div",{className:"st-layer"+(w0===b0.dom_path.length-1?" is-sel":""),style:{paddingLeft:8+w0*12},children:[z(A9,{name:"square",size:13}),m0]},w0)):z("div",{className:"st-rp-empty",children:"Select an element (⌘-click in the canvas) to see its layer tree."})]}):!b0.id&&F00(b0)?z(f20,{el:b0,cfg:F,onResizeArtboard:w,onSetArtboardHug:O,onSetArtboardStyle:P,onSetArtboardKind:I,onSetArtboardPrint:k,onDuplicateArtboard:$}):z(T20,{el:b0,cfg:F,onOptimistic:D,onRecordEdit:_,onReplaceMedia:R,onUndoRedo:C,mode:X0,onSetMode:H0})})]})}function g20(){let[X,J]=u.useState([]),[Q,Y]=u.useState("Design"),[W,G]=u.useState([]),[Z,H]=u.useState(null),[K,U]=u.useState(null),q=u.useCallback((j)=>{U(j)},[]),[B,N]=u.useState(null),F=u.useRef(null);u.useEffect(()=>{F.current=B},[B]);let[D,_]=u.useState(null);u.useEffect(()=>{let j=Array.isArray(B)?B.length===1?B[0]:null:B,y=j&&typeof j.id==="string"?j.id:null;if(!y||!Z){_(null);return}let t=new AbortController,W0=new URLSearchParams({canvas:Z,id:y});return fetch(`/_api/edit-scope?${W0}`,{signal:t.signal}).then((F0)=>F0.ok?F0.json():null).then((F0)=>{if(F0?.ok)_(F0)}).catch(()=>{}),()=>t.abort()},[B,Z]);let R=u.useRef(0),w=u.useRef([]),O=u.useCallback((j)=>{if(!j?.id||!j.file)return;for(let y of w.current)clearTimeout(y);w.current=[50,450,1200,2500,5000].map((y)=>setTimeout(()=>{let t=F.current,W0=Array.isArray(t)?t[0]:t;if(!W0||W0.id!==j.id||W0.file!==j.file)return;let F0=m8.current.get(j.file);if(!F0?.contentWindow)return;try{F0.contentWindow.postMessage({dgn:"select-by-id",id:j.id,artboardId:j.artboardId??null,index:j.index??0},"*")}catch{}},y))},[]),P=u.useRef([]),I=u.useCallback((j,y)=>{if(!j||!y)return;for(let t of P.current)clearTimeout(t);P.current=[50,450,1200,2500,5000].map((t)=>setTimeout(()=>{let W0=F.current,F0=Array.isArray(W0)?W0[0]:W0;if(!F0||F0.artboardId!==j||F0.file!==y)return;let B0=m8.current.get(y);if(!B0?.contentWindow)return;try{B0.contentWindow.postMessage({dgn:"select-by-id",artboardId:j},"*")}catch{}},t))},[]),k=u.useRef(null),$=u.useRef(null),C=u.useRef(null),b=u.useRef(null),v=u.useRef(!1),h=u.useRef(null),[d,o]=u.useState(null),[x,m]=u.useState(null),l=u.useRef({canvas:null,at:0});u.useEffect(()=>{if(!Z||!d)return;let j=Date.now(),y=l.current;if(y.canvas===Z&&j-y.at<1500)return;l.current={canvas:Z,at:j},fetch(`/_api/component-map?canvas=${encodeURIComponent(Z)}`).then((t)=>t.json()).then((t)=>{if(t?.ok&&t.map&&typeof t.map==="object")m(t.map);else m(null)}).catch(()=>m(null))},[Z,d]);let[f,s]=u.useState(!1),[n,c]=u.useState(null),[U0,X0]=u.useState(null),[H0,a]=u.useState(null),[D0,z0]=u.useState(null),[l0,X8]=u.useState(null),[d0,$0]=u.useState(!1),[M0,i0]=u.useState(!1),[c8,z8]=u.useState(null),[Q9,L8]=u.useState(""),[W8,b8]=u.useState(null),[i8,p9]=u.useState(null),O0=u.useRef(null),j8=ue("maude-sb-w",{min:200,max:420,def:252}),L9=ue("maude-rp-w",{min:260,max:480,def:304}),[U8,D9]=u.useState(null),b0=u.useRef(null);u.useEffect(()=>{if(!U8)return;let j=(t)=>{let W0=b0.current?.getBoundingClientRect();if(!W0)return;if(U8==="sb")j8.setW(t.clientX-W0.left);else L9.setW(W0.right-t.clientX)},y=()=>D9(null);return window.addEventListener("pointermove",j),window.addEventListener("pointerup",y),()=>{window.removeEventListener("pointermove",j),window.removeEventListener("pointerup",y)}},[U8,j8.setW,L9.setW]);let Z0=u.useCallback((j)=>{clearTimeout(O0.current),O0.current=setTimeout(()=>{p9((y)=>y===j?null:y)},2500)},[]);u.useEffect(()=>{if(!i8)return;let j=setTimeout(()=>p9(null),15000);return()=>clearTimeout(j)},[i8]);let[y0,c0]=u.useState({designRel:".design",cloud:void 0}),q8=!!y0.readOnly,N8=u.useCallback(()=>{fetch("/_config").then((j)=>j.json()).then((j)=>{let y=(j.designRoot||".design").replace(/^\/+|\/+$/g,"");c0((t)=>({...t,designRel:y,tokensCssRel:j.tokensCssRel,designSystems:j.designSystems,canvasOrigin:j.canvasOrigin,readOnly:!!j.readOnly,canvasToken:j.canvasToken,version:j.version,cloud:j.cloud??null}))}).catch(()=>{})},[]);u.useEffect(()=>{N8()},[N8]),u.useEffect(()=>{let j=!1;return fetch("/_sync-status").then((y)=>y.json()).then((y)=>{if(j||!y||y.linked===!1)return;X0(y)}).catch(()=>{}),()=>{j=!0}},[]),u.useEffect(()=>{let j=!1;return fetch("/_api/git/status").then((y)=>y.json()).then((y)=>{if(!j&&y)z0(y)}).catch(()=>{}),()=>{j=!0}},[]);let[H8,m0]=u.useState({}),[w0,K8]=u.useState(null),[I8,k8]=u.useState(!1),[_9,A8]=u.useState("open"),[T9,Y9]=u.useState(Rq0),[b7,E0]=u.useState(()=>{return vR($e,"advanced")==="designer"?"designer":"advanced"});u.useEffect(()=>{try{localStorage.setItem($e,JSON.stringify(b7))}catch{}},[b7]);let[f8,v9]=u.useState(null),[w9,G6]=u.useState(()=>rZ(Se,!0)),[_6,g8]=u.useState(()=>rZ(ke,!1)),[a9,m7]=u.useState(()=>vR(Ce,{})),[P7,E9]=u.useState(!1),[l6,e]=u.useState(!1);u.useEffect(()=>{if(!X9())return;let j=Dv(()=>e(!0));return()=>{j.then((y)=>y()).catch(()=>{})}},[]);let[A0,q0]=u.useState(!1),[j0,r0]=u.useState(!1),[y8,S8]=u.useState(!1),[o8,e8]=u.useState(!1),[P9,U7]=u.useState(!1),{report:h9}=LA(X9()),[F7,GX]=u.useState(!1),[fQ,JQ]=u.useState(!1),[M5,$6]=u.useState(null),[I9,y7]=u.useState(!1),[hW,L7]=u.useState(!1),[ZX,OX]=u.useState(!1),[vQ,_7]=u.useState(!1),[u7,O5]=u.useState(()=>vR(fe,OK)),[Z7,mY]=u.useState(()=>{try{let j=localStorage.getItem(ve);if(j==="separate"||j==="in-inspector")return j}catch{}return"separate"}),[j7,o9]=u.useState(!1),[V7,d9]=u.useState([]),[$9,gX]=u.useState(0),[uY,mX]=u.useState(!1),[zJ,QQ]=u.useState(!1),[_X,_5]=u.useState(!1),[xW,hQ]=u.useState(1),[lY,i]=u.useState(216),[J0,N0]=u.useState(null),[C0,R0]=u.useState([]),[Q8,G8]=u.useState([]),[z9,t8]=u.useState([]),[e7,AX]=u.useState(0),A6=u.useRef(0);u.useEffect(()=>{A6.current=$9},[$9]);let[D7,xQ]=u.useState(null),pY=u.useRef(null);u.useEffect(()=>{pY.current=D7},[D7]);let X6=u.useMemo(()=>EA(V7,{artboardId:[D7,J0],total:e7}),[V7,D7,J0,e7]),uX=u.useRef(null);u.useEffect(()=>{uX.current=X6},[X6]);let Z6=u.useMemo(()=>nz(V7,X6)?.fps||30,[V7,X6]),[HX,KJ]=u.useState(null),[A5,T8]=u.useState(0),V9=u.useCallback((j,y)=>{if(/concurrent edit|changed since it was read/i.test(y||""))x8("Timeline changed — reloaded, try again."),T8((t)=>t+1);else x8(`${j}: ${y||"failed"}`)},[]),[N9,UJ]=u.useState(!1),[wX,dY]=u.useState(!1),[gW,mW]=u.useState(!1),w5=u.useRef(N9);u.useEffect(()=>{if(w5.current=N9,N9){mW(!1);try{if(typeof Notification<"u"&&Notification.permission==="default")Notification.requestPermission()}catch{}}},[N9]);let aZ=u.useCallback(()=>{if(!w5.current||document.hidden)mW(!0),xe("Claude finished","Your assistant turn is ready in Maude.")},[]),cY=u.useRef(0),iY=u.useCallback(()=>{if(!w5.current||document.hidden){mW(!0);let j=Date.now();if(j-cY.current<wq0)return;cY.current=j,xe("Maude needs your input","Claude is waiting on an approval or a question in Maude.")}},[]),[EX,YQ]=u.useState("inspect"),[PK,lX]=u.useState(null),WQ=u.useRef({undo:[],redo:[]}),[uW,RK]=u.useState(0),[xJ,lW]=u.useState(()=>{try{return localStorage.getItem("maude-auto-open-inspector")!=="0"}catch{return!0}}),oY=u.useRef(xJ);u.useEffect(()=>{oY.current=xJ;try{localStorage.setItem("maude-auto-open-inspector",xJ?"1":"0")}catch{}},[xJ]);let sZ=u.useRef(!1);u.useEffect(()=>{sZ.current=ZX||I8||d0||M0||N9},[ZX,I8,d0,M0,N9]);let pW=u.useRef({open:{},side:OK});pW.current={open:{tree:w9,layers:vQ,inspector:ZX,comments:I8,changes:d0,sync:M0,assistant:N9},side:u7};let gQ=u.useCallback((j,y)=>{if(j==="tree")G6(y);else if(j==="layers")_7(y);else if(j==="inspector")OX(y);else if(j==="comments")k8(y);else if(j==="changes")$0(y);else if(j==="sync")i0(y);else if(j==="assistant")UJ(y)},[]),dW=u.useCallback((j)=>pW.current.side?.[j]||OK[j],[]),PX=u.useCallback((j)=>{let y=dW(j);gQ(j,!0);for(let t of uR)if(t.id!==j&&dW(t.id)===y)gQ(t.id,!1)},[gQ,dW]),E5=u.useCallback((j)=>{if(pW.current.open?.[j])gQ(j,!1);else PX(j)},[PX,gQ]),gJ=PX,S6=E5,cW=u.useCallback((j)=>{if(!oY.current)return;if(q8)return;if(!j||!j.id)return;if(sZ.current)return;gJ("inspector"),YQ("css")},[gJ,q8]),nY=u.useCallback(()=>o9((j)=>!j),[]),GQ=Bx(pR),rY=sh({enabled:y0.cloud===null}),[iW,oW]=u.useState(!1),[aY,tZ]=u.useState(!1);u.useEffect(()=>{if(!X9())return;let j=!0;return Av().then((y)=>{if(!j)return;if(oW(!!y),!y&&!rZ(Ie,!1))tZ(!0)}).catch(()=>{}),()=>{j=!1}},[]);let eZ=u.useCallback(()=>{tZ(!1);try{localStorage.setItem(Ie,"1")}catch{}},[]),[nW,sY]=u.useState(null);u.useEffect(()=>{if(!X9())return;let j;return Rv((y)=>sY(y&&typeof y==="object"?y:{})).then((y)=>{j=y}).catch(()=>{}),()=>{try{j?.()}catch{}}},[]);let[b6,XH]=u.useState(null),[mQ,TK]=u.useState(()=>!rZ(Te,!1)),P5=u.useCallback((j)=>{XH(Array.isArray(j)&&j.length?j:null)},[]),IK={setup:(j)=>{if(!j)return;if((j.canvas||j.requireSelection)&&W.length===0)PX("tree"),setTimeout(()=>{try{document.querySelector('.st-sidebar [role="treeitem"]')?.click()}catch{}},80);if(j.inspector||j.tab||j.requireSelection)gJ("inspector");if(j.tab)YQ(j.tab);if(j.changes)gJ("changes")}},rW=u.useCallback(()=>{TK(!1);try{localStorage.setItem(Te,"1")}catch{}},[]),[pX,tY]=u.useState(()=>rZ(je,!0)),[JH,kK]=u.useState(!1),[mJ,QH]=u.useState(()=>rZ(be,!1)),[uJ,YH]=u.useState(()=>rZ(ye,!1)),[RX,aW]=u.useState(!1),[CK,dX]=u.useState(!1),[TX,ZQ]=u.useState(0),[sW,$K]=u.useState(null),[uQ,HQ]=u.useState(!1),lQ=u.useRef(null),zQ=u.useRef(null),m8=u.useRef(new Map),O8=u.useCallback((j)=>{let y=Z?m8.current.get(Z):null;if(!y||!y.contentWindow)return;try{y.contentWindow.postMessage(j,"*")}catch{}},[Z]),pQ=u.useCallback((j,y)=>O8({dgn:"photo-preview",asset:j,edit:y}),[O8]),tW=u.useCallback((j,y,t)=>{WQ.current.undo.push({asset:j,before:y,after:t}),WQ.current.redo.length=0},[]),eW=u.useCallback((j)=>{let y=j?WQ.current.redo:WQ.current.undo;if(!y.length)return!1;let t=y.pop();(j?WQ.current.undo:WQ.current.redo).push(t);let W0=(j?t.after:t.before)||{};return pQ(t.asset,W0),fetch(`/_api/photo-edit?asset=${encodeURIComponent(t.asset)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(W0)}).catch(()=>{}),RK((F0)=>F0+1),!0},[pQ]),XG=u.useCallback(async(j)=>{O8({dgn:"photo-busy",asset:j,busy:!0});try{let y=await fetch(`/${j.replace(/^\/+/,"")}`);if(!y.ok)return null;let t=await y.blob(),{removeBackground:W0}=await Promise.resolve().then(() => (Re(),Pe)),F0=await W0(t),B0=await fetch("/_api/asset",{method:"POST",headers:{"content-type":F0.type||"image/png"},body:F0}),k0=await B0.json().catch(()=>({}));if(B0.ok&&k0.path)return{maskAsset:k0.path};return null}catch(y){return console.error("[photo] background removal failed",y),null}finally{O8({dgn:"photo-busy",asset:j,busy:!1})}},[O8]);u.useEffect(()=>{let j=(W0)=>Array.from(W0.dataTransfer?.types??[]).includes("Files"),y=(W0)=>{if(j(W0))W0.preventDefault()},t=(W0)=>{if(j(W0))W0.preventDefault()};return document.addEventListener("dragover",y),document.addEventListener("drop",t),()=>{document.removeEventListener("dragover",y),document.removeEventListener("drop",t)}},[]);let w6=u.useRef({});w6.current={open:j7,comps:V7,frame:$9,total:e7,playing:uY,compId:X6,muted:_X,loop:zJ,sequences:C0,post:O8,canvas:Z};let R5=u.useRef({undo:[],redo:[]}),R7=u.useCallback((j,y,t)=>{if(typeof y!=="number")return;if(R5.current.undo.push({canvas:j,seq:y,label:t}),R5.current.redo=[],R5.current.undo.length>50)R5.current.undo.shift()},[]),K0=u.useCallback((j)=>{let y=R5.current,t=j==="undo"?y.undo:y.redo,W0=j==="undo"?y.redo:y.undo,F0=w6.current.canvas,B0=-1;for(let p=t.length-1;p>=0;p--)if(t[p].canvas===F0){B0=p;break}if(B0<0){x8(j==="undo"?"Nothing to undo on this timeline.":"Nothing to redo.");return}let k0=t[B0];fetch("/_api/reorder-revert",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({canvas:k0.canvas,seq:k0.seq,dir:j})}).then((p)=>p.json().catch(()=>({}))).then((p)=>{if(t.splice(B0,1),p?.ok)W0.push(k0),x8(`${j==="undo"?"Undid":"Redid"}: ${k0.label}`,!0);else x8(`${j==="undo"?"Undo":"Redo"} skipped: ${p?.error||"failed"}`)}).catch(()=>x8(`${j==="undo"?"Undo":"Redo"} failed: network error`))},[]),p6=u.useCallback((j,y)=>{let t=j?.ok&&Array.isArray(j.clips)?j.clips.filter((W0)=>W0.kind==="sequence"):[];if(y==null)return null;if(typeof y==="object")return(y.stableId?t.find((W0)=>W0.stableId===y.stableId):null)||(Number.isInteger(y.index)?t[y.index]:null)||null;if(typeof y==="string")return t.find((W0)=>W0.stableId===y)||null;return t[y]||null},[]),eY=u.useCallback((j)=>{let y=w6.current.canvas;if(!y||y===d8)return;let t=pY.current||void 0,W0=`/_api/comp-clips?canvas=${encodeURIComponent(y)}${t?`&artboardId=${encodeURIComponent(t)}`:""}`;fetch(W0).then((F0)=>F0.json().catch(()=>({}))).then((F0)=>{let B0=p6(F0,j);if(!B0?.stableId)return null;return fetch("/_api/remove-sequence",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({canvas:y,artboardId:t,stableId:B0.stableId,contentHash:B0.contentHash})})}).then((F0)=>F0?F0.json():null).then((F0)=>{if(F0&&!F0.ok)console.warn("[remove-clip]",F0.error||"failed"),V9("Remove refused",F0.error);else if(F0?.ok){if(x8("Clip removed.",!0),F0.seq!=null)R7(y,F0.seq,"remove clip");KJ(null)}}).catch(()=>x8("Remove failed: network error"))},[p6,R7]),KQ=u.useCallback((j,y,t)=>{let W0=w6.current.canvas;if(!W0||W0===d8)return;let F0=pY.current||void 0,B0=`/_api/comp-clips?canvas=${encodeURIComponent(W0)}${F0?`&artboardId=${encodeURIComponent(F0)}`:""}`;fetch(B0).then((k0)=>k0.json().catch(()=>({}))).then((k0)=>{let p=k0?.ok&&Array.isArray(k0.clips)?k0.clips:[],_0=j?.transition?p.find((L0)=>L0.kind==="transition"&&L0.stableId===j.stableId)||null:p6(k0,j);if(!_0?.stableId)return null;return fetch("/_api/clip-edit",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({canvas:W0,artboardId:F0,stableId:_0.stableId,contentHash:_0.contentHash,verb:y,...t})})}).then((k0)=>k0?k0.json():null).then((k0)=>{if(k0&&!k0.ok)console.warn("[clip-edit]",y,k0.error||"failed"),V9(`${y} refused`,k0.error);else if(k0?.ok){let p={speed:"set speed","trim-in":"trim in-point",audio:"clip audio","detach-audio":"detach audio",framing:"crop clip",grade:"grade clip",transition:"edit transition",split:"split clip","insert-transition":"add transition","remove-transition":"remove transition","set-text":"edit text","to-overlay":"move to overlay layer","to-storyline":"move to storyline","layer-order":"reorder layers"};if(x8(`Applied: ${p[y]||y}.`,!0),k0.seq!=null)R7(W0,k0.seq,p[y]||y)}}).catch(()=>x8(`${y} failed: network error`))},[p6,R7,V9]),[cX,f7]=u.useState(null),zX=u.useCallback((j,y="")=>new Promise((t)=>{f7({title:j,value:y,resolve:t})}),[]),VJ=u.useCallback((j)=>{f7((y)=>{return y?.resolve?.(j),null})},[]),X4=u.useCallback((j,y)=>{let t=w6.current.canvas;if(!t||t===d8||!y||!String(y).trim())return;T7({type:"comments-add",payload:{file:t,text:String(y).trim(),selector:"",dom_path:[],tag:"",classes:"",bounds:null,html_excerpt:"",timeline:j}}),x8("Comment added.",!0)},[]);w6.current.selected=HX,w6.current.setSelected=KJ,w6.current.removeClip=eY,w6.current.clipVerb=KQ,w6.current.addComment=X4,w6.current.askText=zX,u.useEffect(()=>{let j=(y)=>{let t=w6.current;if(!t.open||!t.comps?.length)return;let W0=y.target,F0=W0?.tagName;if(F0==="INPUT"&&W0?.type!=="range")return;if(F0==="TEXTAREA"||F0==="SELECT"||W0?.isContentEditable)return;let B0=nz(t.comps,t.compId)?.fps||30,k0=Math.max(1,t.total),p=(L0)=>{let p0=Math.max(0,Math.min(k0-1,Math.round(L0)));gX(p0),mX(!1),t.post({dgn:"timeline-seek",frame:p0,id:t.compId})},_0=()=>{let L0=new Set([0,k0-1]);for(let p0 of t.sequences||[]){L0.add(p0.from);for(let D8 of p0.keyframes||[])L0.add(D8.from),L0.add(D8.to)}return[...L0].filter((p0)=>p0>=0&&p0<k0).sort((p0,D8)=>p0-D8)};if((y.metaKey||y.ctrlKey)&&(y.key==="z"||y.key==="Z")){y.preventDefault(),K0(y.shiftKey?"redo":"undo");return}if(y.key==="Escape"){if(t.selected!=null)y.preventDefault(),t.setSelected?.(null);return}if((y.key==="Delete"||y.key==="Backspace")&&t.selected!=null){y.preventDefault(),t.removeClip?.({stableId:t.selected});return}if((y.metaKey||y.ctrlKey)&&(y.key==="b"||y.key==="B")){y.preventDefault();let L0=t.selected!=null?{stableId:t.selected}:null;if(!L0){let p0=t.sequences||[],D8=p0.find((B8)=>B8.series&&t.frame>=B8.from&&t.frame<B8.from+B8.duration)||p0.find((B8)=>t.frame>=B8.from&&t.frame<B8.from+B8.duration);if(D8?.stableId)L0={stableId:D8.stableId}}if(L0)t.clipVerb?.(L0,"split",{atFrame:t.frame});else x8("Nothing under the playhead to split.");return}if(y.key===" "||y.code==="Space")if(y.preventDefault(),t.playing)mX(!1),t.post({dgn:"timeline-pause",id:t.compId});else mX(!0),t.post({dgn:"timeline-mute",muted:t.muted,id:t.compId}),t.post({dgn:"timeline-loop",loop:t.loop,id:t.compId}),t.post({dgn:"timeline-play",id:t.compId});else if(y.key==="ArrowRight")y.preventDefault(),p(t.frame+(y.shiftKey?B0:1));else if(y.key==="ArrowLeft")y.preventDefault(),p(t.frame-(y.shiftKey?B0:1));else if(y.key==="Home")y.preventDefault(),p(0);else if(y.key==="End")y.preventDefault(),p(k0-1);else if(y.key==="."){y.preventDefault();let L0=_0().find((p0)=>p0>t.frame);if(L0!=null)p(L0)}else if(y.key===","){y.preventDefault();let L0=_0().reverse().find((p0)=>p0<t.frame);if(L0!=null)p(L0)}};return window.addEventListener("keydown",j),()=>window.removeEventListener("keydown",j)},[]),u.useEffect(()=>{d9([]),gX(0),mX(!1),KJ(null),xQ(null);let j=setTimeout(()=>O8({dgn:"timeline-request-comps"}),60);return()=>clearTimeout(j)},[Z,O8]);let[T5,J4]=u.useState(""),[UQ,dQ]=u.useState([]),[JG,s0]=u.useState([]);u.useEffect(()=>{if(!j7||V7.length===0||!Z||Z===d8){J4(""),dQ([]);return}let j=!0;return fetch(`/_api/canvas-source?file=${encodeURIComponent(Z)}`).then((y)=>y.ok?y.json():null).then((y)=>{if(j&&y?.ok&&typeof y.source==="string")J4(y.source)}).catch(()=>{}),()=>{j=!1}},[j7,V7,Z,A5]),u.useEffect(()=>{if(!j7||!Z||Z===d8||!T5){dQ([]),s0([]);return}let j=!0,y=D7||void 0,t=`/_api/comp-clips?canvas=${encodeURIComponent(Z)}${y?`&artboardId=${encodeURIComponent(y)}`:""}`;return fetch(t).then((W0)=>W0.ok?W0.json():null).then((W0)=>{if(!j)return;let F0=W0?.ok&&Array.isArray(W0.clips)?W0.clips:[];dQ(F0.filter((B0)=>B0.kind==="sequence")),s0(F0.filter((B0)=>B0.kind==="transition"))}).catch(()=>{}),()=>{j=!1}},[j7,Z,T5,D7,A5]),u.useEffect(()=>{if(!T5){R0([]),G8([]),t8([]),AX(0);return}let j=J0??B?.artboardId??null,t=(j&&V7.find((B0)=>B0.artboardId===j||B0.id===j)||V7[0])?.durationInFrames||0,W0=uh(T5,t,j);xQ(W0.artboardId??j??null);let F0=W0.sequences.map((B0,k0)=>{let p=UQ[k0];if(!p)return B0;return{...B0,stableId:p.stableId,contentHash:p.contentHash,mediaProps:p.mediaProps??null,placeholder:p.placeholder??null,mediaTag:p.mediaTag??B0.mediaTag,mediaSrc:p.mediaSrc??B0.mediaSrc,replaceable:!!(p.mediaCdId||p.mediaArrayRef),layers:Array.isArray(p.layers)?p.layers:[],hidden:!!p.hidden}});R0(F0),G8(W0.audio||[]),t8(W0.transitions||[]),AX(W0.total)},[T5,UQ,B,V7,J0]);let iX=u.useCallback(()=>{tY((j)=>{let y=!j,t=Z?m8.current.get(Z):null;if(t&&t.contentWindow)try{t.contentWindow.postMessage({dgn:"view-annotations",visible:y},"*")}catch{}return y})},[Z]),KX=u.useCallback((j)=>{for(let y of m8.current.values())try{y.contentWindow.postMessage({dgn:"view-chrome",...j},"*")}catch{}},[]),o0=u.useCallback(()=>{QH((j)=>{let y=!j;return KX({minimap:y}),y})},[KX]),VQ=u.useCallback(()=>{YH((j)=>{let y=!j;return KX({zoom:y}),y})},[KX]),a0=u.useCallback(()=>{aW((j)=>{let y=!j;return KX({present:y}),y})},[KX]),cQ=u.useCallback(()=>{aW(!1),KX({present:!1})},[KX]),QG=u.useCallback(()=>{if(!Z||Z===d8)return;dX((j)=>{let y=!j;return O8({dgn:"view-chrome",print:y}),fetch("/_api/canvas-meta",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:Z,patch:{overlays:{print:y}}})}).catch(()=>{}),y})},[Z,O8]);u.useEffect(()=>{let j=!1;return fetch("/_api/git-user").then((y)=>y.json()).then((y)=>{if(j)return;let t=y&&typeof y.name==="string"?y.name.trim():"";if(t)$K(t)}).catch(()=>{}),()=>{j=!0}},[]),u.useEffect(()=>{if(!Z||Z===d8){ZQ(0),dX(!1);return}let j=!1;return fetch("/_api/canvas-meta?file="+encodeURIComponent(Z)).then((y)=>y.json()).then((y)=>{if(j)return;let t=Array.isArray(y?.artboards)?y.artboards.length:0;ZQ(t),dX(y?.overlays?.print===!0),oQ(new Set(Array.isArray(y?.locked)?y.locked:[]))}).catch(()=>{if(!j)ZQ(0),dX(!1),oQ(new Set)}),()=>{j=!0}},[Z]),u.useEffect(()=>{if(!Z||Z===d8||!J0)return;let j=setTimeout(()=>{O8({dgn:"request-layers",artboardId:J0})},250);return()=>clearTimeout(j)},[Z,J0,O8]);let[iQ,oQ]=u.useState(()=>new Set),YG=u.useCallback((j)=>{if(!Z||Z===d8)return;oQ((y)=>{let t=new Set(y);if(t.has(j))t.delete(j);else t.add(j);let W0=[...t];return fetch("/_api/canvas-meta",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:Z,patch:{locked:W0}})}).catch(()=>{}),O8({dgn:"locked-set",locked:W0}),t})},[Z,O8]);u.useEffect(()=>{if(!Z||Z===d8)return;O8({dgn:"locked-set",locked:[...iQ]})},[iQ,Z,O8]),u.useEffect(()=>{try{document.documentElement.setAttribute("data-theme",T9),localStorage.setItem(Z00,T9)}catch{}for(let j of m8.current.values())try{j.contentWindow.postMessage({dgn:"theme",theme:T9},"*")}catch{}},[T9]),u.useEffect(()=>{try{localStorage.setItem(Se,w9?"1":"0")}catch{}},[w9]),u.useEffect(()=>{try{localStorage.setItem(ke,_6?"1":"0")}catch{}},[_6]),u.useEffect(()=>{try{localStorage.setItem(Ce,JSON.stringify(a9))}catch{}},[a9]),u.useEffect(()=>{try{localStorage.setItem(be,mJ?"1":"0")}catch{}},[mJ]),u.useEffect(()=>{try{localStorage.setItem(ye,uJ?"1":"0")}catch{}},[uJ]),u.useEffect(()=>{try{localStorage.setItem(je,pX?"1":"0")}catch{}},[pX]),u.useEffect(()=>{let j=!1;return fetch("/_api/ui-prefs").then((y)=>y.ok?y.json():Promise.reject(Error(`HTTP ${y.status}`))).then((y)=>{if(j||!y||typeof y!=="object")return;if(y.theme==="light"||y.theme==="dark")Y9(y.theme);if(typeof y.minimap==="boolean")QH(y.minimap);if(typeof y.zoom==="boolean")YH(y.zoom);if(typeof y.annotations==="boolean")tY(y.annotations);if(typeof y.autoOpenInspector==="boolean")lW(y.autoOpenInspector);if(y.panelSides&&typeof y.panelSides==="object")O5({...OK,...y.panelSides});if(y.layersMode==="separate"||y.layersMode==="in-inspector")mY(y.layersMode)}).catch(()=>{}).finally(()=>{if(!j)kK(!0)}),()=>{j=!0}},[]),u.useEffect(()=>{if(!JH)return;Eq0({theme:T9,minimap:mJ,zoom:uJ,annotations:pX,autoOpenInspector:xJ,panelSides:u7,layersMode:Z7})},[JH,T9,mJ,uJ,pX,xJ,u7,Z7]),u.useEffect(()=>{try{localStorage.setItem(fe,JSON.stringify(u7))}catch{}},[u7]),u.useEffect(()=>{try{localStorage.setItem(ve,Z7)}catch{}},[Z7]);let WG=u.useCallback((j,y)=>{m7((t)=>{let W0=t[j],F0=W0===void 0?y:W0;return{...t,[j]:!F0}})},[]),I5=u.useCallback(()=>{Y9((j)=>j==="dark"?"light":"dark")},[]),Y7=u.useCallback(async()=>{try{let y=await(await fetch("/_index-data")).json();Y(y.project||"Design");let t=y.groups.map((W0)=>({...W0,tree:$q0(W0.paths,W0.stripPrefix,W0.dirs)}));J(t),c0((W0)=>({...W0,canvasDesignSystems:y.canvasDesignSystems??{},canvasKinds:y.canvasKinds??{}}))}catch(j){console.error("failed to load tree",j)}},[]);u.useEffect(()=>{Y7()},[Y7]);let lJ=u.useCallback(async(j)=>{try{let y=j?`/_system-data?ds=${encodeURIComponent(j)}`:"/_system-data",t=await fetch(y);if(!t.ok){console.error("failed to load system-data",t.status);return}let W0=await t.json();if(!j&&W0?.defaultDesignSystem&&!W0.ds){b8(W0);let F0=await fetch(`/_system-data?ds=${encodeURIComponent(W0.defaultDesignSystem)}`);if(F0.ok)b8(await F0.json());return}b8(W0)}catch(y){console.error("failed to load system-data",y)}},[]),Q4=u.useCallback(async()=>{try{let y=await(await fetch("/_comments-all")).json();m0(y||{})}catch(j){console.error("failed to load comments",j)}},[]);u.useEffect(()=>{Q4()},[Q4]),u.useEffect(()=>{let j=null;function y(){let t=location.protocol==="https:"?"wss:":"ws:",W0=new WebSocket(t+"//"+location.host+"/_ws");zQ.current=W0,W0.addEventListener("open",()=>{s(!0),clearInterval(j),j=setInterval(()=>{if(W0.readyState===WebSocket.OPEN)W0.send('{"type":"ping"}')},25000)}),W0.addEventListener("close",()=>{s(!1),clearInterval(j),setTimeout(y,1000)}),W0.addEventListener("error",()=>{}),W0.addEventListener("message",(F0)=>{try{let B0=JSON.parse(F0.data);if(B0.type==="snapshot"&&B0.state)N((k0)=>Q00(B0.state.selected,k0));else if(B0.type==="selected"){if(Date.now()-R.current<2000)return;let k0=B0.selected,p=Array.isArray(k0)?k0[0]:k0,_0=F.current,L0=Array.isArray(_0)?_0[0]:_0;if(N((p0)=>Q00(k0,p0)),p?.id&&p.file&&(!L0||L0.id!==p.id||L0.file!==p.file))O(p)}else if(B0.type==="comments"&&typeof B0.file==="string")m0((k0)=>({...k0,[B0.file]:B0.comments||[]}));else if(B0.type==="ai-activity"&&typeof B0.file==="string"){if(HQ(!0),lQ.current)clearTimeout(lQ.current);lQ.current=setTimeout(()=>HQ(!1),8000);for(let k0 of m8.current.values())try{k0.contentWindow.postMessage({dgn:"ai-activity",file:B0.file,entry:B0.entry},"*")}catch{}}else if(B0.type==="export:job"&&B0.payload)rY.upsert(B0.payload);else if(B0.type==="sync:status"&&B0.payload)X0(B0.payload);else if(B0.type==="canvas-list-update"){if(Y7(),B0.payload?.action==="moved"&&B0.payload.fromRel&&B0.payload.rel){let k0=(y0?.designRel||y0?.designRoot||".design").replace(/^\/+|\/+$/g,""),p=`${k0}/${B0.payload.fromRel}`,_0=`${k0}/${B0.payload.rel}`;G((L0)=>L0.map((p0)=>p0.path===p?{path:_0}:p0)),H((L0)=>L0===p?_0:L0)}}else if(B0.type==="config-updated")N8();else if(B0.type==="acp-focus"){if(X9())gJ("assistant")}else if(B0.type==="git-status"&&B0.payload)z0(B0.payload);else if(B0.type==="git-lifecycle"&&B0.payload){c(B0.payload);for(let k0 of m8.current.values())try{k0.contentWindow.postMessage({dgn:"git-lifecycle",payload:B0.payload},"*")}catch{}}}catch{}})}return y(),()=>{if(clearInterval(j),zQ.current)zQ.current.close()}},[Y7,N8]);function T7(j){let y=zQ.current;try{if(y&&y.readyState===1)y.send(JSON.stringify(j))}catch{}}let UX=u.useCallback(async()=>{try{let j=await fetch("/_api/git/status");if(j.ok)z0(await j.json())}catch{}},[]),IX=u.useCallback(async()=>{try{let j=await fetch("/_api/git/status?remote=1");if(!j.ok)return;let y=await j.json();if(y&&y.repo!==!1)X8({remoteAhead:!!y.remoteAhead,behind:y.behind||0})}catch{}},[]),VX=u.useCallback(async(j,y)=>{try{let t=await fetch(j,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(y||{})}),W0=await t.json().catch(()=>({}));return{ok:t.ok,...W0}}catch(t){return{ok:!1,error:"Network error — is the project still open?"}}},[]),GG=u.useCallback(async(j,y)=>{let t=await VX("/_api/git/commit",{message:j,files:y});if(t.ok)await UX();return t},[VX,UX]),Y4=u.useCallback(async(j)=>{let y=await VX("/_api/git/discard",{files:j});if(y.ok)await UX();return y},[VX,UX]),ZG=u.useCallback(async()=>{let j=await VX("/_api/git/push",{});if(j.ok)await UX(),IX();return j},[VX,UX,IX]),W4=u.useCallback(async()=>{let j=await VX("/_api/git/pull",{});if(j.ok)await UX(),IX();if(j.conflict&&Array.isArray(j.files)&&j.files.length)z8({file:j.files[0],conflict:!0});return j},[VX,UX,IX]),HG=u.useCallback(async(j)=>{let y=await VX("/_api/git/resolve",{choice:j});if(y.ok)await UX(),IX();return y},[VX,UX,IX]),G4=u.useCallback(async(j)=>{try{let y="/_api/git/log?limit=40"+(j?`&path=${encodeURIComponent(j)}`:""),t=await fetch(y);if(!t.ok)return[];return(await t.json()).entries||[]}catch{return[]}},[]),zG=u.useMemo(()=>{let j={modified:"M",added:"A",deleted:"D",untracked:"U"},y=new Map;for(let t of D0?.files||[])y.set(t.path,j[t.status]);return y},[D0]),Z4=D0?.files?.length||0;u.useEffect(()=>{if(D0?.repo===!1)return;IX();let j=setInterval(IX,d0?60000:120000);return()=>clearInterval(j)},[D0?.repo,d0,IX]);let H6=u.useCallback((j)=>{if(G((y)=>{for(let t of y)if(t.path!==j)m8.current.delete(t.path);return[{path:j}]}),H(j),K8(null),U(null),j!==d8)p9(j)},[]),H4=u.useRef(!1);u.useEffect(()=>{if(H4.current)return;if(!y0.cloud)return;if(W.length>0)return;if(!X.length)return;let j=null;for(let y of X){for(let t of y.paths||[]){if(!XQ.test(t))continue;if(/(^|\/)system\//.test(t))continue;j=t;break}if(j)break}if(!j)return;H4.current=!0,H6(j)},[y0.cloud,X,W.length,H6]);let pJ=u.useCallback((j)=>{let y=typeof j==="string"?j:void 0;if(y)lJ(y);else if(!W8)lJ();H6(d8)},[W8,lJ,H6]);u.useEffect(()=>{T7({type:"tabs",tabs:W.map((j)=>j.path).filter((j)=>j!==d8)})},[W]),u.useEffect(()=>{if(Z&&Z!==d8)T7({type:"active",file:Z});else if(Z===d8)T7({type:"active",file:""});else T7({type:"active",file:""})},[Z]);let nQ=u.useCallback((j)=>{G((y)=>{let t=y.findIndex((F0)=>F0.path===j);if(t<0)return y;let W0=y.filter((F0)=>F0.path!==j);if(j===Z)if(W0.length===0)H(null);else H(W0[Math.max(0,t-1)].path);return W0}),m8.current.delete(j),p9((y)=>y===j?null:y)},[Z]),qJ=u.useCallback(()=>{if(!Z||Z===d8){if(Z===d8)lJ();return}let j=m8.current.get(Z);if(j)j.src=j.src},[Z,lJ]),z4=u.useCallback(()=>Y7(),[Y7]),[KG,K4]=u.useState(!1),rQ=u.useRef(!1),aQ=u.useCallback(async()=>{if(rQ.current)return;rQ.current=!0,K4(!0);try{await Promise.all([Y7(),new Promise((j)=>setTimeout(j,550))])}finally{rQ.current=!1,K4(!1)}},[Y7]);u.useEffect(()=>{let j=null,y=()=>{if(j)clearTimeout(j);j=setTimeout(()=>{j=null,z4()},150)};return window.addEventListener("focus",y),()=>{if(window.removeEventListener("focus",y),j)clearTimeout(j)}},[z4]);let UG=u.useCallback(async(j)=>{try{let y=await fetch("/_api/canvas",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:j,kind:"brief-board"})}),t=await y.json().catch(()=>({}));if(!y.ok||!t.ok)return{ok:!1,error:t.error||`create failed (${y.status})`};return await Y7(),H6(t.file),{ok:!0,file:t.file}}catch(y){return{ok:!1,error:y instanceof Error?y.message:"network error"}}},[Y7,H6]),U4=u.useCallback(async()=>{let j=await zX("New video name");if(!j)return;let t=(await zX("Size — 1920x1080 (landscape), 1080x1920 (portrait), 1080x1080 (square), or custom WxH","1920x1080")||"1920x1080").toLowerCase().match(/(\d{2,5})\s*[x×]\s*(\d{2,5})/),W0=t?Number(t[1]):1920,F0=t?Number(t[2]):1080,B0=Math.max(1,Math.min(60,Number(await zX("Frames per second","30"))||30));try{let k0=await fetch("/_api/canvas",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:j,kind:"video-comp",clips:[],fps:B0,width:W0,height:F0})}),p=await k0.json().catch(()=>({}));if(!k0.ok||!p.ok){x8(`New video failed: ${p.error||`error ${k0.status}`}`);return}await Y7(),H6(p.file),o9(!0),x8("New video created — drop clips on the timeline to start the cut.",!0)}catch(k0){x8(`New video failed: ${k0 instanceof Error?k0.message:"network error"}`)}},[Y7,H6,zX]),VG=u.useCallback(async()=>{if(!Z||Z===d8)return;try{let j=await fetch(`/_api/annotations?file=${encodeURIComponent(Z)}`),y=j.ok?await j.text():"",t=[];if(y){let p=new DOMParser().parseFromString(y,"image/svg+xml");for(let _0 of p.querySelectorAll('[data-tool="mediaref"]')){let L0=_0.getAttribute("data-src");if(!L0)continue;t.push({src:L0,mediaKind:_0.getAttribute("data-media-kind")==="audio"?"audio":"video"})}}if(t.length===0){window.alert("Drop video/audio clips on the canvas first, then assemble them into a video.");return}let F0=`${vW(wK(Z)).replace(/\.tsx$/i,"")} Video`,B0=await fetch("/_api/canvas",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:F0,kind:"video-comp",clips:t})}),k0=await B0.json().catch(()=>({}));if(!B0.ok||!k0.ok){window.alert(`Assemble failed: ${k0.error||`error ${B0.status}`}`);return}await Y7(),H6(k0.file)}catch(j){window.alert(`Assemble failed: ${j instanceof Error?j.message:"network error"}`)}},[Z,Y7,H6]),sQ=u.useCallback(({accept:j,resolveTarget:y})=>{let t=Z,W0=D7||void 0,F0=document.createElement("input");F0.type="file",F0.accept=j,F0.style.cssText="position:fixed;left:-9999px;top:0;width:1px;height:1px;opacity:0;pointer-events:none",document.body.appendChild(F0);let B0=()=>{if(F0.isConnected)F0.remove()};window.addEventListener("focus",()=>setTimeout(B0,300),{once:!0}),F0.addEventListener("change",()=>{let k0=F0.files?.[0];if(B0(),!k0)return;let p=`/_api/comp-clips?canvas=${encodeURIComponent(t)}${W0?`&artboardId=${encodeURIComponent(W0)}`:""}`;fetch(p).then((_0)=>_0.json().catch(()=>({}))).then((_0)=>{let L0=y(_0);if(!L0)return x8("No replaceable media here (its src is computed) — edit via chat."),null;return fetch("/_api/asset",{method:"POST",headers:{"Content-Type":k0.type||"application/octet-stream"},body:k0}).then((p0)=>p0.json().catch(()=>({}))).then((p0)=>{if(!p0?.path)return x8(`Upload failed: ${p0?.error||"unknown error"}`),null;if(L0.arrayRef)return fetch("/_api/edit-array-src",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({canvas:t,arrayName:L0.arrayRef.arrayName,index:L0.arrayRef.index,field:L0.arrayRef.field,value:p0.path})});return fetch("/_api/edit-attr",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({canvas:t,id:L0.cdId,attr:"src",value:p0.path})})})}).then((_0)=>_0?_0.json():null).then((_0)=>{if(_0&&!_0.ok)x8(`Replace refused: ${_0.error||"failed"}`);else if(_0&&_0.ok){if(x8("Media replaced.",!0),_0.seq!=null)R7(t,_0.seq,"replace media")}}).catch(()=>x8("Replace failed: network error"))}),F0.click()},[Z,D7,R7]),qG=u.useCallback(async(j,y)=>{if(!window.confirm(`Move “${y}” to trash?
|
|
5654
5654
|
|
|
5655
5655
|
Its annotations, history and comments move with it. `+"You can restore it from .design/_trash/."))return;try{let W0=await fetch(`/_api/canvas?file=${encodeURIComponent(j)}`,{method:"DELETE"}),F0=await W0.json().catch(()=>({}));if(!W0.ok||!F0.ok){window.alert(`Could not delete: ${F0.error||`error ${W0.status}`}`);return}if(await Y7(),Z===j)G([]),H(null)}catch(W0){window.alert(`Delete failed: ${W0 instanceof Error?W0.message:"network error"}`)}},[Y7,Z]),BG=u.useCallback(async function j(y,t){try{let W0=await fetch("/_api/fs-move",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:y,toDir:t})}),F0=await W0.json().catch(()=>({}));if(!W0.ok||!F0.ok)return x8(`Could not move: ${F0.error||`error ${W0.status}`}`),{ok:!1,error:F0.error};let B0=(y0?.designRel||y0?.designRoot||".design").replace(/^\/+|\/+$/g,""),k0=`${B0}/${F0.fromRel}`,p=`${B0}/${F0.toRel}`;await Y7(),G((L0)=>L0.map((p0)=>p0.path===k0?{path:p}:p0)),H((L0)=>L0===k0?p:L0);let _0=k0.split("/").slice(0,-1).join("/");return x8(`Moved to ${F0.toRel.split("/").slice(0,-1).join("/")||"."}`,!0,{label:"Undo",onClick:()=>{j(p,_0)}}),{ok:!0}}catch(W0){return x8(`Move failed: ${W0 instanceof Error?W0.message:"network error"}`),{ok:!1,error:"network error"}}},[Y7,y0]),NG=u.useCallback(async(j,y)=>{try{let t=await fetch("/_api/fs-mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parent:j,name:y})}),W0=await t.json().catch(()=>({}));if(!t.ok||!W0.ok){let F0=W0.error||`error ${t.status}`;return x8(`Could not create folder: ${F0}`),{ok:!1,error:F0}}return await Y7(),{ok:!0,dir:W0.dir}}catch(t){let W0=t instanceof Error?t.message:"network error";return x8(`Create folder failed: ${W0}`),{ok:!1,error:W0}}},[Y7]),FG=u.useCallback(async(j,y)=>{if(!window.confirm(`Delete folder "${y}"?
|
|
5656
5656
|
|