@vcp-dev/contracts 0.6.3 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{z as e}from"zod";var lt=["queued","preparing_source","building","artifact_ready","deploying","released","lock_failed","source_prepare_failed","build_failed","artifact_fetch_failed","artifact_validation_failed","deploy_failed","cleanup_failed"];function ur(t){let n=t.VCP_REDIS_URL??t.REDIS_URL;if(n){let s=new URL(n);return{url:n,host:s.hostname,port:s.port?Number(s.port):6379,password:s.password?decodeURIComponent(s.password):void 0}}return{host:t.VCP_REDIS_HOST??"127.0.0.1",port:$n(t.VCP_REDIS_PORT,56379)}}function $n(t,n){if(!t)return n;let s=Number(t);return Number.isInteger(s)&&s>0?s:n}import{z as l}from"zod";var Ae=l.enum(["text","url","document","image"]),Pe=l.enum(["pending","ready","failed"]),Yn=l.enum(["pending","ready","failed"]),Xn=l.enum(["product","price","contact","copy","audience","other"]),le=l.object({fact:l.string().min(1).max(300),kind:Xn,source_id:l.string().min(1),quote:l.string().min(1).max(500),trust:l.enum(["verbatim","ocr"]).default("verbatim")}),Qn=l.object({page_type:l.string().min(1).max(40),sections:l.array(l.string().min(1).max(40)).max(12)}),pe=l.object({source_id:l.string().min(1),nav_structure:l.array(l.string().min(1).max(30)).max(12),page_patterns:l.array(Qn).max(10),tone:l.array(l.string().min(1).max(20)).max(8),screenshot_ref:l.string().optional()}),Zn=l.object({source_id:l.string().min(1),type:Ae,status:Pe,title:l.string().max(120).optional(),original_ref:l.string().min(1),source_metadata:l.record(l.string(),l.unknown()),error_code:l.string().optional(),submitted:l.boolean().optional()}),de=l.object({topic:l.string().min(1).max(80),variants:l.array(l.object({value:l.string().min(1).max(300),source_id:l.string().min(1)})).min(2)}),Jn=l.object({type:l.literal("text"),content:l.string().min(20).max(1e4),title:l.string().min(1).max(120).optional()}).strict(),ei=l.object({type:l.literal("url"),url:l.string().url().max(2048),rights_ack:l.boolean().optional(),title:l.string().min(1).max(120).optional()}).strict(),Sr=l.discriminatedUnion("type",[Jn,ei]),br=[".docx",".html",".md",".txt"],_r=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],yr=10*1024*1024,fr=2,Er=l.object({consent_cross_border:l.union([l.literal(!0),l.literal("true")]),consent_text_version:l.string().min(1).max(120),title:l.string().min(1).max(120).optional()}).strict();function xr(t){return t===!0||t==="true"}var Ir=[".png",".jpg",".jpeg",".webp"],Rr=["image/png","image/jpeg","image/webp","application/octet-stream"],Tr=8*1024*1024,kr=10,ti=l.enum(["asset","reference"]),Ar=l.object({image_role:ti,title:l.string().min(1).max(120).optional()}).strict(),Pr=l.object({version:l.literal(1),site_id:l.string().min(1),tenant_id:l.string().min(1),user_prompt:l.string(),status:Yn,sources:l.array(Zn).max(16),facts:l.array(le).max(120),reference:pe.optional(),conflicts:l.array(de).max(20)}).superRefine((t,n)=>{let s=new Map(t.sources.map(c=>[c.source_id,c]));for(let[c,r]of t.facts.entries()){let m=s.get(r.source_id);(!m||m.type==="url")&&n.addIssue({code:"custom",path:["facts",c,"source_id"],message:"facts must reference a text/document/image source (never url)"})}if(t.reference){let c=s.get(t.reference.source_id),r=c?.type==="image"&&c.source_metadata.image_role==="reference";(!c||c.type!=="url"&&!r)&&n.addIssue({code:"custom",path:["reference","source_id"],message:"reference must point at a url source or reference image source"})}});import{z as u}from"zod";var ni=["design.md","DESIGN.md"],pt=["components/site","src/components/site","lib/generated","src/lib/generated","public"],ii=["app/globals.css","src/app/globals.css"],ai=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],si=new Set(ai),ve="source-delete",dt=u.literal(ve),O=u.string().min(1).refine(gt,"Invalid site edit source path"),oi=u.string().min(1).refine(hi,"Invalid site edit source directory path"),jr=u.enum(["text","binary"]),ue=u.object({path:O,language:u.string().min(1).nullable(),sizeBytes:u.number().int().nonnegative(),contentHash:u.string().min(1).optional()}),ri=u.discriminatedUnion("kind",[ue.extend({kind:u.literal("text"),language:u.string().min(1),readonly:u.boolean().default(!1)}),ue.extend({kind:u.literal("binary"),language:u.null(),mimeType:u.string().min(1).optional(),readonly:u.literal(!0)})]),ut=u.lazy(()=>u.discriminatedUnion("kind",[u.object({kind:u.literal("directory"),name:u.string().min(1),path:oi,children:u.array(ut)}),u.object({kind:u.literal("file"),name:u.string().min(1),path:O,file:ri}).superRefine((t,n)=>{t.path!==t.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),ci=u.enum(["max-files","max-depth","max-total-bytes"]),mi=u.object({reasons:u.array(ci).min(1),maxFiles:u.number().int().positive(),maxDepth:u.number().int().positive(),maxTotalBytes:u.number().int().positive()}),Nr=u.object({nodes:u.array(ut),defaultPath:O.optional(),totalFiles:u.number().int().nonnegative(),truncated:mi.optional()}),li=ue.extend({kind:u.literal("text"),language:u.string().min(1),readonly:u.boolean().default(!1),content:u.string()}),pi=u.enum(["too-large","unsupported-mime","bytes-unavailable"]),di=ue.extend({kind:u.literal("binary"),language:u.null(),readonly:u.literal(!0),mimeType:u.string().min(1),contentBase64:u.string().min(1).optional(),previewUnavailableReason:pi.optional()}),wr=u.discriminatedUnion("kind",[li,di]),ui=u.object({key:u.string().min(1),routeId:u.string().min(1).optional()}),gi=u.object({startLine:u.number().int().positive(),startColumn:u.number().int().nonnegative(),endLine:u.number().int().positive(),endColumn:u.number().int().nonnegative()}),Dr=ui.extend({sourceFile:O,componentName:u.string().min(1),openingElementRange:gi,structuralPath:u.string().min(1),textPreview:u.string().min(1).optional()});function gt(t){return!_t(t)||bt(t)?!1:Ne(t)||St(t)||ht(t)||pt.some(n=>t===n||t.startsWith(`${n}/`))}function Ce(t){return Ne(t)||si.has(Si(t))}function hi(t){return!_t(t)||bt(t)?!1:t==="app"||t.startsWith("app/")||t==="src"||t==="src/app"||t.startsWith("src/app/")||pt.some(n=>t===n||t.startsWith(`${n}/`)||n.startsWith(`${t}/`))}function je(t){return gt(t)?Ne(t)?"design-document":ht(t)?"route-entry":St(t)?"app-global-style":t.toLowerCase()==="lib/generated/media-assets.ts"||t.toLowerCase()==="src/lib/generated/media-assets.ts"?"generated-media-manifest":null:null}function Or(t){return je(t)!==null}function ht(t){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(t.toLowerCase())}function St(t){return ii.some(n=>n.toLowerCase()===t.toLowerCase())}function Si(t){let n=t.split("/").at(-1)??t,s=n.lastIndexOf(".");return s>0?n.slice(s).toLowerCase():""}function Ne(t){return!t.includes("/")&&ni.some(n=>n.toLowerCase()===t.toLowerCase())}function bt(t){let n=t.toLowerCase(),s=n.split("/"),r=(s.at(-1)??n).replace(/\.[^.]+$/,"");return/^(?:src\/)?app\/api(?:\/|$)/.test(n)||/^(?:src\/)?app\/(?:.*\/)?route\.[cm]?[jt]sx?$/.test(n)||/^(?:src\/)?app\/(?:.*\/)?(?:action|actions)\.[cm]?[jt]sx?$/.test(n)||/(^|\/)[^/]+\.server\.[cm]?[jt]sx?$/.test(n)||n==="lib/server"||n.startsWith("lib/server")||n==="src/lib/server"||n.startsWith("src/lib/server")||n==="lib/db"||n.startsWith("lib/db")||n==="src/lib/db"||n.startsWith("src/lib/db")||n==="lib/cms"||n.startsWith("lib/cms/")||n==="src/lib/cms"||n.startsWith("src/lib/cms/")?!0:r==="server"||r==="db"||r==="database"||r==="auth"||r==="secret"||r==="secrets"||r==="token"||r==="tokens"||r==="credential"||r==="credentials"||s.includes("server")||s.includes("secrets")}function _t(t){return!t||t.startsWith("/")||t.includes("\\")?!1:t.split("/").every(n=>!(n.length===0||n==="."||n===".."||n.startsWith(".")||n==="package.json"||n==="node_modules"||n==="recipes"||n.startsWith(".env")))}import{z as bi}from"zod";var yt=["zh-CN","zh-HK","zh-TW","en-US","en-GB","ja-JP","ko-KR","es-ES","fr-FR","de-DE","pt-PT","ru-RU","ar-SA","id-ID","vi-VN","th-TH","it-IT","nl-NL","tr-TR","pl-PL","uk-UA","cs-CZ","sk-SK","hu-HU","ro-RO","el-GR","sv-SE","da-DK","fi-FI","hr-HR","lt-LT","lv-LV","et-EE","ga-IE","mt-MT","ka-GE","fa-IR","bn-BD","ta-IN","si-LK","ms-MY","fil-PH","my-MM","km-KH","lo-LA","mn-MN","kk-KZ"],_i=["en","ja","es","fr","de","ko","pt","pt-BR","it","ru","ar","hi","id","vi","th","tr","nl","pl","uk","sv","da","fi","no","cs","el","hu","ro","he","ms","fil","bn","ta","ca","sk","hr","bg","lt","lv","et","fa","sw","sr","is"],yi=[...yt,..._i],fi=new Set(["ar","fa","he"]),Ur=[{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587",englishName:"Chinese (Simplified)"},{code:"zh-HK",label:"\u7E41\u9AD4\u4E2D\u6587\uFF08\u9999\u6E2F\uFF09",englishName:"Chinese (Traditional, Hong Kong)"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587\uFF08\u53F0\u7063\uFF09",englishName:"Chinese (Traditional, Taiwan)"},{code:"en-US",label:"English (US)",englishName:"English (United States)",common:!0},{code:"en-GB",label:"English (UK)",englishName:"English (United Kingdom)",common:!0},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",englishName:"Japanese"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",englishName:"Korean"},{code:"es-ES",label:"Espa\xF1ol",englishName:"Spanish"},{code:"fr-FR",label:"Fran\xE7ais",englishName:"French"},{code:"de-DE",label:"Deutsch",englishName:"German"},{code:"pt-PT",label:"Portugu\xEAs",englishName:"Portuguese"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",englishName:"Russian"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",englishName:"Arabic"},{code:"id-ID",label:"Bahasa Indonesia",englishName:"Indonesian"},{code:"vi-VN",label:"Ti\u1EBFng Vi\u1EC7t",englishName:"Vietnamese"},{code:"th-TH",label:"\u0E44\u0E17\u0E22",englishName:"Thai"},{code:"it-IT",label:"Italiano",englishName:"Italian"},{code:"nl-NL",label:"Nederlands",englishName:"Dutch"},{code:"tr-TR",label:"T\xFCrk\xE7e",englishName:"Turkish"},{code:"pl-PL",label:"Polski",englishName:"Polish"},{code:"uk-UA",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",englishName:"Ukrainian"},{code:"cs-CZ",label:"\u010Ce\u0161tina",englishName:"Czech"},{code:"sk-SK",label:"Sloven\u010Dina",englishName:"Slovak"},{code:"hu-HU",label:"Magyar",englishName:"Hungarian"},{code:"ro-RO",label:"Rom\xE2n\u0103",englishName:"Romanian"},{code:"el-GR",label:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC",englishName:"Greek"},{code:"sv-SE",label:"Svenska",englishName:"Swedish"},{code:"da-DK",label:"Dansk",englishName:"Danish"},{code:"fi-FI",label:"Suomi",englishName:"Finnish"},{code:"hr-HR",label:"Hrvatski",englishName:"Croatian"},{code:"lt-LT",label:"Lietuvi\u0173",englishName:"Lithuanian"},{code:"lv-LV",label:"Latvie\u0161u",englishName:"Latvian"},{code:"et-EE",label:"Eesti",englishName:"Estonian"},{code:"ga-IE",label:"Gaeilge",englishName:"Irish"},{code:"mt-MT",label:"Malti",englishName:"Maltese"},{code:"ka-GE",label:"\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8",englishName:"Georgian"},{code:"fa-IR",label:"\u0641\u0627\u0631\u0633\u06CC",englishName:"Persian"},{code:"bn-BD",label:"\u09AC\u09BE\u0982\u09B2\u09BE",englishName:"Bengali"},{code:"ta-IN",label:"\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD",englishName:"Tamil"},{code:"si-LK",label:"\u0DC3\u0DD2\u0D82\u0DC4\u0DBD",englishName:"Sinhala"},{code:"ms-MY",label:"Bahasa Melayu",englishName:"Malay"},{code:"fil-PH",label:"Filipino",englishName:"Filipino"},{code:"my-MM",label:"\u1019\u103C\u1014\u103A\u1019\u102C",englishName:"Burmese"},{code:"km-KH",label:"\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A",englishName:"Khmer"},{code:"lo-LA",label:"\u0EA5\u0EB2\u0EA7",englishName:"Lao"},{code:"mn-MN",label:"\u041C\u043E\u043D\u0433\u043E\u043B",englishName:"Mongolian"},{code:"kk-KZ",label:"\u049A\u0430\u0437\u0430\u049B",englishName:"Kazakh"}],Ei={en:"en-US",ja:"ja-JP",es:"es-ES",fr:"fr-FR",de:"de-DE",ko:"ko-KR",pt:"pt-PT",it:"it-IT",ru:"ru-RU",ar:"ar-SA",id:"id-ID",vi:"vi-VN",th:"th-TH",tr:"tr-TR",nl:"nl-NL",pl:"pl-PL",uk:"uk-UA",sv:"sv-SE",da:"da-DK",fi:"fi-FI",cs:"cs-CZ",el:"el-GR",hu:"hu-HU",ro:"ro-RO",ms:"ms-MY",fil:"fil-PH",bn:"bn-BD",ta:"ta-IN",sk:"sk-SK",hr:"hr-HR",lt:"lt-LT",lv:"lv-LV",et:"et-EE",fa:"fa-IR"},xi=new Set(yt);function Kr(t){return xi.has(t)?t:Ei[t]}var Ii="en";function Fr(t){let n=t.toLowerCase().split("-",1)[0]??"";return fi.has(n)?"rtl":"ltr"}var Ri={cmn:"zh-CN",eng:"en",jpn:"ja",spa:"es",fra:"fr",deu:"de",kor:"ko",por:"pt",ita:"it",rus:"ru",arb:"ar",ara:"ar",hin:"hi",ind:"id",vie:"vi",tha:"th",tur:"tr",nld:"nl",pol:"pl",ukr:"uk",swe:"sv",dan:"da",fin:"fi",nob:"no",nor:"no",ces:"cs",ell:"el",hun:"hu",ron:"ro",heb:"he",msa:"ms",zsm:"ms",tgl:"fil",ben:"bn",tam:"ta",cat:"ca",slk:"sk",hrv:"hr",bul:"bg",lit:"lt",lav:"lv",est:"et",pes:"fa",fas:"fa",swh:"sw",swa:"sw",srp:"sr",isl:"is"};function Gr(t){return Ri[t]??Ii}var G=bi.enum(yi);var z="[a-z0-9]+(?:-[a-z0-9]+)*",J=new RegExp(`^/(?:${z}(?:/${z})*)?$`);function Ti(t){return t.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function ft(t){return typeof t=="string"&&J.test(t)}function Et(t){if(typeof t!="string")return null;let n=t.trim();if(/[^\x00-\x7F]/.test(n))return null;let s=n.replace(/^\/+|\/+$/g,"");if(s==="")return"/";let c=s.split("/");if(c.some(p=>p==="."||p===".."))return null;let r=s.toLowerCase();if(r==="index"||r==="home")return"/";let m=c.map(Ti).filter(p=>p.length>0);if(m.length===0)return null;let S=`/${m.join("/")}`;return ft(S)?S:null}function xt(t){let n=Et(t);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function ki(t){let n=xt(t);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as N}from"zod";var he=N.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),Ai=N.enum(["direct","proxy","upstream","readonly","unsupported"]),Pi=N.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),ge=N.object({mode:Ai,reasonCode:N.string().min(1).optional()}),vi=N.object({kind:Pi,message:N.string().min(1)}),Se=N.object({key:N.string().min(1),canUpdateText:N.boolean(),canInsertChild:N.boolean(),canMove:N.boolean(),canRemove:N.boolean(),editModes:N.object({updateText:ge.optional(),insertChild:ge.optional(),move:ge.optional(),remove:ge.optional()}).optional(),constraints:N.array(vi)});import{z as E}from"zod";import{z as M}from"zod";var Ci=M.object({code:M.string().min(1),message:M.string().min(1)}),zr=M.object({code:M.string().min(1),message:M.string().min(1)});function we(t){return M.object({ok:M.literal(!0),data:t})}function ji(t){let n={ok:M.literal(!1),error:Ci.extend({code:t.codeSchema})};return t.currentSchema&&(n.current=t.currentSchema.optional()),t.diagnosticsSchema&&(n.diagnostics=M.array(t.diagnosticsSchema).optional()),t.dataSchema&&(n.data=t.dataSchema.optional()),M.object(n)}function It(t){return M.discriminatedUnion("ok",[we(t.dataSchema),ji({codeSchema:t.codeSchema,currentSchema:t.currentSchema,diagnosticsSchema:t.diagnosticsSchema,dataSchema:t.failureDataSchema})])}var W=E.object({start:E.number().int().nonnegative(),end:E.number().int().nonnegative()}).superRefine((t,n)=>{t.end<t.start&&n.addIssue({code:"custom",path:["end"],message:"end must be greater than or equal to start"})}),Ni=E.object({code:E.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:E.string().min(1)}),Rt=E.object({path:E.string().min(1),content:E.string(),hash:E.string().min(1).optional()}),Qr=E.object({revision:E.string().min(1),entryCss:Rt,stylesheets:E.array(Rt).default([])}),Tt=E.object({key:E.string().min(1),routeId:E.string().min(1),filePath:E.string().min(1),componentName:E.string().min(1),sourceKind:E.enum(["missing","stringLiteral","expression"]),attrRaw:E.string().min(1).nullable(),valueRaw:E.string().min(1).nullable(),attrRange:W.nullable(),openingElementRange:W,version:E.object({documentVersion:E.number().int().nonnegative(),contentHash:E.string().min(1)}),diagnostics:E.array(Ni),computedStyle:E.record(E.string(),E.string()).optional()}).superRefine((t,n)=>{if(t.sourceKind==="missing"){(t.attrRaw!==null||t.valueRaw!==null||t.attrRange!==null)&&n.addIssue({code:"custom",message:"missing className source must not include attr raw or range"});return}(t.attrRaw===null||t.valueRaw===null||t.attrRange===null)&&n.addIssue({code:"custom",message:"present className source must include attr raw and ranges"})}),Zr=Tt,Jr=we(Tt),De=E.object({source:E.enum(["style-panel","class-source-editor"]),operation:E.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as wi}from"zod";var Oe=wi.enum(["src","alt","poster","href","width","height"]);import{z as _}from"zod";import{z as o}from"zod";import{z as v}from"zod";var Di=64,Oi=512*1024,Mi=4*1024*1024,Li=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function Ui(t){return Li.test(t)}var kt=v.string().min(1).refine(Ui,{message:"Materialization pathTemplate must be a safe relative path."}),Ki=v.object({pathTemplate:kt,content:v.string(),role:v.string().min(1).optional()}).strict(),Fi=v.union([v.object({kind:v.literal("default")}).strict(),v.object({kind:v.literal("named"),name:v.string().min(1)}).strict()]),Gi=v.object({pathTemplate:kt,export:Fi}).strict(),Bi=v.array(v.never()).optional(),At=v.object({instanceBaseName:v.string().min(1),files:v.array(Ki).min(1).max(Di),entry:Gi,dataRequirements:Bi}).strict().superRefine((t,n)=>{let s=new Set,c=t.entry.pathTemplate,r=0;for(let[m,S]of t.files.entries()){s.has(S.pathTemplate)&&n.addIssue({code:"custom",path:["files",m,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${S.pathTemplate}`}),s.add(S.pathTemplate);let p=new TextEncoder().encode(S.content).length;p>Oi&&n.addIssue({code:"custom",path:["files",m,"content"],message:"Materialization file content exceeds the per-file byte limit."}),r+=p}s.has(c)||n.addIssue({code:"custom",path:["entry","pathTemplate"],message:"Materialization entry pathTemplate must match a file."}),r>Mi&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});import{z as $}from"zod";var ee=$.object({editingSessionId:$.string().min(1),lockId:$.string().min(1),ownerId:$.string().min(1),leaseAssertion:$.string().min(1)}).strict(),oc="signed-designer-mutations-v1",rc=$.object({mutationContext:ee}).strict();import{z as a}from"zod";import{z as te}from"zod";var be="::",Me=te.object({file:te.string().min(1),component:te.string().min(1),structuralPath:te.string().min(1),key:te.string().min(1)}).superRefine((t,n)=>{let s=qi(t.file,t.component,t.structuralPath);t.key!==s&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function qi(t,n,s){return`${t}${be}${n}${be}${s}`}function lc(t){let[n,s,...c]=t.split(be);return!n||!s||c.length===0?null:{file:n,component:s,structuralPath:c.join(be)}}var _e=a.enum(["VERSION_STALE","RECOVERY_REQUIRED","MULTIPLE_PAGE_RETURNS","INDIRECT_RETURN_ONLY","PAGE_CONTAINER_AMBIGUOUS","NO_SAFE_PAGE_PLACEMENT","MEMBER_NOT_INDEPENDENT","UNSUPPORTED_ROUTE_STRUCTURE","RUNTIME_ANCHOR_UNRESOLVED","ROUTE_RETURN_NOT_FOUND"]),ne=a.object({code:a.string().min(1),message:a.string().min(1)}).strict(),Wi=a.union([a.object({kind:a.literal("virtual-route-root"),key:a.string().min(1)}).strict(),a.object({kind:a.literal("jsx-container"),key:a.string().min(1),sourceMemberKey:a.string().min(1),sourceFile:a.string().min(1),componentName:a.string().min(1).optional()}).strict(),a.object({kind:a.literal("starter-placeholder"),key:a.string().min(1),sourceFile:a.string().min(1).optional()}).strict()]),Hi=a.object({key:a.string().min(1),kind:a.enum(["jsx-element","jsx-fragment","jsx-expression","null-return","starter-placeholder"]),containerKey:a.string().min(1),label:a.string().min(1),sourceFile:a.string().min(1).optional(),isAtomic:a.boolean()}).strict(),Vi=a.object({key:a.string().min(1),sourceMemberKey:a.string().min(1),containerKey:a.string().min(1),label:a.string().min(1),isIndependent:a.boolean()}).strict(),zi=a.object({key:a.string().min(1),containerKey:a.string().min(1),businessMemberKeys:a.array(a.string().min(1)),isMultiMember:a.boolean()}).strict(),Le=a.object({kind:a.literal("page-composition"),placementKey:a.string().min(1),documentVersion:a.number().int().nonnegative()}).strict(),vt=Le.extend({routeId:a.string().min(1),placementUnitKey:a.string().min(1),relation:a.enum(["before","after","prepend","append"])}).strict(),Ct=vt,jt=a.object({kind:a.literal("page-unit"),routeId:a.string().min(1),placementUnitKey:a.string().min(1)}).strict();function F(t,n,s,c,r){let m=new Set;for(let[S,p]of t.entries()){let g=c(p);m.has(g)&&n.addIssue({code:"custom",path:[s,S,r],message:`Duplicate ${s} key: ${g}`}),m.add(g)}}var $i=a.object({status:a.literal("supported"),version:a.number().int().nonnegative(),routeId:a.string().min(1),container:Wi,sourceMembers:a.array(Hi),businessMembers:a.array(Vi),placementUnits:a.array(zi),placements:a.array(vt)}).strict().superRefine((t,n)=>{F(t.sourceMembers,n,"sourceMembers",p=>p.key,"key"),F(t.businessMembers,n,"businessMembers",p=>p.key,"key"),F(t.placementUnits,n,"placementUnits",p=>p.key,"key"),F(t.placements,n,"placements",p=>p.placementKey,"placementKey");let s=new Set(t.sourceMembers.map(p=>p.key)),c=new Set(t.placementUnits.map(p=>p.key)),r=new Map(t.sourceMembers.map(p=>[p.key,p])),m=new Map(t.businessMembers.map(p=>[p.key,p]));for(let[p,g]of t.sourceMembers.entries()){g.containerKey!==t.container.key&&!s.has(g.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",p,"containerKey"],message:"Source member parent must reference the page container or another source member."}),g.containerKey===g.key&&n.addIssue({code:"custom",path:["sourceMembers",p,"containerKey"],message:"Source member cannot contain itself."});let A=new Set([g.key]),d=g.containerKey;for(;d!==t.container.key;){if(A.has(d)){n.addIssue({code:"custom",path:["sourceMembers",p,"containerKey"],message:"Source member hierarchy must be acyclic."});break}A.add(d);let h=r.get(d);if(!h)break;d=h.containerKey}}t.container.kind==="jsx-container"&&!s.has(t.container.sourceMemberKey)&&n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."});for(let[p,g]of t.businessMembers.entries())s.has(g.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",p,"sourceMemberKey"],message:"Business member must reference a source member."}),c.has(g.containerKey)||n.addIssue({code:"custom",path:["businessMembers",p,"containerKey"],message:"Business member must reference a placement unit container."});for(let[p,g]of t.placementUnits.entries()){let A=r.get(g.containerKey);A?A.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",p,"containerKey"],message:"Placement unit must reference a direct child of the page container."}):n.addIssue({code:"custom",path:["placementUnits",p,"containerKey"],message:"Placement unit containerKey must reference a source member."});let d=new Set;for(let[h,C]of g.businessMemberKeys.entries()){let P=m.get(C);if(!P){n.addIssue({code:"custom",path:["placementUnits",p,"businessMemberKeys",h],message:"Placement unit must reference existing business members."});continue}d.has(C)&&n.addIssue({code:"custom",path:["placementUnits",p,"businessMemberKeys",h],message:"Placement unit cannot reference the same business member twice."}),d.add(C),P.containerKey!==g.key&&n.addIssue({code:"custom",path:["placementUnits",p,"businessMemberKeys",h],message:"Business member containerKey must match its placement unit."});let j=P.sourceMemberKey,K=new Set;for(;j&&j!==g.containerKey&&!K.has(j);)K.add(j),j=r.get(j)?.containerKey;j!==g.containerKey&&n.addIssue({code:"custom",path:["placementUnits",p,"businessMemberKeys",h],message:"Placement unit business members must belong to its source subtree."})}}for(let[p,g]of t.businessMembers.entries())t.placementUnits.find(d=>d.key===g.containerKey)?.businessMemberKeys.includes(g.key)||n.addIssue({code:"custom",path:["businessMembers",p,"containerKey"],message:"Business member must be listed by its placement unit container."});let S=new Map;for(let p of t.placementUnits)S.set(p.containerKey,(S.get(p.containerKey)??0)+1);for(let[p,g]of t.sourceMembers.entries())g.containerKey===t.container.key&&S.get(g.key)!==1&&n.addIssue({code:"custom",path:["sourceMembers",p,"key"],message:"Every direct source member must be owned by exactly one placement unit."});for(let[p,g]of t.placements.entries())g.routeId!==t.routeId&&n.addIssue({code:"custom",path:["placements",p,"routeId"],message:"Page placement routeId must match page composition routeId."}),g.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",p,"documentVersion"],message:"Page placement version must match page composition version."}),c.has(g.placementUnitKey)||n.addIssue({code:"custom",path:["placements",p,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),Yi=a.object({status:a.literal("unsupported"),version:a.number().int().nonnegative(),routeId:a.string().min(1),reason:_e,diagnostics:a.array(ne)}).strict(),Xi=a.discriminatedUnion("status",[$i,Yi]),Nt=2,gc="page-composition-v2",wt=a.object({start:a.number().int().nonnegative(),end:a.number().int().nonnegative(),startLine:a.number().int().positive().optional(),startColumn:a.number().int().nonnegative().optional(),endLine:a.number().int().positive().optional(),endColumn:a.number().int().nonnegative().optional()}).strict().superRefine((t,n)=>{t.end<t.start&&n.addIssue({code:"custom",path:["end"],message:"Source range end must be greater than or equal to start."});let s=[t.startLine,t.startColumn,t.endLine,t.endColumn],c=s.some(m=>m!==void 0),r=s.every(m=>m!==void 0);c&&!r&&n.addIssue({code:"custom",path:["startLine"],message:"Source line and column locations must be provided together."}),t.startLine!==void 0&&t.endLine!==void 0&&t.endLine<t.startLine&&n.addIssue({code:"custom",path:["endLine"],message:"Source range endLine must not precede startLine."}),t.startLine!==void 0&&t.endLine===t.startLine&&t.startColumn!==void 0&&t.endColumn!==void 0&&t.endColumn<t.startColumn&&n.addIssue({code:"custom",path:["endColumn"],message:"Source range endColumn must not precede startColumn."})}),Qi=a.object({key:a.string().min(1),instanceIndex:a.number().int().nonnegative().optional(),instanceCount:a.number().int().positive().optional(),textSegmentIndex:a.number().int().nonnegative().optional()}).strict().superRefine((t,n)=>{t.instanceIndex!==void 0&&t.instanceCount!==void 0&&t.instanceIndex>=t.instanceCount&&n.addIssue({code:"custom",path:["instanceIndex"],message:"instanceIndex must be lower than instanceCount."})}),Zi=a.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),Ji=a.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),ea=a.discriminatedUnion("kind",[a.object({kind:a.literal("virtual-route-root"),key:a.null(),routeReturn:a.object({sourceIdentity:Me,sourceRange:wt}).strict()}).strict(),a.object({kind:a.literal("jsx-container"),key:a.string().min(1),sourceMemberKey:a.string().min(1)}).strict(),a.object({kind:a.literal("starter-placeholder"),key:a.string().min(1),sourceMemberKey:a.string().min(1),replacementMode:a.literal("replace")}).strict()]),ta=a.object({key:a.string().min(1),kind:Zi,parentKey:a.string().min(1).nullable(),childKeys:a.array(a.string().min(1)),order:a.number().int().nonnegative(),label:a.string().min(1),sourceIdentity:Me,sourceRange:wt.nullable(),atomicKind:Ji}).strict().superRefine((t,n)=>{let s=t.kind==="component-call"||t.kind==="native-jsx"?"none":t.kind;t.atomicKind!==s&&n.addIssue({code:"custom",path:["atomicKind"],message:`atomicKind must be ${s} for ${t.kind}.`});let c=new Set;for(let[r,m]of t.childKeys.entries())c.has(m)&&n.addIssue({code:"custom",path:["childKeys",r],message:`Duplicate child source member key: ${m}`}),c.add(m)}),na=a.object({key:a.string().min(1),sourceMemberKey:a.string().min(1),placementUnitKey:a.string().min(1),label:a.string().min(1),isIndependent:a.boolean()}).strict(),ia=a.enum(["independent","atomic","container"]),aa=a.object({key:a.string().min(1),containerKey:a.string().min(1).nullable(),sourceMemberKeys:a.array(a.string().min(1)).min(1),businessMemberKeys:a.array(a.string().min(1)),order:a.number().int().nonnegative(),boundaryMode:ia,isIndependent:a.boolean(),isMultiMember:a.boolean()}).strict().superRefine((t,n)=>{Pt(t.sourceMemberKeys,n,"sourceMemberKeys","source member"),Pt(t.businessMemberKeys,n,"businessMemberKeys","business member");let s=t.sourceMemberKeys.length>1||t.businessMemberKeys.length>1;t.isMultiMember!==s&&n.addIssue({code:"custom",path:["isMultiMember"],message:"isMultiMember must reflect the source and business member cardinality."});let c=t.boundaryMode==="independent";t.isIndependent!==c&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),sa=a.enum(["before","after","prepend","append","replace"]),oa=a.enum(["insert-sibling","insert-child","replace-placeholder"]),ra=a.object({kind:a.literal("page-composition"),placementKey:a.string().min(1),documentVersion:a.number().int().nonnegative(),routeId:a.string().min(1),placementUnitKey:a.string().min(1),containerKey:a.string().min(1).nullable(),relation:sa,writeMode:oa}).strict().superRefine((t,n)=>{let s=t.relation==="before"||t.relation==="after"?"insert-sibling":t.relation==="prepend"||t.relation==="append"?"insert-child":"replace-placeholder";t.writeMode!==s&&n.addIssue({code:"custom",path:["writeMode"],message:`writeMode must be ${s} for ${t.relation}.`})}),ca=a.object({key:a.string().min(1),placementUnitKey:a.string().min(1),runtimeRefs:a.array(Qi).min(1)}).strict(),ma=a.object({schemaVersion:a.literal(Nt),status:a.literal("supported"),version:a.number().int().nonnegative(),routeId:a.string().min(1),container:ea,sourceMembers:a.array(ta),businessMembers:a.array(na),placementUnits:a.array(aa),placements:a.array(ra),visualAnchors:a.array(ca).optional(),diagnostics:a.array(ne)}).strict().superRefine((t,n)=>{da(t,n)}),la=a.object({schemaVersion:a.literal(Nt),status:a.literal("unsupported"),version:a.number().int().nonnegative(),routeId:a.string().min(1),reason:_e,diagnostics:a.array(ne)}).strict(),pa=a.discriminatedUnion("status",[ma,la]),hc=a.union([pa,Xi]);function Pt(t,n,s,c){let r=new Set;for(let[m,S]of t.entries())r.has(S)&&n.addIssue({code:"custom",path:[s,m],message:`Duplicate ${c} key: ${S}`}),r.add(S)}function da(t,n){F(t.sourceMembers,n,"sourceMembers",d=>d.key,"key"),F(t.businessMembers,n,"businessMembers",d=>d.key,"key"),F(t.placementUnits,n,"placementUnits",d=>d.key,"key"),F(t.placements,n,"placements",d=>d.placementKey,"placementKey"),F(t.visualAnchors??[],n,"visualAnchors",d=>d.key,"key"),ua(t,n);let s=new Map(t.sourceMembers.map(d=>[d.key,d])),c=new Map(t.businessMembers.map(d=>[d.key,d])),r=new Map(t.placementUnits.map(d=>[d.key,d]));ga(t,s,n),t.container.kind!=="virtual-route-root"&&(s.has(t.container.sourceMemberKey)||n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."}));let m=new Map,S=new Map,p=new Set;for(let[d,h]of t.placementUnits.entries()){h.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",d,"containerKey"],message:"Placement unit containerKey must match the page container."});let C=`${h.containerKey??"<virtual>"}:${h.order}`;p.has(C)&&n.addIssue({code:"custom",path:["placementUnits",d,"order"],message:"Placement unit order must be unique within its container."}),p.add(C);for(let[P,j]of h.sourceMemberKeys.entries()){s.has(j)||n.addIssue({code:"custom",path:["placementUnits",d,"sourceMemberKeys",P],message:"Placement unit must reference existing source members."});let K=m.get(j);K&&K!==h.key&&n.addIssue({code:"custom",path:["placementUnits",d,"sourceMemberKeys",P],message:`Source member is already assigned to ${K}.`}),m.set(j,h.key)}for(let[P,j]of h.businessMemberKeys.entries()){let K=c.get(j);if(!K){n.addIssue({code:"custom",path:["placementUnits",d,"businessMemberKeys",P],message:"Placement unit must reference existing business members."});continue}K.placementUnitKey!==h.key&&n.addIssue({code:"custom",path:["placementUnits",d,"businessMemberKeys",P],message:"Placement unit and business member must reference each other."}),h.sourceMemberKeys.includes(K.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",d,"businessMemberKeys",P],message:"Business member sourceMemberKey must belong to the placement unit."});let ke=S.get(j);ke&&ke!==h.key&&n.addIssue({code:"custom",path:["placementUnits",d,"businessMemberKeys",P],message:`Business member is already assigned to ${ke}.`}),S.set(j,h.key)}}for(let[d,h]of t.businessMembers.entries()){s.has(h.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",d,"sourceMemberKey"],message:"Business member must reference a source member."});let C=r.get(h.placementUnitKey);if(!C){n.addIssue({code:"custom",path:["businessMembers",d,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}C.businessMemberKeys.includes(h.key)||n.addIssue({code:"custom",path:["businessMembers",d,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),C.sourceMemberKeys.includes(h.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",d,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let P=C.isIndependent&&C.businessMemberKeys.length===1;h.isIndependent!==P&&n.addIssue({code:"custom",path:["businessMembers",d,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let g=new Set;for(let[d,h]of t.placements.entries()){h.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",d,"documentVersion"],message:"Page placement version must match page composition version."}),h.routeId!==t.routeId&&n.addIssue({code:"custom",path:["placements",d,"routeId"],message:"Page placement routeId must match page composition routeId."});let C=r.get(h.placementUnitKey);C?h.containerKey!==C.containerKey&&n.addIssue({code:"custom",path:["placements",d,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",d,"placementUnitKey"],message:"Placement option must reference a placement unit."});let P=`${h.placementUnitKey}:${h.relation}`;g.has(P)&&n.addIssue({code:"custom",path:["placements",d,"relation"],message:"A placement unit cannot expose the same relation more than once."}),g.add(P),h.relation==="replace"&&t.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",d,"relation"],message:"replace is only valid for a starter placeholder container."}),t.container.kind==="starter-placeholder"&&h.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",d,"relation"],message:"Starter placeholder placements must use replace."})}let A=new Set;for(let[d,h]of(t.visualAnchors??[]).entries())r.has(h.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",d,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),A.has(h.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",d,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),A.add(h.placementUnitKey)}function ua(t,n){let s=[];t.container.key!==null&&s.push({key:t.container.key,path:["container","key"],namespace:"container"});for(let[r,m]of t.sourceMembers.entries())s.push({key:m.key,path:["sourceMembers",r,"key"],namespace:"source member"});for(let[r,m]of t.businessMembers.entries())s.push({key:m.key,path:["businessMembers",r,"key"],namespace:"business member"});for(let[r,m]of t.placementUnits.entries())s.push({key:m.key,path:["placementUnits",r,"key"],namespace:"placement unit"});for(let[r,m]of(t.visualAnchors??[]).entries())s.push({key:m.key,path:["visualAnchors",r,"key"],namespace:"visual anchor"});let c=new Map;for(let r of s){let m=c.get(r.key);m?n.addIssue({code:"custom",path:r.path,message:`${r.namespace} key collides with ${m}: ${r.key}`}):c.set(r.key,r.namespace)}}function ga(t,n,s){let c=new Set;for(let[r,m]of t.sourceMembers.entries()){let S=`${m.parentKey??"<root>"}:${m.order}`;if(c.has(S)&&s.addIssue({code:"custom",path:["sourceMembers",r,"order"],message:"Source member order must be unique among siblings."}),c.add(S),m.parentKey===m.key&&s.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member cannot be its own parent."}),m.parentKey!==null){let A=n.get(m.parentKey);A?A.childKeys.includes(m.key)||s.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[A,d]of m.childKeys.entries()){if(d===m.key){s.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",A],message:"Source member cannot be its own child."});continue}let h=n.get(d);h?h.parentKey!==m.key&&s.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",A],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",A],message:"Source child key must reference a source member."})}let p=new Set,g=m;for(;g;){if(p.has(g.key)){s.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member graph must be acyclic."});break}p.add(g.key),g=g.parentKey===null?void 0:n.get(g.parentKey)}}}var ie=o.enum(["update-text","update-array-item","remove-node","insert-child","move-node","set-class-name-source","set-props","apply-style-draft","source-edit"]),Dt=o.lazy(()=>o.union([o.string(),o.number(),o.boolean(),o.null(),o.array(Dt),o.record(o.string(),Dt)])),Mt=o.discriminatedUnion("kind",[o.object({kind:o.literal("node"),key:o.string().min(1)}),jt,o.object({kind:o.literal("route"),routeId:o.string().min(1)}),o.object({kind:o.literal("source-file"),path:O}),o.object({kind:o.literal("source-batch"),paths:o.array(O).min(1)}).superRefine((t,n)=>{let s=new Set;for(let[c,r]of t.paths.entries())s.has(r)&&n.addIssue({code:"custom",path:["paths",c],message:`Duplicate source target path: ${r}`}),s.add(r)})]),Lt=o.enum(["display","position","top","right","bottom","left","zIndex","flexDirection","flexWrap","flexGrow","flexShrink","flexBasis","order","gridTemplateColumns","gridTemplateRows","columns","gridColumn","gridRow","gap","gapX","gapY","spaceX","spaceY","alignItems","justifyContent","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","width","height","minWidth","minHeight","maxWidth","maxHeight","overflow","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","textAlign","textTransform","textDecoration","textOverflow","textIndent","writingMode","whiteSpace","wordBreak","lineClamp","fontVariantNumeric","screenReaderOnly","color","backgroundColor","backgroundImage","backgroundRepeat","backgroundSize","backgroundPosition","backgroundAttachment","backgroundClip","backgroundOrigin","borderStyle","borderWidth","borderRadius","borderColor","objectFit","objectPosition","aspectRatio","opacity","boxShadow","transform","transformOrigin","transitionProperty","transitionDuration","transitionTimingFunction","animation","pointerEvents","cursor","userSelect","fontStyle","textUnderlineOffset","scrollMarginTop","alignSelf","flex","outlineStyle","resize","ringWidth","ringColor","backdropFilter","overscrollBehavior","divideWidth","divideColor"]),Ut=o.enum(["hover","active","focus","disabled"]),Kt=o.enum(["sm","md","lg","xl","2xl"]),Ot=o.union([o.object({relation:o.enum(["before","after"]),anchorKey:o.string().min(1)}),o.object({relation:o.enum(["prepend","append"]),parentKey:o.string().min(1)}),Ct]),ha=o.union([o.object({kind:o.literal("native-tag"),tag:o.string().min(1),text:o.string().optional()}),o.object({kind:o.literal("component-call"),component:o.object({source:o.string().min(1),exportName:o.string().min(1)}),materialization:o.never().optional(),props:o.record(o.string(),o.unknown()).optional()}).strict(),o.object({kind:o.literal("component-call"),component:o.never().optional(),materialization:At,props:o.record(o.string(),o.never()).optional()}).strict()]),Sa=o.discriminatedUnion("kind",[o.object({kind:o.literal("update-text"),segmentIndex:o.number().int().min(0),value:o.string()}),o.object({kind:o.literal("update-array-item"),segmentIndex:o.number().int().min(0),index:o.number().int().min(0),value:o.string()}),o.object({kind:o.literal("remove-node")}),o.object({kind:o.literal("insert-child"),node:ha,position:o.union([Ot,Le])}),o.object({kind:o.literal("move-node"),target:Ot,preserveBindings:o.boolean().optional()}),o.object({kind:o.literal("set-class-name-source"),routeId:o.string().min(1).optional(),filePath:o.string().min(1),expectedVersion:o.object({documentVersion:o.number().int().nonnegative(),contentHash:o.string().min(1)}),oldAttrRaw:o.string().min(1).nullable(),oldAttrRange:W.nullable(),openingElementRange:W,newAttrRaw:o.string().min(1).nullable(),intent:De}),o.object({kind:o.literal("set-props"),props:o.partialRecord(Oe,o.string())}),o.object({kind:o.literal("apply-style-draft"),className:o.object({routeId:o.string().min(1).optional(),filePath:o.string().min(1),expectedVersion:o.object({documentVersion:o.number().int().nonnegative(),contentHash:o.string().min(1)}),oldAttrRaw:o.string().min(1).nullable(),oldAttrRange:W.nullable(),openingElementRange:W,newAttrRaw:o.string().min(1).nullable(),intent:De}).optional(),props:o.partialRecord(Oe,o.string()).optional()}).superRefine((t,n)=>{!t.className&&!t.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),o.object({kind:o.literal("source-edit"),conflictPolicy:o.enum(["compare-and-swap","overwrite"]),edits:o.array(o.discriminatedUnion("operation",[o.object({operation:o.literal("upsert"),path:O,content:o.string(),baseContentHash:o.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{Ce(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit upsert only accepts allowlisted text source files"}),t.content.includes("\0")&&n.addIssue({code:"custom",path:["content"],message:"source-edit content must be valid text"})}),o.object({operation:o.literal("delete"),path:O,capability:dt,confirmDelete:o.literal(!0),confirmPath:O,baseContentHash:o.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{t.capability!==ve&&n.addIssue({code:"custom",path:["capability"],message:"delete requires source-delete capability"}),t.confirmPath!==t.path&&n.addIssue({code:"custom",path:["confirmPath"],message:"delete confirmation path must match edit path"}),Ce(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let s=je(t.path);s&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${t.path} (${s})`})})])).min(1),reason:o.string().min(1).optional()}).strict().superRefine((t,n)=>{let s=new Set;for(let[c,r]of t.edits.entries())s.has(r.path)&&n.addIssue({code:"custom",path:["edits",c,"path"],message:`Duplicate source edit path: ${r.path}`}),s.add(r.path),t.conflictPolicy==="compare-and-swap"&&r.baseContentHash===void 0&&n.addIssue({code:"custom",path:["edits",c,"baseContentHash"],message:"source-edit compare-and-swap requires baseContentHash for every edit"})})]),Ft=o.enum(["NODE_NOT_FOUND","ROUTE_NOT_FOUND","CAPABILITY_REJECTED","CONSTRAINT_VIOLATED","INVALID_PARAMS","PLAN_FAILED","TRANSACTION_PREFLIGHT_FAILED","ROUTE_REBUILD_FAILED","HISTORY_COMMIT_FAILED","MATERIALIZATION_CONFLICT","MATERIALIZATION_REJECTED","MUTATION_ASSERTION_REQUIRED","MUTATION_ASSERTION_INVALID","VERSION_STALE","AST_PARSE_ERROR","UNSUPPORTED_OPERATION","LOCATOR_FAILED","INVALID_TARGET","WRITE_IO_ERROR","CONCURRENT_MODIFIED","ROLLBACK_FAILED","RECOVERY_REQUIRED","RECOVERY_PERSIST_FAILED","MUTATION_SESSION_REQUIRED","LEASE_ASSERTION_INVALID","LEASE_ASSERTION_EXPIRED","LEASE_ASSERTION_SCOPE_MISMATCH","CROSS_PAGE_MOVE_UNSUPPORTED","INTERNAL_ERROR"]),Gt=o.object({code:Ft,message:o.string().min(1),details:o.record(o.string(),o.unknown()).optional()}),Bt=o.object({key:o.string().min(1),instanceIndex:o.number().int().nonnegative().optional(),instanceCount:o.number().int().positive().optional()}),ba=o.object({id:o.string().min(1),siteId:o.string().min(1),baseSnapshotId:o.string().min(1),routeId:o.string().min(1).optional(),kind:ie,target:Mt,documentVersion:o.number().int().nonnegative(),selectionRef:Bt.optional(),mutationContext:ee.optional(),params:Sa}).superRefine((t,n)=>{if(t.kind!==t.params.kind&&n.addIssue({code:"custom",path:["params","kind"],message:"params.kind must match operation kind"}),t.kind==="source-edit"){if(t.target.kind!=="source-file"&&t.target.kind!=="source-batch")n.addIssue({code:"custom",path:["target","kind"],message:"source-edit requires a source-file or source-batch target"});else if(t.params.kind==="source-edit"){let s=t.params.edits.map(r=>r.path),c=t.target.kind==="source-file"?[t.target.path]:t.target.paths;_a(s,c)||n.addIssue({code:"custom",path:["target"],message:"source-edit target paths must match edit paths"})}}else(t.target.kind==="source-file"||t.target.kind==="source-batch")&&n.addIssue({code:"custom",path:["target","kind"],message:"source targets are only valid for source-edit"});t.target.kind==="page-unit"&&(t.kind!=="insert-child"&&t.kind!=="move-node"&&t.kind!=="remove-node"&&n.addIssue({code:"custom",path:["target","kind"],message:"page-unit target is only valid for page-level operations"}),t.kind==="move-node"&&t.params.kind==="move-node"&&(!("kind"in t.params.target)||t.params.target.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","target","kind"],message:"page-unit move-node target requires page-composition placement"})),t.params.kind==="insert-child"&&"kind"in t.params.position&&t.params.position.kind==="page-composition"&&t.target.kind!=="page-unit"&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-composition position requires page-unit target"}),t.kind==="insert-child"&&t.target.kind==="page-unit"&&t.params.kind==="insert-child"&&(!("kind"in t.params.position)||t.params.position.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-unit target requires page-composition position"})}),Tc=ba,ye=o.object({requestId:o.string().min(1),kind:ie,target:Mt,resultVersion:o.number().int().nonnegative(),affectedFiles:o.array(o.string().min(1)).optional(),selectionRef:Bt.optional()}),kc=It({dataSchema:ye,codeSchema:Ft,failureDataSchema:ye.partial()});function _a(t,n){return t.length===n.length&&t.every((s,c)=>s===n[c])}var jc=_.discriminatedUnion("type",[_.object({type:_.literal("site-edit.document.changed"),siteId:_.string().min(1),snapshotId:_.string().min(1),routeId:_.string().min(1),version:_.number().int().nonnegative(),at:_.string().min(1)}),_.object({type:_.literal("site-edit.operation.planned"),siteId:_.string().min(1),operationId:_.string().min(1),baseSnapshotId:_.string().min(1),changedFiles:_.array(_.string().min(1)),at:_.string().min(1)}),_.object({type:_.literal("site-edit.operation.completed"),siteId:_.string().min(1),result:ye,at:_.string().min(1)}),_.object({type:_.literal("site-edit.operation.failed"),siteId:_.string().min(1),requestId:_.string().min(1),error:Gt,at:_.string().min(1)}),_.object({type:_.literal("site-edit.capability.changed"),siteId:_.string().min(1),routeId:_.string().min(1),keys:_.array(_.string().min(1)),at:_.string().min(1)})]);import{z as I}from"zod";var Dc="durable-history-v1",Oc=I.enum(["writable","read-only-recovery","unavailable"]),ya=I.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),fa=I.object({code:ya,message:I.string().min(1),occurredAt:I.iso.datetime().optional()}).strict(),Ea=I.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),qt={revision:I.number().int().nonnegative(),undoDepth:I.number().int().nonnegative(),redoDepth:I.number().int().nonnegative()},xa=I.object({mode:I.literal("writable"),...qt,canUndo:I.boolean(),canRedo:I.boolean()}).strict().superRefine((t,n)=>{t.canUndo!==t.undoDepth>0&&n.addIssue({code:"custom",path:["canUndo"],message:"canUndo must reflect undoDepth."}),t.canRedo!==t.redoDepth>0&&n.addIssue({code:"custom",path:["canRedo"],message:"canRedo must reflect redoDepth."})}),Ia=I.object({mode:I.literal("read-only-recovery"),...qt,canUndo:I.literal(!1),canRedo:I.literal(!1),recoveryDiagnostic:fa}).strict(),Ra=I.object({mode:I.literal("unavailable"),revision:I.literal(0),undoDepth:I.literal(0),redoDepth:I.literal(0),canUndo:I.literal(!1),canRedo:I.literal(!1),reason:Ea}).strict(),Mc=I.discriminatedUnion("mode",[xa,Ia,Ra]);import{z as T}from"zod";var Ta=T.string().min(1).refine(t=>!t.startsWith("/")&&!t.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),ka=T.string().regex(/^sha256:[a-f0-9]{64}$/),Aa=T.object({path:Ta,operation:T.enum(["create","update","delete"]),expectedHash:ka.optional(),fullContent:T.string().optional()}).superRefine((t,n)=>{t.operation==="delete"&&t.fullContent!==void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"delete patches must not include fullContent"}),t.operation!=="delete"&&t.fullContent===void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"create/update patches must include fullContent"})}),Kc=T.object({siteId:T.string().min(1),baseSnapshotId:T.string().min(1),operationId:T.string().min(1),reason:T.string().min(1),patches:T.array(Aa).min(1),changedRouteIds:T.array(T.string().min(1)),diagnostics:T.array(T.object({code:T.string().min(1),message:T.string().min(1),path:T.string().min(1).optional()})).default([])}).superRefine((t,n)=>{let s=new Set;for(let[c,r]of t.patches.entries())s.has(r.path)&&n.addIssue({code:"custom",path:["patches",c,"path"],message:`Duplicate patch path: ${r.path}`}),s.add(r.path)});var Ue="::repeat-item#";function Pa(t,n){return`${t}${Ue}${n}`}function Gc(t,n){return n.reduce((s,c)=>Pa(s,c),t)}function va(t){if(typeof t!="string"||t.length===0)return null;let n=[],s=t;for(;;){let c=s.lastIndexOf(Ue);if(c<0)break;let r=Number(s.slice(c+Ue.length));if(!Number.isInteger(r)||r<0)return null;n.unshift({repeatIndex:r}),s=s.slice(0,c)}return!s||n.length===0?null:{baseKey:s,parts:n}}function Bc(t){return va(t)?.baseKey??t??null}import{z as i}from"zod";import{z as w}from"zod";var Ca=w.object({placementKey:w.string().min(1),placementUnitKey:w.string().min(1),relation:w.enum(["before","after","prepend","append"])}).strict(),ja=w.object({status:w.literal("supported"),containerKey:w.string().min(1),hasBusinessMembers:w.boolean(),placementUnitKeys:w.array(w.string().min(1)),placements:w.array(Ca)}).strict().superRefine((t,n)=>{let s=new Set(t.placementUnitKeys);s.size!==t.placementUnitKeys.length&&n.addIssue({code:"custom",path:["placementUnitKeys"],message:"Render page composition placement unit keys must be unique."});let c=new Set;t.placements.forEach((r,m)=>{c.has(r.placementKey)&&n.addIssue({code:"custom",path:["placements",m,"placementKey"],message:"Render page composition placement keys must be unique."}),c.add(r.placementKey),s.has(r.placementUnitKey)||n.addIssue({code:"custom",path:["placements",m,"placementUnitKey"],message:"Render page composition placement must reference a projected unit."})})}),Na=w.object({status:w.literal("unsupported"),reason:_e,diagnostics:w.array(ne)}).strict(),Wt=w.discriminatedUnion("status",[ja,Na]);var wa=i.object({canUpdateText:i.boolean(),canInsertChild:i.boolean(),canMove:i.boolean(),canRemove:i.boolean()}),Ht=i.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),Da=i.enum(["cms-field","api-field"]),Oa=i.enum(["text","attribute","richtext","repeat-region","component-prop"]),Ma=i.enum(["exact","safe-derived","partial","unknown"]),La=i.object({file:i.string().min(1),symbol:i.string().min(1).optional(),reason:i.string().min(1)}),Ua=i.object({sourceKind:Ht,sourceType:Da,endpointPattern:i.string().min(1).optional(),operation:i.string().min(1).optional(),collection:i.string().min(1).optional(),fieldPath:i.string().min(1).optional(),valuePath:i.string().min(1).optional(),targetKind:Oa,targetName:i.string().min(1),confidence:Ma,readonly:i.literal(!0),evidence:i.array(La)}),Vt=i.object({hasDynamicData:i.boolean(),bindings:i.array(Ua)}),zt=i.object({hasDynamicData:i.boolean(),sourceKinds:i.array(Ht),primaryEndpoint:i.string().min(1).optional(),primaryCollection:i.string().min(1).optional(),primaryFieldPath:i.string().min(1).optional()}),Ka=i.object({key:i.string().min(1),pageCompositionUnitKey:i.string().min(1).optional(),operationSummary:wa,dynamicDataSummary:zt.optional()}).strict(),tm=i.object({siteId:i.string().min(1),snapshotId:i.string().min(1),routeId:i.string().min(1),version:i.number().int().nonnegative(),entries:i.array(Ka),pageComposition:Wt}).strict(),Ke=i.enum(["api-field","cms-field","i18n-message","config-entry"]),$t=i.object({kind:i.enum(["literal","binding","imported-binding","repeat-template"]),file:i.string().min(1),expression:i.string().min(1),bindingName:i.string().min(1).optional(),path:i.array(i.union([i.string(),i.number()])).optional()}),Fe=i.object({index:i.number().int().min(0),value:i.string(),editable:i.boolean(),source:$t.nullable()}),ae=i.object({key:i.string().min(1),label:i.string().min(1),tag:i.string().min(1)}),nm=i.object({key:i.string().min(1),canUpdateText:i.boolean(),canInsertChild:i.boolean(),canMove:i.boolean(),canRemove:i.boolean(),boundaryKind:he.nullable(),isOpaque:i.boolean()}),Fa=i.object({kind:i.enum(["jsx-node","component-proxy","value-binding","route-export"]),file:i.string().min(1),componentName:i.string().min(1),isProxy:i.boolean()}),Ga=i.object({kind:i.enum(["jsx-node","value-path","route-export","external-entry"]),file:i.string().min(1).optional(),isProxy:i.boolean(),displayPath:i.string().min(1).optional(),sourceType:Ke.optional(),sourceId:i.string().min(1).optional()}),Yt=i.object({kind:i.union([i.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),Ke]),file:i.string().min(1),displayPath:i.string().min(1),externalSource:i.object({sourceType:Ke,sourceId:i.string().min(1),adapterId:i.string().min(1).optional()}).optional()}),Ba=i.object({kind:Yt.shape.kind,file:i.string().min(1),displayName:i.string().min(1),canEditHere:i.boolean()}),se=i.object({finalSource:Yt.nullable(),chain:i.array(Ba),confidence:i.enum(["exact","safe-derived","partial","unknown"]),editMode:i.enum(["direct","proxy","upstream","readonly","unsupported"]),diagnostics:i.array(i.object({code:i.string().min(1),message:i.string().min(1)}))}),qa=i.object({kind:i.literal("css-style-model"),properties:i.array(i.object({property:Lt,value:i.union([i.string(),i.number(),i.boolean(),i.null()]),resolvedValue:i.union([i.string(),i.number(),i.boolean(),i.null()]).optional(),breakpoint:Kt.optional(),state:Ut.optional(),variants:i.array(i.string().min(1)).optional(),options:i.array(i.union([i.string(),i.number()])).optional(),editable:i.boolean(),diagnostics:i.array(i.object({code:i.string().min(1),message:i.string().min(1)})).optional(),operationBoundary:i.array(ie).optional()}))}),im=i.union([i.record(i.string(),i.unknown()),qa]),Xt=i.object({kind:i.literal("class-name-source"),className:i.string(),sourceKind:i.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:i.boolean(),operationBoundary:i.array(ie),sourcePath:i.string().min(1).optional(),diagnostics:i.array(i.object({code:i.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:i.string().min(1)})).optional()}),Wa=i.object({startLine:i.number().int().positive(),startColumn:i.number().int().nonnegative(),endLine:i.number().int().positive(),endColumn:i.number().int().nonnegative()}),Ge=i.object({sourceFile:i.string().min(1),componentName:i.string().min(1),openingElementRange:Wa,structuralPath:i.string().min(1),textPreview:i.string().min(1).optional()}),am=i.object({key:i.string().min(1),tag:i.string().min(1),componentName:i.string().min(1),sourceFile:i.string().min(1),sourceLocator:Ge.optional(),label:i.string().min(1),capabilities:Se,writeTarget:Fa,effectiveWriteTarget:Ga.optional(),provenanceChain:se.optional(),componentSemantic:i.record(i.string(),i.unknown()).optional(),contentModel:i.record(i.string(),i.unknown()).optional(),mediaModel:i.record(i.string(),i.unknown()).optional(),styleSource:Xt.optional(),conditional:i.record(i.string(),i.unknown()).optional(),dynamicData:Vt.optional(),textSegments:i.array(Fe),boundaryKind:he.nullable(),isOpaque:i.boolean(),ancestors:i.array(ae),children:i.array(ae),siblings:i.array(ae)}),sm=i.object({key:i.string().min(1),tag:i.string().min(1),label:i.string().min(1),sourceLocator:Ge.optional(),capabilities:i.object({constraints:Se.shape.constraints}),isOpaque:i.boolean(),provenanceChain:i.object({editMode:se.shape.editMode,diagnostics:se.shape.diagnostics}).optional(),dynamicDataSummary:zt.optional(),ancestors:i.array(ae)}),om=i.object({key:i.string().min(1),tag:i.string().min(1),label:i.string().min(1),sourceLocator:Ge.optional(),isOpaque:i.boolean(),ancestors:i.array(ae),componentName:i.string().min(1),sourceFile:i.string().min(1),capabilities:Se,provenanceChain:i.object({editMode:se.shape.editMode,diagnostics:se.shape.diagnostics}).optional(),textSegments:i.array(i.object({index:Fe.shape.index,editable:Fe.shape.editable,sourceKind:$t.shape.kind.nullable()})),dynamicData:Vt.optional(),boundaryKind:he.nullable()}),rm=i.object({key:i.string().min(1),mediaModel:i.record(i.string(),i.unknown()).optional(),styleSource:Xt.optional()});var Ha=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Va=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],za=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],$a=new Set(Ha),Ya=new Set(Va),Xa=new Set(za),Qa={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function mm(t){return $a.has(Be(t))}function Za(t){return Ya.has(Be(t))}function Ja(t){return Xa.has(Be(t))}function lm(t){let{operationSummary:n}=t;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:t.fallbackMode!=="preview"?{...Qa}:{canUpdateText:Ja(t.tagName),canInsertChild:Za(t.tagName),canMove:!1,canRemove:!1}}function Be(t){return t?.trim().toLowerCase()??""}import{z as Qt}from"zod";var gm=Qt.object({routeId:Qt.string().min(1),mutationContext:ee.optional()}).strict();var Sm={PATCH_VALIDATION_FAILED:"The code didn't pass validation. Try describing the change more specifically.",PATCH_BATCH_FAILED:"The site code couldn't be generated. Please regenerate the site.",PATCH_BATCH_INVALID:"The change couldn't be applied. Try simpler instructions.",VALIDATION_FAILED:"Your message couldn't be sent as written. Please edit it and try again.",WORKSPACE_MESSAGE_CONTAINS_SECRET:"Your message looks like it contains a secret or token, so it wasn't sent. Remove it and try again.",WORKSPACE_TOOL_RESULT_INVALID:"This change couldn't be completed and was rolled back. Please try again.",WORKSPACE_TOOL_FAILED:"A tool step failed. Please try again.",WORKSPACE_TOOL_RESULT_MISSING:"The tool didn't return a usable result. Please try again.",WORKSPACE_MODEL_STREAM_FAILED:"The model stream ended unexpectedly. Please try again.",WORKSPACE_MODEL_STREAM_ABORTED:"Generation was interrupted before finishing. Please try again.",MODEL_OUTPUT_TRUNCATED:"The response was too long and was cut off before any change was applied. Try again, or split the request into smaller changes.",WORKSPACE_EDIT_NOT_APPLIED:"No change was applied. Try describing the change differently.",WORKSPACE_INITIAL_EXECUTION_FAILED:"Initial generation failed. Please retry from the brief.",WORKSPACE_INITIAL_GENERATION_CHECK_FAILED:"Initial generation could not be verified. Please retry.",WORKSPACE_INITIAL_GENERATION_FINALIZE_FAILED:"Initial generation could not finalize. Please retry.",WORKSPACE_INITIAL_GENERATION_QUALITY_GATE_FAILED:"Initial generation failed quality checks. Please regenerate the site.",WORKSPACE_ITERATION_QUALITY_GATE_FAILED:"Quality check failed. The change was rolled back; try a smaller or more specific request.",WORKSPACE_SOCKET_DEAD:"The workspace connection was lost. Please retry.",WORKSPACE_RUN_CANCELLED:"The run was cancelled.",WORKSPACE_RUN_ABANDONED:"This run was interrupted and did not finish. Please try again.",WORKSPACE_RUN_REQUEST_FAILED:"Couldn't start the workspace. Please try again.",WORKSPACE_RUN_BAD_RESPONSE:"The server response was malformed. Please try again.",WORKSPACE_SOCKET_UNAVAILABLE:"Workspace connection unavailable. Please try again.",WORKSPACE_SOCKET_ERROR:"The workspace connection had an error. Please try again.",WORKSPACE_SOCKET_CLOSED:"The workspace connection closed. Please try again.",WORKSPACE_SOCKET_OPEN_TIMEOUT:"Couldn't reach the workspace in time. Please try again.",WORKSPACE_CLIENT_MESSAGE_ID_MISSING:"Something went wrong sending your message. Please try again.",SITE_SNAPSHOT_REQUIRED:"This site has no usable snapshot yet. Complete Step 3 first.",AGENT_TIMEOUT:"That took longer than expected. Try breaking the change into smaller pieces.",SANDBOX_NOT_AVAILABLE:"The preview environment isn't ready. Your edits have still been saved.",PREVIEW_BUILD_FAILED:"Preview is available, but the production build failed. Fix the reported build error before deploying.",PREVIEW_BUILD_NOT_CONFIGURED:"Preview is available, but the production build check is not configured.",PREVIEW_BUILD_SANDBOX_NOT_FOUND:"Preview is available, but the build check could not find the active preview sandbox.",WS_CONNECTION_ERROR:"Connection lost. Reconnecting\u2026",USER_MESSAGE_PERSIST_FAILED:"Your message wasn't saved. Please send it again.",CLARIFICATION_REPLY_STALE:"That question has expired. Please tell me what you'd like to do now.",CLARIFY_MODEL_FAILED:"Clarify couldn't finish generating questions. Please try again.",WORKSPACE_RUN_IN_FLIGHT:"Another session is already running. Please try again in a moment.",SITE_OPERATION_LOCKED:"Another change is already running for this site. Wait for it to finish, then try again.",EDIT_ENGINE_VERSION_INVALID:"Invalid editor version. Refresh the page and try again.",SANDBOX_DEPENDENCY_SYNC_FAILED:"The preview runtime could not be prepared. Please try again.",SANDBOX_DEPENDENCY_VERSION_MISMATCH:"The preview runtime could not be verified. Please try again.",SANDBOX_RUNTIME_NOT_READY:"The preview needs to be refreshed before this change can be applied. Refresh the preview and try again.",GENERIC:"Something went wrong. Please try again."},bm={UNDO_OR_ROLLBACK:"I can't roll back from chat. Use the version history at the top right to pick a restore point.",HISTORY_RECALL:"Tell me what you'd like to change now\u2014I'll work from the current page state.",OUT_OF_SCOPE:"That's outside what I can do from chat. Try the corresponding panel on the right."},_m={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},ym={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var Zt="0.6.3",Em="x-vcp-edit-engine-version",xm="x-vcp-edit-engine-version-source",qe=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},es=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function ts(t){return es.test(t)}function ns(t){if(typeof t!="string"||!ts(t))throw new qe;return t}function Im(t){return t==null?{version:Zt,source:"fallback_current"}:{version:ns(t),source:"explicit"}}function Rm(){return{version:Zt,source:"system_current"}}import{z as y}from"zod";var is=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],Jt=y.object({name:y.string().min(1).max(100),type:y.enum(is),label:y.string().min(1).max(255),required:y.boolean().optional(),options:y.array(y.string()).optional()}),Am=y.object({name:y.string(),cms_type:y.string(),label:y.string().optional(),required:y.boolean().optional(),value_shape:y.string().optional(),front_display:y.enum(["visible","internal","forbidden"]).optional(),choices:y.array(y.object({value:y.union([y.string(),y.number()]),label:y.string()})).optional()}),Pm=y.object({route_file_path:y.string().min(1),target_component_path:y.string().min(1),content_type_hint:y.string().min(1),required_fields:y.array(Jt).optional(),mode:y.enum(["bind_existing","provision"]),list_mode:y.enum(["page","embedded"]).optional(),fields:y.array(Jt).optional(),seed_records:y.array(y.record(y.string(),y.unknown())).optional()});import{z as R}from"zod";var as=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],ss=R.object({name:R.string().min(1).max(100),type:R.enum(as),label:R.string().min(1).max(255),required:R.boolean().optional(),options:R.array(R.string()).optional()}),jm=R.object({form_hint:R.string().min(1),mode:R.enum(["bind_existing","provision"]),component_slug:R.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),name:R.string().min(1).max(255).optional(),description:R.string().min(1).max(1e3).optional(),fields:R.array(ss).optional()}),Nm=R.object({name:R.string(),label:R.string(),cms_type:R.string(),required:R.boolean()});import{z as L}from"zod";var os=["provisioning","cms_app_created","seeded","ready","failed"],Om=L.object({tenant_id:L.string().min(1),site_id:L.string().min(1),collection_slug:L.string().min(1),cms_collection_id:L.string().min(1).nullable(),status:L.enum(os),owned_by_vcp:L.boolean(),run_id:L.string().min(1).nullable(),last_error:L.string().nullable(),created_at:L.string().datetime(),updated_at:L.string().datetime()});var en="/vibe/v1";function Lm(t){let n=t?.trim().replace(/\/+$/,"");if(!n)return null;try{let s=new URL(n),c=s.pathname.replace(/\/+$/,"");return s.search="",s.hash="",s.pathname=c.endsWith(en)?c:en,s.href.replace(/\/+$/,"")}catch{return n}}import{z as k}from"zod";var rs=k.object({maxSites:k.number().int().nullable().optional(),maxStorageMb:k.number().int().nullable().optional(),customDomains:k.boolean().nullable().optional()}).passthrough().superRefine((t,n)=>{for(let s of Object.keys(t))s.includes("_")&&n.addIssue({code:"custom",path:[s],message:"Public plan feature fields must use camelCase."})}),cs=k.object({subscriptionId:k.string().min(1),planId:k.string().min(1),locale:k.enum(["en","zh_CN"]).or(k.string().min(1)),currentPeriodEnd:k.string().nullable(),servicePeriodEnd:k.string().nullable(),featureSnapshot:rs.nullable(),code:k.string().nullable(),level:k.number().int().nullable(),name:k.string().nullable()}).strict(),ms=k.object({hasActiveSubscription:k.boolean()}).strict(),tn=k.object({plan:cs.nullable(),entitlement:ms}).strict();import{z as b}from"zod";var ls=["pending_dns","active"],Bm="CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED",ps=b.enum(ls),ds=b.enum(["ownershipVerification","certificateValidation","traffic","unknown"]),us=b.enum(["pending","matched"]),gs=b.object({id:b.string().min(1),type:b.string().min(1),name:b.string().min(1),value:b.string().min(1),purpose:ds,required:b.boolean(),status:us.optional()}).strict(),oe=b.object({id:b.string().min(1),domainId:b.string().min(1).optional(),hostname:b.string().min(1),displayHostname:b.string().min(1),asciiHostname:b.string().min(1),status:ps,isPrimary:b.boolean(),deletable:b.boolean(),dnsRecords:b.array(gs),createdAt:b.string().datetime().nullable(),checkedAt:b.string().datetime().nullable()}).strict(),hs=b.object({hostname:b.string().min(1),url:b.string().url(),status:b.literal("ready")}).strict(),nn=b.object({defaultDomain:hs,currentDomain:oe.nullable(),customDomains:b.array(oe)}).strict(),qm=b.object({hostname:b.string().min(1),isPrimary:b.boolean().optional()}).strict(),an=b.object({domain:oe}).strict(),sn=b.object({domain:oe}).strict(),on=b.object({domain:oe}).strict(),rn=b.object({deleted:b.boolean()}).strict();var re={Inter:{import:"Inter"},"Inter Tight":{import:"Inter_Tight"},"DM Sans":{import:"DM_Sans"},"Source Sans 3":{import:"Source_Sans_3"},"Libre Franklin":{import:"Libre_Franklin"},Montserrat:{import:"Montserrat"},Archivo:{import:"Archivo"},"Space Grotesk":{import:"Space_Grotesk"},Manrope:{import:"Manrope"},"IBM Plex Sans":{import:"IBM_Plex_Sans"},Oswald:{import:"Oswald"},"Roboto Condensed":{import:"Roboto_Condensed"},"Bebas Neue":{import:"Bebas_Neue",weights:["400"]},"Playfair Display":{import:"Playfair_Display"},Lora:{import:"Lora"},Fraunces:{import:"Fraunces"},"Cormorant Garamond":{import:"Cormorant_Garamond"},"JetBrains Mono":{import:"JetBrains_Mono"},"IBM Plex Mono":{import:"IBM_Plex_Mono"},"Noto Sans SC":{import:"Noto_Sans_SC",download:!1},"Noto Serif SC":{import:"Noto_Serif_SC",download:!1}},Ss={heading:"Inter",body:"Inter"},cn=re.Inter;function fe(t){return t.trim().replace(/\s+/g,"_").toLowerCase()}var dn=(()=>{let t=new Map;for(let[n,s]of Object.entries(re))t.set(fe(n),s),t.set(fe(s.import),s);return t})();function bs(t){return typeof t!="string"||t.trim().length===0?cn:dn.get(fe(t))??cn}var _s=(()=>{let t=new Map;for(let[n,s]of Object.entries(re))t.set(s.import,n);return t})();function ys(t){if(typeof t!="string"||t.trim().length===0)return"Inter";let n=dn.get(fe(t));return n?_s.get(n.import)??"Inter":"Inter"}var fs=Object.keys(re),mn='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',ln='Georgia, "Times New Roman", serif',pn='"SFMono-Regular", Consolas, monospace',Es=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),xs=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(t=>t.toLowerCase())),Is=new Set(["JetBrains Mono","IBM Plex Mono"].map(t=>t.toLowerCase()));function Rs(t){let n=t.toLowerCase();return Is.has(n)||n.includes("mono")?"mono":xs.has(n)||n.includes("serif")?"serif":"sans"}function We(t,n){let s=g=>(g??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),c=s(t),r=s(n),m=g=>Es.has(g.toLowerCase());if(c&&m(c)){let g=c.toLowerCase();return g.includes("mono")?pn:g.includes("serif")?ln:mn}let S=c;S||(S=m(r)?"":r),S||(S="Inter");let p=Rs(S);return p==="mono"?`"${S}", ${pn}`:p==="serif"?`"${S}", ${ln}`:`"${S}", ${mn}`}function Ts(t){return{"--site-font-sans":We(t?.body,"Inter"),"--site-font-heading":We(t?.heading,t?.body??"Inter")}}var ks=[{id:"archivo-inter",heading:"Archivo",body:"Inter"},{id:"playfair-source-sans",heading:"Playfair Display",body:"Source Sans 3"},{id:"space-grotesk-manrope",heading:"Space Grotesk",body:"Manrope"},{id:"fraunces-libre-franklin",heading:"Fraunces",body:"Libre Franklin"},{id:"noto-serif-sc-noto-sans-sc",heading:"Noto Serif SC",body:"Noto Sans SC"},{id:"noto-sans-sc",heading:"Noto Sans SC",body:"Noto Sans SC"}];var As=[{id:"ocean",colorSeeds:{primary:"#1e3a5f",accent:"#2563eb"}},{id:"forest",colorSeeds:{primary:"#14532d",accent:"#16a34a"}},{id:"clay",colorSeeds:{primary:"#7c2d12",accent:"#ea580c"}},{id:"violet",colorSeeds:{primary:"#3b0764",accent:"#7c3aed"}},{id:"graphite",colorSeeds:{primary:"#1f2937",accent:"#0d9488"}},{id:"crimson",colorSeeds:{primary:"#7f1d1d",accent:"#dc2626"}}];import{z as U}from"zod";var Ps=U.object({colorSeeds:U.object({primary:U.string().min(1).max(40),accent:U.string().min(1).max(40)}).strict().optional(),fonts:U.object({heading:U.string().min(1).max(60),body:U.string().min(1).max(60)}).strict().optional()}).strict().refine(t=>t.colorSeeds!==void 0||t.fonts!==void 0,{message:"colorSeeds or fonts is required"}),vs=U.object({ok:U.literal(!0),design_plan_version:U.number().int().positive(),snapshot_id:U.string().min(1)});var ze=e.object({heading:e.string().min(1).max(160).optional(),body:e.string().min(1).max(160).optional(),paletteIntent:e.string().min(1).max(400).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),density:e.enum(["compact","comfortable","editorial"]).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional()}),$e=e.object({protocol:e.enum(["phone","form","download","route","external"]),ctaLabel:e.string().min(1).max(40),ctaTarget:e.string().min(1).max(200).optional(),requiresOwnerDetail:e.boolean().optional()}),He=e.enum(["material","reference","brief","industry"]),Cs=e.object({market:e.object({value:e.string().min(1).max(200),source:He}),customer:e.object({value:e.string().min(1).max(200),source:He}),purpose:e.object({options:e.array(e.string().min(1).max(60)).min(2).max(4),selected:e.string().min(1).max(60),source:He})}),js=e.enum(["text-options","motion-slider","positioning"]),Ye=e.enum(["none","subtle","moderate","expressive"]),Ns=e.enum(["compact","comfortable","editorial"]),ws=Ye,bn=e.object({skill_name:e.string().min(1),rationale:e.string().min(4).max(200),confidence:e.enum(["high","medium","low"]).optional(),displayName:e.object({zh:e.string().min(1),en:e.string().min(1)}).partial().optional()}),Ds=e.object({value:e.string(),label:e.string(),desc:e.string().optional(),impact:e.string().optional(),isRecommended:e.boolean().optional(),preselect:e.boolean().optional(),visualHints:ze.optional(),conversionHints:$e.optional()}),Os=e.object({id:e.string(),type:js,question:e.string(),tag:e.string(),aiThinking:e.string(),options:e.array(Ds),source:e.enum(["ai-detected","always-ask"]),sourceDetail:e.string(),positioning:Cs.optional()}),Xe=e.object({questions:e.array(Os).min(1).max(6)}),il=e.object({tenant_id:e.string().min(1),site_id:e.string().min(1),brief_id:e.string().min(1),brief:e.string().min(20).max(1e3),site_default_locale:G.optional(),owner_locale:G.optional(),input_context:e.object({facts:e.array(le).max(120),conflicts:e.array(de).max(20),reference:pe.optional(),sources:e.array(e.object({type:Ae,title:e.string().max(120).optional(),status:Pe})).max(16).optional()}).optional()}),_n=e.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),al=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("skill.selecting"),category:e.literal("page-generation"),available:e.array(e.object({id:e.string().min(1),name:e.string().min(1)})).max(20),at:e.string().min(1)}),e.object({type:e.literal("skill.selected"),category:e.literal("page-generation"),selected:e.object({id:e.string().min(1),name:e.string().min(1),reason:e.string().min(1).max(200)}),at:e.string().min(1)}),e.object({type:e.literal("clarify.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("clarify.archetype_proposals"),proposals:e.array(bn).min(1).max(5),at:e.string().min(1)}),e.object({type:e.literal("clarify.finished"),questions_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),error_category:_n.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),at:e.string().min(1)})]),Ms=e.enum(["draft","brief_submitted","clarifying","sitemap_ready","workspace_ready","deployed","archived","error"]),Ls={draft:["brief_submitted","archived","error"],brief_submitted:["clarifying","archived","error"],clarifying:["sitemap_ready","archived","error"],sitemap_ready:["workspace_ready","archived","error"],workspace_ready:["deployed","archived","error"],deployed:["workspace_ready","archived","error"],archived:[],error:["draft","brief_submitted","clarifying","sitemap_ready"]};function sl(t,n){if(!Ls[t].includes(n))throw new Error(`Invalid site status transition: ${t} -> ${n}`);return n}var Us=e.enum(["planning","initial_generation_running","generated"]),Ks={planning:["initial_generation_running"],initial_generation_running:["generated","planning"],generated:[]};function ol(t,n){if(t===n)return n;if(!Ks[t].includes(n))throw new Error(`Invalid site generation state transition: ${t} -> ${n}`);return n}function rl(t){if(t.agent_type!=="workspace"||t.current_state==="generated")return null;switch(t.event_type){case"run.started":return t.current_state==="planning"?"initial_generation_running":null;case"run.finished":return t.current_state==="initial_generation_running"?"generated":null;case"run.failed":return t.current_state==="initial_generation_running"?t.has_current_snapshot?"generated":"planning":null;default:return null}}var cl="SITE_PLANNING_INPUT_FROZEN",ml="SITE_PLANNING_LOCKED",ll=e.object({tenant_id:e.string().min(1),owner_user_id:e.string().min(1),name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),pl=e.object({name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),dl=e.object({name:e.string().min(1).max(120)}),ul=e.object({name:e.string().min(1).max(120),default_locale:G.optional()}),gl=e.object({body:e.string().min(20).max(1e3)}),hl=e.object({body:e.string().min(20).max(1e3)}),Qe=e.string().url().refine(t=>{try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}},{message:"URL must use http or https protocol"}),Sl=e.object({tenant_id:e.string().min(1),site_url:Qe,site_name:e.string().trim().min(1).max(255).optional()}),V=t=>e.object({code:e.number().int(),data:t,message:e.string()}),bl=V(e.object({site_id:e.string().min(1),site_url:Qe})),_l=V(nn),yl=V(an),fl=V(sn),El=V(on),xl=V(rn),Il=V(tn),X=e.object({id:e.string().min(1),tenant_id:e.string().min(1),owner_user_id:e.string().min(1).nullable(),name:e.string().min(1),slug:e.string().min(1),status:Ms,generation_state:Us,planning_locked_at:e.string().min(1).nullable(),current_sitemap_id:e.string().min(1).nullable(),current_snapshot_id:e.string().min(1).nullable(),deployed_url:e.string().url().nullable(),default_locale:G,owner_locale:G.optional(),cms_site_id:e.string().nullable().optional(),cms_site_url:Qe.nullable().optional(),schema_version:e.literal(1),created_at:e.string().min(1),updated_at:e.string().min(1)}),Ze=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),body:e.string().min(1),source:e.enum(["user","import","system"]),created_at:e.string().min(1),updated_at:e.string().min(1)}),Rl=e.object({site:X,brief:Ze,next_step:e.literal("clarify")}),Tl=e.object({site:X,brief:Ze}),kl=e.object({brief:Ze}),Fs=e.enum(["queued","running","succeeded","failed","cancelled"]),yn=e.enum(["clarify","sitemap","workspace"]),fn=e.enum(["clarify","sitemap","initial_generation","iteration"]),En=e.enum(["clarify","sitemap","workspace","summarize"]),q=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),agent_type:yn,run_kind:fn,status:Fs,model_route:En,started_at:e.string().min(1).nullable(),finished_at:e.string().min(1).nullable(),error_code:e.string().min(1).nullable(),created_at:e.string().min(1)}),Al=e.object({run_id:e.string().min(1).optional(),site_id:e.string().min(1),agent_type:yn,run_kind:fn.optional(),model_route:En,input:e.record(e.string(),e.unknown()).optional()}).superRefine((t,n)=>{ce(t.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),Pl=e.object({agent_run:q,next_step:e.literal("stream_events")}),Je=e.enum(["draft","candidate","current","failed"]),me=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),version:e.number().int().positive(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),reason:e.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback"]),status:Je,created_at:e.string().min(1)}),vl=e.object({snapshot_id:e.string().min(1).optional(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),reason:me.shape.reason,status:Je.default("candidate")}),Cl=e.object({site:X,snapshot:me,next_step:e.literal("workspace")}),jl=e.object({site:X,snapshot:me,next_step:e.literal("workspace")}),Nl=e.object({status:e.literal("deleted"),snapshot_id:e.string().min(1)}),et=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),snapshot_id:e.string().min(1),version:e.number().int().positive(),accepted_commit:e.string().min(1),source_run_id:e.string().min(1).nullable(),created_at:e.string().min(1)}),Gs=et.extend({reason:me.shape.reason,status:Je}),wl=e.object({accepted_commit:e.string().min(1),source_run_id:e.string().min(1).optional()}),Dl=e.object({site_version:et,next_step:e.literal("workspace")}),Ol=e.object({site_versions:e.array(Gs)}),Ml=e.object({site:X,snapshot:me,site_version:et,next_step:e.literal("workspace")}),Ll=e.object({snapshot_id:e.string().min(1),force_rehydrate:e.boolean().optional()}),Ul=e.object({status:e.enum(["ready","failed"]),preview_url:e.string().min(1).optional(),code:e.string().min(1).optional(),message:e.string().min(1).optional(),retryable:e.boolean().optional()}),Kl="DEPLOYMENT_ENTITLEMENT_REQUIRED",tt=e.enum(lt),Ie=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),snapshot_id:e.string().min(1),version:e.number().int().positive(),status:tt,provider:e.enum(["cloudflare"]),url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Fl=e.object({snapshot_id:e.string().min(1).optional()}).default({}),Gl=e.object({deployment:Ie}),Bl=e.object({deployment:Ie.nullable()}),ql=e.object({deployment:Ie}),un=e.object({id:e.string().min(1),status:tt,url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable()}),Wl=e.object({current:un.nullable(),latest_released:un.nullable()}),Bs=e.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),Y=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),deployment_id:e.string().min(1),seq:e.number().int().positive(),sent_at:e.string().min(1)}),Ee=e.object({deployment:Ie}),Hl=e.discriminatedUnion("type",[Y.extend({type:e.literal("deployment.snapshot"),payload:Ee}),Y.extend({type:e.literal("deployment.status.changed"),payload:Ee}),Y.extend({type:e.literal("deployment.finished"),payload:Ee}),Y.extend({type:e.literal("deployment.failed"),payload:Ee}),Y.extend({type:e.literal("deployment.realtime.recovered"),payload:e.object({action:e.literal("refresh")})}),Y.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})})]),Vl=e.object({tenant_id:e.string().min(1),site_id:e.string().min(1),deployment_id:e.string().min(1),status:tt,updated_at:e.string().min(1)}),qs="vcp:deployments",zl={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:qs,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...Bs.options]},Ws=e.object({error:e.object({code:e.string().min(1),message:e.string().min(1),details:e.unknown().optional(),request_id:e.string().min(1).optional(),retryable:e.boolean().default(!1)})}),$l=e.object({error:Ws.shape.error.extend({code:e.literal("AGENT_RUN_IN_FLIGHT"),details:e.object({code:e.literal("AGENT_RUN_IN_FLIGHT"),message:e.string().min(1),agent_run:q})})}),Yl=e.object({colors:e.record(e.string(),e.string()).default({}),typography:e.record(e.string(),e.string()).default({}),spacing:e.record(e.string(),e.string()).default({}),motion:e.record(e.string(),e.string()).default({})}),Hs=e.object({theme_id:e.string().min(1),paletteIntent:e.string().min(1),tone:e.string().min(1),mediaMood:e.string().min(1),motionLevel:Ye.optional(),userVisualHints:ze.optional()}),Vs=e.object({question:e.string().min(1),answer:e.string().min(1)}),Xl=e.object({query:e.string().min(1),keywords:e.array(e.string()).default([]),orientation:e.enum(["landscape","portrait","square"]).optional(),role:e.enum(["hero","section","card","gallery","testimonial","decorative"]),altHint:e.string().min(1)}),Ql=e.object({id:e.string().min(1),role:e.enum(["site_background","nav_background","footer_background"]),query:e.string().min(1),keywords:e.array(e.string()).default([]),treatment:e.enum(["cover","fixed-cover","subtle-texture"]),altHint:e.string().optional()}),zs=e.object({provider:e.enum(["unsplash","pexels"]),providerLabel:e.enum(["Unsplash","Pexels"]),providerHref:e.string().url(),photoHref:e.string().url().optional(),photographerName:e.string().optional(),photographerHref:e.string().url().optional(),requiresAttribution:e.boolean()}),Zl=e.object({src:e.string().min(1),alt:e.string().min(1),width:e.number().int().positive().optional(),height:e.number().int().positive().optional(),provider:e.enum(["unsplash","pexels","placeholder"]).optional(),providerId:e.string().optional(),photoUrl:e.string().url().optional(),photographer:e.string().optional(),photographerUrl:e.string().url().optional(),credit:e.string().optional(),dominantColor:e.string().optional(),attribution:zs.optional()}),$s=e.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),Q=e.object({id:e.string().min(1),name:e.string().min(1),category:e.literal("page-generation"),version:e.string().min(1).optional(),reason:e.string().min(1).max(200),source:$s.default("system_recommended")}),f=e.string().min(1).max(2e3),gn=e.string().min(1).max(120),xn=e.object({visualDirection:f,brandFeeling:f,paletteIntent:f,typographyIntent:f,density:Ns,motionLevel:ws,mediaStrategy:f,compositionRules:e.array(f).max(20),avoidPatterns:e.array(f).max(20),fonts:e.object({heading:e.string().min(1),body:e.string().min(1)}).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional()}),nt=160,In=e.object({routeGoal:f,narrativeArc:f,firstViewportIntent:f,visualContinuity:f,sectionRhythm:f,avoidPatterns:e.array(f).max(20),displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(nt).optional(),metaTitle:e.string().min(1).max(120).optional(),metaDescription:e.string().min(1).max(320).optional()}),Rn=e.enum(["model_call","validation","repair","preview","worker_group"]),B=e.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),Tn=e.object({sectionRole:f,contentIntent:f,layoutIntent:f,visualIntent:f,mediaIntent:f,motionIntent:f,copyTone:f,displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(nt).optional(),ctaIntent:f.optional(),continuityWithPrevious:f.optional(),avoidRepeating:e.array(f).max(20).optional(),industryRecipeRefs:e.array(gn).max(12).optional(),templateRecipeRefs:e.array(gn).max(12).optional()}),kn=e.object({siteName:e.string().min(1).max(120),tagline:e.string().min(1).max(200).optional(),primaryCta:e.object({label:e.string().min(1).max(60),target:e.string().min(1).max(200)}).optional(),trustSignals:e.array(e.string().min(1).max(60)).max(6).optional(),industry:e.string().min(1).max(40).optional()}),Ys=e.enum(["solid","floating"]),Xs=e.enum(["background","card","primary","frosted"]),Qs=e.enum(["sticky","hide-on-scroll","static"]),Zs=e.enum(["bar","island"]),Js=e.object({variant:Ys,surface:Xs.optional(),behavior:Qs.optional(),shape:Zs.optional()}),eo=e.object({form:f,layoutIntent:f,scrollBehavior:f,shell:Js.optional(),avoidPatterns:e.array(f).max(10).optional()}),to=e.enum(["background","card","primary","inverse"]),no=e.object({surface:to}),io=e.object({form:f,composition:f,shell:no.optional(),avoidPatterns:e.array(f).max(10).optional()}),ao=e.object({pattern:f,intent:f}),An=e.object({header:eo,footer:io,mobileNav:ao}),Pn=e.object({schemaVersion:e.literal(1).default(1),siteDesignContext:xn,routeCards:e.record(e.string().min(1),In),blockContexts:e.record(e.string().min(1),Tn),selectedSkillPacks:e.array(Q).max(3).optional(),branding:kn.optional(),chromeDesign:An.optional()}),Jl=e.object({siteDesignContext:xn.omit({imagePalette:!0}).optional(),routeCards:e.record(e.string().min(1),In).optional(),blockContexts:e.record(e.string().min(1),Tn).optional(),branding:kn.optional(),chromeDesign:An.optional()}),so=e.object({id:e.string(),type:e.string(),variant:e.string().optional(),order:e.number(),props:e.record(e.string(),e.unknown()),enabled:e.boolean(),meta:e.object({aiGenerated:e.boolean(),userEdited:e.boolean(),lastEditedAt:e.string(),lastEditedBy:e.enum(["ai","user"]),userInstruction:e.string().optional()}).optional()}).strict(),oo=e.string().regex(J,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),ro=new RegExp(`^/(?:${z}(?:/${z})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),co=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,mo=e.union([e.string().regex(ro),e.string().regex(co)]),hn=e.object({label:e.string(),href:mo}),lo=e.object({primaryLinks:e.array(hn),footerLinks:e.array(hn)}),vn=e.object({id:e.string(),slug:oo,title:e.string(),blocks:e.array(so).min(1),layout:e.enum(["default","centered","fullwidth"]).optional(),navigation:e.object({showInHeader:e.boolean(),showInFooter:e.boolean(),order:e.number()})}).strict(),po=vn.extend({slug:e.string().min(1)}),Sn=e.object({label:e.string(),href:e.string().min(1)}),uo=e.object({primaryLinks:e.array(Sn),footerLinks:e.array(Sn)}),Cn=e.object({site_name:e.string().min(1).max(80).optional(),version:e.number().int().positive(),pages:e.array(vn).min(1),navigation:lo,integrations:e.object({cms:e.unknown().optional(),analytics:e.unknown().optional()}).optional(),meta:e.object({generatedAt:e.string(),generatedBy:e.literal("sitemap-agent"),source_brief_id:e.string().optional(),source_answer_ids:e.array(e.string()).optional()}),skillSelection:Q,visualTheme:Hs.optional(),userChoices:e.array(Vs).optional(),confirmedChoices:e.object({conversion:$e.optional()}).optional()}).strict(),Re=Cn.superRefine((t,n)=>{let s=new Map,c=0;t.pages.forEach((r,m)=>{r.slug==="/"&&(c+=1);let S=s.get(r.slug);S!==void 0?n.addIssue({code:"custom",path:["pages",m,"slug"],message:`Duplicate page slug '${r.slug}' (first used at pages.${S}.slug).`}):s.set(r.slug,m)}),(c!==1||t.pages[0]?.slug!=="/")&&n.addIssue({code:"custom",path:["pages"],message:"Sitemap must contain exactly one home page at pages[0] with slug '/'."})}),ep=Cn.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0}).extend({site_name:e.string().min(1).max(80),pages:e.array(po).min(1),navigation:uo}),go=e.enum(["ai","user"]),Z=e.object({site_id:e.string().min(1),page_id:e.string().min(1),edited_by:go.default("ai"),source_agent_run_id:e.string().min(1).optional()}),tp=Z.extend({block_id:e.string().min(1),target_index:e.number().int().min(0)}),ho=Z.extend({block_id:e.string().min(1)}),So=Z.extend({block_id:e.string().min(1),instruction:e.string()}),np=Z.extend({block_id:e.string().min(1),variant:e.string().min(1).nullable()}),ip=Z.extend({block_id:e.string().min(1),props:e.record(e.string(),e.unknown()),mode:e.enum(["replace","merge"]).default("replace")}),ap=Z.extend({block:e.object({id:e.string().min(1),type:e.string().min(1),variant:e.string().min(1).optional(),props:e.record(e.string(),e.unknown()).default({}),insert_index:e.number().int().min(0).optional()})}),bo=e.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),sp=e.discriminatedUnion("operation",[e.object({operation:e.literal("delete_block"),input:ho}).strict(),e.object({operation:e.literal("update_block_instruction"),input:So}).strict()]),_o=e.enum(["SITEMAP_EDIT_INVALID","SITEMAP_API_NOT_CONFIGURED","SITEMAP_NOT_FOUND","SITEMAP_PAGE_NOT_FOUND","SITEMAP_BLOCK_NOT_FOUND","SITEMAP_BLOCK_ALREADY_EXISTS","SITEMAP_EDIT_FAILED"]),yo=e.object({status:e.literal("updated"),operation:bo,site_id:e.string().min(1),sitemap_id:e.string().min(1),version:e.number().int().positive(),changed_pages:e.array(e.string().min(1)).min(1),requires_code_patch:e.literal(!0)}),fo=e.object({status:e.literal("failed"),code:_o,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),op=e.discriminatedUnion("status",[yo,fo]),it=e.object({question_id:e.string().min(1),value:e.string().min(1),label:e.string().min(1).optional(),question:e.string().min(1).optional(),option_label:e.string().min(1).optional(),motion_level:Ye.optional(),visual_tonality:ze.optional(),conversion:$e.optional(),positioning:e.object({market:e.string().min(1).max(200),customer:e.string().min(1).max(200),purpose:e.string().min(1).max(60)}).optional()}),rp=e.object({tenant_id:e.string().min(1),site_id:e.string().min(1),brief_id:e.string().min(1),brief:e.string().min(20).max(1e3),answers:e.array(it).min(1).max(10),skillSelection:Q,site_default_locale:G.optional(),owner_locale:G.optional(),reference:pe.optional(),input_context:e.object({facts:e.array(le).max(120),conflicts:e.array(de).max(20)}).optional()}),jn=e.enum(["planning","generating","validating","ready"]),Eo=e.enum(["salvaged","deterministic_fallback"]),xo=e.enum(["model_exception_settled_prefix","model_exception_safe_root"]),Nn={outcome:Eo.optional(),reason:xo.optional(),attempts:e.number().int().positive().optional()};function wn(t,n){if(t.type!=="sitemap.generated")return;let s=t.outcome!==void 0,c=t.reason!==void 0;s!==c&&n.addIssue({code:"custom",path:[s?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var Io=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:jn,message:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generated"),sitemap_id:e.string().min(1),sitemap:Re,...Nn,at:e.string().min(1)}),e.object({type:e.literal("sitemap.clamped"),reason:e.enum(["page_early_stop","finalize_best_effort"]),original_page_count:e.number().int().nonnegative().optional(),final_page_count:e.number().int().nonnegative().optional(),original_enabled_block_count:e.number().int().nonnegative().optional(),final_enabled_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.started"),slot_count:e.number().int().nonnegative(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.finished"),slot_count:e.number().int().nonnegative(),provider_counts:e.object({unsplash:e.number().int().nonnegative(),pexels:e.number().int().nonnegative(),placeholder:e.number().int().nonnegative()}),fallback_count:e.number().int().nonnegative(),error_codes:e.array(e.string()),at:e.string().min(1)}),e.object({type:e.literal("snapshot.created"),snapshot_id:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:e.string().min(1).optional(),at:e.string().min(1)})]),cp=Io.superRefine(wn),Ro=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),version:e.number().int().positive(),sitemap:Re,source_agent_run_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),mp=e.object({sitemap_id:e.string().min(1).optional(),sitemap:Re,source_agent_run_id:e.string().min(1).optional()}),lp=e.object({site:X,sitemap:Ro,next_step:e.literal("workspace")}),To=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),brief_id:e.string().min(1),questions:Xe,answers:e.array(it),selected_archetype:Q.optional(),completed_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),pp=e.object({answers:e.array(it).min(1),questions:Xe,selected_archetype:Q.optional()}),dp=e.object({clarify_session:To}),up=e.object({questions:Xe,selected_archetype:Q}),ko=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),version:e.number().int().positive(),design_plan:Pn,source_agent_run_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),gp=e.object({design_plan_id:e.string().min(1).optional(),design_plan:Pn,source_agent_run_id:e.string().min(1).optional()}),hp=e.object({design_plan:ko}),Te=e.enum(["initial_generation","iteration"]),Ao=e.object({label:e.string().min(1).max(48),prompt:e.string().min(1).max(160)}).strict(),Po=e.enum(["model","derived","mixed","advisor"]),Dn=e.object({suggestions:e.array(Ao).min(1).max(4),source:Po}).strict(),vo=e.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),Co=e.enum(["generation_succeeded","entry_slots_omitted","quality_gate_exhausted","schema_gate_exhausted","stream_schema_mismatch","stream_generation_error","generation_error","fallback_compiler_error","legacy_result_missing_metadata"]),On=e.enum(["run.started","message.delta","user.message","plan.updated","clarify.partial","clarify.archetype_proposals","clarify.finished","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","sitemap.updated","sitemap.resync.failed","sitemap.resync.warning","block.changed","tool.started","tool.finished","workspace.plan.created","workspace.worker.updated","workspace.task.updated","workspace.degraded","workspace.design_plan.outcome","workspace.suggestions","file.changed","snapshot.created","preview.preparing","preview.ready","preview.build.started","preview.build.succeeded","preview.build.failed","run.failed","run.finished","media_resolution.started","media_resolution.finished","skill.selecting","skill.selected","activity.started","activity.updated","activity.finished","activity.failed"]),jo=e.object({id:e.string().min(1),title:e.string().min(1),status:e.enum(["pending","running","completed","failed"])}),H=e.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),at=e.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),st=e.object({code:e.string().min(1),message:e.string().min(1),path:e.string().min(1).optional(),task_id:e.string().min(1).optional(),details:e.record(e.string(),e.unknown()).optional()}),D=e.string().min(1).refine(t=>Vn(t),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),ot=e.object({deduped_paths:e.array(D),skipped_tasks:e.array(e.string().min(1)),failed_tasks:e.array(e.string().min(1)),fallback_files:e.array(e.string().min(1)),applied_paths:e.array(D)}),rt=e.object({group_id:e.string().min(1),phase:at,title:e.string().min(1),status:H,task_ids:e.array(e.string().min(1)),depends_on_groups:e.array(e.string().min(1)),target_paths:e.array(D)}),No=e.enum(["style","media","chrome","section","layout","page"]),ct=e.object({task_id:e.string().min(1),group_id:e.string().min(1),kind:No,target_path:D,block_id:e.string().min(1).optional(),block_type:e.string().min(1).optional(),block_variant:e.string().min(1).optional(),block_order:e.number().int().nonnegative().optional(),user_instruction:e.string().min(1).optional(),page_id:e.string().min(1).optional(),page_slug:e.string().min(1).optional(),page_title:e.string().min(1).optional(),title:e.string().min(1).max(60).optional(),description:e.string().min(1).max(nt).optional(),status:H,required_reads:e.array(D).optional()}),mt=e.object({from_group_id:e.string().min(1),to_group_id:e.string().min(1),reason:e.enum(["style_media","chrome","sections","layout","page_composition","quality_gate"])}),Sp=e.object({plan_id:e.string().min(1),run_kind:Te,model_route:e.object({planner:e.literal("workspace_planner"),worker:e.literal("workspace")}),groups:e.array(rt),tasks:e.array(ct),dependencies:e.array(mt),expected_outputs:e.array(D),diagnostics:ot}),bp=e.object({task_id:e.string().min(1),patch:e.unknown().optional(),snapshot_id:e.string().min(1).optional(),read_files:e.array(D),diagnostics:e.array(st),status:H}),Mn=e.object({worker_count:e.number().int().nonnegative(),task_count:e.number().int().nonnegative(),group_count:e.number().int().nonnegative()}),Ln=e.object({pending:e.number().int().nonnegative(),running:e.number().int().nonnegative(),completed:e.number().int().nonnegative(),completed_with_skips:e.number().int().nonnegative(),failed:e.number().int().nonnegative(),skipped:e.number().int().nonnegative()}),wo=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"]).optional()}),Do=e.object({type:e.literal("reasoning"),text:e.string(),state:e.enum(["streaming","done"]).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),Oo=e.object({type:e.literal("file"),mediaType:e.string().min(1),filename:e.string().min(1).optional(),url:e.string().min(1)}),Mo=e.object({type:e.literal("source-url"),sourceId:e.string().min(1),url:e.string().min(1),title:e.string().min(1).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),Lo=e.object({type:e.literal("source-document"),sourceId:e.string().min(1),mediaType:e.string().min(1),title:e.string().min(1),filename:e.string().min(1).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),Uo=e.object({type:e.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:e.string().min(1).optional(),data:e.unknown()}),Ko=e.object({type:e.string().regex(/^tool-[a-zA-Z0-9_-]+$/),toolCallId:e.string().min(1),state:e.enum(["input-streaming","input-available","output-available","output-error"]),input:e.unknown().optional(),output:e.unknown().optional(),errorText:e.string().min(1).optional()}),Fo=e.object({type:e.literal("error"),errorText:e.string().min(1)}),Go=e.object({type:e.literal("step-start")}),xe=e.union([wo,Do,Oo,Mo,Lo,Uo,Ko,Fo,Go]),Bo=e.string().min(1).max(512).refine(t=>Vn(t)&&!/^[A-Za-z]:\//.test(t),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),qo=e.array(Bo).min(1).max(64),Wo=e.array(e.string().min(1).max(120)).min(1).max(64),Ho=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("message.delta"),text:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("user.message"),client_message_id:e.string().min(1),message_id:e.string().min(1),parts:e.array(xe).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("plan.updated"),steps:e.array(jo),at:e.string().min(1)}),e.object({type:e.literal("clarify.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("clarify.archetype_proposals"),proposals:e.array(bn).min(1).max(5),at:e.string().min(1)}),e.object({type:e.literal("clarify.finished"),questions_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:jn,message:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generated"),sitemap_id:e.string().min(1),sitemap:Re,...Nn,at:e.string().min(1)}),e.object({type:e.literal("sitemap.clamped"),reason:e.enum(["page_early_stop","finalize_best_effort"]),original_page_count:e.number().int().nonnegative().optional(),final_page_count:e.number().int().nonnegative().optional(),original_enabled_block_count:e.number().int().nonnegative().optional(),final_enabled_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("sitemap.updated"),sitemap_id:e.string().min(1),version:e.number().int().positive(),reason:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.resync.failed"),error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),diagnostics:e.unknown().optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.resync.warning"),code:e.string().min(1),message:e.string().min(1),diagnostics:e.unknown().optional(),at:e.string().min(1)}),e.object({type:e.literal("block.changed"),block_id:e.string().min(1),change_type:e.enum(["add","update","delete","move"]),at:e.string().min(1)}),e.object({type:e.literal("tool.started"),tool_call_id:e.string().min(1),name:e.string().min(1),summary:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("tool.finished"),tool_call_id:e.string().min(1),name:e.string().min(1),result_summary:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("workspace.plan.created"),plan_id:e.string().min(1),run_kind:Te,groups:e.array(rt),tasks:e.array(ct),dependencies:e.array(mt),expected_outputs:e.array(D),diagnostics:ot,summary:Mn,at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.worker.updated"),group_id:e.string().min(1),phase:at,status:H,task_counts:Ln,target_paths:e.array(D),diagnostics:e.array(e.string().min(1)),at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.task.updated"),task_id:e.string().min(1),group_id:e.string().min(1),status:H,target_path:D,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(st).optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.degraded"),reason:e.enum(["block_placeholder","form_placeholder","patch_protected_dropped","preview_health_degraded","design_plan_fallback","generated_code_rescue"]),degraded_block_ids:e.array(e.string().min(1)).min(1).optional(),dropped_files:e.array(e.string().min(1)).min(1).optional(),degraded_file_paths:qo.optional(),degraded_page_ids:Wo.optional(),snapshot_id:e.string().min(1).optional(),code:e.string().min(1).optional(),message:e.string().min(1).optional(),diagnostics:e.string().min(1).optional(),retryable:e.boolean().optional(),at:e.string().min(1)}).strict().superRefine((t,n)=>{if(!(t.reason==="generated_code_rescue")){for(let c of["degraded_file_paths","degraded_page_ids"])t[c]!==void 0&&n.addIssue({code:"custom",path:[c],message:`${c} is only allowed for generated_code_rescue`});return}t.degraded_file_paths===void 0&&n.addIssue({code:"custom",path:["degraded_file_paths"],message:"generated_code_rescue requires degraded_file_paths"});for(let c of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])t[c]!==void 0&&n.addIssue({code:"custom",path:[c],message:`${c} is not allowed for generated_code_rescue`})}),e.object({type:e.literal("workspace.design_plan.outcome"),design_plan_outcome:vo,reason:Co,at:e.string().min(1)}).strict(),Dn.extend({type:e.literal("workspace.suggestions"),at:e.string().min(1)}).strict(),e.object({type:e.literal("file.changed"),path:e.string().min(1),change_type:e.enum(["create","update","delete"]),diff:e.string().optional(),at:e.string().min(1)}),e.object({type:e.literal("snapshot.created"),snapshot_id:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("preview.preparing"),at:e.string().min(1)}),e.object({type:e.literal("preview.ready"),url:e.string().url(),at:e.string().min(1)}),e.object({type:e.literal("preview.build.started"),snapshot_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("preview.build.succeeded"),snapshot_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("preview.build.failed"),snapshot_id:e.string().min(1),message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean(),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),error_category:_n.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),outcome:e.literal("retained_previous").optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.started"),slot_count:e.number().int().nonnegative(),at:e.string().datetime()}),e.object({type:e.literal("media_resolution.finished"),slot_count:e.number().int().nonnegative(),provider_counts:e.object({unsplash:e.number().int().nonnegative(),pexels:e.number().int().nonnegative(),placeholder:e.number().int().nonnegative()}),fallback_count:e.number().int().nonnegative(),error_codes:e.array(e.string()),at:e.string().datetime()}),e.object({type:e.literal("skill.selecting"),category:e.literal("page-generation"),available:e.array(e.object({id:e.string().min(1),name:e.string().min(1)})).max(20),at:e.string().min(1)}),e.object({type:e.literal("skill.selected"),category:e.literal("page-generation"),selected:e.object({id:e.string().min(1),name:e.string().min(1),reason:e.string().min(1).max(200)}),at:e.string().min(1)}),e.object({type:e.literal("activity.started"),activity_id:e.string().min(1),parent_activity_id:e.string().min(1).optional(),kind:Rn,title:e.string().min(1).max(200),detail:e.string().max(360).optional(),title_code:B.optional(),detail_code:B.optional(),locks_input:e.boolean(),at:e.string().min(1)}),e.object({type:e.literal("activity.updated"),activity_id:e.string().min(1),title:e.string().min(1).max(200).optional(),detail:e.string().max(360).optional(),title_code:B.optional(),detail_code:B.optional(),at:e.string().min(1)}),e.object({type:e.literal("activity.finished"),activity_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("activity.failed"),activity_id:e.string().min(1),detail:e.string().max(360).optional(),at:e.string().min(1)})]),Un=Ho.superRefine(wn),Ve=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),agent_run_id:e.string().min(1),sequence:e.number().int().positive(),event_type:On,payload:Un,created_at:e.string().min(1)}),_p=e.object({event_type:On,payload:Un}).superRefine((t,n)=>{t.event_type!==t.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),ce(t.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),yp=e.discriminatedUnion("status",[e.object({status:e.literal("appended"),agent_run:q,event:Ve,next_cursor:e.number().int().nonnegative()}),e.object({status:e.literal("duplicate_ignored"),agent_run:q,event:Ve,next_cursor:e.number().int().nonnegative()})]),fp=e.object({events:e.array(Ve),next_cursor:e.number().int().nonnegative().optional()}),Ep=e.object({after_sequence:e.coerce.number().int().nonnegative().default(0)}),xp=e.enum(["implemented","skeleton","planned"]),Ip=e.enum(["GET","POST","PUT","PATCH","DELETE"]),Rp=[{method:"GET",path:"/health",tag:"system",summary:"API health check.",status:"implemented",response_schema:"ApiHealth"},{method:"POST",path:"/sites",tag:"sites",summary:"Create a site and Step 1 brief in the current dev context.",status:"implemented",request_body_schema:"CreateSiteBriefRequestSchema",response_schema:"CreateSiteBriefResponseSchema"},{method:"POST",path:"/sites/drafts",tag:"sites",summary:"Create a draft site without a brief in the current tenant so /s/:site_id can collect Step 1 later.",status:"implemented",request_body_schema:"CreateSiteDraftRequestSchema",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites",tag:"sites",summary:"List current tenant sites.",status:"implemented",response_schema:"SiteRecordSchema[]"},{method:"GET",path:"/sites/by-cms/:cms_site_id",tag:"sites",summary:"Resolve an external CMS site id to one tenant-scoped VCP site.",status:"implemented",response_schema:"SiteRecordSchema",notes:["Used by the browser /d/:cms_site_id handoff route; lookup is scoped by current request tenant and returns 404 when the CMS site has not been synchronized."]},{method:"GET",path:"/sites/:site_id",tag:"sites",summary:"Get one tenant-scoped site.",status:"implemented",response_schema:"SiteRecordSchema"},{method:"PATCH",path:"/sites/:site_id",tag:"sites",summary:"Update site display name and optional generated-site locale for the current tenant.",status:"implemented",request_body_schema:"UpdateSiteRequestSchema",response_schema:"SiteRecordSchema"},{method:"DELETE",path:"/sites/:site_id",tag:"sites",summary:"Archive a site so it no longer appears in the tenant site list.",status:"implemented",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites/:site_id/plan",tag:"publish-entitlements",summary:"Get the current site plan and custom-domain entitlement.",status:"implemented",query_schema:"locale",response_schema:"GetSitePlanResponseSchema"},{method:"GET",path:"/sites/:site_id/workspace/source-files",tag:"sites",summary:"List source files available in the ready preview sandbox.",status:"implemented",response_schema:"WorkspaceSourceFileListItemSchema[]"},{method:"GET",path:"/sites/:site_id/workspace/source-file",tag:"sites",summary:"Read a source file from the ready preview sandbox.",status:"implemented",query_schema:"WorkspaceSourceFilePathQuerySchema",response_schema:"WorkspaceSourceFileResponseSchema"},{method:"POST",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Persist generated sitemap and advance the site to sitemap_ready.",status:"implemented",request_body_schema:"PersistSiteSitemapRequestSchema",response_schema:"PersistSiteSitemapResponseSchema"},{method:"GET",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Read the current sitemap for a site.",status:"implemented",response_schema:"SitemapRecordSchema"},{method:"POST",path:"/sites/:site_id/clarify/answers",tag:"clarify",summary:"Persist the Step 2 clarify answers (and the answered questions) into the site's clarify session.",status:"implemented",request_body_schema:"PersistClarifyAnswersRequestSchema",response_schema:"PersistClarifyAnswersResponseSchema"},{method:"PATCH",path:"/sites/:site_id/clarify/archetype",tag:"clarify",summary:"Switch the Step 2 industry archetype (user_picked) into the site's clarify session via an idempotent upsert.",status:"implemented",request_body_schema:"UpdateClarifyArchetypeRequestSchema",response_schema:"PersistClarifyAnswersResponseSchema",notes:["Independent of generate: materializes a clarify_sessions row when none exists (using the supplied questions) or updates only selected_archetype; never writes answers/completed_at. Forces source=user_picked."]},{method:"POST",path:"/internal/sites/:site_id/design-plan",tag:"design-plans",summary:"Persist a generated design plan version for a site (internal agent-only write).",status:"implemented",request_body_schema:"PersistSiteDesignPlanRequestSchema",response_schema:"PersistSiteDesignPlanResponseSchema",notes:["Guarded by the internal agent token; only the Workspace/Sitemap agent writes design plans."]},{method:"GET",path:"/internal/sites/:site_id/design-plan",tag:"design-plans",summary:"Read the current (latest version) design plan for a site (internal agent-only read).",status:"implemented",response_schema:"DesignPlanRecordSchema",notes:["Guarded by the internal agent token; only the Workspace/Sitemap agent reads design plans."]},{method:"GET",path:"/sites/:site_id/design-plan",tag:"design-plans",summary:"Read the current (latest version) design plan for a site so Workspace UI can inspect the generated design contract.",status:"implemented",response_schema:"DesignPlanRecordSchema"},{method:"GET",path:"/sites/:site_id/brief",tag:"briefs",summary:"Read the persisted Step 1 brief for a site so the Workspace Agent can seed first full-site generation without a new write surface.",status:"implemented",response_schema:"BriefRecordSchema"},{method:"PUT",path:"/sites/:site_id/brief/draft",tag:"briefs",summary:"Save a draft site's Step 1 brief without advancing the workflow.",status:"implemented",request_body_schema:"SaveBriefDraftRequestSchema",response_schema:"SaveBriefDraftResponseSchema",notes:["Only draft sites with generation_state=planning are writable; the brief row is upserted idempotently while site status, generation state, locale, and workflow stage remain unchanged."]},{method:"PATCH",path:"/sites/:site_id/brief",tag:"briefs",summary:"Create or update a draft site's Step 1 brief and advance it to Clarify without allowing later workflow states to roll back.",status:"implemented",request_body_schema:"UpdateBriefRequestSchema",response_schema:"UpdateBriefResponseSchema",notes:["Only draft sites with generation_state=planning are writable; missing brief rows are created on first save; identical retries after brief_submitted are idempotent."]},{method:"POST",path:"/internal/sites/:cms_site_id/external-sync",tag:"sites",summary:"Synchronize a trusted external CMS site URL into VCP by tenant_id + cms_site_id, creating a draft VCP site on first sync.",status:"implemented",request_body_schema:"ExternalSyncSiteRequestSchema",response_schema:"ExternalSyncSiteResponseSchema",notes:["This trusted external entry does not require browser login or internal bearer auth; tenant_id is written directly to tenants.id and the response uses the internal { code, data, message } success envelope."]},{method:"POST",path:"/sites/:site_id/snapshots",tag:"snapshots",summary:"Persist snapshot metadata without changing the current site snapshot.",status:"implemented",request_body_schema:"PersistSiteSnapshotRequestSchema",response_schema:"PersistSiteSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/promote",tag:"snapshots",summary:"Promote a site snapshot as the current workspace version.",status:"implemented",response_schema:"PromoteSiteSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/snapshots/:snapshot_id",tag:"snapshots",summary:"Read one tenant-scoped snapshot metadata record for a site.",status:"implemented",response_schema:"SnapshotRecordSchema"},{method:"DELETE",path:"/sites/:site_id/snapshots/:snapshot_id",tag:"snapshots",summary:"Delete a candidate snapshot (cleanup of superseded intermediate snapshots; refuses non-candidate/current/referenced).",status:"implemented",response_schema:"DeleteSiteSnapshotResponseSchema"},{method:"POST",path:"/agent-runs",tag:"agent-runs",summary:"Create an agent run for event persistence and replay.",status:"implemented",request_body_schema:"CreateAgentRunRequestSchema",response_schema:"CreateAgentRunResponseSchema"},{method:"POST",path:"/agent-runs/:run_id/events",tag:"agent-runs",summary:"Append one normalized AgentEvent to a run.",status:"implemented",request_body_schema:"AppendAgentEventRequestSchema",response_schema:"AppendAgentEventResponseSchema",notes:["Internal-only write surface: only internal-service callers may append, except browser (oidc) contexts may append run.failed (the WS connect-stage unlock path, equivalent to POST /agent-runs/workspace/cancel). All other oidc appends \u2014 run.finished, run.started, tool/system/progress, file/snapshot \u2014 are rejected with 403 FORBIDDEN. The browser sends user messages over the Workspace WebSocket (recorded server-side as user.message) and otherwise only reads the GET replay."]},{method:"GET",path:"/agent-runs/:run_id/events",tag:"agent-runs",summary:"Replay AgentEvents after a run-local sequence cursor.",status:"implemented",response_schema:"ListAgentEventsResponseSchema"},{method:"POST",path:"/internal/agent-runs/fail-stale-in-flight",tag:"agent-runs",summary:"Fail stale in-flight workspace runs (internal maintenance, cross-tenant sweep).",status:"implemented",response_schema:"FailStaleInFlightWorkspaceRunsResponseSchema",notes:["Internal maintenance endpoint guarded by InternalAgentAuthGuard (Bearer VCP_AGENT_INTERNAL_TOKEN, production fail-closed); the /internal/** prefix is exempt from browser auth middleware so the guard is the sole trust boundary. Not exposed to the browser via agent-proxy; called by an external admin cron / controlled ops script."]},{method:"GET",path:"/briefs",tag:"briefs",summary:"Brief resource summary endpoint until concrete brief APIs land.",status:"skeleton"},{method:"GET",path:"/clarify",tag:"clarify",summary:"Clarify resource summary endpoint; persisted answers write through POST /sites/:site_id/clarify/answers.",status:"skeleton"},{method:"GET",path:"/sitemaps",tag:"sitemaps",summary:"Sitemap resource summary endpoint until collection APIs land.",status:"skeleton"},{method:"GET",path:"/snapshots",tag:"snapshots",summary:"Snapshot resource summary endpoint until collection APIs land.",status:"skeleton"},{method:"GET",path:"/sandbox-sessions",tag:"sandbox-sessions",summary:"Sandbox session resource summary endpoint until preview APIs land.",status:"skeleton"},{method:"GET",path:"/deployments",tag:"deployments",summary:"Deployment resource summary endpoint until publish APIs land.",status:"skeleton"},{method:"GET",path:"/usage",tag:"usage",summary:"Usage resource summary endpoint until cost summaries land.",status:"skeleton"},{method:"GET",path:"/audit",tag:"audit",summary:"Audit resource summary endpoint until audit queries land.",status:"skeleton"},{method:"POST",path:"/sites/:site_id/workspace/runs",tag:"workspace",summary:"Start an asynchronous Workspace Agent run from the current snapshot.",status:"implemented",request_body_schema:"StartWorkspaceRunRequestSchema",response_schema:"StartWorkspaceRunResponseSchema",notes:["Long-running work must be event-driven and must not block API transactions."]},{method:"GET",path:"/sites/:site_id/workspace/runs/latest",tag:"workspace",summary:"Look up the latest workspace Agent run for a site so Step 4 re-entry can replay persisted events without re-triggering the model.",status:"implemented",response_schema:"LatestWorkspaceRunResponseSchema"},{method:"POST",path:"/sites/:site_id/preview-sessions",tag:"sandbox-sessions",summary:"Persist or update an on-demand preview session for a site.",status:"implemented",request_body_schema:"PersistPreviewSessionRequestSchema",response_schema:"PersistPreviewSessionResponseSchema"},{method:"GET",path:"/sites/:site_id/preview-sessions/current",tag:"sandbox-sessions",summary:"Read the latest tenant-scoped preview session for a site.",status:"implemented",response_schema:"SandboxSessionSchema"},{method:"POST",path:"/sites/:site_id/deployments",tag:"deployments",summary:"Queue an explicit user-confirmed deployment from a snapshot.",status:"implemented",request_body_schema:"CreateDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema",notes:["Before creating any deployment record or queue job, the API verifies the site's active subscription; an inactive subscription returns 403 DEPLOYMENT_ENTITLEMENT_REQUIRED, while an unavailable entitlement source prevents deployment creation.","The API returns after creating the deployment record and queue job; worker-service claims deployment_jobs for build and Cloudflare publish."]},{method:"GET",path:"/sites/:site_id/deployments/current",tag:"deployments",summary:"Read the latest deployment for workspace refresh recovery.",status:"implemented",response_schema:"CurrentDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/status",tag:"deployments",summary:"Read current in-flight deployment and latest released deployment.",status:"implemented",response_schema:"GetDeploymentsStatusResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/:deployment_id",tag:"deployments",summary:"Read one tenant-scoped deployment for status polling.",status:"implemented",response_schema:"GetDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/cms/collections",tag:"cms",summary:"List CMS collections for a site.",status:"planned"},{method:"POST",path:"/sites/:site_id/cms/collections",tag:"cms",summary:"Create a CMS collection bound to generated content.",status:"planned"},{method:"GET",path:"/sites/:site_id/cms/collections/:collection_id/entries",tag:"cms",summary:"List CMS entries for a collection.",status:"planned"},{method:"POST",path:"/sites/:site_id/cms/collections/:collection_id/entries",tag:"cms",summary:"Create a CMS entry.",status:"planned"},{method:"PATCH",path:"/sites/:site_id/cms/collections/:collection_id/entries/:entry_id",tag:"cms",summary:"Update a CMS entry.",status:"planned"},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/version-record",tag:"versions",summary:"Record the sandbox accepted git commit for a promoted snapshot version.",status:"implemented",request_body_schema:"RecordSnapshotVersionRequestSchema",response_schema:"RecordSnapshotVersionResponseSchema"},{method:"GET",path:"/sites/:site_id/versions",tag:"versions",summary:"List snapshot-backed site versions.",status:"implemented",response_schema:"ListSiteVersionsResponseSchema"},{method:"POST",path:"/sites/:site_id/versions/:snapshot_id/restore",tag:"versions",summary:"Restore a site to an earlier snapshot version.",status:"implemented",response_schema:"RestoreSiteSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/domains",tag:"custom-domains",summary:"List the site default domain and custom domains.",status:"implemented",response_schema:"ListSiteDomainsResponseSchema"},{method:"POST",path:"/sites/:site_id/domains",tag:"custom-domains",summary:"Bind a custom domain for site publishing.",status:"implemented",request_body_schema:"BindSiteDomainRequestSchema",response_schema:"BindSiteDomainResponseSchema",notes:["Returns 403 CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED and never calls the downstream bind API when the site has no active subscription or subscription status cannot be confirmed."]},{method:"GET",path:"/sites/:site_id/domains/:hostname",tag:"custom-domains",summary:"Get DNS verification detail for a custom domain.",status:"implemented",response_schema:"GetSiteDomainDetailResponseSchema"},{method:"POST",path:"/sites/:site_id/domains/:hostname/verify",tag:"custom-domains",summary:"Refresh DNS verification status for a custom domain.",status:"implemented",response_schema:"VerifySiteDomainResponseSchema"},{method:"DELETE",path:"/sites/:site_id/domains/:hostname",tag:"custom-domains",summary:"Delete a non-primary custom domain.",status:"implemented",response_schema:"DeleteSiteDomainResponseSchema"},{method:"GET",path:"/admin/tenants",tag:"admin",summary:"Admin tenant listing.",status:"planned"},{method:"GET",path:"/usage/summary",tag:"usage",summary:"Summarize tenant usage and cost controls.",status:"planned"}],Tp=[{method:"POST",path:"/v1/agent/clarify/:site_id",tag:"clarify",summary:"Stream Step 2 clarify questions as SSE; event_order includes optional skill.selecting, skill.selected, clarify.archetype_proposals, and run.failed on errors.",status:"implemented",request_body_schema:"ClarifyRunInputSchema without tenant_id/site_id",event_schema:"ClarifyStreamEventSchema",event_order:["run.started","skill.selecting","skill.selected","clarify.partial","clarify.archetype_proposals","clarify.finished","run.failed"]},{method:"POST",path:"/v1/agent/sitemap/:site_id",tag:"sitemap",summary:"Stream Step 3 sitemap generation as SSE; event_order includes sitemap.partial and run.failed on errors.",status:"implemented",request_body_schema:"SitemapRunInputSchema public body without server-injected fields",event_schema:"SitemapStreamEventSchema",event_order:["run.started","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","run.failed"]}],Vo=e.object({id:e.string().min(1),role:e.enum(["system","user","assistant"]),metadata:e.unknown().optional(),parts:e.array(xe).min(1)}),Kn=Vo.extend({role:e.literal("user")}),kp=e.object({base_snapshot_id:e.string().min(1).optional(),message:Kn.optional(),client_run_key:e.string().min(1).max(200).optional()}).superRefine((t,n)=>{ce(t.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),zo=e.object({path:e.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:e.string().min(1),base_snapshot_id:e.string().min(1),run_kind:Te}),Ap=e.object({agent_run:q,websocket:zo,next_step:e.literal("workspace_socket")}),Pp=e.object({agent_run:q}),vp=e.object({agent_type:e.enum(["clarify","sitemap","workspace"])}),Cp=e.object({agent_run:q}),jp=e.enum(["client.message.create","client.run.cancel","client.tool.approve","server.run.started","server.user.message","server.assistant.delta","server.tool.started","server.tool.completed","server.workspace.suggestions","workspace.plan.created","workspace.worker.updated","workspace.task.updated","server.patch.applied","server.sitemap.updated","server.snapshot.created","server.preview.invalidated","preview.build.started","preview.build.succeeded","preview.build.failed","server.run.finished","server.run.failed","server.error","server.activity.started","server.activity.updated","server.activity.finished","server.activity.failed"]),x=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),run_id:e.string().min(1).optional(),correlation_id:e.string().min(1).optional(),seq:e.number().int().positive().optional(),sent_at:e.string().min(1)}),$o=e.object({key:e.string().min(1),label:e.string().min(1),source_file:e.string().min(1).optional(),component_name:e.string().min(1).optional(),opening_element_range:e.object({start_line:e.number().int().positive(),start_column:e.number().int().nonnegative(),end_line:e.number().int().positive(),end_column:e.number().int().nonnegative()}).optional(),structural_path:e.string().min(1).optional(),text_preview:e.string().min(1).optional()}),Yo=e.discriminatedUnion("type",[x.extend({type:e.literal("client.message.create"),payload:e.object({client_message_id:e.string().min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),selected_component:$o.optional(),message:Kn,base_snapshot_id:e.string().min(1).optional()})}),x.extend({type:e.literal("client.run.cancel"),payload:e.object({run_id:e.string().min(1),reason:e.string().min(1).optional()})}),x.extend({type:e.literal("client.tool.approve"),payload:e.object({tool_call_id:e.string().min(1),decision:e.enum(["approve","reject"]),reason:e.string().min(1).optional()})})]),Xo=e.discriminatedUnion("type",[x.extend({type:e.literal("server.run.started"),payload:e.object({run_id:e.string().min(1),agent_type:e.literal("workspace")})}),x.extend({type:e.literal("server.user.message"),payload:e.object({client_message_id:e.string().min(1),message_id:e.string().min(1),parts:e.array(xe).min(1),in_reply_to_tool_call_id:e.string().min(1).optional()})}),x.extend({type:e.literal("server.assistant.delta"),payload:e.object({message_id:e.string().min(1),parts:e.array(xe).min(1),status:e.enum(["streaming","ready"])})}),x.extend({type:e.literal("server.tool.started"),payload:e.object({tool_call_id:e.string().min(1),name:e.string().min(1),summary:e.string().min(1)})}),x.extend({type:e.literal("server.tool.completed"),payload:e.object({tool_call_id:e.string().min(1),name:e.string().min(1),result_summary:e.string().min(1)})}),x.extend({type:e.literal("server.workspace.suggestions"),payload:Dn.extend({run_id:e.string().min(1)}).strict()}),x.extend({type:e.literal("workspace.plan.created"),payload:e.object({plan_id:e.string().min(1),run_kind:Te,groups:e.array(rt),tasks:e.array(ct),dependencies:e.array(mt),expected_outputs:e.array(D),diagnostics:ot,summary:Mn})}),x.extend({type:e.literal("workspace.worker.updated"),payload:e.object({group_id:e.string().min(1),phase:at,status:H,task_counts:Ln,target_paths:e.array(D),diagnostics:e.array(e.string().min(1))})}),x.extend({type:e.literal("workspace.task.updated"),payload:e.object({task_id:e.string().min(1),group_id:e.string().min(1),status:H,target_path:D,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(st).optional()})}),x.extend({type:e.literal("server.patch.applied"),payload:e.object({patch_batch_id:e.string().min(1),changed_files:e.array(e.string().min(1)),sitemap_resync_queued:e.boolean()})}),x.extend({type:e.literal("server.sitemap.updated"),payload:e.object({sitemap_id:e.string().min(1),version:e.number().int().positive(),reason:e.string().min(1)})}),x.extend({type:e.literal("server.snapshot.created"),payload:e.object({snapshot_id:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/)})}),x.extend({type:e.literal("server.preview.invalidated"),payload:e.object({reason:e.string().min(1),next_preview_url:e.string().url().optional()})}),x.extend({type:e.literal("preview.build.started"),payload:e.object({snapshot_id:e.string().min(1)})}),x.extend({type:e.literal("preview.build.succeeded"),payload:e.object({snapshot_id:e.string().min(1)})}),x.extend({type:e.literal("preview.build.failed"),payload:e.object({snapshot_id:e.string().min(1),message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean()})}),x.extend({type:e.literal("server.run.finished"),payload:e.object({run_id:e.string().min(1),snapshot_id:e.string().min(1)})}),x.extend({type:e.literal("server.run.failed"),payload:e.object({run_id:e.string().min(1),error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),outcome:e.literal("retained_previous").optional()})}),x.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})}),x.extend({type:e.literal("server.activity.started"),payload:e.object({activity_id:e.string().min(1),parent_activity_id:e.string().min(1).optional(),kind:Rn,title:e.string().min(1).max(200),title_code:B.optional(),detail:e.string().max(360).optional(),detail_code:B.optional(),locks_input:e.boolean()})}),x.extend({type:e.literal("server.activity.updated"),payload:e.object({activity_id:e.string().min(1),title:e.string().min(1).max(200).optional(),title_code:B.optional(),detail:e.string().max(360).optional(),detail_code:B.optional()})}),x.extend({type:e.literal("server.activity.finished"),payload:e.object({activity_id:e.string().min(1)})}),x.extend({type:e.literal("server.activity.failed"),payload:e.object({activity_id:e.string().min(1),detail:e.string().max(360).optional()})})]),Np=e.union([Yo,Xo]),wp={path:"/v1/workspace/sites/:site_id/socket",protocol:"ws",status:"implemented",inbound_message_schema:"WorkspaceClientMessageSchema",outbound_message_schema:"WorkspaceServerMessageSchema",query_parameters:[{name:"run_id",required:!1,schema:"string",summary:"Workspace run id returned by the API run-start response."},{name:"run_kind",required:!1,schema:"WorkspaceRunKindSchema",summary:"Workspace run mode; initial_generation can auto-start when base_snapshot_id is present."},{name:"base_snapshot_id",required:!1,schema:"string",summary:"Authoritative base snapshot id for this workspace run."}],ai_sdk_ui_compatible:!0,notes:["Assistant UI output is carried as AI SDK UIMessage parts, including text, data-*, and tool-* parts.","Operational AgentEvents remain persisted separately for replay and audit."]},Fn=e.string().regex(/^sha256:[a-f0-9]{64}$/),Qo=e.enum(["create","update","delete","str_replace"]),Gn=e.enum(["sitemap_resync","smoke_test","prepare_preview"]),Zo=e.object({old_string:e.string().min(1).describe("Exact text to find in the current file. Must match the file uniquely; include enough surrounding context (usually 2-4 adjacent lines)."),new_string:e.string().describe("Replacement text. May be empty to delete the matched text."),replace_all:e.boolean().optional()}).strict(),Jo=e.object({path:D,operation:Qo,expected_hash:Fn.optional(),full_content:e.string().describe("Complete file content for create/update patches. It is passed as a JSON string, so every double quote in source code must be valid JSON; avoid ASCII double quotes inside JSX attribute values and use corner quotes like \u300C\u751F\u65E5\u5FEB\u4E50\u300D for visitor-facing quoted examples.").optional(),edits:e.array(Zo).min(1).max(20).optional()}).strict().superRefine((t,n)=>{let s=t.full_content!==void 0;if(t.operation==="delete"){s&&n.addIssue({code:"custom",path:["full_content"],message:"delete patches must not include full_content"}),t.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"});return}if(pr(t.path)||n.addIssue({code:"custom",path:["path"],message:"Static App Router page paths must use lowercase ASCII kebab-case public segments."}),t.operation==="str_replace"){t.full_content!==void 0&&n.addIssue({code:"custom",path:["full_content"],message:"str_replace patches must not include full_content"}),(!t.edits||t.edits.length===0)&&n.addIssue({code:"custom",path:["edits"],message:"str_replace patches must include a non-empty edits array"});return}s||n.addIssue({code:"custom",path:["full_content"],message:"create/update patches must include full_content"}),t.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"})}),er=e.object({kind:e.enum(["block","page","site","chrome"]),id:e.string().min(1).max(120)}),tr=e.object({base_key:e.string().min(1).max(120).regex(/^[A-Za-z0-9._:-]+$/).refine(t=>!t.includes(".."),{message:"base_key must not contain '..'"}),owner:er,count:e.number().int().min(1).max(12),query:e.string().min(1).max(400),role:e.enum(["hero","section","card","gallery","testimonial","decorative","site_background","nav_background","footer_background"]),orientation:e.enum(["landscape","portrait","square"]).optional(),altHint:e.string().min(1).max(300)}),Bn=e.object({site_id:e.string().min(1),base_snapshot_id:e.string().min(1),reason:e.string().min(1),patches:e.array(Jo).min(1),media_requests:e.array(tr).max(24).optional(),post_actions:e.array(Gn).optional()});function qn(t,n){let s=new Set;for(let[c,r]of t.patches.entries())s.has(r.path)&&n.addIssue({code:"custom",path:["patches",c,"path"],message:`Duplicate patch path: ${r.path}`}),s.add(r.path)}var Dp=Bn.superRefine(qn),Op=Bn.omit({base_snapshot_id:!0}).extend({site_id:e.string().min(1).optional()}).superRefine(qn),nr=O,ir=e.object({path:nr,operation:e.enum(["upsert","delete"]).optional()}),Mp=e.object({files:e.array(ir).min(1)}).strict(),ar=e.enum(["BASE_SNAPSHOT_NOT_FOUND","PATCH_TARGET_NOT_FOUND","PATCH_TARGET_ALREADY_EXISTS","PATCH_EXPECTED_HASH_MISMATCH","PATCH_DIFF_UNSUPPORTED","PATCH_PROTECTED_FILE","PATCH_VALIDATION_FAILED","PATCH_MEDIA_REFERENCE_NOT_DECLARED","PATCH_BATCH_INVALID","PATCH_BATCH_FAILED","PATCH_BATCH_TOO_LARGE","STR_REPLACE_NOT_FOUND","STR_REPLACE_NOT_UNIQUE","STR_REPLACE_BINARY_FILE","STR_REPLACE_REQUIRES_READ"]),sr=e.object({status:e.literal("applied"),patch_batch_id:e.string().min(1),site_id:e.string().min(1),base_snapshot_id:e.string().min(1),snapshot_id:e.string().min(1),manifest_hash:Fn,object_key:e.string().min(1),changed_files:e.array(D).min(1),post_actions_queued:e.array(Gn),dropped_protected_files:e.array(e.string().min(1)).min(1).optional()}),or=e.object({status:e.literal("failed"),code:ar,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),Lp=e.discriminatedUnion("status",[sr,or]),Up=e.object({ok:e.literal(!0)}),Wn=O,rr=e.enum(["text","binary"]),Hn=e.object({path:Wn,kind:rr,language:e.string().min(1).nullable(),size_bytes:e.number().int().nonnegative()}),Kp=e.object({path:Wn}),cr=Hn.extend({kind:e.literal("text"),language:e.string().min(1),content:e.string()}),mr=Hn.extend({kind:e.literal("binary"),language:e.null(),mime_type:e.string().min(1),content_base64:e.string().min(1)}),Fp=e.union([cr,mr]);function ce(t){return typeof t=="string"?/authorization\s*:|bearer\s+|token\s*=|secret\s*=|api[_-]?key\s*=|access[_\s-]?key\s*=|\bsk-[a-z0-9_-]{20,}|eyJ[a-z0-9_-]{10,}\.[a-z0-9_-]{10,}\.[a-z0-9_-]{10,}/i.test(t):!t||typeof t!="object"?!1:Array.isArray(t)?t.some(n=>ce(n)):Object.entries(t).some(([n,s])=>lr(n)||ce(s))}function lr(t){let n=t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/\s+/g,"_").toLowerCase();return/(^|[_-])(authorization|token|secret|api[_-]?key|apikey|access[_-]?key|accesskey)([_-]|$)/.test(n)}function Vn(t){let n=t.split("/");return t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&n.every(s=>s!==""&&s!=="."&&s!=="..")}function pr(t){let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(t);if(!n)return!0;let c=(n[1]??"").split("/").filter(m=>m.length>0);return c.some(m=>m.startsWith("_"))?!0:c.filter(m=>!m.startsWith("@")&&!/^\(.+\)$/.test(m)).map(m=>m.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(m=>m.length>0).every(m=>/^\[.*\]$/.test(m)||J.test(`/${m}`))}var zn=e.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),dr=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),sandbox_id:e.string().min(1).nullable(),status:zn,source_snapshot_id:e.string().min(1).nullable(),last_snapshot_id:e.string().min(1).nullable(),preview_url:e.string().url().nullable(),last_activity_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Gp=e.object({session_id:e.string().min(1).optional(),sandbox_id:e.string().min(1).optional(),source_snapshot_id:e.string().min(1).optional(),last_snapshot_id:e.string().min(1),status:zn,preview_url:e.string().url().optional()}),Bp=e.object({preview_session:dr,next_step:e.literal("preview")}),qp=e.object({failed_count:e.number().int().nonnegative()}),Wp=e.object({site_id:e.string().min(1)}),Hp=e.object({status:e.enum(["cancelled","no_active_run"]),agent_run:q.nullable()});export{Rn as ActivityKindSchema,B as ActivityTitleCodeSchema,_n as AgentErrorCategorySchema,Ve as AgentEventRecordSchema,Un as AgentEventSchema,On as AgentEventTypeSchema,En as AgentModelRouteSchema,jo as AgentPlanStepSchema,fn as AgentRunKindSchema,q as AgentRunRecordSchema,Fs as AgentRunStatusSchema,yn as AgentRunTypeSchema,Uo as AiSdkUiDataPartSchema,Fo as AiSdkUiErrorPartSchema,Oo as AiSdkUiFilePartSchema,xe as AiSdkUiMessagePartSchema,Vo as AiSdkUiMessageSchema,Do as AiSdkUiReasoningPartSchema,Lo as AiSdkUiSourceDocumentPartSchema,Mo as AiSdkUiSourceUrlPartSchema,Go as AiSdkUiStepStartPartSchema,wo as AiSdkUiTextPartSchema,Ko as AiSdkUiToolPartSchema,xp as ApiContractStatusSchema,Ws as ApiErrorEnvelopeSchema,V as ApiResponseSchema,_p as AppendAgentEventRequestSchema,yp as AppendAgentEventResponseSchema,ar as ApplyPatchBatchErrorCodeSchema,or as ApplyPatchBatchFailureSchema,Dp as ApplyPatchBatchInputSchema,Jo as ApplyPatchBatchPatchSchema,Gn as ApplyPatchBatchPostActionSchema,Lp as ApplyPatchBatchResultSchema,sr as ApplyPatchBatchSuccessSchema,Op as ApplyPatchBatchToolInputSchema,Zo as ApplyPatchEditSchema,Qo as ApplyPatchOperationSchema,bn as ArchetypeProposalSchema,os as BINDING_STATUSES,an as BindSiteDomainDataSchema,qm as BindSiteDomainRequestSchema,yl as BindSiteDomainResponseSchema,Tn as BlockGenerationContextSchema,Xl as BlockMediaIntentSchema,so as BlockSchema,kn as BrandingSchema,Ze as BriefRecordSchema,ym as CHAT_COPY,_m as CLARIFICATION_COPY,Zt as CURRENT_EDIT_ENGINE_VERSION,Bm as CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED_ERROR_CODE,ls as CUSTOM_DOMAIN_STATUSES,Wp as CancelActiveWorkspaceRunRequestSchema,Hp as CancelActiveWorkspaceRunResponseSchema,An as ChromeDesignSchema,io as ChromeFooterDesignSchema,no as ChromeFooterShellSchema,eo as ChromeHeaderDesignSchema,Js as ChromeHeaderShellSchema,ao as ChromeMobileNavDesignSchema,Ds as ClarifyQuestionOptionSchema,Os as ClarifyQuestionSchema,js as ClarifyQuestionTypeSchema,Xe as ClarifyQuestionsSchema,il as ClarifyRunInputSchema,To as ClarifySessionRecordSchema,al as ClarifyStreamEventSchema,Om as CmsCollectionBindingSchema,Pm as ConnectDynamicCollectionInputSchema,jm as ConnectFormInputSchema,$e as ConversionHintsSchema,$l as CreateAgentRunConflictResponseSchema,Al as CreateAgentRunRequestSchema,Pl as CreateAgentRunResponseSchema,Fl as CreateDeploymentRequestSchema,Gl as CreateDeploymentResponseSchema,Er as CreateDocumentUploadRequestSchema,Ar as CreateImageUploadRequestSchema,Sr as CreateInputSourceRequestSchema,pl as CreateSiteBriefRequestSchema,Rl as CreateSiteBriefResponseSchema,dl as CreateSiteDraftRequestSchema,ll as CreateSiteInputSchema,Jn as CreateTextInputSourceRequestSchema,ei as CreateUrlInputSourceRequestSchema,Bl as CurrentDeploymentResponseSchema,ds as CustomDomainDnsRecordPurposeSchema,gs as CustomDomainDnsRecordSchema,us as CustomDomainDnsRecordStatusSchema,ps as CustomDomainStatusSchema,Ss as DEFAULT_FONTS,Ii as DEFAULT_SITE_LOCALE,Kl as DEPLOYMENT_ENTITLEMENT_REQUIRED_ERROR_CODE,qs as DEPLOYMENT_REALTIME_CHANNEL,lt as DEPLOYMENT_STATUSES,zl as DEPLOYMENT_WEBSOCKET_CONTRACT,br as DOCUMENT_EXTENSION_WHITELIST,_r as DOCUMENT_MIME_WHITELIST,hs as DefaultPublishDomainSchema,rn as DeleteSiteDomainDataSchema,xl as DeleteSiteDomainResponseSchema,Nl as DeleteSiteSnapshotResponseSchema,Ie as DeploymentRecordSchema,Vl as DeploymentRedisPubSubEventSchema,tt as DeploymentStatusSchema,un as DeploymentStatusSummarySchema,Hl as DeploymentWsServerMessageSchema,Bs as DeploymentWsServerMessageTypeSchema,vo as DesignPlanGenerationOutcomeSchema,Co as DesignPlanGenerationReasonSchema,Jl as DesignPlanPatchSchema,ko as DesignPlanRecordSchema,Pn as DesignPlanSchema,Yl as DesignTokensSchema,Em as EDIT_ENGINE_VERSION_HEADER,xm as EDIT_ENGINE_VERSION_SOURCE_HEADER,Sm as ERROR_COPY,qe as EditEngineVersionParseError,Sl as ExternalSyncSiteRequestSchema,bl as ExternalSyncSiteResponseSchema,Xn as ExtractedFactKindSchema,le as ExtractedFactSchema,is as FIELD_TYPES,ks as FONT_PAIRINGS,as as FORM_FIELD_TYPES,qp as FailStaleInFlightWorkspaceRunsResponseSchema,Jt as FieldDeclSchema,to as FooterShellSurfaceSchema,ss as FormFieldDeclSchema,ql as GetDeploymentResponseSchema,Wl as GetDeploymentsStatusResponseSchema,on as GetSiteDomainDetailDataSchema,El as GetSiteDomainDetailResponseSchema,tn as GetSitePlanDataSchema,Il as GetSitePlanResponseSchema,Qs as HeaderShellBehaviorSchema,Zs as HeaderShellShapeSchema,Xs as HeaderShellSurfaceSchema,Ys as HeaderShellVariantSchema,Ir as IMAGE_EXTENSION_WHITELIST,Rr as IMAGE_MIME_WHITELIST,Ri as ISO_639_3_TO_SITE_LOCALE,ti as ImageRoleSchema,Kn as InboundUserMessageSchema,Yn as InputBundleStatusSchema,de as InputConflictSchema,Pr as InputContextBundleSchema,Zn as InputSourceSchema,Pe as InputSourceStatusSchema,Ae as InputSourceTypeSchema,_i as LEGACY_SITE_LOCALE_CODES,vp as LatestAgentRunQuerySchema,Cp as LatestAgentRunResponseSchema,Pp as LatestWorkspaceRunResponseSchema,Ep as ListAgentEventsQuerySchema,fp as ListAgentEventsResponseSchema,nn as ListSiteDomainsDataSchema,_l as ListSiteDomainsResponseSchema,Ol as ListSiteVersionsResponseSchema,fr as MAX_DOCUMENT_SOURCES_PER_SITE,yr as MAX_DOCUMENT_UPLOAD_BYTES,kr as MAX_IMAGE_SOURCES_PER_SITE,Tr as MAX_IMAGE_UPLOAD_BYTES,Zl as MediaAssetSchema,zs as MediaAttributionSchema,er as MediaRequestOwnerSchema,Ye as MotionLevelSchema,fs as NEXT_FONT_DISPLAY_NAMES,re as NEXT_FONT_REGISTRY,J as PAGE_SLUG_PATTERN,z as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,vn as PageSchema,oo as PageSlugSchema,pp as PersistClarifyAnswersRequestSchema,dp as PersistClarifyAnswersResponseSchema,Gp as PersistPreviewSessionRequestSchema,Bp as PersistPreviewSessionResponseSchema,gp as PersistSiteDesignPlanRequestSchema,hp as PersistSiteDesignPlanResponseSchema,mp as PersistSiteSitemapRequestSchema,lp as PersistSiteSitemapResponseSchema,vl as PersistSiteSnapshotRequestSchema,Cl as PersistSiteSnapshotResponseSchema,Cs as PositioningPrefillSchema,He as PositioningSourceSchema,Ll as PrepareVersionPreviewRequestSchema,Ul as PrepareVersionPreviewResponseSchema,jl as PromoteSiteSnapshotResponseSchema,ms as PublishEntitlementSchema,rs as PublishPlanFeatureSnapshotSchema,cs as PublishPlanSchema,bm as REFUSAL_COPY,Rp as REST_API_ENDPOINTS,wl as RecordSnapshotVersionRequestSchema,Dl as RecordSnapshotVersionResponseSchema,Qn as ReferencePagePatternSchema,pe as ReferenceSignalsSchema,Am as ResolvedFieldSchema,Nm as ResolvedFormFieldSchema,Ip as RestApiMethodSchema,Ml as RestoreSiteSnapshotResponseSchema,In as RouteGenerationCardSchema,yt as SELECTABLE_SITE_LOCALE_CODES,Dc as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,Oi as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,Di as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,Mi as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,Nt as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,gc as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,Va as SITE_EDIT_RUNTIME_CONTAINER_TAGS,za as SITE_EDIT_RUNTIME_TEXT_TAGS,Ha as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,oc as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,ii as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,pt as SITE_EDIT_SOURCE_ALLOWED_DIRS,ni as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,ve as SITE_EDIT_SOURCE_DELETE_CAPABILITY,ai as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,yi as SITE_LOCALE_CODES,cl as SITE_PLANNING_FROZEN_ERROR_CODE,ml as SITE_PLANNING_LOCKED_ERROR_CODE,Tp as SSE_STREAMS,Ur as SUPPORTED_SITE_LOCALES,dr as SandboxSessionSchema,zn as SandboxSessionStatusSchema,hl as SaveBriefDraftRequestSchema,kl as SaveBriefDraftResponseSchema,oe as SiteCustomDomainSchema,xn as SiteDesignContextSchema,Ns as SiteDesignDensitySchema,ws as SiteDesignMotionLevelSchema,he as SiteEditBoundaryKindSchema,vi as SiteEditCapabilityConstraintSchema,Ai as SiteEditCapabilityModeSchema,ge as SiteEditCapabilityModeViewSchema,Ni as SiteEditClassNameSourceDiagnosticSchema,W as SiteEditClassNameSourceRangeSchema,Tt as SiteEditClassNameSourceSchema,Qr as SiteEditClassNameSourceStyleContextSchema,Rt as SiteEditClassNameSourceStylesheetSchema,De as SiteEditClassNameSourceWriteIntentSchema,zr as SiteEditCommandDiagnosticSchema,Ci as SiteEditCommandErrorSchema,Pi as SiteEditConstraintKindSchema,Ma as SiteEditDynamicConfidenceSchema,Ua as SiteEditDynamicDataBindingSchema,Vt as SiteEditDynamicDataDetailSchema,zt as SiteEditDynamicDataSummarySchema,La as SiteEditDynamicEvidenceSchema,Ht as SiteEditDynamicSourceKindSchema,Da as SiteEditDynamicSourceTypeSchema,Oa as SiteEditDynamicTargetKindSchema,Ga as SiteEditEffectiveWriteTargetSchema,Oe as SiteEditElementPropertySchema,jc as SiteEditEventSchema,Ke as SiteEditExternalSourceKindSchema,Jr as SiteEditGetClassNameSourceCommandResultSchema,Zr as SiteEditGetClassNameSourceResultSchema,Ia as SiteEditHistoryReadOnlyRecoveryStatusSchema,ya as SiteEditHistoryRecoveryCodeSchema,fa as SiteEditHistoryRecoveryDiagnosticSchema,Oc as SiteEditHistoryStatusModeSchema,Mc as SiteEditHistoryStatusSchema,Ea as SiteEditHistoryUnavailableReasonSchema,Ra as SiteEditHistoryUnavailableStatusSchema,xa as SiteEditHistoryWritableStatusSchema,gm as SiteEditInitializeSessionInputSchema,ha as SiteEditInsertNodeSpecSchema,Bi as SiteEditMaterializationDataRequirementsSchema,Gi as SiteEditMaterializationEntrySchema,Fi as SiteEditMaterializationExportSchema,Ki as SiteEditMaterializationFileSchema,kt as SiteEditMaterializationPathTemplateSchema,At as SiteEditMaterializationSchema,Ot as SiteEditMoveTargetSchema,ee as SiteEditMutationContextSchema,Se as SiteEditNodeCapabilitySnapshotSchema,nm as SiteEditObjectCapabilitiesSchema,am as SiteEditObjectDetailSchema,om as SiteEditObjectEditContextSchema,rm as SiteEditObjectStyleDetailSchema,sm as SiteEditObjectSummarySchema,kc as SiteEditOperationCommandResultSchema,Ft as SiteEditOperationErrorCodeSchema,Gt as SiteEditOperationErrorSchema,Sa as SiteEditOperationParamsSchema,ye as SiteEditOperationPayloadSchema,ba as SiteEditOperationRequestSchema,Bt as SiteEditOperationSelectionRefSchema,wa as SiteEditOperationSummarySchema,Mt as SiteEditOperationTargetSchema,ie as SiteEditOperationTypeSchema,Dt as SiteEditOperationValueSchema,hc as SiteEditPageCompositionAnyVersionSchema,Ji as SiteEditPageCompositionAtomicKindSchema,ia as SiteEditPageCompositionBoundaryModeSchema,Vi as SiteEditPageCompositionBusinessMemberSchema,Wi as SiteEditPageCompositionContainerSchema,ne as SiteEditPageCompositionDiagnosticSchema,_e as SiteEditPageCompositionErrorCodeSchema,Ct as SiteEditPageCompositionPlacementTargetSchema,zi as SiteEditPageCompositionPlacementUnitSchema,Qi as SiteEditPageCompositionRuntimeRefSchema,Xi as SiteEditPageCompositionSchema,Zi as SiteEditPageCompositionSourceMemberKindSchema,Hi as SiteEditPageCompositionSourceMemberSchema,wt as SiteEditPageCompositionSourceRangeSchema,$i as SiteEditPageCompositionSupportedSchema,Yi as SiteEditPageCompositionUnsupportedSchema,na as SiteEditPageCompositionV2BusinessMemberSchema,ea as SiteEditPageCompositionV2ContainerSchema,sa as SiteEditPageCompositionV2PlacementRelationSchema,ra as SiteEditPageCompositionV2PlacementSchema,aa as SiteEditPageCompositionV2PlacementUnitSchema,pa as SiteEditPageCompositionV2Schema,ta as SiteEditPageCompositionV2SourceMemberSchema,ma as SiteEditPageCompositionV2SupportedSchema,la as SiteEditPageCompositionV2UnsupportedSchema,oa as SiteEditPageCompositionV2WriteModeSchema,ca as SiteEditPageCompositionVisualAnchorSchema,vt as SiteEditPagePlacementOptionSchema,Le as SiteEditPagePlacementSchema,jt as SiteEditPageUnitTargetSchema,Aa as SiteEditPatchPlanPatchSchema,Kc as SiteEditPatchPlanSchema,se as SiteEditProvenanceChainSchema,Ba as SiteEditProvenanceHopSchema,tm as SiteEditRenderDocumentSchema,ae as SiteEditRenderEntryRefSchema,Ka as SiteEditRenderEntrySchema,Wt as SiteEditRenderPageCompositionSchema,ja as SiteEditRenderPageCompositionSupportedSchema,Na as SiteEditRenderPageCompositionUnsupportedSchema,Ca as SiteEditRenderPagePlacementSchema,rc as SiteEditRequiredMutationContextEnvelopeSchema,ui as SiteEditResolveSourceLocationInputSchema,Yt as SiteEditSemanticSourceSchema,Tc as SiteEditSignedOperationRequestSchema,dt as SiteEditSourceDeleteCapabilitySchema,oi as SiteEditSourceDirectoryPathSchema,pi as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,di as SiteEditSourceFileBinaryResponseSchema,jr as SiteEditSourceFileKindSchema,ri as SiteEditSourceFileListItemSchema,wr as SiteEditSourceFileResponseSchema,li as SiteEditSourceFileTextResponseSchema,Me as SiteEditSourceIdentitySchema,gi as SiteEditSourceLocationRangeSchema,Dr as SiteEditSourceLocationSchema,Wa as SiteEditSourceLocatorRangeSchema,Ge as SiteEditSourceLocatorSchema,O as SiteEditSourcePathSchema,ut as SiteEditSourceTreeNodeSchema,Nr as SiteEditSourceTreeResponseSchema,ci as SiteEditSourceTreeTruncationReasonSchema,mi as SiteEditSourceTreeTruncationSchema,Kt as SiteEditStyleBreakpointSchema,im as SiteEditStyleModelSchema,Lt as SiteEditStylePropertySchema,Xt as SiteEditStyleSourceSchema,Ut as SiteEditStyleStateModeSchema,Fe as SiteEditTextSegmentSchema,$t as SiteEditTextSourceSchema,Fa as SiteEditWriteTargetSchema,Us as SiteGenerationStateSchema,G as SiteLocaleSchema,Ql as SiteMediaIntentSchema,X as SiteRecordSchema,Ms as SiteStatusSchema,Gs as SiteVersionListItemSchema,et as SiteVersionRecordSchema,ap as SitemapAddBlockInputSchema,it as SitemapAnswerSchema,np as SitemapChangeBlockVariantInputSchema,ho as SitemapDeleteBlockInputSchema,go as SitemapEditActorSchema,_o as SitemapEditErrorCodeSchema,fo as SitemapEditFailureSchema,bo as SitemapEditOperationSchema,op as SitemapEditResultSchema,yo as SitemapEditSuccessSchema,Eo as SitemapGenerationOutcomeSchema,xo as SitemapGenerationReasonSchema,jn as SitemapGenerationStageSchema,ep as SitemapModelOutputSchema,po as SitemapModelPageSchema,tp as SitemapMoveBlockInputSchema,mo as SitemapNavigationHrefSchema,Ro as SitemapRecordSchema,rp as SitemapRunInputSchema,Re as SitemapSchema,cp as SitemapStreamEventSchema,So as SitemapUpdateBlockInstructionInputSchema,ip as SitemapUpdateBlockPropsInputSchema,Vs as SitemapUserChoiceSchema,Q as SkillSelectionSchema,$s as SkillSelectionSourceSchema,Fn as SnapshotContentHashSchema,D as SnapshotFilePathSchema,me as SnapshotRecordSchema,Je as SnapshotStatusSchema,kp as StartWorkspaceRunRequestSchema,Ap as StartWorkspaceRunResponseSchema,As as THEME_PRESETS,gl as UpdateBriefRequestSchema,Tl as UpdateBriefResponseSchema,up as UpdateClarifyArchetypeRequestSchema,ul as UpdateSiteRequestSchema,sn as VerifySiteDomainDataSchema,fl as VerifySiteDomainResponseSchema,ze as VisualHintsSchema,Hs as VisualThemeSchema,wp as WORKSPACE_WEBSOCKET_CONTRACT,Yo as WorkspaceClientMessageSchema,Ps as WorkspaceDesignApplyRequestSchema,vs as WorkspaceDesignApplyResponseSchema,st as WorkspaceDiagnosticSchema,ir as WorkspaceDirectEditFileSchema,nr as WorkspaceDirectEditPathSchema,Mp as WorkspaceDirectEditRequestSchema,Up as WorkspaceDirectEditResponseSchema,ot as WorkspaceExecutionDiagnosticsSchema,Sp as WorkspaceExecutionPlanSchema,tr as WorkspaceMediaRequestSchema,mt as WorkspacePlanDependencySchema,Mn as WorkspacePlanSummarySchema,No as WorkspacePlanTaskKindSchema,ct as WorkspacePlanTaskSchema,Te as WorkspaceRunKindSchema,$o as WorkspaceSelectedComponentSchema,Xo as WorkspaceServerMessageSchema,sp as WorkspaceSitemapEditRequestSchema,zo as WorkspaceSocketDescriptorSchema,mr as WorkspaceSourceFileBinaryResponseSchema,rr as WorkspaceSourceFileKindSchema,Hn as WorkspaceSourceFileListItemSchema,Kp as WorkspaceSourceFilePathQuerySchema,Fp as WorkspaceSourceFileResponseSchema,cr as WorkspaceSourceFileTextResponseSchema,Wn as WorkspaceSourcePathSchema,Ao as WorkspaceSuggestionSchema,Dn as WorkspaceSuggestionsSchema,Po as WorkspaceSuggestionsSourceSchema,Ln as WorkspaceTaskCountsSchema,Np as WorkspaceWebSocketMessageSchema,jp as WorkspaceWebSocketMessageTypeSchema,rt as WorkspaceWorkerGroupSchema,at as WorkspaceWorkerPhaseSchema,bp as WorkspaceWorkerResultSchema,H as WorkspaceWorkerStatusSchema,ol as assertSiteGenerationStateTransition,sl as assertSiteStatusTransition,xt as canonicalizePageSlug,Gc as composeSiteEditRepeatInstanceKey,qi as computeSiteEditSourceIdentityKey,ce as containsSensitiveData,ji as createSiteEditCommandFailureSchema,It as createSiteEditCommandResultSchema,we as createSiteEditCommandSuccessSchema,We as fontStack,je as getSiteEditSourceDeleteProtectionReason,ft as isCanonicalPageSlug,xr as isConsentGranted,ts as isExactEditEngineVersion,Ui as isSiteEditMaterializationPathTemplate,Za as isSiteEditRuntimeContainerTag,Ja as isSiteEditRuntimeTextTag,mm as isSiteEditRuntimeVoidElementTag,Or as isSiteEditSourceDeleteProtectedPath,hi as isSiteEditSourceDirectoryPath,gt as isSiteEditSourcePath,Ce as isSiteEditTextSourcePath,Pa as makeSiteEditRepeatInstanceKey,Lm as normalizeCmsPublicApiBase,ki as pageSlugToRouteFilePath,ns as parseExactEditEngineVersion,va as parseSiteEditRepeatInstanceKey,lc as parseSiteEditSourceIdentityKey,bs as resolveFont,ys as resolveFontDisplayName,rl as resolveGenerationStateForRunLifecycle,ur as resolveRedisConnectionConfig,Im as resolveRequestedEditEngineVersion,Kr as resolveSelectableSiteLocale,lm as resolveSiteEditRuntimeOperationSummary,Gr as resolveSiteLocaleFromIso6393,Fr as resolveSiteTextDirection,Rm as resolveSystemCurrentEditEngineVersion,Ts as siteFontVariables,Bc as stripSiteEditRepeatInstanceKeys,Et as tryCanonicalizeAsciiPageSlug};
1
+ import{z as e}from"zod";var pt=["queued","preparing_source","building","artifact_ready","deploying","released","lock_failed","source_prepare_failed","build_failed","artifact_fetch_failed","artifact_validation_failed","deploy_failed","cleanup_failed"];function fr(t){let n=t.VCP_REDIS_URL??t.REDIS_URL;if(n){let a=new URL(n);return{url:n,host:a.hostname,port:a.port?Number(a.port):6379,password:a.password?decodeURIComponent(a.password):void 0}}return{host:t.VCP_REDIS_HOST??"127.0.0.1",port:Jn(t.VCP_REDIS_PORT,56379)}}function Jn(t,n){if(!t)return n;let a=Number(t);return Number.isInteger(a)&&a>0?a:n}import{z as l}from"zod";var Pe=l.enum(["text","url","document","image"]),ve=l.enum(["pending","ready","failed"]),ei=l.enum(["pending","ready","failed"]),ti=l.enum(["product","price","contact","copy","audience","other"]),pe=l.object({fact:l.string().min(1).max(300),kind:ti,source_id:l.string().min(1),quote:l.string().min(1).max(500),trust:l.enum(["verbatim","ocr"]).default("verbatim")}),ni=l.object({page_type:l.string().min(1).max(40),sections:l.array(l.string().min(1).max(40)).max(12)}),de=l.object({source_id:l.string().min(1),nav_structure:l.array(l.string().min(1).max(30)).max(12),page_patterns:l.array(ni).max(10),tone:l.array(l.string().min(1).max(20)).max(8),screenshot_ref:l.string().optional()}),ii=l.object({source_id:l.string().min(1),type:Pe,status:ve,title:l.string().max(120).optional(),original_ref:l.string().min(1),source_metadata:l.record(l.string(),l.unknown()),error_code:l.string().optional(),submitted:l.boolean().optional()}),ue=l.object({topic:l.string().min(1).max(80),variants:l.array(l.object({value:l.string().min(1).max(300),source_id:l.string().min(1)})).min(2)}),si=l.object({type:l.literal("text"),content:l.string().min(20).max(1e4),title:l.string().min(1).max(120).optional()}).strict(),ai=l.object({type:l.literal("url"),url:l.string().url().max(2048),rights_ack:l.boolean().optional(),title:l.string().min(1).max(120).optional()}).strict(),Ir=l.discriminatedUnion("type",[si,ai]),Rr=[".docx",".html",".md",".txt"],Tr=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],kr=10*1024*1024,Ar=2,Pr=l.object({consent_cross_border:l.union([l.literal(!0),l.literal("true")]),consent_text_version:l.string().min(1).max(120),title:l.string().min(1).max(120).optional()}).strict();function vr(t){return t===!0||t==="true"}var Cr=[".png",".jpg",".jpeg",".webp"],Nr=["image/png","image/jpeg","image/webp","application/octet-stream"],jr=8*1024*1024,Dr=10,oi=l.enum(["asset","reference"]),wr=l.object({image_role:oi,title:l.string().min(1).max(120).optional()}).strict(),Or=l.object({version:l.literal(1),site_id:l.string().min(1),tenant_id:l.string().min(1),user_prompt:l.string(),status:ei,sources:l.array(ii).max(16),facts:l.array(pe).max(120),reference:de.optional(),conflicts:l.array(ue).max(20)}).superRefine((t,n)=>{let a=new Map(t.sources.map(c=>[c.source_id,c]));for(let[c,r]of t.facts.entries()){let m=a.get(r.source_id);(!m||m.type==="url")&&n.addIssue({code:"custom",path:["facts",c,"source_id"],message:"facts must reference a text/document/image source (never url)"})}if(t.reference){let c=a.get(t.reference.source_id),r=c?.type==="image"&&c.source_metadata.image_role==="reference";(!c||c.type!=="url"&&!r)&&n.addIssue({code:"custom",path:["reference","source_id"],message:"reference must point at a url source or reference image source"})}});import{z as u}from"zod";var ri=["design.md","DESIGN.md"],dt=["components/site","src/components/site","lib/generated","src/lib/generated","public"],ci=["app/globals.css","src/app/globals.css"],mi=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],li=new Set(mi),Ce="source-delete",ut=u.literal(Ce),M=u.string().min(1).refine(ht,"Invalid site edit source path"),pi=u.string().min(1).refine(fi,"Invalid site edit source directory path"),Ur=u.enum(["text","binary"]),ge=u.object({path:M,language:u.string().min(1).nullable(),sizeBytes:u.number().int().nonnegative(),contentHash:u.string().min(1).optional()}),di=u.discriminatedUnion("kind",[ge.extend({kind:u.literal("text"),language:u.string().min(1),readonly:u.boolean().default(!1)}),ge.extend({kind:u.literal("binary"),language:u.null(),mimeType:u.string().min(1).optional(),readonly:u.literal(!0)})]),gt=u.lazy(()=>u.discriminatedUnion("kind",[u.object({kind:u.literal("directory"),name:u.string().min(1),path:pi,children:u.array(gt)}),u.object({kind:u.literal("file"),name:u.string().min(1),path:M,file:di}).superRefine((t,n)=>{t.path!==t.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),ui=u.enum(["max-files","max-depth","max-total-bytes"]),gi=u.object({reasons:u.array(ui).min(1),maxFiles:u.number().int().positive(),maxDepth:u.number().int().positive(),maxTotalBytes:u.number().int().positive()}),Kr=u.object({nodes:u.array(gt),defaultPath:M.optional(),totalFiles:u.number().int().nonnegative(),truncated:gi.optional()}),hi=ge.extend({kind:u.literal("text"),language:u.string().min(1),readonly:u.boolean().default(!1),content:u.string()}),Si=u.enum(["too-large","unsupported-mime","bytes-unavailable"]),_i=ge.extend({kind:u.literal("binary"),language:u.null(),readonly:u.literal(!0),mimeType:u.string().min(1),contentBase64:u.string().min(1).optional(),previewUnavailableReason:Si.optional()}),Gr=u.discriminatedUnion("kind",[hi,_i]),bi=u.object({key:u.string().min(1),routeId:u.string().min(1).optional()}),yi=u.object({startLine:u.number().int().positive(),startColumn:u.number().int().nonnegative(),endLine:u.number().int().positive(),endColumn:u.number().int().nonnegative()}),Fr=bi.extend({sourceFile:M,componentName:u.string().min(1),openingElementRange:yi,structuralPath:u.string().min(1),textPreview:u.string().min(1).optional()});function ht(t){return!yt(t)||bt(t)?!1:De(t)||_t(t)||St(t)||dt.some(n=>t===n||t.startsWith(`${n}/`))}function Ne(t){return De(t)||li.has(Ei(t))}function fi(t){return!yt(t)||bt(t)?!1:t==="app"||t.startsWith("app/")||t==="src"||t==="src/app"||t.startsWith("src/app/")||dt.some(n=>t===n||t.startsWith(`${n}/`)||n.startsWith(`${t}/`))}function je(t){return ht(t)?De(t)?"design-document":St(t)?"route-entry":_t(t)?"app-global-style":t.toLowerCase()==="lib/generated/media-assets.ts"||t.toLowerCase()==="src/lib/generated/media-assets.ts"?"generated-media-manifest":null:null}function Br(t){return je(t)!==null}function St(t){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(t.toLowerCase())}function _t(t){return ci.some(n=>n.toLowerCase()===t.toLowerCase())}function Ei(t){let n=t.split("/").at(-1)??t,a=n.lastIndexOf(".");return a>0?n.slice(a).toLowerCase():""}function De(t){return!t.includes("/")&&ri.some(n=>n.toLowerCase()===t.toLowerCase())}function bt(t){let n=t.toLowerCase(),a=n.split("/"),r=(a.at(-1)??n).replace(/\.[^.]+$/,"");return/^(?:src\/)?app\/api(?:\/|$)/.test(n)||/^(?:src\/)?app\/(?:.*\/)?route\.[cm]?[jt]sx?$/.test(n)||/^(?:src\/)?app\/(?:.*\/)?(?:action|actions)\.[cm]?[jt]sx?$/.test(n)||/(^|\/)[^/]+\.server\.[cm]?[jt]sx?$/.test(n)||n==="lib/server"||n.startsWith("lib/server")||n==="src/lib/server"||n.startsWith("src/lib/server")||n==="lib/db"||n.startsWith("lib/db")||n==="src/lib/db"||n.startsWith("src/lib/db")||n==="lib/cms"||n.startsWith("lib/cms/")||n==="src/lib/cms"||n.startsWith("src/lib/cms/")?!0:r==="server"||r==="db"||r==="database"||r==="auth"||r==="secret"||r==="secrets"||r==="token"||r==="tokens"||r==="credential"||r==="credentials"||a.includes("server")||a.includes("secrets")}function yt(t){return!t||t.startsWith("/")||t.includes("\\")?!1:t.split("/").every(n=>!(n.length===0||n==="."||n===".."||n.startsWith(".")||n==="package.json"||n==="node_modules"||n==="recipes"||n.startsWith(".env")))}import{z as xi}from"zod";var ft=["zh-CN","zh-HK","zh-TW","en-US","en-GB","ja-JP","ko-KR","es-ES","fr-FR","de-DE","pt-PT","ru-RU","ar-SA","id-ID","vi-VN","th-TH","it-IT","nl-NL","tr-TR","pl-PL","uk-UA","cs-CZ","sk-SK","hu-HU","ro-RO","el-GR","sv-SE","da-DK","fi-FI","hr-HR","lt-LT","lv-LV","et-EE","ga-IE","mt-MT","ka-GE","fa-IR","bn-BD","ta-IN","si-LK","ms-MY","fil-PH","my-MM","km-KH","lo-LA","mn-MN","kk-KZ"],Ii=["en","ja","es","fr","de","ko","pt","pt-BR","it","ru","ar","hi","id","vi","th","tr","nl","pl","uk","sv","da","fi","no","cs","el","hu","ro","he","ms","fil","bn","ta","ca","sk","hr","bg","lt","lv","et","fa","sw","sr","is"],Ri=[...ft,...Ii],Ti=new Set(["ar","fa","he"]),Hr=[{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587",englishName:"Chinese (Simplified)"},{code:"zh-HK",label:"\u7E41\u9AD4\u4E2D\u6587\uFF08\u9999\u6E2F\uFF09",englishName:"Chinese (Traditional, Hong Kong)"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587\uFF08\u53F0\u7063\uFF09",englishName:"Chinese (Traditional, Taiwan)"},{code:"en-US",label:"English (US)",englishName:"English (United States)",common:!0},{code:"en-GB",label:"English (UK)",englishName:"English (United Kingdom)",common:!0},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",englishName:"Japanese"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",englishName:"Korean"},{code:"es-ES",label:"Espa\xF1ol",englishName:"Spanish"},{code:"fr-FR",label:"Fran\xE7ais",englishName:"French"},{code:"de-DE",label:"Deutsch",englishName:"German"},{code:"pt-PT",label:"Portugu\xEAs",englishName:"Portuguese"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",englishName:"Russian"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",englishName:"Arabic"},{code:"id-ID",label:"Bahasa Indonesia",englishName:"Indonesian"},{code:"vi-VN",label:"Ti\u1EBFng Vi\u1EC7t",englishName:"Vietnamese"},{code:"th-TH",label:"\u0E44\u0E17\u0E22",englishName:"Thai"},{code:"it-IT",label:"Italiano",englishName:"Italian"},{code:"nl-NL",label:"Nederlands",englishName:"Dutch"},{code:"tr-TR",label:"T\xFCrk\xE7e",englishName:"Turkish"},{code:"pl-PL",label:"Polski",englishName:"Polish"},{code:"uk-UA",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",englishName:"Ukrainian"},{code:"cs-CZ",label:"\u010Ce\u0161tina",englishName:"Czech"},{code:"sk-SK",label:"Sloven\u010Dina",englishName:"Slovak"},{code:"hu-HU",label:"Magyar",englishName:"Hungarian"},{code:"ro-RO",label:"Rom\xE2n\u0103",englishName:"Romanian"},{code:"el-GR",label:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC",englishName:"Greek"},{code:"sv-SE",label:"Svenska",englishName:"Swedish"},{code:"da-DK",label:"Dansk",englishName:"Danish"},{code:"fi-FI",label:"Suomi",englishName:"Finnish"},{code:"hr-HR",label:"Hrvatski",englishName:"Croatian"},{code:"lt-LT",label:"Lietuvi\u0173",englishName:"Lithuanian"},{code:"lv-LV",label:"Latvie\u0161u",englishName:"Latvian"},{code:"et-EE",label:"Eesti",englishName:"Estonian"},{code:"ga-IE",label:"Gaeilge",englishName:"Irish"},{code:"mt-MT",label:"Malti",englishName:"Maltese"},{code:"ka-GE",label:"\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8",englishName:"Georgian"},{code:"fa-IR",label:"\u0641\u0627\u0631\u0633\u06CC",englishName:"Persian"},{code:"bn-BD",label:"\u09AC\u09BE\u0982\u09B2\u09BE",englishName:"Bengali"},{code:"ta-IN",label:"\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD",englishName:"Tamil"},{code:"si-LK",label:"\u0DC3\u0DD2\u0D82\u0DC4\u0DBD",englishName:"Sinhala"},{code:"ms-MY",label:"Bahasa Melayu",englishName:"Malay"},{code:"fil-PH",label:"Filipino",englishName:"Filipino"},{code:"my-MM",label:"\u1019\u103C\u1014\u103A\u1019\u102C",englishName:"Burmese"},{code:"km-KH",label:"\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A",englishName:"Khmer"},{code:"lo-LA",label:"\u0EA5\u0EB2\u0EA7",englishName:"Lao"},{code:"mn-MN",label:"\u041C\u043E\u043D\u0433\u043E\u043B",englishName:"Mongolian"},{code:"kk-KZ",label:"\u049A\u0430\u0437\u0430\u049B",englishName:"Kazakh"}],ki={en:"en-US",ja:"ja-JP",es:"es-ES",fr:"fr-FR",de:"de-DE",ko:"ko-KR",pt:"pt-PT",it:"it-IT",ru:"ru-RU",ar:"ar-SA",id:"id-ID",vi:"vi-VN",th:"th-TH",tr:"tr-TR",nl:"nl-NL",pl:"pl-PL",uk:"uk-UA",sv:"sv-SE",da:"da-DK",fi:"fi-FI",cs:"cs-CZ",el:"el-GR",hu:"hu-HU",ro:"ro-RO",ms:"ms-MY",fil:"fil-PH",bn:"bn-BD",ta:"ta-IN",sk:"sk-SK",hr:"hr-HR",lt:"lt-LT",lv:"lv-LV",et:"et-EE",fa:"fa-IR"},Ai=new Set(ft);function Vr(t){return Ai.has(t)?t:ki[t]}var Pi="en";function zr(t){let n=t.toLowerCase().split("-",1)[0]??"";return Ti.has(n)?"rtl":"ltr"}var vi={cmn:"zh-CN",eng:"en",jpn:"ja",spa:"es",fra:"fr",deu:"de",kor:"ko",por:"pt",ita:"it",rus:"ru",arb:"ar",ara:"ar",hin:"hi",ind:"id",vie:"vi",tha:"th",tur:"tr",nld:"nl",pol:"pl",ukr:"uk",swe:"sv",dan:"da",fin:"fi",nob:"no",nor:"no",ces:"cs",ell:"el",hun:"hu",ron:"ro",heb:"he",msa:"ms",zsm:"ms",tgl:"fil",ben:"bn",tam:"ta",cat:"ca",slk:"sk",hrv:"hr",bul:"bg",lit:"lt",lav:"lv",est:"et",pes:"fa",fas:"fa",swh:"sw",swa:"sw",srp:"sr",isl:"is"};function $r(t){return vi[t]??Pi}var q=xi.enum(Ri);import{z as I}from"zod";var Et="insertNewComponent",Qr={categoryGroupMissing:"DESIGNER_COMPONENT_CATEGORY_GROUP_MISSING",unavailable:"DESIGNER_COMPONENT_LIBRARY_UNAVAILABLE",timeout:"DESIGNER_COMPONENT_LIBRARY_TIMEOUT",invalidResponse:"DESIGNER_COMPONENT_LIBRARY_INVALID_RESPONSE"},xt=I.lazy(()=>I.object({id:I.string().uuid(),key:I.string().min(1),name:I.string(),children:I.array(xt)}).strict()),It=I.object({category_group_key:I.literal(Et),categories:I.array(xt)}).strict(),Ci=I.object({resource_id:I.string().min(1),name:I.string(),description:I.string().nullable(),thumbnail_url:I.string().nullable(),resolved_version:I.string().min(1),category_id:I.string().uuid().nullable()}).strict(),Rt=I.object({category_group_key:I.literal(Et),items:I.array(Ci),next_cursor:I.string().min(1).nullable()}).strict(),Zr=I.object({category_id:I.string().uuid().optional(),include_descendants:I.enum(["true","false"]).optional().transform(t=>t==="true"),limit:I.coerce.number().int().min(1).max(100).optional().default(20),cursor:I.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})});var $="[a-z0-9]+(?:-[a-z0-9]+)*",ee=new RegExp(`^/(?:${$}(?:/${$})*)?$`);function Ni(t){return t.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Tt(t){return typeof t=="string"&&ee.test(t)}function kt(t){if(typeof t!="string")return null;let n=t.trim();if(/[^\x00-\x7F]/.test(n))return null;let a=n.replace(/^\/+|\/+$/g,"");if(a==="")return"/";let c=a.split("/");if(c.some(p=>p==="."||p===".."))return null;let r=a.toLowerCase();if(r==="index"||r==="home")return"/";let m=c.map(Ni).filter(p=>p.length>0);if(m.length===0)return null;let S=`/${m.join("/")}`;return Tt(S)?S:null}function At(t){let n=kt(t);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function ji(t){let n=At(t);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as D}from"zod";var Se=D.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),Di=D.enum(["direct","proxy","upstream","readonly","unsupported"]),wi=D.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),he=D.object({mode:Di,reasonCode:D.string().min(1).optional()}),Oi=D.object({kind:wi,message:D.string().min(1)}),_e=D.object({key:D.string().min(1),canUpdateText:D.boolean(),canInsertChild:D.boolean(),canMove:D.boolean(),canRemove:D.boolean(),editModes:D.object({updateText:he.optional(),insertChild:he.optional(),move:he.optional(),remove:he.optional()}).optional(),constraints:D.array(Oi)});import{z as E}from"zod";import{z as L}from"zod";var Mi=L.object({code:L.string().min(1),message:L.string().min(1)}),sc=L.object({code:L.string().min(1),message:L.string().min(1)});function we(t){return L.object({ok:L.literal(!0),data:t})}function Li(t){let n={ok:L.literal(!1),error:Mi.extend({code:t.codeSchema})};return t.currentSchema&&(n.current=t.currentSchema.optional()),t.diagnosticsSchema&&(n.diagnostics=L.array(t.diagnosticsSchema).optional()),t.dataSchema&&(n.data=t.dataSchema.optional()),L.object(n)}function Pt(t){return L.discriminatedUnion("ok",[we(t.dataSchema),Li({codeSchema:t.codeSchema,currentSchema:t.currentSchema,diagnosticsSchema:t.diagnosticsSchema,dataSchema:t.failureDataSchema})])}var V=E.object({start:E.number().int().nonnegative(),end:E.number().int().nonnegative()}).superRefine((t,n)=>{t.end<t.start&&n.addIssue({code:"custom",path:["end"],message:"end must be greater than or equal to start"})}),Ui=E.object({code:E.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:E.string().min(1)}),vt=E.object({path:E.string().min(1),content:E.string(),hash:E.string().min(1).optional()}),cc=E.object({revision:E.string().min(1),entryCss:vt,stylesheets:E.array(vt).default([])}),Ct=E.object({key:E.string().min(1),routeId:E.string().min(1),filePath:E.string().min(1),componentName:E.string().min(1),sourceKind:E.enum(["missing","stringLiteral","expression"]),attrRaw:E.string().min(1).nullable(),valueRaw:E.string().min(1).nullable(),attrRange:V.nullable(),openingElementRange:V,version:E.object({documentVersion:E.number().int().nonnegative(),contentHash:E.string().min(1)}),diagnostics:E.array(Ui),computedStyle:E.record(E.string(),E.string()).optional()}).superRefine((t,n)=>{if(t.sourceKind==="missing"){(t.attrRaw!==null||t.valueRaw!==null||t.attrRange!==null)&&n.addIssue({code:"custom",message:"missing className source must not include attr raw or range"});return}(t.attrRaw===null||t.valueRaw===null||t.attrRange===null)&&n.addIssue({code:"custom",message:"present className source must include attr raw and ranges"})}),mc=Ct,lc=we(Ct),Oe=E.object({source:E.enum(["style-panel","class-source-editor"]),operation:E.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as Ki}from"zod";var Me=Ki.enum(["src","alt","poster","href","width","height"]);import{z as b}from"zod";import{z as o}from"zod";import{z as C}from"zod";var Gi=64,Fi=512*1024,Bi=4*1024*1024,qi=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function Wi(t){return qi.test(t)}var Nt=C.string().min(1).refine(Wi,{message:"Materialization pathTemplate must be a safe relative path."}),Hi=C.object({pathTemplate:Nt,content:C.string(),role:C.string().min(1).optional()}).strict(),Vi=C.union([C.object({kind:C.literal("default")}).strict(),C.object({kind:C.literal("named"),name:C.string().min(1)}).strict()]),zi=C.object({pathTemplate:Nt,export:Vi}).strict(),$i=C.array(C.never()).optional(),jt=C.object({instanceBaseName:C.string().min(1),files:C.array(Hi).min(1).max(Gi),entry:zi,dataRequirements:$i}).strict().superRefine((t,n)=>{let a=new Set,c=t.entry.pathTemplate,r=0;for(let[m,S]of t.files.entries()){a.has(S.pathTemplate)&&n.addIssue({code:"custom",path:["files",m,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${S.pathTemplate}`}),a.add(S.pathTemplate);let p=new TextEncoder().encode(S.content).length;p>Fi&&n.addIssue({code:"custom",path:["files",m,"content"],message:"Materialization file content exceeds the per-file byte limit."}),r+=p}a.has(c)||n.addIssue({code:"custom",path:["entry","pathTemplate"],message:"Materialization entry pathTemplate must match a file."}),r>Bi&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});import{z as Y}from"zod";var te=Y.object({editingSessionId:Y.string().min(1),lockId:Y.string().min(1),ownerId:Y.string().min(1),leaseAssertion:Y.string().min(1)}).strict(),_c="signed-designer-mutations-v1",bc=Y.object({mutationContext:te}).strict();import{z as s}from"zod";import{z as ne}from"zod";var be="::",Le=ne.object({file:ne.string().min(1),component:ne.string().min(1),structuralPath:ne.string().min(1),key:ne.string().min(1)}).superRefine((t,n)=>{let a=Yi(t.file,t.component,t.structuralPath);t.key!==a&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function Yi(t,n,a){return`${t}${be}${n}${be}${a}`}function Ec(t){let[n,a,...c]=t.split(be);return!n||!a||c.length===0?null:{file:n,component:a,structuralPath:c.join(be)}}var ye=s.enum(["VERSION_STALE","RECOVERY_REQUIRED","MULTIPLE_PAGE_RETURNS","INDIRECT_RETURN_ONLY","PAGE_CONTAINER_AMBIGUOUS","NO_SAFE_PAGE_PLACEMENT","MEMBER_NOT_INDEPENDENT","UNSUPPORTED_ROUTE_STRUCTURE","RUNTIME_ANCHOR_UNRESOLVED","ROUTE_RETURN_NOT_FOUND"]),ie=s.object({code:s.string().min(1),message:s.string().min(1)}).strict(),Xi=s.union([s.object({kind:s.literal("virtual-route-root"),key:s.string().min(1)}).strict(),s.object({kind:s.literal("jsx-container"),key:s.string().min(1),sourceMemberKey:s.string().min(1),sourceFile:s.string().min(1),componentName:s.string().min(1).optional()}).strict(),s.object({kind:s.literal("starter-placeholder"),key:s.string().min(1),sourceFile:s.string().min(1).optional()}).strict()]),Qi=s.object({key:s.string().min(1),kind:s.enum(["jsx-element","jsx-fragment","jsx-expression","null-return","starter-placeholder"]),containerKey:s.string().min(1),label:s.string().min(1),sourceFile:s.string().min(1).optional(),isAtomic:s.boolean()}).strict(),Zi=s.object({key:s.string().min(1),sourceMemberKey:s.string().min(1),containerKey:s.string().min(1),label:s.string().min(1),isIndependent:s.boolean()}).strict(),Ji=s.object({key:s.string().min(1),containerKey:s.string().min(1),businessMemberKeys:s.array(s.string().min(1)),isMultiMember:s.boolean()}).strict(),Ue=s.object({kind:s.literal("page-composition"),placementKey:s.string().min(1),documentVersion:s.number().int().nonnegative()}).strict(),wt=Ue.extend({routeId:s.string().min(1),placementUnitKey:s.string().min(1),relation:s.enum(["before","after","prepend","append"])}).strict(),Ot=wt,Mt=s.object({kind:s.literal("page-unit"),routeId:s.string().min(1),placementUnitKey:s.string().min(1)}).strict();function F(t,n,a,c,r){let m=new Set;for(let[S,p]of t.entries()){let g=c(p);m.has(g)&&n.addIssue({code:"custom",path:[a,S,r],message:`Duplicate ${a} key: ${g}`}),m.add(g)}}var es=s.object({status:s.literal("supported"),version:s.number().int().nonnegative(),routeId:s.string().min(1),container:Xi,sourceMembers:s.array(Qi),businessMembers:s.array(Zi),placementUnits:s.array(Ji),placements:s.array(wt)}).strict().superRefine((t,n)=>{F(t.sourceMembers,n,"sourceMembers",p=>p.key,"key"),F(t.businessMembers,n,"businessMembers",p=>p.key,"key"),F(t.placementUnits,n,"placementUnits",p=>p.key,"key"),F(t.placements,n,"placements",p=>p.placementKey,"placementKey");let a=new Set(t.sourceMembers.map(p=>p.key)),c=new Set(t.placementUnits.map(p=>p.key)),r=new Map(t.sourceMembers.map(p=>[p.key,p])),m=new Map(t.businessMembers.map(p=>[p.key,p]));for(let[p,g]of t.sourceMembers.entries()){g.containerKey!==t.container.key&&!a.has(g.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",p,"containerKey"],message:"Source member parent must reference the page container or another source member."}),g.containerKey===g.key&&n.addIssue({code:"custom",path:["sourceMembers",p,"containerKey"],message:"Source member cannot contain itself."});let P=new Set([g.key]),d=g.containerKey;for(;d!==t.container.key;){if(P.has(d)){n.addIssue({code:"custom",path:["sourceMembers",p,"containerKey"],message:"Source member hierarchy must be acyclic."});break}P.add(d);let h=r.get(d);if(!h)break;d=h.containerKey}}t.container.kind==="jsx-container"&&!a.has(t.container.sourceMemberKey)&&n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."});for(let[p,g]of t.businessMembers.entries())a.has(g.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",p,"sourceMemberKey"],message:"Business member must reference a source member."}),c.has(g.containerKey)||n.addIssue({code:"custom",path:["businessMembers",p,"containerKey"],message:"Business member must reference a placement unit container."});for(let[p,g]of t.placementUnits.entries()){let P=r.get(g.containerKey);P?P.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",p,"containerKey"],message:"Placement unit must reference a direct child of the page container."}):n.addIssue({code:"custom",path:["placementUnits",p,"containerKey"],message:"Placement unit containerKey must reference a source member."});let d=new Set;for(let[h,N]of g.businessMemberKeys.entries()){let v=m.get(N);if(!v){n.addIssue({code:"custom",path:["placementUnits",p,"businessMemberKeys",h],message:"Placement unit must reference existing business members."});continue}d.has(N)&&n.addIssue({code:"custom",path:["placementUnits",p,"businessMemberKeys",h],message:"Placement unit cannot reference the same business member twice."}),d.add(N),v.containerKey!==g.key&&n.addIssue({code:"custom",path:["placementUnits",p,"businessMemberKeys",h],message:"Business member containerKey must match its placement unit."});let j=v.sourceMemberKey,G=new Set;for(;j&&j!==g.containerKey&&!G.has(j);)G.add(j),j=r.get(j)?.containerKey;j!==g.containerKey&&n.addIssue({code:"custom",path:["placementUnits",p,"businessMemberKeys",h],message:"Placement unit business members must belong to its source subtree."})}}for(let[p,g]of t.businessMembers.entries())t.placementUnits.find(d=>d.key===g.containerKey)?.businessMemberKeys.includes(g.key)||n.addIssue({code:"custom",path:["businessMembers",p,"containerKey"],message:"Business member must be listed by its placement unit container."});let S=new Map;for(let p of t.placementUnits)S.set(p.containerKey,(S.get(p.containerKey)??0)+1);for(let[p,g]of t.sourceMembers.entries())g.containerKey===t.container.key&&S.get(g.key)!==1&&n.addIssue({code:"custom",path:["sourceMembers",p,"key"],message:"Every direct source member must be owned by exactly one placement unit."});for(let[p,g]of t.placements.entries())g.routeId!==t.routeId&&n.addIssue({code:"custom",path:["placements",p,"routeId"],message:"Page placement routeId must match page composition routeId."}),g.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",p,"documentVersion"],message:"Page placement version must match page composition version."}),c.has(g.placementUnitKey)||n.addIssue({code:"custom",path:["placements",p,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),ts=s.object({status:s.literal("unsupported"),version:s.number().int().nonnegative(),routeId:s.string().min(1),reason:ye,diagnostics:s.array(ie)}).strict(),ns=s.discriminatedUnion("status",[es,ts]),Lt=2,Tc="page-composition-v2",Ut=s.object({start:s.number().int().nonnegative(),end:s.number().int().nonnegative(),startLine:s.number().int().positive().optional(),startColumn:s.number().int().nonnegative().optional(),endLine:s.number().int().positive().optional(),endColumn:s.number().int().nonnegative().optional()}).strict().superRefine((t,n)=>{t.end<t.start&&n.addIssue({code:"custom",path:["end"],message:"Source range end must be greater than or equal to start."});let a=[t.startLine,t.startColumn,t.endLine,t.endColumn],c=a.some(m=>m!==void 0),r=a.every(m=>m!==void 0);c&&!r&&n.addIssue({code:"custom",path:["startLine"],message:"Source line and column locations must be provided together."}),t.startLine!==void 0&&t.endLine!==void 0&&t.endLine<t.startLine&&n.addIssue({code:"custom",path:["endLine"],message:"Source range endLine must not precede startLine."}),t.startLine!==void 0&&t.endLine===t.startLine&&t.startColumn!==void 0&&t.endColumn!==void 0&&t.endColumn<t.startColumn&&n.addIssue({code:"custom",path:["endColumn"],message:"Source range endColumn must not precede startColumn."})}),is=s.object({key:s.string().min(1),instanceIndex:s.number().int().nonnegative().optional(),instanceCount:s.number().int().positive().optional(),textSegmentIndex:s.number().int().nonnegative().optional()}).strict().superRefine((t,n)=>{t.instanceIndex!==void 0&&t.instanceCount!==void 0&&t.instanceIndex>=t.instanceCount&&n.addIssue({code:"custom",path:["instanceIndex"],message:"instanceIndex must be lower than instanceCount."})}),ss=s.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),as=s.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),os=s.discriminatedUnion("kind",[s.object({kind:s.literal("virtual-route-root"),key:s.null(),routeReturn:s.object({sourceIdentity:Le,sourceRange:Ut}).strict()}).strict(),s.object({kind:s.literal("jsx-container"),key:s.string().min(1),sourceMemberKey:s.string().min(1)}).strict(),s.object({kind:s.literal("starter-placeholder"),key:s.string().min(1),sourceMemberKey:s.string().min(1),replacementMode:s.literal("replace")}).strict()]),rs=s.object({key:s.string().min(1),kind:ss,parentKey:s.string().min(1).nullable(),childKeys:s.array(s.string().min(1)),order:s.number().int().nonnegative(),label:s.string().min(1),sourceIdentity:Le,sourceRange:Ut.nullable(),atomicKind:as}).strict().superRefine((t,n)=>{let a=t.kind==="component-call"||t.kind==="native-jsx"?"none":t.kind;t.atomicKind!==a&&n.addIssue({code:"custom",path:["atomicKind"],message:`atomicKind must be ${a} for ${t.kind}.`});let c=new Set;for(let[r,m]of t.childKeys.entries())c.has(m)&&n.addIssue({code:"custom",path:["childKeys",r],message:`Duplicate child source member key: ${m}`}),c.add(m)}),cs=s.object({key:s.string().min(1),sourceMemberKey:s.string().min(1),placementUnitKey:s.string().min(1),label:s.string().min(1),isIndependent:s.boolean()}).strict(),ms=s.enum(["independent","atomic","container"]),ls=s.object({key:s.string().min(1),containerKey:s.string().min(1).nullable(),sourceMemberKeys:s.array(s.string().min(1)).min(1),businessMemberKeys:s.array(s.string().min(1)),order:s.number().int().nonnegative(),boundaryMode:ms,isIndependent:s.boolean(),isMultiMember:s.boolean()}).strict().superRefine((t,n)=>{Dt(t.sourceMemberKeys,n,"sourceMemberKeys","source member"),Dt(t.businessMemberKeys,n,"businessMemberKeys","business member");let a=t.sourceMemberKeys.length>1||t.businessMemberKeys.length>1;t.isMultiMember!==a&&n.addIssue({code:"custom",path:["isMultiMember"],message:"isMultiMember must reflect the source and business member cardinality."});let c=t.boundaryMode==="independent";t.isIndependent!==c&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),ps=s.enum(["before","after","prepend","append","replace"]),ds=s.enum(["insert-sibling","insert-child","replace-placeholder"]),us=s.object({kind:s.literal("page-composition"),placementKey:s.string().min(1),documentVersion:s.number().int().nonnegative(),routeId:s.string().min(1),placementUnitKey:s.string().min(1),containerKey:s.string().min(1).nullable(),relation:ps,writeMode:ds}).strict().superRefine((t,n)=>{let a=t.relation==="before"||t.relation==="after"?"insert-sibling":t.relation==="prepend"||t.relation==="append"?"insert-child":"replace-placeholder";t.writeMode!==a&&n.addIssue({code:"custom",path:["writeMode"],message:`writeMode must be ${a} for ${t.relation}.`})}),gs=s.object({key:s.string().min(1),placementUnitKey:s.string().min(1),runtimeRefs:s.array(is).min(1)}).strict(),hs=s.object({schemaVersion:s.literal(Lt),status:s.literal("supported"),version:s.number().int().nonnegative(),routeId:s.string().min(1),container:os,sourceMembers:s.array(rs),businessMembers:s.array(cs),placementUnits:s.array(ls),placements:s.array(us),visualAnchors:s.array(gs).optional(),diagnostics:s.array(ie)}).strict().superRefine((t,n)=>{bs(t,n)}),Ss=s.object({schemaVersion:s.literal(Lt),status:s.literal("unsupported"),version:s.number().int().nonnegative(),routeId:s.string().min(1),reason:ye,diagnostics:s.array(ie)}).strict(),_s=s.discriminatedUnion("status",[hs,Ss]),kc=s.union([_s,ns]);function Dt(t,n,a,c){let r=new Set;for(let[m,S]of t.entries())r.has(S)&&n.addIssue({code:"custom",path:[a,m],message:`Duplicate ${c} key: ${S}`}),r.add(S)}function bs(t,n){F(t.sourceMembers,n,"sourceMembers",d=>d.key,"key"),F(t.businessMembers,n,"businessMembers",d=>d.key,"key"),F(t.placementUnits,n,"placementUnits",d=>d.key,"key"),F(t.placements,n,"placements",d=>d.placementKey,"placementKey"),F(t.visualAnchors??[],n,"visualAnchors",d=>d.key,"key"),ys(t,n);let a=new Map(t.sourceMembers.map(d=>[d.key,d])),c=new Map(t.businessMembers.map(d=>[d.key,d])),r=new Map(t.placementUnits.map(d=>[d.key,d]));fs(t,a,n),t.container.kind!=="virtual-route-root"&&(a.has(t.container.sourceMemberKey)||n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."}));let m=new Map,S=new Map,p=new Set;for(let[d,h]of t.placementUnits.entries()){h.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",d,"containerKey"],message:"Placement unit containerKey must match the page container."});let N=`${h.containerKey??"<virtual>"}:${h.order}`;p.has(N)&&n.addIssue({code:"custom",path:["placementUnits",d,"order"],message:"Placement unit order must be unique within its container."}),p.add(N);for(let[v,j]of h.sourceMemberKeys.entries()){a.has(j)||n.addIssue({code:"custom",path:["placementUnits",d,"sourceMemberKeys",v],message:"Placement unit must reference existing source members."});let G=m.get(j);G&&G!==h.key&&n.addIssue({code:"custom",path:["placementUnits",d,"sourceMemberKeys",v],message:`Source member is already assigned to ${G}.`}),m.set(j,h.key)}for(let[v,j]of h.businessMemberKeys.entries()){let G=c.get(j);if(!G){n.addIssue({code:"custom",path:["placementUnits",d,"businessMemberKeys",v],message:"Placement unit must reference existing business members."});continue}G.placementUnitKey!==h.key&&n.addIssue({code:"custom",path:["placementUnits",d,"businessMemberKeys",v],message:"Placement unit and business member must reference each other."}),h.sourceMemberKeys.includes(G.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",d,"businessMemberKeys",v],message:"Business member sourceMemberKey must belong to the placement unit."});let Ae=S.get(j);Ae&&Ae!==h.key&&n.addIssue({code:"custom",path:["placementUnits",d,"businessMemberKeys",v],message:`Business member is already assigned to ${Ae}.`}),S.set(j,h.key)}}for(let[d,h]of t.businessMembers.entries()){a.has(h.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",d,"sourceMemberKey"],message:"Business member must reference a source member."});let N=r.get(h.placementUnitKey);if(!N){n.addIssue({code:"custom",path:["businessMembers",d,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}N.businessMemberKeys.includes(h.key)||n.addIssue({code:"custom",path:["businessMembers",d,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),N.sourceMemberKeys.includes(h.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",d,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let v=N.isIndependent&&N.businessMemberKeys.length===1;h.isIndependent!==v&&n.addIssue({code:"custom",path:["businessMembers",d,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let g=new Set;for(let[d,h]of t.placements.entries()){h.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",d,"documentVersion"],message:"Page placement version must match page composition version."}),h.routeId!==t.routeId&&n.addIssue({code:"custom",path:["placements",d,"routeId"],message:"Page placement routeId must match page composition routeId."});let N=r.get(h.placementUnitKey);N?h.containerKey!==N.containerKey&&n.addIssue({code:"custom",path:["placements",d,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",d,"placementUnitKey"],message:"Placement option must reference a placement unit."});let v=`${h.placementUnitKey}:${h.relation}`;g.has(v)&&n.addIssue({code:"custom",path:["placements",d,"relation"],message:"A placement unit cannot expose the same relation more than once."}),g.add(v),h.relation==="replace"&&t.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",d,"relation"],message:"replace is only valid for a starter placeholder container."}),t.container.kind==="starter-placeholder"&&h.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",d,"relation"],message:"Starter placeholder placements must use replace."})}let P=new Set;for(let[d,h]of(t.visualAnchors??[]).entries())r.has(h.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",d,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),P.has(h.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",d,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),P.add(h.placementUnitKey)}function ys(t,n){let a=[];t.container.key!==null&&a.push({key:t.container.key,path:["container","key"],namespace:"container"});for(let[r,m]of t.sourceMembers.entries())a.push({key:m.key,path:["sourceMembers",r,"key"],namespace:"source member"});for(let[r,m]of t.businessMembers.entries())a.push({key:m.key,path:["businessMembers",r,"key"],namespace:"business member"});for(let[r,m]of t.placementUnits.entries())a.push({key:m.key,path:["placementUnits",r,"key"],namespace:"placement unit"});for(let[r,m]of(t.visualAnchors??[]).entries())a.push({key:m.key,path:["visualAnchors",r,"key"],namespace:"visual anchor"});let c=new Map;for(let r of a){let m=c.get(r.key);m?n.addIssue({code:"custom",path:r.path,message:`${r.namespace} key collides with ${m}: ${r.key}`}):c.set(r.key,r.namespace)}}function fs(t,n,a){let c=new Set;for(let[r,m]of t.sourceMembers.entries()){let S=`${m.parentKey??"<root>"}:${m.order}`;if(c.has(S)&&a.addIssue({code:"custom",path:["sourceMembers",r,"order"],message:"Source member order must be unique among siblings."}),c.add(S),m.parentKey===m.key&&a.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member cannot be its own parent."}),m.parentKey!==null){let P=n.get(m.parentKey);P?P.childKeys.includes(m.key)||a.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source parent and child references must be bidirectional."}):a.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[P,d]of m.childKeys.entries()){if(d===m.key){a.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",P],message:"Source member cannot be its own child."});continue}let h=n.get(d);h?h.parentKey!==m.key&&a.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",P],message:"Source parent and child references must be bidirectional."}):a.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",P],message:"Source child key must reference a source member."})}let p=new Set,g=m;for(;g;){if(p.has(g.key)){a.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member graph must be acyclic."});break}p.add(g.key),g=g.parentKey===null?void 0:n.get(g.parentKey)}}}var se=o.enum(["update-text","update-array-item","remove-node","insert-child","move-node","set-class-name-source","set-props","apply-style-draft","source-edit"]),Kt=o.lazy(()=>o.union([o.string(),o.number(),o.boolean(),o.null(),o.array(Kt),o.record(o.string(),Kt)])),Ft=o.discriminatedUnion("kind",[o.object({kind:o.literal("node"),key:o.string().min(1)}),Mt,o.object({kind:o.literal("route"),routeId:o.string().min(1)}),o.object({kind:o.literal("source-file"),path:M}),o.object({kind:o.literal("source-batch"),paths:o.array(M).min(1)}).superRefine((t,n)=>{let a=new Set;for(let[c,r]of t.paths.entries())a.has(r)&&n.addIssue({code:"custom",path:["paths",c],message:`Duplicate source target path: ${r}`}),a.add(r)})]),Bt=o.enum(["display","position","top","right","bottom","left","zIndex","flexDirection","flexWrap","flexGrow","flexShrink","flexBasis","order","gridTemplateColumns","gridTemplateRows","columns","gridColumn","gridRow","gap","gapX","gapY","spaceX","spaceY","alignItems","justifyContent","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","width","height","minWidth","minHeight","maxWidth","maxHeight","overflow","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","textAlign","textTransform","textDecoration","textOverflow","textIndent","writingMode","whiteSpace","wordBreak","lineClamp","fontVariantNumeric","screenReaderOnly","color","backgroundColor","backgroundImage","backgroundRepeat","backgroundSize","backgroundPosition","backgroundAttachment","backgroundClip","backgroundOrigin","borderStyle","borderWidth","borderRadius","borderColor","objectFit","objectPosition","aspectRatio","opacity","boxShadow","transform","transformOrigin","transitionProperty","transitionDuration","transitionTimingFunction","animation","pointerEvents","cursor","userSelect","fontStyle","textUnderlineOffset","scrollMarginTop","alignSelf","flex","outlineStyle","resize","ringWidth","ringColor","backdropFilter","overscrollBehavior","divideWidth","divideColor"]),qt=o.enum(["hover","active","focus","disabled"]),Wt=o.enum(["sm","md","lg","xl","2xl"]),Gt=o.union([o.object({relation:o.enum(["before","after"]),anchorKey:o.string().min(1)}),o.object({relation:o.enum(["prepend","append"]),parentKey:o.string().min(1)}),Ot]),Es=o.union([o.object({kind:o.literal("native-tag"),tag:o.string().min(1),text:o.string().optional()}),o.object({kind:o.literal("component-call"),component:o.object({source:o.string().min(1),exportName:o.string().min(1)}),materialization:o.never().optional(),props:o.record(o.string(),o.unknown()).optional()}).strict(),o.object({kind:o.literal("component-call"),component:o.never().optional(),materialization:jt,props:o.record(o.string(),o.never()).optional()}).strict()]),xs=o.discriminatedUnion("kind",[o.object({kind:o.literal("update-text"),segmentIndex:o.number().int().min(0),value:o.string()}),o.object({kind:o.literal("update-array-item"),segmentIndex:o.number().int().min(0),index:o.number().int().min(0),value:o.string()}),o.object({kind:o.literal("remove-node")}),o.object({kind:o.literal("insert-child"),node:Es,position:o.union([Gt,Ue])}),o.object({kind:o.literal("move-node"),target:Gt,preserveBindings:o.boolean().optional()}),o.object({kind:o.literal("set-class-name-source"),routeId:o.string().min(1).optional(),filePath:o.string().min(1),expectedVersion:o.object({documentVersion:o.number().int().nonnegative(),contentHash:o.string().min(1)}),oldAttrRaw:o.string().min(1).nullable(),oldAttrRange:V.nullable(),openingElementRange:V,newAttrRaw:o.string().min(1).nullable(),intent:Oe}),o.object({kind:o.literal("set-props"),props:o.partialRecord(Me,o.string())}),o.object({kind:o.literal("apply-style-draft"),className:o.object({routeId:o.string().min(1).optional(),filePath:o.string().min(1),expectedVersion:o.object({documentVersion:o.number().int().nonnegative(),contentHash:o.string().min(1)}),oldAttrRaw:o.string().min(1).nullable(),oldAttrRange:V.nullable(),openingElementRange:V,newAttrRaw:o.string().min(1).nullable(),intent:Oe}).optional(),props:o.partialRecord(Me,o.string()).optional()}).superRefine((t,n)=>{!t.className&&!t.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),o.object({kind:o.literal("source-edit"),conflictPolicy:o.enum(["compare-and-swap","overwrite"]),edits:o.array(o.discriminatedUnion("operation",[o.object({operation:o.literal("upsert"),path:M,content:o.string(),baseContentHash:o.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{Ne(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit upsert only accepts allowlisted text source files"}),t.content.includes("\0")&&n.addIssue({code:"custom",path:["content"],message:"source-edit content must be valid text"})}),o.object({operation:o.literal("delete"),path:M,capability:ut,confirmDelete:o.literal(!0),confirmPath:M,baseContentHash:o.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{t.capability!==Ce&&n.addIssue({code:"custom",path:["capability"],message:"delete requires source-delete capability"}),t.confirmPath!==t.path&&n.addIssue({code:"custom",path:["confirmPath"],message:"delete confirmation path must match edit path"}),Ne(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let a=je(t.path);a&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${t.path} (${a})`})})])).min(1),reason:o.string().min(1).optional()}).strict().superRefine((t,n)=>{let a=new Set;for(let[c,r]of t.edits.entries())a.has(r.path)&&n.addIssue({code:"custom",path:["edits",c,"path"],message:`Duplicate source edit path: ${r.path}`}),a.add(r.path),t.conflictPolicy==="compare-and-swap"&&r.baseContentHash===void 0&&n.addIssue({code:"custom",path:["edits",c,"baseContentHash"],message:"source-edit compare-and-swap requires baseContentHash for every edit"})})]),Ht=o.enum(["NODE_NOT_FOUND","ROUTE_NOT_FOUND","CAPABILITY_REJECTED","CONSTRAINT_VIOLATED","INVALID_PARAMS","PLAN_FAILED","TRANSACTION_PREFLIGHT_FAILED","ROUTE_REBUILD_FAILED","HISTORY_COMMIT_FAILED","MATERIALIZATION_CONFLICT","MATERIALIZATION_REJECTED","MUTATION_ASSERTION_REQUIRED","MUTATION_ASSERTION_INVALID","VERSION_STALE","AST_PARSE_ERROR","UNSUPPORTED_OPERATION","LOCATOR_FAILED","INVALID_TARGET","WRITE_IO_ERROR","CONCURRENT_MODIFIED","ROLLBACK_FAILED","RECOVERY_REQUIRED","RECOVERY_PERSIST_FAILED","MUTATION_SESSION_REQUIRED","LEASE_ASSERTION_INVALID","LEASE_ASSERTION_EXPIRED","LEASE_ASSERTION_SCOPE_MISMATCH","CROSS_PAGE_MOVE_UNSUPPORTED","INTERNAL_ERROR"]),Vt=o.object({code:Ht,message:o.string().min(1),details:o.record(o.string(),o.unknown()).optional()}),zt=o.object({key:o.string().min(1),instanceIndex:o.number().int().nonnegative().optional(),instanceCount:o.number().int().positive().optional()}),Is=o.object({id:o.string().min(1),siteId:o.string().min(1),baseSnapshotId:o.string().min(1),routeId:o.string().min(1).optional(),kind:se,target:Ft,documentVersion:o.number().int().nonnegative(),selectionRef:zt.optional(),mutationContext:te.optional(),params:xs}).superRefine((t,n)=>{if(t.kind!==t.params.kind&&n.addIssue({code:"custom",path:["params","kind"],message:"params.kind must match operation kind"}),t.kind==="source-edit"){if(t.target.kind!=="source-file"&&t.target.kind!=="source-batch")n.addIssue({code:"custom",path:["target","kind"],message:"source-edit requires a source-file or source-batch target"});else if(t.params.kind==="source-edit"){let a=t.params.edits.map(r=>r.path),c=t.target.kind==="source-file"?[t.target.path]:t.target.paths;Rs(a,c)||n.addIssue({code:"custom",path:["target"],message:"source-edit target paths must match edit paths"})}}else(t.target.kind==="source-file"||t.target.kind==="source-batch")&&n.addIssue({code:"custom",path:["target","kind"],message:"source targets are only valid for source-edit"});t.target.kind==="page-unit"&&(t.kind!=="insert-child"&&t.kind!=="move-node"&&t.kind!=="remove-node"&&n.addIssue({code:"custom",path:["target","kind"],message:"page-unit target is only valid for page-level operations"}),t.kind==="move-node"&&t.params.kind==="move-node"&&(!("kind"in t.params.target)||t.params.target.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","target","kind"],message:"page-unit move-node target requires page-composition placement"})),t.params.kind==="insert-child"&&"kind"in t.params.position&&t.params.position.kind==="page-composition"&&t.target.kind!=="page-unit"&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-composition position requires page-unit target"}),t.kind==="insert-child"&&t.target.kind==="page-unit"&&t.params.kind==="insert-child"&&(!("kind"in t.params.position)||t.params.position.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-unit target requires page-composition position"})}),Mc=Is,fe=o.object({requestId:o.string().min(1),kind:se,target:Ft,resultVersion:o.number().int().nonnegative(),affectedFiles:o.array(o.string().min(1)).optional(),selectionRef:zt.optional()}),Lc=Pt({dataSchema:fe,codeSchema:Ht,failureDataSchema:fe.partial()});function Rs(t,n){return t.length===n.length&&t.every((a,c)=>a===n[c])}var Bc=b.discriminatedUnion("type",[b.object({type:b.literal("site-edit.document.changed"),siteId:b.string().min(1),snapshotId:b.string().min(1),routeId:b.string().min(1),version:b.number().int().nonnegative(),at:b.string().min(1)}),b.object({type:b.literal("site-edit.operation.planned"),siteId:b.string().min(1),operationId:b.string().min(1),baseSnapshotId:b.string().min(1),changedFiles:b.array(b.string().min(1)),at:b.string().min(1)}),b.object({type:b.literal("site-edit.operation.completed"),siteId:b.string().min(1),result:fe,at:b.string().min(1)}),b.object({type:b.literal("site-edit.operation.failed"),siteId:b.string().min(1),requestId:b.string().min(1),error:Vt,at:b.string().min(1)}),b.object({type:b.literal("site-edit.capability.changed"),siteId:b.string().min(1),routeId:b.string().min(1),keys:b.array(b.string().min(1)),at:b.string().min(1)})]);import{z as R}from"zod";var Hc="durable-history-v1",Vc=R.enum(["writable","read-only-recovery","unavailable"]),Ts=R.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),ks=R.object({code:Ts,message:R.string().min(1),occurredAt:R.iso.datetime().optional()}).strict(),As=R.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),$t={revision:R.number().int().nonnegative(),undoDepth:R.number().int().nonnegative(),redoDepth:R.number().int().nonnegative()},Ps=R.object({mode:R.literal("writable"),...$t,canUndo:R.boolean(),canRedo:R.boolean()}).strict().superRefine((t,n)=>{t.canUndo!==t.undoDepth>0&&n.addIssue({code:"custom",path:["canUndo"],message:"canUndo must reflect undoDepth."}),t.canRedo!==t.redoDepth>0&&n.addIssue({code:"custom",path:["canRedo"],message:"canRedo must reflect redoDepth."})}),vs=R.object({mode:R.literal("read-only-recovery"),...$t,canUndo:R.literal(!1),canRedo:R.literal(!1),recoveryDiagnostic:ks}).strict(),Cs=R.object({mode:R.literal("unavailable"),revision:R.literal(0),undoDepth:R.literal(0),redoDepth:R.literal(0),canUndo:R.literal(!1),canRedo:R.literal(!1),reason:As}).strict(),zc=R.discriminatedUnion("mode",[Ps,vs,Cs]);import{z as k}from"zod";var Ns=k.string().min(1).refine(t=>!t.startsWith("/")&&!t.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),js=k.string().regex(/^sha256:[a-f0-9]{64}$/),Ds=k.object({path:Ns,operation:k.enum(["create","update","delete"]),expectedHash:js.optional(),fullContent:k.string().optional()}).superRefine((t,n)=>{t.operation==="delete"&&t.fullContent!==void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"delete patches must not include fullContent"}),t.operation!=="delete"&&t.fullContent===void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"create/update patches must include fullContent"})}),Xc=k.object({siteId:k.string().min(1),baseSnapshotId:k.string().min(1),operationId:k.string().min(1),reason:k.string().min(1),patches:k.array(Ds).min(1),changedRouteIds:k.array(k.string().min(1)),diagnostics:k.array(k.object({code:k.string().min(1),message:k.string().min(1),path:k.string().min(1).optional()})).default([])}).superRefine((t,n)=>{let a=new Set;for(let[c,r]of t.patches.entries())a.has(r.path)&&n.addIssue({code:"custom",path:["patches",c,"path"],message:`Duplicate patch path: ${r.path}`}),a.add(r.path)});var Ke="::repeat-item#";function ws(t,n){return`${t}${Ke}${n}`}function Zc(t,n){return n.reduce((a,c)=>ws(a,c),t)}function Os(t){if(typeof t!="string"||t.length===0)return null;let n=[],a=t;for(;;){let c=a.lastIndexOf(Ke);if(c<0)break;let r=Number(a.slice(c+Ke.length));if(!Number.isInteger(r)||r<0)return null;n.unshift({repeatIndex:r}),a=a.slice(0,c)}return!a||n.length===0?null:{baseKey:a,parts:n}}function Jc(t){return Os(t)?.baseKey??t??null}import{z as i}from"zod";import{z as w}from"zod";var Ms=w.object({placementKey:w.string().min(1),placementUnitKey:w.string().min(1),relation:w.enum(["before","after","prepend","append"])}).strict(),Ls=w.object({status:w.literal("supported"),containerKey:w.string().min(1),hasBusinessMembers:w.boolean(),placementUnitKeys:w.array(w.string().min(1)),placements:w.array(Ms)}).strict().superRefine((t,n)=>{let a=new Set(t.placementUnitKeys);a.size!==t.placementUnitKeys.length&&n.addIssue({code:"custom",path:["placementUnitKeys"],message:"Render page composition placement unit keys must be unique."});let c=new Set;t.placements.forEach((r,m)=>{c.has(r.placementKey)&&n.addIssue({code:"custom",path:["placements",m,"placementKey"],message:"Render page composition placement keys must be unique."}),c.add(r.placementKey),a.has(r.placementUnitKey)||n.addIssue({code:"custom",path:["placements",m,"placementUnitKey"],message:"Render page composition placement must reference a projected unit."})})}),Us=w.object({status:w.literal("unsupported"),reason:ye,diagnostics:w.array(ie)}).strict(),Yt=w.discriminatedUnion("status",[Ls,Us]);var Ks=i.object({canUpdateText:i.boolean(),canInsertChild:i.boolean(),canMove:i.boolean(),canRemove:i.boolean()}),Xt=i.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),Gs=i.enum(["cms-field","api-field"]),Fs=i.enum(["text","attribute","richtext","repeat-region","component-prop"]),Bs=i.enum(["exact","safe-derived","partial","unknown"]),qs=i.object({file:i.string().min(1),symbol:i.string().min(1).optional(),reason:i.string().min(1)}),Ws=i.object({sourceKind:Xt,sourceType:Gs,endpointPattern:i.string().min(1).optional(),operation:i.string().min(1).optional(),collection:i.string().min(1).optional(),fieldPath:i.string().min(1).optional(),valuePath:i.string().min(1).optional(),targetKind:Fs,targetName:i.string().min(1),confidence:Bs,readonly:i.literal(!0),evidence:i.array(qs)}),Qt=i.object({hasDynamicData:i.boolean(),bindings:i.array(Ws)}),Zt=i.object({hasDynamicData:i.boolean(),sourceKinds:i.array(Xt),primaryEndpoint:i.string().min(1).optional(),primaryCollection:i.string().min(1).optional(),primaryFieldPath:i.string().min(1).optional()}),Hs=i.object({key:i.string().min(1),pageCompositionUnitKey:i.string().min(1).optional(),operationSummary:Ks,dynamicDataSummary:Zt.optional()}).strict(),dm=i.object({siteId:i.string().min(1),snapshotId:i.string().min(1),routeId:i.string().min(1),version:i.number().int().nonnegative(),entries:i.array(Hs),pageComposition:Yt}).strict(),Ge=i.enum(["api-field","cms-field","i18n-message","config-entry"]),Jt=i.object({kind:i.enum(["literal","binding","imported-binding","repeat-template"]),file:i.string().min(1),expression:i.string().min(1),bindingName:i.string().min(1).optional(),path:i.array(i.union([i.string(),i.number()])).optional()}),Fe=i.object({index:i.number().int().min(0),value:i.string(),editable:i.boolean(),source:Jt.nullable()}),ae=i.object({key:i.string().min(1),label:i.string().min(1),tag:i.string().min(1)}),um=i.object({key:i.string().min(1),canUpdateText:i.boolean(),canInsertChild:i.boolean(),canMove:i.boolean(),canRemove:i.boolean(),boundaryKind:Se.nullable(),isOpaque:i.boolean()}),Vs=i.object({kind:i.enum(["jsx-node","component-proxy","value-binding","route-export"]),file:i.string().min(1),componentName:i.string().min(1),isProxy:i.boolean()}),zs=i.object({kind:i.enum(["jsx-node","value-path","route-export","external-entry"]),file:i.string().min(1).optional(),isProxy:i.boolean(),displayPath:i.string().min(1).optional(),sourceType:Ge.optional(),sourceId:i.string().min(1).optional()}),en=i.object({kind:i.union([i.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),Ge]),file:i.string().min(1),displayPath:i.string().min(1),externalSource:i.object({sourceType:Ge,sourceId:i.string().min(1),adapterId:i.string().min(1).optional()}).optional()}),$s=i.object({kind:en.shape.kind,file:i.string().min(1),displayName:i.string().min(1),canEditHere:i.boolean()}),oe=i.object({finalSource:en.nullable(),chain:i.array($s),confidence:i.enum(["exact","safe-derived","partial","unknown"]),editMode:i.enum(["direct","proxy","upstream","readonly","unsupported"]),diagnostics:i.array(i.object({code:i.string().min(1),message:i.string().min(1)}))}),Ys=i.object({kind:i.literal("css-style-model"),properties:i.array(i.object({property:Bt,value:i.union([i.string(),i.number(),i.boolean(),i.null()]),resolvedValue:i.union([i.string(),i.number(),i.boolean(),i.null()]).optional(),breakpoint:Wt.optional(),state:qt.optional(),variants:i.array(i.string().min(1)).optional(),options:i.array(i.union([i.string(),i.number()])).optional(),editable:i.boolean(),diagnostics:i.array(i.object({code:i.string().min(1),message:i.string().min(1)})).optional(),operationBoundary:i.array(se).optional()}))}),gm=i.union([i.record(i.string(),i.unknown()),Ys]),tn=i.object({kind:i.literal("class-name-source"),className:i.string(),sourceKind:i.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:i.boolean(),operationBoundary:i.array(se),sourcePath:i.string().min(1).optional(),diagnostics:i.array(i.object({code:i.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:i.string().min(1)})).optional()}),Xs=i.object({startLine:i.number().int().positive(),startColumn:i.number().int().nonnegative(),endLine:i.number().int().positive(),endColumn:i.number().int().nonnegative()}),Be=i.object({sourceFile:i.string().min(1),componentName:i.string().min(1),openingElementRange:Xs,structuralPath:i.string().min(1),textPreview:i.string().min(1).optional()}),hm=i.object({key:i.string().min(1),tag:i.string().min(1),componentName:i.string().min(1),sourceFile:i.string().min(1),sourceLocator:Be.optional(),label:i.string().min(1),capabilities:_e,writeTarget:Vs,effectiveWriteTarget:zs.optional(),provenanceChain:oe.optional(),componentSemantic:i.record(i.string(),i.unknown()).optional(),contentModel:i.record(i.string(),i.unknown()).optional(),mediaModel:i.record(i.string(),i.unknown()).optional(),styleSource:tn.optional(),conditional:i.record(i.string(),i.unknown()).optional(),dynamicData:Qt.optional(),textSegments:i.array(Fe),boundaryKind:Se.nullable(),isOpaque:i.boolean(),ancestors:i.array(ae),children:i.array(ae),siblings:i.array(ae)}),Sm=i.object({key:i.string().min(1),tag:i.string().min(1),label:i.string().min(1),sourceLocator:Be.optional(),capabilities:i.object({constraints:_e.shape.constraints}),isOpaque:i.boolean(),provenanceChain:i.object({editMode:oe.shape.editMode,diagnostics:oe.shape.diagnostics}).optional(),dynamicDataSummary:Zt.optional(),ancestors:i.array(ae)}),_m=i.object({key:i.string().min(1),tag:i.string().min(1),label:i.string().min(1),sourceLocator:Be.optional(),isOpaque:i.boolean(),ancestors:i.array(ae),componentName:i.string().min(1),sourceFile:i.string().min(1),capabilities:_e,provenanceChain:i.object({editMode:oe.shape.editMode,diagnostics:oe.shape.diagnostics}).optional(),textSegments:i.array(i.object({index:Fe.shape.index,editable:Fe.shape.editable,sourceKind:Jt.shape.kind.nullable()})),dynamicData:Qt.optional(),boundaryKind:Se.nullable()}),bm=i.object({key:i.string().min(1),mediaModel:i.record(i.string(),i.unknown()).optional(),styleSource:tn.optional()});var Qs=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Zs=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],Js=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],ea=new Set(Qs),ta=new Set(Zs),na=new Set(Js),ia={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function fm(t){return ea.has(qe(t))}function sa(t){return ta.has(qe(t))}function aa(t){return na.has(qe(t))}function Em(t){let{operationSummary:n}=t;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:t.fallbackMode!=="preview"?{...ia}:{canUpdateText:aa(t.tagName),canInsertChild:sa(t.tagName),canMove:!1,canRemove:!1}}function qe(t){return t?.trim().toLowerCase()??""}import{z as nn}from"zod";var Tm=nn.object({routeId:nn.string().min(1),mutationContext:te.optional()}).strict();var Am={PATCH_VALIDATION_FAILED:"The code didn't pass validation. Try describing the change more specifically.",PATCH_BATCH_FAILED:"The site code couldn't be generated. Please regenerate the site.",PATCH_BATCH_INVALID:"The change couldn't be applied. Try simpler instructions.",VALIDATION_FAILED:"Your message couldn't be sent as written. Please edit it and try again.",WORKSPACE_MESSAGE_CONTAINS_SECRET:"Your message looks like it contains a secret or token, so it wasn't sent. Remove it and try again.",WORKSPACE_TOOL_RESULT_INVALID:"This change couldn't be completed and was rolled back. Please try again.",WORKSPACE_TOOL_FAILED:"A tool step failed. Please try again.",WORKSPACE_TOOL_RESULT_MISSING:"The tool didn't return a usable result. Please try again.",WORKSPACE_MODEL_STREAM_FAILED:"The model stream ended unexpectedly. Please try again.",WORKSPACE_MODEL_STREAM_ABORTED:"Generation was interrupted before finishing. Please try again.",MODEL_OUTPUT_TRUNCATED:"The response was too long and was cut off before any change was applied. Try again, or split the request into smaller changes.",WORKSPACE_EDIT_NOT_APPLIED:"No change was applied. Try describing the change differently.",WORKSPACE_INITIAL_EXECUTION_FAILED:"Initial generation failed. Please retry from the brief.",WORKSPACE_INITIAL_GENERATION_CHECK_FAILED:"Initial generation could not be verified. Please retry.",WORKSPACE_INITIAL_GENERATION_FINALIZE_FAILED:"Initial generation could not finalize. Please retry.",WORKSPACE_INITIAL_GENERATION_QUALITY_GATE_FAILED:"Initial generation failed quality checks. Please regenerate the site.",WORKSPACE_ITERATION_QUALITY_GATE_FAILED:"Quality check failed. The change was rolled back; try a smaller or more specific request.",WORKSPACE_SOCKET_DEAD:"The workspace connection was lost. Please retry.",WORKSPACE_RUN_CANCELLED:"The run was cancelled.",WORKSPACE_RUN_ABANDONED:"This run was interrupted and did not finish. Please try again.",WORKSPACE_RUN_REQUEST_FAILED:"Couldn't start the workspace. Please try again.",WORKSPACE_RUN_BAD_RESPONSE:"The server response was malformed. Please try again.",WORKSPACE_SOCKET_UNAVAILABLE:"Workspace connection unavailable. Please try again.",WORKSPACE_SOCKET_ERROR:"The workspace connection had an error. Please try again.",WORKSPACE_SOCKET_CLOSED:"The workspace connection closed. Please try again.",WORKSPACE_SOCKET_OPEN_TIMEOUT:"Couldn't reach the workspace in time. Please try again.",WORKSPACE_CLIENT_MESSAGE_ID_MISSING:"Something went wrong sending your message. Please try again.",SITE_SNAPSHOT_REQUIRED:"This site has no usable snapshot yet. Complete Step 3 first.",AGENT_TIMEOUT:"That took longer than expected. Try breaking the change into smaller pieces.",SANDBOX_NOT_AVAILABLE:"The preview environment isn't ready. Your edits have still been saved.",PREVIEW_BUILD_FAILED:"Preview is available, but the production build failed. Fix the reported build error before deploying.",PREVIEW_BUILD_NOT_CONFIGURED:"Preview is available, but the production build check is not configured.",PREVIEW_BUILD_SANDBOX_NOT_FOUND:"Preview is available, but the build check could not find the active preview sandbox.",WS_CONNECTION_ERROR:"Connection lost. Reconnecting\u2026",USER_MESSAGE_PERSIST_FAILED:"Your message wasn't saved. Please send it again.",CLARIFICATION_REPLY_STALE:"That question has expired. Please tell me what you'd like to do now.",CLARIFY_MODEL_FAILED:"Clarify couldn't finish generating questions. Please try again.",WORKSPACE_RUN_IN_FLIGHT:"Another session is already running. Please try again in a moment.",SITE_OPERATION_LOCKED:"Another change is already running for this site. Wait for it to finish, then try again.",EDIT_ENGINE_VERSION_INVALID:"Invalid editor version. Refresh the page and try again.",SANDBOX_DEPENDENCY_SYNC_FAILED:"The preview runtime could not be prepared. Please try again.",SANDBOX_PREVIEW_FAILED:"The site preview failed to start. Please try again.",SANDBOX_DEPENDENCY_VERSION_MISMATCH:"The preview runtime could not be verified. Please try again.",SANDBOX_RUNTIME_NOT_READY:"The preview needs to be refreshed before this change can be applied. Refresh the preview and try again.",GENERIC:"Something went wrong. Please try again."},Pm={UNDO_OR_ROLLBACK:"I can't roll back from chat. Use the version history at the top right to pick a restore point.",HISTORY_RECALL:"Tell me what you'd like to change now\u2014I'll work from the current page state.",OUT_OF_SCOPE:"That's outside what I can do from chat. Try the corresponding panel on the right."},vm={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},Cm={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var sn="0.6.5",jm="x-vcp-edit-engine-version",Dm="x-vcp-edit-engine-version-source",We=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},oa=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function ra(t){return oa.test(t)}function ca(t){if(typeof t!="string"||!ra(t))throw new We;return t}function wm(t){return t==null?{version:sn,source:"fallback_current"}:{version:ca(t),source:"explicit"}}function Om(){return{version:sn,source:"system_current"}}import{z as y}from"zod";var ma=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],an=y.object({name:y.string().min(1).max(100),type:y.enum(ma),label:y.string().min(1).max(255),required:y.boolean().optional(),options:y.array(y.string()).optional()}),Um=y.object({name:y.string(),cms_type:y.string(),label:y.string().optional(),required:y.boolean().optional(),value_shape:y.string().optional(),front_display:y.enum(["visible","internal","forbidden"]).optional(),choices:y.array(y.object({value:y.union([y.string(),y.number()]),label:y.string()})).optional()}),Km=y.object({route_file_path:y.string().min(1),target_component_path:y.string().min(1),content_type_hint:y.string().min(1),required_fields:y.array(an).optional(),mode:y.enum(["bind_existing","provision"]),list_mode:y.enum(["page","embedded"]).optional(),fields:y.array(an).optional(),seed_records:y.array(y.record(y.string(),y.unknown())).optional()});import{z as T}from"zod";var la=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],pa=T.object({name:T.string().min(1).max(100),type:T.enum(la),label:T.string().min(1).max(255),required:T.boolean().optional(),options:T.array(T.string()).optional()}),da=T.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),Bm=T.object({mode:T.enum(["bind_existing","provision"],{error:'mode is required. Use {"mode":"bind_existing","form_hint":"<exact form code or name>"} or {"mode":"provision","name":"<confirmed form name>","component_slug":"<ascii-kebab>","fields":[...]}. Never call connect_form with {}.'}),form_hint:T.string().min(1).optional(),name:T.string().min(1).max(255).optional(),component_slug:da,description:T.string().min(1).max(1e3).optional(),fields:T.array(pa).optional()}).superRefine((t,n)=>{t.mode==="bind_existing"&&!t.form_hint?.trim()&&n.addIssue({code:"custom",path:["form_hint"],message:"form_hint is required for bind_existing"}),t.mode==="provision"&&!t.name?.trim()&&n.addIssue({code:"custom",path:["name"],message:"name is required for provision"})}),qm=T.object({name:T.string(),label:T.string(),cms_type:T.string(),required:T.boolean()});import{z as U}from"zod";var ua=["provisioning","cms_app_created","seeded","ready","failed"],Vm=U.object({tenant_id:U.string().min(1),site_id:U.string().min(1),collection_slug:U.string().min(1),cms_collection_id:U.string().min(1).nullable(),status:U.enum(ua),owned_by_vcp:U.boolean(),run_id:U.string().min(1).nullable(),last_error:U.string().nullable(),created_at:U.string().datetime(),updated_at:U.string().datetime()});var on="/vibe/v1";function $m(t){let n=t?.trim().replace(/\/+$/,"");if(!n)return null;try{let a=new URL(n),c=a.pathname.replace(/\/+$/,"");return a.search="",a.hash="",a.pathname=c.endsWith(on)?c:on,a.href.replace(/\/+$/,"")}catch{return n}}import{z as A}from"zod";var ga=A.object({maxSites:A.number().int().nullable().optional(),maxStorageMb:A.number().int().nullable().optional(),customDomains:A.boolean().nullable().optional()}).passthrough().superRefine((t,n)=>{for(let a of Object.keys(t))a.includes("_")&&n.addIssue({code:"custom",path:[a],message:"Public plan feature fields must use camelCase."})}),ha=A.object({subscriptionId:A.string().min(1),planId:A.string().min(1),locale:A.enum(["en","zh_CN"]).or(A.string().min(1)),currentPeriodEnd:A.string().nullable(),servicePeriodEnd:A.string().nullable(),featureSnapshot:ga.nullable(),code:A.string().nullable(),level:A.number().int().nullable(),name:A.string().nullable()}).strict(),Sa=A.object({hasActiveSubscription:A.boolean()}).strict(),rn=A.object({plan:ha.nullable(),entitlement:Sa}).strict();import{z as _}from"zod";var _a=["pending_dns","active"],Jm="CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED",ba=_.enum(_a),ya=_.enum(["ownershipVerification","certificateValidation","traffic","unknown"]),fa=_.enum(["pending","matched"]),Ea=_.object({id:_.string().min(1),type:_.string().min(1),name:_.string().min(1),value:_.string().min(1),purpose:ya,required:_.boolean(),status:fa.optional()}).strict(),re=_.object({id:_.string().min(1),domainId:_.string().min(1).optional(),hostname:_.string().min(1),displayHostname:_.string().min(1),asciiHostname:_.string().min(1),status:ba,isPrimary:_.boolean(),deletable:_.boolean(),dnsRecords:_.array(Ea),createdAt:_.string().datetime().nullable(),checkedAt:_.string().datetime().nullable()}).strict(),xa=_.object({hostname:_.string().min(1),url:_.string().url(),status:_.literal("ready")}).strict(),cn=_.object({defaultDomain:xa,currentDomain:re.nullable(),customDomains:_.array(re)}).strict(),el=_.object({hostname:_.string().min(1),isPrimary:_.boolean().optional()}).strict(),mn=_.object({domain:re}).strict(),ln=_.object({domain:re}).strict(),pn=_.object({domain:re}).strict(),dn=_.object({deleted:_.boolean()}).strict();var ce={Inter:{import:"Inter"},"Inter Tight":{import:"Inter_Tight"},"DM Sans":{import:"DM_Sans"},"Source Sans 3":{import:"Source_Sans_3"},"Libre Franklin":{import:"Libre_Franklin"},Montserrat:{import:"Montserrat"},Archivo:{import:"Archivo"},"Space Grotesk":{import:"Space_Grotesk"},Manrope:{import:"Manrope"},"IBM Plex Sans":{import:"IBM_Plex_Sans"},Oswald:{import:"Oswald"},"Roboto Condensed":{import:"Roboto_Condensed"},"Bebas Neue":{import:"Bebas_Neue",weights:["400"]},"Playfair Display":{import:"Playfair_Display"},Lora:{import:"Lora"},Fraunces:{import:"Fraunces"},"Cormorant Garamond":{import:"Cormorant_Garamond"},"JetBrains Mono":{import:"JetBrains_Mono"},"IBM Plex Mono":{import:"IBM_Plex_Mono"},"Noto Sans SC":{import:"Noto_Sans_SC",download:!1},"Noto Serif SC":{import:"Noto_Serif_SC",download:!1}},Ia={heading:"Inter",body:"Inter"},un=ce.Inter;function Ee(t){return t.trim().replace(/\s+/g,"_").toLowerCase()}var _n=(()=>{let t=new Map;for(let[n,a]of Object.entries(ce))t.set(Ee(n),a),t.set(Ee(a.import),a);return t})();function Ra(t){return typeof t!="string"||t.trim().length===0?un:_n.get(Ee(t))??un}var Ta=(()=>{let t=new Map;for(let[n,a]of Object.entries(ce))t.set(a.import,n);return t})();function ka(t){if(typeof t!="string"||t.trim().length===0)return"Inter";let n=_n.get(Ee(t));return n?Ta.get(n.import)??"Inter":"Inter"}var Aa=Object.keys(ce),gn='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',hn='Georgia, "Times New Roman", serif',Sn='"SFMono-Regular", Consolas, monospace',Pa=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),va=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(t=>t.toLowerCase())),Ca=new Set(["JetBrains Mono","IBM Plex Mono"].map(t=>t.toLowerCase()));function Na(t){let n=t.toLowerCase();return Ca.has(n)||n.includes("mono")?"mono":va.has(n)||n.includes("serif")?"serif":"sans"}function He(t,n){let a=g=>(g??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),c=a(t),r=a(n),m=g=>Pa.has(g.toLowerCase());if(c&&m(c)){let g=c.toLowerCase();return g.includes("mono")?Sn:g.includes("serif")?hn:gn}let S=c;S||(S=m(r)?"":r),S||(S="Inter");let p=Na(S);return p==="mono"?`"${S}", ${Sn}`:p==="serif"?`"${S}", ${hn}`:`"${S}", ${gn}`}function ja(t){return{"--site-font-sans":He(t?.body,"Inter"),"--site-font-heading":He(t?.heading,t?.body??"Inter")}}var Da=[{id:"archivo-inter",heading:"Archivo",body:"Inter"},{id:"playfair-source-sans",heading:"Playfair Display",body:"Source Sans 3"},{id:"space-grotesk-manrope",heading:"Space Grotesk",body:"Manrope"},{id:"fraunces-libre-franklin",heading:"Fraunces",body:"Libre Franklin"},{id:"noto-serif-sc-noto-sans-sc",heading:"Noto Serif SC",body:"Noto Sans SC"},{id:"noto-sans-sc",heading:"Noto Sans SC",body:"Noto Sans SC"}];var wa=[{id:"ocean",colorSeeds:{primary:"#1e3a5f",accent:"#2563eb"}},{id:"forest",colorSeeds:{primary:"#14532d",accent:"#16a34a"}},{id:"clay",colorSeeds:{primary:"#7c2d12",accent:"#ea580c"}},{id:"violet",colorSeeds:{primary:"#3b0764",accent:"#7c3aed"}},{id:"graphite",colorSeeds:{primary:"#1f2937",accent:"#0d9488"}},{id:"crimson",colorSeeds:{primary:"#7f1d1d",accent:"#dc2626"}}];import{z as K}from"zod";var Oa=K.object({colorSeeds:K.object({primary:K.string().min(1).max(40),accent:K.string().min(1).max(40)}).strict().optional(),fonts:K.object({heading:K.string().min(1).max(60),body:K.string().min(1).max(60)}).strict().optional()}).strict().refine(t=>t.colorSeeds!==void 0||t.fonts!==void 0,{message:"colorSeeds or fonts is required"}),Ma=K.object({ok:K.literal(!0),design_plan_version:K.number().int().positive(),snapshot_id:K.string().min(1)});var $e=e.object({heading:e.string().min(1).max(160).optional(),body:e.string().min(1).max(160).optional(),paletteIntent:e.string().min(1).max(400).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),density:e.enum(["compact","comfortable","editorial"]).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional()}),Ye=e.object({protocol:e.enum(["phone","form","download","route","external"]),ctaLabel:e.string().min(1).max(40),ctaTarget:e.string().min(1).max(200).optional(),requiresOwnerDetail:e.boolean().optional()}),Ve=e.enum(["material","reference","brief","industry"]),La=e.object({market:e.object({value:e.string().min(1).max(200),source:Ve}),customer:e.object({value:e.string().min(1).max(200),source:Ve}),purpose:e.object({options:e.array(e.string().min(1).max(60)).min(2).max(4),selected:e.string().min(1).max(60),source:Ve})}),Ua=e.enum(["text-options","motion-slider","positioning"]),Xe=e.enum(["none","subtle","moderate","expressive"]),Ka=e.enum(["compact","comfortable","editorial"]),Ga=Xe,xn=e.object({skill_name:e.string().min(1),rationale:e.string().min(4).max(200),confidence:e.enum(["high","medium","low"]).optional(),displayName:e.object({zh:e.string().min(1),en:e.string().min(1)}).partial().optional()}),Fa=e.object({value:e.string(),label:e.string(),desc:e.string().optional(),impact:e.string().optional(),isRecommended:e.boolean().optional(),preselect:e.boolean().optional(),visualHints:$e.optional(),conversionHints:Ye.optional()}),Ba=e.object({id:e.string(),type:Ua,question:e.string(),tag:e.string(),aiThinking:e.string(),options:e.array(Fa),source:e.enum(["ai-detected","always-ask"]),sourceDetail:e.string(),positioning:La.optional()}),Qe=e.object({questions:e.array(Ba).min(1).max(6)}),hl=e.object({tenant_id:e.string().min(1),site_id:e.string().min(1),brief_id:e.string().min(1),brief:e.string().min(20).max(1e3),site_default_locale:q.optional(),owner_locale:q.optional(),input_context:e.object({facts:e.array(pe).max(120),conflicts:e.array(ue).max(20),reference:de.optional(),sources:e.array(e.object({type:Pe,title:e.string().max(120).optional(),status:ve})).max(16).optional()}).optional()}),In=e.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),Sl=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("skill.selecting"),category:e.literal("page-generation"),available:e.array(e.object({id:e.string().min(1),name:e.string().min(1)})).max(20),at:e.string().min(1)}),e.object({type:e.literal("skill.selected"),category:e.literal("page-generation"),selected:e.object({id:e.string().min(1),name:e.string().min(1),reason:e.string().min(1).max(200)}),at:e.string().min(1)}),e.object({type:e.literal("clarify.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("clarify.archetype_proposals"),proposals:e.array(xn).min(1).max(5),at:e.string().min(1)}),e.object({type:e.literal("clarify.finished"),questions_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),error_category:In.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),at:e.string().min(1)})]),qa=e.enum(["draft","brief_submitted","clarifying","sitemap_ready","workspace_ready","deployed","archived","error"]),Wa={draft:["brief_submitted","archived","error"],brief_submitted:["clarifying","archived","error"],clarifying:["sitemap_ready","archived","error"],sitemap_ready:["workspace_ready","archived","error"],workspace_ready:["deployed","archived","error"],deployed:["workspace_ready","archived","error"],archived:[],error:["draft","brief_submitted","clarifying","sitemap_ready"]};function _l(t,n){if(!Wa[t].includes(n))throw new Error(`Invalid site status transition: ${t} -> ${n}`);return n}var Ha=e.enum(["planning","initial_generation_running","generated"]),Va={planning:["initial_generation_running"],initial_generation_running:["generated","planning"],generated:[]};function bl(t,n){if(t===n)return n;if(!Va[t].includes(n))throw new Error(`Invalid site generation state transition: ${t} -> ${n}`);return n}function yl(t){if(t.agent_type!=="workspace"||t.current_state==="generated")return null;switch(t.event_type){case"run.started":return t.current_state==="planning"?"initial_generation_running":null;case"run.finished":return t.current_state==="initial_generation_running"?"generated":null;case"run.failed":return t.current_state==="initial_generation_running"?t.has_current_snapshot?"generated":"planning":null;default:return null}}var fl="SITE_PLANNING_INPUT_FROZEN",El="SITE_PLANNING_LOCKED",xl=e.object({tenant_id:e.string().min(1),owner_user_id:e.string().min(1),name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),Il=e.object({name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),Rl=e.object({name:e.string().min(1).max(120)}),Tl=e.object({name:e.string().min(1).max(120),default_locale:q.optional()}),kl=e.object({body:e.string().min(20).max(1e3)}),Al=e.object({body:e.string().min(20).max(1e3)}),Ze=e.string().url().refine(t=>{try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}},{message:"URL must use http or https protocol"}),Pl=e.object({tenant_id:e.string().min(1),site_url:Ze,site_name:e.string().trim().min(1).max(255).optional()}),B=t=>e.object({code:e.number().int(),data:t,message:e.string()}),vl=B(It),Cl=B(Rt),Nl=B(e.object({site_id:e.string().min(1),site_url:Ze})),jl=B(cn),Dl=B(mn),wl=B(ln),Ol=B(pn),Ml=B(dn),Ll=B(rn),Q=e.object({id:e.string().min(1),tenant_id:e.string().min(1),owner_user_id:e.string().min(1).nullable(),name:e.string().min(1),slug:e.string().min(1),status:qa,generation_state:Ha,planning_locked_at:e.string().min(1).nullable(),current_sitemap_id:e.string().min(1).nullable(),current_snapshot_id:e.string().min(1).nullable(),deployed_url:e.string().url().nullable(),default_locale:q,owner_locale:q.optional(),cms_site_id:e.string().nullable().optional(),cms_site_url:Ze.nullable().optional(),schema_version:e.literal(1),created_at:e.string().min(1),updated_at:e.string().min(1)}),Je=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),body:e.string().min(1),source:e.enum(["user","import","system"]),created_at:e.string().min(1),updated_at:e.string().min(1)}),Ul=e.object({site:Q,brief:Je,next_step:e.literal("clarify")}),Kl=e.object({site:Q,brief:Je}),Gl=e.object({brief:Je}),za=e.enum(["queued","running","succeeded","failed","cancelled"]),Rn=e.enum(["clarify","sitemap","workspace"]),Tn=e.enum(["clarify","sitemap","initial_generation","iteration"]),kn=e.enum(["clarify","sitemap","workspace","summarize"]),H=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),agent_type:Rn,run_kind:Tn,status:za,model_route:kn,started_at:e.string().min(1).nullable(),finished_at:e.string().min(1).nullable(),error_code:e.string().min(1).nullable(),created_at:e.string().min(1)}),Fl=e.object({run_id:e.string().min(1).optional(),site_id:e.string().min(1),agent_type:Rn,run_kind:Tn.optional(),model_route:kn,input:e.record(e.string(),e.unknown()).optional()}).superRefine((t,n)=>{me(t.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),Bl=e.object({agent_run:H,next_step:e.literal("stream_events")}),et=e.enum(["draft","candidate","current","failed"]),le=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),version:e.number().int().positive(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),reason:e.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback"]),status:et,created_at:e.string().min(1)}),ql=e.object({snapshot_id:e.string().min(1).optional(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),reason:le.shape.reason,status:et.default("candidate")}),Wl=e.object({site:Q,snapshot:le,next_step:e.literal("workspace")}),Hl=e.object({site:Q,snapshot:le,next_step:e.literal("workspace")}),Vl=e.object({status:e.literal("deleted"),snapshot_id:e.string().min(1)}),tt=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),snapshot_id:e.string().min(1),version:e.number().int().positive(),accepted_commit:e.string().min(1),source_run_id:e.string().min(1).nullable(),created_at:e.string().min(1)}),$a=tt.extend({reason:le.shape.reason,status:et}),zl=e.object({accepted_commit:e.string().min(1),source_run_id:e.string().min(1).optional()}),$l=e.object({site_version:tt,next_step:e.literal("workspace")}),Yl=e.object({site_versions:e.array($a)}),Xl=e.object({site:Q,snapshot:le,site_version:tt,next_step:e.literal("workspace")}),Ql=e.object({snapshot_id:e.string().min(1),force_rehydrate:e.boolean().optional()}),Zl=e.object({status:e.enum(["ready","failed"]),preview_url:e.string().min(1).optional(),code:e.string().min(1).optional(),message:e.string().min(1).optional(),retryable:e.boolean().optional()}),Jl="DEPLOYMENT_ENTITLEMENT_REQUIRED",nt=e.enum(pt),Re=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),snapshot_id:e.string().min(1),version:e.number().int().positive(),status:nt,provider:e.enum(["cloudflare"]),url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),ep=e.object({snapshot_id:e.string().min(1).optional()}).default({}),tp=e.object({deployment:Re}),np=e.object({deployment:Re.nullable()}),ip=e.object({deployment:Re}),bn=e.object({id:e.string().min(1),status:nt,url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable()}),sp=e.object({current:bn.nullable(),latest_released:bn.nullable()}),Ya=e.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),X=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),deployment_id:e.string().min(1),seq:e.number().int().positive(),sent_at:e.string().min(1)}),xe=e.object({deployment:Re}),ap=e.discriminatedUnion("type",[X.extend({type:e.literal("deployment.snapshot"),payload:xe}),X.extend({type:e.literal("deployment.status.changed"),payload:xe}),X.extend({type:e.literal("deployment.finished"),payload:xe}),X.extend({type:e.literal("deployment.failed"),payload:xe}),X.extend({type:e.literal("deployment.realtime.recovered"),payload:e.object({action:e.literal("refresh")})}),X.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})})]),op=e.object({tenant_id:e.string().min(1),site_id:e.string().min(1),deployment_id:e.string().min(1),status:nt,updated_at:e.string().min(1)}),Xa="vcp:deployments",rp={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:Xa,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...Ya.options]},Qa=e.object({error:e.object({code:e.string().min(1),message:e.string().min(1),details:e.unknown().optional(),request_id:e.string().min(1).optional(),retryable:e.boolean().default(!1)})}),cp=e.object({error:Qa.shape.error.extend({code:e.literal("AGENT_RUN_IN_FLIGHT"),details:e.object({code:e.literal("AGENT_RUN_IN_FLIGHT"),message:e.string().min(1),agent_run:H})})}),mp=e.object({colors:e.record(e.string(),e.string()).default({}),typography:e.record(e.string(),e.string()).default({}),spacing:e.record(e.string(),e.string()).default({}),motion:e.record(e.string(),e.string()).default({})}),Za=e.object({theme_id:e.string().min(1),paletteIntent:e.string().min(1),tone:e.string().min(1),mediaMood:e.string().min(1),motionLevel:Xe.optional(),userVisualHints:$e.optional()}),Ja=e.object({question:e.string().min(1),answer:e.string().min(1)}),lp=e.object({query:e.string().min(1),keywords:e.array(e.string()).default([]),orientation:e.enum(["landscape","portrait","square"]).optional(),role:e.enum(["hero","section","card","gallery","testimonial","decorative"]),altHint:e.string().min(1)}),pp=e.object({id:e.string().min(1),role:e.enum(["site_background","nav_background","footer_background"]),query:e.string().min(1),keywords:e.array(e.string()).default([]),treatment:e.enum(["cover","fixed-cover","subtle-texture"]),altHint:e.string().optional()}),eo=e.object({provider:e.enum(["unsplash","pexels"]),providerLabel:e.enum(["Unsplash","Pexels"]),providerHref:e.string().url(),photoHref:e.string().url().optional(),photographerName:e.string().optional(),photographerHref:e.string().url().optional(),requiresAttribution:e.boolean()}),dp=e.object({src:e.string().min(1),alt:e.string().min(1),width:e.number().int().positive().optional(),height:e.number().int().positive().optional(),provider:e.enum(["unsplash","pexels","placeholder"]).optional(),providerId:e.string().optional(),photoUrl:e.string().url().optional(),photographer:e.string().optional(),photographerUrl:e.string().url().optional(),credit:e.string().optional(),dominantColor:e.string().optional(),attribution:eo.optional()}),to=e.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),Z=e.object({id:e.string().min(1),name:e.string().min(1),category:e.literal("page-generation"),version:e.string().min(1).optional(),reason:e.string().min(1).max(200),source:to.default("system_recommended")}),f=e.string().min(1).max(2e3),yn=e.string().min(1).max(120),An=e.object({visualDirection:f,brandFeeling:f,paletteIntent:f,typographyIntent:f,density:Ka,motionLevel:Ga,mediaStrategy:f,compositionRules:e.array(f).max(20),avoidPatterns:e.array(f).max(20),fonts:e.object({heading:e.string().min(1),body:e.string().min(1)}).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional()}),it=160,Pn=e.object({routeGoal:f,narrativeArc:f,firstViewportIntent:f,visualContinuity:f,sectionRhythm:f,avoidPatterns:e.array(f).max(20),displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(it).optional(),metaTitle:e.string().min(1).max(120).optional(),metaDescription:e.string().min(1).max(320).optional()}),vn=e.enum(["model_call","validation","repair","preview","worker_group"]),W=e.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),Cn=e.object({sectionRole:f,contentIntent:f,layoutIntent:f,visualIntent:f,mediaIntent:f,motionIntent:f,copyTone:f,displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(it).optional(),ctaIntent:f.optional(),continuityWithPrevious:f.optional(),avoidRepeating:e.array(f).max(20).optional(),industryRecipeRefs:e.array(yn).max(12).optional(),templateRecipeRefs:e.array(yn).max(12).optional()}),Nn=e.object({siteName:e.string().min(1).max(120),tagline:e.string().min(1).max(200).optional(),primaryCta:e.object({label:e.string().min(1).max(60),target:e.string().min(1).max(200)}).optional(),trustSignals:e.array(e.string().min(1).max(60)).max(6).optional(),industry:e.string().min(1).max(40).optional()}),no=e.enum(["solid","floating"]),io=e.enum(["background","card","primary","frosted"]),so=e.enum(["sticky","hide-on-scroll","static"]),ao=e.enum(["bar","island"]),oo=e.object({variant:no,surface:io.optional(),behavior:so.optional(),shape:ao.optional()}),ro=e.object({form:f,layoutIntent:f,scrollBehavior:f,shell:oo.optional(),avoidPatterns:e.array(f).max(10).optional()}),co=e.enum(["background","card","primary","inverse"]),mo=e.object({surface:co}),lo=e.object({form:f,composition:f,shell:mo.optional(),avoidPatterns:e.array(f).max(10).optional()}),po=e.object({pattern:f,intent:f}),jn=e.object({header:ro,footer:lo,mobileNav:po}),Dn=e.object({schemaVersion:e.literal(1).default(1),siteDesignContext:An,routeCards:e.record(e.string().min(1),Pn),blockContexts:e.record(e.string().min(1),Cn),selectedSkillPacks:e.array(Z).max(3).optional(),branding:Nn.optional(),chromeDesign:jn.optional()}),up=e.object({siteDesignContext:An.omit({imagePalette:!0}).optional(),routeCards:e.record(e.string().min(1),Pn).optional(),blockContexts:e.record(e.string().min(1),Cn).optional(),branding:Nn.optional(),chromeDesign:jn.optional()}),uo=e.object({id:e.string(),type:e.string(),variant:e.string().optional(),order:e.number(),props:e.record(e.string(),e.unknown()),enabled:e.boolean(),meta:e.object({aiGenerated:e.boolean(),userEdited:e.boolean(),lastEditedAt:e.string(),lastEditedBy:e.enum(["ai","user"]),userInstruction:e.string().optional()}).optional()}).strict(),go=e.string().regex(ee,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),ho=new RegExp(`^/(?:${$}(?:/${$})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),So=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,_o=e.union([e.string().regex(ho),e.string().regex(So)]),fn=e.object({label:e.string(),href:_o}),bo=e.object({primaryLinks:e.array(fn),footerLinks:e.array(fn)}),wn=e.object({id:e.string(),slug:go,title:e.string(),blocks:e.array(uo).min(1),layout:e.enum(["default","centered","fullwidth"]).optional(),navigation:e.object({showInHeader:e.boolean(),showInFooter:e.boolean(),order:e.number()})}).strict(),yo=wn.extend({slug:e.string().min(1)}),En=e.object({label:e.string(),href:e.string().min(1)}),fo=e.object({primaryLinks:e.array(En),footerLinks:e.array(En)}),On=e.object({site_name:e.string().min(1).max(80).optional(),version:e.number().int().positive(),pages:e.array(wn).min(1),navigation:bo,integrations:e.object({cms:e.unknown().optional(),analytics:e.unknown().optional()}).optional(),meta:e.object({generatedAt:e.string(),generatedBy:e.literal("sitemap-agent"),source_brief_id:e.string().optional(),source_answer_ids:e.array(e.string()).optional()}),skillSelection:Z,visualTheme:Za.optional(),userChoices:e.array(Ja).optional(),confirmedChoices:e.object({conversion:Ye.optional()}).optional()}).strict(),Te=On.superRefine((t,n)=>{let a=new Map,c=0;t.pages.forEach((r,m)=>{r.slug==="/"&&(c+=1);let S=a.get(r.slug);S!==void 0?n.addIssue({code:"custom",path:["pages",m,"slug"],message:`Duplicate page slug '${r.slug}' (first used at pages.${S}.slug).`}):a.set(r.slug,m)}),(c!==1||t.pages[0]?.slug!=="/")&&n.addIssue({code:"custom",path:["pages"],message:"Sitemap must contain exactly one home page at pages[0] with slug '/'."})}),gp=On.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0}).extend({site_name:e.string().min(1).max(80),pages:e.array(yo).min(1),navigation:fo}),Eo=e.enum(["ai","user"]),J=e.object({site_id:e.string().min(1),page_id:e.string().min(1),edited_by:Eo.default("ai"),source_agent_run_id:e.string().min(1).optional()}),hp=J.extend({block_id:e.string().min(1),target_index:e.number().int().min(0)}),xo=J.extend({block_id:e.string().min(1)}),Io=J.extend({block_id:e.string().min(1),instruction:e.string()}),Sp=J.extend({block_id:e.string().min(1),variant:e.string().min(1).nullable()}),_p=J.extend({block_id:e.string().min(1),props:e.record(e.string(),e.unknown()),mode:e.enum(["replace","merge"]).default("replace")}),bp=J.extend({block:e.object({id:e.string().min(1),type:e.string().min(1),variant:e.string().min(1).optional(),props:e.record(e.string(),e.unknown()).default({}),insert_index:e.number().int().min(0).optional()})}),Ro=e.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),yp=e.discriminatedUnion("operation",[e.object({operation:e.literal("delete_block"),input:xo}).strict(),e.object({operation:e.literal("update_block_instruction"),input:Io}).strict()]),To=e.enum(["SITEMAP_EDIT_INVALID","SITEMAP_API_NOT_CONFIGURED","SITEMAP_NOT_FOUND","SITEMAP_PAGE_NOT_FOUND","SITEMAP_BLOCK_NOT_FOUND","SITEMAP_BLOCK_ALREADY_EXISTS","SITEMAP_EDIT_FAILED"]),ko=e.object({status:e.literal("updated"),operation:Ro,site_id:e.string().min(1),sitemap_id:e.string().min(1),version:e.number().int().positive(),changed_pages:e.array(e.string().min(1)).min(1),requires_code_patch:e.literal(!0)}),Ao=e.object({status:e.literal("failed"),code:To,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),fp=e.discriminatedUnion("status",[ko,Ao]),st=e.object({question_id:e.string().min(1),value:e.string().min(1),label:e.string().min(1).optional(),question:e.string().min(1).optional(),option_label:e.string().min(1).optional(),motion_level:Xe.optional(),visual_tonality:$e.optional(),conversion:Ye.optional(),positioning:e.object({market:e.string().min(1).max(200),customer:e.string().min(1).max(200),purpose:e.string().min(1).max(60)}).optional()}),Ep=e.object({tenant_id:e.string().min(1),site_id:e.string().min(1),brief_id:e.string().min(1),brief:e.string().min(20).max(1e3),answers:e.array(st).min(1).max(10),skillSelection:Z,site_default_locale:q.optional(),owner_locale:q.optional(),reference:de.optional(),input_context:e.object({facts:e.array(pe).max(120),conflicts:e.array(ue).max(20)}).optional()}),Mn=e.enum(["planning","generating","validating","ready"]),Po=e.enum(["salvaged","deterministic_fallback"]),vo=e.enum(["model_exception_settled_prefix","model_exception_safe_root"]),Ln={outcome:Po.optional(),reason:vo.optional(),attempts:e.number().int().positive().optional()};function Un(t,n){if(t.type!=="sitemap.generated")return;let a=t.outcome!==void 0,c=t.reason!==void 0;a!==c&&n.addIssue({code:"custom",path:[a?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var Co=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:Mn,message:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generated"),sitemap_id:e.string().min(1),sitemap:Te,...Ln,at:e.string().min(1)}),e.object({type:e.literal("sitemap.clamped"),reason:e.enum(["page_early_stop","finalize_best_effort"]),original_page_count:e.number().int().nonnegative().optional(),final_page_count:e.number().int().nonnegative().optional(),original_enabled_block_count:e.number().int().nonnegative().optional(),final_enabled_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.started"),slot_count:e.number().int().nonnegative(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.finished"),slot_count:e.number().int().nonnegative(),provider_counts:e.object({unsplash:e.number().int().nonnegative(),pexels:e.number().int().nonnegative(),placeholder:e.number().int().nonnegative()}),fallback_count:e.number().int().nonnegative(),error_codes:e.array(e.string()),at:e.string().min(1)}),e.object({type:e.literal("snapshot.created"),snapshot_id:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:e.string().min(1).optional(),at:e.string().min(1)})]),xp=Co.superRefine(Un),No=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),version:e.number().int().positive(),sitemap:Te,source_agent_run_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Ip=e.object({sitemap_id:e.string().min(1).optional(),sitemap:Te,source_agent_run_id:e.string().min(1).optional()}),Rp=e.object({site:Q,sitemap:No,next_step:e.literal("workspace")}),jo=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),brief_id:e.string().min(1),questions:Qe,answers:e.array(st),selected_archetype:Z.optional(),completed_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Tp=e.object({answers:e.array(st).min(1),questions:Qe,selected_archetype:Z.optional()}),kp=e.object({clarify_session:jo}),Ap=e.object({questions:Qe,selected_archetype:Z}),Do=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),version:e.number().int().positive(),design_plan:Dn,source_agent_run_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Pp=e.object({design_plan_id:e.string().min(1).optional(),design_plan:Dn,source_agent_run_id:e.string().min(1).optional()}),vp=e.object({design_plan:Do}),ke=e.enum(["initial_generation","iteration"]),wo=e.object({label:e.string().min(1).max(48),prompt:e.string().min(1).max(160)}).strict(),Oo=e.enum(["model","derived","mixed","advisor"]),Kn=e.object({suggestions:e.array(wo).min(1).max(4),source:Oo}).strict(),Mo=e.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),Lo=e.enum(["generation_succeeded","entry_slots_omitted","quality_gate_exhausted","schema_gate_exhausted","stream_schema_mismatch","stream_generation_error","generation_error","fallback_compiler_error","legacy_result_missing_metadata"]),Gn=e.enum(["run.started","message.delta","user.message","plan.updated","clarify.partial","clarify.archetype_proposals","clarify.finished","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","sitemap.updated","sitemap.resync.failed","sitemap.resync.warning","block.changed","tool.started","tool.finished","workspace.plan.created","workspace.worker.updated","workspace.task.updated","workspace.degraded","workspace.design_plan.outcome","workspace.suggestions","file.changed","snapshot.created","snapshot.finalized","preview.preparing","preview.ready","preview.build.started","preview.build.succeeded","preview.build.failed","run.failed","run.finished","media_resolution.started","media_resolution.finished","skill.selecting","skill.selected","activity.started","activity.updated","activity.finished","activity.failed"]),Uo=e.object({id:e.string().min(1),title:e.string().min(1),status:e.enum(["pending","running","completed","failed"])}),z=e.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),at=e.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),ot=e.object({code:e.string().min(1),message:e.string().min(1),path:e.string().min(1).optional(),task_id:e.string().min(1).optional(),details:e.record(e.string(),e.unknown()).optional()}),O=e.string().min(1).refine(t=>Qn(t),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),rt=e.object({deduped_paths:e.array(O),skipped_tasks:e.array(e.string().min(1)),failed_tasks:e.array(e.string().min(1)),fallback_files:e.array(e.string().min(1)),applied_paths:e.array(O)}),ct=e.object({group_id:e.string().min(1),phase:at,title:e.string().min(1),status:z,task_ids:e.array(e.string().min(1)),depends_on_groups:e.array(e.string().min(1)),target_paths:e.array(O)}),Ko=e.enum(["style","media","chrome","section","layout","page"]),mt=e.object({task_id:e.string().min(1),group_id:e.string().min(1),kind:Ko,target_path:O,block_id:e.string().min(1).optional(),block_type:e.string().min(1).optional(),block_variant:e.string().min(1).optional(),block_order:e.number().int().nonnegative().optional(),user_instruction:e.string().min(1).optional(),page_id:e.string().min(1).optional(),page_slug:e.string().min(1).optional(),page_title:e.string().min(1).optional(),title:e.string().min(1).max(60).optional(),description:e.string().min(1).max(it).optional(),status:z,required_reads:e.array(O).optional()}),lt=e.object({from_group_id:e.string().min(1),to_group_id:e.string().min(1),reason:e.enum(["style_media","chrome","sections","layout","page_composition","quality_gate"])}),Cp=e.object({plan_id:e.string().min(1),run_kind:ke,model_route:e.object({planner:e.literal("workspace_planner"),worker:e.literal("workspace")}),groups:e.array(ct),tasks:e.array(mt),dependencies:e.array(lt),expected_outputs:e.array(O),diagnostics:rt}),Np=e.object({task_id:e.string().min(1),patch:e.unknown().optional(),snapshot_id:e.string().min(1).optional(),read_files:e.array(O),diagnostics:e.array(ot),status:z}),Fn=e.object({worker_count:e.number().int().nonnegative(),task_count:e.number().int().nonnegative(),group_count:e.number().int().nonnegative()}),Bn=e.object({pending:e.number().int().nonnegative(),running:e.number().int().nonnegative(),completed:e.number().int().nonnegative(),completed_with_skips:e.number().int().nonnegative(),failed:e.number().int().nonnegative(),skipped:e.number().int().nonnegative()}),Go=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"]).optional()}),Fo=e.object({type:e.literal("reasoning"),text:e.string(),state:e.enum(["streaming","done"]).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),Bo=e.object({type:e.literal("file"),mediaType:e.string().min(1),filename:e.string().min(1).optional(),url:e.string().min(1)}),qo=e.object({type:e.literal("source-url"),sourceId:e.string().min(1),url:e.string().min(1),title:e.string().min(1).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),Wo=e.object({type:e.literal("source-document"),sourceId:e.string().min(1),mediaType:e.string().min(1),title:e.string().min(1),filename:e.string().min(1).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),Ho=e.object({type:e.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:e.string().min(1).optional(),data:e.unknown()}),Vo=e.object({type:e.string().regex(/^tool-[a-zA-Z0-9_-]+$/),toolCallId:e.string().min(1),state:e.enum(["input-streaming","input-available","output-available","output-error"]),input:e.unknown().optional(),output:e.unknown().optional(),errorText:e.string().min(1).optional()}),zo=e.object({type:e.literal("error"),errorText:e.string().min(1)}),$o=e.object({type:e.literal("step-start")}),Ie=e.union([Go,Fo,Bo,qo,Wo,Ho,Vo,zo,$o]),Yo=e.string().min(1).max(512).refine(t=>Qn(t)&&!/^[A-Za-z]:\//.test(t),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),Xo=e.array(Yo).min(1).max(64),Qo=e.array(e.string().min(1).max(120)).min(1).max(64),Zo=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("message.delta"),text:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("user.message"),client_message_id:e.string().min(1),message_id:e.string().min(1),parts:e.array(Ie).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("plan.updated"),steps:e.array(Uo),at:e.string().min(1)}),e.object({type:e.literal("clarify.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("clarify.archetype_proposals"),proposals:e.array(xn).min(1).max(5),at:e.string().min(1)}),e.object({type:e.literal("clarify.finished"),questions_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:Mn,message:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generated"),sitemap_id:e.string().min(1),sitemap:Te,...Ln,at:e.string().min(1)}),e.object({type:e.literal("sitemap.clamped"),reason:e.enum(["page_early_stop","finalize_best_effort"]),original_page_count:e.number().int().nonnegative().optional(),final_page_count:e.number().int().nonnegative().optional(),original_enabled_block_count:e.number().int().nonnegative().optional(),final_enabled_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("sitemap.updated"),sitemap_id:e.string().min(1),version:e.number().int().positive(),reason:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.resync.failed"),error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),diagnostics:e.unknown().optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.resync.warning"),code:e.string().min(1),message:e.string().min(1),diagnostics:e.unknown().optional(),at:e.string().min(1)}),e.object({type:e.literal("block.changed"),block_id:e.string().min(1),change_type:e.enum(["add","update","delete","move"]),at:e.string().min(1)}),e.object({type:e.literal("tool.started"),tool_call_id:e.string().min(1),name:e.string().min(1),summary:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("tool.finished"),tool_call_id:e.string().min(1),name:e.string().min(1),result_summary:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("workspace.plan.created"),plan_id:e.string().min(1),run_kind:ke,groups:e.array(ct),tasks:e.array(mt),dependencies:e.array(lt),expected_outputs:e.array(O),diagnostics:rt,summary:Fn,at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.worker.updated"),group_id:e.string().min(1),phase:at,status:z,task_counts:Bn,target_paths:e.array(O),diagnostics:e.array(e.string().min(1)),at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.task.updated"),task_id:e.string().min(1),group_id:e.string().min(1),status:z,target_path:O,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(ot).optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.degraded"),reason:e.enum(["block_placeholder","form_placeholder","patch_protected_dropped","preview_health_degraded","design_plan_fallback","generated_code_rescue"]),degraded_block_ids:e.array(e.string().min(1)).min(1).optional(),dropped_files:e.array(e.string().min(1)).min(1).optional(),degraded_file_paths:Xo.optional(),degraded_page_ids:Qo.optional(),snapshot_id:e.string().min(1).optional(),code:e.string().min(1).optional(),message:e.string().min(1).optional(),diagnostics:e.string().min(1).optional(),retryable:e.boolean().optional(),at:e.string().min(1)}).strict().superRefine((t,n)=>{if(!(t.reason==="generated_code_rescue")){for(let c of["degraded_file_paths","degraded_page_ids"])t[c]!==void 0&&n.addIssue({code:"custom",path:[c],message:`${c} is only allowed for generated_code_rescue`});return}t.degraded_file_paths===void 0&&n.addIssue({code:"custom",path:["degraded_file_paths"],message:"generated_code_rescue requires degraded_file_paths"});for(let c of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])t[c]!==void 0&&n.addIssue({code:"custom",path:[c],message:`${c} is not allowed for generated_code_rescue`})}),e.object({type:e.literal("workspace.design_plan.outcome"),design_plan_outcome:Mo,reason:Lo,at:e.string().min(1)}).strict(),Kn.extend({type:e.literal("workspace.suggestions"),at:e.string().min(1)}).strict(),e.object({type:e.literal("file.changed"),path:e.string().min(1),change_type:e.enum(["create","update","delete"]),diff:e.string().optional(),at:e.string().min(1)}),e.object({type:e.literal("snapshot.created"),snapshot_id:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("snapshot.finalized"),snapshot_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("preview.preparing"),at:e.string().min(1)}),e.object({type:e.literal("preview.ready"),url:e.string().url(),at:e.string().min(1)}),e.object({type:e.literal("preview.build.started"),snapshot_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("preview.build.succeeded"),snapshot_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("preview.build.failed"),snapshot_id:e.string().min(1),message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean(),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),error_category:In.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),outcome:e.literal("retained_previous").optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.started"),slot_count:e.number().int().nonnegative(),at:e.string().datetime()}),e.object({type:e.literal("media_resolution.finished"),slot_count:e.number().int().nonnegative(),provider_counts:e.object({unsplash:e.number().int().nonnegative(),pexels:e.number().int().nonnegative(),placeholder:e.number().int().nonnegative()}),fallback_count:e.number().int().nonnegative(),error_codes:e.array(e.string()),at:e.string().datetime()}),e.object({type:e.literal("skill.selecting"),category:e.literal("page-generation"),available:e.array(e.object({id:e.string().min(1),name:e.string().min(1)})).max(20),at:e.string().min(1)}),e.object({type:e.literal("skill.selected"),category:e.literal("page-generation"),selected:e.object({id:e.string().min(1),name:e.string().min(1),reason:e.string().min(1).max(200)}),at:e.string().min(1)}),e.object({type:e.literal("activity.started"),activity_id:e.string().min(1),parent_activity_id:e.string().min(1).optional(),kind:vn,title:e.string().min(1).max(200),detail:e.string().max(360).optional(),title_code:W.optional(),detail_code:W.optional(),locks_input:e.boolean(),at:e.string().min(1)}),e.object({type:e.literal("activity.updated"),activity_id:e.string().min(1),title:e.string().min(1).max(200).optional(),detail:e.string().max(360).optional(),title_code:W.optional(),detail_code:W.optional(),at:e.string().min(1)}),e.object({type:e.literal("activity.finished"),activity_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("activity.failed"),activity_id:e.string().min(1),detail:e.string().max(360).optional(),at:e.string().min(1)})]),qn=Zo.superRefine(Un),ze=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),agent_run_id:e.string().min(1),sequence:e.number().int().positive(),event_type:Gn,payload:qn,created_at:e.string().min(1)}),jp=e.object({event_type:Gn,payload:qn}).superRefine((t,n)=>{t.event_type!==t.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),me(t.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),Dp=e.discriminatedUnion("status",[e.object({status:e.literal("appended"),agent_run:H,event:ze,next_cursor:e.number().int().nonnegative()}),e.object({status:e.literal("duplicate_ignored"),agent_run:H,event:ze,next_cursor:e.number().int().nonnegative()})]),wp=e.object({events:e.array(ze),next_cursor:e.number().int().nonnegative().optional()}),Op=e.object({after_sequence:e.coerce.number().int().nonnegative().default(0)}),Mp=e.enum(["implemented","skeleton","planned"]),Lp=e.enum(["GET","POST","PUT","PATCH","DELETE"]),Up=[{method:"GET",path:"/health",tag:"system",summary:"API health check.",status:"implemented",response_schema:"ApiHealth"},{method:"POST",path:"/sites",tag:"sites",summary:"Create a site and Step 1 brief in the current dev context.",status:"implemented",request_body_schema:"CreateSiteBriefRequestSchema",response_schema:"CreateSiteBriefResponseSchema"},{method:"POST",path:"/sites/drafts",tag:"sites",summary:"Create a draft site without a brief in the current tenant so /s/:site_id can collect Step 1 later.",status:"implemented",request_body_schema:"CreateSiteDraftRequestSchema",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites",tag:"sites",summary:"List current tenant sites.",status:"implemented",response_schema:"SiteRecordSchema[]"},{method:"GET",path:"/sites/by-cms/:cms_site_id",tag:"sites",summary:"Resolve an external CMS site id to one tenant-scoped VCP site.",status:"implemented",response_schema:"SiteRecordSchema",notes:["Used by the browser /d/:cms_site_id handoff route; lookup is scoped by current request tenant and returns 404 when the CMS site has not been synchronized."]},{method:"GET",path:"/sites/:site_id",tag:"sites",summary:"Get one tenant-scoped site.",status:"implemented",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites/:site_id/designer/component-library/categories",tag:"designer-component-library",summary:"List the fixed insert-new-component category tree for a site.",status:"implemented",response_schema:"ListDesignerComponentCategoriesResponseSchema",notes:["The server validates site ownership and fixes category_group_key to insertNewComponent."]},{method:"GET",path:"/sites/:site_id/designer/component-library/resources",tag:"designer-component-library",summary:"List component resources from the fixed designer catalog group.",status:"implemented",query_schema:"ListDesignerComponentsQuerySchema",response_schema:"ListDesignerComponentsResponseSchema",notes:["The server fixes resource type to component and does not expose resource-platform secrets, internal hosts, or product-line selection."]},{method:"PATCH",path:"/sites/:site_id",tag:"sites",summary:"Update site display name and optional generated-site locale for the current tenant.",status:"implemented",request_body_schema:"UpdateSiteRequestSchema",response_schema:"SiteRecordSchema"},{method:"DELETE",path:"/sites/:site_id",tag:"sites",summary:"Archive a site so it no longer appears in the tenant site list.",status:"implemented",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites/:site_id/plan",tag:"publish-entitlements",summary:"Get the current site plan and custom-domain entitlement.",status:"implemented",query_schema:"locale",response_schema:"GetSitePlanResponseSchema"},{method:"GET",path:"/sites/:site_id/workspace/source-files",tag:"sites",summary:"List source files available in the ready preview sandbox.",status:"implemented",response_schema:"WorkspaceSourceFileListItemSchema[]"},{method:"GET",path:"/sites/:site_id/workspace/source-file",tag:"sites",summary:"Read a source file from the ready preview sandbox.",status:"implemented",query_schema:"WorkspaceSourceFilePathQuerySchema",response_schema:"WorkspaceSourceFileResponseSchema"},{method:"POST",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Persist generated sitemap and advance the site to sitemap_ready.",status:"implemented",request_body_schema:"PersistSiteSitemapRequestSchema",response_schema:"PersistSiteSitemapResponseSchema"},{method:"GET",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Read the current sitemap for a site.",status:"implemented",response_schema:"SitemapRecordSchema"},{method:"POST",path:"/sites/:site_id/clarify/answers",tag:"clarify",summary:"Persist the Step 2 clarify answers (and the answered questions) into the site's clarify session.",status:"implemented",request_body_schema:"PersistClarifyAnswersRequestSchema",response_schema:"PersistClarifyAnswersResponseSchema"},{method:"PATCH",path:"/sites/:site_id/clarify/archetype",tag:"clarify",summary:"Switch the Step 2 industry archetype (user_picked) into the site's clarify session via an idempotent upsert.",status:"implemented",request_body_schema:"UpdateClarifyArchetypeRequestSchema",response_schema:"PersistClarifyAnswersResponseSchema",notes:["Independent of generate: materializes a clarify_sessions row when none exists (using the supplied questions) or updates only selected_archetype; never writes answers/completed_at. Forces source=user_picked."]},{method:"POST",path:"/internal/sites/:site_id/design-plan",tag:"design-plans",summary:"Persist a generated design plan version for a site (internal agent-only write).",status:"implemented",request_body_schema:"PersistSiteDesignPlanRequestSchema",response_schema:"PersistSiteDesignPlanResponseSchema",notes:["Guarded by the internal agent token; only the Workspace/Sitemap agent writes design plans."]},{method:"GET",path:"/internal/sites/:site_id/design-plan",tag:"design-plans",summary:"Read the current (latest version) design plan for a site (internal agent-only read).",status:"implemented",response_schema:"DesignPlanRecordSchema",notes:["Guarded by the internal agent token; only the Workspace/Sitemap agent reads design plans."]},{method:"GET",path:"/sites/:site_id/design-plan",tag:"design-plans",summary:"Read the current (latest version) design plan for a site so Workspace UI can inspect the generated design contract.",status:"implemented",response_schema:"DesignPlanRecordSchema"},{method:"GET",path:"/sites/:site_id/brief",tag:"briefs",summary:"Read the persisted Step 1 brief for a site so the Workspace Agent can seed first full-site generation without a new write surface.",status:"implemented",response_schema:"BriefRecordSchema"},{method:"PUT",path:"/sites/:site_id/brief/draft",tag:"briefs",summary:"Save a draft site's Step 1 brief without advancing the workflow.",status:"implemented",request_body_schema:"SaveBriefDraftRequestSchema",response_schema:"SaveBriefDraftResponseSchema",notes:["Only draft sites with generation_state=planning are writable; the brief row is upserted idempotently while site status, generation state, locale, and workflow stage remain unchanged."]},{method:"PATCH",path:"/sites/:site_id/brief",tag:"briefs",summary:"Create or update a draft site's Step 1 brief and advance it to Clarify without allowing later workflow states to roll back.",status:"implemented",request_body_schema:"UpdateBriefRequestSchema",response_schema:"UpdateBriefResponseSchema",notes:["Only draft sites with generation_state=planning are writable; missing brief rows are created on first save; identical retries after brief_submitted are idempotent."]},{method:"POST",path:"/internal/sites/:cms_site_id/external-sync",tag:"sites",summary:"Synchronize a trusted external CMS site URL into VCP by tenant_id + cms_site_id, creating a draft VCP site on first sync.",status:"implemented",request_body_schema:"ExternalSyncSiteRequestSchema",response_schema:"ExternalSyncSiteResponseSchema",notes:["This trusted external entry does not require browser login or internal bearer auth; tenant_id is written directly to tenants.id and the response uses the internal { code, data, message } success envelope."]},{method:"POST",path:"/sites/:site_id/snapshots",tag:"snapshots",summary:"Persist snapshot metadata without changing the current site snapshot.",status:"implemented",request_body_schema:"PersistSiteSnapshotRequestSchema",response_schema:"PersistSiteSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/promote",tag:"snapshots",summary:"Promote a site snapshot as the current workspace version.",status:"implemented",response_schema:"PromoteSiteSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/snapshots/:snapshot_id",tag:"snapshots",summary:"Read one tenant-scoped snapshot metadata record for a site.",status:"implemented",response_schema:"SnapshotRecordSchema"},{method:"DELETE",path:"/sites/:site_id/snapshots/:snapshot_id",tag:"snapshots",summary:"Delete a candidate snapshot (cleanup of superseded intermediate snapshots; refuses non-candidate/current/referenced).",status:"implemented",response_schema:"DeleteSiteSnapshotResponseSchema"},{method:"POST",path:"/agent-runs",tag:"agent-runs",summary:"Create an agent run for event persistence and replay.",status:"implemented",request_body_schema:"CreateAgentRunRequestSchema",response_schema:"CreateAgentRunResponseSchema"},{method:"POST",path:"/agent-runs/:run_id/events",tag:"agent-runs",summary:"Append one normalized AgentEvent to a run.",status:"implemented",request_body_schema:"AppendAgentEventRequestSchema",response_schema:"AppendAgentEventResponseSchema",notes:["Internal-only write surface: only internal-service callers may append, except browser (oidc) contexts may append run.failed (the WS connect-stage unlock path, equivalent to POST /agent-runs/workspace/cancel). All other oidc appends \u2014 run.finished, run.started, tool/system/progress, file/snapshot \u2014 are rejected with 403 FORBIDDEN. The browser sends user messages over the Workspace WebSocket (recorded server-side as user.message) and otherwise only reads the GET replay."]},{method:"GET",path:"/agent-runs/:run_id/events",tag:"agent-runs",summary:"Replay AgentEvents after a run-local sequence cursor.",status:"implemented",response_schema:"ListAgentEventsResponseSchema"},{method:"POST",path:"/internal/agent-runs/fail-stale-in-flight",tag:"agent-runs",summary:"Fail stale in-flight workspace runs (internal maintenance, cross-tenant sweep).",status:"implemented",response_schema:"FailStaleInFlightWorkspaceRunsResponseSchema",notes:["Internal maintenance endpoint guarded by InternalAgentAuthGuard (Bearer VCP_AGENT_INTERNAL_TOKEN, production fail-closed); the /internal/** prefix is exempt from browser auth middleware so the guard is the sole trust boundary. Not exposed to the browser via agent-proxy; called by an external admin cron / controlled ops script."]},{method:"GET",path:"/briefs",tag:"briefs",summary:"Brief resource summary endpoint until concrete brief APIs land.",status:"skeleton"},{method:"GET",path:"/clarify",tag:"clarify",summary:"Clarify resource summary endpoint; persisted answers write through POST /sites/:site_id/clarify/answers.",status:"skeleton"},{method:"GET",path:"/sitemaps",tag:"sitemaps",summary:"Sitemap resource summary endpoint until collection APIs land.",status:"skeleton"},{method:"GET",path:"/snapshots",tag:"snapshots",summary:"Snapshot resource summary endpoint until collection APIs land.",status:"skeleton"},{method:"GET",path:"/sandbox-sessions",tag:"sandbox-sessions",summary:"Sandbox session resource summary endpoint until preview APIs land.",status:"skeleton"},{method:"GET",path:"/deployments",tag:"deployments",summary:"Deployment resource summary endpoint until publish APIs land.",status:"skeleton"},{method:"GET",path:"/usage",tag:"usage",summary:"Usage resource summary endpoint until cost summaries land.",status:"skeleton"},{method:"GET",path:"/audit",tag:"audit",summary:"Audit resource summary endpoint until audit queries land.",status:"skeleton"},{method:"POST",path:"/sites/:site_id/workspace/runs",tag:"workspace",summary:"Start an asynchronous Workspace Agent run from the current snapshot.",status:"implemented",request_body_schema:"StartWorkspaceRunRequestSchema",response_schema:"StartWorkspaceRunResponseSchema",notes:["Long-running work must be event-driven and must not block API transactions."]},{method:"GET",path:"/sites/:site_id/workspace/runs/latest",tag:"workspace",summary:"Look up the latest workspace Agent run for a site so Step 4 re-entry can replay persisted events without re-triggering the model.",status:"implemented",response_schema:"LatestWorkspaceRunResponseSchema"},{method:"POST",path:"/sites/:site_id/preview-sessions",tag:"sandbox-sessions",summary:"Persist or update an on-demand preview session for a site.",status:"implemented",request_body_schema:"PersistPreviewSessionRequestSchema",response_schema:"PersistPreviewSessionResponseSchema"},{method:"GET",path:"/sites/:site_id/preview-sessions/current",tag:"sandbox-sessions",summary:"Read the latest tenant-scoped preview session for a site.",status:"implemented",response_schema:"SandboxSessionSchema"},{method:"POST",path:"/sites/:site_id/deployments",tag:"deployments",summary:"Queue an explicit user-confirmed deployment from a snapshot.",status:"implemented",request_body_schema:"CreateDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema",notes:["Before creating any deployment record or queue job, the API verifies the site's active subscription; an inactive subscription returns 403 DEPLOYMENT_ENTITLEMENT_REQUIRED, while an unavailable entitlement source prevents deployment creation.","The API returns after creating the deployment record and queue job; worker-service claims deployment_jobs for build and Cloudflare publish."]},{method:"GET",path:"/sites/:site_id/deployments/current",tag:"deployments",summary:"Read the latest deployment for workspace refresh recovery.",status:"implemented",response_schema:"CurrentDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/status",tag:"deployments",summary:"Read current in-flight deployment and latest released deployment.",status:"implemented",response_schema:"GetDeploymentsStatusResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/:deployment_id",tag:"deployments",summary:"Read one tenant-scoped deployment for status polling.",status:"implemented",response_schema:"GetDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/cms/collections",tag:"cms",summary:"List CMS collections for a site.",status:"planned"},{method:"POST",path:"/sites/:site_id/cms/collections",tag:"cms",summary:"Create a CMS collection bound to generated content.",status:"planned"},{method:"GET",path:"/sites/:site_id/cms/collections/:collection_id/entries",tag:"cms",summary:"List CMS entries for a collection.",status:"planned"},{method:"POST",path:"/sites/:site_id/cms/collections/:collection_id/entries",tag:"cms",summary:"Create a CMS entry.",status:"planned"},{method:"PATCH",path:"/sites/:site_id/cms/collections/:collection_id/entries/:entry_id",tag:"cms",summary:"Update a CMS entry.",status:"planned"},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/version-record",tag:"versions",summary:"Record the sandbox accepted git commit for a promoted snapshot version.",status:"implemented",request_body_schema:"RecordSnapshotVersionRequestSchema",response_schema:"RecordSnapshotVersionResponseSchema"},{method:"GET",path:"/sites/:site_id/versions",tag:"versions",summary:"List snapshot-backed site versions.",status:"implemented",response_schema:"ListSiteVersionsResponseSchema"},{method:"POST",path:"/sites/:site_id/versions/:snapshot_id/restore",tag:"versions",summary:"Restore a site to an earlier snapshot version.",status:"implemented",response_schema:"RestoreSiteSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/domains",tag:"custom-domains",summary:"List the site default domain and custom domains.",status:"implemented",response_schema:"ListSiteDomainsResponseSchema"},{method:"POST",path:"/sites/:site_id/domains",tag:"custom-domains",summary:"Bind a custom domain for site publishing.",status:"implemented",request_body_schema:"BindSiteDomainRequestSchema",response_schema:"BindSiteDomainResponseSchema",notes:["Returns 403 CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED and never calls the downstream bind API when the site has no active subscription or subscription status cannot be confirmed."]},{method:"GET",path:"/sites/:site_id/domains/:hostname",tag:"custom-domains",summary:"Get DNS verification detail for a custom domain.",status:"implemented",response_schema:"GetSiteDomainDetailResponseSchema"},{method:"POST",path:"/sites/:site_id/domains/:hostname/verify",tag:"custom-domains",summary:"Refresh DNS verification status for a custom domain.",status:"implemented",response_schema:"VerifySiteDomainResponseSchema"},{method:"DELETE",path:"/sites/:site_id/domains/:hostname",tag:"custom-domains",summary:"Delete a non-primary custom domain.",status:"implemented",response_schema:"DeleteSiteDomainResponseSchema"},{method:"GET",path:"/admin/tenants",tag:"admin",summary:"Admin tenant listing.",status:"planned"},{method:"GET",path:"/usage/summary",tag:"usage",summary:"Summarize tenant usage and cost controls.",status:"planned"}],Kp=[{method:"POST",path:"/v1/agent/clarify/:site_id",tag:"clarify",summary:"Stream Step 2 clarify questions as SSE; event_order includes optional skill.selecting, skill.selected, clarify.archetype_proposals, and run.failed on errors.",status:"implemented",request_body_schema:"ClarifyRunInputSchema without tenant_id/site_id",event_schema:"ClarifyStreamEventSchema",event_order:["run.started","skill.selecting","skill.selected","clarify.partial","clarify.archetype_proposals","clarify.finished","run.failed"]},{method:"POST",path:"/v1/agent/sitemap/:site_id",tag:"sitemap",summary:"Stream Step 3 sitemap generation as SSE; event_order includes sitemap.partial and run.failed on errors.",status:"implemented",request_body_schema:"SitemapRunInputSchema public body without server-injected fields",event_schema:"SitemapStreamEventSchema",event_order:["run.started","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","run.failed"]}],Jo=e.object({id:e.string().min(1),role:e.enum(["system","user","assistant"]),metadata:e.unknown().optional(),parts:e.array(Ie).min(1)}),Wn=Jo.extend({role:e.literal("user")}),Gp=e.object({base_snapshot_id:e.string().min(1).optional(),message:Wn.optional(),client_run_key:e.string().min(1).max(200).optional()}).superRefine((t,n)=>{me(t.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),er=e.object({path:e.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:e.string().min(1),base_snapshot_id:e.string().min(1),run_kind:ke}),Fp=e.object({agent_run:H,websocket:er,next_step:e.literal("workspace_socket")}),Bp=e.object({agent_run:H}),qp=e.object({agent_type:e.enum(["clarify","sitemap","workspace"])}),Wp=e.object({agent_run:H}),Hp=e.enum(["client.message.create","client.run.cancel","client.tool.approve","server.run.started","server.user.message","server.assistant.delta","server.tool.started","server.tool.completed","server.workspace.suggestions","workspace.plan.created","workspace.worker.updated","workspace.task.updated","server.patch.applied","server.sitemap.updated","server.snapshot.created","server.snapshot.finalized","server.preview.invalidated","preview.build.started","preview.build.succeeded","preview.build.failed","server.run.finished","server.run.failed","server.error","server.activity.started","server.activity.updated","server.activity.finished","server.activity.failed"]),x=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),run_id:e.string().min(1).optional(),correlation_id:e.string().min(1).optional(),seq:e.number().int().positive().optional(),sent_at:e.string().min(1)}),tr=e.object({key:e.string().min(1),label:e.string().min(1),source_file:e.string().min(1).optional(),component_name:e.string().min(1).optional(),opening_element_range:e.object({start_line:e.number().int().positive(),start_column:e.number().int().nonnegative(),end_line:e.number().int().positive(),end_column:e.number().int().nonnegative()}).optional(),structural_path:e.string().min(1).optional(),text_preview:e.string().min(1).optional()}),nr=e.discriminatedUnion("type",[x.extend({type:e.literal("client.message.create"),payload:e.object({client_message_id:e.string().min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),selected_component:tr.optional(),message:Wn,base_snapshot_id:e.string().min(1).optional()})}),x.extend({type:e.literal("client.run.cancel"),payload:e.object({run_id:e.string().min(1),reason:e.string().min(1).optional()})}),x.extend({type:e.literal("client.tool.approve"),payload:e.object({tool_call_id:e.string().min(1),decision:e.enum(["approve","reject"]),reason:e.string().min(1).optional()})})]),ir=e.discriminatedUnion("type",[x.extend({type:e.literal("server.run.started"),payload:e.object({run_id:e.string().min(1),agent_type:e.literal("workspace")})}),x.extend({type:e.literal("server.user.message"),payload:e.object({client_message_id:e.string().min(1),message_id:e.string().min(1),parts:e.array(Ie).min(1),in_reply_to_tool_call_id:e.string().min(1).optional()})}),x.extend({type:e.literal("server.assistant.delta"),payload:e.object({message_id:e.string().min(1),parts:e.array(Ie).min(1),status:e.enum(["streaming","ready"])})}),x.extend({type:e.literal("server.tool.started"),payload:e.object({tool_call_id:e.string().min(1),name:e.string().min(1),summary:e.string().min(1)})}),x.extend({type:e.literal("server.tool.completed"),payload:e.object({tool_call_id:e.string().min(1),name:e.string().min(1),result_summary:e.string().min(1)})}),x.extend({type:e.literal("server.workspace.suggestions"),payload:Kn.extend({run_id:e.string().min(1)}).strict()}),x.extend({type:e.literal("workspace.plan.created"),payload:e.object({plan_id:e.string().min(1),run_kind:ke,groups:e.array(ct),tasks:e.array(mt),dependencies:e.array(lt),expected_outputs:e.array(O),diagnostics:rt,summary:Fn})}),x.extend({type:e.literal("workspace.worker.updated"),payload:e.object({group_id:e.string().min(1),phase:at,status:z,task_counts:Bn,target_paths:e.array(O),diagnostics:e.array(e.string().min(1))})}),x.extend({type:e.literal("workspace.task.updated"),payload:e.object({task_id:e.string().min(1),group_id:e.string().min(1),status:z,target_path:O,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(ot).optional()})}),x.extend({type:e.literal("server.patch.applied"),payload:e.object({patch_batch_id:e.string().min(1),changed_files:e.array(e.string().min(1)),sitemap_resync_queued:e.boolean()})}),x.extend({type:e.literal("server.sitemap.updated"),payload:e.object({sitemap_id:e.string().min(1),version:e.number().int().positive(),reason:e.string().min(1)})}),x.extend({type:e.literal("server.snapshot.created"),payload:e.object({snapshot_id:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/)})}),x.extend({type:e.literal("server.snapshot.finalized"),payload:e.object({snapshot_id:e.string().min(1)})}),x.extend({type:e.literal("server.preview.invalidated"),payload:e.object({reason:e.string().min(1),next_preview_url:e.string().url().optional()})}),x.extend({type:e.literal("preview.build.started"),payload:e.object({snapshot_id:e.string().min(1)})}),x.extend({type:e.literal("preview.build.succeeded"),payload:e.object({snapshot_id:e.string().min(1)})}),x.extend({type:e.literal("preview.build.failed"),payload:e.object({snapshot_id:e.string().min(1),message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean()})}),x.extend({type:e.literal("server.run.finished"),payload:e.object({run_id:e.string().min(1),snapshot_id:e.string().min(1)})}),x.extend({type:e.literal("server.run.failed"),payload:e.object({run_id:e.string().min(1),error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),outcome:e.literal("retained_previous").optional()})}),x.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})}),x.extend({type:e.literal("server.activity.started"),payload:e.object({activity_id:e.string().min(1),parent_activity_id:e.string().min(1).optional(),kind:vn,title:e.string().min(1).max(200),title_code:W.optional(),detail:e.string().max(360).optional(),detail_code:W.optional(),locks_input:e.boolean()})}),x.extend({type:e.literal("server.activity.updated"),payload:e.object({activity_id:e.string().min(1),title:e.string().min(1).max(200).optional(),title_code:W.optional(),detail:e.string().max(360).optional(),detail_code:W.optional()})}),x.extend({type:e.literal("server.activity.finished"),payload:e.object({activity_id:e.string().min(1)})}),x.extend({type:e.literal("server.activity.failed"),payload:e.object({activity_id:e.string().min(1),detail:e.string().max(360).optional()})})]),Vp=e.union([nr,ir]),zp={path:"/v1/workspace/sites/:site_id/socket",protocol:"ws",status:"implemented",inbound_message_schema:"WorkspaceClientMessageSchema",outbound_message_schema:"WorkspaceServerMessageSchema",query_parameters:[{name:"run_id",required:!1,schema:"string",summary:"Workspace run id returned by the API run-start response."},{name:"run_kind",required:!1,schema:"WorkspaceRunKindSchema",summary:"Workspace run mode; initial_generation can auto-start when base_snapshot_id is present."},{name:"base_snapshot_id",required:!1,schema:"string",summary:"Authoritative base snapshot id for this workspace run."}],ai_sdk_ui_compatible:!0,notes:["Assistant UI output is carried as AI SDK UIMessage parts, including text, data-*, and tool-* parts.","Operational AgentEvents remain persisted separately for replay and audit."]},Hn=e.string().regex(/^sha256:[a-f0-9]{64}$/),sr=e.enum(["create","update","delete","str_replace"]),Vn=e.enum(["sitemap_resync","smoke_test","prepare_preview"]),ar=e.object({old_string:e.string().min(1).describe("Exact text to find in the current file. Must match the file uniquely; include enough surrounding context (usually 2-4 adjacent lines)."),new_string:e.string().describe("Replacement text. May be empty to delete the matched text."),replace_all:e.boolean().optional()}).strict(),or=e.object({path:O,operation:sr,expected_hash:Hn.optional(),full_content:e.string().describe("Complete file content for create/update patches. It is passed as a JSON string, so every double quote in source code must be valid JSON; avoid ASCII double quotes inside JSX attribute values and use corner quotes like \u300C\u751F\u65E5\u5FEB\u4E50\u300D for visitor-facing quoted examples.").optional(),edits:e.array(ar).min(1).max(20).optional()}).strict().superRefine((t,n)=>{let a=t.full_content!==void 0;if(t.operation==="delete"){a&&n.addIssue({code:"custom",path:["full_content"],message:"delete patches must not include full_content"}),t.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"});return}if(br(t.path)||n.addIssue({code:"custom",path:["path"],message:"Static App Router page paths must use lowercase ASCII kebab-case public segments."}),t.operation==="str_replace"){t.full_content!==void 0&&n.addIssue({code:"custom",path:["full_content"],message:"str_replace patches must not include full_content"}),(!t.edits||t.edits.length===0)&&n.addIssue({code:"custom",path:["edits"],message:"str_replace patches must include a non-empty edits array"});return}a||n.addIssue({code:"custom",path:["full_content"],message:"create/update patches must include full_content"}),t.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"})}),rr=e.object({kind:e.enum(["block","page","site","chrome"]),id:e.string().min(1).max(120)}),cr=e.object({base_key:e.string().min(1).max(120).regex(/^[A-Za-z0-9._:-]+$/).refine(t=>!t.includes(".."),{message:"base_key must not contain '..'"}),owner:rr,count:e.number().int().min(1).max(12),query:e.string().min(1).max(400),role:e.enum(["hero","section","card","gallery","testimonial","decorative","site_background","nav_background","footer_background"]),orientation:e.enum(["landscape","portrait","square"]).optional(),altHint:e.string().min(1).max(300)}),zn=e.object({site_id:e.string().min(1),base_snapshot_id:e.string().min(1),reason:e.string().min(1),patches:e.array(or).min(1),media_requests:e.array(cr).max(24).optional(),post_actions:e.array(Vn).optional()});function $n(t,n){let a=new Set;for(let[c,r]of t.patches.entries())a.has(r.path)&&n.addIssue({code:"custom",path:["patches",c,"path"],message:`Duplicate patch path: ${r.path}`}),a.add(r.path)}var $p=zn.superRefine($n),Yp=zn.omit({base_snapshot_id:!0}).extend({site_id:e.string().min(1).optional()}).superRefine($n),mr=M,lr=e.object({path:mr,operation:e.enum(["upsert","delete"]).optional()}),Xp=e.object({files:e.array(lr).min(1)}).strict(),pr=e.enum(["BASE_SNAPSHOT_NOT_FOUND","PATCH_TARGET_NOT_FOUND","PATCH_TARGET_ALREADY_EXISTS","PATCH_EXPECTED_HASH_MISMATCH","PATCH_DIFF_UNSUPPORTED","PATCH_PROTECTED_FILE","PATCH_VALIDATION_FAILED","PATCH_MEDIA_REFERENCE_NOT_DECLARED","PATCH_BATCH_INVALID","PATCH_BATCH_FAILED","PATCH_BATCH_TOO_LARGE","STR_REPLACE_NOT_FOUND","STR_REPLACE_NOT_UNIQUE","STR_REPLACE_BINARY_FILE","STR_REPLACE_REQUIRES_READ"]),dr=e.object({status:e.literal("applied"),patch_batch_id:e.string().min(1),site_id:e.string().min(1),base_snapshot_id:e.string().min(1),snapshot_id:e.string().min(1),manifest_hash:Hn,object_key:e.string().min(1),changed_files:e.array(O).min(1),post_actions_queued:e.array(Vn),dropped_protected_files:e.array(e.string().min(1)).min(1).optional()}),ur=e.object({status:e.literal("failed"),code:pr,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),Qp=e.discriminatedUnion("status",[dr,ur]),Zp=e.object({ok:e.literal(!0)}),Yn=M,gr=e.enum(["text","binary"]),Xn=e.object({path:Yn,kind:gr,language:e.string().min(1).nullable(),size_bytes:e.number().int().nonnegative()}),Jp=e.object({path:Yn}),hr=Xn.extend({kind:e.literal("text"),language:e.string().min(1),content:e.string()}),Sr=Xn.extend({kind:e.literal("binary"),language:e.null(),mime_type:e.string().min(1),content_base64:e.string().min(1)}),ed=e.union([hr,Sr]);function me(t){return typeof t=="string"?/authorization\s*:|bearer\s+|token\s*=|secret\s*=|api[_-]?key\s*=|access[_\s-]?key\s*=|\bsk-[a-z0-9_-]{20,}|eyJ[a-z0-9_-]{10,}\.[a-z0-9_-]{10,}\.[a-z0-9_-]{10,}/i.test(t):!t||typeof t!="object"?!1:Array.isArray(t)?t.some(n=>me(n)):Object.entries(t).some(([n,a])=>_r(n)||me(a))}function _r(t){let n=t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/\s+/g,"_").toLowerCase();return/(^|[_-])(authorization|token|secret|api[_-]?key|apikey|access[_-]?key|accesskey)([_-]|$)/.test(n)}function Qn(t){let n=t.split("/");return t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&n.every(a=>a!==""&&a!=="."&&a!=="..")}function br(t){let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(t);if(!n)return!0;let c=(n[1]??"").split("/").filter(m=>m.length>0);return c.some(m=>m.startsWith("_"))?!0:c.filter(m=>!m.startsWith("@")&&!/^\(.+\)$/.test(m)).map(m=>m.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(m=>m.length>0).every(m=>/^\[.*\]$/.test(m)||ee.test(`/${m}`))}var Zn=e.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),yr=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),sandbox_id:e.string().min(1).nullable(),status:Zn,source_snapshot_id:e.string().min(1).nullable(),last_snapshot_id:e.string().min(1).nullable(),preview_url:e.string().url().nullable(),last_activity_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),td=e.object({session_id:e.string().min(1).optional(),sandbox_id:e.string().min(1).optional(),source_snapshot_id:e.string().min(1).optional(),last_snapshot_id:e.string().min(1),status:Zn,preview_url:e.string().url().optional()}),nd=e.object({preview_session:yr,next_step:e.literal("preview")}),id=e.object({failed_count:e.number().int().nonnegative()}),sd=e.object({site_id:e.string().min(1)}),ad=e.object({status:e.enum(["cancelled","no_active_run"]),agent_run:H.nullable()});export{vn as ActivityKindSchema,W as ActivityTitleCodeSchema,In as AgentErrorCategorySchema,ze as AgentEventRecordSchema,qn as AgentEventSchema,Gn as AgentEventTypeSchema,kn as AgentModelRouteSchema,Uo as AgentPlanStepSchema,Tn as AgentRunKindSchema,H as AgentRunRecordSchema,za as AgentRunStatusSchema,Rn as AgentRunTypeSchema,Ho as AiSdkUiDataPartSchema,zo as AiSdkUiErrorPartSchema,Bo as AiSdkUiFilePartSchema,Ie as AiSdkUiMessagePartSchema,Jo as AiSdkUiMessageSchema,Fo as AiSdkUiReasoningPartSchema,Wo as AiSdkUiSourceDocumentPartSchema,qo as AiSdkUiSourceUrlPartSchema,$o as AiSdkUiStepStartPartSchema,Go as AiSdkUiTextPartSchema,Vo as AiSdkUiToolPartSchema,Mp as ApiContractStatusSchema,Qa as ApiErrorEnvelopeSchema,B as ApiResponseSchema,jp as AppendAgentEventRequestSchema,Dp as AppendAgentEventResponseSchema,pr as ApplyPatchBatchErrorCodeSchema,ur as ApplyPatchBatchFailureSchema,$p as ApplyPatchBatchInputSchema,or as ApplyPatchBatchPatchSchema,Vn as ApplyPatchBatchPostActionSchema,Qp as ApplyPatchBatchResultSchema,dr as ApplyPatchBatchSuccessSchema,Yp as ApplyPatchBatchToolInputSchema,ar as ApplyPatchEditSchema,sr as ApplyPatchOperationSchema,xn as ArchetypeProposalSchema,ua as BINDING_STATUSES,mn as BindSiteDomainDataSchema,el as BindSiteDomainRequestSchema,Dl as BindSiteDomainResponseSchema,Cn as BlockGenerationContextSchema,lp as BlockMediaIntentSchema,uo as BlockSchema,Nn as BrandingSchema,Je as BriefRecordSchema,Cm as CHAT_COPY,vm as CLARIFICATION_COPY,sn as CURRENT_EDIT_ENGINE_VERSION,Jm as CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED_ERROR_CODE,_a as CUSTOM_DOMAIN_STATUSES,sd as CancelActiveWorkspaceRunRequestSchema,ad as CancelActiveWorkspaceRunResponseSchema,jn as ChromeDesignSchema,lo as ChromeFooterDesignSchema,mo as ChromeFooterShellSchema,ro as ChromeHeaderDesignSchema,oo as ChromeHeaderShellSchema,po as ChromeMobileNavDesignSchema,Fa as ClarifyQuestionOptionSchema,Ba as ClarifyQuestionSchema,Ua as ClarifyQuestionTypeSchema,Qe as ClarifyQuestionsSchema,hl as ClarifyRunInputSchema,jo as ClarifySessionRecordSchema,Sl as ClarifyStreamEventSchema,Vm as CmsCollectionBindingSchema,Km as ConnectDynamicCollectionInputSchema,Bm as ConnectFormInputSchema,Ye as ConversionHintsSchema,cp as CreateAgentRunConflictResponseSchema,Fl as CreateAgentRunRequestSchema,Bl as CreateAgentRunResponseSchema,ep as CreateDeploymentRequestSchema,tp as CreateDeploymentResponseSchema,Pr as CreateDocumentUploadRequestSchema,wr as CreateImageUploadRequestSchema,Ir as CreateInputSourceRequestSchema,Il as CreateSiteBriefRequestSchema,Ul as CreateSiteBriefResponseSchema,Rl as CreateSiteDraftRequestSchema,xl as CreateSiteInputSchema,si as CreateTextInputSourceRequestSchema,ai as CreateUrlInputSourceRequestSchema,np as CurrentDeploymentResponseSchema,ya as CustomDomainDnsRecordPurposeSchema,Ea as CustomDomainDnsRecordSchema,fa as CustomDomainDnsRecordStatusSchema,ba as CustomDomainStatusSchema,Ia as DEFAULT_FONTS,Pi as DEFAULT_SITE_LOCALE,Jl as DEPLOYMENT_ENTITLEMENT_REQUIRED_ERROR_CODE,Xa as DEPLOYMENT_REALTIME_CHANNEL,pt as DEPLOYMENT_STATUSES,rp as DEPLOYMENT_WEBSOCKET_CONTRACT,Qr as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,Rr as DOCUMENT_EXTENSION_WHITELIST,Tr as DOCUMENT_MIME_WHITELIST,xa as DefaultPublishDomainSchema,dn as DeleteSiteDomainDataSchema,Ml as DeleteSiteDomainResponseSchema,Vl as DeleteSiteSnapshotResponseSchema,Re as DeploymentRecordSchema,op as DeploymentRedisPubSubEventSchema,nt as DeploymentStatusSchema,bn as DeploymentStatusSummarySchema,ap as DeploymentWsServerMessageSchema,Ya as DeploymentWsServerMessageTypeSchema,Mo as DesignPlanGenerationOutcomeSchema,Lo as DesignPlanGenerationReasonSchema,up as DesignPlanPatchSchema,Do as DesignPlanRecordSchema,Dn as DesignPlanSchema,mp as DesignTokensSchema,Ci as DesignerComponentCatalogItemSchema,It as DesignerComponentCategoriesDataSchema,xt as DesignerComponentCategoryNodeSchema,Rt as DesignerComponentsDataSchema,jm as EDIT_ENGINE_VERSION_HEADER,Dm as EDIT_ENGINE_VERSION_SOURCE_HEADER,Am as ERROR_COPY,We as EditEngineVersionParseError,Pl as ExternalSyncSiteRequestSchema,Nl as ExternalSyncSiteResponseSchema,ti as ExtractedFactKindSchema,pe as ExtractedFactSchema,ma as FIELD_TYPES,Da as FONT_PAIRINGS,la as FORM_FIELD_TYPES,id as FailStaleInFlightWorkspaceRunsResponseSchema,an as FieldDeclSchema,co as FooterShellSurfaceSchema,pa as FormFieldDeclSchema,ip as GetDeploymentResponseSchema,sp as GetDeploymentsStatusResponseSchema,pn as GetSiteDomainDetailDataSchema,Ol as GetSiteDomainDetailResponseSchema,rn as GetSitePlanDataSchema,Ll as GetSitePlanResponseSchema,so as HeaderShellBehaviorSchema,ao as HeaderShellShapeSchema,io as HeaderShellSurfaceSchema,no as HeaderShellVariantSchema,Cr as IMAGE_EXTENSION_WHITELIST,Nr as IMAGE_MIME_WHITELIST,Et as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,vi as ISO_639_3_TO_SITE_LOCALE,oi as ImageRoleSchema,Wn as InboundUserMessageSchema,ei as InputBundleStatusSchema,ue as InputConflictSchema,Or as InputContextBundleSchema,ii as InputSourceSchema,ve as InputSourceStatusSchema,Pe as InputSourceTypeSchema,Ii as LEGACY_SITE_LOCALE_CODES,qp as LatestAgentRunQuerySchema,Wp as LatestAgentRunResponseSchema,Bp as LatestWorkspaceRunResponseSchema,Op as ListAgentEventsQuerySchema,wp as ListAgentEventsResponseSchema,vl as ListDesignerComponentCategoriesResponseSchema,Zr as ListDesignerComponentsQuerySchema,Cl as ListDesignerComponentsResponseSchema,cn as ListSiteDomainsDataSchema,jl as ListSiteDomainsResponseSchema,Yl as ListSiteVersionsResponseSchema,Ar as MAX_DOCUMENT_SOURCES_PER_SITE,kr as MAX_DOCUMENT_UPLOAD_BYTES,Dr as MAX_IMAGE_SOURCES_PER_SITE,jr as MAX_IMAGE_UPLOAD_BYTES,dp as MediaAssetSchema,eo as MediaAttributionSchema,rr as MediaRequestOwnerSchema,Xe as MotionLevelSchema,Aa as NEXT_FONT_DISPLAY_NAMES,ce as NEXT_FONT_REGISTRY,ee as PAGE_SLUG_PATTERN,$ as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,wn as PageSchema,go as PageSlugSchema,Tp as PersistClarifyAnswersRequestSchema,kp as PersistClarifyAnswersResponseSchema,td as PersistPreviewSessionRequestSchema,nd as PersistPreviewSessionResponseSchema,Pp as PersistSiteDesignPlanRequestSchema,vp as PersistSiteDesignPlanResponseSchema,Ip as PersistSiteSitemapRequestSchema,Rp as PersistSiteSitemapResponseSchema,ql as PersistSiteSnapshotRequestSchema,Wl as PersistSiteSnapshotResponseSchema,La as PositioningPrefillSchema,Ve as PositioningSourceSchema,Ql as PrepareVersionPreviewRequestSchema,Zl as PrepareVersionPreviewResponseSchema,Hl as PromoteSiteSnapshotResponseSchema,Sa as PublishEntitlementSchema,ga as PublishPlanFeatureSnapshotSchema,ha as PublishPlanSchema,Pm as REFUSAL_COPY,Up as REST_API_ENDPOINTS,zl as RecordSnapshotVersionRequestSchema,$l as RecordSnapshotVersionResponseSchema,ni as ReferencePagePatternSchema,de as ReferenceSignalsSchema,Um as ResolvedFieldSchema,qm as ResolvedFormFieldSchema,Lp as RestApiMethodSchema,Xl as RestoreSiteSnapshotResponseSchema,Pn as RouteGenerationCardSchema,ft as SELECTABLE_SITE_LOCALE_CODES,Hc as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,Fi as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,Gi as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,Bi as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,Lt as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,Tc as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,Zs as SITE_EDIT_RUNTIME_CONTAINER_TAGS,Js as SITE_EDIT_RUNTIME_TEXT_TAGS,Qs as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,_c as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,ci as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,dt as SITE_EDIT_SOURCE_ALLOWED_DIRS,ri as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,Ce as SITE_EDIT_SOURCE_DELETE_CAPABILITY,mi as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,Ri as SITE_LOCALE_CODES,fl as SITE_PLANNING_FROZEN_ERROR_CODE,El as SITE_PLANNING_LOCKED_ERROR_CODE,Kp as SSE_STREAMS,Hr as SUPPORTED_SITE_LOCALES,yr as SandboxSessionSchema,Zn as SandboxSessionStatusSchema,Al as SaveBriefDraftRequestSchema,Gl as SaveBriefDraftResponseSchema,re as SiteCustomDomainSchema,An as SiteDesignContextSchema,Ka as SiteDesignDensitySchema,Ga as SiteDesignMotionLevelSchema,Se as SiteEditBoundaryKindSchema,Oi as SiteEditCapabilityConstraintSchema,Di as SiteEditCapabilityModeSchema,he as SiteEditCapabilityModeViewSchema,Ui as SiteEditClassNameSourceDiagnosticSchema,V as SiteEditClassNameSourceRangeSchema,Ct as SiteEditClassNameSourceSchema,cc as SiteEditClassNameSourceStyleContextSchema,vt as SiteEditClassNameSourceStylesheetSchema,Oe as SiteEditClassNameSourceWriteIntentSchema,sc as SiteEditCommandDiagnosticSchema,Mi as SiteEditCommandErrorSchema,wi as SiteEditConstraintKindSchema,Bs as SiteEditDynamicConfidenceSchema,Ws as SiteEditDynamicDataBindingSchema,Qt as SiteEditDynamicDataDetailSchema,Zt as SiteEditDynamicDataSummarySchema,qs as SiteEditDynamicEvidenceSchema,Xt as SiteEditDynamicSourceKindSchema,Gs as SiteEditDynamicSourceTypeSchema,Fs as SiteEditDynamicTargetKindSchema,zs as SiteEditEffectiveWriteTargetSchema,Me as SiteEditElementPropertySchema,Bc as SiteEditEventSchema,Ge as SiteEditExternalSourceKindSchema,lc as SiteEditGetClassNameSourceCommandResultSchema,mc as SiteEditGetClassNameSourceResultSchema,vs as SiteEditHistoryReadOnlyRecoveryStatusSchema,Ts as SiteEditHistoryRecoveryCodeSchema,ks as SiteEditHistoryRecoveryDiagnosticSchema,Vc as SiteEditHistoryStatusModeSchema,zc as SiteEditHistoryStatusSchema,As as SiteEditHistoryUnavailableReasonSchema,Cs as SiteEditHistoryUnavailableStatusSchema,Ps as SiteEditHistoryWritableStatusSchema,Tm as SiteEditInitializeSessionInputSchema,Es as SiteEditInsertNodeSpecSchema,$i as SiteEditMaterializationDataRequirementsSchema,zi as SiteEditMaterializationEntrySchema,Vi as SiteEditMaterializationExportSchema,Hi as SiteEditMaterializationFileSchema,Nt as SiteEditMaterializationPathTemplateSchema,jt as SiteEditMaterializationSchema,Gt as SiteEditMoveTargetSchema,te as SiteEditMutationContextSchema,_e as SiteEditNodeCapabilitySnapshotSchema,um as SiteEditObjectCapabilitiesSchema,hm as SiteEditObjectDetailSchema,_m as SiteEditObjectEditContextSchema,bm as SiteEditObjectStyleDetailSchema,Sm as SiteEditObjectSummarySchema,Lc as SiteEditOperationCommandResultSchema,Ht as SiteEditOperationErrorCodeSchema,Vt as SiteEditOperationErrorSchema,xs as SiteEditOperationParamsSchema,fe as SiteEditOperationPayloadSchema,Is as SiteEditOperationRequestSchema,zt as SiteEditOperationSelectionRefSchema,Ks as SiteEditOperationSummarySchema,Ft as SiteEditOperationTargetSchema,se as SiteEditOperationTypeSchema,Kt as SiteEditOperationValueSchema,kc as SiteEditPageCompositionAnyVersionSchema,as as SiteEditPageCompositionAtomicKindSchema,ms as SiteEditPageCompositionBoundaryModeSchema,Zi as SiteEditPageCompositionBusinessMemberSchema,Xi as SiteEditPageCompositionContainerSchema,ie as SiteEditPageCompositionDiagnosticSchema,ye as SiteEditPageCompositionErrorCodeSchema,Ot as SiteEditPageCompositionPlacementTargetSchema,Ji as SiteEditPageCompositionPlacementUnitSchema,is as SiteEditPageCompositionRuntimeRefSchema,ns as SiteEditPageCompositionSchema,ss as SiteEditPageCompositionSourceMemberKindSchema,Qi as SiteEditPageCompositionSourceMemberSchema,Ut as SiteEditPageCompositionSourceRangeSchema,es as SiteEditPageCompositionSupportedSchema,ts as SiteEditPageCompositionUnsupportedSchema,cs as SiteEditPageCompositionV2BusinessMemberSchema,os as SiteEditPageCompositionV2ContainerSchema,ps as SiteEditPageCompositionV2PlacementRelationSchema,us as SiteEditPageCompositionV2PlacementSchema,ls as SiteEditPageCompositionV2PlacementUnitSchema,_s as SiteEditPageCompositionV2Schema,rs as SiteEditPageCompositionV2SourceMemberSchema,hs as SiteEditPageCompositionV2SupportedSchema,Ss as SiteEditPageCompositionV2UnsupportedSchema,ds as SiteEditPageCompositionV2WriteModeSchema,gs as SiteEditPageCompositionVisualAnchorSchema,wt as SiteEditPagePlacementOptionSchema,Ue as SiteEditPagePlacementSchema,Mt as SiteEditPageUnitTargetSchema,Ds as SiteEditPatchPlanPatchSchema,Xc as SiteEditPatchPlanSchema,oe as SiteEditProvenanceChainSchema,$s as SiteEditProvenanceHopSchema,dm as SiteEditRenderDocumentSchema,ae as SiteEditRenderEntryRefSchema,Hs as SiteEditRenderEntrySchema,Yt as SiteEditRenderPageCompositionSchema,Ls as SiteEditRenderPageCompositionSupportedSchema,Us as SiteEditRenderPageCompositionUnsupportedSchema,Ms as SiteEditRenderPagePlacementSchema,bc as SiteEditRequiredMutationContextEnvelopeSchema,bi as SiteEditResolveSourceLocationInputSchema,en as SiteEditSemanticSourceSchema,Mc as SiteEditSignedOperationRequestSchema,ut as SiteEditSourceDeleteCapabilitySchema,pi as SiteEditSourceDirectoryPathSchema,Si as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,_i as SiteEditSourceFileBinaryResponseSchema,Ur as SiteEditSourceFileKindSchema,di as SiteEditSourceFileListItemSchema,Gr as SiteEditSourceFileResponseSchema,hi as SiteEditSourceFileTextResponseSchema,Le as SiteEditSourceIdentitySchema,yi as SiteEditSourceLocationRangeSchema,Fr as SiteEditSourceLocationSchema,Xs as SiteEditSourceLocatorRangeSchema,Be as SiteEditSourceLocatorSchema,M as SiteEditSourcePathSchema,gt as SiteEditSourceTreeNodeSchema,Kr as SiteEditSourceTreeResponseSchema,ui as SiteEditSourceTreeTruncationReasonSchema,gi as SiteEditSourceTreeTruncationSchema,Wt as SiteEditStyleBreakpointSchema,gm as SiteEditStyleModelSchema,Bt as SiteEditStylePropertySchema,tn as SiteEditStyleSourceSchema,qt as SiteEditStyleStateModeSchema,Fe as SiteEditTextSegmentSchema,Jt as SiteEditTextSourceSchema,Vs as SiteEditWriteTargetSchema,Ha as SiteGenerationStateSchema,q as SiteLocaleSchema,pp as SiteMediaIntentSchema,Q as SiteRecordSchema,qa as SiteStatusSchema,$a as SiteVersionListItemSchema,tt as SiteVersionRecordSchema,bp as SitemapAddBlockInputSchema,st as SitemapAnswerSchema,Sp as SitemapChangeBlockVariantInputSchema,xo as SitemapDeleteBlockInputSchema,Eo as SitemapEditActorSchema,To as SitemapEditErrorCodeSchema,Ao as SitemapEditFailureSchema,Ro as SitemapEditOperationSchema,fp as SitemapEditResultSchema,ko as SitemapEditSuccessSchema,Po as SitemapGenerationOutcomeSchema,vo as SitemapGenerationReasonSchema,Mn as SitemapGenerationStageSchema,gp as SitemapModelOutputSchema,yo as SitemapModelPageSchema,hp as SitemapMoveBlockInputSchema,_o as SitemapNavigationHrefSchema,No as SitemapRecordSchema,Ep as SitemapRunInputSchema,Te as SitemapSchema,xp as SitemapStreamEventSchema,Io as SitemapUpdateBlockInstructionInputSchema,_p as SitemapUpdateBlockPropsInputSchema,Ja as SitemapUserChoiceSchema,Z as SkillSelectionSchema,to as SkillSelectionSourceSchema,Hn as SnapshotContentHashSchema,O as SnapshotFilePathSchema,le as SnapshotRecordSchema,et as SnapshotStatusSchema,Gp as StartWorkspaceRunRequestSchema,Fp as StartWorkspaceRunResponseSchema,wa as THEME_PRESETS,kl as UpdateBriefRequestSchema,Kl as UpdateBriefResponseSchema,Ap as UpdateClarifyArchetypeRequestSchema,Tl as UpdateSiteRequestSchema,ln as VerifySiteDomainDataSchema,wl as VerifySiteDomainResponseSchema,$e as VisualHintsSchema,Za as VisualThemeSchema,zp as WORKSPACE_WEBSOCKET_CONTRACT,nr as WorkspaceClientMessageSchema,Oa as WorkspaceDesignApplyRequestSchema,Ma as WorkspaceDesignApplyResponseSchema,ot as WorkspaceDiagnosticSchema,lr as WorkspaceDirectEditFileSchema,mr as WorkspaceDirectEditPathSchema,Xp as WorkspaceDirectEditRequestSchema,Zp as WorkspaceDirectEditResponseSchema,rt as WorkspaceExecutionDiagnosticsSchema,Cp as WorkspaceExecutionPlanSchema,cr as WorkspaceMediaRequestSchema,lt as WorkspacePlanDependencySchema,Fn as WorkspacePlanSummarySchema,Ko as WorkspacePlanTaskKindSchema,mt as WorkspacePlanTaskSchema,ke as WorkspaceRunKindSchema,tr as WorkspaceSelectedComponentSchema,ir as WorkspaceServerMessageSchema,yp as WorkspaceSitemapEditRequestSchema,er as WorkspaceSocketDescriptorSchema,Sr as WorkspaceSourceFileBinaryResponseSchema,gr as WorkspaceSourceFileKindSchema,Xn as WorkspaceSourceFileListItemSchema,Jp as WorkspaceSourceFilePathQuerySchema,ed as WorkspaceSourceFileResponseSchema,hr as WorkspaceSourceFileTextResponseSchema,Yn as WorkspaceSourcePathSchema,wo as WorkspaceSuggestionSchema,Kn as WorkspaceSuggestionsSchema,Oo as WorkspaceSuggestionsSourceSchema,Bn as WorkspaceTaskCountsSchema,Vp as WorkspaceWebSocketMessageSchema,Hp as WorkspaceWebSocketMessageTypeSchema,ct as WorkspaceWorkerGroupSchema,at as WorkspaceWorkerPhaseSchema,Np as WorkspaceWorkerResultSchema,z as WorkspaceWorkerStatusSchema,bl as assertSiteGenerationStateTransition,_l as assertSiteStatusTransition,At as canonicalizePageSlug,Zc as composeSiteEditRepeatInstanceKey,Yi as computeSiteEditSourceIdentityKey,me as containsSensitiveData,Li as createSiteEditCommandFailureSchema,Pt as createSiteEditCommandResultSchema,we as createSiteEditCommandSuccessSchema,He as fontStack,je as getSiteEditSourceDeleteProtectionReason,Tt as isCanonicalPageSlug,vr as isConsentGranted,ra as isExactEditEngineVersion,Wi as isSiteEditMaterializationPathTemplate,sa as isSiteEditRuntimeContainerTag,aa as isSiteEditRuntimeTextTag,fm as isSiteEditRuntimeVoidElementTag,Br as isSiteEditSourceDeleteProtectedPath,fi as isSiteEditSourceDirectoryPath,ht as isSiteEditSourcePath,Ne as isSiteEditTextSourcePath,ws as makeSiteEditRepeatInstanceKey,$m as normalizeCmsPublicApiBase,ji as pageSlugToRouteFilePath,ca as parseExactEditEngineVersion,Os as parseSiteEditRepeatInstanceKey,Ec as parseSiteEditSourceIdentityKey,Ra as resolveFont,ka as resolveFontDisplayName,yl as resolveGenerationStateForRunLifecycle,fr as resolveRedisConnectionConfig,wm as resolveRequestedEditEngineVersion,Vr as resolveSelectableSiteLocale,Em as resolveSiteEditRuntimeOperationSummary,$r as resolveSiteLocaleFromIso6393,zr as resolveSiteTextDirection,Om as resolveSystemCurrentEditEngineVersion,ja as siteFontVariables,Jc as stripSiteEditRepeatInstanceKeys,kt as tryCanonicalizeAsciiPageSlug};