decocms
Version:
Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools
5 lines (4 loc) • 36.2 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-editor-BwfJ8i7M.js","assets/index-DoEtSiIe.js","assets/index-DOMlzk_A.css","assets/editor-UaRoONxx.js","assets/delay-CnY5UFtP.js"])))=>i.map(i=>d[i]);
import{r as R,bb as Ue,c as W,b as X,m as ne,j as s,B as K,b8 as ye,h as je,I as ge,t as Pe,a_ as ve,a9 as Oe,bA as Ke,n as We,bB as ce,bC as Ge,e as qe,br as Se,bD as xe,bo as Te,bp as He,bq as he}from"./index-DoEtSiIe.js";import{C as Ye,c as Xe,a as Qe,S as Ze,M as es,v as ss}from"./held-block-view-CRIGJWyy.js";import{b as Le}from"./use-never-published-C4cAqdmZ.js";import{c as ts,u as ns}from"./hosted-reconcile-CTronLZo.js";import{b as ls,a as as}from"./repository-binding-BAQCDq-W.js";import{b as $e}from"./UserCheck01-CA8kXGn8.js";import{L as Ae,e as os,V as rs,_ as is}from"./agent-icon-DoabtHNW.js";import{c as cs}from"./Tool01-D90Wr5xR.js";import{i as ds}from"./SearchMd-BGRe_18c.js";import{L as _e}from"./label-G4Rj_cXa.js";import{S as us}from"./switch-C5tCt-1T.js";import{T as fs}from"./textarea-CP9TQ5HN.js";import{u as ms}from"./use-copy-CjEnyhFT.js";import{D as ps}from"./section-array-field-yz7QHNSD.js";import{a2 as xs,a3 as ke,a4 as hs,a5 as Ee,w as bs,q as vs}from"./site-editor-toast-B-FDGvtN.js";import{X as ys,Y as js,O as ze,x as gs,Z as ks,_ as Ns}from"./blocks-tab-states-CTy1iAF5.js";import{X as Ss}from"./category-tree-CW0acTf_.js";import{i as Ts}from"./ChevronSelectorVertical-Cvgyclsz.js";import{a as _s,C as Es,b as Ce,e as Cs,c as ws,f as Bs}from"./command-D5O7M-Cf.js";import{a as Rs,b as Ps,P as Os}from"./popover-mrQ4T9ru.js";import{u as Ls}from"./chat-context-vJ6R-Clt.js";import{a as $s}from"./MessageCircle01-zc37Krdu.js";import{i as As}from"./Play-C_9Fb_Ik.js";import{S as zs}from"./scroll-area-KLotig-P.js";import{c as ue,T as fe,a as me}from"./tooltip-DhlWzeQv.js";import{MonacoCodeEditor as Ie}from"./monaco-editor-BwfJ8i7M.js";import{S as Is}from"./save-status-CQe-z40L.js";const Ms=R.lazy(()=>Ue(()=>import("./monaco-editor-BwfJ8i7M.js"),__vite__mapDeps([0,1,2,3,4])).then(o=>({default:o.MonacoCodeEditor}))),te=o=>!!o&&typeof o=="object"&&!Array.isArray(o);function Js(o,e){return o("sandbox.schemaless.agentPrompt",{site:e?`"${e}"`:o("sandbox.schemaless.agentPromptSiteUnknown")})}function Vs(o){const e=W.c(56),{site:l,className:n}=o,t=X(),{handleCopy:a,copied:r}=ms();let i;e[0]!==n?(i=ne("flex shrink-0 flex-col gap-2.5 border-b bg-muted/40 px-4 py-3",n),e[0]=n,e[1]=i):i=e[1];let f;e[2]===Symbol.for("react.memo_cache_sentinel")?(f=s.jsx(cs,{"aria-hidden":"true",className:"mt-0.5 size-4 shrink-0 text-muted-foreground"}),e[2]=f):f=e[2];let p;e[3]!==t?(p=t("sandbox.schemaless.bannerTitle"),e[3]=t,e[4]=p):p=e[4];let b;e[5]!==p?(b=s.jsx("h2",{id:"schema-pending-title",className:"text-sm font-medium text-foreground",children:p}),e[5]=p,e[6]=b):b=e[6];let h;e[7]!==t?(h=t("sandbox.schemaless.bannerBody"),e[7]=t,e[8]=h):h=e[8];let x;e[9]!==h?(x=s.jsx("p",{className:"text-xs leading-relaxed text-muted-foreground",children:h}),e[9]=h,e[10]=x):x=e[10];let y;e[11]!==b||e[12]!==x?(y=s.jsxs("div",{className:"flex items-start gap-2",children:[f,s.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[b,x]})]}),e[11]=b,e[12]=x,e[13]=y):y=e[13];let m;e[14]!==a||e[15]!==l||e[16]!==t?(m=()=>{a(Js(t,l)).catch(()=>Pe.error(t("sandbox.schemaless.copyPromptFailed")))},e[14]=a,e[15]=l,e[16]=t,e[17]=m):m=e[17];let d;e[18]!==r?(d=r?s.jsx(ve,{className:"text-success"}):s.jsx(os,{}),e[18]=r,e[19]=d):d=e[19];let u;e[20]!==r||e[21]!==t?(u=t(r?"sandbox.schemaless.promptCopied":"sandbox.schemaless.copyPrompt"),e[20]=r,e[21]=t,e[22]=u):u=e[22];let c;e[23]!==u||e[24]!==m||e[25]!==d?(c=s.jsxs(K,{type:"button",variant:"outline",size:"sm",onClick:m,children:[d,u]}),e[23]=u,e[24]=m,e[25]=d,e[26]=c):c=e[26];let g;e[27]!==r||e[28]!==t?(g=r?t("sandbox.schemaless.promptCopiedAnnouncement"):"",e[27]=r,e[28]=t,e[29]=g):g=e[29];let j;e[30]!==g?(j=s.jsx("span",{className:"sr-only",role:"status","aria-live":"polite",children:g}),e[30]=g,e[31]=j):j=e[31];let v;e[32]!==t?(v=t("sandbox.schemaless.usesSkill"),e[32]=t,e[33]=v):v=e[33];let E;e[34]===Symbol.for("react.memo_cache_sentinel")?(E=s.jsx("span",{"aria-hidden":"true",children:" · "}),e[34]=E):E=e[34];let k;e[35]!==t?(k=t("sandbox.schemaless.installSkill"),e[35]=t,e[36]=k):k=e[36];let S;e[37]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(Oe,{"aria-hidden":"true",className:"size-3.5"}),e[37]=S):S=e[37];let N;e[38]!==t?(N=t("decoServe.docs.newTab"),e[38]=t,e[39]=N):N=e[39];let _;e[40]!==N?(_=s.jsx("span",{className:"sr-only",children:N}),e[40]=N,e[41]=_):_=e[41];let w;e[42]!==k||e[43]!==_?(w=s.jsxs("a",{href:ps,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-foreground underline-offset-4 hover:underline focus-visible:underline",children:[k,S,_]}),e[42]=k,e[43]=_,e[44]=w):w=e[44];let T;e[45]!==v||e[46]!==w?(T=s.jsxs("span",{className:"text-xs text-muted-foreground",children:[v,E,w]}),e[45]=v,e[46]=w,e[47]=T):T=e[47];let C;e[48]!==c||e[49]!==j||e[50]!==T?(C=s.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 pl-6",children:[c,j,T]}),e[48]=c,e[49]=j,e[50]=T,e[51]=C):C=e[51];let B;return e[52]!==i||e[53]!==C||e[54]!==y?(B=s.jsxs("section",{"aria-labelledby":"schema-pending-title","data-testid":"schema-pending-banner",className:i,children:[y,C]}),e[52]=i,e[53]=C,e[54]=y,e[55]=B):B=e[55],B}function Ds(o,e,l){if(te(o)){for(const n of["name","title","label"]){const t=o[n];if(typeof t=="string"&&t.trim())return t.trim()}if(typeof o.__resolveType=="string")return ke(o.__resolveType);for(const[n,t]of Object.entries(o)){if(n.startsWith("__")||typeof t!="string")continue;const a=t.trim();if(a&&a.length<=80&&!a.startsWith("<"))return a}}return l("sandbox.schemaless.item",{n:e+1})}const Fs=o=>`schemaless-${o.join(".")}`;function Us(o){const e=W.c(7),{id:l,value:n,onChange:t}=o;let a;e[0]!==n?(a=()=>n.includes(`
`)||n.length>80,e[0]=n,e[1]=a):a=e[1];const[r]=R.useState(a);let i;return e[2]!==l||e[3]!==r||e[4]!==t||e[5]!==n?(i=r?s.jsx(fs,{id:l,value:n,rows:Math.min(8,Math.max(3,n.split(`
`).length)),onChange:f=>t(f.target.value)}):s.jsx(ge,{id:l,value:n,onChange:f=>t(f.target.value)}),e[2]=l,e[3]=r,e[4]=t,e[5]=n,e[6]=i):i=e[6],i}function Ks(o){const e=W.c(15),{id:l,value:n,onChange:t}=o,a=X(),[r,i]=R.useState(String(n));let f;e[0]!==r?(f=Ee(r),e[0]=r,e[1]=f):f=e[1];const p=f===null;let b;e[2]!==t?(b=m=>{i(m.target.value);const d=Ee(m.target.value);d!==null&&t(d)},e[2]=t,e[3]=b):b=e[3];let h;e[4]!==l||e[5]!==p||e[6]!==b||e[7]!==r?(h=s.jsx(ge,{id:l,inputMode:"decimal",value:r,"aria-invalid":p,onChange:b}),e[4]=l,e[5]=p,e[6]=b,e[7]=r,e[8]=h):h=e[8];let x;e[9]!==p||e[10]!==a?(x=p&&s.jsx("p",{className:"text-xs text-destructive",children:a("sandbox.schemaless.notANumber")}),e[9]=p,e[10]=a,e[11]=x):x=e[11];let y;return e[12]!==h||e[13]!==x?(y=s.jsxs("div",{className:"flex flex-col gap-1",children:[h,x]}),e[12]=h,e[13]=x,e[14]=y):y=e[14],y}function Me(o){const e=W.c(67),{label:l,value:n,path:t,depth:a,onChange:r}=o,i=X();let f;e[0]!==t?(f=Fs(t),e[0]=t,e[1]=f):f=e[1];const p=f;if(typeof n=="boolean"){let m;e[2]!==p||e[3]!==l?(m=s.jsx(_e,{htmlFor:p,className:"min-w-0 truncate",children:l}),e[2]=p,e[3]=l,e[4]=m):m=e[4];let d;e[5]!==r||e[6]!==t?(d=g=>r(t,g),e[5]=r,e[6]=t,e[7]=d):d=e[7];let u;e[8]!==p||e[9]!==d||e[10]!==n?(u=s.jsx(us,{id:p,checked:n,onCheckedChange:d}),e[8]=p,e[9]=d,e[10]=n,e[11]=u):u=e[11];let c;return e[12]!==m||e[13]!==u?(c=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m,u]}),e[12]=m,e[13]=u,e[14]=c):c=e[14],c}if(typeof n=="string"||typeof n=="number"){let m;e[15]!==p||e[16]!==l?(m=s.jsx(_e,{htmlFor:p,className:"min-w-0 truncate",children:l}),e[15]=p,e[16]=l,e[17]=m):m=e[17];let d;e[18]!==p||e[19]!==r||e[20]!==t||e[21]!==n?(d=typeof n=="string"?s.jsx(Us,{id:p,value:n,onChange:c=>r(t,c)}):s.jsx(Ks,{id:p,value:n,onChange:c=>r(t,c)}),e[18]=p,e[19]=r,e[20]=t,e[21]=n,e[22]=d):d=e[22];let u;return e[23]!==m||e[24]!==d?(u=s.jsxs("div",{className:"flex flex-col gap-1.5",children:[m,d]}),e[23]=m,e[24]=d,e[25]=u):u=e[25],u}if(Array.isArray(n)||te(n)){let m,d,u,c,g;if(e[26]!==a||e[27]!==l||e[28]!==r||e[29]!==t||e[30]!==i||e[31]!==n){const E=Array.isArray(n)?n.map((T,C)=>[Ds(T,C,i),T,C]):Object.entries(n).filter(Gs).map(Ws),k=te(n)&&typeof n.__resolveType=="string"?n.__resolveType:null;u=a===0,c="group rounded-md border border-border";let S;e[37]!==l?(S=s.jsx("span",{className:"min-w-0 truncate",children:l}),e[37]=l,e[38]=S):S=e[38];let N;e[39]!==k?(N=k&&s.jsx("span",{className:"min-w-0 truncate font-mono text-xs font-normal text-muted-foreground",title:k,children:ke(k)}),e[39]=k,e[40]=N):N=e[40];let _;e[41]!==i||e[42]!==n?(_=Array.isArray(n)?i("sandbox.schemaless.itemCount",{count:n.length}):null,e[41]=i,e[42]=n,e[43]=_):_=e[43];let w;e[44]!==_?(w=s.jsx("span",{className:"ml-auto shrink-0 text-xs font-normal text-muted-foreground",children:_}),e[44]=_,e[45]=w):w=e[45],e[46]!==w||e[47]!==S||e[48]!==N?(g=s.jsxs("summary",{className:"flex cursor-pointer select-none items-center gap-2 px-3 py-2 text-sm font-medium text-foreground",children:[S,N,w]}),e[46]=w,e[47]=S,e[48]=N,e[49]=g):g=e[49],m="flex flex-col gap-4 border-t border-border px-3 py-3",d=E.length===0?s.jsx("p",{className:"text-xs text-muted-foreground",children:i("sandbox.schemaless.empty")}):E.map(T=>{const[C,B,O]=T;return s.jsx(Me,{label:C,value:B,path:[...t,O],depth:a+1,onChange:r},O)}),e[26]=a,e[27]=l,e[28]=r,e[29]=t,e[30]=i,e[31]=n,e[32]=m,e[33]=d,e[34]=u,e[35]=c,e[36]=g}else m=e[32],d=e[33],u=e[34],c=e[35],g=e[36];let j;e[50]!==m||e[51]!==d?(j=s.jsx("div",{className:m,children:d}),e[50]=m,e[51]=d,e[52]=j):j=e[52];let v;return e[53]!==u||e[54]!==c||e[55]!==g||e[56]!==j?(v=s.jsxs("details",{open:u,className:c,children:[g,j]}),e[53]=u,e[54]=c,e[55]=g,e[56]=j,e[57]=v):v=e[57],v}let b;e[58]!==l?(b=s.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:l}),e[58]=l,e[59]=b):b=e[59];let h;e[60]!==i?(h=i("sandbox.schemaless.notSet"),e[60]=i,e[61]=h):h=e[61];let x;e[62]!==h?(x=s.jsx("span",{className:"text-xs text-muted-foreground",children:h}),e[62]=h,e[63]=x):x=e[63];let y;return e[64]!==b||e[65]!==x?(y=s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[b,x]}),e[64]=b,e[65]=x,e[66]=y):y=e[66],y}function Ws(o){const[e,l]=o;return[e,l,e]}function Gs(o){const[e]=o;return e!=="__resolveType"}function qs({blockKey:o,block:e,onChange:l,onBack:n,onOpenBlock:t}){const a=X(),[r,i]=R.useState(()=>(t?.(o),e)),[f,p]=R.useState(0),[b,h]=R.useState(null),[x,y]=R.useState(!1),m=v=>{i(v),l(o,v)},d=typeof r.__resolveType=="string"?r.__resolveType:null,u=Object.entries(r).filter(([v])=>v!=="__resolveType"),c=()=>{b!==null?(h(null),y(!1),p(v=>v+1)):h(JSON.stringify(r,null,2))},g=v=>{try{const E=JSON.parse(v??"");if(te(E)){y(!1),m(E);return}}catch{}y(!0)},j=a(b!==null?"sandbox.savedSectionEditor.closeJsonEditor":"sandbox.savedSectionEditor.editAsJson");return s.jsxs("div",{className:"flex h-full min-w-0 flex-1 flex-col",children:[s.jsxs("header",{className:"flex shrink-0 items-center gap-2 border-b px-3 py-2",children:[n&&s.jsxs(K,{variant:"ghost",size:"sm",className:"shrink-0",onClick:n,children:[s.jsx($e,{"aria-hidden":"true"}),a("sandbox.schemaless.back")]}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsx("h3",{className:"truncate text-sm font-medium",title:o,children:o}),d&&s.jsx("span",{className:"truncate font-mono text-xs text-muted-foreground",title:d,children:d})]}),s.jsx(K,{variant:b!==null?"default":"ghost",size:"icon",className:"shrink-0",onClick:c,"aria-label":j,"aria-pressed":b!==null,title:j,children:b!==null?s.jsx(ye,{size:14}):s.jsx(Ae,{size:14})})]}),s.jsxs("div",{className:"relative min-h-0 flex-1",children:[s.jsx("div",{className:"h-full overflow-y-auto",children:s.jsx("form",{"aria-label":o,className:"mx-auto flex max-w-2xl flex-col gap-4 px-6 py-4",onSubmit:v=>v.preventDefault(),children:u.length===0?s.jsx("p",{className:"text-xs text-muted-foreground",children:a("sandbox.schemaless.empty")}):u.map(([v,E])=>s.jsx(Me,{label:v,value:E,path:[v],depth:0,onChange:(k,S)=>m(hs(r,k,S))},v))},f)}),b!==null&&s.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[x&&s.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:a("sandbox.savedSectionEditor.invalidJsonError")}),s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(R.Suspense,{fallback:s.jsx("div",{className:"flex h-full items-center justify-center",children:s.jsx(je,{className:"size-5 text-muted-foreground"})}),children:s.jsx(Ms,{language:"json",height:"100%",code:b,onChange:g})})})]})]})]})}function Hs(o){const e=W.c(70),{decofile:l,onChange:n,onLeaveBlock:t,onOpenBlock:a,wrapEditor:r,v8:i,copyEpochOf:f,site:p,initialKey:b,compact:h}=o,x=i===void 0?!1:i,y=p===void 0?null:p,m=b===void 0?null:b,d=h===void 0?!1:h,u=X(),[c,g]=R.useState(m&&te(l[m])?m:null),[j,v]=R.useState("");let E;e[0]!==t||e[1]!==a||e[2]!==c||e[3]!==x?(E=A=>{A!==c&&(t?.(),!x&&A!==null&&a?.(A),g(A))},e[0]=t,e[1]=a,e[2]=c,e[3]=x,e[4]=E):E=e[4];const k=E;let S;e[5]!==f||e[6]!==c?(S=c?f?.(c)??0:0,e[5]=f,e[6]=c,e[7]=S):S=e[7];const N=S,[_,w]=R.useState(N);_!==N&&(w(N),!x&&c!==null&&a?.(c));const T=c?l[c]:void 0;let C,B,O,J,P;if(e[8]!==d||e[9]!==l||e[10]!==j||e[11]!==k||e[12]!==c||e[13]!==u){const A=j.trim().toLowerCase(),F=xs(l).map(M=>({...M,blocks:A?M.blocks.filter(U=>U.label.toLowerCase().includes(A)||U.key.toLowerCase().includes(A)||(M.resolveType??"").toLowerCase().includes(A)):M.blocks})).filter(Ys),pe=Object.keys(l).length;e[19]!==u?(P=u("sandbox.schemaless.listLabel"),e[19]=u,e[20]=P):P=e[20];const ie=d?"flex-1":"w-72 shrink-0 border-r";e[21]!==ie?(C=ne("flex min-h-0 flex-col",ie),e[21]=ie,e[22]=C):C=e[22];let se;e[23]===Symbol.for("react.memo_cache_sentinel")?(se=s.jsx(ds,{"aria-hidden":"true",className:"pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground"}),e[23]=se):se=e[23];let ae;e[24]===Symbol.for("react.memo_cache_sentinel")?(ae=M=>v(M.target.value),e[24]=ae):ae=e[24];let H;e[25]!==u?(H=u("sandbox.schemaless.searchPlaceholder"),e[25]=u,e[26]=H):H=e[26];let Y;e[27]!==u?(Y=u("sandbox.schemaless.searchPlaceholder"),e[27]=u,e[28]=Y):Y=e[28],e[29]!==j||e[30]!==H||e[31]!==Y?(B=s.jsx("div",{className:"shrink-0 border-b p-2",children:s.jsxs("div",{className:"relative",children:[se,s.jsx(ge,{type:"search",value:j,onChange:ae,placeholder:H,"aria-label":Y,className:"pl-8"})]})}),e[29]=j,e[30]=H,e[31]=Y,e[32]=B):B=e[32],O="min-h-0 flex-1 overflow-y-auto py-1",J=pe===0?s.jsx("p",{className:"px-4 py-6 text-center text-xs text-muted-foreground",children:u("sandbox.schemaless.noBlocks")}):F.length===0?s.jsx("p",{className:"px-4 py-6 text-center text-xs text-muted-foreground",children:u("sandbox.schemaless.noMatches")}):F.map(M=>s.jsxs("section",{"aria-label":M.resolveType??u("sandbox.schemaless.noType"),className:"py-1",children:[s.jsxs("h3",{className:"flex items-baseline gap-2 px-3 pt-2 pb-1 text-xs font-medium text-muted-foreground",title:M.resolveType??void 0,children:[s.jsx("span",{className:"truncate",children:M.resolveType?ke(M.resolveType):u("sandbox.schemaless.noType")}),s.jsx("span",{className:"ml-auto shrink-0 tabular-nums",children:M.blocks.length})]}),s.jsx("ul",{children:M.blocks.map(U=>s.jsx("li",{children:s.jsx("button",{type:"button",onClick:()=>k(U.key),"aria-current":U.key===c?"true":void 0,title:U.key,className:ne("block w-full truncate px-3 py-1.5 text-left text-sm hover:bg-accent focus-visible:bg-accent focus-visible:outline-none",U.key===c&&"bg-accent font-medium"),children:U.label})},U.key))})]},M.resolveType??"")),e[8]=d,e[9]=l,e[10]=j,e[11]=k,e[12]=c,e[13]=u,e[14]=C,e[15]=B,e[16]=O,e[17]=J,e[18]=P}else C=e[14],B=e[15],O=e[16],J=e[17],P=e[18];let $;e[33]!==O||e[34]!==J?($=s.jsx("div",{className:O,children:J}),e[33]=O,e[34]=J,e[35]=$):$=e[35];let D;e[36]!==C||e[37]!==B||e[38]!==$||e[39]!==P?(D=s.jsxs("nav",{"aria-label":P,className:C,children:[B,$]}),e[36]=C,e[37]=B,e[38]=$,e[39]=P,e[40]=D):D=e[40];const I=D;let L;e[41]!==T||e[42]!==d||e[43]!==f||e[44]!==n||e[45]!==a||e[46]!==k||e[47]!==c||e[48]!==u||e[49]!==x?(L=c&&te(T)?s.jsx(qs,{blockKey:c,block:T,onOpenBlock:x?a:void 0,onChange:n,onBack:d?()=>k(null):void 0},`${c}:${f?.(c)??0}`):s.jsx("div",{className:"flex min-w-0 flex-1 items-center justify-center p-6",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:u("sandbox.schemaless.pickBlock")})}),e[41]=T,e[42]=d,e[43]=f,e[44]=n,e[45]=a,e[46]=k,e[47]=c,e[48]=u,e[49]=x,e[50]=L):L=e[50];const Q=L;let Z;e[51]!==Q||e[52]!==c||e[53]!==x||e[54]!==r?(Z=x&&c&&r?r(c,Q):Q,e[51]=Q,e[52]=c,e[53]=x,e[54]=r,e[55]=Z):Z=e[55];const ee=Z;let G;e[56]!==y?(G=s.jsx(Vs,{site:y}),e[56]=y,e[57]=G):G=e[57];let V;e[58]!==T||e[59]!==d||e[60]!==ee||e[61]!==I||e[62]!==c?(V=d&&c&&te(T)?ee:I,e[58]=T,e[59]=d,e[60]=ee,e[61]=I,e[62]=c,e[63]=V):V=e[63];const re=!d&ⅇlet q;e[64]!==V||e[65]!==re?(q=s.jsxs("div",{className:"flex min-h-0 flex-1",children:[V,re]}),e[64]=V,e[65]=re,e[66]=q):q=e[66];let le;return e[67]!==G||e[68]!==q?(le=s.jsxs("div",{"data-testid":"schemaless-content",className:"flex h-full min-h-0 w-full flex-col",children:[G,q]}),e[67]=G,e[68]=q,e[69]=le):le=e[69],le}function Ys(o){return o.blocks.length>0}function At(o){const e=W.c(35),{orgSlug:l,virtualMcpId:n,branch:t,decofile:a,initialKey:r,compact:i}=o,f=ls(n)?.metadata;let p;e[0]!==f?(p=Ke(f),e[0]=f,e[1]=p):p=e[1];const b=p;let h;e[2]!==t||e[3]!==l||e[4]!==n?(h={orgSlug:l,virtualMcpId:n,branch:t},e[2]=t,e[3]=l,e[4]=n,e[5]=h):h=e[5];let x;e[6]===Symbol.for("react.memo_cache_sentinel")?(x={holdsCopy:!0},e[6]=x):x=e[6];const{save:y,flush:m,hold:d,v8:u}=Le(h,x);let c;e[7]!==t||e[8]!==l||e[9]!==n?(c=ts({orgSlug:l,virtualMcpId:n,branch:t}),e[7]=t,e[8]=l,e[9]=n,e[10]=c):c=e[10];const g=ns(c);let j;e[11]!==m?(j=()=>m(),e[11]=m,e[12]=j):j=e[12];const v=R.useEffectEvent(j);let E;e[13]!==v?(E=()=>()=>v(),e[13]=v,e[14]=E):E=e[14];let k;e[15]===Symbol.for("react.memo_cache_sentinel")?(k=[],e[15]=k):k=e[15],R.useEffect(E,k);let S;e[16]!==y?(S=(w,T)=>y(w,T),e[16]=y,e[17]=S):S=e[17];let N;e[18]!==t||e[19]!==a||e[20]!==l||e[21]!==u||e[22]!==n?(N=u?(w,T)=>s.jsx(Ye,{listing:a,scope:{orgSlug:l,virtualMcpId:n,branch:t},names:[w],children:T}):void 0,e[18]=t,e[19]=a,e[20]=l,e[21]=u,e[22]=n,e[23]=N):N=e[23];let _;return e[24]!==i||e[25]!==g||e[26]!==a||e[27]!==m||e[28]!==d||e[29]!==r||e[30]!==b||e[31]!==N||e[32]!==S||e[33]!==u?(_=s.jsx(Hs,{decofile:a,site:b,onChange:S,onLeaveBlock:m,onOpenBlock:d,v8:u,wrapEditor:N,copyEpochOf:g,initialKey:r,compact:i}),e[24]=i,e[25]=g,e[26]=a,e[27]=m,e[28]=d,e[29]=r,e[30]=b,e[31]=N,e[32]=S,e[33]=u,e[34]=_):_=e[34],_}const we={resolveType:"website/pages/Page.tsx",seoResolveType:"website/sections/Seo/SeoV2.tsx"};function zt(o){return`pages-${encodeURIComponent(o)}-${crypto.randomUUID()}`}function It(o,e,l){if(bs(l))return{name:o,path:e,sections:[],__resolveType:"page"};const n=ys(l??void 0);if(!l||js(n))return{name:o,path:e,sections:[],seo:{__resolveType:we.seoResolveType},__resolveType:we.resolveType};const t=Ss(l);return{name:o,path:e,sections:[],...t?{seo:{__resolveType:t}}:{},__resolveType:n}}const Be="__blank__";function Mt(o){const e=W.c(65),{id:l,value:n,onChange:t,templates:a,disabled:r}=o,i=X(),[f,p]=R.useState(!1);let b;if(e[0]!==a||e[1]!==n){let I;e[3]!==n?(I=L=>L.key===n,e[3]=n,e[4]=I):I=e[4],b=a.find(I),e[0]=a,e[1]=n,e[2]=b}else b=e[2];const h=b;let x;e[5]!==h?.name||e[6]!==i?(x=h?.name??i("sectionsEditor.pageTemplateSelect.blankPageDefaultLabel"),e[5]=h?.name,e[6]=i,e[7]=x):x=e[7];let y;e[8]!==x?(y=s.jsx("span",{className:"max-w-full shrink-0 truncate",children:x}),e[8]=x,e[9]=y):y=e[9];let m;e[10]!==h?(m=h?.path?s.jsx("span",{className:"truncate text-muted-foreground",children:h.path}):null,e[10]=h,e[11]=m):m=e[11];let d;e[12]!==y||e[13]!==m?(d=s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[y,m]}),e[12]=y,e[13]=m,e[14]=d):d=e[14];let u;e[15]===Symbol.for("react.memo_cache_sentinel")?(u=s.jsx(Ts,{className:"shrink-0 opacity-50"}),e[15]=u):u=e[15];let c;e[16]!==r||e[17]!==l||e[18]!==f||e[19]!==d?(c=s.jsx(Rs,{asChild:!0,children:s.jsxs(K,{id:l,type:"button",variant:"outline",role:"combobox","aria-expanded":f,disabled:r,className:"w-full justify-between font-normal contain-inline-size",children:[d,u]})}),e[16]=r,e[17]=l,e[18]=f,e[19]=d,e[20]=c):c=e[20];let g;e[21]===Symbol.for("react.memo_cache_sentinel")?(g={width:"var(--radix-popover-trigger-width)"},e[21]=g):g=e[21];let j;e[22]!==i?(j=i("sectionsEditor.pageTemplateSelect.searchPlaceholder"),e[22]=i,e[23]=j):j=e[23];let v;e[24]!==j?(v=s.jsx(_s,{placeholder:j,className:"h-9"}),e[24]=j,e[25]=v):v=e[25];let E;e[26]!==i?(E=i("sectionsEditor.pageTemplateSelect.noPagesFoundMessage"),e[26]=i,e[27]=E):E=e[27];let k;e[28]!==E?(k=s.jsx(Es,{children:E}),e[28]=E,e[29]=k):k=e[29];let S;e[30]!==i?(S=i("sectionsEditor.pageTemplateSelect.blankPageLabel"),e[30]=i,e[31]=S):S=e[31];let N;e[32]!==t?(N=()=>{t(Be),p(!1)},e[32]=t,e[33]=N):N=e[33];let _;e[34]!==i?(_=i("sectionsEditor.pageTemplateSelect.blankPageLabel"),e[34]=i,e[35]=_):_=e[35];const w=n===Be?"opacity-100":"opacity-0";let T;e[36]!==w?(T=ne("ml-auto",w),e[36]=w,e[37]=T):T=e[37];let C;e[38]!==T?(C=s.jsx(ve,{className:T}),e[38]=T,e[39]=C):C=e[39];let B;e[40]!==S||e[41]!==N||e[42]!==_||e[43]!==C?(B=s.jsxs(Ce,{value:S,onSelect:N,children:[_,C]}),e[40]=S,e[41]=N,e[42]=_,e[43]=C,e[44]=B):B=e[44];let O;if(e[45]!==t||e[46]!==a||e[47]!==n){let I;e[49]!==t||e[50]!==n?(I=L=>s.jsxs(Ce,{value:`${L.name} ${L.path}`,onSelect:()=>{t(L.key),p(!1)},children:[s.jsxs("div",{className:"flex min-w-0 flex-col",children:[s.jsx("span",{className:"truncate",children:L.name}),s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:L.path})]}),s.jsx(ve,{className:ne("ml-auto",n===L.key?"opacity-100":"opacity-0")})]},L.key),e[49]=t,e[50]=n,e[51]=I):I=e[51],O=a.map(I),e[45]=t,e[46]=a,e[47]=n,e[48]=O}else O=e[48];let J;e[52]!==B||e[53]!==O?(J=s.jsxs(Cs,{children:[B,O]}),e[52]=B,e[53]=O,e[54]=J):J=e[54];let P;e[55]!==k||e[56]!==J?(P=s.jsxs(ws,{onWheel:Xs,children:[k,J]}),e[55]=k,e[56]=J,e[57]=P):P=e[57];let $;e[58]!==v||e[59]!==P?($=s.jsx(Ps,{className:"p-0",style:g,children:s.jsxs(Bs,{children:[v,P]})}),e[58]=v,e[59]=P,e[60]=$):$=e[60];let D;return e[61]!==f||e[62]!==$||e[63]!==c?(D=s.jsxs(Os,{open:f,onOpenChange:p,children:[c,$]}),e[61]=f,e[62]=$,e[63]=c,e[64]=D):D=e[64],D}function Xs(o){const e=o.deltaMode===1?16:1;o.currentTarget.scrollTop=o.currentTarget.scrollTop+o.deltaY*e}function Qs(o){const e=W.c(13),{crumbs:l,onSelect:n,onSelectRoot:t}=o;let a;e[0]!==n||e[1]!==t?(a=t??(()=>n(0)),e[0]=n,e[1]=t,e[2]=a):a=e[2];let r;e[3]!==a?(r={onSelect:a},e[3]=a,e[4]=r):r=e[4];let i;if(e[5]!==l||e[6]!==n){let p;e[8]!==n?(p=(b,h)=>({key:`block-${h}`,label:Xe(b),onSelect:()=>n(h)}),e[8]=n,e[9]=p):p=e[9],i=l.map(p),e[5]=l,e[6]=n,e[7]=i}else i=e[7];let f;return e[10]!==r||e[11]!==i?(f=s.jsx(We.Breadcrumbs,{after:"page",parent:r,items:i}),e[10]=r,e[11]=i,e[12]=f):f=e[12],f}const Zs={loaders:"loader",actions:"action"},Je=new Set(["workflows"]);function et(o){return Zs[o]}function Ve(o,e,l){const n=o.manifest?.blocks??{};for(const[t,a]of Object.entries(n))if(t.includes(l)&&e in a)return!0;return!1}function st(o,e,l){return/\.tsx?$/.test(e)?!0:Ve(o,e,l)}function Jt(o,e){const l=new Set,n=o.manifest?.blocks??{};for(const[t,a]of Object.entries(n))if(t.includes(e))for(const r of Object.keys(a))l.add(r);return l}function tt(o,e){return/\.tsx?$/.test(o)?!1:e.has(`${o}.ts`)||e.has(`${o}.tsx`)}function nt(o,e){const l=o.manifest?.blocks??{},n=[],t=new Set;for(const[a,r]of Object.entries(l))if(a.includes(e))for(const i of Object.keys(r))t.add(i);for(const a of t){if(a.toLowerCase().includes("preview")||ze.has(a)||Je.has(Ne(a))||tt(a,t))continue;const r=gs(a,o);if(r.hidden)continue;const i=r.title&&r.title!==a?r.title:ce(a);n.push({resolveType:a,title:i})}return n.sort((a,r)=>a.title.localeCompare(r.title))}function Vt(o,e){return nt(o,e).length}function Ne(o){return o.startsWith("deco-sites/")?o.split("/")[1]||"site":o.startsWith("$live")||o.startsWith("deco/")?"deco":o.split("/")[0]||"other"}const lt={deco:"Deco",std:"Deco Standard",website:"Website"};function Dt(o){return lt[o]??o}function Ft(o){const e=Ne(o);let n=o.split("/").filter(Boolean).slice(o.startsWith("deco-sites/")?2:1);return(n[0]==="loaders"||n[0]==="actions")&&(n=n.slice(1)),[e,...n.slice(0,-1)]}function Ut(o,e,l){const n=[];for(const[t,a]of Object.entries(e)){if(st(o,t,l)||Ge(t)||!a||typeof a!="object"||Array.isArray(a))continue;const r=a,i=r.__resolveType;typeof i=="string"&&(ze.has(i)||Je.has(Ne(i))||Ve(o,i,l)&&n.push({key:t,resolveType:i,title:typeof r.name=="string"&&r.name?r.name:t}))}return n.sort((t,a)=>t.title.localeCompare(a.title))}function Kt(o,e){const l=o[e],n=typeof l?.__resolveType=="string"?l.__resolveType:"",{__resolveType:t,...a}=l??{},r=typeof l?.name=="string"&&l.name?l.name:e;return{resolveType:n,props:a,title:r}}const Re=3e4;function at(o,e,l,n){const t=new URL(`/deco/invoke/${e}`,o);return t.searchParams.set("__cb",n.toString(36)),t.searchParams.set("__decoFBT","0"),t.searchParams.set("__d",`run-${n.toString(36)}`),t.searchParams.set("props",btoa(encodeURIComponent(JSON.stringify(l)))),t.href}async function ot(o,{resolveType:e,props:l}){let n;try{n=await fetch(vs(o),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({__resolveType:e,...l}),signal:AbortSignal.timeout(Re)})}catch(i){throw i instanceof DOMException&&i.name==="TimeoutError"?new Error(`Run timed out after ${Re/1e3}s — the block may be slow or the preview unresponsive.`):i}const t=await n.text();let a=null,r=!1;try{a=t?JSON.parse(t):null,r=!0}catch{}if(!n.ok){const i=r&&a&&typeof a=="object"&&"error"in a&&typeof a.error=="string"?a.error:t||`Run failed (${n.status})`;throw new Error(i)}return r?a:t}function rt(o){const e=W.c(2);let l;return e[0]!==o?(l={mutationFn:n=>ot(o,n)},e[0]=o,e[1]=l):l=e[1],qe(l)}function Wt({orgSlug:o,virtualMcpId:e,branch:l,previewUrl:n,meta:t,decofile:a,kind:r,target:i,initialValue:f,isCreating:p,onCreate:b,onSaveReferencedBlock:h,onBack:x,backLabel:y,showRun:m=!0}){const d=Ls(),u=d?.taskId??null,c=X(),g=d?.virtualMcpId,v=as(g===e?e:null)?.metadata?.siteSlug??null,E=Qe(i.resolveType,t),k=!E&&ks(i.resolveType,t),S=k?Ns(f):null,N=E??S,[_,w]=R.useState(f),[T,C]=R.useState([]),[B,O]=R.useState(0),[J,P]=R.useState(!1),[$,D]=R.useState(null),[I,L]=R.useState(!1),[Q,Z]=R.useState(!1),[ee,G]=R.useState(!1),V=$!==null,{save:re,flush:q,isPending:le}=Le({orgSlug:o,virtualMcpId:e,branch:l},{holdsCopy:i.mode==="saved"}),A=rt({orgSlug:o,virtualMcpId:e,branch:l,threadId:u});R.useEffect(()=>()=>{q()},[]);const F=et(r),pe=i.resolveType.split("/").pop()?.replace(/\.tsx?$/,"")??i.resolveType,ie={orgSlug:o,virtualMcpId:e,branch:l,threadId:u,previewUrl:n??void 0,siteSlug:v},se=z=>{w(z),i.mode==="saved"&&re(i.blockKey,{__resolveType:i.resolveType,...z})},ae=()=>{V?(D(null),P(!1),O(z=>z+1)):D(JSON.stringify(_,null,2))},H=z=>{const oe=z??"";try{const de=JSON.parse(oe);if(de&&typeof de=="object"&&!Array.isArray(de)){P(!1),se(de);return}P(!0)}catch{P(!0)}},Y=async z=>{const oe=ss(z,a);if(oe){Pe.error(oe);return}await b(z,{__resolveType:i.resolveType,..._}),L(!1)},M=()=>{Z(!0),A.mutate({resolveType:i.resolveType,props:_})},U=()=>{n&&window.open(at(n,i.resolveType,_,Date.now()),"_blank","noopener")},De=[i.title,...T],Fe=z=>{C(T.slice(0,z)),O(oe=>oe+1)};return s.jsxs("div",{className:"flex h-full w-full min-w-0 flex-col",children:[s.jsx(Qs,{crumbs:De,onSelect:Fe,onSelectRoot:x}),s.jsxs("div",{className:"shrink-0 border-b px-3 py-2.5",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2 overflow-hidden",children:[x&&y&&s.jsxs(K,{variant:"ghost",size:"sm",className:"-ml-1 min-w-0 shrink gap-1",onClick:x,children:[s.jsx($e,{size:14,className:"shrink-0"}),s.jsx("span",{className:"truncate",children:y})]}),s.jsx("div",{className:"flex-1"}),i.mode==="saved"&&s.jsx(Is,{isPending:le,isError:!1}),m&&s.jsxs(K,{size:"default",variant:"outline",className:"shrink-0 gap-1.5",onClick:M,disabled:A.isPending,"aria-label":c("sandbox.runnableBlockEditor.runAriaLabel",{singular:F}),children:[A.isPending?s.jsx(je,{className:"size-3.5"}):s.jsx(As,{size:14}),c("sandbox.runnableBlockEditor.run")]}),i.mode==="available"&&s.jsxs(ue,{children:[s.jsx(fe,{asChild:!0,children:s.jsx(K,{size:"icon",className:"shrink-0",disabled:p,onClick:()=>L(!0),"aria-label":c("sandbox.runnableBlockEditor.saveAsGlobalAriaLabel",{singular:F}),children:s.jsx(rs,{size:14})})}),s.jsx(me,{side:"bottom",children:c("sandbox.runnableBlockEditor.saveAsGlobal",{singular:F})})]}),s.jsxs(ue,{children:[s.jsx(fe,{asChild:!0,children:s.jsx(K,{variant:V?"default":"ghost",size:"icon",className:"shrink-0",onClick:ae,"aria-label":c(V?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson"),"aria-pressed":V,children:V?s.jsx(ye,{size:14}):s.jsx(Ae,{size:14})})}),s.jsx(me,{side:"bottom",children:c(V?"sandbox.runnableBlockEditor.closeJsonEditor":"sandbox.runnableBlockEditor.editAsJson")})]})]}),s.jsx("p",{className:"mt-1.5 py-1 pl-1 text-sm leading-snug text-muted-foreground",children:i.mode==="saved"?c("sandbox.runnableBlockEditor.savedModeDescription",{singular:F}):c("sandbox.runnableBlockEditor.availableModeDescription",{typeLabel:pe,singular:F})})]}),s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[s.jsxs("div",{className:ne("relative min-h-0 flex-1",Q&&ee&&"hidden"),children:[s.jsx(zs,{className:"h-full [&_[data-slot=scroll-area-viewport]>div]:!block",children:s.jsx("div",{className:"min-w-0 max-w-full overflow-x-hidden px-6 py-4",children:s.jsxs("div",{className:"mx-auto max-w-2xl",children:[S&&N===S&&s.jsx("p",{className:"mb-3 rounded-md bg-muted px-3 py-2 text-xs leading-snug text-muted-foreground",children:c("sandbox.runnableBlockEditor.inferredSchemaNotice",{singular:F})}),N?s.jsx(Ze,{schema:N,value:_,onChange:z=>se(z),basePath:"",breadcrumbPath:T,onBreadcrumbChange:C,meta:t,decofile:a,onSaveReferencedBlock:h,sandbox:ie},B):s.jsx("div",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:k?c("sandbox.runnableBlockEditor.freeformPropsEmptyState",{singular:F}):c("sandbox.runnableBlockEditor.noInputEmptyState",{singular:F})})]})})}),$!==null&&s.jsxs("div",{className:"absolute inset-0 flex flex-col bg-background",children:[J&&s.jsx("div",{className:"shrink-0 border-b bg-destructive/10 px-3 py-1.5 text-xs text-destructive",children:c("sandbox.runnableBlockEditor.invalidJsonError")}),s.jsx("div",{className:"min-h-0 flex-1",children:s.jsx(Ie,{language:"json",height:"100%",code:$,onChange:H,onSave:z=>{H(z),q()}})})]})]}),Q&&s.jsx(it,{singular:F,result:{isPending:A.isPending,error:A.error,data:A.data,hasRun:A.status!=="idle"},expanded:ee,onToggleExpand:()=>G(z=>!z),onOpenInNewTab:n?U:void 0,onClose:()=>{Z(!1),G(!1)}})]}),s.jsx(es,{open:I,onOpenChange:L,defaultBlockId:"",isPending:p,onSubmit:Y})]})}function it(o){const e=W.c(54),{singular:l,result:n,expanded:t,onToggleExpand:a,onOpenInNewTab:r,onClose:i}=o,f=X();let p;e[0]!==n.data?(p=typeof n.data=="string"?n.data:JSON.stringify(n.data??null,null,2),e[0]=n.data,e[1]=p):p=e[1];const b=p,h=t?"flex-1":"h-[45%] shrink-0";let x;e[2]!==h?(x=ne("flex min-h-0 flex-col border-t",h),e[2]=h,e[3]=x):x=e[3];let y;e[4]!==f?(y=f("sandbox.runnableBlockEditor.resultPanelTitle"),e[4]=f,e[5]=y):y=e[5];let m;e[6]!==y?(m=s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:y}),e[6]=y,e[7]=m):m=e[7];let d;e[8]!==r||e[9]!==l||e[10]!==f?(d=r&&s.jsxs(ue,{children:[s.jsx(fe,{asChild:!0,children:s.jsx(K,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":f("sandbox.runnableBlockEditor.openResultInNewTabAriaLabel"),children:s.jsx(Oe,{size:14})})}),s.jsx(me,{side:"bottom",children:f("sandbox.runnableBlockEditor.openInNewTabTooltip",{singular:l})})]}),e[8]=r,e[9]=l,e[10]=f,e[11]=d):d=e[11];let u;e[12]!==t||e[13]!==f?(u=f(t?"sandbox.runnableBlockEditor.collapseResult":"sandbox.runnableBlockEditor.expandResult"),e[12]=t,e[13]=f,e[14]=u):u=e[14];let c;e[15]!==t?(c=t?s.jsx(is,{size:14}):s.jsx($s,{size:14}),e[15]=t,e[16]=c):c=e[16];let g;e[17]!==t||e[18]!==a||e[19]!==u||e[20]!==c?(g=s.jsx(fe,{asChild:!0,children:s.jsx(K,{variant:"ghost",size:"icon-sm",onClick:a,"aria-label":u,"aria-pressed":t,children:c})}),e[17]=t,e[18]=a,e[19]=u,e[20]=c,e[21]=g):g=e[21];let j;e[22]!==t||e[23]!==f?(j=f(t?"sandbox.runnableBlockEditor.collapse":"sandbox.runnableBlockEditor.expand"),e[22]=t,e[23]=f,e[24]=j):j=e[24];let v;e[25]!==j?(v=s.jsx(me,{side:"bottom",children:j}),e[25]=j,e[26]=v):v=e[26];let E;e[27]!==v||e[28]!==g?(E=s.jsxs(ue,{children:[g,v]}),e[27]=v,e[28]=g,e[29]=E):E=e[29];let k;e[30]!==f?(k=f("sandbox.runnableBlockEditor.closeResult"),e[30]=f,e[31]=k):k=e[31];let S;e[32]===Symbol.for("react.memo_cache_sentinel")?(S=s.jsx(ye,{size:14}),e[32]=S):S=e[32];let N;e[33]!==i||e[34]!==k?(N=s.jsx(K,{variant:"ghost",size:"icon-sm",onClick:i,"aria-label":k,children:S}),e[33]=i,e[34]=k,e[35]=N):N=e[35];let _;e[36]!==E||e[37]!==N||e[38]!==d?(_=s.jsxs("div",{className:"flex items-center gap-0.5",children:[d,E,N]}),e[36]=E,e[37]=N,e[38]=d,e[39]=_):_=e[39];let w;e[40]!==_||e[41]!==m?(w=s.jsxs("div",{className:"flex h-9 shrink-0 items-center justify-between border-b px-3",children:[m,_]}),e[40]=_,e[41]=m,e[42]=w):w=e[42];let T;e[43]!==n.error||e[44]!==n.hasRun||e[45]!==n.isPending||e[46]!==b||e[47]!==l||e[48]!==f?(T=s.jsx("div",{className:"min-h-0 flex-1",children:n.isPending?s.jsxs("div",{className:"flex h-full items-center justify-center gap-2 text-xs text-muted-foreground",children:[s.jsx(je,{className:"size-4"}),f("sandbox.runnableBlockEditor.running",{singular:l})]}):n.error?s.jsxs("div",{className:"h-full overflow-auto px-4 py-3",children:[s.jsx("p",{className:"text-xs font-medium text-destructive",children:f("sandbox.runnableBlockEditor.failedToRun",{singular:l})}),s.jsx("pre",{className:"mt-1 whitespace-pre-wrap break-words text-xs text-destructive/90",children:n.error.message})]}):n.hasRun?s.jsx(Ie,{language:"json",height:"100%",code:b,readOnly:!0}):s.jsx("div",{className:"flex h-full items-center justify-center text-xs text-muted-foreground",children:f("sandbox.runnableBlockEditor.pressRunToInvoke",{singular:l})})}),e[43]=n.error,e[44]=n.hasRun,e[45]=n.isPending,e[46]=b,e[47]=l,e[48]=f,e[49]=T):T=e[49];let C;return e[50]!==w||e[51]!==T||e[52]!==x?(C=s.jsxs("div",{className:x,children:[w,T]}),e[50]=w,e[51]=T,e[52]=x,e[53]=C):C=e[53],C}function be(o,e,l){const n=l[o];return typeof n?.name=="string"&&n.name||o.replace(/[-_]/g," ").replace(/\b\w/g,t=>t.toUpperCase())||`Section ${e+1}`}function Gt(o,e,l=!1){return o.map((n,t)=>{const a=n.__resolveType??"",r=Se(a);if(!r&&a!==""&&xe(a)&&a in e)return{index:t,resolveType:a,label:be(a,t,e),isLazy:!1,isSavedBlock:!0};const i=r?n.section:void 0,f=r?i?.__resolveType??"":a;if(Te(f,l)){const b=r?i:n,h=Array.isArray(b?.variants)?b.variants:[];if(h.length===1&&He(h[0]?.rule?.__resolveType,l)){const m=he(h[0],l)??{};let d=m.__resolveType??"";const u=Se(d);let c=m;if(u){const g=m.section;d=g?.__resolveType??d,g&&(c=g)}if(Te(d,l)){const g=Array.isArray(c.variants)?c.variants:[],j=he(g[0],l)?.__resolveType,v=j?ce(j):"Section";return{index:t,resolveType:a,label:`Variants of ${v}`,variantOf:v,isHidden:!0,isLazy:u}}return d!==""&&xe(d)&&d in e?{index:t,resolveType:a,label:be(d,t,e),isHidden:!0,isLazy:u,isSavedBlock:!0}:{index:t,resolveType:a,label:ce(d)||`Section ${t+1}`,isHidden:!0,isLazy:u}}const x=he(h[0],l)?.__resolveType,y=x?ce(x):"Section";return{index:t,resolveType:a,label:`Variants of ${y}`,variantOf:y,isMultivariate:!0,isLazy:r}}const p=r?n.section?.__resolveType??a:a;return r&&p!==""&&xe(p)&&p in e?{index:t,resolveType:a,label:be(p,t,e),isLazy:!0,isSavedBlock:!0}:{index:t,resolveType:a,label:ce(p)||`Section ${t+1}`,isLazy:r}})}function qt(o){let e=o.length;for(;e>0&&o[e-1]?.isSavedBlock;)e--;return e>0?e:Math.max(o.length-1,0)}export{Be as B,Mt as P,Wt as R,At as S,nt as a,Ft as b,It as c,Dt as d,et as e,Qs as f,zt as g,Vt as h,Ut as l,Jt as m,qt as n,Gt as p,Kt as r};