@vcp-dev/contracts 0.6.10 → 0.6.11
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/api-response.d.ts +11 -0
- package/dist/cms-page-directory.d.ts +245 -0
- package/dist/cms-site-id.d.ts +4 -0
- package/dist/connect-dynamic-collection.d.ts +13 -9
- package/dist/connect-form.d.ts +5 -3
- package/dist/crawler-task-service.d.ts +352 -0
- package/dist/custom-domain.d.ts +36 -2
- package/dist/customer-materials.d.ts +196 -0
- package/dist/deployment-progress.d.ts +51 -0
- package/dist/designer-component-library.d.ts +9 -7
- package/dist/designer-page-library.d.ts +36 -40
- package/dist/external-site-edit.d.ts +258 -0
- package/dist/firecrawl-internal.d.ts +103 -0
- package/dist/form-design.d.ts +79 -81
- package/dist/google-search-console.d.ts +316 -0
- package/dist/index.d.ts +4004 -1136
- package/dist/index.js +1 -1
- package/dist/input-context-bundle.d.ts +6 -6
- package/dist/internal-entity-id.d.ts +2 -0
- package/dist/launcher-prompt-templates.d.ts +639 -0
- package/dist/media-library.d.ts +164 -0
- package/dist/product-search.d.ts +227 -0
- package/dist/publish-quality.d.ts +92 -0
- package/dist/site-edit-event.d.ts +8 -0
- package/dist/site-edit-operation.d.ts +53 -11
- package/dist/site-edit-render-document.d.ts +13 -9
- package/dist/site-preview.d.ts +50 -0
- package/dist/site-workflow.d.ts +1006 -0
- package/dist/sitemap-navigation.d.ts +9 -0
- package/dist/step2-site-initialization.d.ts +209 -0
- package/dist/step3-digital-employee-analysis.d.ts +695 -0
- package/dist/step4-diagnosis.d.ts +204 -0
- package/dist/step5-strategy.d.ts +2697 -0
- package/dist/step6-design.d.ts +672 -0
- package/dist/user-facing-copy.d.ts +1 -0
- package/dist/workspace-resource-operation.d.ts +17 -9
- package/package.json +2 -1
- package/dist/publish-plan.d.ts +0 -54
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";import{z as La}from"zod";var C=La.uuidv7(),ut=C,gp=C,hp=C,_p=C,Sp=C,fp=C,bp=C,E=C,Re=C,ln=C,te=C,gt=C,_=C,un=C,v=C,gn=C,qe=C,Te=C,yp=C,Ep=C,xp=C,Ip=C,Rp=C,ke=C,Tp=C,kp=C,Pp=C;var hn=["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 Cp(t){let n=t.VCP_REDIS_URL??t.REDIS_URL;if(n){let i=new URL(n);return{url:n,host:i.hostname,port:i.port?Number(i.port):6379,password:i.password?decodeURIComponent(i.password):void 0}}return{host:t.VCP_REDIS_HOST??"127.0.0.1",port:Ua(t.VCP_REDIS_PORT,56379)}}function Ua(t,n){if(!t)return n;let i=Number(t);return Number.isInteger(i)&&i>0?i:n}import{z as S}from"zod";var ht=S.enum(["text","url","document","image"]),_t=S.enum(["pending","ready","failed"]),Fa=S.enum(["pending","ready","failed"]),Ka=S.enum(["product","price","contact","copy","audience","other"]),Be=S.object({fact:S.string().min(1).max(300),kind:Ka,source_id:ke,quote:S.string().min(1).max(500),trust:S.enum(["verbatim","ocr"]).default("verbatim")}),Ga=S.object({page_type:S.string().min(1).max(40),sections:S.array(S.string().min(1).max(40)).max(12)}),ze=S.object({source_id:ke,nav_structure:S.array(S.string().min(1).max(30)).max(12),page_patterns:S.array(Ga).max(10),tone:S.array(S.string().min(1).max(20)).max(8),screenshot_ref:S.string().optional()}),qa=S.object({source_id:ke,type:ht,status:_t,title:S.string().max(120).optional(),original_ref:S.string().min(1),source_metadata:S.record(S.string(),S.unknown()),error_code:S.string().optional(),submitted:S.boolean().optional()}),We=S.object({topic:S.string().min(1).max(80),variants:S.array(S.object({value:S.string().min(1).max(300),source_id:ke})).min(2)}),Ba=S.object({type:S.literal("text"),content:S.string().min(20).max(1e4),title:S.string().min(1).max(120).optional()}).strict(),za=S.object({type:S.literal("url"),url:S.string().url().max(2048),rights_ack:S.boolean().optional(),title:S.string().min(1).max(120).optional()}).strict(),jp=S.discriminatedUnion("type",[Ba,za]),Op=[".docx",".html",".md",".txt"],wp=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],Mp=10*1024*1024,Lp=2,Up=S.object({consent_cross_border:S.union([S.literal(!0),S.literal("true")]),consent_text_version:S.string().min(1).max(120),title:S.string().min(1).max(120).optional()}).strict();function Fp(t){return t===!0||t==="true"}var Kp=[".png",".jpg",".jpeg",".webp"],Gp=["image/png","image/jpeg","image/webp","application/octet-stream"],qp=8*1024*1024,Bp=10,Wa=S.enum(["asset","reference"]),zp=S.object({image_role:Wa,title:S.string().min(1).max(120).optional()}).strict(),Wp=S.object({version:S.literal(1),site_id:E,tenant_id:S.string().min(1),user_prompt:S.string(),status:Fa,sources:S.array(qa).max(16),facts:S.array(Be).max(120),reference:ze.optional(),conflicts:S.array(We).max(20)}).superRefine((t,n)=>{let i=new Map(t.sources.map(s=>[s.source_id,s]));for(let[s,r]of t.facts.entries()){let m=i.get(r.source_id);(!m||m.type==="url")&&n.addIssue({code:"custom",path:["facts",s,"source_id"],message:"facts must reference a text/document/image source (never url)"})}if(t.reference){let s=i.get(t.reference.source_id),r=s?.type==="image"&&s.source_metadata.image_role==="reference";(!s||s.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 f}from"zod";var Va=["design.md","DESIGN.md"],_n=["components/site","src/components/site","lib/generated","src/lib/generated","public"],Ha=["app/globals.css","src/app/globals.css"],$a=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Ya=new Set($a),St="source-delete",Sn=f.literal(St),W=f.string().min(1).refine(bn,"Invalid site edit source path"),Za=f.string().min(1).refine(ss,"Invalid site edit source directory path"),$p=f.enum(["text","binary"]),Ve=f.object({path:W,language:f.string().min(1).nullable(),sizeBytes:f.number().int().nonnegative(),contentHash:f.string().min(1).optional()}),Xa=f.discriminatedUnion("kind",[Ve.extend({kind:f.literal("text"),language:f.string().min(1),readonly:f.boolean().default(!1)}),Ve.extend({kind:f.literal("binary"),language:f.null(),mimeType:f.string().min(1).optional(),readonly:f.literal(!0)})]),fn=f.lazy(()=>f.discriminatedUnion("kind",[f.object({kind:f.literal("directory"),name:f.string().min(1),path:Za,children:f.array(fn)}),f.object({kind:f.literal("file"),name:f.string().min(1),path:W,file:Xa}).superRefine((t,n)=>{t.path!==t.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),Qa=f.enum(["max-files","max-depth","max-total-bytes"]),Ja=f.object({reasons:f.array(Qa).min(1),maxFiles:f.number().int().positive(),maxDepth:f.number().int().positive(),maxTotalBytes:f.number().int().positive()}),Yp=f.object({nodes:f.array(fn),defaultPath:W.optional(),totalFiles:f.number().int().nonnegative(),truncated:Ja.optional()}),es=Ve.extend({kind:f.literal("text"),language:f.string().min(1),readonly:f.boolean().default(!1),content:f.string()}),ts=f.enum(["too-large","unsupported-mime","bytes-unavailable"]),ns=Ve.extend({kind:f.literal("binary"),language:f.null(),readonly:f.literal(!0),mimeType:f.string().min(1),contentBase64:f.string().min(1).optional(),previewUnavailableReason:ts.optional()}),Zp=f.discriminatedUnion("kind",[es,ns]),is=f.object({key:f.string().min(1),routeId:f.string().min(1).optional()}),as=f.object({startLine:f.number().int().positive(),startColumn:f.number().int().nonnegative(),endLine:f.number().int().positive(),endColumn:f.number().int().nonnegative()}),Xp=is.extend({sourceFile:W,componentName:f.string().min(1),openingElementRange:as,structuralPath:f.string().min(1),textPreview:f.string().min(1).optional()});function bn(t){return!In(t)||xn(t)?!1:yt(t)||En(t)||yn(t)||_n.some(n=>t===n||t.startsWith(`${n}/`))}function ft(t){return yt(t)||Ya.has(os(t))}function ss(t){return!In(t)||xn(t)?!1:t==="app"||t.startsWith("app/")||t==="src"||t==="src/app"||t.startsWith("src/app/")||_n.some(n=>t===n||t.startsWith(`${n}/`)||n.startsWith(`${t}/`))}function bt(t){return bn(t)?yt(t)?"design-document":yn(t)?"route-entry":En(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 Qp(t){return bt(t)!==null}function yn(t){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(t.toLowerCase())}function En(t){return Ha.some(n=>n.toLowerCase()===t.toLowerCase())}function os(t){let n=t.split("/").at(-1)??t,i=n.lastIndexOf(".");return i>0?n.slice(i).toLowerCase():""}function yt(t){return!t.includes("/")&&Va.some(n=>n.toLowerCase()===t.toLowerCase())}function xn(t){let n=t.toLowerCase(),i=n.split("/"),r=(i.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"||i.includes("server")||i.includes("secrets")}function In(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 rs}from"zod";var Pe=["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"],cs=["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"],ms=[...Pe,...cs],ps=new Set(["ar","fa","he"]),td=[{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"}],ds={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"},ls=new Set(Pe);function Rn(t){return ls.has(t)?t:ds[t]}var us="en";function nd(t){let n=t.toLowerCase().split("-",1)[0]??"";return ps.has(n)?"rtl":"ltr"}var gs={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 id(t){return gs[t]??us}var Z=rs.enum(ms);import{z as hs}from"zod";var X=hs.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/);function od(t,n){let i=X.safeParse(t),s=X.safeParse(n);if(!i.success||!s.success)return null;let r=Tn(i.data),m=Tn(s.data);for(let o=0;o<3;o+=1){let l=kn(r.release[o],m.release[o]);if(l!==0)return l}if(!r.prerelease&&!m.prerelease)return 0;if(!r.prerelease)return 1;if(!m.prerelease)return-1;let g=Math.max(r.prerelease.length,m.prerelease.length);for(let o=0;o<g;o+=1){let l=r.prerelease[o],y=m.prerelease[o];if(l===void 0)return-1;if(y===void 0)return 1;if(l===y)continue;let h=/^\d+$/u.test(l),b=/^\d+$/u.test(y);return h&&b?kn(BigInt(l),BigInt(y)):h?-1:b?1:_s(l,y)}return 0}function Tn(t){let n=t.indexOf("+"),i=n===-1?t:t.slice(0,n),s=i.indexOf("-"),r=s===-1?i:i.slice(0,s),m=s===-1?void 0:i.slice(s+1),[g,o,l]=r.split(".");return{release:[BigInt(g),BigInt(o),BigInt(l)],...m?{prerelease:m.split(".")}:{}}}function kn(t,n){return t<n?-1:t>n?1:0}function _s(t,n){return t<n?-1:t>n?1:0}import{z as I}from"zod";import{z as K}from"zod";var Et=64,Ss=512*1024,xt=4*1024*1024,fs=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function bs(t){return fs.test(t)}var Pn=K.string().min(1).refine(bs,{message:"Materialization pathTemplate must be a safe relative path."}),ys=K.object({pathTemplate:Pn,content:K.string(),role:K.string().min(1).optional()}).strict(),Es=K.union([K.object({kind:K.literal("default")}).strict(),K.object({kind:K.literal("named"),name:K.string().min(1)}).strict()]),xs=K.object({pathTemplate:Pn,export:Es}).strict(),Is=K.array(K.never()).optional(),pe=K.object({instanceBaseName:K.string().min(1),files:K.array(ys).min(1).max(Et),entry:xs,dataRequirements:Is}).strict().superRefine((t,n)=>{let i=new Set,s=t.entry.pathTemplate,r=0;for(let[m,g]of t.files.entries()){i.has(g.pathTemplate)&&n.addIssue({code:"custom",path:["files",m,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${g.pathTemplate}`}),i.add(g.pathTemplate);let o=new TextEncoder().encode(g.content).length;o>Ss&&n.addIssue({code:"custom",path:["files",m,"content"],message:"Materialization file content exceeds the per-file byte limit."}),r+=o}i.has(s)||n.addIssue({code:"custom",path:["entry","pathTemplate"],message:"Materialization entry pathTemplate must match a file."}),r>xt&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});var An="insertNewComponent",ld={categoryGroupMissing:"DESIGNER_COMPONENT_CATEGORY_GROUP_MISSING",unavailable:"DESIGNER_COMPONENT_LIBRARY_UNAVAILABLE",timeout:"DESIGNER_COMPONENT_LIBRARY_TIMEOUT",invalidResponse:"DESIGNER_COMPONENT_LIBRARY_INVALID_RESPONSE",incompatibleResource:"DESIGNER_COMPONENT_RESOURCE_INCOMPATIBLE"},Cn=I.lazy(()=>I.object({id:I.string().uuid(),key:I.string().min(1),name:I.string(),children:I.array(Cn)}).strict()),Dn=I.object({category_group_key:I.literal(An),categories:I.array(Cn)}).strict(),Rs=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(),vn=I.object({category_group_key:I.literal(An),items:I.array(Rs),next_cursor:I.string().min(1).nullable()}).strict(),ud=I.object({resource_id:I.string().min(1),resolved_version:I.string().min(1),anchor_block_id:I.string().min(1),placement:I.enum(["before","after"])}).strict(),gd=I.object({status:I.literal("mock_acknowledged")}).strict(),hd=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"})}),Ts=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,de=I.string().regex(Ts),_d=I.object({version:de}).strict(),Nn=I.object({resource_id:I.string().min(1),resolved_version:de,revision_id:I.string().uuid(),digest_sha256:I.string().regex(/^[a-f0-9]{64}$/),materialization:pe}).strict();import{z as u}from"zod";var jn="insertNewPage",Ed={categoryGroupMissing:"DESIGNER_PAGE_CATEGORY_GROUP_MISSING",unavailable:"DESIGNER_PAGE_LIBRARY_UNAVAILABLE",timeout:"DESIGNER_PAGE_LIBRARY_TIMEOUT",invalidResponse:"DESIGNER_PAGE_LIBRARY_INVALID_RESPONSE",incompatibleResource:"DESIGNER_PAGE_RESOURCE_INCOMPATIBLE"},le=u.enum(["page","pages"]),ks=u.object({resource_id:u.string().min(1),resource_type:le,resolved_version:de,template_page_id:u.string().min(1)}).strict(),On=u.lazy(()=>u.object({id:u.string().uuid(),key:u.string().min(1),name:u.string(),children:u.array(On)}).strict()),wn=u.object({category_group_key:u.literal(jn),categories:u.array(On)}).strict(),Ps=u.object({resource_id:u.string().min(1),resource_type:le,name:u.string(),description:u.string().nullable(),thumbnail_url:u.string().nullable(),resolved_version:de,category_id:u.string().uuid().nullable()}).strict(),Mn=u.object({category_group_key:u.literal(jn),items:u.array(Ps),next_cursor:u.string().min(1).nullable()}).strict(),xd=u.object({category_id:u.string().uuid().optional(),include_descendants:u.enum(["true","false"]).optional().transform(t=>t==="true"),limit:u.coerce.number().int().min(1).max(100).optional().default(20),cursor:u.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),Ae=de,He=u.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),As=u.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),Cs=u.object({template_page_id:u.string().min(1),title:u.string().trim().min(1).max(120),final_route:He}).strict(),Ds=u.object({template_page_id:u.string().min(1),title:u.string().trim().min(1).max(120),source:ks.optional(),blocks:u.array(u.discriminatedUnion("kind",[u.object({kind:u.literal("package-component"),instance_id:u.string().min(1),component_id:u.string().min(1),label:u.string().trim().min(1).max(120)}).strict(),u.object({kind:u.literal("component-resource"),instance_id:u.string().min(1),resource_id:u.string().min(1),resolved_version:de,label:u.string().trim().min(1).max(120)}).strict()])).min(1).optional(),route:u.object({input:u.string(),append_random_suffix:u.boolean().optional(),random_suffix_length:u.number().int().min(4).max(16).optional(),final:He}).strict()}).strict(),vs=u.object({resource_id:u.string().min(1),resource_type:le,resolved_version:Ae,pages:u.array(Ds).min(1)}).strict().superRefine((t,n)=>{se(t.pages.map(i=>i.template_page_id),"pages",n),se(t.pages.map(i=>i.route.final),"routes",n);for(let[i,s]of t.pages.entries()){if(!s.blocks)continue;let r=new Set;for(let[m,g]of s.blocks.entries())r.has(g.instance_id)&&n.addIssue({code:"custom",path:["pages",i,"blocks",m,"instance_id"],message:`Duplicate block instance identifier within page: ${g.instance_id}`}),r.add(g.instance_id)}});function It(t,n){t.resource_type==="page"&&t.pages.length!==1&&n.addIssue({code:"custom",path:["pages"],message:"page resources must contain exactly one page"}),t.resource_type==="pages"&&t.pages.length<2&&n.addIssue({code:"custom",path:["pages"],message:"pages resources must contain at least two pages"})}function se(t,n,i){let s=new Set;for(let[r,m]of t.entries())s.has(m)&&i.addIssue({code:"custom",path:[n,r],message:`Duplicate ${n} identifier: ${m}`}),s.add(m)}var Id=u.object({resource_type:le,version:Ae,pages:u.array(Cs).min(1)}).strict().superRefine((t,n)=>{It(t,n),se(t.pages.map(i=>i.template_page_id),"pages",n),se(t.pages.map(i=>i.final_route),"routes",n)}),Ns=u.object({instance_id:u.string().min(1),component_id:u.string().min(1)}).strict(),js=u.object({component_id:u.string().min(1),materialization:pe}).strict(),Os=u.object({template_page_id:u.string().min(1),title:u.string().trim().min(1).max(120),final_route:He,materialization:pe,components:u.array(Ns)}).strict(),Rt=u.object({resource_id:u.string().min(1),resource_type:le,resolved_version:Ae,revision_id:u.string().uuid(),digest_sha256:u.string().regex(/^[a-f0-9]{64}$/),components:u.array(js),pages:u.array(Os).min(1),project_dependencies:u.record(u.string(),u.never()).optional()}).strict().superRefine((t,n)=>{It(t,n);let i=t.components.map(r=>r.component_id),s=new Set(i);se(i,"components",n),se(t.pages.map(r=>r.template_page_id),"pages",n),se(t.pages.map(r=>r.final_route),"routes",n);for(let[r,m]of t.pages.entries()){let g=new Set;for(let[o,l]of m.components.entries())s.has(l.component_id)||n.addIssue({code:"custom",path:["pages",r,"components",o,"component_id"],message:`Unknown component reference: ${l.component_id}`}),g.has(l.instance_id)&&n.addIssue({code:"custom",path:["pages",r,"components",o,"instance_id"],message:`Duplicate component instance identifier within page: ${l.instance_id}`}),g.add(l.instance_id)}}),Ln=Rt,Un=u.object({template_page_id:u.string().min(1),title:u.string().trim().min(1).max(120),final_route:He,route_file_path:u.string().regex(/^app\/[a-z0-9]+(?:-[a-z0-9]+)*\/page\.tsx$/)}).strict(),ws=u.object({template_page_id:u.string().min(1),title:u.string().trim().min(1).max(120),composition_supported:u.boolean(),blocks:u.array(u.object({instance_id:u.string().min(1),component_id:u.string().min(1),label:u.string().trim().min(1).max(120)}).strict())}).strict(),Fn=u.object({resource_id:u.string().min(1),resource_type:le,resolved_version:Ae,pages:u.array(ws).min(1)}).strict().superRefine((t,n)=>{It(t,n),se(t.pages.map(i=>i.template_page_id),"pages",n)}),Rd=u.object({resource_type:le,version:Ae}).strict(),Td=u.object({draft:vs}).strict(),Ms=u.object({title:u.string().trim().min(1).max(120),route_id:As}).strict(),Kn=u.object({items:u.array(Ms)}).strict(),Gn=u.object({candidate:u.record(u.string(),u.unknown())}).strict();var he="[a-z0-9]+(?:-[a-z0-9]+)*",Ce=new RegExp(`^/(?:${he}(?:/${he})*)?$`);function Ls(t){return t.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function qn(t){return typeof t=="string"&&Ce.test(t)}function Bn(t){if(typeof t!="string")return null;let n=t.trim();if(/[^\x00-\x7F]/.test(n))return null;let i=n.replace(/^\/+|\/+$/g,"");if(i==="")return"/";let s=i.split("/");if(s.some(o=>o==="."||o===".."))return null;let r=i.toLowerCase();if(r==="index"||r==="home")return"/";let m=s.map(Ls).filter(o=>o.length>0);if(m.length===0)return null;let g=`/${m.join("/")}`;return qn(g)?g:null}function zn(t){let n=Bn(t);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function Us(t){let n=zn(t);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as A}from"zod";import{z as d}from"zod";import{z as Y}from"zod";var Fs=Y.object({code:Y.string().min(1),message:Y.string().min(1)}),Cd=Y.object({code:Y.string().min(1),message:Y.string().min(1)});function Tt(t){return Y.object({ok:Y.literal(!0),data:t})}function Ks(t){let n={ok:Y.literal(!1),error:Fs.extend({code:t.codeSchema})};return t.currentSchema&&(n.current=t.currentSchema.optional()),t.diagnosticsSchema&&(n.diagnostics=Y.array(t.diagnosticsSchema).optional()),t.dataSchema&&(n.data=t.dataSchema.optional()),Y.object(n)}function Wn(t){return Y.discriminatedUnion("ok",[Tt(t.dataSchema),Ks({codeSchema:t.codeSchema,currentSchema:t.currentSchema,diagnosticsSchema:t.diagnosticsSchema,dataSchema:t.failureDataSchema})])}import{z as P}from"zod";var ue=P.object({start:P.number().int().nonnegative(),end:P.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"})}),Gs=P.object({code:P.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:P.string().min(1)}),Vn=P.object({path:P.string().min(1),content:P.string(),hash:P.string().min(1).optional()}),jd=P.object({revision:P.string().min(1),entryCss:Vn,stylesheets:P.array(Vn).default([])}),Hn=P.object({key:P.string().min(1),routeId:P.string().min(1),filePath:P.string().min(1),componentName:P.string().min(1),sourceKind:P.enum(["missing","stringLiteral","expression"]),attrRaw:P.string().min(1).nullable(),valueRaw:P.string().min(1).nullable(),attrRange:ue.nullable(),openingElementRange:ue,version:P.object({documentVersion:P.number().int().nonnegative(),contentHash:P.string().min(1)}),diagnostics:P.array(Gs),computedStyle:P.record(P.string(),P.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"})}),Od=Hn,wd=Tt(Hn),kt=P.object({source:P.enum(["style-panel","class-source-editor"]),operation:P.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as qs}from"zod";var Pt=qs.enum(["src","alt","poster","href","width","height"]);import{z as _e}from"zod";var De=_e.object({editingSessionId:_e.string().min(1),lockId:_e.string().min(1),ownerId:_e.string().min(1),leaseAssertion:_e.string().min(1)}).strict(),Kd="signed-designer-mutations-v1",Gd=_e.object({mutationContext:De}).strict();import{z as p}from"zod";import{z as ve}from"zod";var $e="::",At=ve.object({file:ve.string().min(1),component:ve.string().min(1),structuralPath:ve.string().min(1),key:ve.string().min(1)}).superRefine((t,n)=>{let i=Bs(t.file,t.component,t.structuralPath);t.key!==i&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function Bs(t,n,i){return`${t}${$e}${n}${$e}${i}`}function zd(t){let[n,i,...s]=t.split($e);return!n||!i||s.length===0?null:{file:n,component:i,structuralPath:s.join($e)}}var Ye=p.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=p.object({code:p.string().min(1),message:p.string().min(1)}).strict(),zs=p.union([p.object({kind:p.literal("virtual-route-root"),key:p.string().min(1)}).strict(),p.object({kind:p.literal("jsx-container"),key:p.string().min(1),sourceMemberKey:p.string().min(1),sourceFile:p.string().min(1),componentName:p.string().min(1).optional()}).strict(),p.object({kind:p.literal("starter-placeholder"),key:p.string().min(1),sourceFile:p.string().min(1).optional()}).strict()]),Ws=p.object({key:p.string().min(1),kind:p.enum(["jsx-element","jsx-fragment","jsx-expression","null-return","starter-placeholder"]),containerKey:p.string().min(1),label:p.string().min(1),sourceFile:p.string().min(1).optional(),isAtomic:p.boolean()}).strict(),Vs=p.object({key:p.string().min(1),sourceMemberKey:p.string().min(1),containerKey:p.string().min(1),label:p.string().min(1),isIndependent:p.boolean()}).strict(),Hs=p.object({key:p.string().min(1),containerKey:p.string().min(1),businessMemberKeys:p.array(p.string().min(1)),isMultiMember:p.boolean()}).strict(),Ct=p.object({kind:p.literal("page-composition"),placementKey:p.string().min(1),documentVersion:p.number().int().nonnegative()}).strict(),Yn=Ct.extend({routeId:p.string().min(1),placementUnitKey:p.string().min(1),relation:p.enum(["before","after","prepend","append"])}).strict(),Zn=Yn,Xn=p.object({kind:p.literal("page-unit"),routeId:p.string().min(1),placementUnitKey:p.string().min(1)}).strict();function ne(t,n,i,s,r){let m=new Set;for(let[g,o]of t.entries()){let l=s(o);m.has(l)&&n.addIssue({code:"custom",path:[i,g,r],message:`Duplicate ${i} key: ${l}`}),m.add(l)}}var $s=p.object({status:p.literal("supported"),version:p.number().int().nonnegative(),routeId:p.string().min(1),container:zs,sourceMembers:p.array(Ws),businessMembers:p.array(Vs),placementUnits:p.array(Hs),placements:p.array(Yn)}).strict().superRefine((t,n)=>{ne(t.sourceMembers,n,"sourceMembers",o=>o.key,"key"),ne(t.businessMembers,n,"businessMembers",o=>o.key,"key"),ne(t.placementUnits,n,"placementUnits",o=>o.key,"key"),ne(t.placements,n,"placements",o=>o.placementKey,"placementKey");let i=new Set(t.sourceMembers.map(o=>o.key)),s=new Set(t.placementUnits.map(o=>o.key)),r=new Map(t.sourceMembers.map(o=>[o.key,o])),m=new Map(t.businessMembers.map(o=>[o.key,o]));for(let[o,l]of t.sourceMembers.entries()){l.containerKey!==t.container.key&&!i.has(l.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",o,"containerKey"],message:"Source member parent must reference the page container or another source member."}),l.containerKey===l.key&&n.addIssue({code:"custom",path:["sourceMembers",o,"containerKey"],message:"Source member cannot contain itself."});let y=new Set([l.key]),h=l.containerKey;for(;h!==t.container.key;){if(y.has(h)){n.addIssue({code:"custom",path:["sourceMembers",o,"containerKey"],message:"Source member hierarchy must be acyclic."});break}y.add(h);let b=r.get(h);if(!b)break;h=b.containerKey}}t.container.kind==="jsx-container"&&!i.has(t.container.sourceMemberKey)&&n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."});for(let[o,l]of t.businessMembers.entries())i.has(l.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",o,"sourceMemberKey"],message:"Business member must reference a source member."}),s.has(l.containerKey)||n.addIssue({code:"custom",path:["businessMembers",o,"containerKey"],message:"Business member must reference a placement unit container."});for(let[o,l]of t.placementUnits.entries()){let y=r.get(l.containerKey);y?y.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",o,"containerKey"],message:"Placement unit must reference a direct child of the page container."}):n.addIssue({code:"custom",path:["placementUnits",o,"containerKey"],message:"Placement unit containerKey must reference a source member."});let h=new Set;for(let[b,w]of l.businessMemberKeys.entries()){let L=m.get(w);if(!L){n.addIssue({code:"custom",path:["placementUnits",o,"businessMemberKeys",b],message:"Placement unit must reference existing business members."});continue}h.has(w)&&n.addIssue({code:"custom",path:["placementUnits",o,"businessMemberKeys",b],message:"Placement unit cannot reference the same business member twice."}),h.add(w),L.containerKey!==l.key&&n.addIssue({code:"custom",path:["placementUnits",o,"businessMemberKeys",b],message:"Business member containerKey must match its placement unit."});let z=L.sourceMemberKey,Q=new Set;for(;z&&z!==l.containerKey&&!Q.has(z);)Q.add(z),z=r.get(z)?.containerKey;z!==l.containerKey&&n.addIssue({code:"custom",path:["placementUnits",o,"businessMemberKeys",b],message:"Placement unit business members must belong to its source subtree."})}}for(let[o,l]of t.businessMembers.entries())t.placementUnits.find(h=>h.key===l.containerKey)?.businessMemberKeys.includes(l.key)||n.addIssue({code:"custom",path:["businessMembers",o,"containerKey"],message:"Business member must be listed by its placement unit container."});let g=new Map;for(let o of t.placementUnits)g.set(o.containerKey,(g.get(o.containerKey)??0)+1);for(let[o,l]of t.sourceMembers.entries())l.containerKey===t.container.key&&g.get(l.key)!==1&&n.addIssue({code:"custom",path:["sourceMembers",o,"key"],message:"Every direct source member must be owned by exactly one placement unit."});for(let[o,l]of t.placements.entries())l.routeId!==t.routeId&&n.addIssue({code:"custom",path:["placements",o,"routeId"],message:"Page placement routeId must match page composition routeId."}),l.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",o,"documentVersion"],message:"Page placement version must match page composition version."}),s.has(l.placementUnitKey)||n.addIssue({code:"custom",path:["placements",o,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),Ys=p.object({status:p.literal("unsupported"),version:p.number().int().nonnegative(),routeId:p.string().min(1),reason:Ye,diagnostics:p.array(Ne)}).strict(),Zs=p.discriminatedUnion("status",[$s,Ys]),Qn=2,$d="page-composition-v2",Jn=p.object({start:p.number().int().nonnegative(),end:p.number().int().nonnegative(),startLine:p.number().int().positive().optional(),startColumn:p.number().int().nonnegative().optional(),endLine:p.number().int().positive().optional(),endColumn:p.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 i=[t.startLine,t.startColumn,t.endLine,t.endColumn],s=i.some(m=>m!==void 0),r=i.every(m=>m!==void 0);s&&!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."})}),Xs=p.object({key:p.string().min(1),instanceIndex:p.number().int().nonnegative().optional(),instanceCount:p.number().int().positive().optional(),textSegmentIndex:p.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."})}),Qs=p.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),Js=p.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),eo=p.discriminatedUnion("kind",[p.object({kind:p.literal("virtual-route-root"),key:p.null(),routeReturn:p.object({sourceIdentity:At,sourceRange:Jn}).strict()}).strict(),p.object({kind:p.literal("jsx-container"),key:p.string().min(1),sourceMemberKey:p.string().min(1)}).strict(),p.object({kind:p.literal("starter-placeholder"),key:p.string().min(1),sourceMemberKey:p.string().min(1),replacementMode:p.literal("replace")}).strict()]),to=p.object({key:p.string().min(1),kind:Qs,parentKey:p.string().min(1).nullable(),childKeys:p.array(p.string().min(1)),order:p.number().int().nonnegative(),label:p.string().min(1),sourceIdentity:At,sourceRange:Jn.nullable(),atomicKind:Js}).strict().superRefine((t,n)=>{let i=t.kind==="component-call"||t.kind==="native-jsx"?"none":t.kind;t.atomicKind!==i&&n.addIssue({code:"custom",path:["atomicKind"],message:`atomicKind must be ${i} for ${t.kind}.`});let s=new Set;for(let[r,m]of t.childKeys.entries())s.has(m)&&n.addIssue({code:"custom",path:["childKeys",r],message:`Duplicate child source member key: ${m}`}),s.add(m)}),no=p.object({key:p.string().min(1),sourceMemberKey:p.string().min(1),placementUnitKey:p.string().min(1),label:p.string().min(1),isIndependent:p.boolean()}).strict(),io=p.enum(["independent","atomic","container"]),ao=p.object({key:p.string().min(1),containerKey:p.string().min(1).nullable(),sourceMemberKeys:p.array(p.string().min(1)).min(1),businessMemberKeys:p.array(p.string().min(1)),order:p.number().int().nonnegative(),boundaryMode:io,isIndependent:p.boolean(),isMultiMember:p.boolean()}).strict().superRefine((t,n)=>{$n(t.sourceMemberKeys,n,"sourceMemberKeys","source member"),$n(t.businessMemberKeys,n,"businessMemberKeys","business member");let i=t.sourceMemberKeys.length>1||t.businessMemberKeys.length>1;t.isMultiMember!==i&&n.addIssue({code:"custom",path:["isMultiMember"],message:"isMultiMember must reflect the source and business member cardinality."});let s=t.boundaryMode==="independent";t.isIndependent!==s&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),so=p.enum(["before","after","prepend","append","replace"]),oo=p.enum(["insert-sibling","insert-child","replace-placeholder"]),ro=p.object({kind:p.literal("page-composition"),placementKey:p.string().min(1),documentVersion:p.number().int().nonnegative(),routeId:p.string().min(1),placementUnitKey:p.string().min(1),containerKey:p.string().min(1).nullable(),relation:so,writeMode:oo}).strict().superRefine((t,n)=>{let i=t.relation==="before"||t.relation==="after"?"insert-sibling":t.relation==="prepend"||t.relation==="append"?"insert-child":"replace-placeholder";t.writeMode!==i&&n.addIssue({code:"custom",path:["writeMode"],message:`writeMode must be ${i} for ${t.relation}.`})}),co=p.object({key:p.string().min(1),placementUnitKey:p.string().min(1),runtimeRefs:p.array(Xs).min(1)}).strict(),mo=p.object({schemaVersion:p.literal(Qn),status:p.literal("supported"),version:p.number().int().nonnegative(),routeId:p.string().min(1),container:eo,sourceMembers:p.array(to),businessMembers:p.array(no),placementUnits:p.array(ao),placements:p.array(ro),visualAnchors:p.array(co).optional(),diagnostics:p.array(Ne)}).strict().superRefine((t,n)=>{uo(t,n)}),po=p.object({schemaVersion:p.literal(Qn),status:p.literal("unsupported"),version:p.number().int().nonnegative(),routeId:p.string().min(1),reason:Ye,diagnostics:p.array(Ne)}).strict(),lo=p.discriminatedUnion("status",[mo,po]),Yd=p.union([lo,Zs]);function $n(t,n,i,s){let r=new Set;for(let[m,g]of t.entries())r.has(g)&&n.addIssue({code:"custom",path:[i,m],message:`Duplicate ${s} key: ${g}`}),r.add(g)}function uo(t,n){ne(t.sourceMembers,n,"sourceMembers",h=>h.key,"key"),ne(t.businessMembers,n,"businessMembers",h=>h.key,"key"),ne(t.placementUnits,n,"placementUnits",h=>h.key,"key"),ne(t.placements,n,"placements",h=>h.placementKey,"placementKey"),ne(t.visualAnchors??[],n,"visualAnchors",h=>h.key,"key"),go(t,n);let i=new Map(t.sourceMembers.map(h=>[h.key,h])),s=new Map(t.businessMembers.map(h=>[h.key,h])),r=new Map(t.placementUnits.map(h=>[h.key,h]));ho(t,i,n),t.container.kind!=="virtual-route-root"&&(i.has(t.container.sourceMemberKey)||n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."}));let m=new Map,g=new Map,o=new Set;for(let[h,b]of t.placementUnits.entries()){b.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",h,"containerKey"],message:"Placement unit containerKey must match the page container."});let w=`${b.containerKey??"<virtual>"}:${b.order}`;o.has(w)&&n.addIssue({code:"custom",path:["placementUnits",h,"order"],message:"Placement unit order must be unique within its container."}),o.add(w);for(let[L,z]of b.sourceMemberKeys.entries()){i.has(z)||n.addIssue({code:"custom",path:["placementUnits",h,"sourceMemberKeys",L],message:"Placement unit must reference existing source members."});let Q=m.get(z);Q&&Q!==b.key&&n.addIssue({code:"custom",path:["placementUnits",h,"sourceMemberKeys",L],message:`Source member is already assigned to ${Q}.`}),m.set(z,b.key)}for(let[L,z]of b.businessMemberKeys.entries()){let Q=s.get(z);if(!Q){n.addIssue({code:"custom",path:["placementUnits",h,"businessMemberKeys",L],message:"Placement unit must reference existing business members."});continue}Q.placementUnitKey!==b.key&&n.addIssue({code:"custom",path:["placementUnits",h,"businessMemberKeys",L],message:"Placement unit and business member must reference each other."}),b.sourceMemberKeys.includes(Q.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",h,"businessMemberKeys",L],message:"Business member sourceMemberKey must belong to the placement unit."});let lt=g.get(z);lt&<!==b.key&&n.addIssue({code:"custom",path:["placementUnits",h,"businessMemberKeys",L],message:`Business member is already assigned to ${lt}.`}),g.set(z,b.key)}}for(let[h,b]of t.businessMembers.entries()){i.has(b.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",h,"sourceMemberKey"],message:"Business member must reference a source member."});let w=r.get(b.placementUnitKey);if(!w){n.addIssue({code:"custom",path:["businessMembers",h,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}w.businessMemberKeys.includes(b.key)||n.addIssue({code:"custom",path:["businessMembers",h,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),w.sourceMemberKeys.includes(b.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",h,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let L=w.isIndependent&&w.businessMemberKeys.length===1;b.isIndependent!==L&&n.addIssue({code:"custom",path:["businessMembers",h,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let l=new Set;for(let[h,b]of t.placements.entries()){b.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",h,"documentVersion"],message:"Page placement version must match page composition version."}),b.routeId!==t.routeId&&n.addIssue({code:"custom",path:["placements",h,"routeId"],message:"Page placement routeId must match page composition routeId."});let w=r.get(b.placementUnitKey);w?b.containerKey!==w.containerKey&&n.addIssue({code:"custom",path:["placements",h,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",h,"placementUnitKey"],message:"Placement option must reference a placement unit."});let L=`${b.placementUnitKey}:${b.relation}`;l.has(L)&&n.addIssue({code:"custom",path:["placements",h,"relation"],message:"A placement unit cannot expose the same relation more than once."}),l.add(L),b.relation==="replace"&&t.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",h,"relation"],message:"replace is only valid for a starter placeholder container."}),t.container.kind==="starter-placeholder"&&b.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",h,"relation"],message:"Starter placeholder placements must use replace."})}let y=new Set;for(let[h,b]of(t.visualAnchors??[]).entries())r.has(b.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",h,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),y.has(b.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",h,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),y.add(b.placementUnitKey)}function go(t,n){let i=[];t.container.key!==null&&i.push({key:t.container.key,path:["container","key"],namespace:"container"});for(let[r,m]of t.sourceMembers.entries())i.push({key:m.key,path:["sourceMembers",r,"key"],namespace:"source member"});for(let[r,m]of t.businessMembers.entries())i.push({key:m.key,path:["businessMembers",r,"key"],namespace:"business member"});for(let[r,m]of t.placementUnits.entries())i.push({key:m.key,path:["placementUnits",r,"key"],namespace:"placement unit"});for(let[r,m]of(t.visualAnchors??[]).entries())i.push({key:m.key,path:["visualAnchors",r,"key"],namespace:"visual anchor"});let s=new Map;for(let r of i){let m=s.get(r.key);m?n.addIssue({code:"custom",path:r.path,message:`${r.namespace} key collides with ${m}: ${r.key}`}):s.set(r.key,r.namespace)}}function ho(t,n,i){let s=new Set;for(let[r,m]of t.sourceMembers.entries()){let g=`${m.parentKey??"<root>"}:${m.order}`;if(s.has(g)&&i.addIssue({code:"custom",path:["sourceMembers",r,"order"],message:"Source member order must be unique among siblings."}),s.add(g),m.parentKey===m.key&&i.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member cannot be its own parent."}),m.parentKey!==null){let y=n.get(m.parentKey);y?y.childKeys.includes(m.key)||i.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source parent and child references must be bidirectional."}):i.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[y,h]of m.childKeys.entries()){if(h===m.key){i.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",y],message:"Source member cannot be its own child."});continue}let b=n.get(h);b?b.parentKey!==m.key&&i.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",y],message:"Source parent and child references must be bidirectional."}):i.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",y],message:"Source child key must reference a source member."})}let o=new Set,l=m;for(;l;){if(o.has(l.key)){i.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member graph must be acyclic."});break}o.add(l.key),l=l.parentKey===null?void 0:n.get(l.parentKey)}}}var je=d.enum(["update-text","update-array-item","remove-node","insert-child","move-node","set-class-name-source","set-props","apply-style-draft","source-edit","insert-page-resource"]),ei=d.lazy(()=>d.union([d.string(),d.number(),d.boolean(),d.null(),d.array(ei),d.record(d.string(),ei)])),ni=d.discriminatedUnion("kind",[d.object({kind:d.literal("node"),key:d.string().min(1)}),Xn,d.object({kind:d.literal("route"),routeId:d.string().min(1)}),d.object({kind:d.literal("source-file"),path:W}),d.object({kind:d.literal("source-batch"),paths:d.array(W).min(1)}).superRefine((t,n)=>{let i=new Set;for(let[s,r]of t.paths.entries())i.has(r)&&n.addIssue({code:"custom",path:["paths",s],message:`Duplicate source target path: ${r}`}),i.add(r)}),d.object({kind:d.literal("project")}).strict()]),ii=d.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"]),ai=d.enum(["hover","active","focus","disabled"]),si=d.enum(["sm","md","lg","xl","2xl"]),ti=d.union([d.object({relation:d.enum(["before","after"]),anchorKey:d.string().min(1)}),d.object({relation:d.enum(["prepend","append"]),parentKey:d.string().min(1)}),Zn]),_o=d.union([d.object({kind:d.literal("native-tag"),tag:d.string().min(1),text:d.string().optional()}),d.object({kind:d.literal("component-call"),component:d.object({source:d.string().min(1),exportName:d.string().min(1)}),materialization:d.never().optional(),props:d.record(d.string(),d.unknown()).optional()}).strict(),d.object({kind:d.literal("component-call"),component:d.never().optional(),materialization:pe,props:d.record(d.string(),d.never()).optional()}).strict()]),So=d.discriminatedUnion("kind",[d.object({kind:d.literal("update-text"),segmentIndex:d.number().int().min(0),value:d.string()}),d.object({kind:d.literal("update-array-item"),segmentIndex:d.number().int().min(0),index:d.number().int().min(0),value:d.string()}),d.object({kind:d.literal("remove-node")}),d.object({kind:d.literal("insert-child"),node:_o,position:d.union([ti,Ct])}),d.object({kind:d.literal("move-node"),target:ti,preserveBindings:d.boolean().optional()}),d.object({kind:d.literal("set-class-name-source"),routeId:d.string().min(1).optional(),filePath:d.string().min(1),expectedVersion:d.object({documentVersion:d.number().int().nonnegative(),contentHash:d.string().min(1)}),oldAttrRaw:d.string().min(1).nullable(),oldAttrRange:ue.nullable(),openingElementRange:ue,newAttrRaw:d.string().min(1).nullable(),intent:kt}),d.object({kind:d.literal("set-props"),props:d.partialRecord(Pt,d.string())}),d.object({kind:d.literal("apply-style-draft"),className:d.object({routeId:d.string().min(1).optional(),filePath:d.string().min(1),expectedVersion:d.object({documentVersion:d.number().int().nonnegative(),contentHash:d.string().min(1)}),oldAttrRaw:d.string().min(1).nullable(),oldAttrRange:ue.nullable(),openingElementRange:ue,newAttrRaw:d.string().min(1).nullable(),intent:kt}).optional(),props:d.partialRecord(Pt,d.string()).optional()}).superRefine((t,n)=>{!t.className&&!t.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),d.object({kind:d.literal("source-edit"),conflictPolicy:d.enum(["compare-and-swap","overwrite"]),edits:d.array(d.discriminatedUnion("operation",[d.object({operation:d.literal("upsert"),path:W,content:d.string(),baseContentHash:d.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{ft(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"})}),d.object({operation:d.literal("delete"),path:W,capability:Sn,confirmDelete:d.literal(!0),confirmPath:W,baseContentHash:d.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{t.capability!==St&&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"}),ft(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let i=bt(t.path);i&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${t.path} (${i})`})})])).min(1),reason:d.string().min(1).optional()}).strict().superRefine((t,n)=>{let i=new Set;for(let[s,r]of t.edits.entries())i.has(r.path)&&n.addIssue({code:"custom",path:["edits",s,"path"],message:`Duplicate source edit path: ${r.path}`}),i.add(r.path),t.conflictPolicy==="compare-and-swap"&&r.baseContentHash===void 0&&n.addIssue({code:"custom",path:["edits",s,"baseContentHash"],message:"source-edit compare-and-swap requires baseContentHash for every edit"})}),d.object({kind:d.literal("insert-page-resource"),artifact:Rt}).strict()]),oi=d.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"]),ri=d.object({code:oi,message:d.string().min(1),details:d.record(d.string(),d.unknown()).optional()}),ci=d.object({key:d.string().min(1),instanceIndex:d.number().int().nonnegative().optional(),instanceCount:d.number().int().positive().optional()}),Dt=d.object({id:d.string().min(1),siteId:E,baseSnapshotId:_,routeId:d.string().min(1).optional(),kind:je,target:ni,documentVersion:d.number().int().nonnegative(),selectionRef:ci.optional(),mutationContext:De.optional(),params:So}).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 i=t.params.edits.map(r=>r.path),s=t.target.kind==="source-file"?[t.target.path]:t.target.paths;yo(i,s)||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-page-resource"?t.target.kind!=="project"&&n.addIssue({code:"custom",path:["target","kind"],message:`${t.kind} requires a project target`}):t.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project target is only valid for insert-page-resource"}),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"})}),rl=Dt,fo=d.object({kind:d.literal("insert-page-resource"),package_instance_id:d.string().min(1),pages:d.array(Un).min(1)}).strict().superRefine((t,n)=>{let i=new Set,s=new Set;for(let[r,m]of t.pages.entries())i.has(m.template_page_id)&&n.addIssue({code:"custom",path:["pages",r,"template_page_id"],message:`Duplicate template page route mapping: ${m.template_page_id}`}),s.has(m.final_route)&&n.addIssue({code:"custom",path:["pages",r,"final_route"],message:`Duplicate final route mapping: ${m.final_route}`}),i.add(m.template_page_id),s.add(m.final_route)}),bo=d.discriminatedUnion("kind",[fo]),mi=d.object({requestId:d.string().min(1),kind:je,target:ni,resultVersion:d.number().int().nonnegative(),affectedFiles:d.array(d.string().min(1)).optional(),selectionRef:ci.optional(),output:bo.optional()}),vt=mi.superRefine((t,n)=>{let i=t.kind==="insert-page-resource";i&&t.target.kind!=="project"?n.addIssue({code:"custom",path:["target","kind"],message:`${t.kind} result requires a project target`}):!i&&t.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project result target requires a project operation"}),i&&!t.output&&n.addIssue({code:"custom",path:["output"],message:`${t.kind} result requires typed output`}),t.output&&t.output.kind!==t.kind&&n.addIssue({code:"custom",path:["output","kind"],message:"output.kind must match operation kind"})}),cl=Wn({dataSchema:vt,codeSchema:oi,failureDataSchema:mi.partial()});function yo(t,n){return t.length===n.length&&t.every((i,s)=>i===n[s])}var Eo=A.enum(["component","page","pages"]),xo=A.object({resource_kind:Eo,resource_name:A.string().trim().min(1).max(200),file_count:A.number().int().min(1).max(64),total_bytes:A.number().int().min(0).max(4*1024*1024),content_digest:A.string().regex(/^sha256:[a-f0-9]{64}$/),custom_prompt:A.string().trim().min(1).max(4e3).optional(),final_routes:A.array(A.string().min(1)).max(64)}).strict(),Io=A.discriminatedUnion("kind",[A.object({kind:A.literal("none")}).strict(),A.object({kind:A.literal("primary"),items:A.array(A.object({label:A.string().trim().min(1).max(120),href:A.string().startsWith("/").max(200)}).strict()).min(1).max(64)}).strict().superRefine((t,n)=>{let i=new Set;for(let[s,r]of t.items.entries())i.has(r.href)&&n.addIssue({code:"custom",path:["items",s,"href"],message:`Duplicate navigation href: ${r.href}`}),i.add(r.href)})]),Ro=A.object({base_snapshot_id:A.string().min(1),operation:Dt,navigation_selection:Io.optional()}).strict().superRefine((t,n)=>{t.base_snapshot_id!==t.operation.baseSnapshotId&&n.addIssue({code:"custom",path:["operation","baseSnapshotId"],message:"Resource operation baseSnapshotId must match base_snapshot_id."})});function To(t){return t.kind==="insert-child"&&t.params.kind==="insert-child"&&t.params.node.kind==="component-call"&&"materialization"in t.params.node&&t.params.node.materialization?[t.params.node.materialization]:t.kind==="insert-page-resource"&&t.params.kind==="insert-page-resource"?[...t.params.artifact.components.map(n=>n.materialization),...t.params.artifact.pages.map(n=>n.materialization)]:[]}var pi=A.object({id:A.string().min(1),tenant_id:A.string().min(1),site_id:A.string().min(1),run_id:A.string().min(1).optional(),correlation_id:A.string().min(1).optional(),sent_at:A.string().min(1),type:A.literal("client.resource.operation.create"),payload:A.object({client_message_id:A.string().min(1),display:xo,transient_resource_input:Ro}).strict()}).strict().superRefine((t,n)=>{let{display:i,transient_resource_input:s}=t.payload;t.site_id!==s.operation.siteId&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","siteId"],message:"Resource operation siteId must match envelope site_id."});let r=i.resource_kind==="component"?"insert-child":"insert-page-resource";s.operation.kind!==r&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","kind"],message:`${i.resource_kind} resources require ${r}.`});let g=To(s.operation).flatMap(l=>l.files),o=g.reduce((l,y)=>l+new TextEncoder().encode(y.content).byteLength,0);if(g.length>Et&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate file count limit."}),o>xt&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate content byte limit."}),i.file_count!==g.length&&n.addIssue({code:"custom",path:["payload","display","file_count"],message:"Resource summary file_count must match the transient operation."}),i.total_bytes!==o&&n.addIssue({code:"custom",path:["payload","display","total_bytes"],message:"Resource summary total_bytes must match the transient operation."}),s.operation.kind==="insert-page-resource"&&s.operation.params.kind==="insert-page-resource"){let l=s.operation.params.artifact;l.resource_type!==i.resource_kind&&n.addIssue({code:"custom",path:["payload","display","resource_kind"],message:"Resource summary kind must match the page artifact resource_type."});let y=l.pages.map(h=>h.final_route);(y.length!==i.final_routes.length||y.some((h,b)=>h!==i.final_routes[b]))&&n.addIssue({code:"custom",path:["payload","display","final_routes"],message:"Resource summary final_routes must match the page artifact routes."})}if(s.navigation_selection?.kind==="primary"){let l=new Set(i.final_routes);for(let[y,h]of s.navigation_selection.items.entries())l.has(h.href)||n.addIssue({code:"custom",path:["payload","transient_resource_input","navigation_selection","items",y,"href"],message:"Navigation selection href must reference a final resource route."})}});import{z as ko}from"zod";var hl=".i18n.json",Ze="translation",di=new Set(["__proto__","constructor","prototype"]);function ui(t){if(!Xe(t)||Object.keys(t).length===0)return oe("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,i]of Object.entries(t)){if(di.has(n))return li([n]);if(!Po(n))return oe("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!Xe(i))return oe("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let s=Object.keys(i);if(s.length!==1||s[0]!==Ze)return oe("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let r=i[Ze];if(!Xe(r))return oe("I18N_RESOURCE_TREE_INVALID",`Component i18n translation namespace for ${n} must be an object.`,[n,Ze]);let m=[{value:r,path:[n,Ze]}];for(;m.length>0;){let g=m.pop();for(let[o,l]of Object.entries(g.value)){let y=[...g.path,o];if(di.has(o))return li(y);if(typeof l!="string"){if(!Xe(l))return oe("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",y);m.push({value:l,path:y})}}}}return{success:!0,data:t}}function _l(t){let n;try{n=JSON.parse(t)}catch{return oe("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return ui(n)}var Sl=ko.custom(t=>ui(t).success,"Invalid component i18n resources.");function Po(t){try{let n=Intl.getCanonicalLocales(t);return n.length===1&&n[0]===t}catch{return!1}}function Xe(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function li(t){return oe("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${t.at(-1)??""}`,t)}function oe(t,n,i){return{success:!1,error:{code:t,message:n,path:i}}}import{z as V}from"zod";var Je=V.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),Ao=V.enum(["direct","proxy","upstream","readonly","unsupported"]),Co=V.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),Qe=V.object({mode:Ao,reasonCode:V.string().min(1).optional()}),Do=V.object({kind:Co,message:V.string().min(1)}),et=V.object({key:V.string().min(1),canUpdateText:V.boolean(),canInsertChild:V.boolean(),canMove:V.boolean(),canRemove:V.boolean(),editModes:V.object({updateText:Qe.optional(),insertChild:Qe.optional(),move:Qe.optional(),remove:Qe.optional()}).optional(),constraints:V.array(Do)});import{z as N}from"zod";var Tl=N.discriminatedUnion("type",[N.object({type:N.literal("site-edit.document.changed"),siteId:E,snapshotId:_,routeId:N.string().min(1),version:N.number().int().nonnegative(),at:N.string().min(1)}),N.object({type:N.literal("site-edit.operation.planned"),siteId:E,operationId:N.string().min(1),baseSnapshotId:_,changedFiles:N.array(N.string().min(1)),at:N.string().min(1)}),N.object({type:N.literal("site-edit.operation.completed"),siteId:E,result:vt,at:N.string().min(1)}),N.object({type:N.literal("site-edit.operation.failed"),siteId:E,requestId:N.string().min(1),error:ri,at:N.string().min(1)}),N.object({type:N.literal("site-edit.capability.changed"),siteId:E,routeId:N.string().min(1),keys:N.array(N.string().min(1)),at:N.string().min(1)})]);import{z as j}from"zod";var Al="durable-history-v1",Cl=j.enum(["writable","read-only-recovery","unavailable"]),vo=j.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),No=j.object({code:vo,message:j.string().min(1),occurredAt:j.iso.datetime().optional()}).strict(),jo=j.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),gi={revision:j.number().int().nonnegative(),undoDepth:j.number().int().nonnegative(),redoDepth:j.number().int().nonnegative()},Oo=j.object({mode:j.literal("writable"),...gi,canUndo:j.boolean(),canRedo:j.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."})}),wo=j.object({mode:j.literal("read-only-recovery"),...gi,canUndo:j.literal(!1),canRedo:j.literal(!1),recoveryDiagnostic:No}).strict(),Mo=j.object({mode:j.literal("unavailable"),revision:j.literal(0),undoDepth:j.literal(0),redoDepth:j.literal(0),canUndo:j.literal(!1),canRedo:j.literal(!1),reason:jo}).strict(),Dl=j.discriminatedUnion("mode",[Oo,wo,Mo]);import{z as G}from"zod";var Lo=G.string().min(1).refine(t=>!t.startsWith("/")&&!t.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),Uo=G.string().regex(/^sha256:[a-f0-9]{64}$/),Fo=G.object({path:Lo,operation:G.enum(["create","update","delete"]),expectedHash:Uo.optional(),fullContent:G.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"})}),Ol=G.object({siteId:E,baseSnapshotId:_,operationId:G.string().min(1),reason:G.string().min(1),patches:G.array(Fo).min(1),changedRouteIds:G.array(G.string().min(1)),diagnostics:G.array(G.object({code:G.string().min(1),message:G.string().min(1),path:G.string().min(1).optional()})).default([])}).superRefine((t,n)=>{let i=new Set;for(let[s,r]of t.patches.entries())i.has(r.path)&&n.addIssue({code:"custom",path:["patches",s,"path"],message:`Duplicate patch path: ${r.path}`}),i.add(r.path)});var Nt="::repeat-item#";function Ko(t,n){return`${t}${Nt}${n}`}function Ml(t,n){return n.reduce((i,s)=>Ko(i,s),t)}function Go(t){if(typeof t!="string"||t.length===0)return null;let n=[],i=t;for(;;){let s=i.lastIndexOf(Nt);if(s<0)break;let r=Number(i.slice(s+Nt.length));if(!Number.isInteger(r)||r<0)return null;n.unshift({repeatIndex:r}),i=i.slice(0,s)}return!i||n.length===0?null:{baseKey:i,parts:n}}function Ll(t){return Go(t)?.baseKey??t??null}import{z as a}from"zod";import{z as H}from"zod";var qo=H.object({placementKey:H.string().min(1),placementUnitKey:H.string().min(1),relation:H.enum(["before","after","prepend","append"])}).strict(),Bo=H.object({status:H.literal("supported"),containerKey:H.string().min(1),hasBusinessMembers:H.boolean(),placementUnitKeys:H.array(H.string().min(1)),placements:H.array(qo)}).strict().superRefine((t,n)=>{let i=new Set(t.placementUnitKeys);i.size!==t.placementUnitKeys.length&&n.addIssue({code:"custom",path:["placementUnitKeys"],message:"Render page composition placement unit keys must be unique."});let s=new Set;t.placements.forEach((r,m)=>{s.has(r.placementKey)&&n.addIssue({code:"custom",path:["placements",m,"placementKey"],message:"Render page composition placement keys must be unique."}),s.add(r.placementKey),i.has(r.placementUnitKey)||n.addIssue({code:"custom",path:["placements",m,"placementUnitKey"],message:"Render page composition placement must reference a projected unit."})})}),zo=H.object({status:H.literal("unsupported"),reason:Ye,diagnostics:H.array(Ne)}).strict(),hi=H.discriminatedUnion("status",[Bo,zo]);var Wo=a.object({canUpdateText:a.boolean(),canInsertChild:a.boolean(),canMove:a.boolean(),canRemove:a.boolean()}),_i=a.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),Vo=a.enum(["cms-field","api-field"]),Ho=a.enum(["text","attribute","richtext","repeat-region","component-prop"]),$o=a.enum(["exact","safe-derived","partial","unknown"]),Yo=a.object({file:a.string().min(1),symbol:a.string().min(1).optional(),reason:a.string().min(1)}),Zo=a.object({sourceKind:_i,sourceType:Vo,endpointPattern:a.string().min(1).optional(),operation:a.string().min(1).optional(),collection:a.string().min(1).optional(),fieldPath:a.string().min(1).optional(),valuePath:a.string().min(1).optional(),targetKind:Ho,targetName:a.string().min(1),confidence:$o,readonly:a.literal(!0),evidence:a.array(Yo)}),Si=a.object({hasDynamicData:a.boolean(),bindings:a.array(Zo)}),fi=a.object({hasDynamicData:a.boolean(),sourceKinds:a.array(_i),primaryEndpoint:a.string().min(1).optional(),primaryCollection:a.string().min(1).optional(),primaryFieldPath:a.string().min(1).optional()}),Xo=a.object({key:a.string().min(1),pageCompositionUnitKey:a.string().min(1).optional(),operationSummary:Wo,dynamicDataSummary:fi.optional()}).strict(),Xl=a.object({siteId:E,snapshotId:_,routeId:a.string().min(1),version:a.number().int().nonnegative(),entries:a.array(Xo),pageComposition:hi}).strict(),jt=a.enum(["api-field","cms-field","i18n-message","config-entry"]),bi=a.object({kind:a.enum(["literal","binding","imported-binding","repeat-template"]),file:a.string().min(1),expression:a.string().min(1),bindingName:a.string().min(1).optional(),path:a.array(a.union([a.string(),a.number()])).optional()}),Ot=a.object({index:a.number().int().min(0),value:a.string(),editable:a.boolean(),source:bi.nullable()}),Oe=a.object({key:a.string().min(1),label:a.string().min(1),tag:a.string().min(1)}),Ql=a.object({key:a.string().min(1),canUpdateText:a.boolean(),canInsertChild:a.boolean(),canMove:a.boolean(),canRemove:a.boolean(),boundaryKind:Je.nullable(),isOpaque:a.boolean()}),Qo=a.object({kind:a.enum(["jsx-node","component-proxy","value-binding","route-export"]),file:a.string().min(1),componentName:a.string().min(1),isProxy:a.boolean()}),Jo=a.object({kind:a.enum(["jsx-node","value-path","route-export","external-entry"]),file:a.string().min(1).optional(),isProxy:a.boolean(),displayPath:a.string().min(1).optional(),sourceType:jt.optional(),sourceId:a.string().min(1).optional()}),yi=a.object({kind:a.union([a.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),jt]),file:a.string().min(1),displayPath:a.string().min(1),externalSource:a.object({sourceType:jt,sourceId:a.string().min(1),adapterId:a.string().min(1).optional()}).optional()}),er=a.object({kind:yi.shape.kind,file:a.string().min(1),displayName:a.string().min(1),canEditHere:a.boolean()}),we=a.object({finalSource:yi.nullable(),chain:a.array(er),confidence:a.enum(["exact","safe-derived","partial","unknown"]),editMode:a.enum(["direct","proxy","upstream","readonly","unsupported"]),diagnostics:a.array(a.object({code:a.string().min(1),message:a.string().min(1)}))}),tr=a.object({kind:a.literal("css-style-model"),properties:a.array(a.object({property:ii,value:a.union([a.string(),a.number(),a.boolean(),a.null()]),resolvedValue:a.union([a.string(),a.number(),a.boolean(),a.null()]).optional(),breakpoint:si.optional(),state:ai.optional(),variants:a.array(a.string().min(1)).optional(),options:a.array(a.union([a.string(),a.number()])).optional(),editable:a.boolean(),diagnostics:a.array(a.object({code:a.string().min(1),message:a.string().min(1)})).optional(),operationBoundary:a.array(je).optional()}))}),Jl=a.union([a.record(a.string(),a.unknown()),tr]),Ei=a.object({kind:a.literal("class-name-source"),className:a.string(),sourceKind:a.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:a.boolean(),operationBoundary:a.array(je),sourcePath:a.string().min(1).optional(),diagnostics:a.array(a.object({code:a.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:a.string().min(1)})).optional()}),nr=a.object({startLine:a.number().int().positive(),startColumn:a.number().int().nonnegative(),endLine:a.number().int().positive(),endColumn:a.number().int().nonnegative()}),wt=a.object({sourceFile:a.string().min(1),componentName:a.string().min(1),openingElementRange:nr,structuralPath:a.string().min(1),textPreview:a.string().min(1).optional()}),eu=a.object({key:a.string().min(1),tag:a.string().min(1),componentName:a.string().min(1),sourceFile:a.string().min(1),sourceLocator:wt.optional(),label:a.string().min(1),capabilities:et,writeTarget:Qo,effectiveWriteTarget:Jo.optional(),provenanceChain:we.optional(),componentSemantic:a.record(a.string(),a.unknown()).optional(),contentModel:a.record(a.string(),a.unknown()).optional(),mediaModel:a.record(a.string(),a.unknown()).optional(),styleSource:Ei.optional(),conditional:a.record(a.string(),a.unknown()).optional(),dynamicData:Si.optional(),textSegments:a.array(Ot),boundaryKind:Je.nullable(),isOpaque:a.boolean(),ancestors:a.array(Oe),children:a.array(Oe),siblings:a.array(Oe)}),tu=a.object({key:a.string().min(1),tag:a.string().min(1),label:a.string().min(1),sourceLocator:wt.optional(),capabilities:a.object({constraints:et.shape.constraints}),isOpaque:a.boolean(),provenanceChain:a.object({editMode:we.shape.editMode,diagnostics:we.shape.diagnostics}).optional(),dynamicDataSummary:fi.optional(),ancestors:a.array(Oe)}),nu=a.object({key:a.string().min(1),tag:a.string().min(1),label:a.string().min(1),sourceLocator:wt.optional(),isOpaque:a.boolean(),ancestors:a.array(Oe),componentName:a.string().min(1),sourceFile:a.string().min(1),capabilities:et,provenanceChain:a.object({editMode:we.shape.editMode,diagnostics:we.shape.diagnostics}).optional(),textSegments:a.array(a.object({index:Ot.shape.index,editable:Ot.shape.editable,sourceKind:bi.shape.kind.nullable()})),dynamicData:Si.optional(),boundaryKind:Je.nullable()}),iu=a.object({key:a.string().min(1),mediaModel:a.record(a.string(),a.unknown()).optional(),styleSource:Ei.optional()});var ir=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],ar=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],sr=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],or=new Set(ir),rr=new Set(ar),cr=new Set(sr),mr={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function su(t){return or.has(Mt(t))}function pr(t){return rr.has(Mt(t))}function dr(t){return cr.has(Mt(t))}function ou(t){let{operationSummary:n}=t;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:t.fallbackMode!=="preview"?{...mr}:{canUpdateText:dr(t.tagName),canInsertChild:pr(t.tagName),canMove:!1,canRemove:!1}}function Mt(t){return t?.trim().toLowerCase()??""}import{z as xi}from"zod";var pu=xi.object({routeId:xi.string().min(1),mutationContext:De.optional()}).strict();var lu={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."},uu={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."},gu={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},hu={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var Ii="0.6.10",Su="x-vcp-edit-engine-version",fu="x-vcp-edit-engine-version-source",Lt=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},lr=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function ur(t){return lr.test(t)}function gr(t){if(typeof t!="string"||!ur(t))throw new Lt;return t}function bu(t){return t==null?{version:Ii,source:"fallback_current"}:{version:gr(t),source:"explicit"}}function yu(){return{version:Ii,source:"system_current"}}import{z as M}from"zod";var hr=M.enum(["active","paused","blocked"]),Ri=M.enum(["typecheck_failed","health_failed","validation_failed"]),_r={status:hr,attempts:M.number().int().nonnegative(),attempted_template_version:X.nullable(),last_error_code:Ri.nullable()},Se=M.object(_r).strict(),tt=M.object({template_id:M.string().trim().min(1),target_template_version:X}).strict(),Ru=tt,Sr=M.discriminatedUnion("action",[M.object({action:M.literal("proceed"),state:Se.extend({status:M.literal("active")})}).strict(),M.object({action:M.literal("skip_not_newer"),state:Se.extend({status:M.literal("active")})}).strict(),M.object({action:M.literal("skip_paused"),state:Se.extend({status:M.literal("paused")})}).strict(),M.object({action:M.literal("skip_blocked"),state:Se.extend({status:M.literal("blocked")})}).strict()]),Tu=tt,ku=Sr,Pu=tt.extend({error_code:Ri}),Au=M.object({state:Se}).strict(),Cu=tt,Du=M.object({state:Se}).strict();import{z as x}from"zod";var fr=744*60*60*1e3,br=x.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),yr=x.enum(["typecheck","build","health","validation"]),Er=x.enum(["not_attempted","promoted","aborted"]),wu=x.object({template_id:x.string().trim().min(1).max(128),from_version:X.nullable(),to_version:X,outcome:br,attempt:x.number().int().nonnegative().max(2147483647),duration_ms:x.number().int().nonnegative().max(2147483647),replaced_group_count:x.number().int().nonnegative().max(2147483647),skipped_group_count:x.number().int().nonnegative().max(2147483647),validation_stage:yr.nullable(),cas_outcome:Er.nullable()}).strict(),Mu=x.object({recorded:x.literal(!0)}).strict(),Ti=x.object({from:x.iso.datetime(),to:x.iso.datetime()}).strict().refine(({from:t,to:n})=>Date.parse(t)<Date.parse(n),{message:"from must be earlier than to",path:["to"]}).refine(({from:t,to:n})=>Date.parse(n)-Date.parse(t)<=fr,{message:"report window must not exceed 31 days",path:["to"]}),Lu=Ti,xr=x.object({eligible:x.number().int().nonnegative(),fast_path:x.number().int().nonnegative(),upgraded:x.number().int().nonnegative(),skipped:x.number().int().nonnegative(),lock_skipped:x.number().int().nonnegative(),cas_aborted:x.number().int().nonnegative(),validation_failed:x.number().int().nonnegative(),blocked:x.number().int().nonnegative(),paused:x.number().int().nonnegative()}).strict(),Uu=x.object({window:Ti,outcome_counts:xr,current_state_counts:x.object({blocked:x.number().int().nonnegative(),paused:x.number().int().nonnegative()}).strict(),duration_ms:x.object({p50:x.number().int().nonnegative().nullable(),p95:x.number().int().nonnegative().nullable(),sample_count:x.number().int().nonnegative()}).strict()}).strict(),Fu=x.object({older_than:x.iso.datetime(),limit:x.coerce.number().int().min(1).max(200).default(50),include_candidates:x.enum(["true","false"]).default("false").transform(t=>t==="true")}).strict(),Ir=x.object({site_id:E,snapshot_id:_,status:x.enum(["candidate","deleting"]),created_at:x.iso.datetime()}).strict(),Ku=x.object({snapshots:x.array(Ir)}).strict();import{z as T}from"zod";var Rr=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],ki=T.object({name:T.string().min(1).max(100),type:T.enum(Rr),label:T.string().min(1).max(255),required:T.boolean().optional(),options:T.array(T.string()).optional()}),Bu=T.object({name:T.string(),cms_type:T.string(),label:T.string().optional(),required:T.boolean().optional(),value_shape:T.string().optional(),front_display:T.enum(["visible","internal","forbidden"]).optional(),choices:T.array(T.object({value:T.union([T.string(),T.number()]),label:T.string()})).optional()}),zu=T.object({route_file_path:T.string().min(1),target_component_path:T.string().min(1),content_type_hint:T.string().min(1),required_fields:T.array(ki).optional(),mode:T.enum(["bind_existing","provision"]),list_mode:T.enum(["page","embedded"]).optional(),fields:T.array(ki).optional(),seed_records:T.array(T.record(T.string(),T.unknown())).optional()});import{z as U}from"zod";var Me=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],Tr=U.object({name:U.string().min(1).max(100),type:U.enum(Me),label:U.string().min(1).max(255),required:U.boolean().optional(),options:U.array(U.string()).optional()}),kr=U.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),Hu=U.object({mode:U.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:U.string().min(1).optional(),name:U.string().min(1).max(255).optional(),component_slug:kr,description:U.string().min(1).max(1e3).optional(),fields:U.array(Tr).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"})}),$u=U.object({name:U.string(),label:U.string(),cms_type:U.string(),required:U.boolean()});import{z as c}from"zod";var Le=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,be=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,nt=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,Ci=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,Di=/^[a-z][a-z0-9-]{0,99}$/,vi=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,Pi=2,it=c.string().regex(Le),Pr=c.string().regex(Le),Ft=c.string().regex(Le),Ue=c.string().regex(nt),Kt=c.string().regex(Ci),Ar=c.discriminatedUnion("status",[c.object({status:c.literal("unbound"),form_code:c.null()}).strict(),c.object({status:c.literal("bound"),form_code:c.string().regex(be)}).strict(),c.object({status:c.literal("missing"),form_code:c.string().regex(be)}).strict()]),Cr=c.object({value:Kt,label:c.string().trim().min(1).max(255)}).strict(),Dr=c.object({kind:c.literal("field"),field_name:Ue,type:c.enum(Me),label:c.string().trim().min(1).max(255),required:c.boolean(),span:c.enum(["full","half"]),options:c.array(Cr).max(100)}).strict(),vr=c.object({kind:c.literal("step-break"),step_id:c.string().regex(Le)}).strict(),Nr=c.discriminatedUnion("kind",[Dr,vr]),jr=c.object({field_name:Ue,type:c.enum(Me),last_label:c.string().max(255)}).strict(),Or=c.object({field_name:Ue,value:Kt,last_label:c.string().max(255)}).strict(),wr=c.discriminatedUnion("kind",[c.object({kind:c.literal("custom")}).strict(),c.object({kind:c.literal("template"),slug:c.string().regex(Di),version:c.string().regex(vi)}).strict()]),Ni=new Set(["select","radio","multiselect"]);function J(t){return t.toLowerCase()}function fe(t,n){return`${J(t)}\0${n}`}function q(t,n,i,s){let r=new Set;for(let m of t){if(r.has(m)){s.addIssue({code:"custom",path:n,message:i});return}r.add(m)}}function Gt(t,n,i,s){t&&n===0?s.addIssue({code:"custom",path:i,message:"choice fields require at least one option"}):!t&&n>0&&s.addIssue({code:"custom",path:i,message:"non-choice fields must use an empty options array"})}var qt=c.object({schema_version:c.literal(1),min_runtime_version:c.number().int().positive(),form_definition_id:it,binding:Ar,content_locale:Z,features:c.object({multistep:c.boolean()}).strict(),copy:c.object({title:c.string().max(255),description:c.string().max(1e3),submit_button:c.string().trim().min(1).max(100),success_message:c.string().trim().min(1).max(500),error_message:c.string().trim().min(1).max(500)}).strict(),layout:c.object({columns:c.enum(["one","two"])}).strict(),nodes:c.array(Nr).min(1).max(200),source:wr,retired:c.object({fields:c.array(jr).max(1e3),options:c.array(Or).max(5e3)}).strict(),compatibility:c.object({standardization_version:c.number().int().positive(),diagnostics:c.array(c.string().trim().min(1).max(500)).max(100)}).strict()}).strict().superRefine((t,n)=>{let i=t.nodes.flatMap((o,l)=>o.kind==="field"?[[l,o]]:[]),s=i.map(([,o])=>o);s.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"at least one field node is required"});let r=t.nodes.filter(o=>o.kind==="step-break");!t.features.multistep&&r.length>0&&n.addIssue({code:"custom",path:["nodes"],message:"step-break requires the multistep feature"}),t.features.multistep&&(t.min_runtime_version<Pi&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${Pi}`}),r.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"multistep requires at least one step-break"}));for(let[o,l]of t.nodes.entries())l.kind==="step-break"&&(o===0||o===t.nodes.length-1||t.nodes[o-1]?.kind==="step-break"||t.nodes[o+1]?.kind==="step-break")&&n.addIssue({code:"custom",path:["nodes",o],message:"step-break must separate two non-empty steps"});q(r.map(o=>o.step_id),["nodes"],"step_id must be unique",n),q(s.map(o=>J(o.field_name)),["nodes"],"field_name must be unique",n),q(t.retired.fields.map(o=>J(o.field_name)),["retired","fields"],"retired field_name must be unique",n);let m=new Set(t.retired.fields.map(o=>J(o.field_name)));for(let[o,l]of i)m.has(J(l.field_name))&&n.addIssue({code:"custom",path:["nodes",o,"field_name"],message:"retired field_name cannot be reused"}),Gt(Ni.has(l.type),l.options.length,["nodes",o,"options"],n),q(l.options.map(y=>y.value),["nodes",o,"options"],"option value must be unique within a field",n),q(l.options.map(y=>y.label),["nodes",o,"options"],"option label must be unique within a field",n);q(t.retired.options.map(o=>fe(o.field_name,o.value)),["retired","options"],"retired option identity must be unique",n);let g=new Set(t.retired.options.map(o=>fe(o.field_name,o.value)));for(let[o,l]of i)for(let[y,h]of l.options.entries())g.has(fe(l.field_name,h.value))&&n.addIssue({code:"custom",path:["nodes",o,"options",y,"value"],message:"retired option value cannot be reused"})});function tg(t,n){let i=[],s=t.nodes.filter(o=>o.kind==="field"),r=new Map(n.nodes.filter(o=>o.kind==="field").map(o=>[J(o.field_name),o])),m=new Map(n.retired.fields.map(o=>[J(o.field_name),o])),g=new Map(n.retired.options.map(o=>[fe(o.field_name,o.value),o]));for(let o of s){let l=J(o.field_name),y=r.get(l),h=m.get(l);y&&y.field_name!==o.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:o.field_name}),y&&y.type!==o.type&&i.push({code:"FIELD_TYPE_CHANGED",field_name:o.field_name}),!y&&h&&h.field_name!==o.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:o.field_name}),!y&&h&&h.type!==o.type&&i.push({code:"FIELD_TYPE_CHANGED",field_name:o.field_name}),!y&&!m.has(l)&&i.push({code:"FIELD_RETIREMENT_MISSING",field_name:o.field_name});let b=new Set(y?.options.map(w=>w.value)??[]);for(let w of o.options){let L=g.get(fe(o.field_name,w.value));!b.has(w.value)&&L&&L.field_name!==o.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:o.field_name}),!b.has(w.value)&&!L&&i.push({code:"OPTION_RETIREMENT_MISSING",field_name:o.field_name,value:w.value})}}for(let o of t.retired.fields){let l=m.get(J(o.field_name));l&&l.field_name!==o.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:o.field_name}),l&&l.type!==o.type&&i.push({code:"FIELD_TYPE_CHANGED",field_name:o.field_name}),l||i.push({code:"FIELD_RETIREMENT_MISSING",field_name:o.field_name})}for(let o of t.retired.options){let l=g.get(fe(o.field_name,o.value));l&&l.field_name!==o.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:o.field_name}),l||i.push({code:"OPTION_RETIREMENT_MISSING",field_name:o.field_name,value:o.value})}return i}var Mr=c.enum(Pe),re=c.object({english:c.string().max(1e3),translations:c.partialRecord(Mr,c.string().max(1e3)).optional()}).strict(),Lr=c.object({template_option_key:c.string().regex(Ci),label:re}).strict(),Ur=c.object({template_field_key:c.string().regex(nt),type:c.enum(Me),label:re,required:c.boolean(),span:c.enum(["full","half"]),options:c.array(Lr).max(100)}).strict(),Fr=c.object({template_step_key:c.string().regex(nt),after_field_key:c.string().regex(nt)}).strict(),ji=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],Kr=[1,1,1,1,1,1],Oi=c.enum(ji),Gr=c.object({schema_version:c.literal(1),slug:Oi,name:re,template_count:c.number().int().min(0).max(1)}).strict().superRefine((t,n)=>{t.name.english.trim()===""&&n.addIssue({code:"custom",path:["name","english"],message:"English category name is required"})}),qr=c.object({schema_version:c.literal(1),slug:c.string().regex(Di),version:c.string().regex(vi),category:Oi,copy:c.object({title:re,description:re,submit_button:re,success_message:re,error_message:re}).strict(),layout:c.object({columns:c.enum(["one","two"])}).strict(),fields:c.array(Ur).min(1).max(200),step_breaks:c.array(Fr).max(20).optional()}).strict().superRefine((t,n)=>{for(let m of["title","description","submit_button","success_message","error_message"])t.copy[m].english.trim()===""&&n.addIssue({code:"custom",path:["copy",m,"english"],message:"English baseline text is required"});q(t.fields.map(m=>m.template_field_key),["fields"],"template_field_key must be unique",n);let i=new Map(t.fields.map((m,g)=>[m.template_field_key,g])),s=t.step_breaks??[];q(s.map(m=>m.template_step_key),["step_breaks"],"template_step_key must be unique",n),q(s.map(m=>m.after_field_key),["step_breaks"],"step breaks must not share an anchor field",n);let r=-1;for(let[m,g]of s.entries()){let o=i.get(g.after_field_key);o===void 0||o>=t.fields.length-1?n.addIssue({code:"custom",path:["step_breaks",m,"after_field_key"],message:"step break must follow an existing non-final field"}):o<=r&&n.addIssue({code:"custom",path:["step_breaks",m,"after_field_key"],message:"step breaks must follow field order"}),r=o??r}t.fields.length+s.length>200&&n.addIssue({code:"custom",path:["step_breaks"],message:"template fields and step breaks must not exceed 200 nodes"});for(let[m,g]of t.fields.entries()){g.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",m,"label","english"],message:"English field label is required"}),Gt(Ni.has(g.type),g.options.length,["fields",m,"options"],n),q(g.options.map(o=>o.template_option_key),["fields",m,"options"],"template_option_key must be unique within a field",n),q(g.options.map(o=>o.label.english.trim().toLowerCase()),["fields",m,"options"],"English option labels must be unique within a field",n);for(let[o,l]of g.options.entries())l.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",m,"options",o,"label","english"],message:"English option label is required"})}}),ng=c.object({schema_version:c.literal(1),visibility:c.enum(["internal","public"]),categories:c.array(Gr).length(6),templates:c.array(qr).length(6)}).strict().superRefine((t,n)=>{let i=(s,r)=>{let m=Pe.filter(g=>!s.translations?.[g]?.trim());m.length>0&&n.addIssue({code:"custom",path:[...r,"translations"],message:`public template copy is missing locales: ${m.join(", ")}`})};q(t.categories.map(s=>s.slug),["categories"],"template category slug must be unique",n);for(let[s,r]of ji.entries()){let m=t.categories[s];m?.slug!==r&&n.addIssue({code:"custom",path:["categories",s,"slug"],message:`template category order must contain ${r}`});let g=t.templates.filter(l=>l.category===r).length,o=Kr[s];g!==o&&n.addIssue({code:"custom",path:["templates"],message:`${r} must contain exactly ${o} templates`}),m?.template_count!==g&&n.addIssue({code:"custom",path:["categories",s,"template_count"],message:"template_count must match catalog templates"})}if(q(t.templates.map(s=>s.slug),["templates"],"template slug must be unique",n),t.visibility==="public"){for(let[s,r]of t.categories.entries())i(r.name,["categories",s,"name"]);for(let[s,r]of t.templates.entries()){for(let[m,g]of Object.entries(r.copy))i(g,["templates",s,"copy",m]);for(let[m,g]of r.fields.entries()){i(g.label,["templates",s,"fields",m,"label"]);for(let[o,l]of g.options.entries())i(l.label,["templates",s,"fields",m,"options",o,"label"])}}}});function ig(t,n){let i=Rn(n),s=i?t.translations?.[i]:void 0;return s!==void 0&&s.trim()!==""?s:t.english}var Br=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num"],zr={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num"},Wr=c.object({value:Kt,label:c.string().trim().min(1).max(255)}).strict(),Vr=c.object({field_name:Ue,field_type:c.enum(Br),field_label:c.string().trim().min(1).max(255),is_required:c.boolean(),sort_order:c.number().int().nonnegative(),options:c.array(Wr).max(100)}).strict(),Hr=new Set(["DropdownSelection","RadioButton","Checkbox"]),wi=c.object({version:c.literal(1),locale:Z,fields:c.array(Vr).min(1).max(200)}).strict().superRefine((t,n)=>{q(t.fields.map(i=>J(i.field_name)),["fields"],"field_name must be unique",n);for(let[i,s]of t.fields.entries())Gt(Hr.has(s.field_type),s.options.length,["fields",i,"options"],n),q(s.options.map(r=>r.value),["fields",i,"options"],"option value must be unique within a field",n)});function ag(t){let n=t.nodes.filter(i=>i.kind==="field").map((i,s)=>({field_name:i.field_name,field_type:zr[i.type],field_label:i.label,is_required:i.required,sort_order:s,options:i.options.map(r=>({...r}))}));return wi.parse({version:1,locale:t.content_locale,fields:n})}var O=c.string().regex(/^sha256:[0-9a-f]{64}$/),$r=c.object({path:W,content_hash:O.nullable()}).strict(),Yr=c.array($r).min(1).max(500).superRefine((t,n)=>{q(t.map(i=>i.path),[],"affected file paths must be unique",n)}),Bt=c.object({grade:c.enum(["standard","A","B","C"]),required:c.boolean(),pending_confirmations:c.array(c.object({item_id:c.string().regex(Le),field_name:Ue.optional(),kind:c.enum(["form_copy","layout","field_label","field_type","field_required","field_options"]),message:c.string().trim().min(1).max(500)}).strict().superRefine((t,n)=>{t.kind.startsWith("field_")&&!t.field_name&&n.addIssue({code:"custom",path:["field_name"],message:"field confirmation items require field_name"})})).max(200)}).strict().superRefine((t,n)=>{let i=t.grade==="standard";i===t.required&&n.addIssue({code:"custom",path:["required"],message:i?"standard forms do not require standardization confirmation":"legacy forms require standardization confirmation"}),t.grade==="C"&&t.pending_confirmations.length===0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"grade C requires at least one pending confirmation"}),t.grade!=="C"&&t.pending_confirmations.length>0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"only grade C can contain pending confirmations"})}),Zr=c.object({site_id:E,form_definition_id:it,base_snapshot_id:_,expected_form_spec_hash:O,expected_cms_schema_hash:O.nullable(),draft_form_spec_hash:O,desired_cms_schema_hash:O,affected_files_hash:O,shared_reference_hash:O,shared_reference_count:c.number().int().positive(),confirm_shared_update:c.boolean(),recreate_missing_binding:c.boolean(),standardization:Bt,confirm_standardization:c.boolean()}).strict(),Mi=c.object({reference_hash:O,page_count:c.number().int().positive(),block_count:c.number().int().positive()}).strict().refine(t=>t.page_count<=t.block_count,{message:"page_count cannot exceed block_count"}),sg=c.object({site_id:E,form_block_id:Pr,base_snapshot_id:_,form_spec:qt,runtime_upgrade_required:c.boolean(),expected_form_spec_hash:O,expected_cms_schema_hash:O.nullable(),affected_files_hash:O,shared_impact:Mi,standardization:Bt}).strict(),Xr=c.object({operation_id:Ft,operation_fingerprint:O,site_id:E,form_definition_id:it,base_snapshot_id:_,expected_form_spec_hash:O,expected_cms_schema_hash:O.nullable(),draft_form_spec:qt,draft_form_spec_hash:O,desired_cms_schema_hash:O,affected_files_hash:O,shared_impact:Mi,confirm_shared_update:c.boolean(),recreate_missing_binding:c.boolean(),standardization:Bt,confirm_standardization:c.boolean()}).strict().superRefine((t,n)=>{t.form_definition_id!==t.draft_form_spec.form_definition_id&&n.addIssue({code:"custom",path:["form_definition_id"],message:"form_definition_id must match draft_form_spec"}),t.shared_impact.block_count>1&&!t.confirm_shared_update&&n.addIssue({code:"custom",path:["confirm_shared_update"],message:"shared definition updates require explicit confirmation"});let i=t.draft_form_spec.binding.status==="missing";i!==t.recreate_missing_binding&&n.addIssue({code:"custom",path:["recreate_missing_binding"],message:i?"missing bindings require explicit recreation confirmation":"only missing bindings can be recreated"});let s=t.draft_form_spec.binding.status==="bound",r=s&&t.standardization.required&&(t.standardization.grade==="B"||t.standardization.grade==="C");(s&&!r&&t.expected_cms_schema_hash===null||!s&&t.expected_cms_schema_hash!==null)&&n.addIssue({code:"custom",path:["expected_cms_schema_hash"],message:s?"bound standard forms require the current CMS schema hash":"unbound or missing forms cannot claim a current CMS schema hash"}),t.confirm_standardization!==t.standardization.required&&n.addIssue({code:"custom",path:["confirm_standardization"],message:t.standardization.required?"legacy standardization requires explicit confirmation":"standard forms cannot claim legacy standardization confirmation"})}),Qr=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],zt=c.enum(Qr),Jr=["pending","running","succeeded","failed","recovery_required"],Li=c.enum(Jr),ec=["candidate_abandon","snapshot_reconcile","cms_restore"],Ui=c.enum(ec),tc=["FORM_DESIGN_INVALID","FORM_DESIGN_UNSUPPORTED","FORM_DESIGN_STANDARDIZATION_AGENT_REQUIRED","FORM_DESIGN_STANDARDIZATION_UNSUPPORTED","FORM_DESIGN_FEATURE_NOT_ENABLED","FORM_DESIGN_PERMISSION_DENIED","FORM_DESIGN_LOCKED","FORM_DESIGN_CODE_CONFLICT","FORM_DESIGN_CMS_CONFLICT","FORM_DESIGN_CMS_SCHEMA_MISMATCH","FORM_DESIGN_CMS_NOT_FOUND","FORM_DESIGN_BINDING_MISSING","FORM_DESIGN_OPERATION_CONFLICT","FORM_DESIGN_CMS_UNAVAILABLE","FORM_DESIGN_PATCH_FAILED","FORM_DESIGN_COMPENSATION_FAILED","FORM_DESIGN_RECOVERY_REQUIRED"],Wt=c.enum(tc),Fi=c.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),Ki=c.enum(["not_started","pending","succeeded","failed"]),Gi=c.object({operation_id:Ft,operation_fingerprint:O,site_id:E,form_definition_id:it,stage:zt,status:Li,base_snapshot_id:_,candidate_snapshot_id:_.nullable(),before_form_code:c.string().regex(be).nullable(),materialized_form_code:c.string().regex(be).nullable(),expected_form_spec_hash:O,draft_form_spec_hash:O,materialized_form_spec_hash:O.nullable(),expected_cms_schema_hash:O.nullable(),desired_cms_schema_hash:O,retry_count:c.number().int().nonnegative(),failure_stage:Ui.nullable(),last_error_code:Wt.nullable(),retryable:c.boolean(),next_action:Fi,preview_refresh_status:Ki,created_at:c.string().datetime({offset:!0}),updated_at:c.string().datetime({offset:!0})}).strict().superRefine((t,n)=>{if(!(t.stage!=="committed"&&t.status!=="succeeded")){(t.stage!=="committed"||t.status!=="succeeded")&&n.addIssue({code:"custom",path:["status"],message:"committed stage and succeeded status must be reported together"});for(let i of["candidate_snapshot_id","materialized_form_code","materialized_form_spec_hash"])t[i]===null&&n.addIssue({code:"custom",path:[i],message:`${i} is required for a committed success`});(t.failure_stage!==null||t.last_error_code!==null||t.retryable||t.next_action!=="none")&&n.addIssue({code:"custom",path:["next_action"],message:"a committed success cannot retain an error or retry action"})}}),Vt=c.object({operation:Gi}).strict(),og=Vt,rg=Vt,cg=c.object({operation_fingerprint:O}).strict(),mg=Vt,nc=c.preprocess(t=>!t||typeof t!="object"||Array.isArray(t)||"standardization"in t||"confirm_standardization"in t?t:{...t,standardization:{grade:"standard",required:!1,pending_confirmations:[]},confirm_standardization:!1},Xr),pg=c.object({operation:Gi,request:nc,cms_replace_result:c.unknown().nullable()}).strict(),ic=c.object({stage:zt.optional(),status:Li.optional(),candidate_snapshot_id:_.nullable().optional(),before_form_code:c.string().regex(be).nullable().optional(),materialized_form_code:c.string().regex(be).nullable().optional(),materialized_form_spec_hash:O.nullable().optional(),retry_count:c.number().int().nonnegative().optional(),failure_stage:Ui.nullable().optional(),last_error_code:Wt.nullable().optional(),retryable:c.boolean().optional(),next_action:Fi.optional(),preview_refresh_status:Ki.optional()}).strict(),dg=c.object({expected_updated_at:c.string().datetime({offset:!0}),operation:ic,cms_replace_result:c.unknown().nullable().optional()}).strict().refine(t=>Object.keys(t.operation).length>0||Object.hasOwn(t,"cms_replace_result"),{message:"transition must change operation state or CMS result"}),lg=c.object({code:Wt,message:c.string().trim().min(1).max(500),retryable:c.boolean(),operation_id:Ft.optional(),stage:zt.optional()}).strict();function ac(t){return Zr.parse({site_id:t.site_id,form_definition_id:t.form_definition_id,base_snapshot_id:t.base_snapshot_id,expected_form_spec_hash:t.expected_form_spec_hash,expected_cms_schema_hash:t.expected_cms_schema_hash,draft_form_spec_hash:t.draft_form_spec_hash,desired_cms_schema_hash:t.desired_cms_schema_hash,affected_files_hash:t.affected_files_hash,shared_reference_hash:t.shared_impact.reference_hash,shared_reference_count:t.shared_impact.block_count,confirm_shared_update:t.confirm_shared_update,recreate_missing_binding:t.recreate_missing_binding,standardization:t.standardization,confirm_standardization:t.confirm_standardization})}function Ai(t){for(let n=0;n<t.length;n+=1){let i=t.charCodeAt(n);if(i>=55296&&i<=56319){let s=t.charCodeAt(n+1);if(n+1>=t.length||s<56320||s>57343)throw new TypeError("canonical JSON cannot contain a lone surrogate");n+=1}else if(i>=56320&&i<=57343)throw new TypeError("canonical JSON cannot contain a lone surrogate")}}function Ut(t,n){if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError("canonical JSON numbers must be finite");return JSON.stringify(t)}if(typeof t=="string")return Ai(t),JSON.stringify(t);if(typeof t!="object")throw new TypeError("value is not valid JSON");if(n.has(t))throw new TypeError("canonical JSON cannot contain cycles");n.add(t);try{if(Array.isArray(t)){let m=[];for(let g=0;g<t.length;g+=1){if(!(g in t))throw new TypeError("canonical JSON cannot contain sparse arrays");m.push(Ut(t[g],n))}return`[${m.join(",")}]`}let i=Object.getPrototypeOf(t);if(i!==Object.prototype&&i!==null)throw new TypeError("canonical JSON objects must be plain records");let s=t;return`{${Object.keys(s).sort().map(m=>(Ai(m),`${JSON.stringify(m)}:${Ut(s[m],n)}`)).join(",")}}`}finally{n.delete(t)}}function sc(t){return Ut(t,new Set)}async function at(t){let n=sc(t),i=await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));return`sha256:${Array.from(new Uint8Array(i),r=>r.toString(16).padStart(2,"0")).join("")}`}async function ug(t){return at(qt.parse(t))}async function gg(t){return at(wi.parse(t))}async function hg(t){let n=Yr.parse(t).map(i=>({...i})).sort((i,s)=>i.path<s.path?-1:i.path>s.path?1:0);return at({version:1,files:n})}async function _g(t){return at(ac(t))}import{z as ie}from"zod";var oc=["provisioning","cms_app_created","seeded","ready","failed"],yg=ie.object({tenant_id:ie.string().min(1),site_id:E,collection_slug:ie.string().min(1),cms_collection_id:ie.string().min(1).nullable(),status:ie.enum(oc),owned_by_vcp:ie.boolean(),run_id:v.nullable(),last_error:ie.string().nullable(),created_at:ie.string().datetime(),updated_at:ie.string().datetime()});var qi="/vibe/v1";function xg(t){let n=t?.trim().replace(/\/+$/,"");if(!n)return null;try{let i=new URL(n),s=i.pathname.replace(/\/+$/,"");return i.search="",i.hash="",i.pathname=s.endsWith(qi)?s:qi,i.href.replace(/\/+$/,"")}catch{return n}}import{z as F}from"zod";var rc=F.object({maxSites:F.number().int().nullable().optional(),maxStorageMb:F.number().int().nullable().optional(),customDomains:F.boolean().nullable().optional()}).passthrough().superRefine((t,n)=>{for(let i of Object.keys(t))i.includes("_")&&n.addIssue({code:"custom",path:[i],message:"Public plan feature fields must use camelCase."})}),cc=F.object({subscriptionId:F.string().min(1),planId:F.string().min(1),locale:F.enum(["en","zh_CN"]).or(F.string().min(1)),currentPeriodEnd:F.string().nullable(),servicePeriodEnd:F.string().nullable(),featureSnapshot:rc.nullable(),code:F.string().nullable(),level:F.number().int().nullable(),name:F.string().nullable()}).strict(),mc=F.object({hasActiveSubscription:F.boolean()}).strict(),Bi=F.object({plan:cc.nullable(),entitlement:mc}).strict();import{z as R}from"zod";var pc=["pending_dns","active"],Pg="CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED",dc=R.enum(pc),lc=R.enum(["ownershipVerification","certificateValidation","traffic","unknown"]),uc=R.enum(["pending","matched"]),gc=R.object({id:R.string().min(1),type:R.string().min(1),name:R.string().min(1),value:R.string().min(1),purpose:lc,required:R.boolean(),status:uc.optional()}).strict(),Fe=R.object({id:R.string().min(1),domainId:R.string().min(1).optional(),hostname:R.string().min(1),displayHostname:R.string().min(1),asciiHostname:R.string().min(1),status:dc,isPrimary:R.boolean(),deletable:R.boolean(),dnsRecords:R.array(gc),createdAt:R.string().datetime().nullable(),checkedAt:R.string().datetime().nullable()}).strict(),hc=R.object({hostname:R.string().min(1),url:R.string().url(),status:R.literal("ready")}).strict(),zi=R.object({defaultDomain:hc,currentDomain:Fe.nullable(),customDomains:R.array(Fe)}).strict(),Ag=R.object({hostname:R.string().min(1),isPrimary:R.boolean().optional()}).strict(),Wi=R.object({domain:Fe}).strict(),Vi=R.object({domain:Fe}).strict(),Hi=R.object({domain:Fe}).strict(),$i=R.object({deleted:R.boolean()}).strict();var Ke={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}},_c={heading:"Inter",body:"Inter"},Yi=Ke.Inter;function st(t){return t.trim().replace(/\s+/g,"_").toLowerCase()}var Ji=(()=>{let t=new Map;for(let[n,i]of Object.entries(Ke))t.set(st(n),i),t.set(st(i.import),i);return t})();function Sc(t){return typeof t!="string"||t.trim().length===0?Yi:Ji.get(st(t))??Yi}var fc=(()=>{let t=new Map;for(let[n,i]of Object.entries(Ke))t.set(i.import,n);return t})();function bc(t){if(typeof t!="string"||t.trim().length===0)return"Inter";let n=Ji.get(st(t));return n?fc.get(n.import)??"Inter":"Inter"}var yc=Object.keys(Ke),Zi='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',Xi='Georgia, "Times New Roman", serif',Qi='"SFMono-Regular", Consolas, monospace',Ec=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),xc=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(t=>t.toLowerCase())),Ic=new Set(["JetBrains Mono","IBM Plex Mono"].map(t=>t.toLowerCase()));function Rc(t){let n=t.toLowerCase();return Ic.has(n)||n.includes("mono")?"mono":xc.has(n)||n.includes("serif")?"serif":"sans"}function Ht(t,n){let i=l=>(l??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),s=i(t),r=i(n),m=l=>Ec.has(l.toLowerCase());if(s&&m(s)){let l=s.toLowerCase();return l.includes("mono")?Qi:l.includes("serif")?Xi:Zi}let g=s;g||(g=m(r)?"":r),g||(g="Inter");let o=Rc(g);return o==="mono"?`"${g}", ${Qi}`:o==="serif"?`"${g}", ${Xi}`:`"${g}", ${Zi}`}function Tc(t){return{"--site-font-sans":Ht(t?.body,"Inter"),"--site-font-heading":Ht(t?.heading,t?.body??"Inter")}}var kc=[{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 Pc=[{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 ee}from"zod";var Ac=ee.object({colorSeeds:ee.object({primary:ee.string().min(1).max(40),accent:ee.string().min(1).max(40)}).strict().optional(),fonts:ee.object({heading:ee.string().min(1).max(60),body:ee.string().min(1).max(60)}).strict().optional()}).strict().refine(t=>t.colorSeeds!==void 0||t.fonts!==void 0,{message:"colorSeeds or fonts is required"}),Cc=ee.object({ok:ee.literal(!0),design_plan_version:ee.number().int().positive(),snapshot_id:_});var Zt=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()}),Xt=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()}),$t=e.enum(["material","reference","brief","industry"]),Dc=e.object({market:e.object({value:e.string().min(1).max(200),source:$t}),customer:e.object({value:e.string().min(1).max(200),source:$t}),purpose:e.object({options:e.array(e.string().min(1).max(60)).min(2).max(4),selected:e.string().min(1).max(60),source:$t})}),vc=e.enum(["text-options","motion-slider","positioning"]),Qt=e.enum(["none","subtle","moderate","expressive"]),Nc=e.enum(["compact","comfortable","editorial"]),jc=Qt,aa=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()}),Oc=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:Zt.optional(),conversionHints:Xt.optional()}),wc=e.object({id:e.string(),type:vc,question:e.string(),tag:e.string(),aiThinking:e.string(),options:e.array(Oc),source:e.enum(["ai-detected","always-ask"]),sourceDetail:e.string(),positioning:Dc.optional()}),Jt=e.object({questions:e.array(wc).min(1).max(6)}),$g=e.object({tenant_id:e.string().min(1),site_id:E,brief_id:Re,brief:e.string().min(20).max(1e3),site_default_locale:Z.optional(),owner_locale:Z.optional(),input_context:e.object({facts:e.array(Be).max(120),conflicts:e.array(We).max(20),reference:ze.optional(),sources:e.array(e.object({type:ht,title:e.string().max(120).optional(),status:_t})).max(16).optional()}).optional()}),sa=e.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),Yg=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:v,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(aa).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:sa.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)})]),Mc=e.enum(["draft","brief_submitted","clarifying","sitemap_ready","workspace_ready","deployed","archived","error"]),Lc={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 Zg(t,n){if(!Lc[t].includes(n))throw new Error(`Invalid site status transition: ${t} -> ${n}`);return n}var Uc=e.enum(["planning","initial_generation_running","generated"]),Fc={planning:["initial_generation_running"],initial_generation_running:["generated","planning"],generated:[]};function Xg(t,n){if(t===n)return n;if(!Fc[t].includes(n))throw new Error(`Invalid site generation state transition: ${t} -> ${n}`);return n}function Qg(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 Jg="SITE_PLANNING_INPUT_FROZEN",eh="SITE_PLANNING_LOCKED",th=e.object({tenant_id:e.string().min(1),owner_user_id:ut,name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),nh=e.object({name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),ih=e.object({name:e.string().min(1).max(120)}),ah=e.object({name:e.string().min(1).max(120),default_locale:Z.optional()}),sh=e.object({body:e.string().min(20).max(1e3)}),oh=e.object({body:e.string().min(20).max(1e3)}),en=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"}),rh=e.object({tenant_id:e.string().min(1),site_url:en,site_name:e.string().trim().min(1).max(255).optional()}),B=t=>e.object({code:e.number().int(),data:t,message:e.string()}),ch=B(Dn),mh=B(vn),ph=B(Nn),dh=B(wn),lh=B(Mn),uh=B(Ln),gh=B(Fn),hh=B(Kn),_h=B(Gn),Sh=B(e.object({site_id:E,site_url:en})),fh=B(zi),bh=B(Wi),yh=B(Vi),Eh=B(Hi),xh=B($i),Ih=B(Bi),Ee=e.object({id:E,tenant_id:e.string().min(1),owner_user_id:ut.nullable(),name:e.string().min(1),slug:e.string().min(1),status:Mc,generation_state:Uc,planning_locked_at:e.string().min(1).nullable(),current_sitemap_id:te.nullable(),current_snapshot_id:_.nullable(),deployed_url:e.string().url().nullable(),default_locale:Z,owner_locale:Z.optional(),cms_site_id:e.string().nullable().optional(),cms_site_url:en.nullable().optional(),schema_version:e.literal(1),created_at:e.string().min(1),updated_at:e.string().min(1)}),tn=e.object({id:Re,tenant_id:e.string().min(1),site_id:E,body:e.string().min(1),source:e.enum(["user","import","system"]),created_at:e.string().min(1),updated_at:e.string().min(1)}),Rh=e.object({site:Ee,brief:tn,next_step:e.literal("clarify")}),Th=e.object({site:Ee,brief:tn}),kh=e.object({brief:tn}),Kc=e.enum(["queued","running","succeeded","failed","cancelled"]),oa=e.enum(["clarify","sitemap","workspace"]),ra=e.enum(["clarify","sitemap","initial_generation","iteration"]),ca=e.enum(["clarify","sitemap","workspace","summarize"]),me=e.object({id:v,tenant_id:e.string().min(1),site_id:E,agent_type:oa,run_kind:ra,status:Kc,model_route:ca,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)}),Ph=e.object({run_id:v.optional(),site_id:E,agent_type:oa,run_kind:ra.optional(),model_route:ca,input:e.record(e.string(),e.unknown()).optional()}).superRefine((t,n)=>{Ge(t.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),Ah=e.object({agent_run:me,next_step:e.literal("stream_events")}),ma=e.enum(["draft","candidate","deleting","current","failed"]),ae=e.object({id:_,tenant_id:e.string().min(1),site_id:E,version:e.number().int().positive(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:X.nullable().optional(),reason:e.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback","template_upgrade"]),status:ma,created_at:e.string().min(1)}),Ch=e.object({snapshot_id:_,creation_key:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:X.optional(),reason:ae.shape.reason,status:e.enum(["draft","candidate","current","failed"]).default("candidate"),source_run_id:v.optional()}),Dh=e.object({site:Ee,snapshot:ae,next_step:e.literal("workspace")}),vh=e.object({expected_manifest_hash:ae.shape.manifest_hash,manifest_hash:ae.shape.manifest_hash,object_key:ae.shape.object_key}).strict(),Nh=e.union([e.object({base_snapshot_id:_.nullable(),source_run_id:v.optional()}).strict(),e.object({skip_base_check:e.literal(!0)}).strict()]),Gc=e.object({site:Ee,snapshot:ae,next_step:e.literal("workspace")}),jh=e.object({snapshot:ae}),Oh=e.object({status:e.literal("deleting"),snapshot_id:_,object_key:e.string().min(1)}),wh=e.object({status:e.literal("deleted"),snapshot_id:_}),ct=e.object({id:un,tenant_id:e.string().min(1),site_id:E,snapshot_id:_,version:e.number().int().positive(),accepted_commit:e.string().min(1),source_run_id:v.nullable(),created_at:e.string().min(1)}),qc=ct.extend({reason:ae.shape.reason,status:ma}),Mh=e.object({accepted_commit:e.string().min(1),source_run_id:v.optional()}),Lh=e.object({site_version:ct,next_step:e.literal("workspace")}),Uh=e.object({owner_id:e.string().min(1)}).strict(),Fh=e.discriminatedUnion("acquired",[e.object({acquired:e.literal(!0)}).strict(),e.object({acquired:e.literal(!1)}).strict()]),Kh=e.object({owner_id:e.string().min(1)}).strict(),Gh=e.object({released:e.literal(!0)}).strict(),qh="TEMPLATE_UPGRADE_LOCK_LOST",Bh=e.object({base_snapshot_id:_,accepted_commit:ct.shape.accepted_commit,owner_id:e.string().min(1)}).strict(),zh=Gc.strict(),Wh=e.object({site_versions:e.array(qc)}),Vh=e.object({site:Ee,snapshot:ae,site_version:ct,next_step:e.literal("workspace")}),Hh=e.object({snapshot_id:_,force_rehydrate:e.boolean().optional()}),$h=e.discriminatedUnion("status",[e.object({status:e.literal("ready"),snapshot_id:_,preview_url:e.string().min(1)}),e.object({status:e.literal("failed"),code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})]),Yh="DEPLOYMENT_ENTITLEMENT_REQUIRED",nn=e.enum(hn),mt=e.object({id:Te,tenant_id:e.string().min(1),site_id:E,snapshot_id:_,version:e.number().int().positive(),status:nn,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)}),Zh=e.object({snapshot_id:_.optional()}).default({}),Xh=e.object({deployment:mt}),Qh=e.object({deployment:mt.nullable()}),Jh=e.object({deployment:mt}),ea=e.object({id:Te,status:nn,url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable()}),e_=e.object({current:ea.nullable(),latest_released:ea.nullable()}),Bc=e.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),ye=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:E,deployment_id:Te,seq:e.number().int().positive(),sent_at:e.string().min(1)}),ot=e.object({deployment:mt}),t_=e.discriminatedUnion("type",[ye.extend({type:e.literal("deployment.snapshot"),payload:ot}),ye.extend({type:e.literal("deployment.status.changed"),payload:ot}),ye.extend({type:e.literal("deployment.finished"),payload:ot}),ye.extend({type:e.literal("deployment.failed"),payload:ot}),ye.extend({type:e.literal("deployment.realtime.recovered"),payload:e.object({action:e.literal("refresh")})}),ye.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})})]),n_=e.object({tenant_id:e.string().min(1),site_id:E,deployment_id:Te,status:nn,updated_at:e.string().min(1)}),zc="vcp:deployments",i_={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:zc,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...Bc.options]},Wc=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)})}),a_=e.object({error:Wc.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:me})})}),s_=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({})}),Vc=e.object({theme_id:e.string().min(1),paletteIntent:e.string().min(1),tone:e.string().min(1),mediaMood:e.string().min(1),motionLevel:Qt.optional(),userVisualHints:Zt.optional()}),Hc=e.object({question:e.string().min(1),answer:e.string().min(1)}),o_=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)}),r_=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()}),$c=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()}),c_=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:$c.optional()}),Yc=e.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),xe=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:Yc.default("system_recommended")}),k=e.string().min(1).max(2e3),ta=e.string().min(1).max(120),pa=e.object({visualDirection:k,brandFeeling:k,paletteIntent:k,typographyIntent:k,density:Nc,motionLevel:jc,mediaStrategy:k,compositionRules:e.array(k).max(20),avoidPatterns:e.array(k).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()}),an=160,da=e.object({routeGoal:k,narrativeArc:k,firstViewportIntent:k,visualContinuity:k,sectionRhythm:k,avoidPatterns:e.array(k).max(20),displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(an).optional(),metaTitle:e.string().min(1).max(120).optional(),metaDescription:e.string().min(1).max(320).optional()}),la=e.enum(["model_call","validation","repair","preview","worker_group"]),ce=e.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),ua=e.object({sectionRole:k,contentIntent:k,layoutIntent:k,visualIntent:k,mediaIntent:k,motionIntent:k,copyTone:k,displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(an).optional(),ctaIntent:k.optional(),continuityWithPrevious:k.optional(),avoidRepeating:e.array(k).max(20).optional(),industryRecipeRefs:e.array(ta).max(12).optional(),templateRecipeRefs:e.array(ta).max(12).optional()}),ga=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()}),Zc=e.enum(["solid","floating"]),Xc=e.enum(["background","card","primary","frosted"]),Qc=e.enum(["sticky","hide-on-scroll","static"]),Jc=e.enum(["bar","island"]),em=e.object({variant:Zc,surface:Xc.optional(),behavior:Qc.optional(),shape:Jc.optional()}),tm=e.object({form:k,layoutIntent:k,scrollBehavior:k,shell:em.optional(),avoidPatterns:e.array(k).max(10).optional()}),nm=e.enum(["background","card","primary","inverse"]),im=e.object({surface:nm}),am=e.object({form:k,composition:k,shell:im.optional(),avoidPatterns:e.array(k).max(10).optional()}),sm=e.object({pattern:k,intent:k}),ha=e.object({header:tm,footer:am,mobileNav:sm}),_a=e.object({schemaVersion:e.literal(1).default(1),siteDesignContext:pa,routeCards:e.record(e.string().min(1),da),blockContexts:e.record(e.string().min(1),ua),selectedSkillPacks:e.array(xe).max(3).optional(),branding:ga.optional(),chromeDesign:ha.optional()}),m_=e.object({siteDesignContext:pa.omit({imagePalette:!0}).optional(),routeCards:e.record(e.string().min(1),da).optional(),blockContexts:e.record(e.string().min(1),ua).optional(),branding:ga.optional(),chromeDesign:ha.optional()}),om=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(),rm=e.string().regex(Ce,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),cm=new RegExp(`^/(?:${he}(?:/${he})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),mm=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,pm=e.union([e.string().regex(cm),e.string().regex(mm)]),na=e.object({label:e.string(),href:pm}),dm=e.object({primaryLinks:e.array(na),footerLinks:e.array(na)}),Sa=e.object({id:e.string(),slug:rm,title:e.string(),blocks:e.array(om).min(1),layout:e.enum(["default","centered","fullwidth"]).optional(),navigation:e.object({showInHeader:e.boolean(),showInFooter:e.boolean(),order:e.number()})}).strict(),lm=Sa.extend({slug:e.string().min(1)}),ia=e.object({label:e.string(),href:e.string().min(1)}),um=e.object({primaryLinks:e.array(ia),footerLinks:e.array(ia)}),fa=e.object({site_name:e.string().min(1).max(80).optional(),version:e.number().int().positive(),pages:e.array(Sa).min(1),navigation:dm,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:xe,visualTheme:Vc.optional(),userChoices:e.array(Hc).optional(),confirmedChoices:e.object({conversion:Xt.optional()}).optional()}).strict(),pt=fa.superRefine((t,n)=>{let i=new Map,s=0;t.pages.forEach((r,m)=>{r.slug==="/"&&(s+=1);let g=i.get(r.slug);g!==void 0?n.addIssue({code:"custom",path:["pages",m,"slug"],message:`Duplicate page slug '${r.slug}' (first used at pages.${g}.slug).`}):i.set(r.slug,m)}),(s!==1||t.pages[0]?.slug!=="/")&&n.addIssue({code:"custom",path:["pages"],message:"Sitemap must contain exactly one home page at pages[0] with slug '/'."})}),p_=fa.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0}).extend({site_name:e.string().min(1).max(80),pages:e.array(lm).min(1),navigation:um}),gm=e.enum(["ai","user"]),Ie=e.object({site_id:E,page_id:e.string().min(1),edited_by:gm.default("ai"),source_agent_run_id:v.optional()}),d_=Ie.extend({block_id:e.string().min(1),target_index:e.number().int().min(0)}),hm=Ie.extend({block_id:e.string().min(1)}),_m=Ie.extend({block_id:e.string().min(1),instruction:e.string()}),l_=Ie.extend({block_id:e.string().min(1),variant:e.string().min(1).nullable()}),u_=Ie.extend({block_id:e.string().min(1),props:e.record(e.string(),e.unknown()),mode:e.enum(["replace","merge"]).default("replace")}),g_=Ie.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()})}),Sm=e.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),h_=e.discriminatedUnion("operation",[e.object({operation:e.literal("delete_block"),input:hm}).strict(),e.object({operation:e.literal("update_block_instruction"),input:_m}).strict()]),fm=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"]),bm=e.object({status:e.literal("updated"),operation:Sm,site_id:E,sitemap_id:te,version:e.number().int().positive(),changed_pages:e.array(e.string().min(1)).min(1),requires_code_patch:e.literal(!0)}),ym=e.object({status:e.literal("failed"),code:fm,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),__=e.discriminatedUnion("status",[bm,ym]),sn=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:Qt.optional(),visual_tonality:Zt.optional(),conversion:Xt.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()}),S_=e.object({tenant_id:e.string().min(1),site_id:E,brief_id:Re,brief:e.string().min(20).max(1e3),answers:e.array(sn).min(1).max(10),skillSelection:xe,site_default_locale:Z.optional(),owner_locale:Z.optional(),reference:ze.optional(),input_context:e.object({facts:e.array(Be).max(120),conflicts:e.array(We).max(20)}).optional()}),ba=e.enum(["planning","generating","validating","ready"]),Em=e.enum(["salvaged","deterministic_fallback"]),xm=e.enum(["model_exception_settled_prefix","model_exception_safe_root"]),ya={outcome:Em.optional(),reason:xm.optional(),attempts:e.number().int().positive().optional()};function Ea(t,n){if(t.type!=="sitemap.generated")return;let i=t.outcome!==void 0,s=t.reason!==void 0;i!==s&&n.addIssue({code:"custom",path:[i?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var Im=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:v,at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:ba,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:te,sitemap:pt,...ya,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:_,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:_.optional(),at:e.string().min(1)})]),f_=Im.superRefine(Ea),Rm=e.object({id:te,tenant_id:e.string().min(1),site_id:E,version:e.number().int().positive(),sitemap:pt,source_agent_run_id:v.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),b_=e.object({sitemap_id:te,creation_key:e.string().min(1),sitemap:pt,source_agent_run_id:v.optional()}),y_=e.object({site:Ee,sitemap:Rm,next_step:e.literal("workspace")}),Tm=e.object({id:ln,tenant_id:e.string().min(1),site_id:E,brief_id:Re,questions:Jt,answers:e.array(sn),selected_archetype:xe.optional(),completed_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),E_=e.object({answers:e.array(sn).min(1),questions:Jt,selected_archetype:xe.optional()}),x_=e.object({clarify_session:Tm}),I_=e.object({questions:Jt,selected_archetype:xe}),km=e.object({id:gt,tenant_id:e.string().min(1),site_id:E,version:e.number().int().positive(),design_plan:_a,source_agent_run_id:v.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),R_=e.object({design_plan_id:gt.optional(),design_plan:_a,source_agent_run_id:v.optional()}),T_=e.object({design_plan:km}),dt=e.enum(["initial_generation","iteration"]),Pm=e.object({label:e.string().min(1).max(48),prompt:e.string().min(1).max(160)}).strict(),Am=e.enum(["model","derived","mixed","advisor"]),xa=e.object({suggestions:e.array(Pm).min(1).max(4),source:Am}).strict(),Cm=e.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),Dm=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"]),Ia=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"]),vm=e.object({id:e.string().min(1),title:e.string().min(1),status:e.enum(["pending","running","completed","failed"])}),ge=e.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),on=e.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),rn=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()}),$=e.string().min(1).refine(t=>wa(t),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),cn=e.object({deduped_paths:e.array($),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($)}),mn=e.object({group_id:e.string().min(1),phase:on,title:e.string().min(1),status:ge,task_ids:e.array(e.string().min(1)),depends_on_groups:e.array(e.string().min(1)),target_paths:e.array($)}),Nm=e.enum(["style","media","chrome","section","layout","page"]),pn=e.object({task_id:e.string().min(1),group_id:e.string().min(1),kind:Nm,target_path:$,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(an).optional(),status:ge,required_reads:e.array($).optional()}),dn=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"])}),k_=e.object({plan_id:e.string().min(1),run_kind:dt,model_route:e.object({planner:e.literal("workspace_planner"),worker:e.literal("workspace")}),groups:e.array(mn),tasks:e.array(pn),dependencies:e.array(dn),expected_outputs:e.array($),diagnostics:cn}),P_=e.object({task_id:e.string().min(1),patch:e.unknown().optional(),snapshot_id:_.optional(),read_files:e.array($),diagnostics:e.array(rn),status:ge}),Ra=e.object({worker_count:e.number().int().nonnegative(),task_count:e.number().int().nonnegative(),group_count:e.number().int().nonnegative()}),Ta=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()}),jm=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"]).optional()}),Om=e.object({type:e.literal("reasoning"),text:e.string(),state:e.enum(["streaming","done"]).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),wm=e.object({type:e.literal("file"),mediaType:e.string().min(1),filename:e.string().min(1).optional(),url:e.string().min(1)}),Mm=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()}),Lm=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()}),Um=e.object({type:e.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:e.string().min(1).optional(),data:e.unknown()}),Fm=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()}),Km=e.object({type:e.literal("error"),errorText:e.string().min(1)}),Gm=e.object({type:e.literal("step-start")}),rt=e.union([jm,Om,wm,Mm,Lm,Um,Fm,Km,Gm]),qm=e.string().min(1).max(512).refine(t=>wa(t)&&!/^[A-Za-z]:\//.test(t),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),Bm=e.array(qm).min(1).max(64),zm=e.array(e.string().min(1).max(120)).min(1).max(64),Wm=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:v,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(rt).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(vm),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(aa).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:ba,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:te,sitemap:pt,...ya,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:te,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:dt,groups:e.array(mn),tasks:e.array(pn),dependencies:e.array(dn),expected_outputs:e.array($),diagnostics:cn,summary:Ra,at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.worker.updated"),group_id:e.string().min(1),phase:on,status:ge,task_counts:Ta,target_paths:e.array($),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:ge,target_path:$,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(rn).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:Bm.optional(),degraded_page_ids:zm.optional(),snapshot_id:_.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 s of["degraded_file_paths","degraded_page_ids"])t[s]!==void 0&&n.addIssue({code:"custom",path:[s],message:`${s} 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 s of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])t[s]!==void 0&&n.addIssue({code:"custom",path:[s],message:`${s} is not allowed for generated_code_rescue`})}),e.object({type:e.literal("workspace.design_plan.outcome"),design_plan_outcome:Cm,reason:Dm,at:e.string().min(1)}).strict(),xa.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:_,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("snapshot.finalized"),snapshot_id:_,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:_,at:e.string().min(1)}),e.object({type:e.literal("preview.build.succeeded"),snapshot_id:_,at:e.string().min(1)}),e.object({type:e.literal("preview.build.failed"),snapshot_id:_,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:sa.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:_.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:la,title:e.string().min(1).max(200),detail:e.string().max(360).optional(),title_code:ce.optional(),detail_code:ce.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:ce.optional(),detail_code:ce.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)})]),ka=Wm.superRefine(Ea),Yt=e.object({id:gn,tenant_id:e.string().min(1),site_id:E,agent_run_id:v,sequence:e.number().int().positive(),event_type:Ia,payload:ka,created_at:e.string().min(1)}),A_=e.object({event_type:Ia,payload:ka}).superRefine((t,n)=>{t.event_type!==t.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),Ge(t.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),C_=e.discriminatedUnion("status",[e.object({status:e.literal("appended"),agent_run:me,event:Yt,next_cursor:e.number().int().nonnegative()}),e.object({status:e.literal("duplicate_ignored"),agent_run:me,event:Yt,next_cursor:e.number().int().nonnegative()})]),D_=e.object({events:e.array(Yt),next_cursor:e.number().int().nonnegative().optional()}),v_=e.object({after_sequence:e.coerce.number().int().nonnegative().default(0)}),N_=e.enum(["implemented","skeleton","planned"]),j_=e.enum(["GET","POST","PUT","PATCH","DELETE"]),O_=[{method:"PATCH",path:"/internal/sites/:site_id/snapshots/:snapshot_id/manifest",tag:"snapshots",summary:"Compare-and-set the manifest hash for the active current snapshot after an in-place object replacement.",status:"implemented",request_body_schema:"UpdateCurrentSnapshotManifestRequestSchema",response_schema:"SnapshotRecordSchema",notes:["Internal Agent authentication is required. The update succeeds only when site current_snapshot_id, snapshot status, object key, and expected manifest hash still match."]},{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:"POST",path:"/sites/:site_id/designer/component-library/resources/:resource_id/install",tag:"designer-component-library",summary:"Install one exact component version and return a strict SiteEditEngine materialization.",status:"implemented",request_body_schema:"InstallDesignerComponentBodySchema",response_schema:"InstallDesignerComponentResponseSchema",notes:["The server downloads the resource ZIP with the configured secret, validates main.json identity and compatibility, and returns only the strict materialization plus immutable revision metadata."]},{method:"GET",path:"/sites/:site_id/designer/page-library/categories",tag:"designer-page-library",summary:"List the fixed insert-new-page category tree for a site.",status:"implemented",response_schema:"ListDesignerPageCategoriesResponseSchema",notes:["The server validates site ownership and fixes category_group_key to insertNewPage."]},{method:"GET",path:"/sites/:site_id/designer/page-library/resources",tag:"designer-page-library",summary:"List page and pages resources from the fixed designer catalog.",status:"implemented",query_schema:"ListDesignerPagesQuerySchema",response_schema:"ListDesignerPagesResponseSchema",notes:["The server fixes resource types to page and pages and does not expose resource-platform credentials or internal routing."]},{method:"POST",path:"/sites/:site_id/designer/page-library/resources/:resource_id/prepare",tag:"designer-page-library",summary:"Resolve one exact page resource version for designer-side draft configuration.",status:"implemented",request_body_schema:"PrepareDesignerPageBodySchema",response_schema:"PrepareDesignerPageResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-library/resources/:resource_id/install",tag:"designer-page-library",summary:"Install one exact page resource version and return a strict PageResourceArtifact.",status:"implemented",request_body_schema:"InstallDesignerPageBodySchema",response_schema:"InstallDesignerPageResponseSchema",notes:["The server validates the explicit resource type, immutable package identity, page selections, materializations, and package-local references."]},{method:"GET",path:"/sites/:site_id/designer/pages",tag:"designer-page-library",summary:"List designer pages from the stable first-phase fixture source.",status:"implemented",response_schema:"ListDesignerSitePagesResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-resources/enhance",tag:"designer-page-library",summary:"Echo a designer page-resource candidate without model execution or normalization.",status:"implemented",request_body_schema:"EnhanceDesignerPageResourceBodySchema",response_schema:"EnhanceDesignerPageResourceResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-resources/compose",tag:"designer-page-library",summary:"Compose exact page and component resources into one strict page artifact.",status:"implemented",request_body_schema:"ComposeDesignerPageResourceBodySchema",response_schema:"InstallDesignerPageResponseSchema",notes:["The server installs every immutable source, validates ordered page blocks, scopes component materializations, and returns one artifact without exposing resource-platform credentials."]},{method:"POST",path:"/sites/:site_id/designer/page-resources/blank",tag:"designer-page-library",summary:"Create the deterministic built-in blank page artifact for one configured route.",status:"implemented",request_body_schema:"InstallDesignerPageBodySchema",response_schema:"InstallDesignerPageResponseSchema"},{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",request_body_schema:"PromoteSiteSnapshotRequestSchema",response_schema:"PromoteSiteSnapshotResponseSchema"},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/lock/try-acquire",tag:"snapshots",summary:"Try to acquire the short-lived template-upgrade site lock.",status:"implemented",request_body_schema:"TryAcquireTemplateUpgradeLockRequestSchema",response_schema:"TryAcquireTemplateUpgradeLockResponseSchema",notes:["Internal agent-only endpoint; lock contention returns acquired=false instead of a user-facing conflict."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/lock/release",tag:"snapshots",summary:"Release the calling template-upgrade attempt's site lock.",status:"implemented",request_body_schema:"ReleaseTemplateUpgradeLockRequestSchema",response_schema:"ReleaseTemplateUpgradeLockResponseSchema",notes:["Internal agent-only endpoint; release is scoped by tenant, site, operation type, and owner."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/snapshots/:snapshot_id/promote",tag:"snapshots",summary:"CAS-promote a validated template-upgrade candidate and bind its accepted commit atomically.",status:"implemented",request_body_schema:"PromoteTemplateUpgradeSnapshotRequestSchema",response_schema:"PromoteTemplateUpgradeSnapshotResponseSchema",notes:["Internal agent-only endpoint; accepted_commit is never part of the public promote request or response."]},{method:"GET",path:"/internal/sites/:site_id/template-upgrade/state",tag:"snapshots",summary:"Inspect the projected tenant-scoped template-upgrade state without mutation.",status:"implemented",query_schema:"InspectTemplateUpgradeStateRequestSchema",response_schema:"InspectTemplateUpgradeStateResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and the repository path is read-only."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/prepare",tag:"snapshots",summary:"Prepare the tenant-scoped template-upgrade retry state for a target version.",status:"implemented",request_body_schema:"PrepareTemplateUpgradeStateRequestSchema",response_schema:"PrepareTemplateUpgradeStateResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and is never accepted in the request body."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/failure",tag:"snapshots",summary:"Record a finite validation failure for the prepared template-upgrade target.",status:"implemented",request_body_schema:"RecordTemplateUpgradeFailureRequestSchema",response_schema:"RecordTemplateUpgradeFailureResponseSchema",notes:["Internal agent-only endpoint; accepts a finite error code and never raw validation output."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/success",tag:"snapshots",summary:"Reset retry state after the prepared template-upgrade target succeeds.",status:"implemented",request_body_schema:"RecordTemplateUpgradeSuccessRequestSchema",response_schema:"RecordTemplateUpgradeSuccessResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and is never accepted in the request body."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/events",tag:"snapshots",summary:"Record one bounded template-upgrade observability event.",status:"implemented",request_body_schema:"RecordTemplateUpgradeEventRequestSchema",response_schema:"RecordTemplateUpgradeEventResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and the strict request excludes raw errors, source content, and file paths."]},{method:"GET",path:"/internal/template-upgrades/report",tag:"snapshots",summary:"Read tenant-scoped template-upgrade outcome, state, and duration aggregates.",status:"implemented",query_schema:"GetTemplateUpgradeReportQuerySchema",response_schema:"GetTemplateUpgradeReportResponseSchema",notes:["Internal endpoint; tenant identity is derived from trusted request context and all aggregates are tenant-scoped."]},{method:"GET",path:"/internal/template-upgrades/snapshot-deletions/pending",tag:"snapshots",summary:"List tenant-scoped stale template-upgrade snapshot deletions for dry-run or reconciliation.",status:"implemented",query_schema:"ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema",response_schema:"ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema",notes:["Defaults to retrying deleting tombstones. Including candidate snapshots is an explicit maintenance action and should use a conservative age threshold."]},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/abandon",tag:"snapshots",summary:"Mark an unpromoted candidate snapshot as failed.",status:"implemented",response_schema:"AbandonSiteSnapshotResponseSchema"},{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:"Prepare two-phase deletion of a candidate snapshot and return its object key; refuses non-candidate/current/referenced snapshots.",status:"implemented",response_schema:"DeleteSiteSnapshotResponseSchema",notes:["Internal Agent authentication is required. This endpoint only creates a deleting tombstone; object removal and completion are separate steps."]},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/deletion/complete",tag:"snapshots",summary:"Complete deletion after the snapshot object has been removed; only accepts deleting snapshots.",status:"implemented",response_schema:"CompleteSiteSnapshotDeletionResponseSchema",notes:["Internal Agent authentication is required; callers must remove the object before completing the DB deletion."]},{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:"POST",path:"/v1/agent/workspace/:site_id/form-design-operations",tag:"agent/workspace",summary:"Create or replay a deterministic FORM_SPEC save operation.",status:"implemented",request_body_schema:"FormDesignSaveRequestSchema",response_schema:"FormDesignOperationResponseSchema"},{method:"GET",path:"/v1/agent/workspace/:site_id/form-design-operations/:operation_id",tag:"agent/workspace",summary:"Read a persisted FORM_SPEC save operation.",status:"implemented",response_schema:"FormDesignOperationResponseSchema"},{method:"POST",path:"/v1/agent/workspace/:site_id/form-design-operations/:operation_id/resume",tag:"agent/workspace",summary:"Resume a recoverable FORM_SPEC save with its original fingerprint.",status:"implemented",request_body_schema:"FormDesignResumeRequestSchema",response_schema:"FormDesignOperationResponseSchema"},{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; optional expected_current_snapshot_id enables current-snapshot CAS.",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"}],w_=[{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"]}],Vm=e.object({id:e.string().min(1),role:e.enum(["system","user","assistant"]),metadata:e.unknown().optional(),parts:e.array(rt).min(1)}),Pa=Vm.extend({role:e.literal("user")}),M_=e.object({base_snapshot_id:_.optional(),message:Pa.optional(),client_run_key:e.string().min(1).max(200).optional()}).superRefine((t,n)=>{Ge(t.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),Hm=e.object({path:e.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:v,base_snapshot_id:_,run_kind:dt}),L_=e.object({agent_run:me,websocket:Hm,next_step:e.literal("workspace_socket")}),U_=e.object({agent_run:me}),F_=e.object({agent_type:e.enum(["clarify","sitemap","workspace"])}),K_=e.object({agent_run:me}),G_=e.enum(["client.message.create","client.resource.operation.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"]),D=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:E,run_id:v.optional(),correlation_id:e.string().min(1).optional(),seq:e.number().int().positive().optional(),sent_at:e.string().min(1)}),$m=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()}),Ym=e.discriminatedUnion("type",[D.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:$m.optional(),message:Pa,base_snapshot_id:_.optional()})}),D.extend({type:e.literal("client.run.cancel"),payload:e.object({run_id:v,reason:e.string().min(1).optional()})}),D.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()})}),pi]),Zm=e.discriminatedUnion("type",[D.extend({type:e.literal("server.run.started"),payload:e.object({run_id:v,agent_type:e.literal("workspace")})}),D.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(rt).min(1),in_reply_to_tool_call_id:e.string().min(1).optional()})}),D.extend({type:e.literal("server.assistant.delta"),payload:e.object({message_id:e.string().min(1),parts:e.array(rt).min(1),status:e.enum(["streaming","ready"])})}),D.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)})}),D.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)})}),D.extend({type:e.literal("server.workspace.suggestions"),payload:xa.extend({run_id:v}).strict()}),D.extend({type:e.literal("workspace.plan.created"),payload:e.object({plan_id:e.string().min(1),run_kind:dt,groups:e.array(mn),tasks:e.array(pn),dependencies:e.array(dn),expected_outputs:e.array($),diagnostics:cn,summary:Ra})}),D.extend({type:e.literal("workspace.worker.updated"),payload:e.object({group_id:e.string().min(1),phase:on,status:ge,task_counts:Ta,target_paths:e.array($),diagnostics:e.array(e.string().min(1))})}),D.extend({type:e.literal("workspace.task.updated"),payload:e.object({task_id:e.string().min(1),group_id:e.string().min(1),status:ge,target_path:$,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(rn).optional()})}),D.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()})}),D.extend({type:e.literal("server.sitemap.updated"),payload:e.object({sitemap_id:te,version:e.number().int().positive(),reason:e.string().min(1)})}),D.extend({type:e.literal("server.snapshot.created"),payload:e.object({snapshot_id:_,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/)})}),D.extend({type:e.literal("server.snapshot.finalized"),payload:e.object({snapshot_id:_})}),D.extend({type:e.literal("server.preview.invalidated"),payload:e.object({reason:e.string().min(1),next_preview_url:e.string().url().optional()})}),D.extend({type:e.literal("preview.build.started"),payload:e.object({snapshot_id:_})}),D.extend({type:e.literal("preview.build.succeeded"),payload:e.object({snapshot_id:_})}),D.extend({type:e.literal("preview.build.failed"),payload:e.object({snapshot_id:_,message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean()})}),D.extend({type:e.literal("server.run.finished"),payload:e.object({run_id:v,snapshot_id:_})}),D.extend({type:e.literal("server.run.failed"),payload:e.object({run_id:v,error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),outcome:e.literal("retained_previous").optional()})}),D.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})}),D.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:la,title:e.string().min(1).max(200),title_code:ce.optional(),detail:e.string().max(360).optional(),detail_code:ce.optional(),locks_input:e.boolean()})}),D.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:ce.optional(),detail:e.string().max(360).optional(),detail_code:ce.optional()})}),D.extend({type:e.literal("server.activity.finished"),payload:e.object({activity_id:e.string().min(1)})}),D.extend({type:e.literal("server.activity.failed"),payload:e.object({activity_id:e.string().min(1),detail:e.string().max(360).optional()})})]),q_=e.union([Ym,Zm]),B_={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."]},Aa=e.string().regex(/^sha256:[a-f0-9]{64}$/),Xm=e.enum(["create","update","delete","str_replace"]),Ca=e.enum(["sitemap_resync","smoke_test","prepare_preview"]),Qm=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(),Jm=e.object({path:$,operation:Xm,expected_hash:Aa.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(Qm).min(1).max(20).optional()}).strict().superRefine((t,n)=>{let i=t.full_content!==void 0;if(t.operation==="delete"){i&&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(dp(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}i||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"})}),ep=e.object({kind:e.enum(["block","page","site","chrome"]),id:e.string().min(1).max(120)}),tp=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:ep,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)}),Da=e.object({site_id:E,base_snapshot_id:_,reason:e.string().min(1),patches:e.array(Jm).min(1),media_requests:e.array(tp).max(24).optional(),post_actions:e.array(Ca).optional()});function va(t,n){let i=new Set;for(let[s,r]of t.patches.entries())i.has(r.path)&&n.addIssue({code:"custom",path:["patches",s,"path"],message:`Duplicate patch path: ${r.path}`}),i.add(r.path)}var z_=Da.superRefine(va),W_=Da.omit({base_snapshot_id:!0}).extend({site_id:E.optional()}).superRefine(va),np=W,ip=e.object({path:np,operation:e.enum(["upsert","delete"]).optional()}),Na=e.enum(["sync_cms_pages","sync_cms_navigation"]),V_=e.object({files:e.array(ip).min(1),post_actions:e.array(Na).optional()}).strict().overwrite(t=>t.post_actions?{...t,post_actions:[...new Set(t.post_actions)]}:t),ap=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"]),sp=e.object({status:e.literal("applied"),patch_batch_id:e.string().min(1),site_id:E,base_snapshot_id:_,snapshot_id:_,manifest_hash:Aa,object_key:e.string().min(1),changed_files:e.array($).min(1),post_actions_queued:e.array(Ca),dropped_protected_files:e.array(e.string().min(1)).min(1).optional()}),op=e.object({status:e.literal("failed"),code:ap,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),H_=e.discriminatedUnion("status",[sp,op]),$_=e.object({ok:e.literal(!0),post_actions:e.array(e.object({action:Na,status:e.enum(["succeeded","failed"])}).strict()).default([])}),ja=W,rp=e.enum(["text","binary"]),Oa=e.object({path:ja,kind:rp,language:e.string().min(1).nullable(),size_bytes:e.number().int().nonnegative()}),Y_=e.object({path:ja}),cp=Oa.extend({kind:e.literal("text"),language:e.string().min(1),content:e.string()}),mp=Oa.extend({kind:e.literal("binary"),language:e.null(),mime_type:e.string().min(1),content_base64:e.string().min(1)}),Z_=e.union([cp,mp]);function Ge(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=>Ge(n)):Object.entries(t).some(([n,i])=>pp(n)||Ge(i))}function pp(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 wa(t){let n=t.split("/");return t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&n.every(i=>i!==""&&i!=="."&&i!=="..")}function dp(t){let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(t);if(!n)return!0;let s=(n[1]??"").split("/").filter(m=>m.length>0);return s.some(m=>m.startsWith("_"))?!0:s.filter(m=>!m.startsWith("@")&&!/^\(.+\)$/.test(m)).map(m=>m.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(m=>m.length>0).every(m=>/^\[.*\]$/.test(m)||Ce.test(`/${m}`))}var Ma=e.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),lp=e.object({id:qe,tenant_id:e.string().min(1),site_id:E,sandbox_id:e.string().min(1).nullable(),status:Ma,source_snapshot_id:_.nullable(),last_snapshot_id:_.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)}),X_=e.object({session_id:qe.optional(),sandbox_id:e.string().min(1).optional(),source_snapshot_id:_.optional(),last_snapshot_id:_,expected_current_snapshot_id:_.optional(),expected_ready_session_id:qe.optional(),status:Ma,preview_url:e.string().url().optional()}),Q_=e.object({preview_session:lp,next_step:e.literal("preview")}),J_=e.object({failed_count:e.number().int().nonnegative()}),eS=e.object({site_id:E}),tS=e.object({status:e.enum(["cancelled","no_active_run"]),agent_run:me.nullable()});export{jh as AbandonSiteSnapshotResponseSchema,la as ActivityKindSchema,ce as ActivityTitleCodeSchema,sa as AgentErrorCategorySchema,gn as AgentEventIdSchema,Yt as AgentEventRecordSchema,ka as AgentEventSchema,Ia as AgentEventTypeSchema,ca as AgentModelRouteSchema,vm as AgentPlanStepSchema,v as AgentRunIdSchema,ra as AgentRunKindSchema,me as AgentRunRecordSchema,Kc as AgentRunStatusSchema,oa as AgentRunTypeSchema,Um as AiSdkUiDataPartSchema,Km as AiSdkUiErrorPartSchema,wm as AiSdkUiFilePartSchema,rt as AiSdkUiMessagePartSchema,Vm as AiSdkUiMessageSchema,Om as AiSdkUiReasoningPartSchema,Lm as AiSdkUiSourceDocumentPartSchema,Mm as AiSdkUiSourceUrlPartSchema,Gm as AiSdkUiStepStartPartSchema,jm as AiSdkUiTextPartSchema,Fm as AiSdkUiToolPartSchema,N_ as ApiContractStatusSchema,Wc as ApiErrorEnvelopeSchema,B as ApiResponseSchema,A_ as AppendAgentEventRequestSchema,C_ as AppendAgentEventResponseSchema,ap as ApplyPatchBatchErrorCodeSchema,op as ApplyPatchBatchFailureSchema,z_ as ApplyPatchBatchInputSchema,Jm as ApplyPatchBatchPatchSchema,Ca as ApplyPatchBatchPostActionSchema,H_ as ApplyPatchBatchResultSchema,sp as ApplyPatchBatchSuccessSchema,W_ as ApplyPatchBatchToolInputSchema,Qm as ApplyPatchEditSchema,Xm as ApplyPatchOperationSchema,aa as ArchetypeProposalSchema,kp as AuditLogIdSchema,gp as AuthIdentityIdSchema,fp as AuthLoginCodeIdSchema,Sp as AuthOidcStateIdSchema,hp as AuthSessionIdSchema,_p as AuthTokenIdSchema,bp as AuthWsTicketIdSchema,oc as BINDING_STATUSES,Wi as BindSiteDomainDataSchema,Ag as BindSiteDomainRequestSchema,bh as BindSiteDomainResponseSchema,ua as BlockGenerationContextSchema,o_ as BlockMediaIntentSchema,om as BlockSchema,ga as BrandingSchema,Re as BriefIdSchema,tn as BriefRecordSchema,hu as CHAT_COPY,gu as CLARIFICATION_COPY,Br as CMS_FORM_FIELD_TYPES,hl as COMPONENT_I18N_FILE_SUFFIX,Ze as COMPONENT_I18N_NAMESPACE,Ii as CURRENT_EDIT_ENGINE_VERSION,Pg as CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED_ERROR_CODE,pc as CUSTOM_DOMAIN_STATUSES,eS as CancelActiveWorkspaceRunRequestSchema,tS as CancelActiveWorkspaceRunResponseSchema,ha as ChromeDesignSchema,am as ChromeFooterDesignSchema,im as ChromeFooterShellSchema,tm as ChromeHeaderDesignSchema,em as ChromeHeaderShellSchema,sm as ChromeMobileNavDesignSchema,Oc as ClarifyQuestionOptionSchema,wc as ClarifyQuestionSchema,vc as ClarifyQuestionTypeSchema,Jt as ClarifyQuestionsSchema,$g as ClarifyRunInputSchema,ln as ClarifySessionIdSchema,Tm as ClarifySessionRecordSchema,Yg as ClarifyStreamEventSchema,Pp as CmsCollectionBindingIdSchema,yg as CmsCollectionBindingSchema,wi as CmsFormSchemaProjectionSchema,wh as CompleteSiteSnapshotDeletionResponseSchema,Sl as ComponentI18nResourcesSchema,Td as ComposeDesignerPageResourceBodySchema,zu as ConnectDynamicCollectionInputSchema,Hu as ConnectFormInputSchema,Xt as ConversionHintsSchema,a_ as CreateAgentRunConflictResponseSchema,Ph as CreateAgentRunRequestSchema,Ah as CreateAgentRunResponseSchema,Zh as CreateDeploymentRequestSchema,Xh as CreateDeploymentResponseSchema,Up as CreateDocumentUploadRequestSchema,zp as CreateImageUploadRequestSchema,jp as CreateInputSourceRequestSchema,nh as CreateSiteBriefRequestSchema,Rh as CreateSiteBriefResponseSchema,ih as CreateSiteDraftRequestSchema,th as CreateSiteInputSchema,Ba as CreateTextInputSourceRequestSchema,za as CreateUrlInputSourceRequestSchema,Qh as CurrentDeploymentResponseSchema,lc as CustomDomainDnsRecordPurposeSchema,gc as CustomDomainDnsRecordSchema,uc as CustomDomainDnsRecordStatusSchema,dc as CustomDomainStatusSchema,_c as DEFAULT_FONTS,us as DEFAULT_SITE_LOCALE,Yh as DEPLOYMENT_ENTITLEMENT_REQUIRED_ERROR_CODE,zc as DEPLOYMENT_REALTIME_CHANNEL,hn as DEPLOYMENT_STATUSES,i_ as DEPLOYMENT_WEBSOCKET_CONTRACT,ld as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,Ed as DESIGNER_PAGE_LIBRARY_ERROR_CODES,Op as DOCUMENT_EXTENSION_WHITELIST,wp as DOCUMENT_MIME_WHITELIST,hc as DefaultPublishDomainSchema,$i as DeleteSiteDomainDataSchema,xh as DeleteSiteDomainResponseSchema,Oh as DeleteSiteSnapshotResponseSchema,Te as DeploymentIdSchema,yp as DeploymentJobIdSchema,mt as DeploymentRecordSchema,n_ as DeploymentRedisPubSubEventSchema,nn as DeploymentStatusSchema,ea as DeploymentStatusSummarySchema,t_ as DeploymentWsServerMessageSchema,Bc as DeploymentWsServerMessageTypeSchema,Cm as DesignPlanGenerationOutcomeSchema,Dm as DesignPlanGenerationReasonSchema,gt as DesignPlanIdSchema,m_ as DesignPlanPatchSchema,km as DesignPlanRecordSchema,_a as DesignPlanSchema,s_ as DesignTokensSchema,Rs as DesignerComponentCatalogItemSchema,Dn as DesignerComponentCategoriesDataSchema,Cn as DesignerComponentCategoryNodeSchema,de as DesignerComponentExactVersionSchema,Nn as DesignerComponentInstallDataSchema,vn as DesignerComponentsDataSchema,Ps as DesignerPageCatalogItemSchema,wn as DesignerPageCategoriesDataSchema,On as DesignerPageCategoryNodeSchema,Ae as DesignerPageExactVersionSchema,Ln as DesignerPageInstallDataSchema,Fn as DesignerPageResourcePreparationDataSchema,ks as DesignerPageResourceSourceSchema,ws as DesignerPageResourceTemplateSchema,le as DesignerPageResourceTypeSchema,Mn as DesignerPagesDataSchema,Ms as DesignerSitePageSchema,Kn as DesignerSitePagesDataSchema,As as DesignerSiteRouteIdSchema,Su as EDIT_ENGINE_VERSION_HEADER,fu as EDIT_ENGINE_VERSION_SOURCE_HEADER,lu as ERROR_COPY,Lt as EditEngineVersionParseError,Gn as EnhanceDesignerPageResourceBodySchema,_h as EnhanceDesignerPageResourceResponseSchema,rh as ExternalSyncSiteRequestSchema,Sh as ExternalSyncSiteResponseSchema,Ka as ExtractedFactKindSchema,Be as ExtractedFactSchema,Rr as FIELD_TYPES,kc as FONT_PAIRINGS,tc as FORM_DESIGN_ERROR_CODES,ec as FORM_DESIGN_FAILURE_STAGES,Qr as FORM_DESIGN_OPERATION_STAGES,Jr as FORM_DESIGN_OPERATION_STATUSES,Me as FORM_FIELD_TYPES,zr as FORM_SPEC_FIELD_TYPE_TO_CMS,Pi as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,Kr as FORM_TEMPLATE_CATEGORY_COUNTS,ji as FORM_TEMPLATE_CATEGORY_SLUGS,J_ as FailStaleInFlightWorkspaceRunsResponseSchema,ki as FieldDeclSchema,nm as FooterShellSurfaceSchema,Pr as FormBlockIdSchema,it as FormDefinitionIdSchema,Yr as FormDesignAffectedFilesSchema,Wt as FormDesignErrorCodeSchema,lg as FormDesignErrorSchema,Ui as FormDesignFailureStageSchema,O as FormDesignHashSchema,sg as FormDesignOpenResponseSchema,Zr as FormDesignOperationFingerprintInputSchema,Ft as FormDesignOperationIdSchema,Fi as FormDesignOperationNextActionSchema,xp as FormDesignOperationRecordIdSchema,pg as FormDesignOperationRecordSchema,Vt as FormDesignOperationResponseSchema,Gi as FormDesignOperationSchema,zt as FormDesignOperationStageSchema,Li as FormDesignOperationStatusSchema,dg as FormDesignOperationTransitionRequestSchema,Ki as FormDesignPreviewRefreshStatusSchema,rg as FormDesignQueryResponseSchema,cg as FormDesignResumeRequestSchema,mg as FormDesignResumeResponseSchema,Xr as FormDesignSaveRequestSchema,og as FormDesignSaveResponseSchema,Mi as FormDesignSharedImpactSchema,Bt as FormDesignStandardizationSchema,Tr as FormFieldDeclSchema,Ue as FormFieldNameSchema,Kt as FormOptionValueSchema,Ar as FormSpecBindingSchema,Dr as FormSpecFieldNodeSchema,Nr as FormSpecNodeSchema,Cr as FormSpecOptionSchema,vr as FormSpecStepBreakNodeSchema,qt as FormSpecV1Schema,ng as FormTemplateCatalogResponseSchema,Oi as FormTemplateCategorySlugSchema,Gr as FormTemplateCategoryV1Schema,re as FormTemplateTextSchema,qr as FormTemplateV1Schema,Jh as GetDeploymentResponseSchema,e_ as GetDeploymentsStatusResponseSchema,Hi as GetSiteDomainDetailDataSchema,Eh as GetSiteDomainDetailResponseSchema,Bi as GetSitePlanDataSchema,Ih as GetSitePlanResponseSchema,Lu as GetTemplateUpgradeReportQuerySchema,Uu as GetTemplateUpgradeReportResponseSchema,Qc as HeaderShellBehaviorSchema,Jc as HeaderShellShapeSchema,Xc as HeaderShellSurfaceSchema,Zc as HeaderShellVariantSchema,Kp as IMAGE_EXTENSION_WHITELIST,Gp as IMAGE_MIME_WHITELIST,An as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,jn as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,gs as ISO_639_3_TO_SITE_LOCALE,Wa as ImageRoleSchema,Pa as InboundUserMessageSchema,Fa as InputBundleStatusSchema,We as InputConflictSchema,Wp as InputContextBundleSchema,ke as InputContextSourceIdSchema,qa as InputSourceSchema,_t as InputSourceStatusSchema,ht as InputSourceTypeSchema,Tu as InspectTemplateUpgradeStateRequestSchema,ku as InspectTemplateUpgradeStateResponseSchema,_d as InstallDesignerComponentBodySchema,ph as InstallDesignerComponentResponseSchema,Id as InstallDesignerPageBodySchema,uh as InstallDesignerPageResponseSchema,C as InternalEntityIdSchema,cs as LEGACY_SITE_LOCALE_CODES,F_ as LatestAgentRunQuerySchema,K_ as LatestAgentRunResponseSchema,U_ as LatestWorkspaceRunResponseSchema,v_ as ListAgentEventsQuerySchema,D_ as ListAgentEventsResponseSchema,ch as ListDesignerComponentCategoriesResponseSchema,hd as ListDesignerComponentsQuerySchema,mh as ListDesignerComponentsResponseSchema,dh as ListDesignerPageCategoriesResponseSchema,xd as ListDesignerPagesQuerySchema,lh as ListDesignerPagesResponseSchema,hh as ListDesignerSitePagesResponseSchema,zi as ListSiteDomainsDataSchema,fh as ListSiteDomainsResponseSchema,Wh as ListSiteVersionsResponseSchema,Fu as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,Ku as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,Lp as MAX_DOCUMENT_SOURCES_PER_SITE,Mp as MAX_DOCUMENT_UPLOAD_BYTES,Bp as MAX_IMAGE_SOURCES_PER_SITE,qp as MAX_IMAGE_UPLOAD_BYTES,c_ as MediaAssetSchema,$c as MediaAttributionSchema,ep as MediaRequestOwnerSchema,Tp as MediaResolutionCacheIdSchema,gd as MockDesignerComponentInsertDataSchema,ud as MockDesignerComponentInsertRequestSchema,Qt as MotionLevelSchema,yc as NEXT_FONT_DISPLAY_NAMES,Ke as NEXT_FONT_REGISTRY,Ce as PAGE_SLUG_PATTERN,he as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,Rt as PageResourceArtifactSchema,Ns as PageResourceComponentReferenceSchema,js as PageResourceComponentSchema,Ds as PageResourceDraftPageSchema,vs as PageResourceDraftSchema,He as PageResourceFinalRouteSchema,Os as PageResourcePageSchema,Cs as PageResourcePageSelectionSchema,Un as PageResourceRouteMappingSchema,Sa as PageSchema,rm as PageSlugSchema,E_ as PersistClarifyAnswersRequestSchema,x_ as PersistClarifyAnswersResponseSchema,X_ as PersistPreviewSessionRequestSchema,Q_ as PersistPreviewSessionResponseSchema,R_ as PersistSiteDesignPlanRequestSchema,T_ as PersistSiteDesignPlanResponseSchema,b_ as PersistSiteSitemapRequestSchema,y_ as PersistSiteSitemapResponseSchema,Ch as PersistSiteSnapshotRequestSchema,Dh as PersistSiteSnapshotResponseSchema,Dc as PositioningPrefillSchema,$t as PositioningSourceSchema,Rd as PrepareDesignerPageBodySchema,gh as PrepareDesignerPageResponseSchema,Ru as PrepareTemplateUpgradeStateRequestSchema,Sr as PrepareTemplateUpgradeStateResponseSchema,Hh as PrepareVersionPreviewRequestSchema,$h as PrepareVersionPreviewResponseSchema,Nh as PromoteSiteSnapshotRequestSchema,Gc as PromoteSiteSnapshotResponseSchema,Bh as PromoteTemplateUpgradeSnapshotRequestSchema,zh as PromoteTemplateUpgradeSnapshotResponseSchema,mc as PublishEntitlementSchema,rc as PublishPlanFeatureSnapshotSchema,cc as PublishPlanSchema,uu as REFUSAL_COPY,O_ as REST_API_ENDPOINTS,Mh as RecordSnapshotVersionRequestSchema,Lh as RecordSnapshotVersionResponseSchema,wu as RecordTemplateUpgradeEventRequestSchema,Mu as RecordTemplateUpgradeEventResponseSchema,Pu as RecordTemplateUpgradeFailureRequestSchema,Au as RecordTemplateUpgradeFailureResponseSchema,Cu as RecordTemplateUpgradeSuccessRequestSchema,Du as RecordTemplateUpgradeSuccessResponseSchema,Ga as ReferencePagePatternSchema,ze as ReferenceSignalsSchema,Kh as ReleaseTemplateUpgradeLockRequestSchema,Gh as ReleaseTemplateUpgradeLockResponseSchema,Bu as ResolvedFieldSchema,$u as ResolvedFormFieldSchema,j_ as RestApiMethodSchema,Vh as RestoreSiteSnapshotResponseSchema,da as RouteGenerationCardSchema,Pe as SELECTABLE_SITE_LOCALE_CODES,Al as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,Ss as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,Et as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,xt as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,Qn as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,$d as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,ar as SITE_EDIT_RUNTIME_CONTAINER_TAGS,sr as SITE_EDIT_RUNTIME_TEXT_TAGS,ir as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,Kd as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,Ha as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,_n as SITE_EDIT_SOURCE_ALLOWED_DIRS,Va as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,St as SITE_EDIT_SOURCE_DELETE_CAPABILITY,$a as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,ms as SITE_LOCALE_CODES,Jg as SITE_PLANNING_FROZEN_ERROR_CODE,eh as SITE_PLANNING_LOCKED_ERROR_CODE,w_ as SSE_STREAMS,td as SUPPORTED_SITE_LOCALES,qe as SandboxSessionIdSchema,lp as SandboxSessionSchema,Ma as SandboxSessionStatusSchema,oh as SaveBriefDraftRequestSchema,kh as SaveBriefDraftResponseSchema,Fe as SiteCustomDomainSchema,pa as SiteDesignContextSchema,Nc as SiteDesignDensitySchema,jc as SiteDesignMotionLevelSchema,Je as SiteEditBoundaryKindSchema,Do as SiteEditCapabilityConstraintSchema,Ao as SiteEditCapabilityModeSchema,Qe as SiteEditCapabilityModeViewSchema,Gs as SiteEditClassNameSourceDiagnosticSchema,ue as SiteEditClassNameSourceRangeSchema,Hn as SiteEditClassNameSourceSchema,jd as SiteEditClassNameSourceStyleContextSchema,Vn as SiteEditClassNameSourceStylesheetSchema,kt as SiteEditClassNameSourceWriteIntentSchema,Cd as SiteEditCommandDiagnosticSchema,Fs as SiteEditCommandErrorSchema,Co as SiteEditConstraintKindSchema,$o as SiteEditDynamicConfidenceSchema,Zo as SiteEditDynamicDataBindingSchema,Si as SiteEditDynamicDataDetailSchema,fi as SiteEditDynamicDataSummarySchema,Yo as SiteEditDynamicEvidenceSchema,_i as SiteEditDynamicSourceKindSchema,Vo as SiteEditDynamicSourceTypeSchema,Ho as SiteEditDynamicTargetKindSchema,Jo as SiteEditEffectiveWriteTargetSchema,Pt as SiteEditElementPropertySchema,Tl as SiteEditEventSchema,jt as SiteEditExternalSourceKindSchema,wd as SiteEditGetClassNameSourceCommandResultSchema,Od as SiteEditGetClassNameSourceResultSchema,wo as SiteEditHistoryReadOnlyRecoveryStatusSchema,vo as SiteEditHistoryRecoveryCodeSchema,No as SiteEditHistoryRecoveryDiagnosticSchema,Cl as SiteEditHistoryStatusModeSchema,Dl as SiteEditHistoryStatusSchema,jo as SiteEditHistoryUnavailableReasonSchema,Mo as SiteEditHistoryUnavailableStatusSchema,Oo as SiteEditHistoryWritableStatusSchema,pu as SiteEditInitializeSessionInputSchema,_o as SiteEditInsertNodeSpecSchema,fo as SiteEditInsertPageResourceOutputSchema,Is as SiteEditMaterializationDataRequirementsSchema,xs as SiteEditMaterializationEntrySchema,Es as SiteEditMaterializationExportSchema,ys as SiteEditMaterializationFileSchema,Pn as SiteEditMaterializationPathTemplateSchema,pe as SiteEditMaterializationSchema,ti as SiteEditMoveTargetSchema,De as SiteEditMutationContextSchema,et as SiteEditNodeCapabilitySnapshotSchema,Ql as SiteEditObjectCapabilitiesSchema,eu as SiteEditObjectDetailSchema,nu as SiteEditObjectEditContextSchema,iu as SiteEditObjectStyleDetailSchema,tu as SiteEditObjectSummarySchema,cl as SiteEditOperationCommandResultSchema,oi as SiteEditOperationErrorCodeSchema,ri as SiteEditOperationErrorSchema,bo as SiteEditOperationOutputSchema,So as SiteEditOperationParamsSchema,vt as SiteEditOperationPayloadSchema,Dt as SiteEditOperationRequestSchema,ci as SiteEditOperationSelectionRefSchema,Wo as SiteEditOperationSummarySchema,ni as SiteEditOperationTargetSchema,je as SiteEditOperationTypeSchema,ei as SiteEditOperationValueSchema,Yd as SiteEditPageCompositionAnyVersionSchema,Js as SiteEditPageCompositionAtomicKindSchema,io as SiteEditPageCompositionBoundaryModeSchema,Vs as SiteEditPageCompositionBusinessMemberSchema,zs as SiteEditPageCompositionContainerSchema,Ne as SiteEditPageCompositionDiagnosticSchema,Ye as SiteEditPageCompositionErrorCodeSchema,Zn as SiteEditPageCompositionPlacementTargetSchema,Hs as SiteEditPageCompositionPlacementUnitSchema,Xs as SiteEditPageCompositionRuntimeRefSchema,Zs as SiteEditPageCompositionSchema,Qs as SiteEditPageCompositionSourceMemberKindSchema,Ws as SiteEditPageCompositionSourceMemberSchema,Jn as SiteEditPageCompositionSourceRangeSchema,$s as SiteEditPageCompositionSupportedSchema,Ys as SiteEditPageCompositionUnsupportedSchema,no as SiteEditPageCompositionV2BusinessMemberSchema,eo as SiteEditPageCompositionV2ContainerSchema,so as SiteEditPageCompositionV2PlacementRelationSchema,ro as SiteEditPageCompositionV2PlacementSchema,ao as SiteEditPageCompositionV2PlacementUnitSchema,lo as SiteEditPageCompositionV2Schema,to as SiteEditPageCompositionV2SourceMemberSchema,mo as SiteEditPageCompositionV2SupportedSchema,po as SiteEditPageCompositionV2UnsupportedSchema,oo as SiteEditPageCompositionV2WriteModeSchema,co as SiteEditPageCompositionVisualAnchorSchema,Yn as SiteEditPagePlacementOptionSchema,Ct as SiteEditPagePlacementSchema,Xn as SiteEditPageUnitTargetSchema,Fo as SiteEditPatchPlanPatchSchema,Ol as SiteEditPatchPlanSchema,we as SiteEditProvenanceChainSchema,er as SiteEditProvenanceHopSchema,Xl as SiteEditRenderDocumentSchema,Oe as SiteEditRenderEntryRefSchema,Xo as SiteEditRenderEntrySchema,hi as SiteEditRenderPageCompositionSchema,Bo as SiteEditRenderPageCompositionSupportedSchema,zo as SiteEditRenderPageCompositionUnsupportedSchema,qo as SiteEditRenderPagePlacementSchema,Gd as SiteEditRequiredMutationContextEnvelopeSchema,is as SiteEditResolveSourceLocationInputSchema,yi as SiteEditSemanticSourceSchema,rl as SiteEditSignedOperationRequestSchema,Sn as SiteEditSourceDeleteCapabilitySchema,Za as SiteEditSourceDirectoryPathSchema,ts as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,ns as SiteEditSourceFileBinaryResponseSchema,$p as SiteEditSourceFileKindSchema,Xa as SiteEditSourceFileListItemSchema,Zp as SiteEditSourceFileResponseSchema,es as SiteEditSourceFileTextResponseSchema,At as SiteEditSourceIdentitySchema,as as SiteEditSourceLocationRangeSchema,Xp as SiteEditSourceLocationSchema,nr as SiteEditSourceLocatorRangeSchema,wt as SiteEditSourceLocatorSchema,W as SiteEditSourcePathSchema,fn as SiteEditSourceTreeNodeSchema,Yp as SiteEditSourceTreeResponseSchema,Qa as SiteEditSourceTreeTruncationReasonSchema,Ja as SiteEditSourceTreeTruncationSchema,si as SiteEditStyleBreakpointSchema,Jl as SiteEditStyleModelSchema,ii as SiteEditStylePropertySchema,Ei as SiteEditStyleSourceSchema,ai as SiteEditStyleStateModeSchema,Ot as SiteEditTextSegmentSchema,bi as SiteEditTextSourceSchema,Qo as SiteEditWriteTargetSchema,Uc as SiteGenerationStateSchema,E as SiteIdSchema,Z as SiteLocaleSchema,r_ as SiteMediaIntentSchema,Ep as SiteOperationLockIdSchema,Ee as SiteRecordSchema,Mc as SiteStatusSchema,Ip as SiteTemplateUpgradeStateIdSchema,un as SiteVersionIdSchema,qc as SiteVersionListItemSchema,ct as SiteVersionRecordSchema,g_ as SitemapAddBlockInputSchema,sn as SitemapAnswerSchema,l_ as SitemapChangeBlockVariantInputSchema,hm as SitemapDeleteBlockInputSchema,gm as SitemapEditActorSchema,fm as SitemapEditErrorCodeSchema,ym as SitemapEditFailureSchema,Sm as SitemapEditOperationSchema,__ as SitemapEditResultSchema,bm as SitemapEditSuccessSchema,Em as SitemapGenerationOutcomeSchema,xm as SitemapGenerationReasonSchema,ba as SitemapGenerationStageSchema,te as SitemapIdSchema,p_ as SitemapModelOutputSchema,lm as SitemapModelPageSchema,d_ as SitemapMoveBlockInputSchema,pm as SitemapNavigationHrefSchema,Rm as SitemapRecordSchema,S_ as SitemapRunInputSchema,pt as SitemapSchema,f_ as SitemapStreamEventSchema,_m as SitemapUpdateBlockInstructionInputSchema,u_ as SitemapUpdateBlockPropsInputSchema,Hc as SitemapUserChoiceSchema,xe as SkillSelectionSchema,Yc as SkillSelectionSourceSchema,Aa as SnapshotContentHashSchema,$ as SnapshotFilePathSchema,_ as SnapshotIdSchema,ae as SnapshotRecordSchema,ma as SnapshotStatusSchema,M_ as StartWorkspaceRunRequestSchema,L_ as StartWorkspaceRunResponseSchema,qh as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,Pc as THEME_PRESETS,Er as TemplateUpgradeCasOutcomeSchema,Ri as TemplateUpgradeErrorCodeSchema,xr as TemplateUpgradeOutcomeCountsSchema,br as TemplateUpgradeOutcomeSchema,Ir as TemplateUpgradeSnapshotDeletionCandidateSchema,Se as TemplateUpgradeStateSchema,hr as TemplateUpgradeStatusSchema,yr as TemplateUpgradeValidationStageSchema,X as TemplateVersionSchema,Uh as TryAcquireTemplateUpgradeLockRequestSchema,Fh as TryAcquireTemplateUpgradeLockResponseSchema,sh as UpdateBriefRequestSchema,Th as UpdateBriefResponseSchema,I_ as UpdateClarifyArchetypeRequestSchema,vh as UpdateCurrentSnapshotManifestRequestSchema,ah as UpdateSiteRequestSchema,Rp as UsageRecordIdSchema,ut as UserIdSchema,Vi as VerifySiteDomainDataSchema,yh as VerifySiteDomainResponseSchema,Zt as VisualHintsSchema,Vc as VisualThemeSchema,B_ as WORKSPACE_WEBSOCKET_CONTRACT,Ym as WorkspaceClientMessageSchema,Ac as WorkspaceDesignApplyRequestSchema,Cc as WorkspaceDesignApplyResponseSchema,rn as WorkspaceDiagnosticSchema,ip as WorkspaceDirectEditFileSchema,np as WorkspaceDirectEditPathSchema,Na as WorkspaceDirectEditPostActionSchema,V_ as WorkspaceDirectEditRequestSchema,$_ as WorkspaceDirectEditResponseSchema,cn as WorkspaceExecutionDiagnosticsSchema,k_ as WorkspaceExecutionPlanSchema,tp as WorkspaceMediaRequestSchema,dn as WorkspacePlanDependencySchema,Ra as WorkspacePlanSummarySchema,Nm as WorkspacePlanTaskKindSchema,pn as WorkspacePlanTaskSchema,Eo as WorkspaceResourceKindSchema,Io as WorkspaceResourceNavigationSelectionSchema,pi as WorkspaceResourceOperationClientMessageSchema,xo as WorkspaceResourceOperationSummarySchema,Ro as WorkspaceResourceOperationTransientInputSchema,dt as WorkspaceRunKindSchema,$m as WorkspaceSelectedComponentSchema,Zm as WorkspaceServerMessageSchema,h_ as WorkspaceSitemapEditRequestSchema,Hm as WorkspaceSocketDescriptorSchema,mp as WorkspaceSourceFileBinaryResponseSchema,rp as WorkspaceSourceFileKindSchema,Oa as WorkspaceSourceFileListItemSchema,Y_ as WorkspaceSourceFilePathQuerySchema,Z_ as WorkspaceSourceFileResponseSchema,cp as WorkspaceSourceFileTextResponseSchema,ja as WorkspaceSourcePathSchema,Pm as WorkspaceSuggestionSchema,xa as WorkspaceSuggestionsSchema,Am as WorkspaceSuggestionsSourceSchema,Ta as WorkspaceTaskCountsSchema,q_ as WorkspaceWebSocketMessageSchema,G_ as WorkspaceWebSocketMessageTypeSchema,mn as WorkspaceWorkerGroupSchema,on as WorkspaceWorkerPhaseSchema,P_ as WorkspaceWorkerResultSchema,ge as WorkspaceWorkerStatusSchema,Xg as assertSiteGenerationStateTransition,Zg as assertSiteStatusTransition,sc as canonicalizeFormDesignJson,zn as canonicalizePageSlug,od as compareTemplateVersions,Ml as composeSiteEditRepeatInstanceKey,_g as computeFormDesignOperationFingerprint,Bs as computeSiteEditSourceIdentityKey,Ge as containsSensitiveData,Ks as createSiteEditCommandFailureSchema,Wn as createSiteEditCommandResultSchema,Tt as createSiteEditCommandSuccessSchema,Ht as fontStack,ac as formDesignOperationFingerprintInput,bt as getSiteEditSourceDeleteProtectionReason,hg as hashAffectedFormDesignFiles,gg as hashCmsFormSchemaProjection,at as hashFormDesignJson,ug as hashFormSpec,qn as isCanonicalPageSlug,Fp as isConsentGranted,ur as isExactEditEngineVersion,bs as isSiteEditMaterializationPathTemplate,pr as isSiteEditRuntimeContainerTag,dr as isSiteEditRuntimeTextTag,su as isSiteEditRuntimeVoidElementTag,Qp as isSiteEditSourceDeleteProtectedPath,ss as isSiteEditSourceDirectoryPath,bn as isSiteEditSourcePath,ft as isSiteEditTextSourcePath,Ko as makeSiteEditRepeatInstanceKey,xg as normalizeCmsPublicApiBase,Us as pageSlugToRouteFilePath,_l as parseComponentI18nResourcesJson,gr as parseExactEditEngineVersion,Go as parseSiteEditRepeatInstanceKey,zd as parseSiteEditSourceIdentityKey,ag as projectFormSpecToCmsSchema,Sc as resolveFont,bc as resolveFontDisplayName,ig as resolveFormTemplateText,Qg as resolveGenerationStateForRunLifecycle,Cp as resolveRedisConnectionConfig,bu as resolveRequestedEditEngineVersion,Rn as resolveSelectableSiteLocale,ou as resolveSiteEditRuntimeOperationSummary,id as resolveSiteLocaleFromIso6393,nd as resolveSiteTextDirection,yu as resolveSystemCurrentEditEngineVersion,Tc as siteFontVariables,Ll as stripSiteEditRepeatInstanceKeys,Bn as tryCanonicalizeAsciiPageSlug,ui as validateComponentI18nResources,tg as validateFormSpecIdentityTransition};
|
|
1
|
+
import{z as e}from"zod";import{z as Lr}from"zod";var U=Lr.uuidv7(),un=U,oh=U,rh=U,ch=U,mh=U,lh=U,ph=U,T=U,nt=U,Gs=U,de=U,gn=U,R=U,Ks=U,W=U,Bs=U,wt=U,Be=U,dh=U,uh=U,Ae=U,zs=U,gh=U,_h=U,hh=U,st=U,Sh=U,bh=U,fh=U;var Ws=["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 xh(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:Mr(t.VCP_REDIS_PORT,56379)}}function Mr(t,n){if(!t)return n;let s=Number(t);return Number.isInteger(s)&&s>0?s:n}import{z as V}from"zod";var $s=U,Vs=200,Ur=4e3,Hs=V.enum(["succeeded","degraded","no_changes","failed"]),at=V.enum(["typecheck_unresolved","step_cap_reached","partial_apply_gave_up","patch_protected_dropped","preview_build_failed","preview_runtime_degraded","external_blocked","cms_reconcile_failed","run_expired","sandbox_unavailable"]),Fr=["sandbox_unavailable"];function Th(t){return t!=null&&Fr.includes(t)}var qr=V.enum(["pending","delivered","failed"]),Gr=V.enum(["running","succeeded","degraded","no_changes","failed"]),kh=V.object({site_id:T,external_run_id:V.string().min(1).max(Vs),external_thread_id:V.string().min(1).max(Vs),prompt:V.string().min(1).max(Ur)}).strict(),Ys=V.object({id:$s,site_id:T,external_run_id:V.string().min(1),external_thread_id:V.string().min(1),status:Gr,outcome:Hs.nullable(),degraded_reason:at.nullable(),vcp_run_id:W.nullable(),base_snapshot_id:R,snapshot_id:R.nullable(),preview_url:V.string().url().nullable(),summary:V.string().nullable(),error_code:V.string().nullable(),callback_status:qr,created_at:V.string().min(1),started_at:V.string().min(1).nullable(),finished_at:V.string().min(1).nullable()}).strict(),vh=V.object({task:Ys}).strict(),Ah=V.object({task:Ys}).strict(),wh=V.object({task_id:$s,external_run_id:V.string().min(1),external_thread_id:V.string().min(1),site_id:T,vcp_run_id:W.nullable(),outcome:Hs,degraded_reason:at.nullable(),snapshot_id:R.nullable(),preview_url:V.string().url().nullable(),summary:V.string().nullable(),error_code:V.string().nullable(),retryable:V.boolean(),finished_at:V.string().min(1)}).strict(),Ch=V.object({received:V.literal(!0)}).strict();import{z as v}from"zod";var _n=v.enum(["text","url","document","image"]),hn=v.enum(["pending","ready","failed"]),Kr=v.enum(["pending","ready","failed"]),Br=v.enum(["product","price","contact","copy","audience","other"]),Ct=v.object({fact:v.string().min(1).max(300),kind:Br,source_id:st,quote:v.string().min(1).max(500),trust:v.enum(["verbatim","ocr"]).default("verbatim")}),zr=v.object({page_type:v.string().min(1).max(40),sections:v.array(v.string().min(1).max(40)).max(12)}),Pt=v.object({source_id:st,nav_structure:v.array(v.string().min(1).max(30)).max(12),page_patterns:v.array(zr).max(10),tone:v.array(v.string().min(1).max(20)).max(8),screenshot_ref:v.string().optional()}),Wr=v.object({source_id:st,type:_n,status:hn,title:v.string().max(120).optional(),original_ref:v.string().min(1),source_metadata:v.record(v.string(),v.unknown()),error_code:v.string().optional(),submitted:v.boolean().optional()}),Dt=v.object({topic:v.string().min(1).max(80),variants:v.array(v.object({value:v.string().min(1).max(300),source_id:st})).min(2)}),Vr=v.object({type:v.literal("text"),content:v.string().min(20).max(1e4),title:v.string().min(1).max(120).optional()}).strict(),$r=v.object({type:v.literal("url"),url:v.string().url().max(2048),rights_ack:v.boolean().optional(),title:v.string().min(1).max(120).optional()}).strict(),Oh=v.discriminatedUnion("type",[Vr,$r]),Nh=[".docx",".html",".md",".txt"],Lh=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],Mh=10*1024*1024,Uh=2,Fh=v.object({consent_cross_border:v.union([v.literal(!0),v.literal("true")]),consent_text_version:v.string().min(1).max(120),title:v.string().min(1).max(120).optional()}).strict();function qh(t){return t===!0||t==="true"}var Gh=[".png",".jpg",".jpeg",".webp"],Kh=["image/png","image/jpeg","image/webp","application/octet-stream"],Bh=8*1024*1024,zh=10,Hr=v.enum(["asset","reference"]),Wh=v.object({image_role:Hr,title:v.string().min(1).max(120).optional()}).strict(),Vh=v.object({version:v.literal(1),site_id:T,tenant_id:v.string().min(1),user_prompt:v.string(),status:Kr,sources:v.array(Wr).max(16),facts:v.array(Ct).max(120),reference:Pt.optional(),conflicts:v.array(Dt).max(20)}).superRefine((t,n)=>{let s=new Map(t.sources.map(i=>[i.source_id,i]));for(let[i,a]of t.facts.entries()){let c=s.get(a.source_id);(!c||c.type==="url")&&n.addIssue({code:"custom",path:["facts",i,"source_id"],message:"facts must reference a text/document/image source (never url)"})}if(t.reference){let i=s.get(t.reference.source_id),a=i?.type==="image"&&i.source_metadata.image_role==="reference";(!i||i.type!=="url"&&!a)&&n.addIssue({code:"custom",path:["reference","source_id"],message:"reference must point at a url source or reference image source"})}});import{z as A}from"zod";var Yr=["design.md","DESIGN.md"],Xs=["components/site","src/components/site","lib/generated","src/lib/generated","public"],Xr=["app/globals.css","src/app/globals.css"],Zr=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Qr=new Set(Zr),Sn="source-delete",Zs=A.literal(Sn),ce=A.string().min(1).refine(Js,"Invalid site edit source path"),Jr=A.string().min(1).refine(cc,"Invalid site edit source directory path"),Yh=A.enum(["text","binary"]),jt=A.object({path:ce,language:A.string().min(1).nullable(),sizeBytes:A.number().int().nonnegative(),contentHash:A.string().min(1).optional()}),ec=A.discriminatedUnion("kind",[jt.extend({kind:A.literal("text"),language:A.string().min(1),readonly:A.boolean().default(!1)}),jt.extend({kind:A.literal("binary"),language:A.null(),mimeType:A.string().min(1).optional(),readonly:A.literal(!0)})]),Qs=A.lazy(()=>A.discriminatedUnion("kind",[A.object({kind:A.literal("directory"),name:A.string().min(1),path:Jr,children:A.array(Qs)}),A.object({kind:A.literal("file"),name:A.string().min(1),path:ce,file:ec}).superRefine((t,n)=>{t.path!==t.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),tc=A.enum(["max-files","max-depth","max-total-bytes"]),nc=A.object({reasons:A.array(tc).min(1),maxFiles:A.number().int().positive(),maxDepth:A.number().int().positive(),maxTotalBytes:A.number().int().positive()}),Xh=A.object({nodes:A.array(Qs),defaultPath:ce.optional(),totalFiles:A.number().int().nonnegative(),truncated:nc.optional()}),sc=jt.extend({kind:A.literal("text"),language:A.string().min(1),readonly:A.boolean().default(!1),content:A.string()}),ac=A.enum(["too-large","unsupported-mime","bytes-unavailable"]),ic=jt.extend({kind:A.literal("binary"),language:A.null(),readonly:A.literal(!0),mimeType:A.string().min(1),contentBase64:A.string().min(1).optional(),previewUnavailableReason:ac.optional()}),Zh=A.discriminatedUnion("kind",[sc,ic]),oc=A.object({key:A.string().min(1),routeId:A.string().min(1).optional()}),rc=A.object({startLine:A.number().int().positive(),startColumn:A.number().int().nonnegative(),endLine:A.number().int().positive(),endColumn:A.number().int().nonnegative()}),Qh=oc.extend({sourceFile:ce,componentName:A.string().min(1),openingElementRange:rc,structuralPath:A.string().min(1),textPreview:A.string().min(1).optional()});function Js(t){return!sa(t)||na(t)?!1:yn(t)||ta(t)||ea(t)||Xs.some(n=>t===n||t.startsWith(`${n}/`))}function bn(t){return yn(t)||Qr.has(mc(t))}function cc(t){return!sa(t)||na(t)?!1:t==="app"||t.startsWith("app/")||t==="src"||t==="src/app"||t.startsWith("src/app/")||Xs.some(n=>t===n||t.startsWith(`${n}/`)||n.startsWith(`${t}/`))}function fn(t){return Js(t)?yn(t)?"design-document":ea(t)?"route-entry":ta(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 Jh(t){return fn(t)!==null}function ea(t){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(t.toLowerCase())}function ta(t){return Xr.some(n=>n.toLowerCase()===t.toLowerCase())}function mc(t){let n=t.split("/").at(-1)??t,s=n.lastIndexOf(".");return s>0?n.slice(s).toLowerCase():""}function yn(t){return!t.includes("/")&&Yr.some(n=>n.toLowerCase()===t.toLowerCase())}function na(t){let n=t.toLowerCase(),s=n.split("/"),a=(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:a==="server"||a==="db"||a==="database"||a==="auth"||a==="secret"||a==="secrets"||a==="token"||a==="tokens"||a==="credential"||a==="credentials"||s.includes("server")||s.includes("secrets")}function sa(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 lc}from"zod";var it=["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"],pc=["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"],dc=[...it,...pc],uc=new Set(["ar","fa","he"]),nS=[{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"}],gc={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"},_c=new Set(it);function aa(t){return _c.has(t)?t:gc[t]}var hc="en";function sS(t){let n=t.toLowerCase().split("-",1)[0]??"";return uc.has(n)?"rtl":"ltr"}var Sc={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 aS(t){return Sc[t]??hc}var ue=lc.enum(dc);import{z as bc}from"zod";var ia=bc.string().uuid();import{z as d}from"zod";var ge=d.string().trim().min(1).max(128),ot=d.string().trim().min(1).max(200),En=d.string().trim().min(1).max(2e3),In=d.string().trim().max(200),rt=d.string().regex(/^[a-f0-9]{64}$/),Ot=["goal","market","persona","product","brand","competition","structure","language","seogeo","content","conversion","risk"],Lt=d.enum(Ot),ra=["recommended","conservative","focused"],Mt=d.enum(ra),xn=d.object({id:Mt,label:ot,note:En,impact:d.string().trim().max(500).nullish(),set_value:d.string().trim().max(500).nullish()}).strict(),fc=d.object({lead:d.string().trim().min(1).max(500),title:ot,columns:d.array(d.string().trim().min(1).max(80)).min(1).max(8),rows:d.array(d.array(d.string().trim().max(500)).min(1).max(8)).max(100)}).strict().superRefine((t,n)=>{t.rows.forEach((s,i)=>{s.length!==t.columns.length&&n.addIssue({code:"custom",path:["rows",i],message:"Each Step5 plan row must match the column count."})})}),yc=d.object({source_type:d.enum(["step2","step3"]),source_id:ge,field_path:d.string().trim().max(300).nullish()}).strict(),xc=d.enum(["ready","disabled","empty","timeout","rate_limited","quota_exhausted","failed"]),ca=d.enum(["INFORMATIONAL","NAVIGATIONAL","COMMERCIAL","TRANSACTIONAL"]),Ec=d.object({id:ge,term:d.string().trim().min(1).max(255),source_type:d.enum(["step2","step3","step5"]),source_id:ge,field_path:d.string().trim().min(1).max(300)}).strict(),Ic=d.object({keyword:d.string().trim().min(1).max(255),normalized_keyword:d.string().trim().min(1).max(255),intents:d.array(ca).min(1).max(4),search_volume:d.number().int().min(50),keyword_difficulty:d.number().min(0).max(45),cpc:d.number().nonnegative().nullish(),trend:d.array(d.number().int().min(0).max(100)).length(12),serp_features:d.array(d.string().trim().min(1).max(80)).max(64),fit:d.object({seo:d.number().int().min(0).max(100),geo:d.number().int().min(0).max(100),buyer:d.number().int().min(0).max(100)}).strict(),recommended_channel:d.enum(["SEO","GEO","DUAL"]),priority:d.enum(["P0","P1","P2","P3"]),already_in_plan:d.boolean(),page_level:d.union([d.literal(1),d.literal(2)]).default(1)}).strict(),Rc=d.object({id:ge,intent:ca,title:ot,landing_page_type:d.enum(["blog","product","category","landing"]),keywords:d.array(Ic).min(1).max(100)}).strict(),Tc=d.object({schema_version:d.literal(1),provider:d.literal("semrush"),api_version:d.literal("v4"),database:d.string().trim().regex(/^[A-Z]{2}$/),country:d.string().trim().regex(/^[A-Z]{2}$/),fetched_at:d.string().datetime({offset:!0}),context_hash:rt,status:xc,seeds:d.array(Ec).max(20),intent_groups:d.array(Rc).max(16),error_code:d.string().trim().regex(/^[A-Z0-9_]+$/).max(64).nullish()}).strict().superRefine((t,n)=>{t.database!==t.country&&n.addIssue({code:"custom",path:["database"],message:"Semrush database must match the ISO country code."}),t.status==="ready"&&t.intent_groups.length===0&&n.addIssue({code:"custom",path:["intent_groups"],message:"Ready Semrush recommendations require an intent group."}),t.status==="ready"&&t.error_code&&n.addIssue({code:"custom",path:["error_code"],message:"Ready Semrush recommendations cannot contain an error code."})}),Rn=d.object({key:Lt,position:d.number().int().min(1).max(12),category:ot,title:ot,summary:En,rationale:En,parameter:d.string().trim().max(500).nullish(),options:d.tuple([xn,xn,xn]),plan:fc.nullish(),note_tips:d.array(d.string().trim().min(1).max(200)).max(6),note_placeholder:d.string().trim().min(1).max(300),evidence_refs:d.array(yc).min(1).max(8),semrush_recommendations:Tc.nullish()}).strict().superRefine((t,n)=>{let s=Ot.indexOf(t.key)+1;t.position!==s&&n.addIssue({code:"custom",path:["position"],message:`Step5 strategy ${t.key} must use position ${s}.`}),t.options.forEach((i,a)=>{i.id!==ra[a]&&n.addIssue({code:"custom",path:["options",a,"id"],message:"Step5 strategy options must use the canonical order."})}),t.semrush_recommendations&&t.key!=="seogeo"&&n.addIssue({code:"custom",path:["semrush_recommendations"],message:"Semrush recommendations are only valid for the seogeo item."})}),Nt=9,ma=d.object({id:ge,type:d.union([d.literal(1),d.literal(2)]).default(1),cells:d.tuple([d.string().trim().max(500),d.string().trim().max(500),d.string().trim().max(500),d.string().trim().max(500),d.string().trim().max(500),d.string().trim().max(500)])}).strict(),kc=d.object({rows:d.array(ma).max(100).optional()}).strict(),la=d.object({rows:d.array(ma).max(100).optional()}).strict(),vc=d.object({item_key:Lt,selected_option_id:Mt,note:In,custom_payload:la.optional()}).strict().superRefine((t,n)=>{t.item_key==="seogeo"&&t.custom_payload&&Dc(t.custom_payload,n)}),Tn=d.object({item_key:Lt,selected_option_id:Mt,note:In,custom_payload:kc.optional(),selected_value:d.unknown().nullable(),accepted_at:d.string().datetime({offset:!0})}).strict(),Ac=d.enum(["running","succeeded","failed"]),wc=d.object({schema_version:d.literal(1),source_job_id:ge,site_id:ge,items:d.array(Rn).length(12),decisions:d.array(Tn).length(12)}).strict(),Cc=d.object({strategy_version_id:ge,site_id:ge,source_job_id:ge,version:d.number().int().positive(),checksum:rt,snapshot:wc,committed_at:d.string().datetime({offset:!0})}).strict(),pa=d.object({job_id:ge,site_id:ge,status:Ac,revision:d.number().int().nonnegative(),items:d.array(Rn).max(12),decisions:d.array(Tn).max(12),output_checksum:rt.nullish(),error_code:d.string().trim().max(64).nullish(),error_message:d.string().trim().max(500).nullish(),committed_version:Cc.nullish()}).strict().superRefine((t,n)=>{let s=t.items.map(a=>a.key);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["items"],message:"Step5 job items must have unique keys."});let i=t.decisions.map(a=>a.item_key);new Set(i).size!==i.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 job decisions must have unique item keys."})}),mS=d.object({force_refresh:d.boolean().optional().default(!1)}).strict(),lS=pa.extend({cached:d.boolean()}).strict(),pS=d.object({expected_revision:d.number().int().nonnegative(),selected_option_id:Mt,note:In,custom_payload:la.optional()}).strict(),dS=d.object({revision:d.number().int().positive(),decision:Tn}).strict(),uS=d.object({idempotency_key:d.string().trim().min(8).max(128),expected_revision:d.number().int().nonnegative(),decisions:d.array(vc).length(12)}).strict().superRefine((t,n)=>{let s=t.decisions.map(i=>i.item_key);new Set(s).size!==Ot.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 commit must contain 12 unique decisions."}),Ot.forEach(i=>{s.includes(i)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit is missing ${i}.`})})}),gS=d.object({strategy_version_id:ge,version:d.number().int().positive(),checksum:rt,next_path:d.string().trim().min(1).max(500)}).strict(),Pc=pa.extend({completed:d.number().int().min(0).max(12),total:d.literal(12)}).strict(),_S=d.discriminatedUnion("event",[d.object({id:d.number().int().nonnegative(),event:d.literal("snapshot"),data:Pc}).strict(),d.object({id:d.number().int().positive(),event:d.literal("strategy_item_start"),data:d.object({key:Lt,position:d.number().int().min(1).max(12)}).strict()}).strict(),d.object({id:d.number().int().positive(),event:d.literal("strategy_item_done"),data:d.object({item:Rn}).strict()}).strict(),d.object({id:d.number().int().positive(),event:d.literal("strategy_items_invalidated"),data:d.object({after_position:d.number().int().min(1).max(11)}).strict()}).strict(),d.object({id:d.number().int().positive(),event:d.literal("strategy_generation_done"),data:d.object({item_count:d.literal(12),schema_version:d.literal(1),checksum:rt}).strict()}).strict(),d.object({id:d.number().int().positive(),event:d.literal("failed"),data:d.object({code:d.string().trim().min(1).max(64),message:d.string().trim().min(1).max(500),retryable:d.boolean()}).strict()}).strict()]);function oa(t){let n=t.trim().toLocaleLowerCase();return n===""||n==="/"?"/":`/${n.replace(/^\/+|\/+$/g,"")}`}function Dc(t,n){let s=(t.rows??[]).filter(a=>a.type===1);t.rows&&s.length===0&&n.addIssue({code:"custom",path:["custom_payload","rows"],message:"SEO/GEO plans must keep at least one primary page."});let i=s.some(a=>oa(a.cells[3])==="/");s.length+(i?0:1)>Nt&&n.addIssue({code:"custom",path:["custom_payload","rows"],message:`Initial generation supports at most ${Nt} primary pages including home.`}),s.forEach((a,c)=>{/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/.test(oa(a.cells[3]))||n.addIssue({code:"custom",path:["custom_payload","rows",c,"cells",3],message:"Primary intent pages must use root or one-segment kebab-case paths."})})}import{z as jc}from"zod";var be=jc.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/);function bS(t,n){let s=be.safeParse(t),i=be.safeParse(n);if(!s.success||!i.success)return null;let a=da(s.data),c=da(i.data);for(let o=0;o<3;o+=1){let _=ua(a.release[o],c.release[o]);if(_!==0)return _}if(!a.prerelease&&!c.prerelease)return 0;if(!a.prerelease)return 1;if(!c.prerelease)return-1;let f=Math.max(a.prerelease.length,c.prerelease.length);for(let o=0;o<f;o+=1){let _=a.prerelease[o],w=c.prerelease[o];if(_===void 0)return-1;if(w===void 0)return 1;if(_===w)continue;let x=/^\d+$/u.test(_),C=/^\d+$/u.test(w);return x&&C?ua(BigInt(_),BigInt(w)):x?-1:C?1:Oc(_,w)}return 0}function da(t){let n=t.indexOf("+"),s=n===-1?t:t.slice(0,n),i=s.indexOf("-"),a=i===-1?s:s.slice(0,i),c=i===-1?void 0:s.slice(i+1),[f,o,_]=a.split(".");return{release:[BigInt(f),BigInt(o),BigInt(_)],...c?{prerelease:c.split(".")}:{}}}function ua(t,n){return t<n?-1:t>n?1:0}function Oc(t,n){return t<n?-1:t>n?1:0}import{z as F}from"zod";import{z as se}from"zod";var kn=64,Nc=512*1024,vn=4*1024*1024,Lc=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function Mc(t){return Lc.test(t)}var ga=se.string().min(1).refine(Mc,{message:"Materialization pathTemplate must be a safe relative path."}),Uc=se.object({pathTemplate:ga,content:se.string(),role:se.string().min(1).optional()}).strict(),Fc=se.union([se.object({kind:se.literal("default")}).strict(),se.object({kind:se.literal("named"),name:se.string().min(1)}).strict()]),qc=se.object({pathTemplate:ga,export:Fc}).strict(),Gc=se.array(se.never()).optional(),Le=se.object({instanceBaseName:se.string().min(1),files:se.array(Uc).min(1).max(kn),entry:qc,dataRequirements:Gc}).strict().superRefine((t,n)=>{let s=new Set,i=t.entry.pathTemplate,a=0;for(let[c,f]of t.files.entries()){s.has(f.pathTemplate)&&n.addIssue({code:"custom",path:["files",c,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${f.pathTemplate}`}),s.add(f.pathTemplate);let o=new TextEncoder().encode(f.content).length;o>Nc&&n.addIssue({code:"custom",path:["files",c,"content"],message:"Materialization file content exceeds the per-file byte limit."}),a+=o}s.has(i)||n.addIssue({code:"custom",path:["entry","pathTemplate"],message:"Materialization entry pathTemplate must match a file."}),a>vn&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});var _a="insertNewComponent",RS={categoryGroupMissing:"DESIGNER_COMPONENT_CATEGORY_GROUP_MISSING",unavailable:"DESIGNER_COMPONENT_LIBRARY_UNAVAILABLE",timeout:"DESIGNER_COMPONENT_LIBRARY_TIMEOUT",invalidResponse:"DESIGNER_COMPONENT_LIBRARY_INVALID_RESPONSE",incompatibleResource:"DESIGNER_COMPONENT_RESOURCE_INCOMPATIBLE"},An=F.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),ha=F.lazy(()=>F.object({id:F.string().uuid(),key:F.string().min(1),name:F.string(),children:F.array(ha)}).strict()),Sa=F.object({category_group_key:F.literal(_a),categories:F.array(ha)}).strict(),Kc=F.object({resource_id:F.string().min(1),name:F.string(),description:F.string().nullable(),thumbnail_url:F.string().nullable(),resolved_version:An,category_id:F.string().uuid().nullable()}).strict(),ba=F.object({category_group_key:F.literal(_a),items:F.array(Kc),next_cursor:F.string().min(1).nullable()}).strict(),TS=F.object({resource_id:F.string().min(1),resolved_version:An,anchor_block_id:F.string().min(1),placement:F.enum(["before","after"])}).strict(),kS=F.object({status:F.literal("mock_acknowledged")}).strict(),vS=F.object({category_id:F.string().uuid().optional(),include_descendants:F.enum(["true","false"]).optional().transform(t=>t==="true"),limit:F.coerce.number().int().min(1).max(100).optional().default(20),cursor:F.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),Me=An,AS=F.object({version:Me}).strict(),fa=F.object({resource_id:F.string().min(1),resolved_version:Me,revision_id:F.string().uuid().optional(),digest_sha256:F.string().regex(/^[a-f0-9]{64}$/),materialization:Le}).strict();import{z as b}from"zod";import{z as y}from"zod";var Bc="/",Ut=y.preprocess(t=>t===0?!1:t===1?!0:t,y.boolean()),wn=y.union([y.url(),y.string().startsWith("/")]),Cn=y.enum(["landing_page","general_page","detail_page"]),xa=y.lazy(()=>y.object({cms_page_id:y.number().int().positive(),title:y.string().trim().min(1).max(120),url_path:y.string().startsWith("/"),url:wn.nullable(),page_type:Cn,vcp_managed:Ut,children:y.array(xa)}).strict()),zc=y.object({group_id:y.string().min(1),title:y.string().trim().min(1).max(120),pages:y.array(xa)}).strict(),ya=y.object({groups:y.array(zc)}).strict(),Ea=y.lazy(()=>y.object({id:y.number().int().positive(),title:y.string().trim().min(1).max(120),url_path:y.string().startsWith("/"),parent_id:y.number().int().nonnegative(),group_type:y.string().min(1),page_type:Cn,plugin_id:y.number().int().nonnegative(),is_default:Ut,is_published:Ut,url:wn.nullable(),vcp_managed:Ut,children:y.array(Ea)})),Wc=y.object({plugin_id:y.number().int().nonnegative(),slug:y.string(),group_name:y.string().trim().min(1).max(120),pages:y.array(Ea)}).passthrough(),Vc=y.array(Wc);function Ia(t){return{cms_page_id:t.id,title:t.title,url_path:t.url_path,url:t.url,page_type:t.page_type,vcp_managed:t.vcp_managed,children:t.children.map(n=>Ia(n))}}function DS(t){let n=ya.safeParse(t);if(n.success)return n.data;let s=Vc.safeParse(t);if(!s.success)return null;let i=ya.safeParse({groups:s.data.map(a=>({group_id:String(a.plugin_id),title:a.group_name,pages:a.pages.map(Ia)}))});return i.success?i.data:null}var $c=y.enum(["missing_url","not_vcp_managed"]),Hc=y.enum(["home_page","not_selectable","not_vcp_managed","page_has_children","last_selectable_page","cms_unbound"]),Ra=y.lazy(()=>y.object({cms_page_id:y.number().int().positive().nullable(),title:y.string().trim().min(1).max(120),url_path:y.string().startsWith("/"),url:wn.nullable(),page_type:Cn,vcp_managed:y.boolean(),selectable:y.boolean(),disabled_reason:$c.nullable(),can_delete:y.boolean(),delete_block_reason:Hc.nullable(),has_cms_children:y.boolean(),children:y.array(Ra)}).strict()),Ta=y.object({group_id:y.string().min(1),title:y.string().trim().min(1).max(120),pages:y.array(Ra)}).strict(),jS=y.object({base_snapshot_id:R,expected_url_path:y.string().startsWith("/")}).strict(),Yc=y.enum(["succeeded","failed"]),Xc=y.object({url_path:y.string().startsWith("/"),phase:y.enum(["ensure","binding","delete"]),code:y.string().min(1),message:y.string().min(1)}).strict(),ka=y.object({status:Yc,checked_count:y.number().int().nonnegative(),ensured_count:y.number().int().nonnegative(),deleted_count:y.number().int().nonnegative(),already_absent_count:y.number().int().nonnegative(),failed_pages:y.array(Xc),warnings:y.array(y.string().min(1))}).strict(),Zc=y.object({result_snapshot_id:R,deleted_files:y.array(y.string().min(1)),updated_files:y.array(y.string().min(1)),preserved_shared_files:y.array(y.string().min(1)),warnings:y.array(y.string().min(1)),next_url:y.url().nullable(),previous_url:y.url().nullable(),cms_reconcile_result:ka}).strict(),OS=y.object({code:y.literal(0),message:y.string(),data:Zc}).strict(),NS=y.object({source_committed:y.boolean(),result_snapshot_id:R.optional(),cms_reconcile_result:ka.optional()}).strict().superRefine((t,n)=>{t.source_committed&&!t.result_snapshot_id&&n.addIssue({code:"custom",path:["result_snapshot_id"],message:"committed source requires result_snapshot_id"})}),Qc=y.enum(["general_page","detail_page"]),va=y.object({url_path:y.string().startsWith("/"),title:y.string().trim().min(1).max(120),kind:Qc,route_file:y.string().min(1),collection_id:y.string().trim().min(1).optional()}).strict().superRefine((t,n)=>{t.kind==="detail_page"&&!t.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:"detail_page target requires collection_id"}),t.kind==="general_page"&&t.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:"general_page target cannot have collection_id"})}),Jc=y.object({complete:y.literal(!0),targets:y.array(va)}).strict().superRefine((t,n)=>{t.targets.length<1&&n.addIssue({code:"too_small",minimum:1,inclusive:!0,origin:"array",path:["targets"],message:"A complete page target set must contain at least one page."}),t.targets.filter(i=>i.url_path===Bc).length!==1&&n.addIssue({code:"custom",path:["targets"],message:"A complete page target set must contain exactly one home page."})}),LS=y.discriminatedUnion("complete",[Jc,y.object({complete:y.literal(!1),targets:y.array(va),errors:y.array(y.string().min(1)).min(1)}).strict()]);var Aa="insertNewPage",KS={categoryGroupMissing:"DESIGNER_PAGE_CATEGORY_GROUP_MISSING",unavailable:"DESIGNER_PAGE_LIBRARY_UNAVAILABLE",timeout:"DESIGNER_PAGE_LIBRARY_TIMEOUT",invalidResponse:"DESIGNER_PAGE_LIBRARY_INVALID_RESPONSE",incompatibleResource:"DESIGNER_PAGE_RESOURCE_INCOMPATIBLE"},Ue=b.enum(["page","pages"]),em=b.object({resource_id:b.string().min(1),resource_type:Ue,resolved_version:Me,template_page_id:b.string().min(1)}).strict(),wa=b.lazy(()=>b.object({id:b.string().uuid(),key:b.string().min(1),name:b.string(),children:b.array(wa)}).strict()),Ca=b.object({category_group_key:b.literal(Aa),categories:b.array(wa)}).strict(),tm=b.object({resource_id:b.string().min(1),resource_type:Ue,name:b.string(),description:b.string().nullable(),thumbnail_url:b.string().nullable(),resolved_version:Me,category_id:b.string().uuid().nullable()}).strict(),Pa=b.object({category_group_key:b.literal(Aa),items:b.array(tm),next_cursor:b.string().min(1).nullable()}).strict(),BS=b.object({category_id:b.string().uuid().optional(),include_descendants:b.enum(["true","false"]).optional().transform(t=>t==="true"),limit:b.coerce.number().int().min(1).max(100).optional().default(20),cursor:b.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),ct=Me,Ft=b.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),zS=b.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),nm=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Ft}).strict(),sm=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),source:em.optional(),blocks:b.array(b.discriminatedUnion("kind",[b.object({kind:b.literal("package-component"),instance_id:b.string().min(1),component_id:b.string().min(1),label:b.string().trim().min(1).max(120)}).strict(),b.object({kind:b.literal("component-resource"),instance_id:b.string().min(1),resource_id:b.string().min(1),resolved_version:Me,label:b.string().trim().min(1).max(120)}).strict()])).optional(),route:b.object({input:b.string(),append_random_suffix:b.boolean().optional(),random_suffix_length:b.number().int().min(4).max(16).optional(),final:Ft}).strict()}).strict(),am=b.object({resource_id:b.string().min(1),resource_type:Ue,resolved_version:ct,pages:b.array(sm).min(1)}).strict().superRefine((t,n)=>{we(t.pages.map(s=>s.template_page_id),"pages",n),we(t.pages.map(s=>s.route.final),"routes",n);for(let[s,i]of t.pages.entries()){if(!i.blocks)continue;let a=new Set;for(let[c,f]of i.blocks.entries())a.has(f.instance_id)&&n.addIssue({code:"custom",path:["pages",s,"blocks",c,"instance_id"],message:`Duplicate block instance identifier within page: ${f.instance_id}`}),a.add(f.instance_id)}});function Pn(t,n){t.resource_type==="page"&&t.pages.length!==1&&n.addIssue({code:"custom",path:["pages"],message:"page resources must contain exactly one page"}),t.resource_type==="pages"&&t.pages.length<2&&n.addIssue({code:"custom",path:["pages"],message:"pages resources must contain at least two pages"})}function we(t,n,s){let i=new Set;for(let[a,c]of t.entries())i.has(c)&&s.addIssue({code:"custom",path:[n,a],message:`Duplicate ${n} identifier: ${c}`}),i.add(c)}var WS=b.object({resource_type:Ue,version:ct,pages:b.array(nm).min(1)}).strict().superRefine((t,n)=>{Pn(t,n),we(t.pages.map(s=>s.template_page_id),"pages",n),we(t.pages.map(s=>s.final_route),"routes",n)}),im=b.object({instance_id:b.string().min(1),component_id:b.string().min(1)}).strict(),om=b.object({component_id:b.string().min(1),materialization:Le}).strict(),rm=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Ft,materialization:Le,components:b.array(im)}).strict(),Dn=b.object({resource_id:b.string().min(1),resource_type:Ue,resolved_version:ct,revision_id:b.string().uuid().optional(),digest_sha256:b.string().regex(/^[a-f0-9]{64}$/),components:b.array(om),pages:b.array(rm).min(1),project_dependencies:b.record(b.string(),b.never()).optional()}).strict().superRefine((t,n)=>{Pn(t,n);let s=t.components.map(a=>a.component_id),i=new Set(s);we(s,"components",n),we(t.pages.map(a=>a.template_page_id),"pages",n),we(t.pages.map(a=>a.final_route),"routes",n);for(let[a,c]of t.pages.entries()){let f=new Set;for(let[o,_]of c.components.entries())i.has(_.component_id)||n.addIssue({code:"custom",path:["pages",a,"components",o,"component_id"],message:`Unknown component reference: ${_.component_id}`}),f.has(_.instance_id)&&n.addIssue({code:"custom",path:["pages",a,"components",o,"instance_id"],message:`Duplicate component instance identifier within page: ${_.instance_id}`}),f.add(_.instance_id)}}),Da=Dn,ja=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Ft,route_file_path:b.string().regex(/^app\/[a-z0-9]+(?:-[a-z0-9]+)*\/page\.tsx$/)}).strict(),cm=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),composition_supported:b.boolean(),blocks:b.array(b.object({instance_id:b.string().min(1),component_id:b.string().min(1),label:b.string().trim().min(1).max(120)}).strict())}).strict(),Oa=b.object({resource_id:b.string().min(1),resource_type:Ue,resolved_version:ct,pages:b.array(cm).min(1)}).strict().superRefine((t,n)=>{Pn(t,n),we(t.pages.map(s=>s.template_page_id),"pages",n)}),VS=b.object({resource_type:Ue,version:ct}).strict(),$S=b.object({draft:am}).strict(),Na=b.object({groups:b.array(Ta)}).strict(),La=b.object({candidate:b.record(b.string(),b.unknown())}).strict();var ze="[a-z0-9]+(?:-[a-z0-9]+)*",mt=new RegExp(`^/(?:${ze}(?:/${ze})*)?$`);function mm(t){return t.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Ma(t){return typeof t=="string"&&mt.test(t)}function Ua(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 i=s.split("/");if(i.some(o=>o==="."||o===".."))return null;let a=s.toLowerCase();if(a==="index"||a==="home")return"/";let c=i.map(mm).filter(o=>o.length>0);if(c.length===0)return null;let f=`/${c.join("/")}`;return Ma(f)?f:null}function Fa(t){let n=Ua(t);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function lm(t){let n=Fa(t);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z}from"zod";import{z as p}from"zod";import{z as he}from"zod";var pm=he.object({code:he.string().min(1),message:he.string().min(1)}),ZS=he.object({code:he.string().min(1),message:he.string().min(1)});function jn(t){return he.object({ok:he.literal(!0),data:t})}function dm(t){let n={ok:he.literal(!1),error:pm.extend({code:t.codeSchema})};return t.currentSchema&&(n.current=t.currentSchema.optional()),t.diagnosticsSchema&&(n.diagnostics=he.array(t.diagnosticsSchema).optional()),t.dataSchema&&(n.data=t.dataSchema.optional()),he.object(n)}function qa(t){return he.discriminatedUnion("ok",[jn(t.dataSchema),dm({codeSchema:t.codeSchema,currentSchema:t.currentSchema,diagnosticsSchema:t.diagnosticsSchema,dataSchema:t.failureDataSchema})])}import{z as B}from"zod";var Fe=B.object({start:B.number().int().nonnegative(),end:B.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"})}),um=B.object({code:B.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:B.string().min(1)}),Ga=B.object({path:B.string().min(1),content:B.string(),hash:B.string().min(1).optional()}),tb=B.object({revision:B.string().min(1),entryCss:Ga,stylesheets:B.array(Ga).default([])}),Ka=B.object({key:B.string().min(1),routeId:B.string().min(1),filePath:B.string().min(1),componentName:B.string().min(1),sourceKind:B.enum(["missing","stringLiteral","expression"]),attrRaw:B.string().min(1).nullable(),valueRaw:B.string().min(1).nullable(),attrRange:Fe.nullable(),openingElementRange:Fe,version:B.object({documentVersion:B.number().int().nonnegative(),contentHash:B.string().min(1)}),diagnostics:B.array(um),computedStyle:B.record(B.string(),B.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"})}),nb=Ka,sb=jn(Ka),On=B.object({source:B.enum(["style-panel","class-source-editor"]),operation:B.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as gm}from"zod";var Nn=gm.enum(["src","alt","poster","href","width","height"]);import{z as We}from"zod";var lt=We.object({editingSessionId:We.string().min(1),lockId:We.string().min(1),ownerId:We.string().min(1),leaseAssertion:We.string().min(1)}).strict(),cb="signed-designer-mutations-v1",mb=We.object({mutationContext:lt}).strict();import{z as u}from"zod";import{z as pt}from"zod";var qt="::",Ln=pt.object({file:pt.string().min(1),component:pt.string().min(1),structuralPath:pt.string().min(1),key:pt.string().min(1)}).superRefine((t,n)=>{let s=_m(t.file,t.component,t.structuralPath);t.key!==s&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function _m(t,n,s){return`${t}${qt}${n}${qt}${s}`}function db(t){let[n,s,...i]=t.split(qt);return!n||!s||i.length===0?null:{file:n,component:s,structuralPath:i.join(qt)}}var Gt=u.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"]),dt=u.object({code:u.string().min(1),message:u.string().min(1)}).strict(),hm=u.union([u.object({kind:u.literal("virtual-route-root"),key:u.string().min(1)}).strict(),u.object({kind:u.literal("jsx-container"),key:u.string().min(1),sourceMemberKey:u.string().min(1),sourceFile:u.string().min(1),componentName:u.string().min(1).optional()}).strict(),u.object({kind:u.literal("starter-placeholder"),key:u.string().min(1),sourceFile:u.string().min(1).optional()}).strict()]),Sm=u.object({key:u.string().min(1),kind:u.enum(["jsx-element","jsx-fragment","jsx-expression","null-return","starter-placeholder"]),containerKey:u.string().min(1),label:u.string().min(1),sourceFile:u.string().min(1).optional(),isAtomic:u.boolean()}).strict(),bm=u.object({key:u.string().min(1),sourceMemberKey:u.string().min(1),containerKey:u.string().min(1),label:u.string().min(1),isIndependent:u.boolean()}).strict(),fm=u.object({key:u.string().min(1),containerKey:u.string().min(1),businessMemberKeys:u.array(u.string().min(1)),isMultiMember:u.boolean()}).strict(),Mn=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative()}).strict(),za=Mn.extend({routeId:u.string().min(1),placementUnitKey:u.string().min(1),relation:u.enum(["before","after","prepend","append"])}).strict(),Wa=za,Va=u.object({kind:u.literal("page-unit"),routeId:u.string().min(1),placementUnitKey:u.string().min(1)}).strict();function Re(t,n,s,i,a){let c=new Set;for(let[f,o]of t.entries()){let _=i(o);c.has(_)&&n.addIssue({code:"custom",path:[s,f,a],message:`Duplicate ${s} key: ${_}`}),c.add(_)}}var ym=u.object({status:u.literal("supported"),version:u.number().int().nonnegative(),routeId:u.string().min(1),container:hm,sourceMembers:u.array(Sm),businessMembers:u.array(bm),placementUnits:u.array(fm),placements:u.array(za)}).strict().superRefine((t,n)=>{Re(t.sourceMembers,n,"sourceMembers",o=>o.key,"key"),Re(t.businessMembers,n,"businessMembers",o=>o.key,"key"),Re(t.placementUnits,n,"placementUnits",o=>o.key,"key"),Re(t.placements,n,"placements",o=>o.placementKey,"placementKey");let s=new Set(t.sourceMembers.map(o=>o.key)),i=new Set(t.placementUnits.map(o=>o.key)),a=new Map(t.sourceMembers.map(o=>[o.key,o])),c=new Map(t.businessMembers.map(o=>[o.key,o]));for(let[o,_]of t.sourceMembers.entries()){_.containerKey!==t.container.key&&!s.has(_.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",o,"containerKey"],message:"Source member parent must reference the page container or another source member."}),_.containerKey===_.key&&n.addIssue({code:"custom",path:["sourceMembers",o,"containerKey"],message:"Source member cannot contain itself."});let w=new Set([_.key]),x=_.containerKey;for(;x!==t.container.key;){if(w.has(x)){n.addIssue({code:"custom",path:["sourceMembers",o,"containerKey"],message:"Source member hierarchy must be acyclic."});break}w.add(x);let C=a.get(x);if(!C)break;x=C.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[o,_]of t.businessMembers.entries())s.has(_.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",o,"sourceMemberKey"],message:"Business member must reference a source member."}),i.has(_.containerKey)||n.addIssue({code:"custom",path:["businessMembers",o,"containerKey"],message:"Business member must reference a placement unit container."});for(let[o,_]of t.placementUnits.entries()){let w=a.get(_.containerKey);w?w.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",o,"containerKey"],message:"Placement unit must reference a direct child of the page container."}):n.addIssue({code:"custom",path:["placementUnits",o,"containerKey"],message:"Placement unit containerKey must reference a source member."});let x=new Set;for(let[C,L]of _.businessMemberKeys.entries()){let M=c.get(L);if(!M){n.addIssue({code:"custom",path:["placementUnits",o,"businessMemberKeys",C],message:"Placement unit must reference existing business members."});continue}x.has(L)&&n.addIssue({code:"custom",path:["placementUnits",o,"businessMemberKeys",C],message:"Placement unit cannot reference the same business member twice."}),x.add(L),M.containerKey!==_.key&&n.addIssue({code:"custom",path:["placementUnits",o,"businessMemberKeys",C],message:"Business member containerKey must match its placement unit."});let H=M.sourceMemberKey,Q=new Set;for(;H&&H!==_.containerKey&&!Q.has(H);)Q.add(H),H=a.get(H)?.containerKey;H!==_.containerKey&&n.addIssue({code:"custom",path:["placementUnits",o,"businessMemberKeys",C],message:"Placement unit business members must belong to its source subtree."})}}for(let[o,_]of t.businessMembers.entries())t.placementUnits.find(x=>x.key===_.containerKey)?.businessMemberKeys.includes(_.key)||n.addIssue({code:"custom",path:["businessMembers",o,"containerKey"],message:"Business member must be listed by its placement unit container."});let f=new Map;for(let o of t.placementUnits)f.set(o.containerKey,(f.get(o.containerKey)??0)+1);for(let[o,_]of t.sourceMembers.entries())_.containerKey===t.container.key&&f.get(_.key)!==1&&n.addIssue({code:"custom",path:["sourceMembers",o,"key"],message:"Every direct source member must be owned by exactly one placement unit."});for(let[o,_]of t.placements.entries())_.routeId!==t.routeId&&n.addIssue({code:"custom",path:["placements",o,"routeId"],message:"Page placement routeId must match page composition routeId."}),_.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",o,"documentVersion"],message:"Page placement version must match page composition version."}),i.has(_.placementUnitKey)||n.addIssue({code:"custom",path:["placements",o,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),xm=u.object({status:u.literal("unsupported"),version:u.number().int().nonnegative(),routeId:u.string().min(1),reason:Gt,diagnostics:u.array(dt)}).strict(),Em=u.discriminatedUnion("status",[ym,xm]),$a=2,hb="page-composition-v2",Ha=u.object({start:u.number().int().nonnegative(),end:u.number().int().nonnegative(),startLine:u.number().int().positive().optional(),startColumn:u.number().int().nonnegative().optional(),endLine:u.number().int().positive().optional(),endColumn:u.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],i=s.some(c=>c!==void 0),a=s.every(c=>c!==void 0);i&&!a&&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."})}),Im=u.object({key:u.string().min(1),instanceIndex:u.number().int().nonnegative().optional(),instanceCount:u.number().int().positive().optional(),textSegmentIndex:u.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."})}),Rm=u.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),Tm=u.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),km=u.discriminatedUnion("kind",[u.object({kind:u.literal("virtual-route-root"),key:u.null(),routeReturn:u.object({sourceIdentity:Ln,sourceRange:Ha}).strict()}).strict(),u.object({kind:u.literal("jsx-container"),key:u.string().min(1),sourceMemberKey:u.string().min(1)}).strict(),u.object({kind:u.literal("starter-placeholder"),key:u.string().min(1),sourceMemberKey:u.string().min(1),replacementMode:u.literal("replace")}).strict()]),vm=u.object({key:u.string().min(1),kind:Rm,parentKey:u.string().min(1).nullable(),childKeys:u.array(u.string().min(1)),order:u.number().int().nonnegative(),label:u.string().min(1),sourceIdentity:Ln,sourceRange:Ha.nullable(),atomicKind:Tm}).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 i=new Set;for(let[a,c]of t.childKeys.entries())i.has(c)&&n.addIssue({code:"custom",path:["childKeys",a],message:`Duplicate child source member key: ${c}`}),i.add(c)}),Am=u.object({key:u.string().min(1),sourceMemberKey:u.string().min(1),placementUnitKey:u.string().min(1),label:u.string().min(1),isIndependent:u.boolean()}).strict(),wm=u.enum(["independent","atomic","container"]),Cm=u.object({key:u.string().min(1),containerKey:u.string().min(1).nullable(),sourceMemberKeys:u.array(u.string().min(1)).min(1),businessMemberKeys:u.array(u.string().min(1)),order:u.number().int().nonnegative(),boundaryMode:wm,isIndependent:u.boolean(),isMultiMember:u.boolean()}).strict().superRefine((t,n)=>{Ba(t.sourceMemberKeys,n,"sourceMemberKeys","source member"),Ba(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 i=t.boundaryMode==="independent";t.isIndependent!==i&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),Pm=u.enum(["before","after","prepend","append","replace"]),Dm=u.enum(["insert-sibling","insert-child","replace-placeholder"]),jm=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),routeId:u.string().min(1),placementUnitKey:u.string().min(1),containerKey:u.string().min(1).nullable(),relation:Pm,writeMode:Dm}).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}.`})}),Om=u.object({key:u.string().min(1),placementUnitKey:u.string().min(1),runtimeRefs:u.array(Im).min(1)}).strict(),Nm=u.object({schemaVersion:u.literal($a),status:u.literal("supported"),version:u.number().int().nonnegative(),routeId:u.string().min(1),container:km,sourceMembers:u.array(vm),businessMembers:u.array(Am),placementUnits:u.array(Cm),placements:u.array(jm),visualAnchors:u.array(Om).optional(),diagnostics:u.array(dt)}).strict().superRefine((t,n)=>{Um(t,n)}),Lm=u.object({schemaVersion:u.literal($a),status:u.literal("unsupported"),version:u.number().int().nonnegative(),routeId:u.string().min(1),reason:Gt,diagnostics:u.array(dt)}).strict(),Mm=u.discriminatedUnion("status",[Nm,Lm]),Sb=u.union([Mm,Em]);function Ba(t,n,s,i){let a=new Set;for(let[c,f]of t.entries())a.has(f)&&n.addIssue({code:"custom",path:[s,c],message:`Duplicate ${i} key: ${f}`}),a.add(f)}function Um(t,n){Re(t.sourceMembers,n,"sourceMembers",x=>x.key,"key"),Re(t.businessMembers,n,"businessMembers",x=>x.key,"key"),Re(t.placementUnits,n,"placementUnits",x=>x.key,"key"),Re(t.placements,n,"placements",x=>x.placementKey,"placementKey"),Re(t.visualAnchors??[],n,"visualAnchors",x=>x.key,"key"),Fm(t,n);let s=new Map(t.sourceMembers.map(x=>[x.key,x])),i=new Map(t.businessMembers.map(x=>[x.key,x])),a=new Map(t.placementUnits.map(x=>[x.key,x]));qm(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 c=new Map,f=new Map,o=new Set;for(let[x,C]of t.placementUnits.entries()){C.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",x,"containerKey"],message:"Placement unit containerKey must match the page container."});let L=`${C.containerKey??"<virtual>"}:${C.order}`;o.has(L)&&n.addIssue({code:"custom",path:["placementUnits",x,"order"],message:"Placement unit order must be unique within its container."}),o.add(L);for(let[M,H]of C.sourceMemberKeys.entries()){s.has(H)||n.addIssue({code:"custom",path:["placementUnits",x,"sourceMemberKeys",M],message:"Placement unit must reference existing source members."});let Q=c.get(H);Q&&Q!==C.key&&n.addIssue({code:"custom",path:["placementUnits",x,"sourceMemberKeys",M],message:`Source member is already assigned to ${Q}.`}),c.set(H,C.key)}for(let[M,H]of C.businessMemberKeys.entries()){let Q=i.get(H);if(!Q){n.addIssue({code:"custom",path:["placementUnits",x,"businessMemberKeys",M],message:"Placement unit must reference existing business members."});continue}Q.placementUnitKey!==C.key&&n.addIssue({code:"custom",path:["placementUnits",x,"businessMemberKeys",M],message:"Placement unit and business member must reference each other."}),C.sourceMemberKeys.includes(Q.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",x,"businessMemberKeys",M],message:"Business member sourceMemberKey must belong to the placement unit."});let tt=f.get(H);tt&&tt!==C.key&&n.addIssue({code:"custom",path:["placementUnits",x,"businessMemberKeys",M],message:`Business member is already assigned to ${tt}.`}),f.set(H,C.key)}}for(let[x,C]of t.businessMembers.entries()){s.has(C.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",x,"sourceMemberKey"],message:"Business member must reference a source member."});let L=a.get(C.placementUnitKey);if(!L){n.addIssue({code:"custom",path:["businessMembers",x,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}L.businessMemberKeys.includes(C.key)||n.addIssue({code:"custom",path:["businessMembers",x,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),L.sourceMemberKeys.includes(C.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",x,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let M=L.isIndependent&&L.businessMemberKeys.length===1;C.isIndependent!==M&&n.addIssue({code:"custom",path:["businessMembers",x,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let _=new Set;for(let[x,C]of t.placements.entries()){C.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",x,"documentVersion"],message:"Page placement version must match page composition version."}),C.routeId!==t.routeId&&n.addIssue({code:"custom",path:["placements",x,"routeId"],message:"Page placement routeId must match page composition routeId."});let L=a.get(C.placementUnitKey);L?C.containerKey!==L.containerKey&&n.addIssue({code:"custom",path:["placements",x,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",x,"placementUnitKey"],message:"Placement option must reference a placement unit."});let M=`${C.placementUnitKey}:${C.relation}`;_.has(M)&&n.addIssue({code:"custom",path:["placements",x,"relation"],message:"A placement unit cannot expose the same relation more than once."}),_.add(M),C.relation==="replace"&&t.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",x,"relation"],message:"replace is only valid for a starter placeholder container."}),t.container.kind==="starter-placeholder"&&C.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",x,"relation"],message:"Starter placeholder placements must use replace."})}let w=new Set;for(let[x,C]of(t.visualAnchors??[]).entries())a.has(C.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",x,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),w.has(C.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",x,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),w.add(C.placementUnitKey)}function Fm(t,n){let s=[];t.container.key!==null&&s.push({key:t.container.key,path:["container","key"],namespace:"container"});for(let[a,c]of t.sourceMembers.entries())s.push({key:c.key,path:["sourceMembers",a,"key"],namespace:"source member"});for(let[a,c]of t.businessMembers.entries())s.push({key:c.key,path:["businessMembers",a,"key"],namespace:"business member"});for(let[a,c]of t.placementUnits.entries())s.push({key:c.key,path:["placementUnits",a,"key"],namespace:"placement unit"});for(let[a,c]of(t.visualAnchors??[]).entries())s.push({key:c.key,path:["visualAnchors",a,"key"],namespace:"visual anchor"});let i=new Map;for(let a of s){let c=i.get(a.key);c?n.addIssue({code:"custom",path:a.path,message:`${a.namespace} key collides with ${c}: ${a.key}`}):i.set(a.key,a.namespace)}}function qm(t,n,s){let i=new Set;for(let[a,c]of t.sourceMembers.entries()){let f=`${c.parentKey??"<root>"}:${c.order}`;if(i.has(f)&&s.addIssue({code:"custom",path:["sourceMembers",a,"order"],message:"Source member order must be unique among siblings."}),i.add(f),c.parentKey===c.key&&s.addIssue({code:"custom",path:["sourceMembers",a,"parentKey"],message:"Source member cannot be its own parent."}),c.parentKey!==null){let w=n.get(c.parentKey);w?w.childKeys.includes(c.key)||s.addIssue({code:"custom",path:["sourceMembers",a,"parentKey"],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",a,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[w,x]of c.childKeys.entries()){if(x===c.key){s.addIssue({code:"custom",path:["sourceMembers",a,"childKeys",w],message:"Source member cannot be its own child."});continue}let C=n.get(x);C?C.parentKey!==c.key&&s.addIssue({code:"custom",path:["sourceMembers",a,"childKeys",w],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",a,"childKeys",w],message:"Source child key must reference a source member."})}let o=new Set,_=c;for(;_;){if(o.has(_.key)){s.addIssue({code:"custom",path:["sourceMembers",a,"parentKey"],message:"Source member graph must be acyclic."});break}o.add(_.key),_=_.parentKey===null?void 0:n.get(_.parentKey)}}}var ut=p.enum(["update-text","update-array-item","remove-node","insert-child","move-node","set-class-name-source","set-props","apply-style-draft","source-edit","insert-page-resource","delete-page-source"]),Ya=p.lazy(()=>p.union([p.string(),p.number(),p.boolean(),p.null(),p.array(Ya),p.record(p.string(),Ya)])),Za=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}),Va,p.object({kind:p.literal("route"),routeId:p.string().min(1)}),p.object({kind:p.literal("source-file"),path:ce}),p.object({kind:p.literal("source-batch"),paths:p.array(ce).min(1)}).superRefine((t,n)=>{let s=new Set;for(let[i,a]of t.paths.entries())s.has(a)&&n.addIssue({code:"custom",path:["paths",i],message:`Duplicate source target path: ${a}`}),s.add(a)}),p.object({kind:p.literal("project")}).strict()]),Qa=p.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"]),Ja=p.enum(["hover","active","focus","disabled"]),ei=p.enum(["sm","md","lg","xl","2xl"]),Xa=p.union([p.object({relation:p.enum(["before","after"]),anchorKey:p.string().min(1)}),p.object({relation:p.enum(["prepend","append"]),parentKey:p.string().min(1)}),Wa]),Gm=p.union([p.object({kind:p.literal("native-tag"),tag:p.string().min(1),text:p.string().optional()}),p.object({kind:p.literal("component-call"),component:p.object({source:p.string().min(1),exportName:p.string().min(1)}),materialization:p.never().optional(),props:p.record(p.string(),p.unknown()).optional()}).strict(),p.object({kind:p.literal("component-call"),component:p.never().optional(),materialization:Le,props:p.record(p.string(),p.never()).optional()}).strict()]),Km=p.discriminatedUnion("kind",[p.object({kind:p.literal("update-text"),segmentIndex:p.number().int().min(0),value:p.string()}),p.object({kind:p.literal("update-array-item"),segmentIndex:p.number().int().min(0),index:p.number().int().min(0),value:p.string()}),p.object({kind:p.literal("remove-node")}),p.object({kind:p.literal("insert-child"),node:Gm,position:p.union([Xa,Mn])}),p.object({kind:p.literal("move-node"),target:Xa,preserveBindings:p.boolean().optional()}),p.object({kind:p.literal("set-class-name-source"),routeId:p.string().min(1).optional(),filePath:p.string().min(1),expectedVersion:p.object({documentVersion:p.number().int().nonnegative(),contentHash:p.string().min(1)}),oldAttrRaw:p.string().min(1).nullable(),oldAttrRange:Fe.nullable(),openingElementRange:Fe,newAttrRaw:p.string().min(1).nullable(),intent:On}),p.object({kind:p.literal("set-props"),props:p.partialRecord(Nn,p.string())}),p.object({kind:p.literal("apply-style-draft"),className:p.object({routeId:p.string().min(1).optional(),filePath:p.string().min(1),expectedVersion:p.object({documentVersion:p.number().int().nonnegative(),contentHash:p.string().min(1)}),oldAttrRaw:p.string().min(1).nullable(),oldAttrRange:Fe.nullable(),openingElementRange:Fe,newAttrRaw:p.string().min(1).nullable(),intent:On}).optional(),props:p.partialRecord(Nn,p.string()).optional()}).superRefine((t,n)=>{!t.className&&!t.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),p.object({kind:p.literal("source-edit"),conflictPolicy:p.enum(["compare-and-swap","overwrite"]),edits:p.array(p.discriminatedUnion("operation",[p.object({operation:p.literal("upsert"),path:ce,content:p.string(),baseContentHash:p.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{bn(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"})}),p.object({operation:p.literal("delete"),path:ce,capability:Zs,confirmDelete:p.literal(!0),confirmPath:ce,baseContentHash:p.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{t.capability!==Sn&&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"}),bn(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let s=fn(t.path);s&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${t.path} (${s})`})})])).min(1),reason:p.string().min(1).optional()}).strict().superRefine((t,n)=>{let s=new Set;for(let[i,a]of t.edits.entries())s.has(a.path)&&n.addIssue({code:"custom",path:["edits",i,"path"],message:`Duplicate source edit path: ${a.path}`}),s.add(a.path),t.conflictPolicy==="compare-and-swap"&&a.baseContentHash===void 0&&n.addIssue({code:"custom",path:["edits",i,"baseContentHash"],message:"source-edit compare-and-swap requires baseContentHash for every edit"})}),p.object({kind:p.literal("insert-page-resource"),artifact:Dn}).strict(),p.object({kind:p.literal("delete-page-source"),expectedUrlPath:p.string().startsWith("/")}).strict()]),ti=p.enum(["NODE_NOT_FOUND","HOME_PAGE_LOCKED","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"]),ni=p.object({code:ti,message:p.string().min(1),details:p.record(p.string(),p.unknown()).optional()}),si=p.object({key:p.string().min(1),instanceIndex:p.number().int().nonnegative().optional(),instanceCount:p.number().int().positive().optional()}),Un=p.object({id:p.string().min(1),siteId:T,baseSnapshotId:R,routeId:p.string().min(1).optional(),kind:ut,target:Za,documentVersion:p.number().int().nonnegative(),selectionRef:si.optional(),mutationContext:lt.optional(),params:Km}).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(a=>a.path),i=t.target.kind==="source-file"?[t.target.path]:t.target.paths;Vm(s,i)||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-page-resource"||t.kind==="delete-page-source"?t.target.kind!=="project"&&n.addIssue({code:"custom",path:["target","kind"],message:`${t.kind} requires a project target`}):t.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project target is only valid for insert-page-resource or delete-page-source"}),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"})}),wb=Un,Bm=p.object({kind:p.literal("insert-page-resource"),package_instance_id:p.string().min(1),pages:p.array(ja).min(1)}).strict().superRefine((t,n)=>{let s=new Set,i=new Set;for(let[a,c]of t.pages.entries())s.has(c.template_page_id)&&n.addIssue({code:"custom",path:["pages",a,"template_page_id"],message:`Duplicate template page route mapping: ${c.template_page_id}`}),i.has(c.final_route)&&n.addIssue({code:"custom",path:["pages",a,"final_route"],message:`Duplicate final route mapping: ${c.final_route}`}),s.add(c.template_page_id),i.add(c.final_route)}),zm=p.object({kind:p.literal("delete-page-source"),deleted_files:p.array(p.string().min(1)),updated_files:p.array(p.string().min(1)),preserved_shared_files:p.array(p.string().min(1)),warnings:p.array(p.string().min(1))}).strict(),Wm=p.discriminatedUnion("kind",[Bm,zm]),ai=p.object({requestId:p.string().min(1),kind:ut,target:Za,resultVersion:p.number().int().nonnegative(),affectedFiles:p.array(p.string().min(1)).optional(),selectionRef:si.optional(),output:Wm.optional()}),Fn=ai.superRefine((t,n)=>{let s=t.kind==="insert-page-resource"||t.kind==="delete-page-source";s&&t.target.kind!=="project"?n.addIssue({code:"custom",path:["target","kind"],message:`${t.kind} result requires a project target`}):!s&&t.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project result target requires a project operation"}),s&&!t.output&&n.addIssue({code:"custom",path:["output"],message:`${t.kind} result requires typed output`}),t.output&&t.output.kind!==t.kind&&n.addIssue({code:"custom",path:["output","kind"],message:"output.kind must match operation kind"})}),Cb=qa({dataSchema:Fn,codeSchema:ti,failureDataSchema:ai.partial()});function Vm(t,n){return t.length===n.length&&t.every((s,i)=>s===n[i])}var $m=z.enum(["component","page","pages"]),Hm=z.object({resource_kind:$m,resource_name:z.string().trim().min(1).max(200),file_count:z.number().int().min(1).max(64),total_bytes:z.number().int().min(0).max(4*1024*1024),content_digest:z.string().regex(/^sha256:[a-f0-9]{64}$/),custom_prompt:z.string().trim().min(1).max(4e3).optional(),final_routes:z.array(z.string().min(1)).max(64)}).strict(),Ym=z.discriminatedUnion("kind",[z.object({kind:z.literal("none")}).strict(),z.object({kind:z.literal("primary"),items:z.array(z.object({label:z.string().trim().min(1).max(120),href:z.string().startsWith("/").max(200)}).strict()).min(1).max(64)}).strict().superRefine((t,n)=>{let s=new Set;for(let[i,a]of t.items.entries())s.has(a.href)&&n.addIssue({code:"custom",path:["items",i,"href"],message:`Duplicate navigation href: ${a.href}`}),s.add(a.href)})]),Xm=z.object({base_snapshot_id:z.string().min(1),operation:Un,navigation_selection:Ym.optional()}).strict().superRefine((t,n)=>{t.base_snapshot_id!==t.operation.baseSnapshotId&&n.addIssue({code:"custom",path:["operation","baseSnapshotId"],message:"Resource operation baseSnapshotId must match base_snapshot_id."})});function Zm(t){return t.kind==="insert-child"&&t.params.kind==="insert-child"&&t.params.node.kind==="component-call"&&"materialization"in t.params.node&&t.params.node.materialization?[t.params.node.materialization]:t.kind==="insert-page-resource"&&t.params.kind==="insert-page-resource"?[...t.params.artifact.components.map(n=>n.materialization),...t.params.artifact.pages.map(n=>n.materialization)]:[]}var ii=z.object({id:z.string().min(1),tenant_id:z.string().min(1),site_id:z.string().min(1),run_id:z.string().min(1).optional(),correlation_id:z.string().min(1).optional(),sent_at:z.string().min(1),type:z.literal("client.resource.operation.create"),payload:z.object({client_message_id:z.string().min(1),display:Hm,transient_resource_input:Xm}).strict()}).strict().superRefine((t,n)=>{let{display:s,transient_resource_input:i}=t.payload;t.site_id!==i.operation.siteId&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","siteId"],message:"Resource operation siteId must match envelope site_id."});let a=s.resource_kind==="component"?"insert-child":"insert-page-resource";i.operation.kind!==a&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","kind"],message:`${s.resource_kind} resources require ${a}.`});let f=Zm(i.operation).flatMap(_=>_.files),o=f.reduce((_,w)=>_+new TextEncoder().encode(w.content).byteLength,0);if(f.length>kn&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate file count limit."}),o>vn&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate content byte limit."}),s.file_count!==f.length&&n.addIssue({code:"custom",path:["payload","display","file_count"],message:"Resource summary file_count must match the transient operation."}),s.total_bytes!==o&&n.addIssue({code:"custom",path:["payload","display","total_bytes"],message:"Resource summary total_bytes must match the transient operation."}),i.operation.kind==="insert-page-resource"&&i.operation.params.kind==="insert-page-resource"){let _=i.operation.params.artifact;_.resource_type!==s.resource_kind&&n.addIssue({code:"custom",path:["payload","display","resource_kind"],message:"Resource summary kind must match the page artifact resource_type."});let w=_.pages.map(x=>x.final_route);(w.length!==s.final_routes.length||w.some((x,C)=>x!==s.final_routes[C]))&&n.addIssue({code:"custom",path:["payload","display","final_routes"],message:"Resource summary final_routes must match the page artifact routes."})}if(i.navigation_selection?.kind==="primary"){let _=new Set(s.final_routes);for(let[w,x]of i.navigation_selection.items.entries())_.has(x.href)||n.addIssue({code:"custom",path:["payload","transient_resource_input","navigation_selection","items",w,"href"],message:"Navigation selection href must reference a final resource route."})}});import{z as E}from"zod";import{z as qn}from"zod";var N=t=>qn.object({code:qn.number().int(),data:t,message:qn.string()});var Qm=["with_website","without_website"],oi=E.enum(Qm),ri=E.string().trim().url().refine(t=>{let n=new URL(t).protocol;return n==="http:"||n==="https:"},{message:"Website must use the http or https protocol."}),Jm=["welcome","website_scan","customer_materials","analysis","diagnosis","strategy","site_build","customer_conversion","growth_loop","growth_dashboard","stage_goal"],gt=E.enum(Jm),el=["company_info","website_crawl","website_basic_info_extract","website_metrics_evaluate","intelligent_analysis","strategy_recommendation"],Gn=E.enum(el),tl=["started","running","succeeded","failed","invalidated"],ci=E.enum(tl),nl=["draft","structure_saved","generating","workspace_ready"],Kn=E.enum(nl),sl=["not_deployed","deploying","deployed"],Bn=E.enum(sl),al=["active","completed"],il=E.enum(al),ol=["completed","current","locked"],rl=E.enum(ol),mi={draft:10,structure_saved:20,generating:30,workspace_ready:40},li={not_deployed:10,deploying:20,deployed:30},pi={active:10,completed:20},di={started:10,running:20,succeeded:30,failed:40,invalidated:50};function Kt(t){return new Map(Object.entries(t).map(([n,s])=>[s,n]))}var cl=Kt(mi),ml=Kt(li),ll=Kt(pi),pl=Kt(di);function Kb(t){let n=cl.get(t);if(!n)throw new Error(`Unknown site build status code: ${t}`);return n}function Bb(t){let n=ml.get(t);if(!n)throw new Error(`Unknown site deployment status code: ${t}`);return n}function zb(t){let n=ll.get(t);if(!n)throw new Error(`Unknown site workflow status code: ${t}`);return n}function Wb(t){let n=pl.get(t);if(!n)throw new Error(`Unknown task execution status code: ${t}`);return n}function Vb(t){return mi[t]}function $b(t){return li[t]}function Hb(t){return pi[t]}function Yb(t){return di[t]}var dl={with_website:[{node_code:"welcome",label:"\u6B22\u8FCE\u542F\u52A8",sort_order:1},{node_code:"website_scan",label:"\u521D\u59CB\u5316\u9700\u6C42\u4E0E\u5B98\u7F51\u626B\u63CF",sort_order:2},{node_code:"analysis",label:"\u667A\u80FD\u5206\u6790",sort_order:3},{node_code:"diagnosis",label:"\u8BCA\u65AD\u62A5\u544A",sort_order:4},{node_code:"strategy",label:"\u7B56\u7565\u4E0E\u5EFA\u8BAE",sort_order:5},{node_code:"site_build",label:"\u5EFA\u7AD9",sort_order:6},{node_code:"customer_conversion",label:"\u5BA2\u6237\u8F6C\u5316",sort_order:7},{node_code:"growth_loop",label:"\u589E\u957F\u95ED\u73AF",sort_order:8},{node_code:"growth_dashboard",label:"\u589E\u957F\u5927\u76D8",sort_order:9},{node_code:"stage_goal",label:"\u9636\u6BB5\u8FD0\u8425\u76EE\u6807",sort_order:10}],without_website:[{node_code:"welcome",label:"\u6B22\u8FCE\u542F\u52A8",sort_order:1},{node_code:"customer_materials",label:"\u5BA2\u6237\u8D44\u6599\u63D0\u4F9B",sort_order:2},{node_code:"analysis",label:"\u667A\u80FD\u5206\u6790",sort_order:3},{node_code:"strategy",label:"\u7B56\u7565\u4E0E\u5EFA\u8BAE",sort_order:4},{node_code:"site_build",label:"\u5EFA\u7AD9",sort_order:5},{node_code:"customer_conversion",label:"\u5BA2\u6237\u8F6C\u5316",sort_order:6},{node_code:"growth_loop",label:"\u589E\u957F\u95ED\u73AF",sort_order:7},{node_code:"growth_dashboard",label:"\u589E\u957F\u5927\u76D8",sort_order:8},{node_code:"stage_goal",label:"\u9636\u6BB5\u8FD0\u8425\u76EE\u6807",sort_order:9}]},ui=E.number().int().min(1),ul=E.object({id:U,flow_type:oi,definition_version:ui,node_code:gt,label:E.string().min(1),sort_order:E.number().int().min(1),is_enabled:E.boolean(),state:rl}),gi=E.object({id:zs,tenant_id:E.string().min(1),site_id:T,workflow_id:Ae,node_code:gt,task_type:Gn,external_task_id:E.string().min(1),execution_status:ci,idempotency_key:E.string().min(1),attempt_no:E.number().int().min(1),superseded_at:E.string().min(1).nullable(),created_at:E.string().min(1),updated_at:E.string().min(1)}),gl=E.object({id:Ae,tenant_id:E.string().min(1),site_id:T,flow_type:oi,website:ri.nullable(),definition_version:ui,current_node_code:gt,status:il,started_at:E.string().min(1),completed_at:E.string().min(1).nullable(),created_at:E.string().min(1),updated_at:E.string().min(1)}),_l=E.object({workflow:gl,menu:E.array(ul),task_refs:E.array(gi),site:E.object({default_locale:ue.optional(),status:Kn,deployment_status:Bn,archived_at:E.string().min(1).nullable(),current_sitemap_id:E.string().nullable().optional(),current_sitemap_version:E.number().int().positive().nullable().optional(),confirmed_sitemap_id:E.string().nullable().optional(),confirmed_sitemap_version:E.number().int().positive().nullable().optional(),structure_confirmed_at:E.string().min(1).nullable().optional(),current_snapshot_id:E.string().nullable(),deployed_url:E.string().url().nullable()}),capabilities:E.object({workflow_task_provider_available:E.boolean()}).optional()}),Xb=N(_l),Zb=N(gi),Qb=E.discriminatedUnion("flow_type",[E.object({flow_type:E.literal("with_website"),website:ri}).strict(),E.object({flow_type:E.literal("without_website"),website:E.null().optional()}).strict()]),Jb=E.object({expected_current_node:gt}).strict(),ef=E.object({expected_current_node:E.literal("stage_goal")}).strict(),tf=E.object({expected_current_node:E.literal("site_build")}).strict(),hl=E.object({node_code:gt,task_type:Gn,external_task_id:E.string().min(1).max(255),idempotency_key:E.string().min(1).max(255)}),nf=hl.extend({workflow_id:Ae}).strict(),sf=E.object({external_task_id:E.string().min(1).max(255),execution_status:ci}),Sl=E.object({previous_external_task_id:E.string().min(1).max(255),external_task_id:E.string().min(1).max(255),idempotency_key:E.string().min(1).max(255)}),af=Sl.extend({workflow_id:Ae}).strict(),bl=E.object({previous_external_task_id:E.string().min(1).max(255),external_task_id:E.string().min(1).max(255),idempotency_key:E.string().min(1).max(255)}),of=bl.extend({workflow_id:Ae}).strict(),rf=E.object({}).strict(),cf=E.object({task_types:E.array(Gn).min(1).max(3)}).strict(),mf=E.object({previous_external_task_id:E.string().min(1).max(255)}).strict();function fl(t){return dl[t]}function lf(t,n){return fl(t).findIndex(s=>s.node_code===n)}function pf(t,n){return t==="website_scan"?n==="website_crawl"||n==="website_basic_info_extract"||n==="website_metrics_evaluate":t==="customer_materials"?n==="company_info":t==="analysis"?n==="intelligent_analysis":t==="strategy"?n==="strategy_recommendation":!1}function df(t,n){if(t===n)return n;if(!{started:["running","succeeded","failed","invalidated"],running:["succeeded","failed","invalidated"],succeeded:["invalidated"],failed:["invalidated"],invalidated:[]}[t].includes(n))throw new Error(`Invalid task execution status transition: ${t} -> ${n}`);return n}function uf(t,n){if(t===n)return n;if(!{draft:["structure_saved"],structure_saved:["generating","draft"],generating:["workspace_ready","structure_saved"],workspace_ready:[]}[t].includes(n))throw new Error(`Invalid site build status transition: ${t} -> ${n}`);return n}import{z as S}from"zod";var zn=S.string().min(1).max(120).regex(/^[a-z][a-z0-9_-]*$/),pe=S.string().min(1).max(120).regex(/^[A-Za-z_][A-Za-z0-9_]*$/),yl=S.enum(["text","select","multi_select","tags","category_list","boolean","number"]),_t=S.string().min(1).max(512).regex(/^\/(?:[^?#]*)$/),xl=S.object({minimum:S.number().finite(),maximum:S.number().finite(),step:S.number().finite().positive()}).strict().refine(t=>t.minimum<t.maximum,{message:"minimum must be less than maximum"}),El=S.string().trim().min(1).max(100),hi=S.array(El).max(5).refine(t=>new Set(t.map(n=>n.toLowerCase())).size===t.length,{message:"popular_terms must be unique ignoring case"}),Sf=S.array(S.string()).max(20).transform(t=>{let n=new Set;return t.map(s=>s.trim()).filter(s=>{if(s.length===0||s.length>100)return!1;let i=s.toLowerCase();return n.has(i)?!1:(n.add(i),!0)}).slice(0,5)}),Si=S.object({filter_enabled:S.boolean(),selected_fields:S.array(pe).max(64),selected_card_fields:S.array(pe).max(64).default([]),popular_terms_enabled:S.boolean().default(!1),popular_terms:hi.optional()}).strict(),Il=S.object({app_slug:zn}).extend(Si.shape).strict(),Wn=S.object({kind:S.literal("product_search_confirmation"),baseline_snapshot_id:R,target_route_id:_t,applications:S.array(S.object({app_slug:zn,label:S.string().min(1).max(200),popular_terms:hi.default([]),current_config:Si.nullable().default(null),affected_routes:S.array(_t).max(64).default([]),fields:S.array(S.object({field_name:pe,label:S.string().min(1).max(200),value_shape:yl,option_count:S.number().int().nonnegative().optional(),filter_meta:xl.optional()}).strict()).max(64)}).strict()).min(1).max(12),current_config:Il.nullable().optional(),affected_routes:S.array(_t).min(1).max(64).optional()}).strict(),Rl=S.object({kind:S.literal("product_search_confirmation"),action:S.enum(["confirm","modify"]),app_slug:zn,filter_enabled:S.boolean(),popular_terms_enabled:S.boolean().default(!1),selected_fields:S.array(pe).max(64),selected_card_fields:S.array(pe).max(64).default([])}).strict().superRefine((t,n)=>{t.filter_enabled&&t.selected_fields.length===0&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must not be empty while filters are enabled"}),new Set(t.selected_fields).size!==t.selected_fields.length&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must be unique"}),new Set(t.selected_card_fields).size!==t.selected_card_fields.length&&n.addIssue({code:"custom",path:["selected_card_fields"],message:"selected_card_fields must be unique"})}),Bt=S.union([Rl,S.object({kind:S.literal("product_search_confirmation"),action:S.literal("cancel")}).strict()]),ht=S.union([S.string().max(255),S.number().finite(),S.boolean()]),Tl=S.object({values:S.array(ht).min(1).max(20).refine(t=>new Set(t.map(n=>`${typeof n}:${String(n)}`)).size===t.length,{message:"values must be unique"})}).strict(),kl=S.object({min:S.number().finite().optional(),max:S.number().finite().optional(),include_unlabeled:S.boolean().optional()}).strict().refine(t=>t.min!==void 0||t.max!==void 0||t.include_unlabeled===!0,{message:"a numeric boundary or include_unlabeled is required"}).refine(t=>t.min===void 0||t.max===void 0||t.min<=t.max,{message:"min must not be greater than max"}),vl=S.object({q:S.string().max(200),page:S.number().int().min(1).max(500),page_size:S.union([S.literal(9),S.literal(20)]),sort:S.enum(["published_at_desc","published_at_asc","product_name_asc","product_name_desc"]),filters:S.record(pe,S.union([Tl,kl])).superRefine((t,n)=>{Object.keys(t).length>12&&n.addIssue({code:"custom",message:"filters must contain at most 12 fields"})}),display_fields:S.array(pe).max(64).default([]),missing_count_fields:S.array(pe).max(12).default([]),relaxation_count_fields:S.array(pe).max(12).default([]),facets:S.array(S.object({field:pe,query:S.string().max(100),page:S.number().int().min(1).max(100),page_size:S.literal(10),include_values:S.array(ht).max(20)}).strict()).max(8)}).strict(),_i=S.object({value:ht,label:S.string().max(200),count:S.number().int().nonnegative()}).strict(),Al=S.union([ht,S.array(ht).max(50)]),wl=S.object({items:S.array(S.object({id:S.number().int().positive(),thumbnail:S.string().max(2048).nullable(),title:S.string().max(300),summary:S.string().max(2e3),category:S.string().max(300).nullable(),field_values:S.record(pe,Al).default({}),url:S.string().min(1).max(2048)}).strict()).max(20),page:S.object({total:S.number().int().nonnegative(),page:S.number().int().positive(),page_size:S.union([S.literal(9),S.literal(20)])}).strict(),facets:S.array(S.object({field:pe,total:S.number().int().nonnegative(),page:S.number().int().positive(),page_size:S.literal(10),values:S.array(_i).max(10),selected_values:S.array(_i).max(20)}).strict()).max(8),missing_counts:S.record(pe,S.number().int().nonnegative()).default({}),relaxation_counts:S.record(pe,S.number().int().nonnegative()).default({})}).strict(),bf=S.object({contract_version:S.literal(1),request:vl,response:wl}).strict();import{z as St}from"zod";var Cl=["deployment_queued","prepare_source","build_artifact","publish_site","site_released","cleanup_release"],Pl=St.enum(Cl),Dl=St.enum(["running","succeeded","failed"]),jl=St.object({code:Pl,status:Dl,message:St.string().trim().min(1)}).strict(),bi=St.array(jl);import{z as P}from"zod";var Ol=P.enum(["pending","running","succeeded","failed"]),Nl=P.object({task_id:P.string().uuid(),site_url:P.string().url(),crawler_task_uuid:P.string().uuid().nullable(),crawler_status:P.enum(["NOT_STARTED","PROCESSING","SUCCEEDED","FAILED"]).nullable(),crawler_total:P.number().int().min(0).max(20),crawler_error_code:P.string().nullable(),crawler_failure_stage:P.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]).nullable(),page_count:P.number().int().min(0).max(20),status:Ol,error:P.string().nullable(),created_at:P.string().min(1),updated_at:P.string().min(1)}),Rf=N(Nl),Vn=P.enum(["existing_site","new_site"]),Ll=P.object({company_task_id:P.string().min(1).max(128),scan_task_id:P.string().min(1).max(128),type:Vn,result:P.object({company_name:P.string().min(1),website:P.string().url().optional(),primary_product:P.string().min(1),current_market:P.string().min(1),qualifications:P.string().min(1),scan_cards:P.record(P.string(),P.object({label:P.string(),value:P.union([P.string(),P.number(),P.boolean(),P.null()]),summary:P.string(),tone:P.enum(["good","warn","bad","unknown"]),status:P.enum(["ok","unknown"])}))})}),Ml=P.object({saved:P.literal(!0),company_task_id:P.string().min(1).max(128),scan_task_id:P.string().min(1).max(128)}),Tf=N(Ml),Ul=P.enum(["snapshot","task"]),Fl=Ll.shape.result.extend({type:Vn}).extend({company_name:P.string(),primary_product:P.string(),current_market:P.string(),qualifications:P.string()}),ql=P.object({site_id:P.string().min(1).max(128),company_task_id:P.string().min(1).max(128),scan_task_id:P.string().min(1).max(128),type:Vn,data_source:Ul,result:Fl}),kf=N(ql.nullable());import{z as m}from"zod";var Cf=m.object({force_refresh:m.boolean().optional(),output_locale:m.string().trim().min(2).max(35).optional()}),Hn=m.enum(["running","succeeded","failed"]),Gl=m.object({agent_id:m.string().min(1),name:m.string().min(1),icon:m.string().min(1),capability:m.string().min(1),data_source:m.string().min(1),output_topics:m.string().min(1)}),Kl=m.object({site_mode:m.enum(["existing_site","new_site"]),scan_required:m.boolean(),scheduled_agent_ids:m.array(m.string().min(1)),omitted_agent_ids:m.array(m.string().min(1)),next_stage:m.enum(["diagnostic_report","strategy"])}),fi=m.object({t:m.string(),d:m.string(),evidence:m.object({from:m.string(),url:m.string().nullable().optional(),value:m.string().nullable().optional()})}),yi=m.enum(["complete","partial","insufficient_data","failed"]),xi=m.enum(["ok","failed","insufficient_data"]),Bl=m.object({agent_id:m.string().min(1),name:m.string().min(1),icon:m.string().min(1),status:xi,topics:m.array(m.object({topic_id:m.string().min(1),status:yi,evidence_refs:m.array(m.string())})).length(3),findings:m.array(fi).max(3),elapsed_ms:m.number().nonnegative(),note:m.string().optional(),error:m.string().optional()}),zl=m.object({total:m.number().int().nonnegative(),ok:m.number().int().nonnegative(),degraded:m.number().int().nonnegative(),total_findings:m.number().int().nonnegative(),elapsed_ms:m.number().nonnegative(),site_mode:m.enum(["existing_site","new_site"]).optional(),scheduled_agent_ids:m.array(m.string()).optional(),omitted_agent_ids:m.array(m.string()).optional(),scheduled:m.number().int().nonnegative().optional(),complete:m.number().int().nonnegative().optional(),partial:m.number().int().nonnegative().optional(),insufficient:m.number().int().nonnegative().optional(),failed:m.number().int().nonnegative().optional(),next_stage:m.enum(["diagnostic_report","strategy"]).optional()}),Wl=m.object({agents_done:m.boolean(),analysis:m.record(m.string(),Bl),step4_scoring_input:m.unknown().optional(),summary:zl}),Vl=m.object({job_id:m.string().min(1),site_id:m.string().min(1),model_version:m.string().min(1),output_locale:m.string().min(2),cached:m.boolean().optional(),status:Hn,result:Wl.nullable().optional(),error:m.string().nullable().optional()}),Pf=N(m.array(Gl)),Df=N(Kl),jf=N(Vl),Of=m.object({agent_id:m.string().min(1),name:m.string().min(1),icon:m.string().min(1),capability:m.string().min(1),data_source:m.string().min(1),output_topics:m.string().min(1)}),Nf=m.object({site_mode:m.enum(["existing_site","new_site"]),scan_required:m.boolean(),scheduled_agent_ids:m.array(m.string().min(1)),omitted_agent_ids:m.array(m.string().min(1)),next_stage:m.enum(["diagnostic_report","strategy"])}),$n=m.object({agent_id:m.string().min(1),name:m.string().min(1),icon:m.string().min(1),status:xi,topics:m.array(m.object({topic_id:m.string().min(1),status:yi,evidence_refs:m.array(m.string())})).length(3),findings:m.array(fi).max(3),elapsed_ms:m.number().nonnegative(),note:m.string().optional(),error:m.string().optional()}),Ei=m.object({total:m.number().int().nonnegative(),ok:m.number().int().nonnegative(),degraded:m.number().int().nonnegative(),total_findings:m.number().int().nonnegative(),elapsed_ms:m.number().nonnegative(),site_mode:m.enum(["existing_site","new_site"]).optional(),scheduled_agent_ids:m.array(m.string()).optional(),omitted_agent_ids:m.array(m.string()).optional(),scheduled:m.number().int().nonnegative().optional(),complete:m.number().int().nonnegative().optional(),partial:m.number().int().nonnegative().optional(),insufficient:m.number().int().nonnegative().optional(),failed:m.number().int().nonnegative().optional(),next_stage:m.enum(["diagnostic_report","strategy"]).optional()}),$l=m.object({agents_done:m.boolean(),analysis:m.record(m.string(),$n),step4_scoring_input:m.unknown().optional(),summary:Ei}),Lf=m.object({job_id:m.string().min(1),tenant_id:m.string().min(1),site_id:m.string().min(1),session_id:m.string().min(1),model_version:m.string().min(1),output_locale:m.string().min(2).optional(),cached:m.boolean().optional(),status:Hn,result:$l.nullable().optional(),error:m.string().nullable().optional()}),Ce=m.object({id:m.number().int().nonnegative()}),Mf=m.discriminatedUnion("event",[Ce.extend({event:m.literal("snapshot"),data:m.object({job_id:m.string().min(1),status:Hn,done:m.number().int().nonnegative(),total:m.number().int().nonnegative(),results:m.array($n)})}),Ce.extend({event:m.literal("preparing_started"),data:m.object({stage:m.literal("baseline")})}),Ce.extend({event:m.literal("preparing_progress"),data:m.object({stage:m.enum(["context","external_evidence"])})}),Ce.extend({event:m.literal("preparing_done"),data:m.object({evidence_count:m.number().int().nonnegative(),rule_count:m.number().int().nonnegative(),degraded_capabilities:m.array(m.string())})}),Ce.extend({event:m.literal("agent_start"),data:m.object({agent_id:m.string().min(1),name:m.string().min(1),icon:m.string().min(1)})}),Ce.extend({event:m.literal("agent_done"),data:$n}),Ce.extend({event:m.literal("done"),data:m.object({agents_done:m.literal(!0),summary:Ei})}),Ce.extend({event:m.literal("failed"),data:m.object({message:m.string().min(1)})})]);import{z as j}from"zod";var Ii=j.enum(["reach","trust","convert","safe"]),ae=j.number().finite(),Hl=j.number().finite().positive(),Yn=["reach","trust","convert","safe"],Yl=17,Xl=j.object({key:Ii,score:ae,pass_score:ae,gap:ae}),Zl=j.object({key:j.string(),title:j.string(),is_redline_option:j.boolean().optional(),score:ae,max_score:Hl,pass_score:ae,passed:j.boolean(),description:j.string()}),Ql=j.object({key:Ii,title:j.string(),alias:j.string(),slogan:j.string(),score:ae,max_score:j.literal(100),pass_score:ae,competitor_average:ae,status:j.enum(["reached","near","not_reached"]),status_name:j.enum(["\u8FBE\u6807","\u63A5\u8FD1","\u672A\u8FBE\u6807"]),summary:j.string(),sub_dimensions:j.array(Zl),red_texts:j.array(j.string()),redline_hit:j.boolean().optional()}),Jl=j.object({id:j.number().int().positive(),task_code:j.string().min(1),rules:j.record(j.string(),j.unknown()),scores_list:j.object({overview:j.object({pass_scores:j.object({reach:ae,trust:ae,convert:ae,safe:ae}),total_score:ae,total_pass_score:ae,score_gap:ae,competitor_average_score:ae,scoring_criteria_text:j.string().min(1),gap_dimensions:j.array(Xl).max(4),overall_passed:j.boolean(),all_scores_passed:j.boolean(),diagnosis_passed:j.boolean(),commitment_eligible:j.boolean(),safe_redline_hit:j.boolean()}),dimensions:j.array(Ql).length(4)}),created_at:j.string().datetime({offset:!0}),updated_time:j.string().datetime({offset:!0})}).superRefine((t,n)=>{ep(t.scores_list.dimensions)||n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include each canonical score dimension."}),t.scores_list.dimensions.reduce((i,a)=>i+a.sub_dimensions.length,0)!==Yl&&n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include 17 subdimensions in total."});for(let[i,a]of t.scores_list.dimensions.entries()){if(a.redline_hit===void 0)continue;let c=a.sub_dimensions.findIndex(f=>f.is_redline_option===void 0);c!==-1&&n.addIssue({code:"custom",path:["scores_list","dimensions",i,"sub_dimensions",c,"is_redline_option"],message:"subdimensions must define is_redline_option when redline_hit is defined."})}}),Gf=N(Jl);function ep(t){let n=t.map(s=>s.key);return n.length===Yn.length&&new Set(n).size===Yn.length&&Yn.every(s=>n.includes(s))}import{z as tp}from"zod";var zf=".i18n.json",zt="translation",Ri=new Set(["__proto__","constructor","prototype"]);function ki(t){if(!Wt(t)||Object.keys(t).length===0)return Pe("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,s]of Object.entries(t)){if(Ri.has(n))return Ti([n]);if(!np(n))return Pe("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!Wt(s))return Pe("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let i=Object.keys(s);if(i.length!==1||i[0]!==zt)return Pe("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let a=s[zt];if(!Wt(a))return Pe("I18N_RESOURCE_TREE_INVALID",`Component i18n translation namespace for ${n} must be an object.`,[n,zt]);let c=[{value:a,path:[n,zt]}];for(;c.length>0;){let f=c.pop();for(let[o,_]of Object.entries(f.value)){let w=[...f.path,o];if(Ri.has(o))return Ti(w);if(typeof _!="string"){if(!Wt(_))return Pe("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",w);c.push({value:_,path:w})}}}}return{success:!0,data:t}}function Wf(t){let n;try{n=JSON.parse(t)}catch{return Pe("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return ki(n)}var Vf=tp.custom(t=>ki(t).success,"Invalid component i18n resources.");function np(t){try{let n=Intl.getCanonicalLocales(t);return n.length===1&&n[0]===t}catch{return!1}}function Wt(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function Ti(t){return Pe("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${t.at(-1)??""}`,t)}function Pe(t,n,s){return{success:!1,error:{code:t,message:n,path:s}}}import{z as me}from"zod";var $t=me.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),sp=me.enum(["direct","proxy","upstream","readonly","unsupported"]),ap=me.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),Vt=me.object({mode:sp,reasonCode:me.string().min(1).optional()}),ip=me.object({kind:ap,message:me.string().min(1)}),Ht=me.object({key:me.string().min(1),canUpdateText:me.boolean(),canInsertChild:me.boolean(),canMove:me.boolean(),canRemove:me.boolean(),editModes:me.object({updateText:Vt.optional(),insertChild:Vt.optional(),move:Vt.optional(),remove:Vt.optional()}).optional(),constraints:me.array(ip)});import{z as Y}from"zod";var ey=Y.discriminatedUnion("type",[Y.object({type:Y.literal("site-edit.document.changed"),siteId:T,snapshotId:R,routeId:Y.string().min(1),version:Y.number().int().nonnegative(),at:Y.string().min(1)}),Y.object({type:Y.literal("site-edit.operation.planned"),siteId:T,operationId:Y.string().min(1),baseSnapshotId:R,changedFiles:Y.array(Y.string().min(1)),at:Y.string().min(1)}),Y.object({type:Y.literal("site-edit.operation.completed"),siteId:T,result:Fn,at:Y.string().min(1)}),Y.object({type:Y.literal("site-edit.operation.failed"),siteId:T,requestId:Y.string().min(1),error:ni,at:Y.string().min(1)}),Y.object({type:Y.literal("site-edit.capability.changed"),siteId:T,routeId:Y.string().min(1),keys:Y.array(Y.string().min(1)),at:Y.string().min(1)})]);import{z as X}from"zod";var sy="durable-history-v1",ay=X.enum(["writable","read-only-recovery","unavailable"]),op=X.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),rp=X.object({code:op,message:X.string().min(1),occurredAt:X.iso.datetime().optional()}).strict(),cp=X.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),vi={revision:X.number().int().nonnegative(),undoDepth:X.number().int().nonnegative(),redoDepth:X.number().int().nonnegative()},mp=X.object({mode:X.literal("writable"),...vi,canUndo:X.boolean(),canRedo:X.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."})}),lp=X.object({mode:X.literal("read-only-recovery"),...vi,canUndo:X.literal(!1),canRedo:X.literal(!1),recoveryDiagnostic:rp}).strict(),pp=X.object({mode:X.literal("unavailable"),revision:X.literal(0),undoDepth:X.literal(0),redoDepth:X.literal(0),canUndo:X.literal(!1),canRedo:X.literal(!1),reason:cp}).strict(),iy=X.discriminatedUnion("mode",[mp,lp,pp]);import{z as ie}from"zod";var dp=ie.string().min(1).refine(t=>!t.startsWith("/")&&!t.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),up=ie.string().regex(/^sha256:[a-f0-9]{64}$/),gp=ie.object({path:dp,operation:ie.enum(["create","update","delete"]),expectedHash:up.optional(),fullContent:ie.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"})}),my=ie.object({siteId:T,baseSnapshotId:R,operationId:ie.string().min(1),reason:ie.string().min(1),patches:ie.array(gp).min(1),changedRouteIds:ie.array(ie.string().min(1)),diagnostics:ie.array(ie.object({code:ie.string().min(1),message:ie.string().min(1),path:ie.string().min(1).optional()})).default([])}).superRefine((t,n)=>{let s=new Set;for(let[i,a]of t.patches.entries())s.has(a.path)&&n.addIssue({code:"custom",path:["patches",i,"path"],message:`Duplicate patch path: ${a.path}`}),s.add(a.path)});var Xn="::repeat-item#";function _p(t,n){return`${t}${Xn}${n}`}function py(t,n){return n.reduce((s,i)=>_p(s,i),t)}function hp(t){if(typeof t!="string"||t.length===0)return null;let n=[],s=t;for(;;){let i=s.lastIndexOf(Xn);if(i<0)break;let a=Number(s.slice(i+Xn.length));if(!Number.isInteger(a)||a<0)return null;n.unshift({repeatIndex:a}),s=s.slice(0,i)}return!s||n.length===0?null:{baseKey:s,parts:n}}function dy(t){return hp(t)?.baseKey??t??null}import{z as r}from"zod";import{z as le}from"zod";var Sp=le.object({placementKey:le.string().min(1),placementUnitKey:le.string().min(1),relation:le.enum(["before","after","prepend","append"])}).strict(),bp=le.object({status:le.literal("supported"),containerKey:le.string().min(1),hasBusinessMembers:le.boolean(),placementUnitKeys:le.array(le.string().min(1)),placements:le.array(Sp)}).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 i=new Set;t.placements.forEach((a,c)=>{i.has(a.placementKey)&&n.addIssue({code:"custom",path:["placements",c,"placementKey"],message:"Render page composition placement keys must be unique."}),i.add(a.placementKey),s.has(a.placementUnitKey)||n.addIssue({code:"custom",path:["placements",c,"placementUnitKey"],message:"Render page composition placement must reference a projected unit."})})}),fp=le.object({status:le.literal("unsupported"),reason:Gt,diagnostics:le.array(dt)}).strict(),Ai=le.discriminatedUnion("status",[bp,fp]);var yp=r.object({canUpdateText:r.boolean(),canInsertChild:r.boolean(),canMove:r.boolean(),canRemove:r.boolean()}),wi=r.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),xp=r.enum(["cms-field","api-field"]),Ep=r.enum(["text","attribute","richtext","repeat-region","component-prop"]),Ip=r.enum(["exact","safe-derived","partial","unknown"]),Rp=r.object({file:r.string().min(1),symbol:r.string().min(1).optional(),reason:r.string().min(1)}),Tp=r.object({sourceKind:wi,sourceType:xp,endpointPattern:r.string().min(1).optional(),operation:r.string().min(1).optional(),collection:r.string().min(1).optional(),fieldPath:r.string().min(1).optional(),valuePath:r.string().min(1).optional(),targetKind:Ep,targetName:r.string().min(1),confidence:Ip,readonly:r.literal(!0),evidence:r.array(Rp)}),Ci=r.object({hasDynamicData:r.boolean(),bindings:r.array(Tp)}),Pi=r.object({hasDynamicData:r.boolean(),sourceKinds:r.array(wi),primaryEndpoint:r.string().min(1).optional(),primaryCollection:r.string().min(1).optional(),primaryFieldPath:r.string().min(1).optional()}),kp=r.object({key:r.string().min(1),pageCompositionUnitKey:r.string().min(1).optional(),operationSummary:yp,dynamicDataSummary:Pi.optional()}).strict(),ky=r.object({siteId:T,snapshotId:R,routeId:r.string().min(1),version:r.number().int().nonnegative(),entries:r.array(kp),pageComposition:Ai}).strict(),Zn=r.enum(["api-field","cms-field","i18n-message","config-entry"]),Di=r.object({kind:r.enum(["literal","binding","imported-binding","repeat-template"]),file:r.string().min(1),expression:r.string().min(1),bindingName:r.string().min(1).optional(),path:r.array(r.union([r.string(),r.number()])).optional()}),Qn=r.object({index:r.number().int().min(0),value:r.string(),editable:r.boolean(),source:Di.nullable()}),bt=r.object({key:r.string().min(1),label:r.string().min(1),tag:r.string().min(1)}),vy=r.object({key:r.string().min(1),canUpdateText:r.boolean(),canInsertChild:r.boolean(),canMove:r.boolean(),canRemove:r.boolean(),boundaryKind:$t.nullable(),isOpaque:r.boolean()}),vp=r.object({kind:r.enum(["jsx-node","component-proxy","value-binding","route-export"]),file:r.string().min(1),componentName:r.string().min(1),isProxy:r.boolean()}),Ap=r.object({kind:r.enum(["jsx-node","value-path","route-export","external-entry"]),file:r.string().min(1).optional(),isProxy:r.boolean(),displayPath:r.string().min(1).optional(),sourceType:Zn.optional(),sourceId:r.string().min(1).optional()}),ji=r.object({kind:r.union([r.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),Zn]),file:r.string().min(1),displayPath:r.string().min(1),externalSource:r.object({sourceType:Zn,sourceId:r.string().min(1),adapterId:r.string().min(1).optional()}).optional()}),wp=r.object({kind:ji.shape.kind,file:r.string().min(1),displayName:r.string().min(1),canEditHere:r.boolean()}),ft=r.object({finalSource:ji.nullable(),chain:r.array(wp),confidence:r.enum(["exact","safe-derived","partial","unknown"]),editMode:r.enum(["direct","proxy","upstream","readonly","unsupported"]),diagnostics:r.array(r.object({code:r.string().min(1),message:r.string().min(1)}))}),Cp=r.object({kind:r.literal("css-style-model"),properties:r.array(r.object({property:Qa,value:r.union([r.string(),r.number(),r.boolean(),r.null()]),resolvedValue:r.union([r.string(),r.number(),r.boolean(),r.null()]).optional(),breakpoint:ei.optional(),state:Ja.optional(),variants:r.array(r.string().min(1)).optional(),options:r.array(r.union([r.string(),r.number()])).optional(),editable:r.boolean(),diagnostics:r.array(r.object({code:r.string().min(1),message:r.string().min(1)})).optional(),operationBoundary:r.array(ut).optional()}))}),Ay=r.union([r.record(r.string(),r.unknown()),Cp]),Oi=r.object({kind:r.literal("class-name-source"),className:r.string(),sourceKind:r.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:r.boolean(),operationBoundary:r.array(ut),sourcePath:r.string().min(1).optional(),diagnostics:r.array(r.object({code:r.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:r.string().min(1)})).optional()}),Pp=r.object({startLine:r.number().int().positive(),startColumn:r.number().int().nonnegative(),endLine:r.number().int().positive(),endColumn:r.number().int().nonnegative()}),Jn=r.object({sourceFile:r.string().min(1),componentName:r.string().min(1),openingElementRange:Pp,structuralPath:r.string().min(1),textPreview:r.string().min(1).optional()}),wy=r.object({key:r.string().min(1),tag:r.string().min(1),componentName:r.string().min(1),sourceFile:r.string().min(1),sourceLocator:Jn.optional(),label:r.string().min(1),capabilities:Ht,writeTarget:vp,effectiveWriteTarget:Ap.optional(),provenanceChain:ft.optional(),componentSemantic:r.record(r.string(),r.unknown()).optional(),contentModel:r.record(r.string(),r.unknown()).optional(),mediaModel:r.record(r.string(),r.unknown()).optional(),styleSource:Oi.optional(),conditional:r.record(r.string(),r.unknown()).optional(),dynamicData:Ci.optional(),textSegments:r.array(Qn),boundaryKind:$t.nullable(),isOpaque:r.boolean(),ancestors:r.array(bt),children:r.array(bt),siblings:r.array(bt)}),Cy=r.object({key:r.string().min(1),tag:r.string().min(1),label:r.string().min(1),sourceLocator:Jn.optional(),capabilities:r.object({constraints:Ht.shape.constraints}),isOpaque:r.boolean(),provenanceChain:r.object({editMode:ft.shape.editMode,diagnostics:ft.shape.diagnostics}).optional(),dynamicDataSummary:Pi.optional(),ancestors:r.array(bt)}),Py=r.object({key:r.string().min(1),tag:r.string().min(1),label:r.string().min(1),sourceLocator:Jn.optional(),isOpaque:r.boolean(),ancestors:r.array(bt),componentName:r.string().min(1),sourceFile:r.string().min(1),capabilities:Ht,provenanceChain:r.object({editMode:ft.shape.editMode,diagnostics:ft.shape.diagnostics}).optional(),textSegments:r.array(r.object({index:Qn.shape.index,editable:Qn.shape.editable,sourceKind:Di.shape.kind.nullable()})),dynamicData:Ci.optional(),boundaryKind:$t.nullable()}),Dy=r.object({key:r.string().min(1),mediaModel:r.record(r.string(),r.unknown()).optional(),styleSource:Oi.optional()});var Dp=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],jp=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],Op=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],Np=new Set(Dp),Lp=new Set(jp),Mp=new Set(Op),Up={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function Oy(t){return Np.has(es(t))}function Fp(t){return Lp.has(es(t))}function qp(t){return Mp.has(es(t))}function Ny(t){let{operationSummary:n}=t;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:t.fallbackMode!=="preview"?{...Up}:{canUpdateText:qp(t.tagName),canInsertChild:Fp(t.tagName),canMove:!1,canRemove:!1}}function es(t){return t?.trim().toLowerCase()??""}import{z as Ni}from"zod";var Fy=Ni.object({routeId:Ni.string().min(1),mutationContext:lt.optional()}).strict();var Gy={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.",PRODUCT_SEARCH_APPLY_NOT_AVAILABLE:"Product search changes aren't available yet. Please try again later.",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."},Ky={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."},By={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},zy={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var Li="0.6.10",Vy="x-vcp-edit-engine-version",$y="x-vcp-edit-engine-version-source",ts=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},Gp=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function Kp(t){return Gp.test(t)}function Bp(t){if(typeof t!="string"||!Kp(t))throw new ts;return t}function Hy(t){return t==null?{version:Li,source:"fallback_current"}:{version:Bp(t),source:"explicit"}}function Yy(){return{version:Li,source:"system_current"}}import{z as J}from"zod";var zp=J.enum(["active","paused","blocked"]),Mi=J.enum(["typecheck_failed","health_failed","validation_failed"]),Wp={status:zp,attempts:J.number().int().nonnegative(),attempted_template_version:be.nullable(),last_error_code:Mi.nullable()},Ve=J.object(Wp).strict(),Yt=J.object({template_id:J.string().trim().min(1),target_template_version:be}).strict(),Jy=Yt,Vp=J.discriminatedUnion("action",[J.object({action:J.literal("proceed"),state:Ve.extend({status:J.literal("active")})}).strict(),J.object({action:J.literal("skip_not_newer"),state:Ve.extend({status:J.literal("active")})}).strict(),J.object({action:J.literal("skip_paused"),state:Ve.extend({status:J.literal("paused")})}).strict(),J.object({action:J.literal("skip_blocked"),state:Ve.extend({status:J.literal("blocked")})}).strict()]),ex=Yt,tx=Vp,nx=Yt.extend({error_code:Mi}),sx=J.object({state:Ve}).strict(),ax=Yt,ix=J.object({state:Ve}).strict();import{z as O}from"zod";var $p=744*60*60*1e3,Hp=O.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),Yp=O.enum(["typecheck","build","health","validation"]),Xp=O.enum(["not_attempted","promoted","aborted"]),lx=O.object({template_id:O.string().trim().min(1).max(128),from_version:be.nullable(),to_version:be,outcome:Hp,attempt:O.number().int().nonnegative().max(2147483647),duration_ms:O.number().int().nonnegative().max(2147483647),replaced_group_count:O.number().int().nonnegative().max(2147483647),skipped_group_count:O.number().int().nonnegative().max(2147483647),validation_stage:Yp.nullable(),cas_outcome:Xp.nullable()}).strict(),px=O.object({recorded:O.literal(!0)}).strict(),Ui=O.object({from:O.iso.datetime(),to:O.iso.datetime()}).strict().refine(({from:t,to:n})=>Date.parse(t)<Date.parse(n),{message:"from must be earlier than to",path:["to"]}).refine(({from:t,to:n})=>Date.parse(n)-Date.parse(t)<=$p,{message:"report window must not exceed 31 days",path:["to"]}),dx=Ui,Zp=O.object({eligible:O.number().int().nonnegative(),fast_path:O.number().int().nonnegative(),upgraded:O.number().int().nonnegative(),skipped:O.number().int().nonnegative(),lock_skipped:O.number().int().nonnegative(),cas_aborted:O.number().int().nonnegative(),validation_failed:O.number().int().nonnegative(),blocked:O.number().int().nonnegative(),paused:O.number().int().nonnegative()}).strict(),ux=O.object({window:Ui,outcome_counts:Zp,current_state_counts:O.object({blocked:O.number().int().nonnegative(),paused:O.number().int().nonnegative()}).strict(),duration_ms:O.object({p50:O.number().int().nonnegative().nullable(),p95:O.number().int().nonnegative().nullable(),sample_count:O.number().int().nonnegative()}).strict()}).strict(),gx=O.object({older_than:O.iso.datetime(),limit:O.coerce.number().int().min(1).max(200).default(50),include_candidates:O.enum(["true","false"]).default("false").transform(t=>t==="true")}).strict(),Qp=O.object({site_id:T,snapshot_id:R,status:O.enum(["candidate","deleting"]),created_at:O.iso.datetime()}).strict(),_x=O.object({snapshots:O.array(Qp)}).strict();import{z as Te}from"zod";var Jp=Te.enum(["PREVIEW_SESSION_NOT_FOUND","PREVIEW_SESSION_INVALID","PREVIEW_SESSION_LOOKUP_FAILED","PREVIEW_SANDBOX_NOT_FOUND","PREVIEW_SANDBOX_CONNECT_FAILED","PREVIEW_SERVER_START_FAILED","PREVIEW_HEALTH_CHECK_FAILED","SANDBOX_NOT_CONFIGURED"]),ed=Te.object({status:Te.literal("ready"),preview_url:Te.string().url()}).strict(),td=Te.object({status:Te.literal("failed"),code:Jp,message:Te.string().min(1),retryable:Te.boolean()}).strict(),bx=Te.discriminatedUnion("status",[ed,td]);import{z as Se}from"zod";var ee=t=>Se.string().trim().max(t),Fi=Se.array(Se.string().trim().min(1).max(120)).max(20),nd=Se.object({company_name:Se.string().trim().min(1).max(200),brand_name:ee(200),primary_products:Se.string().trim().min(1).max(1e3),industry:ee(200),applications:ee(1e3),business_summary:ee(2e3),registered_capital:ee(200).default(""),legal_representative:ee(200).default(""),target_markets:Fi,customer_industries:ee(1e3),customer_roles:ee(1e3),buying_scenarios:ee(2e3),differentiators:ee(2e3),competitors:ee(1e3),trust_proof:ee(2e3),customer_cases:ee(3e3),channels:Fi,expected_domain:ee(255),brand_tone:ee(500),contact_name:ee(200),contact_info:ee(500),timezone:ee(100),launch_timing:ee(200),input_source_ids:Se.array(U).max(50)}).strict(),sd=Se.enum(["draft","submitted"]),ns=nd.extend({id:U,tenant_id:Se.string().min(1),site_id:T,workflow_id:Ae,status:sd,submitted_at:Se.string().min(1).nullable(),created_at:Se.string().min(1),updated_at:Se.string().min(1)}).strict(),Ix=N(ns),Rx=N(ns),Tx=N(ns.nullable());import{z as I}from"zod";var ad=["forest","navy","steel","webblue","webgreen","webviolet"],id=["forest","navy","steel"],od=["webblue","webgreen","webviolet"],ss=I.enum(ad),Xt=I.enum(id),wx=I.enum(od),as=I.object({primary:I.string().regex(/^#[0-9A-F]{6}$/),accent:I.string().regex(/^#[0-9A-F]{6}$/),ink:I.string().regex(/^#[0-9A-F]{6}$/)}).strict(),rd=[{id:"forest",name:"\u5DE5\u4E1A\u58A8\u7EFF \xB7 Industrial Teal",description:"\u6C89\u7A33\u4E13\u4E1A\uFF0C\u7A81\u51FA\u7CBE\u5BC6\u4E0E\u53EF\u4FE1\u3002",colors:{primary:"#0E7C6F",accent:"#2F6FED",ink:"#0F1B2D"}},{id:"navy",name:"\u79D1\u6280\u6DF1\u84DD \xB7 Deep Tech Blue",description:"\u7406\u6027\u79D1\u6280\u611F\uFF0C\u5F3A\u8C03\u6280\u672F\u5B9E\u529B\u4E0E\u6570\u636E\u53EF\u4FE1\u3002",colors:{primary:"#1E3A8A",accent:"#2F6FED",ink:"#0F1B2D"}},{id:"steel",name:"\u7CBE\u5BC6\u94F6\u7070 \xB7 Precision Steel",description:"\u514B\u5236\u6E05\u6670\uFF0C\u9002\u5408\u53C2\u6570\u4E0E\u5DE5\u7A0B\u7EC6\u8282\u8868\u8FBE\u3002",colors:{primary:"#475569",accent:"#94A3B8",ink:"#111827"}},{id:"webblue",name:"\u6807\u51C6\u84DD \xB7 Classic Blue",description:"\u901A\u7528\u53EF\u9760\uFF0C\u9002\u5408\u6280\u672F\u4E0E\u670D\u52A1\u578B\u5B98\u7F51\u3002",colors:{primary:"#2563EB",accent:"#60A5FA",ink:"#0F1B2D"}},{id:"webgreen",name:"\u6807\u51C6\u7EFF \xB7 Fresh Green",description:"\u660E\u5FEB\u6E05\u65B0\uFF0C\u9002\u5408\u73AF\u4FDD\u3001\u65B0\u80FD\u6E90\u4E0E\u519C\u4E1A\u98DF\u54C1\u3002",colors:{primary:"#15803D",accent:"#4ADE80",ink:"#0F1B2D"}},{id:"webviolet",name:"\u6807\u51C6\u7D2B \xB7 Modern Violet",description:"\u73B0\u4EE3\u9C9C\u660E\uFF0C\u9002\u5408\u521B\u65B0\u4E0E\u54C1\u724C\u53D9\u4E8B\u3002",colors:{primary:"#7C3AED",accent:"#A78BFA",ink:"#0F1B2D"}}];function Cx(t){let n=rd.find(s=>s.id===t);if(!n)throw new Error(`Unknown Step6 theme: ${t}`);return n}var cd=["system","inter","grotesk","serif","plex","glow"],Zt=I.enum(cd),qi=["pro","fade","para","slide","none"],yt=I.enum(qi),Gi=["std","compact","airy","magazine"],xt=I.enum(Gi),fe=I.string().trim().min(1).max(240),Ki=I.string().datetime({offset:!0}),md=I.object({id:ss,rank:I.number().int().min(1).max(6),name:I.string().trim().min(1).max(120),description:I.string().trim().min(1).max(240),colors:as,reason:fe.optional()}).strict(),Bi=I.tuple([Xt,Xt,Xt]).refine(t=>new Set(t).size===3,"AI theme IDs must be unique"),ld=I.tuple([I.literal("webblue"),I.literal("webgreen"),I.literal("webviolet")]),pd=I.object({primary_id:Xt,ai_candidate_ids:Bi,standard_candidate_ids:ld,candidates:I.array(md).length(6),font:I.object({recommended_id:Zt,reason:fe}).strict()}).strict().superRefine((t,n)=>{t.primary_id!==t.ai_candidate_ids[0]&&n.addIssue({code:"custom",path:["primary_id"],message:"primary_id must be the first AI candidate."});let s=t.candidates.map(a=>a.id),i=[...t.ai_candidate_ids,...t.standard_candidate_ids];(s.length!==new Set(s).size||s.some((a,c)=>a!==i[c]))&&n.addIssue({code:"custom",path:["candidates"],message:"Candidates must be AI-ranked themes followed by fixed standard themes."})}),dd=I.object({id:yt,name:I.string().trim().min(1).max(120),description:I.string().trim().min(1).max(240)}).strict(),ud=I.object({id:xt,name:I.string().trim().min(1).max(120),description:I.string().trim().min(1).max(240)}).strict(),gd=I.object({recommended_id:yt,options:I.array(dd).length(5),reason:fe}).strict().refine(t=>t.options.map(n=>n.id).join(",")===qi.join(","),"Animation options must include the complete fixed catalog."),_d=I.object({recommended_id:xt,options:I.array(ud).length(4),reason:fe}).strict().refine(t=>t.options.map(n=>n.id).join(",")===Gi.join(","),"Density options must include the complete fixed catalog."),zi=I.object({version:I.number().int().min(1),recommendation_id:I.string().uuid(),theme_id:ss,colors:as,colors_custom:I.boolean(),font_id:Zt,font_changed:I.boolean(),animation_id:yt,density_id:xt,updated_at:Ki}).strict(),hd=I.object({id:I.string().uuid(),version:I.number().int().min(1),catalog_version:I.string().trim().min(1).max(80),source:I.object({mode:I.enum(["ai","fallback"]),fallback_reason:I.string().trim().min(1).max(80).nullable()}).strict(),inputs:I.object({industry:I.string().trim().min(1).max(160).optional(),site_language:I.string().trim().min(2).max(35),strategy_version:I.number().int().min(1),input_digest:I.string().regex(/^sha256:[a-f0-9]{64}$/)}).strict(),theme:pd,animation:gd,density:_d,generated_at:Ki}).strict(),Px=I.object({force_refresh:I.boolean().optional()}).strict(),Dx=I.object({request_id:I.string().trim().min(1).max(160),site_id:T,cached:I.boolean(),recommendation:hd,selection:zi}).strict(),jx=I.object({recommendation_id:I.string().uuid(),expected_version:I.number().int().min(1),theme_id:ss,colors:as,font_id:Zt,animation_id:yt,density_id:xt}).strict(),Ox=I.object({selection:zi}).strict(),Nx=I.object({tenant_id:I.string().trim().min(1).max(160),site_id:T,site_language:I.string().trim().min(2).max(35),industry:I.string().trim().min(1).max(160).optional(),strategy_version_id:I.string().uuid(),strategy_version:I.number().int().min(1),strategy_checksum:I.string().regex(/^[a-f0-9]{64}$/),strategy_summary:I.array(I.string().trim().min(1).max(500)).min(1).max(12)}).strict(),Lx=I.object({theme_candidate_ids:Bi,theme_reasons:I.object({forest:fe.optional(),navy:fe.optional(),steel:fe.optional()}).strict(),font_id:Zt,font_reason:fe,animation_id:yt,animation_reason:fe,density_id:xt,density_reason:fe}).strict().superRefine((t,n)=>{for(let s of t.theme_candidate_ids)t.theme_reasons[s]||n.addIssue({code:"custom",path:["theme_reasons",s],message:"Each selected AI theme requires a short reason."})}),Sd={system:{heading:"Inter",body:"Inter"},inter:{heading:"Inter",body:"Inter"},grotesk:{heading:"Space Grotesk",body:"Inter"},serif:{heading:"Playfair Display",body:"Source Sans 3"},plex:{heading:"IBM Plex Sans",body:"IBM Plex Sans"},glow:{heading:"Noto Sans SC",body:"Noto Sans SC"}};function Mx(t){let n={std:"comfortable",compact:"compact",airy:"airy",magazine:"editorial"},s={none:"none",pro:"subtle",fade:"subtle",slide:"moderate",para:"expressive"};return{colorSeeds:{primary:t.colors.primary,accent:t.colors.accent,neutral:t.colors.ink},fonts:Sd[t.font_id],density:n[t.density_id],motionLevel:s[t.animation_id],motionPreset:t.animation_id}}import{z as G}from"zod";var bd=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],Wi=G.object({name:G.string().min(1).max(100),type:G.enum(bd),label:G.string().min(1).max(255),required:G.boolean().optional(),options:G.array(G.string()).optional()}),qx=G.object({name:G.string(),cms_type:G.string(),label:G.string().optional(),required:G.boolean().optional(),value_shape:G.string().optional(),front_display:G.enum(["visible","internal","forbidden"]).optional(),choices:G.array(G.object({value:G.union([G.string(),G.number()]),label:G.string()})).optional()}),Gx=G.object({route_file_path:G.string().min(1),target_component_path:G.string().min(1),content_type_hint:G.string().min(1),collection_purpose:G.enum(["generic","product"]).optional(),required_fields:G.array(Wi).optional(),mode:G.enum(["bind_existing","provision"]),list_mode:G.enum(["page","embedded"]).optional(),fields:G.array(Wi).optional(),seed_records:G.array(G.record(G.string(),G.unknown())).optional()});import{z as te}from"zod";var Et=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number","file"],fd=te.object({name:te.string().min(1).max(100),type:te.enum(Et),label:te.string().min(1).max(255),required:te.boolean().optional(),options:te.array(te.string()).optional()}),yd=te.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),zx=te.object({mode:te.enum(["bind_existing","provision"],{error:'mode is required. Use "bind_existing" or "provision". Never call connect_form with {}.'}),form_hint:te.string().min(1).optional(),name:te.string().min(1).max(255).optional(),component_slug:yd,description:te.string().min(1).max(1e3).optional(),fields:te.array(fd).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"})}),Wx=te.object({name:te.string(),label:te.string(),cms_type:te.string(),required:te.boolean()});import{z as l}from"zod";var It=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,He=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,Qt=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,Yi=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,os=/^[a-z][a-z0-9-]{0,99}$/,Xi=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,Vi=2,$i=3,Jt=l.string().regex(It),xd=l.string().regex(It),rs=l.string().regex(It),Rt=l.string().regex(Qt),cs=l.string().regex(Yi),Ed=l.discriminatedUnion("status",[l.object({status:l.literal("unbound"),form_code:l.null()}).strict(),l.object({status:l.literal("bound"),form_code:l.string().regex(He)}).strict(),l.object({status:l.literal("missing"),form_code:l.string().regex(He)}).strict()]),Id=l.object({value:cs,label:l.string().trim().min(1).max(255)}).strict(),Rd=l.object({kind:l.literal("field"),field_name:Rt,type:l.enum(Et),label:l.string().trim().min(1).max(255),required:l.boolean(),span:l.enum(["full","half"]),options:l.array(Id).max(100),max_files:l.number().int().min(1).max(5).optional()}).strict(),Td=l.object({kind:l.literal("step-break"),step_id:l.string().regex(It)}).strict(),kd=l.discriminatedUnion("kind",[Rd,Td]),vd=l.object({field_name:Rt,type:l.enum(Et),last_label:l.string().max(255)}).strict(),Ad=l.object({field_name:Rt,value:cs,last_label:l.string().max(255)}).strict(),wd=l.discriminatedUnion("kind",[l.object({kind:l.literal("custom")}).strict(),l.object({kind:l.literal("template"),slug:l.string().regex(os),version:l.string().regex(Xi)}).strict()]),Cd={select:2,radio:2,multiselect:1,DropdownSelection:2,RadioButton:2,Checkbox:1};function ye(t){return t.toLowerCase()}function Zi(t,n){return t.trim().toLocaleLowerCase(n)}function $e(t,n){return`${ye(t)}\0${n}`}function ne(t,n,s,i){let a=new Set;for(let c of t){if(a.has(c)){i.addIssue({code:"custom",path:n,message:s});return}a.add(c)}}function ms(t,n,s,i){let a=Cd[t]??0;a>0&&n<a?i.addIssue({code:"custom",path:s,message:`choice field requires at least ${a} option${a===1?"":"s"}`}):a===0&&n>0&&i.addIssue({code:"custom",path:s,message:"non-choice fields must use an empty options array"})}var ls=l.object({schema_version:l.literal(1),min_runtime_version:l.number().int().positive(),form_definition_id:Jt,binding:Ed,content_locale:ue,features:l.object({multistep:l.boolean()}).strict(),copy:l.object({title:l.string().max(255),description:l.string().max(1e3),submit_button:l.string().trim().min(1).max(100),success_message:l.string().trim().min(1).max(500),error_message:l.string().max(500)}).strict(),layout:l.object({columns:l.enum(["one","two"])}).strict(),nodes:l.array(kd).min(1).max(200),source:wd,retired:l.object({fields:l.array(vd).max(1e3),options:l.array(Ad).max(5e3)}).strict(),compatibility:l.object({standardization_version:l.number().int().positive(),diagnostics:l.array(l.string().trim().min(1).max(500)).max(100)}).strict()}).strict().superRefine((t,n)=>{let s=t.nodes.flatMap((o,_)=>o.kind==="field"?[[_,o]]:[]),i=s.map(([,o])=>o);i.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"at least one field node is required"});let a=t.nodes.filter(o=>o.kind==="step-break");!t.features.multistep&&a.length>0&&n.addIssue({code:"custom",path:["nodes"],message:"step-break requires the multistep feature"}),t.features.multistep&&(t.min_runtime_version<Vi&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${Vi}`}),a.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"multistep requires at least one step-break"}));for(let[o,_]of t.nodes.entries())_.kind==="step-break"&&(o===0||o===t.nodes.length-1||t.nodes[o-1]?.kind==="step-break"||t.nodes[o+1]?.kind==="step-break")&&n.addIssue({code:"custom",path:["nodes",o],message:"step-break must separate two non-empty steps"});ne(a.map(o=>o.step_id),["nodes"],"step_id must be unique",n),ne(i.map(o=>ye(o.field_name)),["nodes"],"field_name must be unique",n),ne(t.retired.fields.map(o=>ye(o.field_name)),["retired","fields"],"retired field_name must be unique",n);let c=new Set(t.retired.fields.map(o=>ye(o.field_name)));for(let[o,_]of s)c.has(ye(_.field_name))&&n.addIssue({code:"custom",path:["nodes",o,"field_name"],message:"retired field_name cannot be reused"}),ms(_.type,_.options.length,["nodes",o,"options"],n),_.type==="file"?t.min_runtime_version<$i&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`file fields require runtime version ${$i}`}):_.max_files!==void 0&&n.addIssue({code:"custom",path:["nodes",o,"max_files"],message:"max_files is only valid for file fields"}),ne(_.options.map(w=>w.value),["nodes",o,"options"],"option value must be unique within a field",n),ne(_.options.map(w=>Zi(w.label,t.content_locale)),["nodes",o,"options"],"option label must be unique within a field",n);ne(t.retired.options.map(o=>$e(o.field_name,o.value)),["retired","options"],"retired option identity must be unique",n);let f=new Set(t.retired.options.map(o=>$e(o.field_name,o.value)));for(let[o,_]of s)for(let[w,x]of _.options.entries())f.has($e(_.field_name,x.value))&&n.addIssue({code:"custom",path:["nodes",o,"options",w,"value"],message:"retired option value cannot be reused"})});function Qx(t,n){let s=[],i=t.nodes.filter(o=>o.kind==="field"),a=new Map(n.nodes.filter(o=>o.kind==="field").map(o=>[ye(o.field_name),o])),c=new Map(n.retired.fields.map(o=>[ye(o.field_name),o])),f=new Map(n.retired.options.map(o=>[$e(o.field_name,o.value),o]));for(let o of i){let _=ye(o.field_name),w=a.get(_),x=c.get(_);w&&w.field_name!==o.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:o.field_name}),w&&w.type!==o.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:o.field_name}),!w&&x&&x.field_name!==o.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:o.field_name}),!w&&x&&x.type!==o.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:o.field_name}),!w&&!c.has(_)&&s.push({code:"FIELD_RETIREMENT_MISSING",field_name:o.field_name});let C=new Set(w?.options.map(L=>L.value)??[]);for(let L of o.options){let M=f.get($e(o.field_name,L.value));!C.has(L.value)&&M&&M.field_name!==o.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:o.field_name}),!C.has(L.value)&&!M&&s.push({code:"OPTION_RETIREMENT_MISSING",field_name:o.field_name,value:L.value})}}for(let o of t.retired.fields){let _=c.get(ye(o.field_name));_&&_.field_name!==o.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:o.field_name}),_&&_.type!==o.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:o.field_name}),_||s.push({code:"FIELD_RETIREMENT_MISSING",field_name:o.field_name})}for(let o of t.retired.options){let _=f.get($e(o.field_name,o.value));_&&_.field_name!==o.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:o.field_name}),_||s.push({code:"OPTION_RETIREMENT_MISSING",field_name:o.field_name,value:o.value})}return s}var Pd=l.enum(it),De=l.object({english:l.string().max(1e3),translations:l.partialRecord(Pd,l.string().max(1e3)).optional()}).strict(),Dd=l.object({template_option_key:l.string().regex(Yi),label:De}).strict(),jd=l.object({template_field_key:l.string().regex(Qt),type:l.enum(Et),label:De,required:l.boolean(),span:l.enum(["full","half"]),options:l.array(Dd).max(100)}).strict(),Od=l.object({template_step_key:l.string().regex(Qt),after_field_key:l.string().regex(Qt)}).strict(),Jx=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],eE=[1,1,1,1,1,1],Qi=l.string().regex(os),Nd=l.object({schema_version:l.literal(1),slug:Qi,name:De,template_count:l.number().int().min(0).max(500)}).strict().superRefine((t,n)=>{t.name.english.trim()===""&&n.addIssue({code:"custom",path:["name","english"],message:"English category name is required"})}),Ld=l.object({schema_version:l.literal(1),slug:l.string().regex(os),version:l.string().regex(Xi),category:Qi,copy:l.object({title:De,description:De,submit_button:De,success_message:De,error_message:De}).strict(),layout:l.object({columns:l.enum(["one","two"])}).strict(),fields:l.array(jd).min(1).max(200),step_breaks:l.array(Od).max(20).optional()}).strict().superRefine((t,n)=>{for(let c of["title","description","submit_button","success_message","error_message"])t.copy[c].english.trim()===""&&n.addIssue({code:"custom",path:["copy",c,"english"],message:"English baseline text is required"});ne(t.fields.map(c=>c.template_field_key),["fields"],"template_field_key must be unique",n);let s=new Map(t.fields.map((c,f)=>[c.template_field_key,f])),i=t.step_breaks??[];ne(i.map(c=>c.template_step_key),["step_breaks"],"template_step_key must be unique",n),ne(i.map(c=>c.after_field_key),["step_breaks"],"step breaks must not share an anchor field",n);let a=-1;for(let[c,f]of i.entries()){let o=s.get(f.after_field_key);o===void 0||o>=t.fields.length-1?n.addIssue({code:"custom",path:["step_breaks",c,"after_field_key"],message:"step break must follow an existing non-final field"}):o<=a&&n.addIssue({code:"custom",path:["step_breaks",c,"after_field_key"],message:"step breaks must follow field order"}),a=o??a}t.fields.length+i.length>200&&n.addIssue({code:"custom",path:["step_breaks"],message:"template fields and step breaks must not exceed 200 nodes"});for(let[c,f]of t.fields.entries()){f.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",c,"label","english"],message:"English field label is required"}),ms(f.type,f.options.length,["fields",c,"options"],n),ne(f.options.map(o=>o.template_option_key),["fields",c,"options"],"template_option_key must be unique within a field",n),ne(f.options.map(o=>o.label.english.trim().toLowerCase()),["fields",c,"options"],"English option labels must be unique within a field",n);for(let[o,_]of f.options.entries())_.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",c,"options",o,"label","english"],message:"English option label is required"})}}),tE=l.object({schema_version:l.literal(1),visibility:l.enum(["internal","public"]),categories:l.array(Nd).max(500),templates:l.array(Ld).max(500)}).strict().superRefine((t,n)=>{let s=(a,c)=>{let f=it.filter(o=>!a.translations?.[o]?.trim());f.length>0&&n.addIssue({code:"custom",path:[...c,"translations"],message:`public template copy is missing locales: ${f.join(", ")}`})};ne(t.categories.map(a=>a.slug),["categories"],"template category slug must be unique",n);let i=new Set(t.categories.map(a=>a.slug));for(let[a,c]of t.categories.entries()){let f=t.templates.filter(o=>o.category===c.slug).length;c.template_count!==f&&n.addIssue({code:"custom",path:["categories",a,"template_count"],message:"template_count must match catalog templates"})}ne(t.templates.map(a=>a.slug),["templates"],"template slug must be unique",n);for(let[a,c]of t.templates.entries())i.has(c.category)||n.addIssue({code:"custom",path:["templates",a,"category"],message:"template category must exist in catalog categories"});if(t.visibility==="public"){for(let[a,c]of t.categories.entries())s(c.name,["categories",a,"name"]);for(let[a,c]of t.templates.entries()){for(let[f,o]of Object.entries(c.copy))s(o,["templates",a,"copy",f]);for(let[f,o]of c.fields.entries()){s(o.label,["templates",a,"fields",f,"label"]);for(let[_,w]of o.options.entries())s(w.label,["templates",a,"fields",f,"options",_,"label"])}}}});function nE(t,n){let s=aa(n),i=s?t.translations?.[s]:void 0;return i!==void 0&&i.trim()!==""?i:t.english}var Md=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num","MultipleFile","SpecificFile"],Ud={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num",file:"MultipleFile"},Fd=l.object({value:cs,label:l.string().trim().min(1).max(255)}).strict(),qd=l.object({field_name:Rt,field_type:l.enum(Md),field_label:l.string().trim().min(1).max(255),is_required:l.boolean(),sort_order:l.number().int().nonnegative(),options:l.array(Fd).max(100)}).strict(),Ji=l.object({version:l.literal(1),locale:ue,fields:l.array(qd).min(1).max(200)}).strict().superRefine((t,n)=>{ne(t.fields.map(s=>ye(s.field_name)),["fields"],"field_name must be unique",n);for(let[s,i]of t.fields.entries())ms(i.field_type,i.options.length,["fields",s,"options"],n),ne(i.options.map(a=>a.value),["fields",s,"options"],"option value must be unique within a field",n),ne(i.options.map(a=>Zi(a.label,t.locale)),["fields",s,"options"],"option label must be unique within a field",n)});function sE(t){let n=t.nodes.filter(s=>s.kind==="field").map((s,i)=>({field_name:s.field_name,field_type:s.type==="file"&&s.max_files===1?"SpecificFile":Ud[s.type],field_label:s.label,is_required:s.required,sort_order:i,options:s.options.map(a=>({...a}))}));return Ji.parse({version:1,locale:t.content_locale,fields:n})}var Z=l.string().regex(/^sha256:[0-9a-f]{64}$/),Gd=l.union([ce,l.enum(["app/api/forms/[code]/route.ts","hooks/use-cms-form-submit.ts","lib/cms/forms.ts","lib/cms/client.ts"])]),Kd=l.object({path:Gd,content_hash:Z.nullable()}).strict(),Bd=l.array(Kd).min(1).max(500).superRefine((t,n)=>{ne(t.map(s=>s.path),[],"affected file paths must be unique",n)}),ps=l.object({grade:l.enum(["standard","A","B","C"]),required:l.boolean(),pending_confirmations:l.array(l.object({item_id:l.string().regex(It),field_name:Rt.optional(),kind:l.enum(["form_copy","layout","field_label","field_type","field_required","field_options"]),message:l.string().trim().min(1).max(500)}).strict().superRefine((t,n)=>{t.kind.startsWith("field_")&&!t.field_name&&n.addIssue({code:"custom",path:["field_name"],message:"field confirmation items require field_name"})})).max(200)}).strict().superRefine((t,n)=>{let s=t.grade==="standard";s===t.required&&n.addIssue({code:"custom",path:["required"],message:s?"standard forms do not require standardization confirmation":"legacy forms require standardization confirmation"}),t.grade==="C"&&t.pending_confirmations.length===0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"grade C requires at least one pending confirmation"}),t.grade!=="C"&&t.pending_confirmations.length>0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"only grade C can contain pending confirmations"})}),zd=l.object({site_id:T,form_definition_id:Jt,base_snapshot_id:R,expected_form_spec_hash:Z,expected_cms_schema_hash:Z.nullable(),draft_form_spec_hash:Z,desired_cms_schema_hash:Z,affected_files_hash:Z,shared_reference_hash:Z,shared_reference_count:l.number().int().positive(),confirm_shared_update:l.boolean(),recreate_missing_binding:l.boolean(),standardization:ps,confirm_standardization:l.boolean()}).strict(),eo=l.object({reference_hash:Z,page_count:l.number().int().positive(),block_count:l.number().int().positive()}).strict().refine(t=>t.page_count<=t.block_count,{message:"page_count cannot exceed block_count"}),aE=l.object({site_id:T,form_block_id:xd,base_snapshot_id:R,form_spec:ls,runtime_upgrade_required:l.boolean(),expected_form_spec_hash:Z,expected_cms_schema_hash:Z.nullable(),affected_files_hash:Z,shared_impact:eo,standardization:ps}).strict(),Wd=l.object({operation_id:rs,operation_fingerprint:Z,site_id:T,form_definition_id:Jt,base_snapshot_id:R,expected_form_spec_hash:Z,expected_cms_schema_hash:Z.nullable(),draft_form_spec:ls,draft_form_spec_hash:Z,desired_cms_schema_hash:Z,affected_files_hash:Z,shared_impact:eo,confirm_shared_update:l.boolean(),recreate_missing_binding:l.boolean(),standardization:ps,confirm_standardization:l.boolean()}).strict().superRefine((t,n)=>{t.form_definition_id!==t.draft_form_spec.form_definition_id&&n.addIssue({code:"custom",path:["form_definition_id"],message:"form_definition_id must match draft_form_spec"}),t.shared_impact.block_count>1&&!t.confirm_shared_update&&n.addIssue({code:"custom",path:["confirm_shared_update"],message:"shared definition updates require explicit confirmation"});let s=t.draft_form_spec.binding.status==="missing";s!==t.recreate_missing_binding&&n.addIssue({code:"custom",path:["recreate_missing_binding"],message:s?"missing bindings require explicit recreation confirmation":"only missing bindings can be recreated"});let i=t.draft_form_spec.binding.status==="bound",a=i&&t.standardization.required&&(t.standardization.grade==="B"||t.standardization.grade==="C");(i&&!a&&t.expected_cms_schema_hash===null||!i&&t.expected_cms_schema_hash!==null)&&n.addIssue({code:"custom",path:["expected_cms_schema_hash"],message:i?"bound standard forms require the current CMS schema hash":"unbound or missing forms cannot claim a current CMS schema hash"}),t.confirm_standardization!==t.standardization.required&&n.addIssue({code:"custom",path:["confirm_standardization"],message:t.standardization.required?"legacy standardization requires explicit confirmation":"standard forms cannot claim legacy standardization confirmation"})}),Vd=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],ds=l.enum(Vd),$d=["pending","running","succeeded","failed","recovery_required"],to=l.enum($d),Hd=["candidate_abandon","snapshot_reconcile","cms_restore"],no=l.enum(Hd),Yd=["FORM_DESIGN_INVALID","FORM_DESIGN_UNSUPPORTED","FORM_DESIGN_STANDARDIZATION_AGENT_REQUIRED","FORM_DESIGN_STANDARDIZATION_UNSUPPORTED","FORM_DESIGN_FEATURE_NOT_ENABLED","FORM_DESIGN_PERMISSION_DENIED","FORM_DESIGN_LOCKED","FORM_DESIGN_CODE_CONFLICT","FORM_DESIGN_CMS_CONFLICT","FORM_DESIGN_CMS_SCHEMA_MISMATCH","FORM_DESIGN_CMS_NOT_FOUND","FORM_DESIGN_BINDING_MISSING","FORM_DESIGN_OPERATION_CONFLICT","FORM_DESIGN_CMS_UNAVAILABLE","FORM_DESIGN_PATCH_FAILED","FORM_DESIGN_COMPENSATION_FAILED","FORM_DESIGN_RECOVERY_REQUIRED"],us=l.enum(Yd),so=l.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),ao=l.enum(["not_started","pending","succeeded","failed"]),io=l.object({operation_id:rs,operation_fingerprint:Z,site_id:T,form_definition_id:Jt,stage:ds,status:to,base_snapshot_id:R,candidate_snapshot_id:R.nullable(),before_form_code:l.string().regex(He).nullable(),materialized_form_code:l.string().regex(He).nullable(),expected_form_spec_hash:Z,draft_form_spec_hash:Z,materialized_form_spec_hash:Z.nullable(),expected_cms_schema_hash:Z.nullable(),desired_cms_schema_hash:Z,retry_count:l.number().int().nonnegative(),failure_stage:no.nullable(),last_error_code:us.nullable(),retryable:l.boolean(),next_action:so,preview_refresh_status:ao,created_at:l.string().datetime({offset:!0}),updated_at:l.string().datetime({offset:!0})}).strict().superRefine((t,n)=>{if(!(t.stage!=="committed"&&t.status!=="succeeded")){(t.stage!=="committed"||t.status!=="succeeded")&&n.addIssue({code:"custom",path:["status"],message:"committed stage and succeeded status must be reported together"});for(let s of["candidate_snapshot_id","materialized_form_code","materialized_form_spec_hash"])t[s]===null&&n.addIssue({code:"custom",path:[s],message:`${s} is required for a committed success`});(t.failure_stage!==null||t.last_error_code!==null||t.retryable||t.next_action!=="none")&&n.addIssue({code:"custom",path:["next_action"],message:"a committed success cannot retain an error or retry action"})}}),gs=l.object({operation:io}).strict(),iE=gs,oE=gs,rE=l.object({operation_fingerprint:Z}).strict(),cE=gs,Xd=l.preprocess(t=>!t||typeof t!="object"||Array.isArray(t)||"standardization"in t||"confirm_standardization"in t?t:{...t,standardization:{grade:"standard",required:!1,pending_confirmations:[]},confirm_standardization:!1},Wd),mE=l.object({operation:io,request:Xd,cms_replace_result:l.unknown().nullable()}).strict(),Zd=l.object({stage:ds.optional(),status:to.optional(),candidate_snapshot_id:R.nullable().optional(),before_form_code:l.string().regex(He).nullable().optional(),materialized_form_code:l.string().regex(He).nullable().optional(),materialized_form_spec_hash:Z.nullable().optional(),retry_count:l.number().int().nonnegative().optional(),failure_stage:no.nullable().optional(),last_error_code:us.nullable().optional(),retryable:l.boolean().optional(),next_action:so.optional(),preview_refresh_status:ao.optional()}).strict(),lE=l.object({expected_updated_at:l.string().datetime({offset:!0}),operation:Zd,cms_replace_result:l.unknown().nullable().optional()}).strict().refine(t=>Object.keys(t.operation).length>0||Object.hasOwn(t,"cms_replace_result"),{message:"transition must change operation state or CMS result"}),pE=l.object({code:us,message:l.string().trim().min(1).max(500),retryable:l.boolean(),operation_id:rs.optional(),stage:ds.optional()}).strict();function Qd(t){return zd.parse({site_id:t.site_id,form_definition_id:t.form_definition_id,base_snapshot_id:t.base_snapshot_id,expected_form_spec_hash:t.expected_form_spec_hash,expected_cms_schema_hash:t.expected_cms_schema_hash,draft_form_spec_hash:t.draft_form_spec_hash,desired_cms_schema_hash:t.desired_cms_schema_hash,affected_files_hash:t.affected_files_hash,shared_reference_hash:t.shared_impact.reference_hash,shared_reference_count:t.shared_impact.block_count,confirm_shared_update:t.confirm_shared_update,recreate_missing_binding:t.recreate_missing_binding,standardization:t.standardization,confirm_standardization:t.confirm_standardization})}function Hi(t){for(let n=0;n<t.length;n+=1){let s=t.charCodeAt(n);if(s>=55296&&s<=56319){let i=t.charCodeAt(n+1);if(n+1>=t.length||i<56320||i>57343)throw new TypeError("canonical JSON cannot contain a lone surrogate");n+=1}else if(s>=56320&&s<=57343)throw new TypeError("canonical JSON cannot contain a lone surrogate")}}function is(t,n){if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError("canonical JSON numbers must be finite");return JSON.stringify(t)}if(typeof t=="string")return Hi(t),JSON.stringify(t);if(typeof t!="object")throw new TypeError("value is not valid JSON");if(n.has(t))throw new TypeError("canonical JSON cannot contain cycles");n.add(t);try{if(Array.isArray(t)){let c=[];for(let f=0;f<t.length;f+=1){if(!(f in t))throw new TypeError("canonical JSON cannot contain sparse arrays");c.push(is(t[f],n))}return`[${c.join(",")}]`}let s=Object.getPrototypeOf(t);if(s!==Object.prototype&&s!==null)throw new TypeError("canonical JSON objects must be plain records");let i=t;return`{${Object.keys(i).sort().map(c=>(Hi(c),`${JSON.stringify(c)}:${is(i[c],n)}`)).join(",")}}`}finally{n.delete(t)}}function Jd(t){return is(t,new Set)}async function en(t){let n=Jd(t),s=new TextEncoder().encode(n),i=globalThis.crypto?.subtle?new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",s)):(await import("@noble/hashes/sha256")).sha256(s);return`sha256:${Array.from(i,c=>c.toString(16).padStart(2,"0")).join("")}`}async function dE(t){return en(ls.parse(t))}async function uE(t){return en(Ji.parse(t))}async function gE(t){let n=Bd.parse(t).map(s=>({...s})).sort((s,i)=>s.path<i.path?-1:s.path>i.path?1:0);return en({version:1,files:n})}async function _E(t){return en(Qd(t))}import{z as ke}from"zod";var eu=["provisioning","cms_app_created","seeded","ready","failed"],fE=ke.object({tenant_id:ke.string().min(1),site_id:T,collection_slug:ke.string().min(1),cms_collection_id:ke.string().min(1).nullable(),status:ke.enum(eu),owned_by_vcp:ke.boolean(),run_id:W.nullable(),last_error:ke.string().nullable(),created_at:ke.string().datetime(),updated_at:ke.string().datetime()});var oo="/vibe/v1";function xE(t){let n=t?.trim().replace(/\/+$/,"");if(!n)return null;try{let s=new URL(n),i=s.pathname.replace(/\/+$/,"");return s.search="",s.hash="",s.pathname=i.endsWith(oo)?i:oo,s.href.replace(/\/+$/,"")}catch{return n}}import{z as g}from"zod";var nn=g.string().url().refine(Su,{message:"URL must use http or https"}),ro=g.string().trim().pipe(nn),tu=g.object({task_type:g.literal("home_url"),task_url:ro,planned_num:g.number().int().min(1).max(20).optional()}).strict(),nu=g.object({task_type:g.literal("url_list"),urls:g.array(nn).min(1).max(1e4)}).strict(),RE=g.discriminatedUnion("task_type",[tu,nu]),TE=g.object({page:g.coerce.number().int().positive().default(1),page_size:g.coerce.number().int().min(1).max(20).default(20)}).strict(),kE=g.object({home_url:ro}).strict(),qe=g.string().uuid(),Ye=g.string().uuid(),vE=g.object({task_uuid:qe}).strict(),co=g.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]),su=g.object({task_uuid:qe,status:g.literal("NOT_STARTED"),total:g.literal(0)}).strict(),au=g.object({task_uuid:qe,status:g.literal("PROCESSING"),total:g.literal(0)}).strict(),iu=g.object({task_uuid:qe,status:g.literal("SUCCEEDED"),total:g.number().int().positive()}).strict(),ou=g.enum(["TASK_FAILED","PROVIDER_CAPABILITY_LIMIT"]),ru=g.object({task_uuid:qe,status:g.literal("FAILED"),total:g.literal(0),error_code:ou,error_message:g.string().min(1),failure_stage:co}).strict(),AE=g.discriminatedUnion("status",[su,au,iu,ru]),cu=g.object({url:nn,raw_html:g.string().min(1)}).strict(),wE=g.object({task_uuid:qe,status:g.literal("SUCCEEDED"),page:g.number().int().positive(),page_size:g.number().int().min(1).max(20),total:g.number().int().positive(),total_pages:g.number().int().positive(),pages:g.array(cu).max(20)}).strict().superRefine((t,n)=>{t.total_pages!==Math.ceil(t.total/t.page_size)&&n.addIssue({code:"custom",path:["total_pages"],message:"total_pages must equal ceil(total / page_size)"}),t.pages.length>t.page_size&&n.addIssue({code:"custom",path:["pages"],message:"pages must not exceed page_size"})}),CE=g.object({task_code:Ye}).strict(),mu=g.object({task_code:Ye,status:g.literal("NOT_STARTED")}).strict(),lu=g.object({task_code:Ye,status:g.literal("PROCESSING")}).strict(),pu=g.object({task_code:Ye,status:g.literal("SUCCEEDED"),urls:g.array(nn)}).strict(),du=g.literal("SITEMAP_DISCOVERY_FAILED"),uu=g.object({task_code:Ye,status:g.literal("FAILED"),error_code:du,error_message:g.string().min(1)}).strict(),PE=g.discriminatedUnion("status",[mu,lu,pu,uu]),DE=g.object({company_name:g.string().regex(/\S/u)}).strict(),gu=g.object({company_name:g.string(),brand_name:g.string(),main_products:g.array(g.string()),industry:g.array(g.string()),subfields:g.array(g.string()),business_intro:g.string(),registered_capital:g.string(),legal_representative:g.string(),target_markets:g.array(g.string()),target_customer_industries:g.array(g.string()),target_customer_roles:g.array(g.string()),purchase_scenarios:g.string(),differentiators:g.array(g.string()),competitors:g.array(g.object({name:g.string(),official_url:g.string()}).strict()).max(3),qualifications:g.array(g.string()),representative_cases:g.array(g.string()),acquisition_channels:g.array(g.string()),desired_domain:g.string(),brand_tone:g.string(),timezone:g.string()}).strict(),jE=g.object({company_uuid:g.string().uuid()}).strict(),tn=g.object({company_uuid:g.string().uuid(),company_info:gu,created_at:g.string().datetime(),updated_at:g.string().datetime()}),OE=g.discriminatedUnion("status",[tn.extend({status:g.literal("NOT_STARTED"),last_error_code:g.null(),last_error_message:g.null(),started_at:g.null(),completed_at:g.null()}).strict(),tn.extend({status:g.literal("PROCESSING"),last_error_code:g.null(),last_error_message:g.null(),started_at:g.string().datetime(),completed_at:g.null()}).strict(),tn.extend({status:g.literal("SUCCEEDED"),last_error_code:g.null(),last_error_message:g.null(),started_at:g.string().datetime(),completed_at:g.string().datetime()}).strict(),tn.extend({status:g.literal("FAILED"),last_error_code:g.string().min(1),last_error_message:g.string().min(1),started_at:g.string().datetime(),completed_at:g.string().datetime()}).strict()]),_u=["BAD_REQUEST","NOT_FOUND","PAYLOAD_TOO_LARGE","INTERNAL_SERVER_ERROR","UNAUTHORIZED","FORBIDDEN","INVALID_TASK_TYPE","TASK_URL_REQUIRED","INVALID_PLANNED_NUM","URL_LIST_REQUIRED","URL_LIST_LIMIT_EXCEEDED","INVALID_URL_LIST","INVALID_PAGINATION","INVALID_TASK_CODE","INVALID_HOME_URL","TASK_CODE_HOME_URL_CONFLICT","SITEMAP_TASK_NOT_FOUND","SITEMAP_DISCOVERY_FAILED","TASK_NOT_FOUND","PROVIDER_CAPABILITY_LIMIT","TASK_FAILED","WEBSITE_UNREACHABLE"],hu=g.enum(_u),NE=g.object({error_code:hu,error_message:g.string().min(1),failure_stage:co.optional(),task_uuid:qe.optional(),task_code:Ye.optional()}).strict();function Su(t){try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as D}from"zod";var xe=D.string().url().refine(yu,{message:"URL must use http or https"}),mo=D.string().min(1).max(512),sn=D.string().datetime({offset:!0}),lo=D.enum(["scraping","completed","failed","expired"]),UE=D.object({url:xe,ignore_cache:D.boolean(),sitemap:D.enum(["include","skip"]),include_subdomains:D.boolean(),ignore_query_parameters:D.boolean(),limit:D.number().int().min(1).max(1e5)}).strict(),FE=D.object({links:D.array(xe).max(1e5)}).strict(),qE=D.object({url:xe,limit:D.number().int().min(1).max(1e5),max_discovery_depth:D.literal(1),crawl_entire_domain:D.literal(!1),sitemap:D.literal("skip")}).strict(),GE=D.object({crawl_id:mo,expires_at:sn.optional()}).strict(),KE=D.object({status:lo,urls:D.array(xe).max(1e5),next:xe.optional(),expires_at:sn}).strict(),BE=D.object({urls:D.array(xe).min(1).max(1e4),formats:D.tuple([D.literal("rawHtml")]),ignore_invalid_urls:D.literal(!1),max_age:D.number().int().nonnegative(),max_concurrency:D.number().int().positive().optional()}).strict(),zE=D.object({batch_id:mo,expires_at:sn.optional()}).strict(),bu=D.object({url:xe,raw_html:D.string().min(1)}).strict(),WE=D.object({status:lo,total:D.number().int().nonnegative(),completed:D.number().int().nonnegative(),pages:D.array(bu).max(1e4),next:xe.optional(),expires_at:sn}).strict().superRefine((t,n)=>{t.completed>t.total&&n.addIssue({code:"custom",path:["completed"],message:"completed must not exceed total"})}),fu=D.object({url:xe,error_message:D.string().min(1)}).strict(),VE=D.object({errors:D.array(fu).max(1e4),robots_blocked:D.array(xe).max(1e4)}).strict(),$E=D.object({active:D.number().int().nonnegative(),waiting:D.number().int().nonnegative(),max_concurrency:D.number().int().positive()}).strict();function yu(t){try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as oe}from"zod";var po=oe.enum(["queued","processing","success","partial_failed","failed"]),xu=oe.string().regex(/^(0|[1-9][0-9]{0,18})$/u),Eu=oe.string().regex(/^[1-9][0-9]{0,18}$/u),ZE=oe.object({site_id:T,vcp_publish_id:xu}).strict(),Iu=oe.object({task_id:oe.number().int().positive(),status:po}).strict(),QE=oe.object({code:oe.literal(0),data:Iu,message:oe.string().min(1)}).strict(),Ru=oe.object({task_id:oe.number().int().positive().nullable(),status:po}).strict(),Tu=oe.object({publish_id:Eu,site_id:T,sensitive_word_detection:Ru,can_continue:oe.boolean(),created_at:oe.string().datetime(),updated_at:oe.string().datetime()}).strict(),JE=oe.object({publish_quality:Tu}).strict();import{z as h}from"zod";var go=h.lazy(()=>kt),ku=h.enum(["page","block"]),on=h.enum(["component","page","pages"]),vu=h.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),Ge=vu,_o=h.object({requested_locale:Ge,resolved_locale:Ge,fallback_used:h.boolean()}).strict(),Tt=h.object({id:h.string().uuid(),key:h.string().min(1),name:h.string().min(1)}).strict(),an=Tt.extend({color:h.string().nullable()}).strict(),sI=h.object({kind:ku,category_id:h.string().uuid().optional(),tag_id:h.string().uuid().optional(),search:h.string().trim().min(1).max(200).optional(),limit:h.coerce.number().int().min(1).max(50).default(20),cursor:h.string().min(1).optional()}).strict(),Au=h.object({stable_key:h.string().min(1),type:on,title:h.string().min(1).max(200),description:h.string().max(1e3),thumbnail_url:h.string().url().nullable(),resolved_version:h.number().int().positive(),content_schema_version:h.literal(3),category:Tt.nullable(),tags:h.array(an),page_count:h.number().int().nonnegative(),component_count:h.number().int().nonnegative(),locale:_o}).strict(),aI=h.object({items:h.array(Au),facets:h.object({categories:h.array(Tt),tags:h.array(an)}).strict(),next_cursor:h.string().nullable()}).strict(),iI=h.object({resolved_version:h.number().int().positive(),base_sitemap_id:h.string().uuid(),base_sitemap_version:h.number().int().positive(),sitemap:go,target_page_id:h.string().min(1).optional()}).strict(),oI=h.object({next_sitemap:go,applied:h.object({stable_key:h.string().min(1),resolved_version:h.number().int().positive(),template_type:on,page_ids:h.array(h.string().min(1)),block_ids:h.array(h.string().min(1))}).strict(),locale:_o,warnings:h.array(h.string())}).strict(),ho=h.object({nodeId:h.string().uuid(),type:h.string().trim().min(1).max(100),label:h.string().trim().min(1).max(200),variant:h.string().trim().min(1).max(100).optional(),order:h.number().int().nonnegative(),props:h.record(h.string(),h.unknown()),thumbnail:h.string().url().optional(),source:h.unknown().optional()}).strict(),uo=h.object({nodeId:h.string().uuid().optional(),slug:h.string().regex(/^\/$|^\/[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/u),navigation:h.object({showInHeader:h.boolean(),showInFooter:h.boolean(),order:h.number().int().nonnegative()}).strict(),components:h.array(ho).min(1).max(100),thumbnail:h.string().url().optional(),source:h.unknown().optional()}).strict(),wu=h.union([ho,uo,h.object({pages:h.array(uo).min(1).max(50),thumbnail:h.string().url().optional(),source:h.unknown().optional()}).strict()]),Cu=h.object({title:h.string().min(1).max(200),description:h.string().min(1).max(1e3),prompt:h.string().min(1).max(8192)}).strict(),Pu=h.object({locale:Ge,title:h.string().min(1).max(200),content:h.object({description:h.string().min(1).max(1e3),prompt:h.string().min(1).max(8192),nodes:h.record(h.string().uuid(),Cu)}).strict()}).strict(),rI=h.object({templateId:h.string().uuid(),stableKey:h.string().min(1),type:on,resolvedVersion:h.number().int().positive(),contentSchemaVersion:h.literal(3),structure:wu,requestedLocale:Ge,resolvedLocale:Ge,fallbackUsed:h.boolean(),contents:h.array(Pu).length(1)}).strict().superRefine((t,n)=>{(t.type==="component"&&!("type"in t.structure)||t.type==="page"&&!("components"in t.structure)||t.type==="pages"&&!("pages"in t.structure))&&n.addIssue({code:"custom",path:["structure"],message:"Template type and structure must match."});let s=Du(t.structure),i=new Set(Object.keys(t.contents[0]?.content.nodes??{}));(s.size!==i.size||[...s].some(a=>!i.has(a)))&&n.addIssue({code:"custom",path:["contents",0,"content","nodes"],message:"Localized nodes must exactly match the structure nodes."}),t.contents[0]?.locale!==t.resolvedLocale&&n.addIssue({code:"custom",path:["contents"],message:"Resolved locale must match returned content."}),t.fallbackUsed!==(t.requestedLocale!==t.resolvedLocale)&&n.addIssue({code:"custom",path:["fallbackUsed"],message:"fallbackUsed must match locale resolution."})}),cI=h.object({items:h.array(h.object({stableKey:h.string().min(1),type:on,title:h.string().min(1).max(200),description:h.string().max(1e3),thumbnailUrl:h.string().url().nullable(),resolvedVersion:h.number().int().positive(),contentSchemaVersion:h.literal(3),category:Tt.nullable(),tags:h.array(an),pageCount:h.number().int().nonnegative(),componentCount:h.number().int().nonnegative(),requestedLocale:Ge,resolvedLocale:Ge,fallbackUsed:h.boolean()}).strict()),facets:h.object({categories:h.array(Tt),tags:h.array(an)}).strict(),nextCursor:h.string().nullable()}).strict().superRefine((t,n)=>{t.items.forEach((s,i)=>{s.fallbackUsed!==(s.requestedLocale!==s.resolvedLocale)&&n.addIssue({code:"custom",path:["items",i,"fallbackUsed"],message:"fallbackUsed must match locale resolution."})})});function Du(t){if("type"in t)return new Set([t.nodeId]);let n="pages"in t?t.pages:[t];return new Set(n.flatMap(s=>[...s.nodeId?[s.nodeId]:[],...s.components.map(i=>i.nodeId)]))}import{z as q}from"zod";var ju=["pending_dns","active"],Ou=q.enum(ju),Nu=q.enum(["ownershipVerification","certificateValidation","traffic","unknown"]),Lu=q.enum(["pending","matched"]),Mu=q.object({id:q.string().min(1),type:q.string().min(1),name:q.string().min(1),value:q.string().min(1),purpose:Nu,required:q.boolean(),status:Lu.optional()}).strict(),Xe=q.object({id:q.string().min(1),domainId:q.string().min(1).optional(),hostname:q.string().min(1),displayHostname:q.string().min(1),asciiHostname:q.string().min(1),status:Ou,isPrimary:q.boolean(),deletable:q.boolean(),dnsRecords:q.array(Mu),createdAt:q.string().datetime().nullable(),checkedAt:q.string().datetime().nullable()}).strict(),Uu=q.object({hostname:q.string().min(1),url:q.string().url(),status:q.literal("ready")}).strict(),So=q.object({defaultDomain:Uu,currentDomain:Xe.nullable(),customDomains:q.array(Xe)}).strict(),pI=q.object({hostname:q.string().min(1)}).strict(),bo=q.object({domain:Xe}).strict(),fo=q.object({domain:Xe,primaryActivated:q.boolean()}).strict(),yo=q.object({domain:Xe}).strict(),xo=q.object({domain:Xe}).strict(),Eo=q.object({deleted:q.boolean()}).strict();import{z as _e}from"zod";var Fu=["started","success","failed","canceled"],_s=_e.enum(Fu),qu=["inactive","pending_binding","active"],hs=_e.enum(qu),Gu=["domain","url_prefix"],Ss=_e.enum(Gu),Ku=["not_connected","authorizing","matching_property","ready","failed","canceled","domain_mismatch"],bs=_e.enum(Ku),Ee=_e.string().nullable(),Ro=_e.object({}).strict(),fs=_e.object({authorize_url:_e.string().url(),custom_domain:Ee}).strict(),To=N(fs),Bu=_e.object({auth_status:_s,binding_status:hs,credential_connected:_e.boolean(),custom_domain:Ee,gsc_site_url:Ee,property_type:Ss.nullable(),auth_error_code:Ee,auth_error_message:Ee}).strict(),ko=_e.object({auth_status:_s,binding_status:hs,credential_connected:_e.boolean(),custom_domain:Ee,gsc_site_url:Ee,property_type:Ss.nullable(),auth_error_code:Ee,auth_error_message:Ee,current_domain:Ee,state:bs,ready:_e.boolean()}).strict().superRefine((t,n)=>{let s=Wu(t,t.current_domain),i=s==="ready";t.state!==s&&n.addIssue({code:"custom",path:["state"],message:`state must equal ${s} for the supplied GSC facts`}),t.ready!==i&&n.addIssue({code:"custom",path:["ready"],message:`ready must equal ${String(i)} for the supplied GSC facts`})}),zu=N(ko);function Io(t){let n=t?.trim()??"";if(!n)return"";let s=/^[a-z][a-z0-9+.-]*:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).hostname.replace(/\.+$/,"").toLowerCase()}catch{return n.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").split(/[/?#]/,1)[0].replace(/\.+$/,"").toLowerCase()}}function Wu(t,n){let s=t.gsc_site_url?.trim()??"",i=Io(t.custom_domain),a=Io(n??("current_domain"in t?t.current_domain:void 0)),c=i.length>0&&a.length>0&&i===a;return t.auth_status==="canceled"?"canceled":t.auth_status==="failed"?"failed":t.auth_status==="started"?"authorizing":!t.credential_connected||t.binding_status==="inactive"?"not_connected":s.length===0?"matching_property":c?t.binding_status==="pending_binding"?"matching_property":t.auth_status==="success"&&t.binding_status==="active"&&t.credential_connected&&s.length>0&&c?"ready":"failed":"domain_mismatch"}var _I=Ro,hI=fs,SI=To,bI=bs,fI=_s,yI=hs,xI=Ss,EI=bs,II=Ro,RI=fs,TI=To,kI=Bu,vI=ko,AI=zu;function Vu(t,n,s=t){let i=new Map(t.map(o=>[o.slug,o])),a=new Map(s.map(o=>[o.id,o])),c=new Map(t.map(o=>{let _=a.get(o.id);return _&&_.slug!==o.slug?[_.slug,o]:null}).filter(o=>o!==null)),f=new Set(s.map(o=>o.slug).filter(o=>!i.has(o)));return{primaryLinks:vo(n.primaryLinks,t,i,c,f,a,"showInHeader"),footerLinks:vo(n.footerLinks,t,i,c,f,a,"showInFooter")}}function vo(t,n,s,i,a,c,f){let o=new Set,_=[];for(let[L,M]of t.entries()){let H=$u(M.href),Q=H===null?void 0:s.get(H)??i.get(H);if(H!==null&&a.has(H)&&!s.has(H)&&!i.has(H))continue;if(!Q||Q.slug==="/"){_.push({kind:"independent",link:M});continue}if(!Q.navigation[f])continue;o.add(Q.slug);let tt=c.get(Q.id),Or=M.label===(tt?.title??Q.title)?Q.title:M.label,Nr=H===Q.slug?M.href:Hu(M.href,Q.slug);_.push({kind:"page",page:Q,link:{...M,label:Or,href:Nr},index:L})}let w=_.filter(L=>L.kind==="page").sort((L,M)=>L.page.navigation.order-M.page.navigation.order||L.index-M.index),x=0,C=_.map(L=>L.kind==="page"?w[x++].link:L.link);for(let L of[...n].filter(M=>M.slug!=="/"&&M.navigation[f]).sort((M,H)=>M.navigation.order-H.navigation.order))o.has(L.slug)||C.push({label:L.title,href:L.slug});return C}function $u(t){if(!t.startsWith("/")||t.startsWith("//"))return null;let n=t.search(/[?#]/u);return n===-1?t:t.slice(0,n)}function Hu(t,n){let s=t.search(/[?#]/u);return s===-1?n:`${n}${t.slice(s)}`}var vt={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}},Yu={heading:"Inter",body:"Inter"},Ao=vt.Inter;function rn(t){return t.trim().replace(/\s+/g,"_").toLowerCase()}var Do=(()=>{let t=new Map;for(let[n,s]of Object.entries(vt))t.set(rn(n),s),t.set(rn(s.import),s);return t})();function Xu(t){return typeof t!="string"||t.trim().length===0?Ao:Do.get(rn(t))??Ao}var Zu=(()=>{let t=new Map;for(let[n,s]of Object.entries(vt))t.set(s.import,n);return t})();function Qu(t){if(typeof t!="string"||t.trim().length===0)return"Inter";let n=Do.get(rn(t));return n?Zu.get(n.import)??"Inter":"Inter"}var Ju=Object.keys(vt),wo='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',Co='Georgia, "Times New Roman", serif',Po='"SFMono-Regular", Consolas, monospace',eg=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),tg=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(t=>t.toLowerCase())),ng=new Set(["JetBrains Mono","IBM Plex Mono"].map(t=>t.toLowerCase()));function sg(t){let n=t.toLowerCase();return ng.has(n)||n.includes("mono")?"mono":tg.has(n)||n.includes("serif")?"serif":"sans"}function ys(t,n){let s=_=>(_??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),i=s(t),a=s(n),c=_=>eg.has(_.toLowerCase());if(i&&c(i)){let _=i.toLowerCase();return _.includes("mono")?Po:_.includes("serif")?Co:wo}let f=i;f||(f=c(a)?"":a),f||(f="Inter");let o=sg(f);return o==="mono"?`"${f}", ${Po}`:o==="serif"?`"${f}", ${Co}`:`"${f}", ${wo}`}function ag(t){return{"--site-font-sans":ys(t?.body,"Inter"),"--site-font-heading":ys(t?.heading,t?.body??"Inter")}}var ig=[{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 og=[{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 jo=20*1024*1024,rg=jo,Oo=["jpg","jpeg","png","gif","webp","bmp"],No=["mp4","avi","mov","webm","mkv"],Lo=["mp3","wav","aac","flac","ogg","wma","m4a"],Mo=["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","md","csv"],Uo=[...Mo,"zip","rar","json","xmind","psd","ai","fig","sketch"],cg=[...Oo,...No,...Lo,...Uo],Fo=["image/jpeg","image/png","image/gif","image/webp","image/bmp"],qo=["video/mp4","video/x-msvideo","video/quicktime","video/webm","video/x-matroska"],Go=["audio/mpeg","audio/wav","audio/x-wav","audio/vnd.wave","audio/aac","audio/flac","audio/x-flac","audio/ogg","audio/x-ms-wma","audio/mp4","audio/x-m4a"],mg=[...Fo,...qo,...Go],Ko=k.enum(["image","video","audio","file"]),Bo=k.enum(["external","ai_generated","unsplash"]),xs=k.object({resource_id:k.string().min(1),name:k.string().min(1).max(255),url:k.string().url(),thumbnail_url:k.union([k.string().url(),k.literal("")]),mime_type:k.string().trim().min(3).max(127),size:k.number().int().nonnegative(),width:k.number().int().positive().nullable(),height:k.number().int().positive().nullable(),source:Bo,created_at:k.string().min(1).nullable()}),lg=k.object({page:k.coerce.number().int().min(1).default(1),page_size:k.coerce.number().int().min(1).max(100).default(24),keyword:k.string().trim().max(100).optional(),file_type:Ko.default("image")}),pg=k.object({code:k.literal(0),message:k.string(),data:k.object({items:k.array(xs),page:k.number().int().min(1),page_size:k.number().int().min(1),total:k.number().int().nonnegative()})}),dg=k.object({code:k.literal(0),message:k.string(),data:xs}),zo=k.object({provider_id:k.string().min(1),url:k.string().url(),thumbnail_url:k.string().url(),width:k.number().int().positive(),height:k.number().int().positive(),alt:k.string(),photographer_name:k.string().min(1),photographer_url:k.string().url(),photo_url:k.string().url(),download_location:k.string().url(),dominant_color:k.string().nullable()}),ug=k.object({query:k.string().trim().min(1).max(100),page:k.coerce.number().int().min(1).default(1),page_size:k.coerce.number().int().min(1).max(30).default(18),orientation:k.enum(["landscape","portrait","squarish"]).optional()}),gg=k.object({code:k.literal(0),message:k.string(),data:k.object({items:k.array(zo),page:k.number().int().min(1),page_size:k.number().int().min(1),total:k.number().int().nonnegative(),total_pages:k.number().int().nonnegative()})}),Wo=k.string().url().refine(Sg,{message:"download_location must be an official Unsplash download URL"}),_g=k.object({download_location:Wo}),hg=k.object({code:k.literal(0),message:k.string(),data:k.object({reported:k.boolean()})});function Sg(t){if(!URL.canParse(t))return!1;let n=new URL(t);return n.protocol==="https:"&&n.hostname==="api.unsplash.com"&&n.username===""&&n.password===""&&n.port===""&&n.hash===""&&/^\/photos\/[^/]+\/download$/.test(n.pathname)}import{z as Ie}from"zod";var bg=Ie.object({colorSeeds:Ie.object({primary:Ie.string().min(1).max(40),accent:Ie.string().min(1).max(40)}).strict().optional(),fonts:Ie.object({heading:Ie.string().min(1).max(60),body:Ie.string().min(1).max(60)}).strict().optional()}).strict().refine(t=>t.colorSeeds!==void 0||t.fonts!==void 0,{message:"colorSeeds or fonts is required"}),fg=Ie.object({ok:Ie.literal(!0),design_plan_version:Ie.number().int().positive(),snapshot_id:R});var Rs=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","airy","editorial"]).optional(),motionPreset:e.enum(["pro","fade","para","slide","none"]).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()}),Ts=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()}),Es=e.enum(["material","reference","brief","industry"]),yg=e.object({market:e.object({value:e.string().min(1).max(200),source:Es}),customer:e.object({value:e.string().min(1).max(200),source:Es}),purpose:e.object({options:e.array(e.string().min(1).max(60)).min(2).max(4),selected:e.string().min(1).max(60),source:Es})}),xg=e.enum(["text-options","motion-slider","positioning"]),ks=e.enum(["none","subtle","moderate","expressive"]),Eg=e.enum(["compact","comfortable","airy","editorial"]),Ig=ks,Xo=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()}),Rg=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:Rs.optional(),conversionHints:Ts.optional()}),Tg=e.object({id:e.string(),type:xg,question:e.string(),tag:e.string(),aiThinking:e.string(),options:e.array(Rg),source:e.enum(["ai-detected","always-ask"]),sourceDetail:e.string(),positioning:yg.optional()}),vs=e.object({questions:e.array(Tg).min(1).max(6)}),sR=e.object({tenant_id:e.string().min(1),site_id:T,brief_id:nt,brief:e.string().min(20).max(1e3),site_default_locale:ue.optional(),owner_locale:ue.optional(),input_context:e.object({facts:e.array(Ct).max(120),conflicts:e.array(Dt).max(20),reference:Pt.optional(),sources:e.array(e.object({type:_n,title:e.string().max(120).optional(),status:hn})).max(16).optional()}).optional()}),Zo=e.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),aR=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:W,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(Xo).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:Zo.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)})]),iR="SITE_PLANNING_INPUT_FROZEN",oR="SITE_PLANNING_LOCKED",rR="SITE_STRUCTURE_CONFIRMATION_REQUIRED",cR="SITE_STRUCTURE_CONFIRMATION_STALE",mR=e.object({tenant_id:e.string().min(1),owner_user_id:un,name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),lR=e.object({name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),pR=e.object({name:e.string().min(1).max(120)}),dR=e.object({name:e.string().min(1).max(120),default_locale:ue.optional()}),uR=e.object({body:e.string().min(20).max(1e3)}),gR=e.object({body:e.string().min(20).max(1e3)}),As=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"}),_R=e.object({tenant_id:e.string().min(1),site_url:As,site_name:e.string().trim().min(1).max(255).optional()}),hR=N(Sa),SR=N(ba),bR=N(fa),fR=N(Ca),yR=N(Pa),xR=N(Da),ER=N(Oa),IR=N(Na),RR=N(La),TR=N(e.object({site_id:T,site_url:As})),kR=N(So),vR=N(bo),AR=N(fo),wR=N(yo),CR=N(xo),PR=N(Eo),Ne=e.object({id:T,tenant_id:e.string().min(1),owner_user_id:un.nullable(),name:e.string().min(1),slug:e.string().min(1),status:Kn,deployment_status:Bn,archived_at:e.string().min(1).nullable(),current_sitemap_id:de.nullable(),confirmed_sitemap_id:de.nullable().optional(),confirmed_sitemap_version:e.number().int().positive().nullable().optional(),structure_confirmed_at:e.string().min(1).nullable().optional(),migration_content_requested:e.boolean().optional(),current_snapshot_id:R.nullable(),published_deployment_id:Be.nullable().optional(),deployed_url:e.string().url().nullable(),default_locale:ue,owner_locale:ue.optional(),cms_site_id:ia.nullable().optional(),cms_site_url:As.nullable().optional(),schema_version:e.literal(1),created_at:e.string().min(1),updated_at:e.string().min(1)}),ws=e.object({id:nt,tenant_id:e.string().min(1),site_id:T,body:e.string().min(1),source:e.enum(["user","import","system"]),created_at:e.string().min(1),updated_at:e.string().min(1)}),DR=e.object({site:Ne,brief:ws,next_step:e.literal("clarify")}),jR=e.object({site:Ne,brief:ws}),OR=e.object({brief:ws}),kg=e.enum(["queued","running","succeeded","failed","cancelled"]),Qo=e.enum(["clarify","sitemap","workspace"]),Jo=e.enum(["clarify","sitemap","initial_generation","iteration"]),er=e.enum(["clarify","sitemap","workspace","summarize"]),Oe=e.object({id:W,tenant_id:e.string().min(1),site_id:T,agent_type:Qo,run_kind:Jo,status:kg,model_route:er,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)}),NR=e.object({run_id:W.optional(),site_id:T,agent_type:Qo,run_kind:Jo.optional(),model_route:er,input:e.record(e.string(),e.unknown()).optional()}).superRefine((t,n)=>{At(t.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),LR=e.object({agent_run:Oe,next_step:e.literal("stream_events")}),tr=e.enum(["draft","candidate","deleting","current","failed"]),ve=e.object({id:R,tenant_id:e.string().min(1),site_id:T,version:e.number().int().positive(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:be.nullable().optional(),reason:e.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback","template_upgrade"]),status:tr,created_at:e.string().min(1)}),MR=e.object({snapshot_id:R,creation_key:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:be.optional(),reason:ve.shape.reason,status:e.enum(["draft","candidate","current","failed"]).default("candidate"),source_run_id:W.optional()}),UR=e.object({site:Ne,snapshot:ve,next_step:e.literal("workspace")}),FR=e.object({expected_manifest_hash:ve.shape.manifest_hash,manifest_hash:ve.shape.manifest_hash,object_key:ve.shape.object_key}).strict(),qR=e.union([e.object({base_snapshot_id:R.nullable(),source_run_id:W.optional()}).strict(),e.object({skip_base_check:e.literal(!0)}).strict()]),vg=e.object({site:Ne,snapshot:ve,next_step:e.literal("workspace")}),GR=e.object({snapshot:ve}),KR=e.object({status:e.literal("deleting"),snapshot_id:R,object_key:e.string().min(1)}),BR=e.object({status:e.literal("deleted"),snapshot_id:R}),ln=e.object({id:Ks,tenant_id:e.string().min(1),site_id:T,snapshot_id:R,version:e.number().int().positive(),accepted_commit:e.string().min(1),source_run_id:W.nullable(),created_at:e.string().min(1)}),Ag=ln.extend({reason:ve.shape.reason,status:tr}),zR=e.object({accepted_commit:e.string().min(1),source_run_id:W.optional()}),WR=e.object({site_version:ln,next_step:e.literal("workspace")}),VR=e.object({owner_id:e.string().min(1)}).strict(),$R=e.discriminatedUnion("acquired",[e.object({acquired:e.literal(!0)}).strict(),e.object({acquired:e.literal(!1)}).strict()]),HR=e.object({owner_id:e.string().min(1)}).strict(),YR=e.object({released:e.literal(!0)}).strict(),XR="TEMPLATE_UPGRADE_LOCK_LOST",ZR=e.object({base_snapshot_id:R,accepted_commit:ln.shape.accepted_commit,owner_id:e.string().min(1)}).strict(),QR=vg.strict(),JR=e.object({site_versions:e.array(Ag)}),e1=e.object({site:Ne,snapshot:ve,site_version:ln,next_step:e.literal("workspace")}),t1=e.object({snapshot_id:R,force_rehydrate:e.boolean().optional()}),n1=e.discriminatedUnion("status",[e.object({status:e.literal("ready"),snapshot_id:R,preview_url:e.string().min(1)}),e.object({status:e.literal("failed"),code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})]),Cs=e.enum(Ws),nr=e.enum(["quality_check","publish"]),pn=e.object({id:Be,tenant_id:e.string().min(1),site_id:T,snapshot_id:R,type:nr.default("publish"),version:e.number().int().positive(),status:Cs,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)}),s1=e.object({snapshot_id:R.optional()}).default({}),a1=e.object({deployment:pn}),i1=e.object({deployment:pn.nullable()}),o1=e.object({deployment:pn}),Vo=e.object({id:Be,type:nr.default("publish"),status:Cs,url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable()}),r1=e.object({current:Vo.nullable(),latest_released:Vo.nullable()}),wg=e.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),Ze=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:T,deployment_id:Be,seq:e.number().int().positive(),sent_at:e.string().min(1)}),cn=e.object({deployment:pn,steps:bi.default([])}),c1=e.discriminatedUnion("type",[Ze.extend({type:e.literal("deployment.snapshot"),payload:cn}),Ze.extend({type:e.literal("deployment.status.changed"),payload:cn}),Ze.extend({type:e.literal("deployment.finished"),payload:cn}),Ze.extend({type:e.literal("deployment.failed"),payload:cn}),Ze.extend({type:e.literal("deployment.realtime.recovered"),payload:e.object({action:e.literal("refresh")})}),Ze.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})})]),m1=e.object({tenant_id:e.string().min(1),site_id:T,deployment_id:Be,status:Cs,updated_at:e.string().min(1)}),Cg="vcp:deployments",l1={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:Cg,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...wg.options]},Pg=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)})}),p1=e.object({error:Pg.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:Oe})})}),d1=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({})}),Dg=e.object({theme_id:e.string().min(1),paletteIntent:e.string().min(1),tone:e.string().min(1),mediaMood:e.string().min(1),motionLevel:ks.optional(),userVisualHints:Rs.optional()}),jg=e.object({question:e.string().min(1),answer:e.string().min(1)}),u1=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)}),g1=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()}),Og=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()}),_1=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:Og.optional()}),Ng=e.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),Qe=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:Ng.default("system_recommended")}),K=e.string().min(1).max(2e3),$o=e.string().min(1).max(120),sr=e.object({visualDirection:K,brandFeeling:K,paletteIntent:K,typographyIntent:K,density:Eg,motionLevel:Ig,motionPreset:e.enum(["pro","fade","para","slide","none"]).optional(),mediaStrategy:K,compositionRules:e.array(K).max(20),avoidPatterns:e.array(K).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()}),Ps=160,ar=e.object({routeGoal:K,narrativeArc:K,firstViewportIntent:K,visualContinuity:K,sectionRhythm:K,avoidPatterns:e.array(K).max(20),displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(Ps).optional(),metaTitle:e.string().min(1).max(120).optional(),metaDescription:e.string().min(1).max(320).optional()}),ir=e.enum(["model_call","validation","repair","preview","worker_group"]),je=e.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),or=e.object({sectionRole:K,contentIntent:K,layoutIntent:K,visualIntent:K,mediaIntent:K,motionIntent:K,copyTone:K,displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(Ps).optional(),ctaIntent:K.optional(),continuityWithPrevious:K.optional(),avoidRepeating:e.array(K).max(20).optional(),industryRecipeRefs:e.array($o).max(12).optional(),templateRecipeRefs:e.array($o).max(12).optional()}),rr=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()}),Lg=e.enum(["solid","floating"]),Mg=e.enum(["background","card","primary","frosted"]),Ug=e.enum(["sticky","hide-on-scroll","static"]),Fg=e.enum(["bar","island"]),qg=e.object({variant:Lg,surface:Mg.optional(),behavior:Ug.optional(),shape:Fg.optional()}),Gg=e.object({form:K,layoutIntent:K,scrollBehavior:K,shell:qg.optional(),avoidPatterns:e.array(K).max(10).optional()}),Kg=e.enum(["background","card","primary","inverse"]),Bg=e.object({surface:Kg}),zg=e.object({form:K,composition:K,shell:Bg.optional(),avoidPatterns:e.array(K).max(10).optional()}),Wg=e.object({pattern:K,intent:K}),cr=e.object({header:Gg,footer:zg,mobileNav:Wg}),mr=e.object({schemaVersion:e.literal(1).default(1),siteDesignContext:sr,routeCards:e.record(e.string().min(1),ar),blockContexts:e.record(e.string().min(1),or),selectedSkillPacks:e.array(Qe).max(3).optional(),branding:rr.optional(),chromeDesign:cr.optional()}),h1=e.object({siteDesignContext:sr.omit({imagePalette:!0}).optional(),routeCards:e.record(e.string().min(1),ar).optional(),blockContexts:e.record(e.string().min(1),or).optional(),branding:rr.optional(),chromeDesign:cr.optional()}),lr=e.object({id:e.string(),label:e.string().trim().min(1),type:e.string(),variant:e.string().optional(),order:e.number(),props:e.record(e.string(),e.unknown()),meta:e.object({aiGenerated:e.boolean(),userEdited:e.boolean(),lastEditedAt:e.string(),lastEditedBy:e.enum(["ai","user"]),userInstruction:e.string().optional()}).optional()}).strict(),pr=e.string().regex(mt,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),Vg=new RegExp(`^/(?:${ze}(?:/${ze})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),$g=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,Hg=e.union([e.string().regex(Vg),e.string().regex($g)]),Ho=e.object({label:e.string(),href:Hg}).passthrough(),Yg=e.object({primaryLinks:e.array(Ho),footerLinks:e.array(Ho)}),dr=e.object({showInHeader:e.boolean(),showInFooter:e.boolean(),order:e.number()}).strict(),Ds=e.object({id:e.string(),slug:pr,title:e.string(),blocks:e.array(lr).min(1),navigation:dr}).strict(),Xg=lr.extend({type:e.string().nullable()}).strict(),Zg=Ds.extend({slug:pr.nullable(),navigation:dr.extend({showInHeader:e.boolean().nullable(),showInFooter:e.boolean().nullable()}).strict(),blocks:e.array(Xg).min(1)}).strict(),Qg=Ds.extend({slug:e.string().min(1)}),Yo=e.object({label:e.string(),href:e.string().min(1)}),Jg=e.object({primaryLinks:e.array(Yo),footerLinks:e.array(Yo)}),js=e.object({site_name:e.string().min(1).max(80).optional(),version:e.number().int().positive(),pages:e.array(Ds).min(1),navigation:Yg,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:Qe,visualTheme:Dg.optional(),userChoices:e.array(jg).optional(),confirmedChoices:e.object({conversion:Ts.optional()}).optional()}).strict(),Je=js.superRefine((t,n)=>{ur(t.pages,n)}),kt=js.extend({pages:e.array(Zg).min(1)}).strict().superRefine((t,n)=>{ur(t.pages,n)}),e_=e.enum(["slug","showInHeader","showInFooter"]),t_=e.object({page_id:e.string().min(1),fields:e.array(e_).min(1).max(3)}).strict(),n_=e.object({page_id:e.string().min(1),block_id:e.string().min(1),fields:e.tuple([e.literal("type")])}).strict(),s_=e.object({pages:e.array(t_),blocks:e.array(n_)}).strict().superRefine((t,n)=>{let s=new Set;t.pages.forEach((a,c)=>{s.has(a.page_id)&&n.addIssue({code:"custom",path:["pages",c,"page_id"],message:`Duplicate page target '${a.page_id}'.`}),s.add(a.page_id),new Set(a.fields).size!==a.fields.length&&n.addIssue({code:"custom",path:["pages",c,"fields"],message:"Page target fields must be unique."})});let i=new Set;t.blocks.forEach((a,c)=>{let f=`${a.page_id}\0${a.block_id}`;i.has(f)&&n.addIssue({code:"custom",path:["blocks",c],message:`Duplicate block target '${a.page_id}/${a.block_id}'.`}),i.add(f)})}),S1=e.object({sitemap:kt,targets:s_}).strict(),b1=e.object({pages:e.array(e.object({page_id:e.string().min(1),slug:e.string().min(1).optional(),show_in_header:e.boolean().optional(),show_in_footer:e.boolean().optional()}).strict()).max(100),blocks:e.array(e.object({page_id:e.string().min(1),block_id:e.string().min(1),type:e.string().min(1)}).strict()).max(500)}).strict().superRefine((t,n)=>{let s=new Set;t.pages.forEach((a,c)=>{s.has(a.page_id)&&n.addIssue({code:"custom",path:["pages",c,"page_id"],message:`Duplicate page output '${a.page_id}'.`}),s.add(a.page_id)});let i=new Set;t.blocks.forEach((a,c)=>{let f=`${a.page_id}\0${a.block_id}`;i.has(f)&&n.addIssue({code:"custom",path:["blocks",c],message:`Duplicate block output '${a.page_id}/${a.block_id}'.`}),i.add(f)})}),f1=e.object({sitemap:Je}).strict();function ur(t,n){let s=new Map,i=0;t.forEach((a,c)=>{if(a.slug===null)return;a.slug==="/"&&(i+=1);let f=s.get(a.slug);f!==void 0?n.addIssue({code:"custom",path:["pages",c,"slug"],message:`Duplicate page slug '${a.slug}' (first used at pages.${f}.slug).`}):s.set(a.slug,c)}),(i!==1||t[0]?.slug!=="/")&&n.addIssue({code:"custom",path:["pages"],message:"Sitemap must contain exactly one home page at pages[0] with slug '/'."})}var y1=js.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0}).extend({site_name:e.string().min(1).max(80),pages:e.array(Qg).min(1),navigation:Jg}),a_=e.enum(["ai","user"]),et=e.object({site_id:T,page_id:e.string().min(1),edited_by:a_.default("ai"),source_agent_run_id:W.optional()}),x1=et.extend({block_id:e.string().min(1),target_index:e.number().int().min(0)}),i_=et.extend({block_id:e.string().min(1)}),o_=et.extend({block_id:e.string().min(1),instruction:e.string()}),E1=et.extend({block_id:e.string().min(1),variant:e.string().min(1).nullable()}),I1=et.extend({block_id:e.string().min(1),props:e.record(e.string(),e.unknown()),mode:e.enum(["replace","merge"]).default("replace")}),R1=et.extend({block:e.object({id:e.string().min(1),label:e.string().trim().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()})}),r_=e.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),T1=e.discriminatedUnion("operation",[e.object({operation:e.literal("delete_block"),input:i_}).strict(),e.object({operation:e.literal("update_block_instruction"),input:o_}).strict()]),c_=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_LAST_BLOCK_DELETE_FORBIDDEN","SITEMAP_EDIT_FAILED"]),m_=e.object({status:e.literal("updated"),operation:r_,site_id:T,sitemap_id:de,version:e.number().int().positive(),changed_pages:e.array(e.string().min(1)).min(1),requires_code_patch:e.literal(!0)}),l_=e.object({status:e.literal("failed"),code:c_,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),k1=e.discriminatedUnion("status",[m_,l_]),Os=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:ks.optional(),visual_tonality:Rs.optional(),conversion:Ts.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()}),p_=e.object({id:e.string().trim().min(1).max(128),type:e.literal(1),search_intent:e.string().trim().min(1).max(255),path:e.string().trim().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),channel:e.string().trim().min(1).max(80),content_format:e.string().trim().min(1).max(80),priority:e.enum(["P0","P1","P2","P3"])}).strict(),v1=e.object({tenant_id:e.string().min(1),site_id:T,brief_id:nt,brief:e.string().min(20).max(1e3),answers:e.array(Os).min(1).max(10),skillSelection:Qe,site_default_locale:ue.optional(),owner_locale:ue.optional(),intent_pages:e.array(p_).max(Nt).optional(),reference:Pt.optional(),input_context:e.object({facts:e.array(Ct).max(120),conflicts:e.array(Dt).max(20)}).optional()}),gr=e.enum(["planning","generating","validating","ready"]),d_=e.enum(["salvaged","deterministic_fallback"]),u_=e.enum(["model_exception_settled_prefix","model_exception_safe_root"]),_r={outcome:d_.optional(),reason:u_.optional(),attempts:e.number().int().positive().optional()};function hr(t,n){if(t.type!=="sitemap.generated")return;let s=t.outcome!==void 0,i=t.reason!==void 0;s!==i&&n.addIssue({code:"custom",path:[s?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var g_=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:W,at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:gr,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:de,sitemap:Je,..._r,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_block_count:e.number().int().nonnegative().optional(),final_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:R,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:R.optional(),at:e.string().min(1)})]),A1=g_.superRefine(hr),Sr=e.object({id:de,tenant_id:e.string().min(1),site_id:T,version:e.number().int().positive(),source_agent_run_id:W.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}).strict(),br=Sr.extend({sitemap:Je}),__=Sr.extend({sitemap:kt}),w1=e.object({sitemap_id:de,creation_key:e.string().min(1),sitemap:Je,source_agent_run_id:W.optional()}),C1=e.object({sitemap_id:de,creation_key:e.string().min(1),sitemap:kt,expected_current_sitemap_id:de,expected_current_sitemap_version:e.number().int().positive(),migration_content_requested:e.boolean().optional()}),P1=e.object({sitemap_id:de,creation_key:e.string().min(1),sitemap:Je,source_agent_run_id:W}),D1=e.object({site:Ne,sitemap:br,next_step:e.literal("workspace")}).strict(),j1=e.object({site:Ne,sitemap:__,next_step:e.literal("workspace")}).strict(),O1=e.object({site:Ne,sitemap:br,next_step:e.literal("sitemap_review")}).strict(),h_=e.object({id:Gs,tenant_id:e.string().min(1),site_id:T,brief_id:nt,questions:vs,answers:e.array(Os),selected_archetype:Qe.optional(),completed_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),N1=e.object({answers:e.array(Os).min(1),questions:vs,selected_archetype:Qe.optional()}),L1=e.object({clarify_session:h_}),M1=e.object({questions:vs,selected_archetype:Qe}),S_=e.object({id:gn,tenant_id:e.string().min(1),site_id:T,version:e.number().int().positive(),design_plan:mr,source_agent_run_id:W.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),U1=e.object({design_plan_id:gn.optional(),design_plan:mr,source_agent_run_id:W.optional()}),F1=e.object({design_plan:S_}),dn=e.enum(["initial_generation","iteration"]),b_=e.object({label:e.string().min(1).max(48),prompt:e.string().min(1).max(160)}).strict(),f_=e.enum(["model","derived","mixed","advisor"]),fr=e.object({suggestions:e.array(b_).min(1).max(4),source:f_}).strict(),y_=e.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),x_=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"]),yr=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"]),E_=e.object({id:e.string().min(1),title:e.string().min(1),status:e.enum(["pending","running","completed","failed"])}),Ke=e.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),Ns=e.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),Ls=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()}),re=e.string().min(1).refine(t=>Dr(t),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),Ms=e.object({deduped_paths:e.array(re),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(re)}),Us=e.object({group_id:e.string().min(1),phase:Ns,title:e.string().min(1),status:Ke,task_ids:e.array(e.string().min(1)),depends_on_groups:e.array(e.string().min(1)),target_paths:e.array(re)}),I_=e.enum(["style","media","chrome","section","layout","page"]),Fs=e.object({task_id:e.string().min(1),group_id:e.string().min(1),kind:I_,target_path:re,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(Ps).optional(),status:Ke,required_reads:e.array(re).optional(),search_params_sections:e.array(re).optional()}),qs=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"])}),q1=e.object({plan_id:e.string().min(1),run_kind:dn,model_route:e.object({planner:e.literal("workspace_planner"),worker:e.literal("workspace")}),groups:e.array(Us),tasks:e.array(Fs),dependencies:e.array(qs),expected_outputs:e.array(re),diagnostics:Ms}),G1=e.object({task_id:e.string().min(1),patch:e.unknown().optional(),snapshot_id:R.optional(),read_files:e.array(re),diagnostics:e.array(Ls),status:Ke}),xr=e.object({worker_count:e.number().int().nonnegative(),task_count:e.number().int().nonnegative(),group_count:e.number().int().nonnegative()}),Er=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()}),R_=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"]).optional()}),T_=e.object({type:e.literal("reasoning"),text:e.string(),state:e.enum(["streaming","done"]).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),k_=e.object({type:e.literal("file"),mediaType:e.string().min(1),filename:e.string().min(1).optional(),url:e.string().min(1)}),v_=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()}),A_=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()}),w_=e.object({type:e.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:e.string().min(1).optional(),data:e.unknown()}),C_=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()}),P_=e.object({type:e.literal("error"),errorText:e.string().min(1)}),D_=e.object({type:e.literal("step-start")}),mn=e.union([R_,T_,k_,v_,A_,w_,C_,P_,D_]),j_=e.string().min(1).max(512).refine(t=>Dr(t)&&!/^[A-Za-z]:\//.test(t),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),O_=e.array(j_).min(1).max(64),N_=e.array(e.string().min(1).max(120)).min(1).max(64),L_=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:W,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(mn).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),interaction_response:Bt.optional(),at:e.string().min(1)}),e.object({type:e.literal("plan.updated"),steps:e.array(E_),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(Xo).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:gr,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:de,sitemap:Je,..._r,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_block_count:e.number().int().nonnegative().optional(),final_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("sitemap.updated"),sitemap_id:de,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),interaction_request:Wn.optional(),at:e.string().min(1)}),e.object({type:e.literal("workspace.plan.created"),plan_id:e.string().min(1),run_kind:dn,groups:e.array(Us),tasks:e.array(Fs),dependencies:e.array(qs),expected_outputs:e.array(re),diagnostics:Ms,summary:xr,at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.worker.updated"),group_id:e.string().min(1),phase:Ns,status:Ke,task_counts:Er,target_paths:e.array(re),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:Ke,target_path:re,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(Ls).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:O_.optional(),degraded_page_ids:N_.optional(),snapshot_id:R.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 i of["degraded_file_paths","degraded_page_ids"])t[i]!==void 0&&n.addIssue({code:"custom",path:[i],message:`${i} 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 i of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])t[i]!==void 0&&n.addIssue({code:"custom",path:[i],message:`${i} is not allowed for generated_code_rescue`})}),e.object({type:e.literal("workspace.design_plan.outcome"),design_plan_outcome:y_,reason:x_,at:e.string().min(1)}).strict(),fr.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:R,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("snapshot.finalized"),snapshot_id:R,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:R,at:e.string().min(1)}),e.object({type:e.literal("preview.build.succeeded"),snapshot_id:R,at:e.string().min(1)}),e.object({type:e.literal("preview.build.failed"),snapshot_id:R,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:Zo.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),outcome:e.literal("retained_previous").optional(),details:e.record(e.string(),e.unknown()).optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:R.optional(),degraded_reason:at.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:ir,title:e.string().min(1).max(200),detail:e.string().max(360).optional(),title_code:je.optional(),detail_code:je.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:je.optional(),detail_code:je.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)})]),Ir=L_.superRefine(hr).superRefine((t,n)=>{if(t.type==="user.message"&&t.interaction_response&&!t.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"}),t.type!=="tool.finished")return;let s=t.name==="prepare_product_search_entry";s!==!!t.interaction_request&&n.addIssue({code:"custom",path:["interaction_request"],message:s?"prepare_product_search_entry requires interaction_request":"interaction_request is only valid for prepare_product_search_entry"})}),Is=e.object({id:Bs,tenant_id:e.string().min(1),site_id:T,agent_run_id:W,sequence:e.number().int().positive(),event_type:yr,payload:Ir,created_at:e.string().min(1)}),K1=e.object({event_type:yr,payload:Ir}).superRefine((t,n)=>{t.event_type!==t.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),At(t.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),B1=e.discriminatedUnion("status",[e.object({status:e.literal("appended"),agent_run:Oe,event:Is,next_cursor:e.number().int().nonnegative()}),e.object({status:e.literal("duplicate_ignored"),agent_run:Oe,event:Is,next_cursor:e.number().int().nonnegative()})]),z1=e.object({events:e.array(Is),next_cursor:e.number().int().nonnegative().optional()}),W1=e.object({after_sequence:e.coerce.number().int().nonnegative().default(0)}),V1=e.enum(["implemented","skeleton","planned"]),$1=e.enum(["GET","POST","PUT","PATCH","DELETE"]),H1=[{method:"PATCH",path:"/internal/sites/:site_id/snapshots/:snapshot_id/manifest",tag:"snapshots",summary:"Compare-and-set the manifest hash for the active current snapshot after an in-place object replacement.",status:"implemented",request_body_schema:"UpdateCurrentSnapshotManifestRequestSchema",response_schema:"SnapshotRecordSchema",notes:["Internal Agent authentication is required. The update succeeds only when site current_snapshot_id, snapshot status, object key, and expected manifest hash still match."]},{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:"POST",path:"/sites/:site_id/workflow",tag:"site-workflows",summary:"Create one version-bound site workflow from a published flow definition.",status:"implemented",request_body_schema:"CreateSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/workflow",tag:"site-workflows",summary:"Read the current site workflow snapshot and derived menu state.",status:"implemented",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/advance",tag:"site-workflows",summary:"Advance one workflow node with an expected-current-node guard; site_build uses the dedicated release-gated command.",status:"implemented",request_body_schema:"AdvanceSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/complete-static-node",tag:"site-workflows",summary:"Complete the visible static build node after the server verifies a released deployment.",status:"implemented",request_body_schema:"CompleteStaticSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema",notes:["This is the only command that can advance site_build. The browser cannot submit workflow or deployment result statuses; the server verifies persisted release facts before advancing exactly one node."]},{method:"POST",path:"/sites/:site_id/workflow/tasks/register",tag:"site-workflows",summary:"Register a business-owned external task id and its idempotency key.",status:"implemented",request_body_schema:"RegisterWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/step2-site-initialization/tasks",tag:"site-workflows/step2-site-initialization",summary:"Create or reuse the current workflow's Step2 website crawl task.",status:"implemented",response_schema:"Step2SiteInitializationTaskResponseSchema",notes:["The server derives tenantId, sessionId, and siteUrl from trusted request/workflow state; the browser cannot submit upstream scope fields."]},{method:"GET",path:"/sites/:site_id/workflow/step2-site-initialization/tasks/:task_id",tag:"site-workflows/step2-site-initialization",summary:"Poll the workflow-owned Step2 website crawl task.",status:"implemented",response_schema:"Step2SiteInitializationTaskResponseSchema",notes:["The task id must match the current non-superseded website_crawl task reference for the workflow."]},{method:"POST",path:"/sites/:site_id/workflow/tasks/:task_type/replace",tag:"site-workflows",summary:"Replace one task reference while retaining its superseded history.",status:"implemented",request_body_schema:"ReplaceWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/tasks/website_crawl/replace-and-invalidate-dependents",tag:"site-workflows",summary:"Replace website crawl and invalidate basic-info and metrics dependents atomically.",status:"implemented",request_body_schema:"ReplaceCrawlWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/build",tag:"site-workflows",summary:"Start the server-owned site build and workspace snapshot lifecycle.",status:"implemented",request_body_schema:"StartSiteBuildRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema",notes:["The browser may start or query the build, but cannot write site build or deployment summary status directly."]},{method:"GET",path:"/sites/:site_id/workflow/customer-materials",tag:"site-workflows",summary:"Read the persisted no-website customer materials draft.",status:"implemented",response_schema:"CustomerMaterialsNullableResponseSchema"},{method:"PUT",path:"/sites/:site_id/workflow/customer-materials",tag:"site-workflows",summary:"Save the no-website customer materials before submission.",status:"implemented",request_body_schema:"CustomerMaterialsDraftSchema",response_schema:"CustomerMaterialsResponseSchema",notes:["A submitted record is immutable and rejects later writes."]},{method:"POST",path:"/sites/:site_id/workflow/customer-materials/submit",tag:"site-workflows",summary:"Submit and freeze customer materials before analysis.",status:"implemented",request_body_schema:"CustomerMaterialsDraftSchema",response_schema:"CustomerMaterialsResponseSchema",notes:["Repeated submissions return 409; clients may retry only the separate workflow advance."]},{method:"POST",path:"/sites/:site_id/workflow/tasks/drive-current",tag:"site-workflows",summary:"Provider-backed task action that exercises VCP task atomics.",status:"implemented",request_body_schema:"WorkflowMockDriveRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema",notes:["The development provider is disabled unless VCP_WORKFLOW_MOCK_ENABLED=true and NODE_ENV is not production; production injects a real provider or fails closed."]},{method:"POST",path:"/sites/:site_id/workflow/tasks/retry-crawl",tag:"site-workflows",summary:"Provider-backed crawl retry with dependent invalidation.",status:"implemented",request_body_schema:"WorkflowMockRetryCrawlRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema",notes:["Disabled unless VCP_WORKFLOW_MOCK_ENABLED=true and NODE_ENV is not production."]},{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:"POST",path:"/sites/:site_id/designer/component-library/resources/:resource_id/install",tag:"designer-component-library",summary:"Install one exact component version and return a strict SiteEditEngine materialization.",status:"implemented",request_body_schema:"InstallDesignerComponentBodySchema",response_schema:"InstallDesignerComponentResponseSchema",notes:["The server downloads the resource ZIP with the configured secret, validates main.json identity and compatibility, and returns only the strict materialization plus immutable revision metadata."]},{method:"GET",path:"/sites/:site_id/designer/page-library/categories",tag:"designer-page-library",summary:"List the fixed insert-new-page category tree for a site.",status:"implemented",response_schema:"ListDesignerPageCategoriesResponseSchema",notes:["The server validates site ownership and fixes category_group_key to insertNewPage."]},{method:"GET",path:"/sites/:site_id/designer/page-library/resources",tag:"designer-page-library",summary:"List page and pages resources from the fixed designer catalog.",status:"implemented",query_schema:"ListDesignerPagesQuerySchema",response_schema:"ListDesignerPagesResponseSchema",notes:["The server fixes resource types to page and pages and does not expose resource-platform credentials or internal routing."]},{method:"POST",path:"/sites/:site_id/designer/page-library/resources/:resource_id/prepare",tag:"designer-page-library",summary:"Resolve one exact page resource version for designer-side draft configuration.",status:"implemented",request_body_schema:"PrepareDesignerPageBodySchema",response_schema:"PrepareDesignerPageResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-library/resources/:resource_id/install",tag:"designer-page-library",summary:"Install one exact page resource version and return a strict PageResourceArtifact.",status:"implemented",request_body_schema:"InstallDesignerPageBodySchema",response_schema:"InstallDesignerPageResponseSchema",notes:["The server validates the explicit resource type, immutable package identity, page selections, materializations, and package-local references."]},{method:"GET",path:"/sites/:site_id/designer/pages",tag:"designer-page-library",summary:"List designer pages from the stable first-phase fixture source.",status:"implemented",response_schema:"ListDesignerSitePagesResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-resources/enhance",tag:"designer-page-library",summary:"Echo a designer page-resource candidate without model execution or normalization.",status:"implemented",request_body_schema:"EnhanceDesignerPageResourceBodySchema",response_schema:"EnhanceDesignerPageResourceResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-resources/compose",tag:"designer-page-library",summary:"Compose exact page and component resources into one strict page artifact.",status:"implemented",request_body_schema:"ComposeDesignerPageResourceBodySchema",response_schema:"InstallDesignerPageResponseSchema",notes:["The server installs every immutable source, validates ordered page blocks, scopes component materializations, and returns one artifact without exposing resource-platform credentials."]},{method:"POST",path:"/sites/:site_id/designer/page-resources/blank",tag:"designer-page-library",summary:"Create the deterministic built-in blank page artifact for one configured route.",status:"implemented",request_body_schema:"InstallDesignerPageBodySchema",response_schema:"InstallDesignerPageResponseSchema"},{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/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:"GET",path:"/sites/:site_id/media-assets",tag:"media-assets",summary:"List or search enterprise image assets through the CMS adapter.",status:"implemented",query_schema:"ListMediaLibraryAssetsQuerySchema",response_schema:"ListMediaLibraryAssetsResponseSchema"},{method:"POST",path:"/sites/:site_id/media-assets",tag:"media-assets",summary:"Upload one validated image and create its enterprise asset.",status:"implemented",response_schema:"UploadMediaLibraryAssetResponseSchema",notes:["Accepts one multipart field named file; only the image MIME allowlist is accepted and the maximum size is 20 MiB."]},{method:"GET",path:"/sites/:site_id/media-assets/unsplash/search",tag:"media-assets",summary:"Search Unsplash through the VCP server-side client.",status:"implemented",query_schema:"SearchUnsplashMediaQuerySchema",response_schema:"SearchUnsplashMediaResponseSchema",notes:["The browser never receives the Unsplash access key; CMS is not involved in search."]},{method:"POST",path:"/sites/:site_id/media-assets/unsplash/:provider_id/use",tag:"media-assets",summary:"Best-effort report that an Unsplash image was selected.",status:"implemented",request_body_schema:"UseUnsplashMediaRequestSchema",response_schema:"UseUnsplashMediaResponseSchema",notes:["CMS report failure returns reported=false and does not roll back the image replacement."]},{method:"POST",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Confirm the currently reviewed Sitemap Draft and advance the site to structure_saved.",status:"implemented",request_body_schema:"ConfirmSiteStructureRequestSchema",response_schema:"PersistSiteSitemapDraftResponseSchema"},{method:"POST",path:"/internal/sites/:site_id/sitemap-draft",tag:"sitemaps",summary:"Persist an agent-generated sitemap draft without confirming the structure.",status:"implemented",request_body_schema:"PersistGeneratedSitemapDraftRequestSchema",response_schema:"PersistGeneratedSitemapDraftResponseSchema"},{method:"GET",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Read the current Sitemap Draft for a site.",status:"implemented",response_schema:"SitemapDraftRecordSchema"},{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 sites in the editable build phase are writable; the brief row is upserted idempotently while site status, 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 sites in the editable build phase are writable; missing brief rows are created on first save; identical retries 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",request_body_schema:"PromoteSiteSnapshotRequestSchema",response_schema:"PromoteSiteSnapshotResponseSchema"},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/lock/try-acquire",tag:"snapshots",summary:"Try to acquire the short-lived template-upgrade site lock.",status:"implemented",request_body_schema:"TryAcquireTemplateUpgradeLockRequestSchema",response_schema:"TryAcquireTemplateUpgradeLockResponseSchema",notes:["Internal agent-only endpoint; lock contention returns acquired=false instead of a user-facing conflict."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/lock/release",tag:"snapshots",summary:"Release the calling template-upgrade attempt's site lock.",status:"implemented",request_body_schema:"ReleaseTemplateUpgradeLockRequestSchema",response_schema:"ReleaseTemplateUpgradeLockResponseSchema",notes:["Internal agent-only endpoint; release is scoped by tenant, site, operation type, and owner."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/snapshots/:snapshot_id/promote",tag:"snapshots",summary:"CAS-promote a validated template-upgrade candidate and bind its accepted commit atomically.",status:"implemented",request_body_schema:"PromoteTemplateUpgradeSnapshotRequestSchema",response_schema:"PromoteTemplateUpgradeSnapshotResponseSchema",notes:["Internal agent-only endpoint; accepted_commit is never part of the public promote request or response."]},{method:"GET",path:"/internal/sites/:site_id/template-upgrade/state",tag:"snapshots",summary:"Inspect the projected tenant-scoped template-upgrade state without mutation.",status:"implemented",query_schema:"InspectTemplateUpgradeStateRequestSchema",response_schema:"InspectTemplateUpgradeStateResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and the repository path is read-only."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/prepare",tag:"snapshots",summary:"Prepare the tenant-scoped template-upgrade retry state for a target version.",status:"implemented",request_body_schema:"PrepareTemplateUpgradeStateRequestSchema",response_schema:"PrepareTemplateUpgradeStateResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and is never accepted in the request body."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/failure",tag:"snapshots",summary:"Record a finite validation failure for the prepared template-upgrade target.",status:"implemented",request_body_schema:"RecordTemplateUpgradeFailureRequestSchema",response_schema:"RecordTemplateUpgradeFailureResponseSchema",notes:["Internal agent-only endpoint; accepts a finite error code and never raw validation output."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/success",tag:"snapshots",summary:"Reset retry state after the prepared template-upgrade target succeeds.",status:"implemented",request_body_schema:"RecordTemplateUpgradeSuccessRequestSchema",response_schema:"RecordTemplateUpgradeSuccessResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and is never accepted in the request body."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/events",tag:"snapshots",summary:"Record one bounded template-upgrade observability event.",status:"implemented",request_body_schema:"RecordTemplateUpgradeEventRequestSchema",response_schema:"RecordTemplateUpgradeEventResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and the strict request excludes raw errors, source content, and file paths."]},{method:"GET",path:"/internal/template-upgrades/report",tag:"snapshots",summary:"Read tenant-scoped template-upgrade outcome, state, and duration aggregates.",status:"implemented",query_schema:"GetTemplateUpgradeReportQuerySchema",response_schema:"GetTemplateUpgradeReportResponseSchema",notes:["Internal endpoint; tenant identity is derived from trusted request context and all aggregates are tenant-scoped."]},{method:"GET",path:"/internal/template-upgrades/snapshot-deletions/pending",tag:"snapshots",summary:"List tenant-scoped stale template-upgrade snapshot deletions for dry-run or reconciliation.",status:"implemented",query_schema:"ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema",response_schema:"ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema",notes:["Defaults to retrying deleting tombstones. Including candidate snapshots is an explicit maintenance action and should use a conservative age threshold."]},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/abandon",tag:"snapshots",summary:"Mark an unpromoted candidate snapshot as failed.",status:"implemented",response_schema:"AbandonSiteSnapshotResponseSchema"},{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:"Prepare two-phase deletion of a candidate snapshot and return its object key; refuses non-candidate/current/referenced snapshots.",status:"implemented",response_schema:"DeleteSiteSnapshotResponseSchema",notes:["Internal Agent authentication is required. This endpoint only creates a deleting tombstone; object removal and completion are separate steps."]},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/deletion/complete",tag:"snapshots",summary:"Complete deletion after the snapshot object has been removed; only accepts deleting snapshots.",status:"implemented",response_schema:"CompleteSiteSnapshotDeletionResponseSchema",notes:["Internal Agent authentication is required; callers must remove the object before completing the DB deletion."]},{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:"/deployments",tag:"deployments",summary:"Deployment resource summary endpoint until publish APIs 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:"POST",path:"/v1/agent/workspace/:site_id/form-design-operations",tag:"agent/workspace",summary:"Create or replay a deterministic FORM_SPEC save operation.",status:"implemented",request_body_schema:"FormDesignSaveRequestSchema",response_schema:"FormDesignOperationResponseSchema"},{method:"GET",path:"/v1/agent/workspace/:site_id/form-design-operations/:operation_id",tag:"agent/workspace",summary:"Read a persisted FORM_SPEC save operation.",status:"implemented",response_schema:"FormDesignOperationResponseSchema"},{method:"POST",path:"/v1/agent/workspace/:site_id/form-design-operations/:operation_id/resume",tag:"agent/workspace",summary:"Resume a recoverable FORM_SPEC save with its original fingerprint.",status:"implemented",request_body_schema:"FormDesignResumeRequestSchema",response_schema:"FormDesignOperationResponseSchema"},{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; optional expected_current_snapshot_id enables current-snapshot CAS.",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/preview/activate",tag:"site-preview",summary:"Activate the existing preview sandbox for a site.",status:"implemented",response_schema:"SitePreviewActivateResponseSchema"},{method:"POST",path:"/v1/agent/site-preview/:site_id/activate",tag:"agent/site-preview",summary:"Activate the existing preview sandbox for a site through Agent.",status:"implemented",response_schema:"SitePreviewActivateResponseSchema"},{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:["The API validates the site, snapshot, in-flight deployment state, and site operation lock before creating the deployment record and queue job.","Before writing the deployment record or queue job, the API requires an active primary custom domain; otherwise it returns 409 DEPLOYMENT_ACTIVE_CUSTOM_DOMAIN_REQUIRED.","The API returns after creating the deployment record and queue job; worker-service claims deployment_jobs for build and Cloudflare publish."]},{method:"POST",path:"/sites/:site_id/deployments/quality-check",tag:"deployments",summary:"Queue a quality-check deployment from a snapshot.",status:"implemented",request_body_schema:"CreateDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/quality-check/status",tag:"deployments",summary:"Read the latest quality-check deployment status.",status:"implemented",response_schema:"GetDeploymentsStatusResponseSchema"},{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:["Binding requires a CMS-ready site and a valid hostname; the API reads the fixed CNAME before sending the downstream bind request."]},{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:"POST",path:"/sites/:site_id/domains/:hostname/activate-primary",tag:"custom-domains",summary:"Activate a custom domain as the site's primary publish domain.",status:"implemented",response_schema:"ActivatePrimarySiteDomainResponseSchema"},{method:"DELETE",path:"/sites/:site_id/domains/:hostname",tag:"custom-domains",summary:"Delete a non-primary custom domain.",status:"implemented",response_schema:"DeleteSiteDomainResponseSchema"},{method:"POST",path:"/sites/:site_id/integrations/gsc/auth/start",tag:"gsc",summary:"Start Google Search Console authorization for a site.",status:"implemented",request_body_schema:"StartGscAuthRequestSchema",response_schema:"StartGscAuthResponseSchema"},{method:"GET",path:"/sites/:site_id/integrations/gsc/status",tag:"gsc",summary:"Read Google Search Console authorization and property status.",status:"implemented",response_schema:"GscStatusResponseSchema"},{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"}],Y1=[{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"]}],M_=e.object({id:e.string().min(1),role:e.enum(["system","user","assistant"]),metadata:e.unknown().optional(),parts:e.array(mn).min(1)}),Rr=M_.extend({role:e.literal("user")}),X1=e.object({base_snapshot_id:R.optional(),message:Rr.optional(),client_run_key:e.string().min(1).max(200).optional()}).superRefine((t,n)=>{At(t.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),U_=e.object({path:e.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:W,base_snapshot_id:R,run_kind:dn}),Z1=e.object({agent_run:Oe,websocket:U_,next_step:e.literal("workspace_socket")}),Q1=e.object({agent_run:Oe}),J1=e.object({agent_type:e.enum(["clarify","sitemap","workspace"])}),eT=e.object({agent_run:Oe}),tT=e.enum(["client.message.create","client.resource.operation.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"]),$=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:T,run_id:W.optional(),correlation_id:e.string().min(1).optional(),seq:e.number().int().positive().optional(),sent_at:e.string().min(1)}),F_=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()}),q_=e.discriminatedUnion("type",[$.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(),current_route_id:_t.optional(),interaction_response:Bt.optional(),selected_component:F_.optional(),message:Rr,base_snapshot_id:R.optional()}).superRefine((t,n)=>{t.interaction_response&&!t.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"})})}),$.extend({type:e.literal("client.run.cancel"),payload:e.object({run_id:W,reason:e.string().min(1).optional()})}),$.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()})}),ii]),G_=e.discriminatedUnion("type",[$.extend({type:e.literal("server.run.started"),payload:e.object({run_id:W,agent_type:e.literal("workspace")})}),$.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(mn).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),interaction_response:Bt.optional()})}),$.extend({type:e.literal("server.assistant.delta"),payload:e.object({message_id:e.string().min(1),parts:e.array(mn).min(1),status:e.enum(["streaming","ready"])})}),$.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)})}),$.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),interaction_request:Wn.optional()})}),$.extend({type:e.literal("server.workspace.suggestions"),payload:fr.extend({run_id:W}).strict()}),$.extend({type:e.literal("workspace.plan.created"),payload:e.object({plan_id:e.string().min(1),run_kind:dn,groups:e.array(Us),tasks:e.array(Fs),dependencies:e.array(qs),expected_outputs:e.array(re),diagnostics:Ms,summary:xr})}),$.extend({type:e.literal("workspace.worker.updated"),payload:e.object({group_id:e.string().min(1),phase:Ns,status:Ke,task_counts:Er,target_paths:e.array(re),diagnostics:e.array(e.string().min(1))})}),$.extend({type:e.literal("workspace.task.updated"),payload:e.object({task_id:e.string().min(1),group_id:e.string().min(1),status:Ke,target_path:re,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(Ls).optional()})}),$.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()})}),$.extend({type:e.literal("server.sitemap.updated"),payload:e.object({sitemap_id:de,version:e.number().int().positive(),reason:e.string().min(1)})}),$.extend({type:e.literal("server.snapshot.created"),payload:e.object({snapshot_id:R,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/)})}),$.extend({type:e.literal("server.snapshot.finalized"),payload:e.object({snapshot_id:R})}),$.extend({type:e.literal("server.preview.invalidated"),payload:e.object({reason:e.string().min(1),next_preview_url:e.string().url().optional()})}),$.extend({type:e.literal("preview.build.started"),payload:e.object({snapshot_id:R})}),$.extend({type:e.literal("preview.build.succeeded"),payload:e.object({snapshot_id:R})}),$.extend({type:e.literal("preview.build.failed"),payload:e.object({snapshot_id:R,message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean()})}),$.extend({type:e.literal("server.run.finished"),payload:e.object({run_id:W,snapshot_id:R,degraded_reason:at.optional()})}),$.extend({type:e.literal("server.run.failed"),payload:e.object({run_id:W,error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),outcome:e.literal("retained_previous").optional(),details:e.record(e.string(),e.unknown()).optional()})}),$.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})}),$.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:ir,title:e.string().min(1).max(200),title_code:je.optional(),detail:e.string().max(360).optional(),detail_code:je.optional(),locks_input:e.boolean()})}),$.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:je.optional(),detail:e.string().max(360).optional(),detail_code:je.optional()})}),$.extend({type:e.literal("server.activity.finished"),payload:e.object({activity_id:e.string().min(1)})}),$.extend({type:e.literal("server.activity.failed"),payload:e.object({activity_id:e.string().min(1),detail:e.string().max(360).optional()})})]),K_=G_.superRefine((t,n)=>{if(t.type==="server.user.message"&&t.payload.interaction_response&&!t.payload.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["payload","in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"}),t.type!=="server.tool.completed")return;let s=t.payload.name==="prepare_product_search_entry";s!==!!t.payload.interaction_request&&n.addIssue({code:"custom",path:["payload","interaction_request"],message:s?"prepare_product_search_entry requires interaction_request":"interaction_request is only valid for prepare_product_search_entry"})}),nT=e.union([q_,K_]),sT={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."},{name:"unattended",required:!1,schema:'"1"',summary:"Unattended mode for machine-driven runs: interactive tools are withheld so the run cannot stall waiting for a human answer. Server-to-server only; the browser proxy strips it."}],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."]},Tr=e.string().regex(/^sha256:[a-f0-9]{64}$/),B_=e.enum(["create","update","delete","str_replace"]),kr=e.enum(["sitemap_resync","smoke_test","prepare_preview"]),z_=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(),W_=e.object({path:re,operation:B_,expected_hash:Tr.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(z_).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(sh(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"})}),V_=e.object({kind:e.enum(["block","page","site","chrome"]),id:e.string().min(1).max(120)}),$_=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:V_,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)}),vr=e.object({site_id:T,base_snapshot_id:R,reason:e.string().min(1),patches:e.array(W_).min(1),media_requests:e.array($_).max(24).optional(),post_actions:e.array(kr).optional()});function Ar(t,n){let s=new Set;for(let[i,a]of t.patches.entries())s.has(a.path)&&n.addIssue({code:"custom",path:["patches",i,"path"],message:`Duplicate patch path: ${a.path}`}),s.add(a.path)}var aT=vr.superRefine(Ar),iT=vr.omit({base_snapshot_id:!0}).extend({site_id:T.optional()}).superRefine(Ar),H_=ce,Y_=e.object({path:H_,operation:e.enum(["upsert","delete"]).optional()}),wr=e.enum(["sync_cms_pages","sync_cms_navigation"]),oT=e.object({files:e.array(Y_).min(1),post_actions:e.array(wr).optional()}).strict().overwrite(t=>t.post_actions?{...t,post_actions:[...new Set(t.post_actions)]}:t),X_=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"]),Z_=e.object({status:e.literal("applied"),patch_batch_id:e.string().min(1),site_id:T,base_snapshot_id:R,snapshot_id:R,manifest_hash:Tr,object_key:e.string().min(1),changed_files:e.array(re).min(1),post_actions_queued:e.array(kr),dropped_protected_files:e.array(e.string().min(1)).min(1).optional()}),Q_=e.object({status:e.literal("failed"),code:X_,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),rT=e.discriminatedUnion("status",[Z_,Q_]),cT=e.object({ok:e.literal(!0),post_actions:e.array(e.object({action:wr,status:e.enum(["succeeded","failed"])}).strict()).default([])}),Cr=ce,J_=e.enum(["text","binary"]),Pr=e.object({path:Cr,kind:J_,language:e.string().min(1).nullable(),size_bytes:e.number().int().nonnegative()}),mT=e.object({path:Cr}),eh=Pr.extend({kind:e.literal("text"),language:e.string().min(1),content:e.string()}),th=Pr.extend({kind:e.literal("binary"),language:e.null(),mime_type:e.string().min(1),content_base64:e.string().min(1)}),lT=e.union([eh,th]);function At(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=>At(n)):Object.entries(t).some(([n,s])=>nh(n)||At(s))}function nh(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 Dr(t){let n=t.split("/");return t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&n.every(s=>s!==""&&s!=="."&&s!=="..")}function sh(t){let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(t);if(!n)return!0;let i=(n[1]??"").split("/").filter(c=>c.length>0);return i.some(c=>c.startsWith("_"))?!0:i.filter(c=>!c.startsWith("@")&&!/^\(.+\)$/.test(c)).map(c=>c.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(c=>c.length>0).every(c=>/^\[.*\]$/.test(c)||mt.test(`/${c}`))}var jr=e.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),ah=e.object({id:wt,tenant_id:e.string().min(1),site_id:T,sandbox_id:e.string().min(1).nullable(),status:jr,source_snapshot_id:R.nullable(),last_snapshot_id:R.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)}),pT=e.object({session_id:wt.optional(),sandbox_id:e.string().min(1).optional(),source_snapshot_id:R.optional(),last_snapshot_id:R,expected_current_snapshot_id:R.optional(),expected_ready_session_id:wt.optional(),status:jr,preview_url:e.string().url().optional()}),dT=e.object({preview_session:ah,next_step:e.literal("preview")}),uT=e.object({failed_count:e.number().int().nonnegative()}),gT=e.object({site_id:T}),_T=e.object({status:e.enum(["cancelled","no_active_run"]),agent_run:Oe.nullable()});export{GR as AbandonSiteSnapshotResponseSchema,fo as ActivatePrimarySiteDomainDataSchema,AR as ActivatePrimarySiteDomainResponseSchema,ir as ActivityKindSchema,je as ActivityTitleCodeSchema,Jb as AdvanceSiteWorkflowRequestSchema,Zo as AgentErrorCategorySchema,Bs as AgentEventIdSchema,Is as AgentEventRecordSchema,Ir as AgentEventSchema,yr as AgentEventTypeSchema,er as AgentModelRouteSchema,E_ as AgentPlanStepSchema,W as AgentRunIdSchema,Jo as AgentRunKindSchema,Oe as AgentRunRecordSchema,kg as AgentRunStatusSchema,Qo as AgentRunTypeSchema,w_ as AiSdkUiDataPartSchema,P_ as AiSdkUiErrorPartSchema,k_ as AiSdkUiFilePartSchema,mn as AiSdkUiMessagePartSchema,M_ as AiSdkUiMessageSchema,T_ as AiSdkUiReasoningPartSchema,A_ as AiSdkUiSourceDocumentPartSchema,v_ as AiSdkUiSourceUrlPartSchema,D_ as AiSdkUiStepStartPartSchema,R_ as AiSdkUiTextPartSchema,C_ as AiSdkUiToolPartSchema,V1 as ApiContractStatusSchema,Pg as ApiErrorEnvelopeSchema,N as ApiResponseSchema,K1 as AppendAgentEventRequestSchema,B1 as AppendAgentEventResponseSchema,X_ as ApplyPatchBatchErrorCodeSchema,Q_ as ApplyPatchBatchFailureSchema,aT as ApplyPatchBatchInputSchema,W_ as ApplyPatchBatchPatchSchema,kr as ApplyPatchBatchPostActionSchema,rT as ApplyPatchBatchResultSchema,Z_ as ApplyPatchBatchSuccessSchema,iT as ApplyPatchBatchToolInputSchema,z_ as ApplyPatchEditSchema,B_ as ApplyPatchOperationSchema,Xo as ArchetypeProposalSchema,bh as AuditLogIdSchema,oh as AuthIdentityIdSchema,lh as AuthLoginCodeIdSchema,mh as AuthOidcStateIdSchema,rh as AuthSessionIdSchema,ch as AuthTokenIdSchema,ph as AuthWsTicketIdSchema,eu as BINDING_STATUSES,bo as BindSiteDomainDataSchema,pI as BindSiteDomainRequestSchema,vR as BindSiteDomainResponseSchema,or as BlockGenerationContextSchema,u1 as BlockMediaIntentSchema,lr as BlockSchema,rr as BrandingSchema,nt as BriefIdSchema,ws as BriefRecordSchema,zy as CHAT_COPY,By as CLARIFICATION_COPY,Md as CMS_FORM_FIELD_TYPES,zf as COMPONENT_I18N_FILE_SUFFIX,zt as COMPONENT_I18N_NAMESPACE,_u as CRAWLER_INTERNAL_ERROR_CODES,Li as CURRENT_EDIT_ENGINE_VERSION,ju as CUSTOM_DOMAIN_STATUSES,gT as CancelActiveWorkspaceRunRequestSchema,_T as CancelActiveWorkspaceRunResponseSchema,cr as ChromeDesignSchema,zg as ChromeFooterDesignSchema,Bg as ChromeFooterShellSchema,Gg as ChromeHeaderDesignSchema,qg as ChromeHeaderShellSchema,Wg as ChromeMobileNavDesignSchema,Rg as ClarifyQuestionOptionSchema,Tg as ClarifyQuestionSchema,xg as ClarifyQuestionTypeSchema,vs as ClarifyQuestionsSchema,sR as ClarifyRunInputSchema,Gs as ClarifySessionIdSchema,h_ as ClarifySessionRecordSchema,aR as ClarifyStreamEventSchema,fh as CmsCollectionBindingIdSchema,fE as CmsCollectionBindingSchema,Ji as CmsFormSchemaProjectionSchema,zc as CmsPageDirectoryGroupSchema,xa as CmsPageDirectoryNodeSchema,ya as CmsPageDirectorySchema,Cn as CmsPageTypeSchema,ia as CmsSiteIdSchema,xu as CmsVcpPublishIdSchema,gu as CompanyInfoSchema,DE as CompanyInfoTaskCreateRequestSchema,jE as CompanyInfoTaskCreateResponseSchema,OE as CompanyInfoTaskResponseSchema,BR as CompleteSiteSnapshotDeletionResponseSchema,ef as CompleteSiteWorkflowRequestSchema,tf as CompleteStaticSiteWorkflowRequestSchema,Vf as ComponentI18nResourcesSchema,$S as ComposeDesignerPageResourceBodySchema,C1 as ConfirmSiteStructureRequestSchema,Gx as ConnectDynamicCollectionInputSchema,zx as ConnectFormInputSchema,Ts as ConversionHintsSchema,hu as CrawlerInternalErrorCodeSchema,NE as CrawlerInternalErrorSchema,Ye as CrawlerTaskCodeSchema,RE as CrawlerTaskCreateRequestSchema,vE as CrawlerTaskCreateResponseSchema,ou as CrawlerTaskFailureErrorCodeSchema,co as CrawlerTaskFailureStageSchema,cu as CrawlerTaskPageSchema,TE as CrawlerTaskPagesQuerySchema,wE as CrawlerTaskPagesResponseSchema,AE as CrawlerTaskStatusResponseSchema,qe as CrawlerTaskUuidSchema,p1 as CreateAgentRunConflictResponseSchema,NR as CreateAgentRunRequestSchema,LR as CreateAgentRunResponseSchema,s1 as CreateDeploymentRequestSchema,a1 as CreateDeploymentResponseSchema,Fh as CreateDocumentUploadRequestSchema,kh as CreateExternalSiteEditRequestSchema,vh as CreateExternalSiteEditResponseSchema,Wh as CreateImageUploadRequestSchema,Oh as CreateInputSourceRequestSchema,lR as CreateSiteBriefRequestSchema,DR as CreateSiteBriefResponseSchema,pR as CreateSiteDraftRequestSchema,mR as CreateSiteInputSchema,Qb as CreateSiteWorkflowRequestSchema,Vr as CreateTextInputSourceRequestSchema,$r as CreateUrlInputSourceRequestSchema,i1 as CurrentDeploymentResponseSchema,Nu as CustomDomainDnsRecordPurposeSchema,Mu as CustomDomainDnsRecordSchema,Lu as CustomDomainDnsRecordStatusSchema,Ou as CustomDomainStatusSchema,Rx as CustomerMaterialsDraftResponseSchema,nd as CustomerMaterialsDraftSchema,Tx as CustomerMaterialsNullableResponseSchema,ns as CustomerMaterialsRecordSchema,Ix as CustomerMaterialsResponseSchema,sd as CustomerMaterialsStatusSchema,Yu as DEFAULT_FONTS,hc as DEFAULT_SITE_LOCALE,Cl as DEPLOYMENT_PROGRESS_STEP_CODES,Cg as DEPLOYMENT_REALTIME_CHANNEL,Ws as DEPLOYMENT_STATUSES,l1 as DEPLOYMENT_WEBSOCKET_CONTRACT,RS as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,KS as DESIGNER_PAGE_LIBRARY_ERROR_CODES,Nh as DOCUMENT_EXTENSION_WHITELIST,Lh as DOCUMENT_MIME_WHITELIST,Uu as DefaultPublishDomainSchema,NS as DeleteDesignerPageErrorDetailsSchema,jS as DeleteDesignerPageRequestSchema,OS as DeleteDesignerPageResponseSchema,Zc as DeleteDesignerPageResultSchema,Eo as DeleteSiteDomainDataSchema,PR as DeleteSiteDomainResponseSchema,KR as DeleteSiteSnapshotResponseSchema,Be as DeploymentIdSchema,dh as DeploymentJobIdSchema,Pl as DeploymentProgressStepCodeSchema,jl as DeploymentProgressStepSchema,Dl as DeploymentProgressStepStatusSchema,bi as DeploymentProgressStepsSchema,pn as DeploymentRecordSchema,m1 as DeploymentRedisPubSubEventSchema,Cs as DeploymentStatusSchema,Vo as DeploymentStatusSummarySchema,nr as DeploymentTypeSchema,cn as DeploymentWsDeploymentPayloadSchema,c1 as DeploymentWsServerMessageSchema,wg as DeploymentWsServerMessageTypeSchema,y_ as DesignPlanGenerationOutcomeSchema,x_ as DesignPlanGenerationReasonSchema,gn as DesignPlanIdSchema,h1 as DesignPlanPatchSchema,S_ as DesignPlanRecordSchema,mr as DesignPlanSchema,d1 as DesignTokensSchema,Kc as DesignerComponentCatalogItemSchema,Sa as DesignerComponentCategoriesDataSchema,ha as DesignerComponentCategoryNodeSchema,Me as DesignerComponentExactVersionSchema,fa as DesignerComponentInstallDataSchema,ba as DesignerComponentsDataSchema,tm as DesignerPageCatalogItemSchema,Ca as DesignerPageCategoriesDataSchema,wa as DesignerPageCategoryNodeSchema,Hc as DesignerPageDeleteBlockReasonSchema,$c as DesignerPageDisabledReasonSchema,ct as DesignerPageExactVersionSchema,Ta as DesignerPageGroupSchema,Da as DesignerPageInstallDataSchema,Ra as DesignerPageNodeSchema,Oa as DesignerPageResourcePreparationDataSchema,em as DesignerPageResourceSourceSchema,cm as DesignerPageResourceTemplateSchema,Ue as DesignerPageResourceTypeSchema,Pa as DesignerPagesDataSchema,An as DesignerResourceVersionSchema,Na as DesignerSitePagesDataSchema,zS as DesignerSiteRouteIdSchema,Vy as EDIT_ENGINE_VERSION_HEADER,$y as EDIT_ENGINE_VERSION_SOURCE_HEADER,Gy as ERROR_COPY,Fr as EXTERNAL_SITE_EDIT_INFRASTRUCTURE_REASONS,Ur as EXTERNAL_SITE_EDIT_PROMPT_MAX_LENGTH,ts as EditEngineVersionParseError,La as EnhanceDesignerPageResourceBodySchema,RR as EnhanceDesignerPageResourceResponseSchema,Ch as ExternalSiteEditCallbackAckSchema,wh as ExternalSiteEditCallbackPayloadSchema,qr as ExternalSiteEditCallbackStatusSchema,at as ExternalSiteEditDegradedReasonSchema,Hs as ExternalSiteEditOutcomeSchema,$s as ExternalSiteEditTaskIdSchema,Ys as ExternalSiteEditTaskSchema,Gr as ExternalSiteEditTaskStatusSchema,_R as ExternalSyncSiteRequestSchema,TR as ExternalSyncSiteResponseSchema,Br as ExtractedFactKindSchema,Ct as ExtractedFactSchema,bd as FIELD_TYPES,ig as FONT_PAIRINGS,Yd as FORM_DESIGN_ERROR_CODES,Hd as FORM_DESIGN_FAILURE_STAGES,Vd as FORM_DESIGN_OPERATION_STAGES,$d as FORM_DESIGN_OPERATION_STATUSES,Et as FORM_FIELD_TYPES,Ud as FORM_SPEC_FIELD_TYPE_TO_CMS,$i as FORM_SPEC_FILE_MIN_RUNTIME_VERSION,Vi as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,eE as FORM_TEMPLATE_CATEGORY_COUNTS,Jx as FORM_TEMPLATE_CATEGORY_SLUGS,uT as FailStaleInFlightWorkspaceRunsResponseSchema,Wi as FieldDeclSchema,BE as FirecrawlBatchCreateRequestSchema,zE as FirecrawlBatchCreatedResponseSchema,fu as FirecrawlBatchErrorSchema,VE as FirecrawlBatchErrorsResponseSchema,bu as FirecrawlBatchPageSchema,WE as FirecrawlBatchStatusResponseSchema,qE as FirecrawlCrawlCreateRequestSchema,GE as FirecrawlCrawlCreatedResponseSchema,KE as FirecrawlCrawlStatusResponseSchema,lo as FirecrawlJobStatusSchema,UE as FirecrawlMapRequestSchema,FE as FirecrawlMapResponseSchema,$E as FirecrawlQueueStatusResponseSchema,Kg as FooterShellSurfaceSchema,xd as FormBlockIdSchema,Jt as FormDefinitionIdSchema,Bd as FormDesignAffectedFilesSchema,us as FormDesignErrorCodeSchema,pE as FormDesignErrorSchema,no as FormDesignFailureStageSchema,Z as FormDesignHashSchema,aE as FormDesignOpenResponseSchema,zd as FormDesignOperationFingerprintInputSchema,rs as FormDesignOperationIdSchema,so as FormDesignOperationNextActionSchema,gh as FormDesignOperationRecordIdSchema,mE as FormDesignOperationRecordSchema,gs as FormDesignOperationResponseSchema,io as FormDesignOperationSchema,ds as FormDesignOperationStageSchema,to as FormDesignOperationStatusSchema,lE as FormDesignOperationTransitionRequestSchema,ao as FormDesignPreviewRefreshStatusSchema,oE as FormDesignQueryResponseSchema,rE as FormDesignResumeRequestSchema,cE as FormDesignResumeResponseSchema,Wd as FormDesignSaveRequestSchema,iE as FormDesignSaveResponseSchema,eo as FormDesignSharedImpactSchema,ps as FormDesignStandardizationSchema,fd as FormFieldDeclSchema,Rt as FormFieldNameSchema,cs as FormOptionValueSchema,Ed as FormSpecBindingSchema,Rd as FormSpecFieldNodeSchema,kd as FormSpecNodeSchema,Id as FormSpecOptionSchema,Td as FormSpecStepBreakNodeSchema,ls as FormSpecV1Schema,tE as FormTemplateCatalogResponseSchema,Qi as FormTemplateCategorySlugSchema,Nd as FormTemplateCategoryV1Schema,De as FormTemplateTextSchema,Ld as FormTemplateV1Schema,Fu as GSC_AUTH_STATUSES,qu as GSC_BINDING_STATUSES,Gu as GSC_PROPERTY_TYPES,o1 as GetDeploymentResponseSchema,r1 as GetDeploymentsStatusResponseSchema,Ah as GetExternalSiteEditResponseSchema,xo as GetSiteDomainDetailDataSchema,CR as GetSiteDomainDetailResponseSchema,dx as GetTemplateUpgradeReportQuerySchema,ux as GetTemplateUpgradeReportResponseSchema,RI as GoogleSearchConsoleAuthStartDataSchema,II as GoogleSearchConsoleAuthStartRequestSchema,TI as GoogleSearchConsoleAuthStartResponseSchema,fI as GoogleSearchConsoleAuthStatusSchema,yI as GoogleSearchConsoleBindingStatusSchema,xI as GoogleSearchConsolePropertyTypeSchema,EI as GoogleSearchConsoleStateSchema,vI as GoogleSearchConsoleStatusDataSchema,kI as GoogleSearchConsoleStatusInputSchema,AI as GoogleSearchConsoleStatusResponseSchema,hI as GscAuthStartDataSchema,_I as GscAuthStartRequestSchema,SI as GscAuthStartResponseSchema,_s as GscAuthStatusSchema,hs as GscBindingStatusSchema,Ss as GscPropertyTypeSchema,Bu as GscStateInputSchema,bI as GscStateSchema,ko as GscStatusDataSchema,zu as GscStatusResponseSchema,Bc as HOME_PAGE_URL_PATH,Ug as HeaderShellBehaviorSchema,Fg as HeaderShellShapeSchema,Mg as HeaderShellSurfaceSchema,Lg as HeaderShellVariantSchema,tu as HomeUrlCrawlerTaskCreateRequestSchema,ri as HttpUrlSchema,Gh as IMAGE_EXTENSION_WHITELIST,Kh as IMAGE_MIME_WHITELIST,_a as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,Aa as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,Sc as ISO_639_3_TO_SITE_LOCALE,Hr as ImageRoleSchema,Rr as InboundUserMessageSchema,Kr as InputBundleStatusSchema,Dt as InputConflictSchema,Vh as InputContextBundleSchema,st as InputContextSourceIdSchema,Wr as InputSourceSchema,hn as InputSourceStatusSchema,_n as InputSourceTypeSchema,ex as InspectTemplateUpgradeStateRequestSchema,tx as InspectTemplateUpgradeStateResponseSchema,AS as InstallDesignerComponentBodySchema,bR as InstallDesignerComponentResponseSchema,WS as InstallDesignerPageBodySchema,xR as InstallDesignerPageResponseSchema,U as InternalEntityIdSchema,pc as LEGACY_SITE_LOCALE_CODES,J1 as LatestAgentRunQuerySchema,eT as LatestAgentRunResponseSchema,Q1 as LatestWorkspaceRunResponseSchema,iI as LauncherPromptTemplateApplyRequestSchema,oI as LauncherPromptTemplateApplyResponseSchema,Au as LauncherPromptTemplateCatalogItemSchema,sI as LauncherPromptTemplateCatalogQuerySchema,aI as LauncherPromptTemplateCatalogSchema,ku as LauncherPromptTemplateKindSchema,vu as LauncherPromptTemplateLocaleSchema,on as LauncherPromptTemplateTypeSchema,W1 as ListAgentEventsQuerySchema,z1 as ListAgentEventsResponseSchema,hR as ListDesignerComponentCategoriesResponseSchema,vS as ListDesignerComponentsQuerySchema,SR as ListDesignerComponentsResponseSchema,fR as ListDesignerPageCategoriesResponseSchema,BS as ListDesignerPagesQuerySchema,yR as ListDesignerPagesResponseSchema,IR as ListDesignerSitePagesResponseSchema,lg as ListMediaLibraryAssetsQuerySchema,pg as ListMediaLibraryAssetsResponseSchema,So as ListSiteDomainsDataSchema,kR as ListSiteDomainsResponseSchema,JR as ListSiteVersionsResponseSchema,gx as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,_x as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,Uh as MAX_DOCUMENT_SOURCES_PER_SITE,Mh as MAX_DOCUMENT_UPLOAD_BYTES,zh as MAX_IMAGE_SOURCES_PER_SITE,Bh as MAX_IMAGE_UPLOAD_BYTES,Lo as MEDIA_LIBRARY_AUDIO_EXTENSIONS,Go as MEDIA_LIBRARY_AUDIO_MIME_TYPES,Mo as MEDIA_LIBRARY_DOCUMENT_EXTENSIONS,cg as MEDIA_LIBRARY_EXTENSIONS,Uo as MEDIA_LIBRARY_FILE_EXTENSIONS,Oo as MEDIA_LIBRARY_IMAGE_EXTENSIONS,rg as MEDIA_LIBRARY_IMAGE_MAX_BYTES,Fo as MEDIA_LIBRARY_IMAGE_MIME_TYPES,jo as MEDIA_LIBRARY_MAX_BYTES,mg as MEDIA_LIBRARY_MIME_TYPES,No as MEDIA_LIBRARY_VIDEO_EXTENSIONS,qo as MEDIA_LIBRARY_VIDEO_MIME_TYPES,_1 as MediaAssetSchema,Og as MediaAttributionSchema,xs as MediaLibraryAssetSchema,Ko as MediaLibraryFileTypeSchema,Bo as MediaLibrarySourceSchema,V_ as MediaRequestOwnerSchema,Sh as MediaResolutionCacheIdSchema,kS as MockDesignerComponentInsertDataSchema,TS as MockDesignerComponentInsertRequestSchema,ks as MotionLevelSchema,Ju as NEXT_FONT_DISPLAY_NAMES,vt as NEXT_FONT_REGISTRY,mt as PAGE_SLUG_PATTERN,ze as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,Xc as PageDirectoryReconcileFailedPageSchema,ka as PageDirectoryReconcileResultSchema,Yc as PageDirectoryReconcileStatusSchema,dr as PageNavigationSchema,Dn as PageResourceArtifactSchema,im as PageResourceComponentReferenceSchema,om as PageResourceComponentSchema,sm as PageResourceDraftPageSchema,am as PageResourceDraftSchema,Ft as PageResourceFinalRouteSchema,rm as PageResourcePageSchema,nm as PageResourcePageSelectionSchema,ja as PageResourceRouteMappingSchema,Ds as PageSchema,pr as PageSlugSchema,Qc as PageTargetKindSchema,va as PageTargetSchema,LS as PageTargetSetSchema,N1 as PersistClarifyAnswersRequestSchema,L1 as PersistClarifyAnswersResponseSchema,P1 as PersistGeneratedSitemapDraftRequestSchema,O1 as PersistGeneratedSitemapDraftResponseSchema,pT as PersistPreviewSessionRequestSchema,dT as PersistPreviewSessionResponseSchema,U1 as PersistSiteDesignPlanRequestSchema,F1 as PersistSiteDesignPlanResponseSchema,j1 as PersistSiteSitemapDraftResponseSchema,w1 as PersistSiteSitemapRequestSchema,D1 as PersistSiteSitemapResponseSchema,MR as PersistSiteSnapshotRequestSchema,UR as PersistSiteSnapshotResponseSchema,yg as PositioningPrefillSchema,Es as PositioningSourceSchema,VS as PrepareDesignerPageBodySchema,ER as PrepareDesignerPageResponseSchema,Jy as PrepareTemplateUpgradeStateRequestSchema,Vp as PrepareTemplateUpgradeStateResponseSchema,t1 as PrepareVersionPreviewRequestSchema,n1 as PrepareVersionPreviewResponseSchema,Si as ProductSearchAppConfigDraftSchema,zn as ProductSearchAppSlugSchema,bf as ProductSearchContractFixtureSchema,Il as ProductSearchDraftConfigSchema,pe as ProductSearchFieldNameSchema,xl as ProductSearchFilterMetaSchema,Wn as ProductSearchInteractionRequestSchema,Bt as ProductSearchInteractionResponseSchema,Sf as ProductSearchPopularTermsReadSchema,hi as ProductSearchPopularTermsSchema,vl as ProductSearchRequestSchema,wl as ProductSearchResponseSchema,_t as ProductSearchRouteIdSchema,yl as ProductSearchValueShapeSchema,qR as PromoteSiteSnapshotRequestSchema,vg as PromoteSiteSnapshotResponseSchema,ZR as PromoteTemplateUpgradeSnapshotRequestSchema,QR as PromoteTemplateUpgradeSnapshotResponseSchema,Tu as PublishQualityRecordSchema,JE as PublishQualityResponseSchema,Ky as REFUSAL_COPY,H1 as REST_API_ENDPOINTS,zR as RecordSnapshotVersionRequestSchema,WR as RecordSnapshotVersionResponseSchema,lx as RecordTemplateUpgradeEventRequestSchema,px as RecordTemplateUpgradeEventResponseSchema,nx as RecordTemplateUpgradeFailureRequestSchema,sx as RecordTemplateUpgradeFailureResponseSchema,ax as RecordTemplateUpgradeSuccessRequestSchema,ix as RecordTemplateUpgradeSuccessResponseSchema,zr as ReferencePagePatternSchema,Pt as ReferenceSignalsSchema,nf as RegisterWorkflowTaskCommandRequestSchema,hl as RegisterWorkflowTaskRequestSchema,HR as ReleaseTemplateUpgradeLockRequestSchema,YR as ReleaseTemplateUpgradeLockResponseSchema,of as ReplaceCrawlWorkflowTaskCommandRequestSchema,bl as ReplaceCrawlWorkflowTaskRequestSchema,af as ReplaceWorkflowTaskCommandRequestSchema,Sl as ReplaceWorkflowTaskRequestSchema,qx as ResolvedFieldSchema,Wx as ResolvedFormFieldSchema,$1 as RestApiMethodSchema,e1 as RestoreSiteSnapshotResponseSchema,ar as RouteGenerationCardSchema,Jl as RuleEngineScoreRecordSchema,Ii as RuleScoreDimensionKeySchema,Ql as RuleScoreDimensionSchema,it as SELECTABLE_SITE_LOCALE_CODES,nl as SITE_BUILD_STATUSES,mi as SITE_BUILD_STATUS_CODES,sl as SITE_DEPLOYMENT_STATUSES,li as SITE_DEPLOYMENT_STATUS_CODES,sy as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,Nc as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,kn as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,vn as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,$a as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,hb as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,jp as SITE_EDIT_RUNTIME_CONTAINER_TAGS,Op as SITE_EDIT_RUNTIME_TEXT_TAGS,Dp as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,cb as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,Xr as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,Xs as SITE_EDIT_SOURCE_ALLOWED_DIRS,Yr as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,Sn as SITE_EDIT_SOURCE_DELETE_CAPABILITY,Zr as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,dc as SITE_LOCALE_CODES,iR as SITE_PLANNING_FROZEN_ERROR_CODE,oR as SITE_PLANNING_LOCKED_ERROR_CODE,rR as SITE_STRUCTURE_CONFIRMATION_REQUIRED_ERROR_CODE,cR as SITE_STRUCTURE_CONFIRMATION_STALE_ERROR_CODE,al as SITE_WORKFLOW_STATUSES,pi as SITE_WORKFLOW_STATUS_CODES,Y1 as SSE_STREAMS,Nt as STEP5_PRIMARY_INTENT_PAGE_LIMIT,Ot as STEP5_STRATEGY_KEYS,ra as STEP5_STRATEGY_OPTION_IDS,id as STEP6_AI_THEME_IDS,qi as STEP6_ANIMATION_IDS,Gi as STEP6_DENSITY_IDS,cd as STEP6_FONT_IDS,od as STEP6_STANDARD_THEME_IDS,rd as STEP6_THEME_CATALOG,ad as STEP6_THEME_IDS,nS as SUPPORTED_SITE_LOCALES,wt as SandboxSessionIdSchema,ah as SandboxSessionSchema,jr as SandboxSessionStatusSchema,gR as SaveBriefDraftRequestSchema,OR as SaveBriefDraftResponseSchema,ug as SearchUnsplashMediaQuerySchema,gg as SearchUnsplashMediaResponseSchema,Ru as SensitiveWordDetectionSchema,po as SensitiveWordTaskStatusSchema,Kn as SiteBuildStatusSchema,Xe as SiteCustomDomainSchema,Bn as SiteDeploymentStatusSchema,sr as SiteDesignContextSchema,Eg as SiteDesignDensitySchema,Ig as SiteDesignMotionLevelSchema,$t as SiteEditBoundaryKindSchema,ip as SiteEditCapabilityConstraintSchema,sp as SiteEditCapabilityModeSchema,Vt as SiteEditCapabilityModeViewSchema,um as SiteEditClassNameSourceDiagnosticSchema,Fe as SiteEditClassNameSourceRangeSchema,Ka as SiteEditClassNameSourceSchema,tb as SiteEditClassNameSourceStyleContextSchema,Ga as SiteEditClassNameSourceStylesheetSchema,On as SiteEditClassNameSourceWriteIntentSchema,ZS as SiteEditCommandDiagnosticSchema,pm as SiteEditCommandErrorSchema,ap as SiteEditConstraintKindSchema,zm as SiteEditDeletePageSourceOutputSchema,Ip as SiteEditDynamicConfidenceSchema,Tp as SiteEditDynamicDataBindingSchema,Ci as SiteEditDynamicDataDetailSchema,Pi as SiteEditDynamicDataSummarySchema,Rp as SiteEditDynamicEvidenceSchema,wi as SiteEditDynamicSourceKindSchema,xp as SiteEditDynamicSourceTypeSchema,Ep as SiteEditDynamicTargetKindSchema,Ap as SiteEditEffectiveWriteTargetSchema,Nn as SiteEditElementPropertySchema,ey as SiteEditEventSchema,Zn as SiteEditExternalSourceKindSchema,sb as SiteEditGetClassNameSourceCommandResultSchema,nb as SiteEditGetClassNameSourceResultSchema,lp as SiteEditHistoryReadOnlyRecoveryStatusSchema,op as SiteEditHistoryRecoveryCodeSchema,rp as SiteEditHistoryRecoveryDiagnosticSchema,ay as SiteEditHistoryStatusModeSchema,iy as SiteEditHistoryStatusSchema,cp as SiteEditHistoryUnavailableReasonSchema,pp as SiteEditHistoryUnavailableStatusSchema,mp as SiteEditHistoryWritableStatusSchema,Fy as SiteEditInitializeSessionInputSchema,Gm as SiteEditInsertNodeSpecSchema,Bm as SiteEditInsertPageResourceOutputSchema,Gc as SiteEditMaterializationDataRequirementsSchema,qc as SiteEditMaterializationEntrySchema,Fc as SiteEditMaterializationExportSchema,Uc as SiteEditMaterializationFileSchema,ga as SiteEditMaterializationPathTemplateSchema,Le as SiteEditMaterializationSchema,Xa as SiteEditMoveTargetSchema,lt as SiteEditMutationContextSchema,Ht as SiteEditNodeCapabilitySnapshotSchema,vy as SiteEditObjectCapabilitiesSchema,wy as SiteEditObjectDetailSchema,Py as SiteEditObjectEditContextSchema,Dy as SiteEditObjectStyleDetailSchema,Cy as SiteEditObjectSummarySchema,Cb as SiteEditOperationCommandResultSchema,ti as SiteEditOperationErrorCodeSchema,ni as SiteEditOperationErrorSchema,Wm as SiteEditOperationOutputSchema,Km as SiteEditOperationParamsSchema,Fn as SiteEditOperationPayloadSchema,Un as SiteEditOperationRequestSchema,si as SiteEditOperationSelectionRefSchema,yp as SiteEditOperationSummarySchema,Za as SiteEditOperationTargetSchema,ut as SiteEditOperationTypeSchema,Ya as SiteEditOperationValueSchema,Sb as SiteEditPageCompositionAnyVersionSchema,Tm as SiteEditPageCompositionAtomicKindSchema,wm as SiteEditPageCompositionBoundaryModeSchema,bm as SiteEditPageCompositionBusinessMemberSchema,hm as SiteEditPageCompositionContainerSchema,dt as SiteEditPageCompositionDiagnosticSchema,Gt as SiteEditPageCompositionErrorCodeSchema,Wa as SiteEditPageCompositionPlacementTargetSchema,fm as SiteEditPageCompositionPlacementUnitSchema,Im as SiteEditPageCompositionRuntimeRefSchema,Em as SiteEditPageCompositionSchema,Rm as SiteEditPageCompositionSourceMemberKindSchema,Sm as SiteEditPageCompositionSourceMemberSchema,Ha as SiteEditPageCompositionSourceRangeSchema,ym as SiteEditPageCompositionSupportedSchema,xm as SiteEditPageCompositionUnsupportedSchema,Am as SiteEditPageCompositionV2BusinessMemberSchema,km as SiteEditPageCompositionV2ContainerSchema,Pm as SiteEditPageCompositionV2PlacementRelationSchema,jm as SiteEditPageCompositionV2PlacementSchema,Cm as SiteEditPageCompositionV2PlacementUnitSchema,Mm as SiteEditPageCompositionV2Schema,vm as SiteEditPageCompositionV2SourceMemberSchema,Nm as SiteEditPageCompositionV2SupportedSchema,Lm as SiteEditPageCompositionV2UnsupportedSchema,Dm as SiteEditPageCompositionV2WriteModeSchema,Om as SiteEditPageCompositionVisualAnchorSchema,za as SiteEditPagePlacementOptionSchema,Mn as SiteEditPagePlacementSchema,Va as SiteEditPageUnitTargetSchema,gp as SiteEditPatchPlanPatchSchema,my as SiteEditPatchPlanSchema,ft as SiteEditProvenanceChainSchema,wp as SiteEditProvenanceHopSchema,ky as SiteEditRenderDocumentSchema,bt as SiteEditRenderEntryRefSchema,kp as SiteEditRenderEntrySchema,Ai as SiteEditRenderPageCompositionSchema,bp as SiteEditRenderPageCompositionSupportedSchema,fp as SiteEditRenderPageCompositionUnsupportedSchema,Sp as SiteEditRenderPagePlacementSchema,mb as SiteEditRequiredMutationContextEnvelopeSchema,oc as SiteEditResolveSourceLocationInputSchema,ji as SiteEditSemanticSourceSchema,wb as SiteEditSignedOperationRequestSchema,Zs as SiteEditSourceDeleteCapabilitySchema,Jr as SiteEditSourceDirectoryPathSchema,ac as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,ic as SiteEditSourceFileBinaryResponseSchema,Yh as SiteEditSourceFileKindSchema,ec as SiteEditSourceFileListItemSchema,Zh as SiteEditSourceFileResponseSchema,sc as SiteEditSourceFileTextResponseSchema,Ln as SiteEditSourceIdentitySchema,rc as SiteEditSourceLocationRangeSchema,Qh as SiteEditSourceLocationSchema,Pp as SiteEditSourceLocatorRangeSchema,Jn as SiteEditSourceLocatorSchema,ce as SiteEditSourcePathSchema,Qs as SiteEditSourceTreeNodeSchema,Xh as SiteEditSourceTreeResponseSchema,tc as SiteEditSourceTreeTruncationReasonSchema,nc as SiteEditSourceTreeTruncationSchema,ei as SiteEditStyleBreakpointSchema,Ay as SiteEditStyleModelSchema,Qa as SiteEditStylePropertySchema,Oi as SiteEditStyleSourceSchema,Ja as SiteEditStyleStateModeSchema,Qn as SiteEditTextSegmentSchema,Di as SiteEditTextSourceSchema,vp as SiteEditWriteTargetSchema,T as SiteIdSchema,ue as SiteLocaleSchema,g1 as SiteMediaIntentSchema,uh as SiteOperationLockIdSchema,Jp as SitePreviewActivateErrorCodeSchema,td as SitePreviewActivateFailedSchema,ed as SitePreviewActivateReadySchema,bx as SitePreviewActivateResponseSchema,Ne as SiteRecordSchema,_h as SiteTemplateUpgradeStateIdSchema,Ks as SiteVersionIdSchema,Ag as SiteVersionListItemSchema,ln as SiteVersionRecordSchema,Ae as SiteWorkflowIdSchema,gl as SiteWorkflowRecordSchema,Xb as SiteWorkflowSnapshotResponseSchema,_l as SiteWorkflowSnapshotSchema,il as SiteWorkflowStatusSchema,zs as SiteWorkflowTaskRefIdSchema,Zb as SiteWorkflowTaskRefResponseSchema,gi as SiteWorkflowTaskRefSchema,R1 as SitemapAddBlockInputSchema,Os as SitemapAnswerSchema,E1 as SitemapChangeBlockVariantInputSchema,i_ as SitemapDeleteBlockInputSchema,Xg as SitemapDraftBlockSchema,Zg as SitemapDraftPageSchema,__ as SitemapDraftRecordSchema,kt as SitemapDraftSchema,a_ as SitemapEditActorSchema,c_ as SitemapEditErrorCodeSchema,l_ as SitemapEditFailureSchema,r_ as SitemapEditOperationSchema,k1 as SitemapEditResultSchema,m_ as SitemapEditSuccessSchema,d_ as SitemapGenerationOutcomeSchema,u_ as SitemapGenerationReasonSchema,gr as SitemapGenerationStageSchema,de as SitemapIdSchema,p_ as SitemapIntentPageSchema,y1 as SitemapModelOutputSchema,Qg as SitemapModelPageSchema,x1 as SitemapMoveBlockInputSchema,Hg as SitemapNavigationHrefSchema,br as SitemapRecordSchema,b1 as SitemapResolverModelOutputSchema,S1 as SitemapResolverRequestSchema,f1 as SitemapResolverResponseSchema,s_ as SitemapResolverTargetsSchema,v1 as SitemapRunInputSchema,Je as SitemapSchema,A1 as SitemapStreamEventSchema,kE as SitemapTaskCreateRequestSchema,CE as SitemapTaskCreateResponseSchema,du as SitemapTaskFailureErrorCodeSchema,PE as SitemapTaskResponseSchema,o_ as SitemapUpdateBlockInstructionInputSchema,I1 as SitemapUpdateBlockPropsInputSchema,jg as SitemapUserChoiceSchema,Qe as SkillSelectionSchema,Ng as SkillSelectionSourceSchema,Tr as SnapshotContentHashSchema,re as SnapshotFilePathSchema,R as SnapshotIdSchema,ve as SnapshotRecordSchema,tr as SnapshotStatusSchema,fs as StartGscAuthDataSchema,Ro as StartGscAuthRequestSchema,To as StartGscAuthResponseSchema,rf as StartSiteBuildRequestSchema,X1 as StartWorkspaceRunRequestSchema,Z1 as StartWorkspaceRunResponseSchema,Ul as Step2FinalResultDataSourceSchema,Ll as Step2FinalResultRequestSchema,kf as Step2FinalResultResponseSchema,Tf as Step2FinalResultSaveResponseSchema,Ml as Step2FinalResultSaveResultSchema,Vn as Step2FinalResultTypeSchema,ql as Step2FinalResultViewSchema,Ol as Step2SiteInitializationStatusSchema,Rf as Step2SiteInitializationTaskResponseSchema,Nl as Step2SiteInitializationTaskSchema,Bl as Step3AgentAnalysisSchema,fi as Step3AnalysisFindingSchema,jf as Step3AnalysisJobResponseSchema,Vl as Step3AnalysisJobSchema,Hn as Step3AnalysisJobStatusSchema,Wl as Step3AnalysisResultSchema,Df as Step3AnalysisScheduleResponseSchema,Kl as Step3AnalysisScheduleSchema,Mf as Step3AnalysisSseFrameSchema,Cf as Step3AnalysisStartRequestSchema,zl as Step3AnalysisSummarySchema,Gl as Step3AnalystSchema,Pf as Step3AnalystsResponseSchema,Gf as Step4DiagnosisResponseSchema,uS as Step5CommitStrategyRequestSchema,gS as Step5CommitStrategyResponseSchema,Cc as Step5CommittedVersionSchema,la as Step5DecisionCustomPayloadInputSchema,kc as Step5DecisionCustomPayloadSchema,yc as Step5EvidenceReferenceSchema,Ac as Step5JobStatusSchema,pS as Step5SaveDecisionRequestSchema,dS as Step5SaveDecisionResponseSchema,Rc as Step5SemrushIntentGroupSchema,Ic as Step5SemrushKeywordRecommendationSchema,Ec as Step5SemrushRecommendationSeedSchema,Tc as Step5SemrushRecommendationSnapshotSchema,xc as Step5SemrushRecommendationStatusSchema,ca as Step5SemrushSearchIntentSchema,ma as Step5SeoGeoPlanRowSchema,mS as Step5StartStrategyRequestSchema,lS as Step5StartStrategyResponseSchema,vc as Step5StrategyDecisionInputSchema,Tn as Step5StrategyDecisionSchema,Rn as Step5StrategyItemSchema,pa as Step5StrategyJobSchema,Lt as Step5StrategyKeySchema,Mt as Step5StrategyOptionIdSchema,xn as Step5StrategyOptionSchema,fc as Step5StrategyPlanSchema,Pc as Step5StrategySnapshotDataSchema,_S as Step5StrategySseFrameSchema,wc as Step5StrategyVersionSnapshotSchema,Xt as Step6AiThemeIdSchema,yt as Step6AnimationIdSchema,dd as Step6AnimationOptionSchema,gd as Step6AnimationRecommendationSchema,xt as Step6DensityIdSchema,ud as Step6DensityOptionSchema,_d as Step6DensityRecommendationSchema,Nx as Step6DesignRecommendationGenerationInputSchema,Lx as Step6DesignRecommendationModelOutputSchema,hd as Step6DesignRecommendationSchema,Px as Step6DesignRecommendationsRequestSchema,Dx as Step6DesignRecommendationsResponseSchema,zi as Step6DesignSelectionSchema,Zt as Step6FontIdSchema,wx as Step6StandardThemeIdSchema,md as Step6ThemeCandidateSchema,as as Step6ThemeColorsSchema,ss as Step6ThemeIdSchema,pd as Step6ThemeRecommendationSchema,tl as TASK_EXECUTION_STATUSES,di as TASK_EXECUTION_STATUS_CODES,XR as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,og as THEME_PRESETS,ci as TaskExecutionStatusSchema,Xp as TemplateUpgradeCasOutcomeSchema,Mi as TemplateUpgradeErrorCodeSchema,Zp as TemplateUpgradeOutcomeCountsSchema,Hp as TemplateUpgradeOutcomeSchema,Qp as TemplateUpgradeSnapshotDeletionCandidateSchema,Ve as TemplateUpgradeStateSchema,zp as TemplateUpgradeStatusSchema,Yp as TemplateUpgradeValidationStageSchema,be as TemplateVersionSchema,Iu as TriggerPublishedSensitiveWordsCheckDataSchema,ZE as TriggerPublishedSensitiveWordsCheckRequestSchema,QE as TriggerPublishedSensitiveWordsCheckResponseSchema,VR as TryAcquireTemplateUpgradeLockRequestSchema,$R as TryAcquireTemplateUpgradeLockResponseSchema,Wo as UnsplashDownloadLocationSchema,zo as UnsplashMediaAssetSchema,uR as UpdateBriefRequestSchema,jR as UpdateBriefResponseSchema,M1 as UpdateClarifyArchetypeRequestSchema,FR as UpdateCurrentSnapshotManifestRequestSchema,dR as UpdateSiteRequestSchema,jx as UpdateStep6DesignSelectionRequestSchema,Ox as UpdateStep6DesignSelectionResponseSchema,sf as UpdateWorkflowTaskStatusRequestSchema,dg as UploadMediaLibraryAssetResponseSchema,cI as UpstreamPromptTemplateCatalogDataSchema,rI as UpstreamPromptTemplateConsumeDataSchema,$n as UpstreamStep3AgentAnalysisSchema,Lf as UpstreamStep3AnalysisJobSchema,$l as UpstreamStep3AnalysisResultSchema,Nf as UpstreamStep3AnalysisScheduleSchema,Ei as UpstreamStep3AnalysisSummarySchema,Of as UpstreamStep3AnalystSchema,nu as UrlListCrawlerTaskCreateRequestSchema,hh as UsageRecordIdSchema,_g as UseUnsplashMediaRequestSchema,hg as UseUnsplashMediaResponseSchema,un as UserIdSchema,Ku as VCP_GSC_STATES,bs as VcpGscStateSchema,Eu as VcpPublishIdSchema,yo as VerifySiteDomainDataSchema,wR as VerifySiteDomainResponseSchema,Rs as VisualHintsSchema,Dg as VisualThemeSchema,dl as WORKFLOW_DEFINITIONS_V1,Qm as WORKFLOW_FLOW_TYPES,ol as WORKFLOW_MENU_STATES,Jm as WORKFLOW_NODE_CODES,el as WORKFLOW_TASK_TYPES,sT as WORKSPACE_WEBSOCKET_CONTRACT,ui as WorkflowDefinitionVersionSchema,oi as WorkflowFlowTypeSchema,ul as WorkflowMenuItemSchema,rl as WorkflowMenuStateSchema,cf as WorkflowMockDriveRequestSchema,mf as WorkflowMockRetryCrawlRequestSchema,gt as WorkflowNodeCodeSchema,Gn as WorkflowTaskTypeSchema,q_ as WorkspaceClientMessageSchema,bg as WorkspaceDesignApplyRequestSchema,fg as WorkspaceDesignApplyResponseSchema,Ls as WorkspaceDiagnosticSchema,Y_ as WorkspaceDirectEditFileSchema,H_ as WorkspaceDirectEditPathSchema,wr as WorkspaceDirectEditPostActionSchema,oT as WorkspaceDirectEditRequestSchema,cT as WorkspaceDirectEditResponseSchema,Ms as WorkspaceExecutionDiagnosticsSchema,q1 as WorkspaceExecutionPlanSchema,$_ as WorkspaceMediaRequestSchema,qs as WorkspacePlanDependencySchema,xr as WorkspacePlanSummarySchema,I_ as WorkspacePlanTaskKindSchema,Fs as WorkspacePlanTaskSchema,$m as WorkspaceResourceKindSchema,Ym as WorkspaceResourceNavigationSelectionSchema,ii as WorkspaceResourceOperationClientMessageSchema,Hm as WorkspaceResourceOperationSummarySchema,Xm as WorkspaceResourceOperationTransientInputSchema,dn as WorkspaceRunKindSchema,F_ as WorkspaceSelectedComponentSchema,K_ as WorkspaceServerMessageSchema,T1 as WorkspaceSitemapEditRequestSchema,U_ as WorkspaceSocketDescriptorSchema,th as WorkspaceSourceFileBinaryResponseSchema,J_ as WorkspaceSourceFileKindSchema,Pr as WorkspaceSourceFileListItemSchema,mT as WorkspaceSourceFilePathQuerySchema,lT as WorkspaceSourceFileResponseSchema,eh as WorkspaceSourceFileTextResponseSchema,Cr as WorkspaceSourcePathSchema,b_ as WorkspaceSuggestionSchema,fr as WorkspaceSuggestionsSchema,f_ as WorkspaceSuggestionsSourceSchema,Er as WorkspaceTaskCountsSchema,nT as WorkspaceWebSocketMessageSchema,tT as WorkspaceWebSocketMessageTypeSchema,Us as WorkspaceWorkerGroupSchema,Ns as WorkspaceWorkerPhaseSchema,G1 as WorkspaceWorkerResultSchema,Ke as WorkspaceWorkerStatusSchema,uf as assertSiteBuildStatusTransition,df as assertTaskExecutionStatusTransition,Jd as canonicalizeFormDesignJson,Fa as canonicalizePageSlug,bS as compareTemplateVersions,py as composeSiteEditRepeatInstanceKey,_E as computeFormDesignOperationFingerprint,_m as computeSiteEditSourceIdentityKey,At as containsSensitiveData,dm as createSiteEditCommandFailureSchema,qa as createSiteEditCommandResultSchema,jn as createSiteEditCommandSuccessSchema,Wu as deriveVcpGscState,ys as fontStack,Qd as formDesignOperationFingerprintInput,fn as getSiteEditSourceDeleteProtectionReason,Cx as getStep6Theme,fl as getWorkflowDefinition,lf as getWorkflowNodeIndex,gE as hashAffectedFormDesignFiles,uE as hashCmsFormSchemaProjection,en as hashFormDesignJson,dE as hashFormSpec,Ma as isCanonicalPageSlug,qh as isConsentGranted,Kp as isExactEditEngineVersion,Th as isExternalSiteEditInfrastructureReason,Mc as isSiteEditMaterializationPathTemplate,Fp as isSiteEditRuntimeContainerTag,qp as isSiteEditRuntimeTextTag,Oy as isSiteEditRuntimeVoidElementTag,Jh as isSiteEditSourceDeleteProtectedPath,cc as isSiteEditSourceDirectoryPath,Js as isSiteEditSourcePath,bn as isSiteEditTextSourcePath,pf as isWorkflowTaskTypeForNode,_p as makeSiteEditRepeatInstanceKey,xE as normalizeCmsPublicApiBase,Zi as normalizeFormOptionLabelIdentity,Io as normalizeGscDomain,lm as pageSlugToRouteFilePath,DS as parseCmsPageDirectory,Wf as parseComponentI18nResourcesJson,Bp as parseExactEditEngineVersion,hp as parseSiteEditRepeatInstanceKey,db as parseSiteEditSourceIdentityKey,sE as projectFormSpecToCmsSchema,Vu as reconcileSitemapNavigation,Xu as resolveFont,Qu as resolveFontDisplayName,nE as resolveFormTemplateText,xh as resolveRedisConnectionConfig,Hy as resolveRequestedEditEngineVersion,aa as resolveSelectableSiteLocale,Ny as resolveSiteEditRuntimeOperationSummary,aS as resolveSiteLocaleFromIso6393,sS as resolveSiteTextDirection,Yy as resolveSystemCurrentEditEngineVersion,Kb as siteBuildStatusFromCode,Vb as siteBuildStatusToCode,Bb as siteDeploymentStatusFromCode,$b as siteDeploymentStatusToCode,ag as siteFontVariables,zb as siteWorkflowStatusFromCode,Hb as siteWorkflowStatusToCode,dy as stripSiteEditRepeatInstanceKeys,Wb as taskExecutionStatusFromCode,Yb as taskExecutionStatusToCode,Mx as toStep6GenerationVisualHints,Ua as tryCanonicalizeAsciiPageSlug,ki as validateComponentI18nResources,Qx as validateFormSpecIdentityTransition};
|