archik 0.12.7 → 0.12.8

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.
@@ -501,7 +501,7 @@ ${d}
501
501
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let k of o.seen.entries()){let m=k[1];if(a===k[0]){b(k);continue}if(o.external){let N=o.external.registry.get(k[0])?.id;if(a!==k[0]&&N){b(k);continue}}if(o.metadataRegistry.get(k[0])?.id){b(k);continue}if(m.cycle){b(k);continue}if(m.count>1&&o.reused==="ref"){b(k);continue}}}function nL(o,a){let d=o.seen.get(a);if(!d)throw new Error("Unprocessed schema. This is a bug in Zod.");let g=k=>{let m=o.seen.get(k);if(m.ref===null)return;let P=m.def??m.schema,N={...P},H=m.ref;if(m.ref=null,H){g(H);let W=o.seen.get(H),Y=W.schema;if(Y.$ref&&(o.target==="draft-07"||o.target==="draft-04"||o.target==="openapi-3.0")?(P.allOf=P.allOf??[],P.allOf.push(Y)):Object.assign(P,Y),Object.assign(P,N),k._zod.parent===H)for(let he in P)he==="$ref"||he==="allOf"||he in N||delete P[he];if(Y.$ref&&W.def)for(let he in P)he==="$ref"||he==="allOf"||he in W.def&&JSON.stringify(P[he])===JSON.stringify(W.def[he])&&delete P[he]}let j=k._zod.parent;if(j&&j!==H){g(j);let W=o.seen.get(j);if(W?.schema.$ref&&(P.$ref=W.schema.$ref,W.def))for(let Y in P)Y==="$ref"||Y==="allOf"||Y in W.def&&JSON.stringify(P[Y])===JSON.stringify(W.def[Y])&&delete P[Y]}o.override({zodSchema:k,jsonSchema:P,path:m.path??[]})};for(let k of[...o.seen.entries()].reverse())g(k[0]);let f={};if(o.target==="draft-2020-12"?f.$schema="https://json-schema.org/draft/2020-12/schema":o.target==="draft-07"?f.$schema="http://json-schema.org/draft-07/schema#":o.target==="draft-04"?f.$schema="http://json-schema.org/draft-04/schema#":o.target,o.external?.uri){let k=o.external.registry.get(a)?.id;if(!k)throw new Error("Schema is missing an `id` property");f.$id=o.external.uri(k)}Object.assign(f,d.def??d.schema);let b=o.external?.defs??{};for(let k of o.seen.entries()){let m=k[1];m.def&&m.defId&&(b[m.defId]=m.def)}o.external||Object.keys(b).length>0&&(o.target==="draft-2020-12"?f.$defs=b:f.definitions=b);try{let k=JSON.parse(JSON.stringify(f));return Object.defineProperty(k,"~standard",{value:{...a["~standard"],jsonSchema:{input:aq(a,"input",o.processors),output:aq(a,"output",o.processors)}},enumerable:!1,writable:!1}),k}catch{throw new Error("Error converting schema to JSON.")}}function Hy(o,a){let d=a??{seen:new Set};if(d.seen.has(o))return!1;d.seen.add(o);let g=o._zod.def;if(g.type==="transform")return!0;if(g.type==="array")return Hy(g.element,d);if(g.type==="set")return Hy(g.valueType,d);if(g.type==="lazy")return Hy(g.getter(),d);if(g.type==="promise"||g.type==="optional"||g.type==="nonoptional"||g.type==="nullable"||g.type==="readonly"||g.type==="default"||g.type==="prefault")return Hy(g.innerType,d);if(g.type==="intersection")return Hy(g.left,d)||Hy(g.right,d);if(g.type==="record"||g.type==="map")return Hy(g.keyType,d)||Hy(g.valueType,d);if(g.type==="pipe")return Hy(g.in,d)||Hy(g.out,d);if(g.type==="object"){for(let f in g.shape)if(Hy(g.shape[f],d))return!0;return!1}if(g.type==="union"){for(let f of g.options)if(Hy(f,d))return!0;return!1}if(g.type==="tuple"){for(let f of g.items)if(Hy(f,d))return!0;return!!(g.rest&&Hy(g.rest,d))}return!1}var Tlt=(o,a={})=>d=>{let g=eL({...d,processors:a});return tu(o,g),tL(g,o),nL(g,o)},aq=(o,a,d={})=>g=>{let{libraryOptions:f,target:b}=g??{},k=eL({...f??{},target:b,io:a,processors:d});return tu(o,k),tL(k,o),nL(k,o)};var IBn={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Elt=(o,a,d,g)=>{let f=d;f.type="string";let{minimum:b,maximum:k,format:m,patterns:P,contentEncoding:N}=o._zod.bag;if(typeof b=="number"&&(f.minLength=b),typeof k=="number"&&(f.maxLength=k),m&&(f.format=IBn[m]??m,f.format===""&&delete f.format,m==="time"&&delete f.format),N&&(f.contentEncoding=N),P&&P.size>0){let H=[...P];H.length===1?f.pattern=H[0].source:H.length>1&&(f.allOf=[...H.map(j=>({...a.target==="draft-07"||a.target==="draft-04"||a.target==="openapi-3.0"?{type:"string"}:{},pattern:j.source}))])}},Plt=(o,a,d,g)=>{let f=d,{minimum:b,maximum:k,format:m,multipleOf:P,exclusiveMaximum:N,exclusiveMinimum:H}=o._zod.bag;typeof m=="string"&&m.includes("int")?f.type="integer":f.type="number",typeof H=="number"&&(a.target==="draft-04"||a.target==="openapi-3.0"?(f.minimum=H,f.exclusiveMinimum=!0):f.exclusiveMinimum=H),typeof b=="number"&&(f.minimum=b,typeof H=="number"&&a.target!=="draft-04"&&(H>=b?delete f.minimum:delete f.exclusiveMinimum)),typeof N=="number"&&(a.target==="draft-04"||a.target==="openapi-3.0"?(f.maximum=N,f.exclusiveMaximum=!0):f.exclusiveMaximum=N),typeof k=="number"&&(f.maximum=k,typeof N=="number"&&a.target!=="draft-04"&&(N<=k?delete f.maximum:delete f.exclusiveMaximum)),typeof P=="number"&&(f.multipleOf=P)},Alt=(o,a,d,g)=>{d.type="boolean"},Nlt=(o,a,d,g)=>{if(a.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},Rlt=(o,a,d,g)=>{if(a.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},Olt=(o,a,d,g)=>{a.target==="openapi-3.0"?(d.type="string",d.nullable=!0,d.enum=[null]):d.type="null"},Dlt=(o,a,d,g)=>{if(a.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},Flt=(o,a,d,g)=>{if(a.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},zlt=(o,a,d,g)=>{d.not={}},jlt=(o,a,d,g)=>{},Blt=(o,a,d,g)=>{},Hlt=(o,a,d,g)=>{if(a.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},$lt=(o,a,d,g)=>{let f=o._zod.def,b=NQ(f.entries);b.every(k=>typeof k=="number")&&(d.type="number"),b.every(k=>typeof k=="string")&&(d.type="string"),d.enum=b},Ult=(o,a,d,g)=>{let f=o._zod.def,b=[];for(let k of f.values)if(k===void 0){if(a.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof k=="bigint"){if(a.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");b.push(Number(k))}else b.push(k);if(b.length!==0)if(b.length===1){let k=b[0];d.type=k===null?"null":typeof k,a.target==="draft-04"||a.target==="openapi-3.0"?d.enum=[k]:d.const=k}else b.every(k=>typeof k=="number")&&(d.type="number"),b.every(k=>typeof k=="string")&&(d.type="string"),b.every(k=>typeof k=="boolean")&&(d.type="boolean"),b.every(k=>k===null)&&(d.type="null"),d.enum=b},qlt=(o,a,d,g)=>{if(a.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},Glt=(o,a,d,g)=>{let f=d,b=o._zod.pattern;if(!b)throw new Error("Pattern not found in template literal");f.type="string",f.pattern=b.source},Vlt=(o,a,d,g)=>{let f=d,b={type:"string",format:"binary",contentEncoding:"binary"},{minimum:k,maximum:m,mime:P}=o._zod.bag;k!==void 0&&(b.minLength=k),m!==void 0&&(b.maxLength=m),P?P.length===1?(b.contentMediaType=P[0],Object.assign(f,b)):(Object.assign(f,b),f.anyOf=P.map(N=>({contentMediaType:N}))):Object.assign(f,b)},Wlt=(o,a,d,g)=>{d.type="boolean"},Jlt=(o,a,d,g)=>{if(a.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Zlt=(o,a,d,g)=>{if(a.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},Xlt=(o,a,d,g)=>{if(a.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Klt=(o,a,d,g)=>{if(a.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},Ylt=(o,a,d,g)=>{if(a.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},Qlt=(o,a,d,g)=>{let f=d,b=o._zod.def,{minimum:k,maximum:m}=o._zod.bag;typeof k=="number"&&(f.minItems=k),typeof m=="number"&&(f.maxItems=m),f.type="array",f.items=tu(b.element,a,{...g,path:[...g.path,"items"]})},e1t=(o,a,d,g)=>{let f=d,b=o._zod.def;f.type="object",f.properties={};let k=b.shape;for(let N in k)f.properties[N]=tu(k[N],a,{...g,path:[...g.path,"properties",N]});let m=new Set(Object.keys(k)),P=new Set([...m].filter(N=>{let H=b.shape[N]._zod;return a.io==="input"?H.optin===void 0:H.optout===void 0}));P.size>0&&(f.required=Array.from(P)),b.catchall?._zod.def.type==="never"?f.additionalProperties=!1:b.catchall?b.catchall&&(f.additionalProperties=tu(b.catchall,a,{...g,path:[...g.path,"additionalProperties"]})):a.io==="output"&&(f.additionalProperties=!1)},r2e=(o,a,d,g)=>{let f=o._zod.def,b=f.inclusive===!1,k=f.options.map((m,P)=>tu(m,a,{...g,path:[...g.path,b?"oneOf":"anyOf",P]}));b?d.oneOf=k:d.anyOf=k},t1t=(o,a,d,g)=>{let f=o._zod.def,b=tu(f.left,a,{...g,path:[...g.path,"allOf",0]}),k=tu(f.right,a,{...g,path:[...g.path,"allOf",1]}),m=N=>"allOf"in N&&Object.keys(N).length===1,P=[...m(b)?b.allOf:[b],...m(k)?k.allOf:[k]];d.allOf=P},n1t=(o,a,d,g)=>{let f=d,b=o._zod.def;f.type="array";let k=a.target==="draft-2020-12"?"prefixItems":"items",m=a.target==="draft-2020-12"||a.target==="openapi-3.0"?"items":"additionalItems",P=b.items.map((W,Y)=>tu(W,a,{...g,path:[...g.path,k,Y]})),N=b.rest?tu(b.rest,a,{...g,path:[...g.path,m,...a.target==="openapi-3.0"?[b.items.length]:[]]}):null;a.target==="draft-2020-12"?(f.prefixItems=P,N&&(f.items=N)):a.target==="openapi-3.0"?(f.items={anyOf:P},N&&f.items.anyOf.push(N),f.minItems=P.length,N||(f.maxItems=P.length)):(f.items=P,N&&(f.additionalItems=N));let{minimum:H,maximum:j}=o._zod.bag;typeof H=="number"&&(f.minItems=H),typeof j=="number"&&(f.maxItems=j)},r1t=(o,a,d,g)=>{let f=d,b=o._zod.def;f.type="object";let k=b.keyType,P=k._zod.bag?.patterns;if(b.mode==="loose"&&P&&P.size>0){let H=tu(b.valueType,a,{...g,path:[...g.path,"patternProperties","*"]});f.patternProperties={};for(let j of P)f.patternProperties[j.source]=H}else(a.target==="draft-07"||a.target==="draft-2020-12")&&(f.propertyNames=tu(b.keyType,a,{...g,path:[...g.path,"propertyNames"]})),f.additionalProperties=tu(b.valueType,a,{...g,path:[...g.path,"additionalProperties"]});let N=k._zod.values;if(N){let H=[...N].filter(j=>typeof j=="string"||typeof j=="number");H.length>0&&(f.required=H)}},i1t=(o,a,d,g)=>{let f=o._zod.def,b=tu(f.innerType,a,g),k=a.seen.get(o);a.target==="openapi-3.0"?(k.ref=f.innerType,d.nullable=!0):d.anyOf=[b,{type:"null"}]},o1t=(o,a,d,g)=>{let f=o._zod.def;tu(f.innerType,a,g);let b=a.seen.get(o);b.ref=f.innerType},c1t=(o,a,d,g)=>{let f=o._zod.def;tu(f.innerType,a,g);let b=a.seen.get(o);b.ref=f.innerType,d.default=JSON.parse(JSON.stringify(f.defaultValue))},a1t=(o,a,d,g)=>{let f=o._zod.def;tu(f.innerType,a,g);let b=a.seen.get(o);b.ref=f.innerType,a.io==="input"&&(d._prefault=JSON.parse(JSON.stringify(f.defaultValue)))},s1t=(o,a,d,g)=>{let f=o._zod.def;tu(f.innerType,a,g);let b=a.seen.get(o);b.ref=f.innerType;let k;try{k=f.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}d.default=k},u1t=(o,a,d,g)=>{let f=o._zod.def,b=a.io==="input"?f.in._zod.def.type==="transform"?f.out:f.in:f.out;tu(b,a,g);let k=a.seen.get(o);k.ref=b},l1t=(o,a,d,g)=>{let f=o._zod.def;tu(f.innerType,a,g);let b=a.seen.get(o);b.ref=f.innerType,d.readOnly=!0},h1t=(o,a,d,g)=>{let f=o._zod.def;tu(f.innerType,a,g);let b=a.seen.get(o);b.ref=f.innerType},i2e=(o,a,d,g)=>{let f=o._zod.def;tu(f.innerType,a,g);let b=a.seen.get(o);b.ref=f.innerType},d1t=(o,a,d,g)=>{let f=o._zod.innerType;tu(f,a,g);let b=a.seen.get(o);b.ref=f},n2e={string:Elt,number:Plt,boolean:Alt,bigint:Nlt,symbol:Rlt,null:Olt,undefined:Dlt,void:Flt,never:zlt,any:jlt,unknown:Blt,date:Hlt,enum:$lt,literal:Ult,nan:qlt,template_literal:Glt,file:Vlt,success:Wlt,custom:Jlt,function:Zlt,transform:Xlt,map:Klt,set:Ylt,array:Qlt,object:e1t,union:r2e,intersection:t1t,tuple:n1t,record:r1t,nullable:i1t,nonoptional:o1t,default:c1t,prefault:a1t,catch:s1t,pipe:u1t,readonly:l1t,promise:h1t,optional:i2e,lazy:d1t};function o2e(o,a){if("_idmap"in o){let g=o,f=eL({...a,processors:n2e}),b={};for(let P of g._idmap.entries()){let[N,H]=P;tu(H,f)}let k={},m={registry:g,uri:a?.uri,defs:b};f.external=m;for(let P of g._idmap.entries()){let[N,H]=P;tL(f,H),k[N]=nL(f,H)}if(Object.keys(b).length>0){let P=f.target==="draft-2020-12"?"$defs":"definitions";k.__shared={[P]:b}}return{schemas:k}}let d=eL({...a,processors:n2e});return tu(o,d),tL(d,o),nL(d,o)}var c2e=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(a){this.ctx.counter=a}get seen(){return this.ctx.seen}constructor(a){let d=a?.target??"draft-2020-12";d==="draft-4"&&(d="draft-04"),d==="draft-7"&&(d="draft-07"),this.ctx=eL({processors:n2e,target:d,...a?.metadata&&{metadata:a.metadata},...a?.unrepresentable&&{unrepresentable:a.unrepresentable},...a?.override&&{override:a.override},...a?.io&&{io:a.io}})}process(a,d={path:[],schemaPath:[]}){return tu(a,this.ctx,d)}emit(a,d){d&&(d.cycles&&(this.ctx.cycles=d.cycles),d.reused&&(this.ctx.reused=d.reused),d.external&&(this.ctx.external=d.external)),tL(this.ctx,a);let g=nL(this.ctx,a),{"~standard":f,...b}=g;return b}};var gtn={};var KQ={};Ex(KQ,{ZodAny:()=>D1t,ZodArray:()=>B1t,ZodBase64:()=>I2e,ZodBase64URL:()=>L2e,ZodBigInt:()=>pq,ZodBigIntFormat:()=>P2e,ZodBoolean:()=>fq,ZodCIDRv4:()=>_2e,ZodCIDRv6:()=>C2e,ZodCUID:()=>w2e,ZodCUID2:()=>v2e,ZodCatch:()=>sht,ZodCodec:()=>j2e,ZodCustom:()=>see,ZodCustomStringFormat:()=>hq,ZodDate:()=>ree,ZodDefault:()=>nht,ZodDiscriminatedUnion:()=>$1t,ZodE164:()=>T2e,ZodEmail:()=>g2e,ZodEmoji:()=>y2e,ZodEnum:()=>uq,ZodExactOptional:()=>Q1t,ZodFile:()=>K1t,ZodFunction:()=>bht,ZodGUID:()=>YQ,ZodIPv4:()=>x2e,ZodIPv6:()=>S2e,ZodIntersection:()=>U1t,ZodJWT:()=>E2e,ZodKSUID:()=>M2e,ZodLazy:()=>pht,ZodLiteral:()=>X1t,ZodMAC:()=>T1t,ZodMap:()=>J1t,ZodNaN:()=>lht,ZodNanoID:()=>b2e,ZodNever:()=>z1t,ZodNonOptional:()=>F2e,ZodNull:()=>R1t,ZodNullable:()=>tht,ZodNumber:()=>dq,ZodNumberFormat:()=>eR,ZodObject:()=>oee,ZodOptional:()=>D2e,ZodPipe:()=>z2e,ZodPrefault:()=>iht,ZodPromise:()=>yht,ZodReadonly:()=>hht,ZodRecord:()=>aee,ZodSet:()=>Z1t,ZodString:()=>lq,ZodStringFormat:()=>Ju,ZodSuccess:()=>aht,ZodSymbol:()=>A1t,ZodTemplateLiteral:()=>fht,ZodTransform:()=>Y1t,ZodTuple:()=>G1t,ZodType:()=>yc,ZodULID:()=>m2e,ZodURL:()=>nee,ZodUUID:()=>w9,ZodUndefined:()=>N1t,ZodUnion:()=>cee,ZodUnknown:()=>F1t,ZodVoid:()=>j1t,ZodXID:()=>k2e,ZodXor:()=>H1t,_ZodString:()=>p2e,_default:()=>rht,_function:()=>Mnn,any:()=>enn,array:()=>iee,base64:()=>Ftn,base64url:()=>ztn,bigint:()=>Ztn,boolean:()=>P1t,catch:()=>uht,check:()=>xnn,cidrv4:()=>Otn,cidrv6:()=>Dtn,codec:()=>vnn,cuid:()=>Itn,cuid2:()=>Ltn,custom:()=>Snn,date:()=>nnn,describe:()=>_nn,discriminatedUnion:()=>snn,e164:()=>jtn,email:()=>btn,emoji:()=>_tn,enum:()=>R2e,exactOptional:()=>eht,file:()=>gnn,float32:()=>Gtn,float64:()=>Vtn,function:()=>Mnn,guid:()=>wtn,hash:()=>qtn,hex:()=>Utn,hostname:()=>$tn,httpUrl:()=>Stn,instanceof:()=>Inn,int:()=>f2e,int32:()=>Wtn,int64:()=>Xtn,intersection:()=>q1t,ipv4:()=>Atn,ipv6:()=>Rtn,json:()=>Tnn,jwt:()=>Btn,keyof:()=>rnn,ksuid:()=>Ptn,lazy:()=>ght,literal:()=>pnn,looseObject:()=>cnn,looseRecord:()=>lnn,mac:()=>Ntn,map:()=>hnn,meta:()=>Cnn,nan:()=>wnn,nanoid:()=>Ctn,nativeEnum:()=>fnn,never:()=>A2e,nonoptional:()=>cht,null:()=>O1t,nullable:()=>eee,nullish:()=>ynn,number:()=>E1t,object:()=>inn,optional:()=>QQ,partialRecord:()=>unn,pipe:()=>tee,prefault:()=>oht,preprocess:()=>Enn,promise:()=>knn,readonly:()=>dht,record:()=>W1t,refine:()=>wht,set:()=>dnn,strictObject:()=>onn,string:()=>d2e,stringFormat:()=>Htn,stringbool:()=>Lnn,success:()=>bnn,superRefine:()=>vht,symbol:()=>Ytn,templateLiteral:()=>mnn,transform:()=>O2e,tuple:()=>V1t,uint32:()=>Jtn,uint64:()=>Ktn,ulid:()=>Ttn,undefined:()=>Qtn,union:()=>N2e,unknown:()=>QN,url:()=>xtn,uuid:()=>vtn,uuidv4:()=>mtn,uuidv6:()=>ktn,uuidv7:()=>Mtn,void:()=>tnn,xid:()=>Etn,xor:()=>ann});var a2e={};Ex(a2e,{endsWith:()=>QU,gt:()=>y9,gte:()=>By,includes:()=>KU,length:()=>YN,lowercase:()=>ZU,lt:()=>g9,lte:()=>sm,maxLength:()=>KN,maxSize:()=>QI,mime:()=>eq,minLength:()=>zx,minSize:()=>b9,multipleOf:()=>YI,negative:()=>Y0e,nonnegative:()=>e2e,nonpositive:()=>Q0e,normalize:()=>tq,overwrite:()=>H5,positive:()=>K0e,property:()=>t2e,regex:()=>JU,size:()=>XN,slugify:()=>oq,startsWith:()=>YU,toLowerCase:()=>rq,toUpperCase:()=>iq,trim:()=>nq,uppercase:()=>XU});var sq={};Ex(sq,{ZodISODate:()=>u2e,ZodISODateTime:()=>s2e,ZodISODuration:()=>h2e,ZodISOTime:()=>l2e,date:()=>p1t,datetime:()=>f1t,duration:()=>y1t,time:()=>g1t});var s2e=kt("ZodISODateTime",(o,a)=>{qst.init(o,a),Ju.init(o,a)});function f1t(o){return Jut(s2e,o)}var u2e=kt("ZodISODate",(o,a)=>{Gst.init(o,a),Ju.init(o,a)});function p1t(o){return Zut(u2e,o)}var l2e=kt("ZodISOTime",(o,a)=>{Vst.init(o,a),Ju.init(o,a)});function g1t(o){return Xut(l2e,o)}var h2e=kt("ZodISODuration",(o,a)=>{Wst.init(o,a),Ju.init(o,a)});function y1t(o){return Kut(h2e,o)}var ytn=(o,a)=>{zQ.init(o,a),o.name="ZodError",Object.defineProperties(o,{format:{value:d=>BQ(o,d)},flatten:{value:d=>jQ(o,d)},addIssue:{value:d=>{o.issues.push(d),o.message=JSON.stringify(o.issues,jU,2)}},addIssues:{value:d=>{o.issues.push(...d),o.message=JSON.stringify(o.issues,jU,2)}},isEmpty:{get(){return o.issues.length===0}}})},TBn=kt("ZodError",ytn),Iw=kt("ZodError",ytn,{Parent:Error});var b1t=$U(Iw),w1t=UU(Iw),v1t=qU(Iw),m1t=GU(Iw),k1t=o0e(Iw),M1t=c0e(Iw),x1t=a0e(Iw),S1t=s0e(Iw),_1t=u0e(Iw),C1t=l0e(Iw),I1t=h0e(Iw),L1t=d0e(Iw);var yc=kt("ZodType",(o,a)=>(jo.init(o,a),Object.assign(o["~standard"],{jsonSchema:{input:aq(o,"input"),output:aq(o,"output")}}),o.toJSONSchema=Tlt(o,{}),o.def=a,o.type=a.type,Object.defineProperty(o,"_def",{value:a}),o.check=(...d)=>o.clone(or.mergeDefs(a,{checks:[...a.checks??[],...d.map(g=>typeof g=="function"?{_zod:{check:g,def:{check:"custom"},onattach:[]}}:g)]}),{parent:!0}),o.with=o.check,o.clone=(d,g)=>jy(o,d,g),o.brand=()=>o,o.register=((d,g)=>(d.add(o,g),o)),o.parse=(d,g)=>b1t(o,d,g,{callee:o.parse}),o.safeParse=(d,g)=>v1t(o,d,g),o.parseAsync=async(d,g)=>w1t(o,d,g,{callee:o.parseAsync}),o.safeParseAsync=async(d,g)=>m1t(o,d,g),o.spa=o.safeParseAsync,o.encode=(d,g)=>k1t(o,d,g),o.decode=(d,g)=>M1t(o,d,g),o.encodeAsync=async(d,g)=>x1t(o,d,g),o.decodeAsync=async(d,g)=>S1t(o,d,g),o.safeEncode=(d,g)=>_1t(o,d,g),o.safeDecode=(d,g)=>C1t(o,d,g),o.safeEncodeAsync=async(d,g)=>I1t(o,d,g),o.safeDecodeAsync=async(d,g)=>L1t(o,d,g),o.refine=(d,g)=>o.check(wht(d,g)),o.superRefine=d=>o.check(vht(d)),o.overwrite=d=>o.check(H5(d)),o.optional=()=>QQ(o),o.exactOptional=()=>eht(o),o.nullable=()=>eee(o),o.nullish=()=>QQ(eee(o)),o.nonoptional=d=>cht(o,d),o.array=()=>iee(o),o.or=d=>N2e([o,d]),o.and=d=>q1t(o,d),o.transform=d=>tee(o,O2e(d)),o.default=d=>rht(o,d),o.prefault=d=>oht(o,d),o.catch=d=>uht(o,d),o.pipe=d=>tee(o,d),o.readonly=()=>dht(o),o.describe=d=>{let g=o.clone();return kp.add(g,{description:d}),g},Object.defineProperty(o,"description",{get(){return kp.get(o)?.description},configurable:!0}),o.meta=(...d)=>{if(d.length===0)return kp.get(o);let g=o.clone();return kp.add(g,d[0]),g},o.isOptional=()=>o.safeParse(void 0).success,o.isNullable=()=>o.safeParse(null).success,o.apply=d=>d(o),o)),p2e=kt("_ZodString",(o,a)=>{ZN.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(g,f,b)=>Elt(o,g,f,b);let d=o._zod.bag;o.format=d.format??null,o.minLength=d.minimum??null,o.maxLength=d.maximum??null,o.regex=(...g)=>o.check(JU(...g)),o.includes=(...g)=>o.check(KU(...g)),o.startsWith=(...g)=>o.check(YU(...g)),o.endsWith=(...g)=>o.check(QU(...g)),o.min=(...g)=>o.check(zx(...g)),o.max=(...g)=>o.check(KN(...g)),o.length=(...g)=>o.check(YN(...g)),o.nonempty=(...g)=>o.check(zx(1,...g)),o.lowercase=g=>o.check(ZU(g)),o.uppercase=g=>o.check(XU(g)),o.trim=()=>o.check(nq()),o.normalize=(...g)=>o.check(tq(...g)),o.toLowerCase=()=>o.check(rq()),o.toUpperCase=()=>o.check(iq()),o.slugify=()=>o.check(oq())}),lq=kt("ZodString",(o,a)=>{ZN.init(o,a),p2e.init(o,a),o.email=d=>o.check(P0e(g2e,d)),o.url=d=>o.check(XQ(nee,d)),o.jwt=d=>o.check(X0e(E2e,d)),o.emoji=d=>o.check(D0e(y2e,d)),o.guid=d=>o.check(ZQ(YQ,d)),o.uuid=d=>o.check(A0e(w9,d)),o.uuidv4=d=>o.check(N0e(w9,d)),o.uuidv6=d=>o.check(R0e(w9,d)),o.uuidv7=d=>o.check(O0e(w9,d)),o.nanoid=d=>o.check(F0e(b2e,d)),o.guid=d=>o.check(ZQ(YQ,d)),o.cuid=d=>o.check(z0e(w2e,d)),o.cuid2=d=>o.check(j0e(v2e,d)),o.ulid=d=>o.check(B0e(m2e,d)),o.base64=d=>o.check(W0e(I2e,d)),o.base64url=d=>o.check(J0e(L2e,d)),o.xid=d=>o.check(H0e(k2e,d)),o.ksuid=d=>o.check($0e(M2e,d)),o.ipv4=d=>o.check(U0e(x2e,d)),o.ipv6=d=>o.check(q0e(S2e,d)),o.cidrv4=d=>o.check(G0e(_2e,d)),o.cidrv6=d=>o.check(V0e(C2e,d)),o.e164=d=>o.check(Z0e(T2e,d)),o.datetime=d=>o.check(f1t(d)),o.date=d=>o.check(p1t(d)),o.time=d=>o.check(g1t(d)),o.duration=d=>o.check(y1t(d))});function d2e(o){return qut(lq,o)}var Ju=kt("ZodStringFormat",(o,a)=>{Wu.init(o,a),p2e.init(o,a)}),g2e=kt("ZodEmail",(o,a)=>{Ost.init(o,a),Ju.init(o,a)});function btn(o){return P0e(g2e,o)}var YQ=kt("ZodGUID",(o,a)=>{Nst.init(o,a),Ju.init(o,a)});function wtn(o){return ZQ(YQ,o)}var w9=kt("ZodUUID",(o,a)=>{Rst.init(o,a),Ju.init(o,a)});function vtn(o){return A0e(w9,o)}function mtn(o){return N0e(w9,o)}function ktn(o){return R0e(w9,o)}function Mtn(o){return O0e(w9,o)}var nee=kt("ZodURL",(o,a)=>{Dst.init(o,a),Ju.init(o,a)});function xtn(o){return XQ(nee,o)}function Stn(o){return XQ(nee,{protocol:/^https?$/,hostname:a3.domain,...or.normalizeParams(o)})}var y2e=kt("ZodEmoji",(o,a)=>{Fst.init(o,a),Ju.init(o,a)});function _tn(o){return D0e(y2e,o)}var b2e=kt("ZodNanoID",(o,a)=>{zst.init(o,a),Ju.init(o,a)});function Ctn(o){return F0e(b2e,o)}var w2e=kt("ZodCUID",(o,a)=>{jst.init(o,a),Ju.init(o,a)});function Itn(o){return z0e(w2e,o)}var v2e=kt("ZodCUID2",(o,a)=>{Bst.init(o,a),Ju.init(o,a)});function Ltn(o){return j0e(v2e,o)}var m2e=kt("ZodULID",(o,a)=>{Hst.init(o,a),Ju.init(o,a)});function Ttn(o){return B0e(m2e,o)}var k2e=kt("ZodXID",(o,a)=>{$st.init(o,a),Ju.init(o,a)});function Etn(o){return H0e(k2e,o)}var M2e=kt("ZodKSUID",(o,a)=>{Ust.init(o,a),Ju.init(o,a)});function Ptn(o){return $0e(M2e,o)}var x2e=kt("ZodIPv4",(o,a)=>{Jst.init(o,a),Ju.init(o,a)});function Atn(o){return U0e(x2e,o)}var T1t=kt("ZodMAC",(o,a)=>{Xst.init(o,a),Ju.init(o,a)});function Ntn(o){return Vut(T1t,o)}var S2e=kt("ZodIPv6",(o,a)=>{Zst.init(o,a),Ju.init(o,a)});function Rtn(o){return q0e(S2e,o)}var _2e=kt("ZodCIDRv4",(o,a)=>{Kst.init(o,a),Ju.init(o,a)});function Otn(o){return G0e(_2e,o)}var C2e=kt("ZodCIDRv6",(o,a)=>{Yst.init(o,a),Ju.init(o,a)});function Dtn(o){return V0e(C2e,o)}var I2e=kt("ZodBase64",(o,a)=>{eut.init(o,a),Ju.init(o,a)});function Ftn(o){return W0e(I2e,o)}var L2e=kt("ZodBase64URL",(o,a)=>{tut.init(o,a),Ju.init(o,a)});function ztn(o){return J0e(L2e,o)}var T2e=kt("ZodE164",(o,a)=>{nut.init(o,a),Ju.init(o,a)});function jtn(o){return Z0e(T2e,o)}var E2e=kt("ZodJWT",(o,a)=>{rut.init(o,a),Ju.init(o,a)});function Btn(o){return X0e(E2e,o)}var hq=kt("ZodCustomStringFormat",(o,a)=>{iut.init(o,a),Ju.init(o,a)});function Htn(o,a,d={}){return cq(hq,o,a,d)}function $tn(o){return cq(hq,"hostname",a3.hostname,o)}function Utn(o){return cq(hq,"hex",a3.hex,o)}function qtn(o,a){let d=a?.enc??"hex",g=`${o}_${d}`,f=a3[g];if(!f)throw new Error(`Unrecognized hash format: ${g}`);return cq(hq,g,f,a)}var dq=kt("ZodNumber",(o,a)=>{M0e.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(g,f,b)=>Plt(o,g,f,b),o.gt=(g,f)=>o.check(y9(g,f)),o.gte=(g,f)=>o.check(By(g,f)),o.min=(g,f)=>o.check(By(g,f)),o.lt=(g,f)=>o.check(g9(g,f)),o.lte=(g,f)=>o.check(sm(g,f)),o.max=(g,f)=>o.check(sm(g,f)),o.int=g=>o.check(f2e(g)),o.safe=g=>o.check(f2e(g)),o.positive=g=>o.check(y9(0,g)),o.nonnegative=g=>o.check(By(0,g)),o.negative=g=>o.check(g9(0,g)),o.nonpositive=g=>o.check(sm(0,g)),o.multipleOf=(g,f)=>o.check(YI(g,f)),o.step=(g,f)=>o.check(YI(g,f)),o.finite=()=>o;let d=o._zod.bag;o.minValue=Math.max(d.minimum??Number.NEGATIVE_INFINITY,d.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,o.maxValue=Math.min(d.maximum??Number.POSITIVE_INFINITY,d.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,o.isInt=(d.format??"").includes("int")||Number.isSafeInteger(d.multipleOf??.5),o.isFinite=!0,o.format=d.format??null});function E1t(o){return Yut(dq,o)}var eR=kt("ZodNumberFormat",(o,a)=>{out.init(o,a),dq.init(o,a)});function f2e(o){return elt(eR,o)}function Gtn(o){return tlt(eR,o)}function Vtn(o){return nlt(eR,o)}function Wtn(o){return rlt(eR,o)}function Jtn(o){return ilt(eR,o)}var fq=kt("ZodBoolean",(o,a)=>{qQ.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Alt(o,d,g,f)});function P1t(o){return olt(fq,o)}var pq=kt("ZodBigInt",(o,a)=>{x0e.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(g,f,b)=>Nlt(o,g,f,b),o.gte=(g,f)=>o.check(By(g,f)),o.min=(g,f)=>o.check(By(g,f)),o.gt=(g,f)=>o.check(y9(g,f)),o.gte=(g,f)=>o.check(By(g,f)),o.min=(g,f)=>o.check(By(g,f)),o.lt=(g,f)=>o.check(g9(g,f)),o.lte=(g,f)=>o.check(sm(g,f)),o.max=(g,f)=>o.check(sm(g,f)),o.positive=g=>o.check(y9(BigInt(0),g)),o.negative=g=>o.check(g9(BigInt(0),g)),o.nonpositive=g=>o.check(sm(BigInt(0),g)),o.nonnegative=g=>o.check(By(BigInt(0),g)),o.multipleOf=(g,f)=>o.check(YI(g,f));let d=o._zod.bag;o.minValue=d.minimum??null,o.maxValue=d.maximum??null,o.format=d.format??null});function Ztn(o){return alt(pq,o)}var P2e=kt("ZodBigIntFormat",(o,a)=>{cut.init(o,a),pq.init(o,a)});function Xtn(o){return ult(P2e,o)}function Ktn(o){return llt(P2e,o)}var A1t=kt("ZodSymbol",(o,a)=>{aut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Rlt(o,d,g,f)});function Ytn(o){return hlt(A1t,o)}var N1t=kt("ZodUndefined",(o,a)=>{sut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Dlt(o,d,g,f)});function Qtn(o){return dlt(N1t,o)}var R1t=kt("ZodNull",(o,a)=>{uut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Olt(o,d,g,f)});function O1t(o){return flt(R1t,o)}var D1t=kt("ZodAny",(o,a)=>{lut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>jlt(o,d,g,f)});function enn(){return plt(D1t)}var F1t=kt("ZodUnknown",(o,a)=>{hut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Blt(o,d,g,f)});function QN(){return glt(F1t)}var z1t=kt("ZodNever",(o,a)=>{dut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>zlt(o,d,g,f)});function A2e(o){return ylt(z1t,o)}var j1t=kt("ZodVoid",(o,a)=>{fut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Flt(o,d,g,f)});function tnn(o){return blt(j1t,o)}var ree=kt("ZodDate",(o,a)=>{put.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(g,f,b)=>Hlt(o,g,f,b),o.min=(g,f)=>o.check(By(g,f)),o.max=(g,f)=>o.check(sm(g,f));let d=o._zod.bag;o.minDate=d.minimum?new Date(d.minimum):null,o.maxDate=d.maximum?new Date(d.maximum):null});function nnn(o){return wlt(ree,o)}var B1t=kt("ZodArray",(o,a)=>{gut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Qlt(o,d,g,f),o.element=a.element,o.min=(d,g)=>o.check(zx(d,g)),o.nonempty=d=>o.check(zx(1,d)),o.max=(d,g)=>o.check(KN(d,g)),o.length=(d,g)=>o.check(YN(d,g)),o.unwrap=()=>o.element});function iee(o,a){return klt(B1t,o,a)}function rnn(o){let a=o._zod.def.shape;return R2e(Object.keys(a))}var oee=kt("ZodObject",(o,a)=>{yut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>e1t(o,d,g,f),or.defineLazy(o,"shape",()=>a.shape),o.keyof=()=>R2e(Object.keys(o._zod.def.shape)),o.catchall=d=>o.clone({...o._zod.def,catchall:d}),o.passthrough=()=>o.clone({...o._zod.def,catchall:QN()}),o.loose=()=>o.clone({...o._zod.def,catchall:QN()}),o.strict=()=>o.clone({...o._zod.def,catchall:A2e()}),o.strip=()=>o.clone({...o._zod.def,catchall:void 0}),o.extend=d=>or.extend(o,d),o.safeExtend=d=>or.safeExtend(o,d),o.merge=d=>or.merge(o,d),o.pick=d=>or.pick(o,d),o.omit=d=>or.omit(o,d),o.partial=(...d)=>or.partial(D2e,o,d[0]),o.required=(...d)=>or.required(F2e,o,d[0])});function inn(o,a){let d={type:"object",shape:o??{},...or.normalizeParams(a)};return new oee(d)}function onn(o,a){return new oee({type:"object",shape:o,catchall:A2e(),...or.normalizeParams(a)})}function cnn(o,a){return new oee({type:"object",shape:o,catchall:QN(),...or.normalizeParams(a)})}var cee=kt("ZodUnion",(o,a)=>{GQ.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>r2e(o,d,g,f),o.options=a.options});function N2e(o,a){return new cee({type:"union",options:o,...or.normalizeParams(a)})}var H1t=kt("ZodXor",(o,a)=>{cee.init(o,a),but.init(o,a),o._zod.processJSONSchema=(d,g,f)=>r2e(o,d,g,f),o.options=a.options});function ann(o,a){return new H1t({type:"union",options:o,inclusive:!1,...or.normalizeParams(a)})}var $1t=kt("ZodDiscriminatedUnion",(o,a)=>{cee.init(o,a),wut.init(o,a)});function snn(o,a,d){return new $1t({type:"union",options:a,discriminator:o,...or.normalizeParams(d)})}var U1t=kt("ZodIntersection",(o,a)=>{vut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>t1t(o,d,g,f)});function q1t(o,a){return new U1t({type:"intersection",left:o,right:a})}var G1t=kt("ZodTuple",(o,a)=>{S0e.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>n1t(o,d,g,f),o.rest=d=>o.clone({...o._zod.def,rest:d})});function V1t(o,a,d){let g=a instanceof jo,f=g?d:a,b=g?a:null;return new G1t({type:"tuple",items:o,rest:b,...or.normalizeParams(f)})}var aee=kt("ZodRecord",(o,a)=>{mut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>r1t(o,d,g,f),o.keyType=a.keyType,o.valueType=a.valueType});function W1t(o,a,d){return new aee({type:"record",keyType:o,valueType:a,...or.normalizeParams(d)})}function unn(o,a,d){let g=jy(o);return g._zod.values=void 0,new aee({type:"record",keyType:g,valueType:a,...or.normalizeParams(d)})}function lnn(o,a,d){return new aee({type:"record",keyType:o,valueType:a,mode:"loose",...or.normalizeParams(d)})}var J1t=kt("ZodMap",(o,a)=>{kut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Klt(o,d,g,f),o.keyType=a.keyType,o.valueType=a.valueType,o.min=(...d)=>o.check(b9(...d)),o.nonempty=d=>o.check(b9(1,d)),o.max=(...d)=>o.check(QI(...d)),o.size=(...d)=>o.check(XN(...d))});function hnn(o,a,d){return new J1t({type:"map",keyType:o,valueType:a,...or.normalizeParams(d)})}var Z1t=kt("ZodSet",(o,a)=>{Mut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Ylt(o,d,g,f),o.min=(...d)=>o.check(b9(...d)),o.nonempty=d=>o.check(b9(1,d)),o.max=(...d)=>o.check(QI(...d)),o.size=(...d)=>o.check(XN(...d))});function dnn(o,a){return new Z1t({type:"set",valueType:o,...or.normalizeParams(a)})}var uq=kt("ZodEnum",(o,a)=>{xut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(g,f,b)=>$lt(o,g,f,b),o.enum=a.entries,o.options=Object.values(a.entries);let d=new Set(Object.keys(a.entries));o.extract=(g,f)=>{let b={};for(let k of g)if(d.has(k))b[k]=a.entries[k];else throw new Error(`Key ${k} not found in enum`);return new uq({...a,checks:[],...or.normalizeParams(f),entries:b})},o.exclude=(g,f)=>{let b={...a.entries};for(let k of g)if(d.has(k))delete b[k];else throw new Error(`Key ${k} not found in enum`);return new uq({...a,checks:[],...or.normalizeParams(f),entries:b})}});function R2e(o,a){let d=Array.isArray(o)?Object.fromEntries(o.map(g=>[g,g])):o;return new uq({type:"enum",entries:d,...or.normalizeParams(a)})}function fnn(o,a){return new uq({type:"enum",entries:o,...or.normalizeParams(a)})}var X1t=kt("ZodLiteral",(o,a)=>{Sut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Ult(o,d,g,f),o.values=new Set(a.values),Object.defineProperty(o,"value",{get(){if(a.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return a.values[0]}})});function pnn(o,a){return new X1t({type:"literal",values:Array.isArray(o)?o:[o],...or.normalizeParams(a)})}var K1t=kt("ZodFile",(o,a)=>{_ut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Vlt(o,d,g,f),o.min=(d,g)=>o.check(b9(d,g)),o.max=(d,g)=>o.check(QI(d,g)),o.mime=(d,g)=>o.check(eq(Array.isArray(d)?d:[d],g))});function gnn(o){return Mlt(K1t,o)}var Y1t=kt("ZodTransform",(o,a)=>{Cut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Xlt(o,d,g,f),o._zod.parse=(d,g)=>{if(g.direction==="backward")throw new WI(o.constructor.name);d.addIssue=b=>{if(typeof b=="string")d.issues.push(or.issue(b,d.value,a));else{let k=b;k.fatal&&(k.continue=!1),k.code??(k.code="custom"),k.input??(k.input=d.value),k.inst??(k.inst=o),d.issues.push(or.issue(k))}};let f=a.transform(d.value,d);return f instanceof Promise?f.then(b=>(d.value=b,d)):(d.value=f,d)}});function O2e(o){return new Y1t({type:"transform",transform:o})}var D2e=kt("ZodOptional",(o,a)=>{_0e.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>i2e(o,d,g,f),o.unwrap=()=>o._zod.def.innerType});function QQ(o){return new D2e({type:"optional",innerType:o})}var Q1t=kt("ZodExactOptional",(o,a)=>{Iut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>i2e(o,d,g,f),o.unwrap=()=>o._zod.def.innerType});function eht(o){return new Q1t({type:"optional",innerType:o})}var tht=kt("ZodNullable",(o,a)=>{Lut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>i1t(o,d,g,f),o.unwrap=()=>o._zod.def.innerType});function eee(o){return new tht({type:"nullable",innerType:o})}function ynn(o){return QQ(eee(o))}var nht=kt("ZodDefault",(o,a)=>{Tut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>c1t(o,d,g,f),o.unwrap=()=>o._zod.def.innerType,o.removeDefault=o.unwrap});function rht(o,a){return new nht({type:"default",innerType:o,get defaultValue(){return typeof a=="function"?a():or.shallowClone(a)}})}var iht=kt("ZodPrefault",(o,a)=>{Eut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>a1t(o,d,g,f),o.unwrap=()=>o._zod.def.innerType});function oht(o,a){return new iht({type:"prefault",innerType:o,get defaultValue(){return typeof a=="function"?a():or.shallowClone(a)}})}var F2e=kt("ZodNonOptional",(o,a)=>{Put.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>o1t(o,d,g,f),o.unwrap=()=>o._zod.def.innerType});function cht(o,a){return new F2e({type:"nonoptional",innerType:o,...or.normalizeParams(a)})}var aht=kt("ZodSuccess",(o,a)=>{Aut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Wlt(o,d,g,f),o.unwrap=()=>o._zod.def.innerType});function bnn(o){return new aht({type:"success",innerType:o})}var sht=kt("ZodCatch",(o,a)=>{Nut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>s1t(o,d,g,f),o.unwrap=()=>o._zod.def.innerType,o.removeCatch=o.unwrap});function uht(o,a){return new sht({type:"catch",innerType:o,catchValue:typeof a=="function"?a:()=>a})}var lht=kt("ZodNaN",(o,a)=>{Rut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>qlt(o,d,g,f)});function wnn(o){return mlt(lht,o)}var z2e=kt("ZodPipe",(o,a)=>{Out.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>u1t(o,d,g,f),o.in=a.in,o.out=a.out});function tee(o,a){return new z2e({type:"pipe",in:o,out:a})}var j2e=kt("ZodCodec",(o,a)=>{z2e.init(o,a),VQ.init(o,a)});function vnn(o,a,d){return new j2e({type:"pipe",in:o,out:a,transform:d.decode,reverseTransform:d.encode})}var hht=kt("ZodReadonly",(o,a)=>{Dut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>l1t(o,d,g,f),o.unwrap=()=>o._zod.def.innerType});function dht(o){return new hht({type:"readonly",innerType:o})}var fht=kt("ZodTemplateLiteral",(o,a)=>{Fut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Glt(o,d,g,f)});function mnn(o,a){return new fht({type:"template_literal",parts:o,...or.normalizeParams(a)})}var pht=kt("ZodLazy",(o,a)=>{But.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>d1t(o,d,g,f),o.unwrap=()=>o._zod.def.getter()});function ght(o){return new pht({type:"lazy",getter:o})}var yht=kt("ZodPromise",(o,a)=>{jut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>h1t(o,d,g,f),o.unwrap=()=>o._zod.def.innerType});function knn(o){return new yht({type:"promise",innerType:o})}var bht=kt("ZodFunction",(o,a)=>{zut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Zlt(o,d,g,f)});function Mnn(o){return new bht({type:"function",input:Array.isArray(o?.input)?V1t(o?.input):o?.input??iee(QN()),output:o?.output??QN()})}var see=kt("ZodCustom",(o,a)=>{Hut.init(o,a),yc.init(o,a),o._zod.processJSONSchema=(d,g,f)=>Jlt(o,d,g,f)});function xnn(o){let a=new hl({check:"custom"});return a._zod.check=o,a}function Snn(o,a){return xlt(see,o??(()=>!0),a)}function wht(o,a={}){return Slt(see,o,a)}function vht(o){return _lt(o)}var _nn=Clt,Cnn=Ilt;function Inn(o,a={}){let d=new see({type:"custom",check:"custom",fn:g=>g instanceof o,abort:!0,...or.normalizeParams(a)});return d._zod.bag.Class=o,d._zod.check=g=>{g.value instanceof o||g.issues.push({code:"invalid_type",expected:o.name,input:g.value,inst:d,path:[...d._zod.def.path??[]]})},d}var Lnn=(...o)=>Llt({Codec:j2e,Boolean:fq,String:lq},...o);function Tnn(o){let a=ght(()=>N2e([d2e(o),E1t(),P1t(),O1t(),iee(a),W1t(d2e(),a)]));return a}function Enn(o,a){return tee(O2e(o),a)}var PBn={invalid_type:"invalid_type",too_big:"too_big",too_small:"too_small",invalid_format:"invalid_format",not_multiple_of:"not_multiple_of",unrecognized_keys:"unrecognized_keys",invalid_union:"invalid_union",invalid_key:"invalid_key",invalid_element:"invalid_element",invalid_value:"invalid_value",custom:"custom"};function ABn(o){cd({customError:o})}function NBn(){return cd().customError}var mht;mht||(mht={});var Fr={...KQ,...a2e,iso:sq},RBn=new Set(["$schema","$ref","$defs","definitions","$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor","type","enum","const","anyOf","oneOf","allOf","not","properties","required","additionalProperties","patternProperties","propertyNames","minProperties","maxProperties","items","prefixItems","additionalItems","minItems","maxItems","uniqueItems","contains","minContains","maxContains","minLength","maxLength","pattern","format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf","description","default","contentEncoding","contentMediaType","contentSchema","unevaluatedItems","unevaluatedProperties","if","then","else","dependentSchemas","dependentRequired","nullable","readOnly"]);function OBn(o,a){let d=o.$schema;return d==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":d==="http://json-schema.org/draft-07/schema#"?"draft-7":d==="http://json-schema.org/draft-04/schema#"?"draft-4":a??"draft-2020-12"}function DBn(o,a){if(!o.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let d=o.slice(1).split("/").filter(Boolean);if(d.length===0)return a.rootSchema;let g=a.version==="draft-2020-12"?"$defs":"definitions";if(d[0]===g){let f=d[1];if(!f||!a.defs[f])throw new Error(`Reference not found: ${o}`);return a.defs[f]}throw new Error(`Reference not found: ${o}`)}function Pnn(o,a){if(o.not!==void 0){if(typeof o.not=="object"&&Object.keys(o.not).length===0)return Fr.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(o.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(o.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(o.if!==void 0||o.then!==void 0||o.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(o.dependentSchemas!==void 0||o.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(o.$ref){let f=o.$ref;if(a.refs.has(f))return a.refs.get(f);if(a.processing.has(f))return Fr.lazy(()=>{if(!a.refs.has(f))throw new Error(`Circular reference not resolved: ${f}`);return a.refs.get(f)});a.processing.add(f);let b=DBn(f,a),k=xg(b,a);return a.refs.set(f,k),a.processing.delete(f),k}if(o.enum!==void 0){let f=o.enum;if(a.version==="openapi-3.0"&&o.nullable===!0&&f.length===1&&f[0]===null)return Fr.null();if(f.length===0)return Fr.never();if(f.length===1)return Fr.literal(f[0]);if(f.every(k=>typeof k=="string"))return Fr.enum(f);let b=f.map(k=>Fr.literal(k));return b.length<2?b[0]:Fr.union([b[0],b[1],...b.slice(2)])}if(o.const!==void 0)return Fr.literal(o.const);let d=o.type;if(Array.isArray(d)){let f=d.map(b=>{let k={...o,type:b};return Pnn(k,a)});return f.length===0?Fr.never():f.length===1?f[0]:Fr.union(f)}if(!d)return Fr.any();let g;switch(d){case"string":{let f=Fr.string();if(o.format){let b=o.format;b==="email"?f=f.check(Fr.email()):b==="uri"||b==="uri-reference"?f=f.check(Fr.url()):b==="uuid"||b==="guid"?f=f.check(Fr.uuid()):b==="date-time"?f=f.check(Fr.iso.datetime()):b==="date"?f=f.check(Fr.iso.date()):b==="time"?f=f.check(Fr.iso.time()):b==="duration"?f=f.check(Fr.iso.duration()):b==="ipv4"?f=f.check(Fr.ipv4()):b==="ipv6"?f=f.check(Fr.ipv6()):b==="mac"?f=f.check(Fr.mac()):b==="cidr"?f=f.check(Fr.cidrv4()):b==="cidr-v6"?f=f.check(Fr.cidrv6()):b==="base64"?f=f.check(Fr.base64()):b==="base64url"?f=f.check(Fr.base64url()):b==="e164"?f=f.check(Fr.e164()):b==="jwt"?f=f.check(Fr.jwt()):b==="emoji"?f=f.check(Fr.emoji()):b==="nanoid"?f=f.check(Fr.nanoid()):b==="cuid"?f=f.check(Fr.cuid()):b==="cuid2"?f=f.check(Fr.cuid2()):b==="ulid"?f=f.check(Fr.ulid()):b==="xid"?f=f.check(Fr.xid()):b==="ksuid"&&(f=f.check(Fr.ksuid()))}typeof o.minLength=="number"&&(f=f.min(o.minLength)),typeof o.maxLength=="number"&&(f=f.max(o.maxLength)),o.pattern&&(f=f.regex(new RegExp(o.pattern))),g=f;break}case"number":case"integer":{let f=d==="integer"?Fr.number().int():Fr.number();typeof o.minimum=="number"&&(f=f.min(o.minimum)),typeof o.maximum=="number"&&(f=f.max(o.maximum)),typeof o.exclusiveMinimum=="number"?f=f.gt(o.exclusiveMinimum):o.exclusiveMinimum===!0&&typeof o.minimum=="number"&&(f=f.gt(o.minimum)),typeof o.exclusiveMaximum=="number"?f=f.lt(o.exclusiveMaximum):o.exclusiveMaximum===!0&&typeof o.maximum=="number"&&(f=f.lt(o.maximum)),typeof o.multipleOf=="number"&&(f=f.multipleOf(o.multipleOf)),g=f;break}case"boolean":{g=Fr.boolean();break}case"null":{g=Fr.null();break}case"object":{let f={},b=o.properties||{},k=new Set(o.required||[]);for(let[P,N]of Object.entries(b)){let H=xg(N,a);f[P]=k.has(P)?H:H.optional()}if(o.propertyNames){let P=xg(o.propertyNames,a),N=o.additionalProperties&&typeof o.additionalProperties=="object"?xg(o.additionalProperties,a):Fr.any();if(Object.keys(f).length===0){g=Fr.record(P,N);break}let H=Fr.object(f).passthrough(),j=Fr.looseRecord(P,N);g=Fr.intersection(H,j);break}if(o.patternProperties){let P=o.patternProperties,N=Object.keys(P),H=[];for(let W of N){let Y=xg(P[W],a),ve=Fr.string().regex(new RegExp(W));H.push(Fr.looseRecord(ve,Y))}let j=[];if(Object.keys(f).length>0&&j.push(Fr.object(f).passthrough()),j.push(...H),j.length===0)g=Fr.object({}).passthrough();else if(j.length===1)g=j[0];else{let W=Fr.intersection(j[0],j[1]);for(let Y=2;Y<j.length;Y++)W=Fr.intersection(W,j[Y]);g=W}break}let m=Fr.object(f);o.additionalProperties===!1?g=m.strict():typeof o.additionalProperties=="object"?g=m.catchall(xg(o.additionalProperties,a)):g=m.passthrough();break}case"array":{let f=o.prefixItems,b=o.items;if(f&&Array.isArray(f)){let k=f.map(P=>xg(P,a)),m=b&&typeof b=="object"&&!Array.isArray(b)?xg(b,a):void 0;m?g=Fr.tuple(k).rest(m):g=Fr.tuple(k),typeof o.minItems=="number"&&(g=g.check(Fr.minLength(o.minItems))),typeof o.maxItems=="number"&&(g=g.check(Fr.maxLength(o.maxItems)))}else if(Array.isArray(b)){let k=b.map(P=>xg(P,a)),m=o.additionalItems&&typeof o.additionalItems=="object"?xg(o.additionalItems,a):void 0;m?g=Fr.tuple(k).rest(m):g=Fr.tuple(k),typeof o.minItems=="number"&&(g=g.check(Fr.minLength(o.minItems))),typeof o.maxItems=="number"&&(g=g.check(Fr.maxLength(o.maxItems)))}else if(b!==void 0){let k=xg(b,a),m=Fr.array(k);typeof o.minItems=="number"&&(m=m.min(o.minItems)),typeof o.maxItems=="number"&&(m=m.max(o.maxItems)),g=m}else g=Fr.array(Fr.any());break}default:throw new Error(`Unsupported type: ${d}`)}return o.description&&(g=g.describe(o.description)),o.default!==void 0&&(g=g.default(o.default)),g}function xg(o,a){if(typeof o=="boolean")return o?Fr.any():Fr.never();let d=Pnn(o,a),g=o.type||o.enum!==void 0||o.const!==void 0;if(o.anyOf&&Array.isArray(o.anyOf)){let m=o.anyOf.map(N=>xg(N,a)),P=Fr.union(m);d=g?Fr.intersection(d,P):P}if(o.oneOf&&Array.isArray(o.oneOf)){let m=o.oneOf.map(N=>xg(N,a)),P=Fr.xor(m);d=g?Fr.intersection(d,P):P}if(o.allOf&&Array.isArray(o.allOf))if(o.allOf.length===0)d=g?d:Fr.any();else{let m=g?d:xg(o.allOf[0],a),P=g?0:1;for(let N=P;N<o.allOf.length;N++)m=Fr.intersection(m,xg(o.allOf[N],a));d=m}o.nullable===!0&&a.version==="openapi-3.0"&&(d=Fr.nullable(d)),o.readOnly===!0&&(d=Fr.readonly(d));let f={},b=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let m of b)m in o&&(f[m]=o[m]);let k=["contentEncoding","contentMediaType","contentSchema"];for(let m of k)m in o&&(f[m]=o[m]);for(let m of Object.keys(o))RBn.has(m)||(f[m]=o[m]);return Object.keys(f).length>0&&a.registry.add(d,f),d}function Ann(o,a){if(typeof o=="boolean")return o?Fr.any():Fr.never();let d=OBn(o,a?.defaultTarget),g=o.$defs||o.definitions||{},f={version:d,defs:g,refs:new Map,processing:new Set,rootSchema:o,registry:a?.registry??kp};return xg(o,f)}var kht={};Ex(kht,{bigint:()=>BBn,boolean:()=>jBn,date:()=>HBn,number:()=>zBn,string:()=>FBn});function FBn(o){return Gut(lq,o)}function zBn(o){return Qut(dq,o)}function jBn(o){return clt(fq,o)}function BBn(o){return slt(pq,o)}function HBn(o){return vlt(ree,o)}cd(C0e());var Mht=["service","function","worker","agent","database","cache","vectordb","storage","queue","topic","stream","gateway","cdn","route","interface","adapter","port","llm","prompt","tool","auth","observability","cloud","frontend","external","page","component","store","hook","module","custom"],Nnn=cr.enum(Mht),$Bn=new Set(["service","function","worker","module","page","component","store","hook"]);function Rnn(o){return $Bn.has(o)}var xht=["http_call","grpc","invokes","routes_to","websocket","webhook","reads","writes","publishes","subscribes","streams_to","implements","extends","depends_on","has_a","uses"],Onn=cr.enum(xht);var gq=cr.enum(["proposed","active","deprecated"]),UBn=cr.string().min(1).refine(o=>!o.startsWith("/"),{message:"sourcePath must be a relative path (no leading /)"}).refine(o=>!o.includes("\\"),{message:"sourcePath must use forward slashes"}).refine(o=>!o.split("/").some(a=>a===".."),{message:"sourcePath must not contain `..` segments"}),qBn=/^[a-z][a-z0-9-]*$/,$y=cr.string().regex(qBn,"id must match /^[a-z][a-z0-9-]*$/"),Sht=cr.string().min(1).refine(o=>!o.startsWith("/")&&!/^[a-zA-Z]:[\\/]/.test(o),{message:"archikFile must be a relative path"}).refine(o=>!o.includes("\\"),{message:"archikFile must use forward slashes"}).refine(o=>!o.split("/").some(a=>a==="..")&&!o.includes("./../"),{message:"archikFile must not contain `..` segments"}).refine(o=>o.endsWith(".archik.yaml"),{message:"archikFile must end in `.archik.yaml`"}),_ht=cr.string().min(1).refine(o=>!o.startsWith("/")&&!/^[a-zA-Z]:[\\/]/.test(o),{message:"seqFile must be a relative path"}).refine(o=>!o.includes("\\"),{message:"seqFile must use forward slashes"}).refine(o=>!o.split("/").some(a=>a===".."),{message:"seqFile must not contain `..` segments"}).refine(o=>o.endsWith(".archik.seq.yaml"),{message:"seqFile must end in `.archik.seq.yaml`"}),GBn=cr.strictObject({name:cr.string().min(1),protocol:cr.string().min(1),description:cr.string().optional()}),VBn=cr.strictObject({id:$y,kind:Nnn,name:cr.string().min(1),description:cr.string().min(1).optional(),stack:cr.string().optional(),responsibilities:cr.array(cr.string().min(1)).optional(),interfaces:cr.array(GBn).optional(),notes:cr.array(cr.string()).optional(),parentId:$y.optional(),archikFile:Sht.optional(),seqFiles:cr.array(_ht).min(1).optional(),sourcePath:UBn.optional(),status:gq.optional(),metadata:cr.record(cr.string(),cr.unknown()).optional()}),WBn=cr.strictObject({id:$y,from:$y,to:$y,relationship:Onn,label:cr.string().optional(),description:cr.string().optional(),protocol:cr.string().optional(),color:cr.string().optional(),status:gq.optional(),fromFile:Sht.optional(),toFile:Sht.optional()}),JBn=cr.strictObject({from:cr.string().min(1),at:cr.string().min(1),note:cr.string().optional()}),ZBn=cr.strictObject({createdAt:cr.string().min(1).optional(),updatedAt:cr.string().min(1).optional(),suggestion:JBn.optional()}),Dnn=cr.strictObject({version:cr.literal("1.0"),name:cr.string().min(1),description:cr.string().optional(),nodes:cr.array(VBn),edges:cr.array(WBn),metadata:ZBn.optional()}).superRefine((o,a)=>{let d=new Set;for(let m=0;m<o.nodes.length;m++){let P=o.nodes[m];d.has(P.id)&&a.addIssue({code:cr.ZodIssueCode.custom,path:["nodes",m,"id"],message:`duplicate node id "${P.id}"`}),d.add(P.id),(P.description===void 0||P.description.length===0)&&a.addIssue({code:cr.ZodIssueCode.custom,path:["nodes",m,"description"],message:`node "${P.id}" is missing required \`description\`. Every node must explain what it does (its responsibility / behaviour) \u2014 not just restate its kind or name.`})}let g=new Set;for(let m=0;m<o.edges.length;m++){let P=o.edges[m];g.has(P.id)&&a.addIssue({code:cr.ZodIssueCode.custom,path:["edges",m,"id"],message:`duplicate edge id "${P.id}"`}),g.add(P.id),P.fromFile===void 0&&!d.has(P.from)&&a.addIssue({code:cr.ZodIssueCode.custom,path:["edges",m,"from"],message:`edge "${P.id}" references unknown node "${P.from}"`}),P.toFile===void 0&&!d.has(P.to)&&a.addIssue({code:cr.ZodIssueCode.custom,path:["edges",m,"to"],message:`edge "${P.id}" references unknown node "${P.to}"`}),P.fromFile!==void 0&&P.toFile!==void 0&&a.addIssue({code:cr.ZodIssueCode.custom,path:["edges",m],message:`edge "${P.id}" has both fromFile and toFile \u2014 at least one endpoint must be local to this file`}),P.from===P.to&&P.fromFile===void 0&&P.toFile===void 0&&a.addIssue({code:cr.ZodIssueCode.custom,path:["edges",m],message:`edge "${P.id}" is a self-loop (from === to). Self-loops aren't meaningful in an architecture diagram.`})}let f=new Map;for(let m of o.nodes)f.set(m.id,m.parentId);for(let m=0;m<o.nodes.length;m++){let P=o.nodes[m];if(P.parentId===void 0)continue;if(P.parentId===P.id){a.addIssue({code:cr.ZodIssueCode.custom,path:["nodes",m,"parentId"],message:`node "${P.id}" lists itself as parentId`});continue}if(!d.has(P.parentId)){a.addIssue({code:cr.ZodIssueCode.custom,path:["nodes",m,"parentId"],message:`node "${P.id}" parentId "${P.parentId}" doesn't match any node`});continue}let N=new Set([P.id]),H=P.parentId,j=0;for(;H!==void 0&&j<=o.nodes.length;){if(N.has(H)){a.addIssue({code:cr.ZodIssueCode.custom,path:["nodes",m,"parentId"],message:`node "${P.id}" is part of a parentId cycle (via "${H}")`});break}N.add(H),H=f.get(H),j++}}function b(m,P){let N=f.get(P),H=0;for(;N!==void 0&&H<=o.nodes.length;){if(N===m)return!0;N=f.get(N),H++}return!1}for(let m=0;m<o.edges.length;m++){let P=o.edges[m];P.fromFile!==void 0||P.toFile!==void 0||!d.has(P.from)||!d.has(P.to)||(b(P.from,P.to)||b(P.to,P.from))&&a.addIssue({code:cr.ZodIssueCode.custom,path:["edges",m],message:`edge "${P.id}" connects "${P.from}" and "${P.to}" but one is an ancestor of the other \u2014 the parent already contains the child, so an edge between them is a duplicate. Either remove the edge or change the parentId.`})}let k=new Map;for(let m=0;m<o.edges.length;m++){let P=o.edges[m];if(P.fromFile!==void 0||P.toFile!==void 0)continue;let N=`${P.from}\0${P.to}\0${P.relationship}`,H=k.get(N);if(H!==void 0){a.addIssue({code:cr.ZodIssueCode.custom,path:["edges",m],message:`edge "${P.id}" duplicates "${H}" \u2014 same from/to/relationship (${P.from} \u2192 ${P.to} via ${P.relationship}). The diagram already expresses this connection; remove one of them.`});continue}k.set(N,P.id)}});function yq(o,a,d){let g=[],f=new Map;for(let b of o.nodes)b.sourcePath!==void 0&&b.sourcePath.length>0&&f.set(b.id,b.sourcePath);return o.nodes.forEach((b,k)=>{if(!Rnn(b.kind))return;let m=b.status==="proposed"||b.status==="deprecated";if(b.sourcePath===void 0||b.sourcePath.length===0){if(m)return;g.push({path:`nodes.${k}.sourcePath`,message:`node "${b.id}" (kind: ${b.kind}) is missing required \`sourcePath\`. Code-bearing kinds must declare where their source lives. Either add a sourcePath, or mark the node \`status: proposed\` if the code isn't built yet (proposed/deprecated nodes are exempt).`});return}if(!d(b.sourcePath)){g.push({path:`nodes.${k}.sourcePath`,message:`node "${b.id}" sourcePath "${b.sourcePath}" does not exist on disk (resolved relative to the project root). Either fix the path, drop it (if status is proposed/deprecated, sourcePath is optional), or change the node's status to proposed.`});return}if(b.parentId!==void 0){let P=f.get(b.parentId);P!==void 0&&KBn(P)&&!XBn(b.sourcePath,P)&&g.push({path:`nodes.${k}.sourcePath`,message:`node "${b.id}" sourcePath "${b.sourcePath}" is not inside its parent's sourcePath "${P}". The diagram says "${b.id}" lives inside "${b.parentId}", but the source tree disagrees. Either fix the path, change the parentId, or drop one of the sourcePaths.`})}}),g}function XBn(o,a){let d=o.replace(/\/+$/,""),g=a.replace(/\/+$/,"");return d===g?!0:d.startsWith(g+"/")}function KBn(o){let a=o.split("/").pop()??"";return!/\.[^./]+$/.test(a)}function bq(o,a){let d=[];return o.nodes.forEach((g,f)=>{g.archikFile!==void 0&&(a(g.archikFile)||d.push({path:`nodes.${f}.archikFile`,message:`archikFile "${g.archikFile}" does not exist (resolved relative to the project root)`}))}),o.edges.forEach((g,f)=>{g.fromFile!==void 0&&!a(g.fromFile)&&d.push({path:`edges.${f}.fromFile`,message:`fromFile "${g.fromFile}" does not exist (resolved relative to the project root)`}),g.toFile!==void 0&&!a(g.toFile)&&d.push({path:`edges.${f}.toFile`,message:`toFile "${g.toFile}" does not exist (resolved relative to the project root)`})}),d}function znn(o,a){let d=[];return o.nodes.forEach((g,f)=>{g.seqFiles&&g.seqFiles.forEach((b,k)=>{a(b)||d.push({path:`nodes.${f}.seqFiles.${k}`,message:`seqFile "${b}" does not exist on disk (resolved relative to the project root)`})})}),d}function Fnn(o){return o.length===0?"<root>":o.map(String).join(".")}function YBn(o,a){let d=o[o.length-1],g=/expected array/i.test(a)&&/received\s+string/i.test(a),f=/received\s+undefined/i.test(a)||/required/i.test(a);return g&&(d==="notes"||d==="responsibilities"||d==="interfaces")?`${String(d)} is an array \u2014 wrap your value, e.g. ${String(d)}: ['first', 'second']. Run \`npx archik schema\` for the full shape.`:f&&d==="id"&&o.length>=2&&o[o.length-3]==="edges"?"every edge requires an `id` (kebab-case, unique within the document), e.g. id: api-writes-db. Run `npx archik schema` for the full Edge shape.":null}function QBn(o){return o.issues.flatMap(a=>{if(a.code==="unrecognized_keys")return a.keys.map(f=>({path:Fnn([...a.path,f]),message:"unrecognized key"}));let d=YBn(a.path,a.message),g=d===null?a.message:`${a.message}
502
502
  hint: ${d}`;return[{path:Fnn(a.path),message:g}]})}function rL(o){let a=Dnn.safeParse(o);return a.success?{ok:!0,value:a.data}:{ok:!1,errors:QBn(a.error)}}function Uy(o){return o.map(a=>` \u2022 ${a.path}: ${a.message}`).join(`
503
503
  `)}import{readFile as eHn,readdir as tHn}from"node:fs/promises";import lee from"node:path";var Cht=$i(EQ(),1);function S2(o){let a;try{a=Cht.default.parse(o)}catch(g){let f=g instanceof Error?g.message:String(g);throw new Error(`Invalid YAML: ${f}`)}let d=rL(a);if(!d.ok)throw new Error(`Invalid Archik document:
504
- ${Uy(d.errors)}`);return d.value}function uee(o){return Cht.default.stringify(o,{indent:2,lineWidth:0})}var nHn=6;function Iht(o,a){return lee.relative(o,a).split(lee.sep).join("/")||lee.basename(a)}function rHn(o){return o.endsWith(".archik.yaml")&&!o.endsWith(".archik.suggested.yaml")}async function um(o,a){let d=[],g=[],f=new Set,b=async m=>{if(f.has(m))return;f.add(m);let P;try{P=await eHn(m,"utf-8")}catch(N){g.push({abs:m,relPath:Iht(a,m),message:N instanceof Error?N.message:String(N)});return}try{let N=S2(P);d.push({abs:m,relPath:Iht(a,m),doc:N})}catch(N){g.push({abs:m,relPath:Iht(a,m),message:N instanceof Error?N.message:String(N)})}};await b(o);let k=async(m,P)=>{if(P>nHn)return;let N;try{N=await tHn(m,{withFileTypes:!0})}catch{return}for(let H of N){let j=lee.join(m,H.name);if(H.isDirectory()){await k(j,P+1);continue}H.isFile()&&rHn(H.name)&&await b(j)}};return await k(lee.join(a,".archik"),0),{docs:d,errors:g}}var $nn=$i(EQ(),1);import{readFile as dHn,readdir as fHn}from"node:fs/promises";import Hnn from"node:path";var iHn=cr.enum(["sync","async","return","create","destroy"]),oHn=cr.enum(["over","left_of","right_of"]),cHn=cr.enum(["alt","opt","loop","par","break","ref"]),aHn=cr.strictObject({id:$y,nodeId:$y,label:cr.string().min(1).optional()}),sHn=cr.strictObject({type:cr.literal("message"),id:$y,from:$y,to:$y,label:cr.string().min(1),arrow:iHn,activate:cr.boolean().optional(),status:gq.optional()}),uHn=cr.strictObject({type:cr.literal("note"),id:$y,position:oHn,participants:cr.array($y).min(1),text:cr.string().min(1),status:gq.optional()}),lHn=cr.lazy(()=>cr.strictObject({label:cr.string().optional(),steps:cr.array(jnn)})),hHn=cr.lazy(()=>cr.strictObject({type:cr.literal("group"),id:$y,kind:cHn,condition:cr.string().optional(),label:cr.string().optional(),branches:cr.array(lHn).optional(),seqFile:_ht.optional(),participants:cr.array($y).optional(),status:gq.optional()})),jnn=cr.lazy(()=>cr.union([sHn,uHn,hHn]));function Bnn(o,a){let d=[];for(let g of o)if(a.has(g.id)?d.push(g.id):a.add(g.id),g.type==="group"&&g.branches)for(let f of g.branches)d.push(...Bnn(f.steps,a));return d}var hee=cr.strictObject({version:cr.literal("1.0"),name:cr.string().min(1),description:cr.string().optional(),participants:cr.array(aHn).min(1),steps:cr.array(jnn)}).superRefine((o,a)=>{let d=new Set;for(let b=0;b<o.participants.length;b++){let k=o.participants[b];d.has(k.id)&&a.addIssue({code:cr.ZodIssueCode.custom,path:["participants",b,"id"],message:`duplicate participant id "${k.id}"`}),d.add(k.id)}let g=new Set,f=Bnn(o.steps,g);for(let b of f)a.addIssue({code:cr.ZodIssueCode.custom,path:["steps"],message:`duplicate step id "${b}"`})});async function B2e(o){let a=[],d=[],g=Hnn.join(o,".archik"),f;try{f=await fHn(g,{withFileTypes:!0,encoding:"utf8"})}catch{return{docs:a,errors:d}}return await Promise.all(f.filter(b=>!b.isDirectory()&&b.name.endsWith(".archik.seq.yaml")).map(async b=>{let k=Hnn.join(g,b.name),m=`.archik/${b.name}`,P;try{P=await dHn(k,"utf-8")}catch(N){d.push({abs:k,relPath:m,message:N instanceof Error?N.message:String(N)});return}try{let N=$nn.default.parse(P),H=hee.safeParse(N);if(!H.success){d.push({abs:k,relPath:m,message:H.error.issues.map(j=>j.message).join("; ")});return}a.push({abs:k,relPath:m,doc:H.data})}catch(N){d.push({abs:k,relPath:m,message:N instanceof Error?N.message:String(N)})}})),{docs:a,errors:d}}function Unn(o,a,d,g){o.forEach((f,b)=>{let k=`${g}.${b}`;f.type==="message"?(a.has(f.from)||d.push({path:`${k}.from`,message:`participant "${f.from}" is not declared in participants`}),a.has(f.to)||d.push({path:`${k}.to`,message:`participant "${f.to}" is not declared in participants`})):f.type==="note"?f.participants.forEach((m,P)=>{a.has(m)||d.push({path:`${k}.participants.${P}`,message:`participant "${m}" is not declared in participants`})}):f.type==="group"&&f.branches&&f.branches.forEach((m,P)=>{Unn(m.steps,a,d,`${k}.branches.${P}.steps`)})})}function qnn(o,a){let d=[],g=new Set;return o.participants.forEach((f,b)=>{g.add(f.id),a.has(f.nodeId)||d.push({path:`participants.${b}.nodeId`,message:`nodeId "${f.nodeId}" does not match any architecture node. Run \`npx archik q list\` to see available node ids.`})}),Unn(o.steps,g,d,"steps"),d}import dee from"node:path";function Bx(o){let a=dee.dirname(o),d=dee.basename(o),g=dee.extname(d),f=g.length>0?d.slice(0,-g.length):d;return dee.join(a,`${f}.suggested${g}`)}function wq(o){return dee.basename(o).endsWith(".archik.suggested.yaml")?"suggested":"normal"}function Gnn(o){return o.metadata?.suggestion!==void 0}function H2e(o){if(o.metadata?.suggestion===void 0)return o;let{suggestion:a,...d}=o.metadata,g={...o};return Object.keys(d).length===0?delete g.metadata:g.metadata=d,g}var yHn=o=>{let a=go(o,"json");return a!==void 0&&a!=="false"&&a!=="0"};function v9(o){console.log(JSON.stringify(o,null,2))}async function Jnn(o){let a=yHn(o),d;try{d=await mh(o._[0])}catch(He){let at=He instanceof Error?He.message:String(He);return a?v9({ok:!1,errors:[{path:"<root>",message:at}]}):console.error(`\u2717 ${at}`),1}let g=Vnn.relative(process.cwd(),d)||d,f;try{f=await gHn(d,"utf-8")}catch(He){let at=He instanceof Error?He.message:String(He);return a?v9({ok:!1,file:g,errors:[{path:"<root>",message:at}]}):(console.error(`\u2717 Cannot read ${g}`),console.error(at)),1}let b;try{b=Wnn.default.parse(f)}catch(He){let Ct=[{path:"<root>",message:`Invalid YAML: ${He instanceof Error?He.message:String(He)}`}];return a?v9({ok:!1,file:g,errors:Ct}):(console.error(`\u2717 ${g}`),console.error(Uy(Ct))),1}let k=rL(b);if(!k.ok)return a?v9({ok:!1,file:g,errors:k.errors}):(console.error(`\u2717 ${g}`),console.error(Uy(k.errors))),1;let m=x2(d),P=He=>pHn(Vnn.resolve(m,He)),N=bq(k.value,P);if(N.length>0)return a?v9({ok:!1,file:g,errors:N}):(console.error(`\u2717 ${g}`),console.error(Uy(N))),1;let H=wq(d),j=yq(k.value,H,P);if(j.length>0)return a?v9({ok:!1,file:g,errors:j}):(console.error(`\u2717 ${g}`),console.error(Uy(j))),1;let W=await um(d,m);if(W.errors.length>0){if(a)v9({ok:!1,file:g,errors:W.errors.map(He=>({path:He.relPath,message:He.message}))});else for(let He of W.errors)console.error(`\u2717 ${He.relPath}: ${He.message}`);return 1}let Y=new Set(W.docs.flatMap(He=>He.doc.nodes.map(at=>at.id))),ve=[];for(let{doc:He}of W.docs)ve.push(...znn(He,P));if(ve.length>0){if(a)v9({ok:!1,file:g,errors:ve});else{console.error("\u2717 seqFiles path errors:");for(let He of ve)console.error(` \u2717 ${He.path}: ${He.message}`)}return 1}let he=await B2e(m),we=0;for(let He of he.errors)a||console.error(`\u2717 ${He.relPath}: ${He.message}`),we++;for(let{relPath:He,doc:at}of he.docs){let Ct=qnn(at,Y);if(Ct.length>0){if(!a){console.error(`\u2717 ${He}`);for(let Pe of Ct)console.error(` \u2717 ${Pe.path}: ${Pe.message}`)}we+=Ct.length}}if(we>0)return a&&v9({ok:!1,file:g,errors:[{path:"<seq>",message:`${we} sequence diagram error(s)`}]}),1;if(a)v9({ok:!0,file:g,nodes:k.value.nodes.length,edges:k.value.edges.length});else{let He=W.docs.reduce((wt,ze)=>wt+ze.doc.nodes.length,0),at=W.docs.reduce((wt,ze)=>wt+ze.doc.edges.length,0),Ct=W.docs.length,Pe=Ct>1?` (${Ct} files)`:"";console.log(`\u2713 ${g}${Pe} \u2014 ${He} nodes, ${at} edges`)}return 0}var kft=$i(s3(),1),Mft=$i(nge(),1),oan=$i(EQ(),1);import{mkdir as nan,readFile as ran,writeFile as ian}from"node:fs/promises";import qq from"node:path";var icn=$i(ecn(),1);function ete(o,a){return o.length*a}function zf(o,a,d){if(a<=0)return"";let g=Math.floor(a/d);return o.length<=g?o:g<=1?"\u2026":o.slice(0,g-1)+"\u2026"}var tte={nodeSpacing:60,layerSpacing:100,padding:40,viewMode:"detailed"};function wGn(o){let a=o.nodeSpacing??tte.nodeSpacing,d=o.layerSpacing??tte.layerSpacing,g=o.padding??tte.padding;return{"elk.algorithm":"layered","elk.direction":"RIGHT","elk.edgeRouting":"ORTHOGONAL","elk.layered.spacing.nodeNodeBetweenLayers":String(d),"elk.spacing.nodeNode":String(a),"elk.padding":`[top=${g}, left=${g}, bottom=${g}, right=${g}]`,"elk.hierarchyHandling":"INCLUDE_CHILDREN","elk.edgeLabels.placement":"CENTER","elk.spacing.edgeLabel":"8","elk.spacing.labelLabel":"6","elk.spacing.edgeNode":"20","elk.spacing.edgeEdge":"12","elk.layered.spacing.edgeEdgeBetweenLayers":"12"}}var xh={width:172,height:82},tcn={width:172,height:90},vGn={service:xh,function:xh,worker:xh,agent:xh,database:{width:184,height:100},cache:tcn,vectordb:xh,storage:xh,queue:{width:188,height:80},topic:xh,stream:xh,gateway:xh,cdn:xh,route:xh,interface:xh,adapter:xh,port:xh,llm:xh,prompt:xh,tool:xh,auth:xh,observability:xh,cloud:{width:200,height:120},frontend:tcn,page:xh,component:xh,store:xh,hook:xh,external:{width:184,height:100},module:{width:240,height:130},custom:{width:240,height:130}},fl={width:152,height:36},ncn={width:200,height:80},mGn={service:fl,function:fl,worker:fl,agent:fl,database:fl,cache:fl,vectordb:fl,storage:fl,queue:{width:168,height:36},topic:fl,stream:fl,gateway:fl,cdn:fl,route:fl,interface:fl,adapter:fl,port:fl,llm:fl,prompt:fl,tool:fl,auth:fl,observability:fl,cloud:fl,frontend:fl,page:fl,component:fl,store:fl,hook:fl,external:{width:168,height:40},module:ncn,custom:ncn},kGn=24,rcn=320;function MGn(o,a,d){if(o.kind==="module"||o.kind==="custom")return a;if(d==="compact"){let m=36+ete(o.name,5.9)+12;return Math.max(a,Math.min(rcn,Math.ceil(m)))}let g=ete(o.name,7.4),f=o.stack!==void 0?ete(o.stack,5.9):0,b=Math.max(g,f)+kGn;return Math.max(a,Math.min(rcn,Math.ceil(b)))}var xGn={top:48,left:18,bottom:18,right:18};function SGn(o,a,d,g){let f=d[o.kind],b={id:o.id,width:MGn(o,f.width,g),height:f.height};if(a.length>0){b.children=a;let k=g==="compact"?{top:30,left:12,bottom:12,right:12}:xGn;b.layoutOptions={"elk.padding":`[top=${k.top}, left=${k.left}, bottom=${k.bottom}, right=${k.right}]`}}return b}function _Gn(o,a,d){let g=new Map;for(let m of o.nodes)g.set(m.id,m);let f=new Map;for(let m of o.nodes){let P=f.get(m.parentId)??[];P.push(m),f.set(m.parentId,P)}function b(m){let P=(f.get(m.id)??[]).map(b);return SGn(m,P,a,d)}return{roots:(f.get(void 0)??[]).map(b),byId:g}}function CGn(o){return o.fromFile===void 0&&o.toFile===void 0}function IGn(o){return o.edges.filter(CGn).map(a=>{let d={id:a.id,sources:[a.from],targets:[a.to]};return a.label!==void 0&&a.label.length>0&&(d.labels=[{text:a.label,width:Math.ceil(ete(a.label,5.9)),height:14}]),d})}function Ew(o){return o??0}function ocn(o,a){let d=a.get(o.id);if(!d)throw new Error(`ELK returned unknown node id "${o.id}"`);let g=(o.children??[]).map(f=>ocn(f,a));return{...d,x:Ew(o.x),y:Ew(o.y),width:Ew(o.width),height:Ew(o.height),children:g}}function LGn(o,a){let d=new Map,g=new Map,f=(N,H,j,W)=>{let Y=H+Ew(N.x),ve=j+Ew(N.y);d.set(N.id,{x:Y,y:ve}),g.set(N.id,W);let he=[...W,N.id];for(let we of N.children??[])f(we,Y,ve,he)};f(o,0,0,[]);let b=(N,H)=>{let j=g.get(N)??[],W=g.get(H)??[],Y=0;for(;Y<j.length&&Y<W.length&&j[Y]===W[Y];)Y++;let ve=Y===0?o.id:j[Y-1];return d.get(ve)??{x:0,y:0}},k=new Map,m=new Map,P=N=>{for(let H of N.edges??[]){let j=H.sources?.[0]??"",W=H.targets?.[0]??"",Y=b(j,W),ve=He=>({x:Ew(He.x)+Y.x,y:Ew(He.y)+Y.y}),he=(H.sections??[]).map(He=>({startPoint:ve(He.startPoint),endPoint:ve(He.endPoint),bendPoints:(He.bendPoints??[]).map(ve)}));k.set(H.id,he);let we=(H.labels??[]).map(He=>({text:typeof He.text=="string"?He.text:"",x:Ew(He.x)+Y.x,y:Ew(He.y)+Y.y,width:Ew(He.width),height:Ew(He.height)}));m.set(H.id,we)}for(let H of N.children??[])P(H)};return P(o),a.edges.map(N=>({...N,sections:k.get(N.id)??[],labels:m.get(N.id)??[]}))}var TGn=new icn.default;async function EGn(o,a={}){if(o.nodes.length===0)return{document:o,width:0,height:0,roots:[],edges:[]};let d=a.viewMode==="compact"?"compact":"detailed",g=d==="compact"?mGn:vGn,{roots:f,byId:b}=_Gn(o,g,d),k={id:"__root__",layoutOptions:wGn(a),children:f,edges:IGn(o)},m=await TGn.layout(k),P=(m.children??[]).map(N=>ocn(N,b));return{document:o,width:Ew(m.width),height:Ew(m.height),roots:P,edges:LGn(m,o)}}var rge={name:"elk",layout:EGn};var iei={[rge.name]:rge},PGn=rge;function Bq(o,a){return PGn.layout(o,a)}var ige="seq-arrow-filled",oge="seq-arrow-open";function AGn(o){return Math.max(160,o.length*8+80)}function ccn(o,a,d,g,f){let b=d,k=[];for(let m of o)if(m.type==="message"){let P=a.get(m.from),N=a.get(m.to),H=P?.cx??0,j=N?.cx??0;k.push({type:"message",id:m.id,fromCx:H,toCx:j,y:b,label:m.label,arrow:m.arrow,activate:m.activate??!1,isSelf:m.from===m.to,...m.status!==void 0?{status:m.status}:{}}),b+=m.from===m.to?56*1.5:56}else if(m.type==="note"){let P=m.participants.map(Y=>a.get(Y)?.cx??0).sort((Y,ve)=>Y-ve),N=P[0]??g,H=P[P.length-1]??f,j=Math.max(m.text.length*7.5+24,H-N+16,80),W=(N+H)/2-j/2;k.push({type:"note",id:m.id,x:W,y:b,width:j,height:48,text:m.text,...m.status!==void 0?{status:m.status}:{}}),b+=56}else if(m.type==="group"){let P=g-12,N=f-g+24,H=b;b+=24;let j=[];if(m.branches)for(let W=0;W<m.branches.length;W++){let Y=m.branches[W],ve=b,{items:he,endY:we}=ccn(Y.steps,a,b,g,f);b=we,j.push({...Y.label!==void 0?{label:Y.label}:{},startY:ve,...W<m.branches.length-1?{dividerY:b}:{},steps:he}),W<m.branches.length-1&&(b+=4)}b+=12,k.push({type:"group",id:m.id,kind:m.kind,...m.condition!==void 0?{condition:m.condition}:{},...m.label!==void 0?{label:m.label}:{},...m.seqFile!==void 0?{seqFile:m.seqFile}:{},x:P,y:H,width:N,height:b-H,branches:j,...m.status!==void 0?{status:m.status}:{}})}return{items:k,endY:b}}function acn(o){let a=new Map;for(let d of o)if(d.type==="message"&&d.arrow==="destroy"&&a.set(d.toCx,d.y+20),d.type==="group")for(let g of d.branches)for(let[f,b]of acn(g.steps))a.set(f,b);return a}function scn(o,a){let d=o.participants.map(he=>AGn(he.label??he.nodeId)),g=32,f=o.participants.map((he,we)=>{let He=d[we],at=g+He/2;g+=He;let Ct=a?.get(he.nodeId);return{id:he.id,nodeId:he.nodeId,label:he.label??he.nodeId,cx:at,colWidth:He,...Ct!==void 0?{kind:Ct}:{},lifelineEndY:0}}),b=g+32,k=new Map(f.map(he=>[he.id,he])),m=f[0]?.cx??32,P=f[f.length-1]?.cx??b-32,N=80,{items:H,endY:j}=ccn(o.steps,k,N,m,P),W=j+24,Y=acn(H);return{participants:f.map(he=>({...he,lifelineEndY:Y.get(he.cx)??W})),steps:H,totalWidth:b,totalHeight:W}}var Ni=$i(lft(),1);var p3=$i(ac(),1),bcn=(o,a,d)=>({width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:a,strokeWidth:d,strokeLinecap:"round",strokeLinejoin:"round"});function wcn({size:o=16,color:a="currentColor",strokeWidth:d=1.8}){return(0,p3.jsxs)("svg",{...bcn(o,a,d),"aria-hidden":"true",children:[(0,p3.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3.5",ry:"3.5"}),(0,p3.jsx)("line",{x1:"9",y1:"9",x2:"9",y2:"13"}),(0,p3.jsx)("line",{x1:"15",y1:"9",x2:"15",y2:"13"}),(0,p3.jsx)("circle",{cx:"12",cy:"16.5",r:"1",fill:a,stroke:"none"})]})}function vcn({size:o=16,color:a="currentColor",strokeWidth:d=1.8}){return(0,p3.jsxs)("svg",{...bcn(o,a,d),"aria-hidden":"true",children:[(0,p3.jsx)("path",{d:"M 7.5 6 L 3.5 12 L 7.5 18"}),(0,p3.jsx)("path",{d:"M 16.5 6 L 20.5 12 L 16.5 18"}),(0,p3.jsx)("circle",{cx:"13",cy:"8.6",r:"0.9",fill:a,stroke:"none"}),(0,p3.jsx)("line",{x1:"13",y1:"11",x2:"11",y2:"16.5"})]})}var Pw={service:{color:"#38bdf8",icon:Ni.Server,description:"Long-running compute that owns business logic."},function:{color:"#22d3ee",icon:Ni.FunctionSquare,description:"Stateless function-as-a-service / lambda."},worker:{color:"#06b6d4",icon:Ni.Cog,description:"Background job processor or consumer loop."},agent:{color:"#14b8a6",icon:Ni.Bot,description:"Autonomous AI agent driving tools and actions."},database:{color:"#34d399",icon:Ni.Database,description:"Persistent state \u2014 relational, document, key-value."},cache:{color:"#a78bfa",icon:Ni.Layers,description:"In-memory store for fast reads."},vectordb:{color:"#c084fc",icon:Ni.Sparkles,description:"Vector store for embeddings / similarity search."},storage:{color:"#84cc16",icon:Ni.HardDrive,description:"Object / blob storage (S3, GCS, etc.)."},queue:{color:"#fbbf24",icon:Ni.SendHorizontal,description:"Asynchronous work queue with at-least-once delivery."},topic:{color:"#f97316",icon:Ni.Radio,description:"Pub/sub topic with multiple consumers."},stream:{color:"#fb923c",icon:Ni.Waves,description:"Append-only event log (Kafka, Kinesis)."},gateway:{color:"#6366f1",icon:Ni.DoorOpen,description:"API gateway, ingress, edge router."},cdn:{color:"#0ea5e9",icon:Ni.Globe,description:"Content delivery network / static edge."},route:{color:"#f59e0b",icon:Ni.Route,description:"HTTP / URL route \u2014 path + method mapped to a handler."},interface:{color:"#d946ef",icon:vcn,description:"Abstract contract \u2014 the <i> a system commits to."},adapter:{color:"#c026d3",icon:Ni.Cable,description:"Concrete implementation of an interface."},port:{color:"#a21caf",icon:wcn,description:"Hexagonal-architecture port \u2014 the socket an adapter plugs into."},llm:{color:"#a855f7",icon:Ni.Brain,description:"Large language model service."},prompt:{color:"#c4b5fd",icon:Ni.MessageSquare,description:"Prompt template / instruction set."},tool:{color:"#fde047",icon:Ni.Wrench,description:"Tool callable by an agent or LLM."},auth:{color:"#ef4444",icon:Ni.Lock,description:"Identity provider, auth service."},observability:{color:"#10b981",icon:Ni.Eye,description:"Metrics, logs, traces \u2014 operational telemetry."},cloud:{color:"#0284c7",icon:Ni.Cloud,description:"Managed cloud service (compute, hosted, etc.)."},frontend:{color:"#f472b6",icon:Ni.Monitor,description:"User-facing surface \u2014 browser, mobile, CLI."},page:{color:"#fb7185",icon:Ni.LayoutTemplate,description:"Route-level UI screen mapped to a URL."},component:{color:"#8b5cf6",icon:Ni.Component,description:"Reusable UI component / view fragment."},store:{color:"#facc15",icon:Ni.Boxes,description:"Client-side state container \u2014 Redux, Zustand, Pinia."},hook:{color:"#0d9488",icon:Ni.Anchor,description:"Reusable client logic \u2014 React hook, Vue composable."},external:{color:"#94a3b8",icon:Ni.ExternalLink,description:"Third-party system you don't own."},module:{color:"#7dd3fc",icon:Ni.Package,description:"Module / component grouping (logical container)."},custom:{color:"#64748b",icon:Ni.Box,description:"Container or anything not in the taxonomy."}};var vz=$i(ac(),1),yOe=36,bOe=64;function mcn({participant:o,nodeKind:a}){let d=a?Pw[a]:void 0,g=d?.color??"var(--archik-fg-muted)",f=(56-yOe)/2,b=d?.icon,k=b?bOe+9:bOe;return(0,vz.jsxs)("g",{transform:`translate(${o.cx-bOe}, ${f})`,children:[(0,vz.jsx)("rect",{width:bOe*2,height:yOe,rx:8,fill:"var(--archik-node-fill)",stroke:g,strokeWidth:1.4}),b&&(0,vz.jsx)("g",{transform:`translate(10, ${(yOe-14)/2})`,children:(0,vz.jsx)(b,{size:14,color:g,strokeWidth:1.5})}),(0,vz.jsx)("text",{x:k,y:yOe/2+4,textAnchor:"middle",fontSize:12,fontWeight:500,fill:"var(--archik-fg)",fontFamily:"inherit",children:o.label})]})}var Mcn=$i(ac(),1);function kcn({participant:o}){return(0,Mcn.jsx)("line",{x1:o.cx,y1:56,x2:o.cx,y2:o.lifelineEndY,stroke:"var(--archik-node-stroke)",strokeWidth:1,strokeDasharray:"4 4",opacity:.5})}var g3=$i(ac(),1),dft=32,fft=20,fmr=-6,xcn=8,pmr=20;function Scn({msg:o}){let a=o.arrow==="return",d=o.arrow==="async",g=o.arrow==="create",f=a||g,b=o.arrow==="destroy",k=a||d?oge:ige,m=o.status==="proposed"?.5:o.status==="deprecated"?.35:1;if(o.isSelf){let j=o.fromCx,W=o.y,Y=`M ${j} ${W} L ${j+dft} ${W} L ${j+dft} ${W+fft} L ${j} ${W+fft}`;return(0,g3.jsxs)("g",{opacity:m,children:[(0,g3.jsx)("path",{d:Y,fill:"none",stroke:"var(--archik-edge-filled)",strokeWidth:1.4,markerEnd:`url(#${k})`}),(0,g3.jsx)("text",{x:j+dft+6,y:W+fft/2+4,fontSize:11,fill:"var(--archik-fg)",fontFamily:"inherit",children:o.label})]})}let N=o.fromCx<o.toCx?o.toCx-6:o.toCx+6,H=(o.fromCx+o.toCx)/2;return(0,g3.jsxs)("g",{opacity:m,children:[o.activate&&(0,g3.jsx)("rect",{x:o.toCx-xcn/2,y:o.y-2,width:xcn,height:pmr,fill:"var(--archik-node-fill)",stroke:"var(--archik-node-stroke)",strokeWidth:1,rx:2}),(0,g3.jsx)("line",{x1:o.fromCx,y1:o.y,x2:N,y2:o.y,stroke:"var(--archik-edge-filled)",strokeWidth:1.4,strokeDasharray:f?"4 4":void 0,markerEnd:b?void 0:`url(#${k})`}),(0,g3.jsxs)("text",{x:H,y:o.y+fmr,textAnchor:"middle",fontSize:11,fill:"var(--archik-fg)",fontFamily:"inherit",children:[g&&"\xABcreate\xBB ",o.label]}),o.arrow==="destroy"&&(0,g3.jsxs)("g",{transform:`translate(${o.toCx-6}, ${o.y-6})`,children:[(0,g3.jsx)("line",{x1:0,y1:0,x2:12,y2:12,stroke:"var(--archik-fg-muted)",strokeWidth:1.5}),(0,g3.jsx)("line",{x1:12,y1:0,x2:0,y2:12,stroke:"var(--archik-fg-muted)",strokeWidth:1.5})]})]})}var P9=$i(ac(),1),gmr={alt:"#6366f1",opt:"#0ea5e9",loop:"#10b981",par:"#f59e0b",break:"#ef4444",ref:"#8b5cf6"},_cn=36,pft=18;function Ccn({group:o,renderStep:a,onRefClick:d}){let g=gmr[o.kind]??"var(--archik-fg-muted)",f=o.status==="proposed"?.55:o.status==="deprecated"?.35:1,b=o.kind==="ref"&&o.seqFile!==void 0&&d!==void 0;return(0,P9.jsxs)("g",{opacity:f,onClick:b?()=>d(o.seqFile):void 0,style:b?{cursor:"pointer"}:void 0,children:[(0,P9.jsx)("rect",{x:o.x,y:o.y,width:o.width,height:o.height,rx:4,fill:"none",stroke:g,strokeWidth:1.2,opacity:.6}),(0,P9.jsx)("rect",{x:o.x,y:o.y,width:_cn,height:pft,rx:4,fill:g,opacity:.8}),(0,P9.jsx)("text",{x:o.x+6,y:o.y+pft-5,fontSize:10,fontWeight:600,fill:"#fff",fontFamily:"inherit",children:o.kind}),(o.condition??o.label)&&(0,P9.jsx)("text",{x:o.x+_cn+6,y:o.y+pft-5,fontSize:10,fill:g,fontFamily:"inherit",children:o.condition??o.label}),o.branches.map((k,m)=>(0,P9.jsxs)("g",{children:[k.label&&(0,P9.jsx)("text",{x:o.x+6,y:k.startY+12,fontSize:10,fill:g,fontFamily:"inherit",children:k.label}),k.steps.map(P=>a(P)),k.dividerY!==void 0&&(0,P9.jsx)("line",{x1:o.x,y1:k.dividerY,x2:o.x+o.width,y2:k.dividerY,stroke:g,strokeWidth:1,strokeDasharray:"4 2",opacity:.5})]},m))]})}var Hq=$i(ac(),1);function Icn({note:o}){let{x:a,y:d,width:g,height:f,text:b}=o,k=o.status==="proposed"?.55:o.status==="deprecated"?.35:1;return(0,Hq.jsxs)("g",{opacity:k,children:[(0,Hq.jsx)("path",{d:`M ${a} ${d} L ${a+g-10} ${d} L ${a+g} ${d+10} L ${a+g} ${d+f} L ${a} ${d+f} Z`,fill:"var(--archik-node-fill)",stroke:"var(--archik-node-stroke)",strokeWidth:1.2}),(0,Hq.jsx)("path",{d:`M ${a+g-10} ${d} L ${a+g-10} ${d+10} L ${a+g} ${d+10}`,fill:"none",stroke:"var(--archik-node-stroke)",strokeWidth:1.2}),(0,Hq.jsx)("text",{x:a+8,y:d+8+11,fontSize:11,fill:"var(--archik-fg)",fontFamily:"inherit",children:b})]})}var I2=$i(ac(),1);function ymr({id:o}){return(0,I2.jsx)("marker",{id:o,viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:(0,I2.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"context-stroke"})})}function bmr({id:o}){return(0,I2.jsx)("marker",{id:o,viewBox:"0 0 12 12",refX:"11",refY:"6",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:(0,I2.jsx)("path",{d:"M 1 1 L 11 6 L 1 11",fill:"none",stroke:"context-stroke",strokeWidth:"1.5",strokeLinejoin:"round"})})}function Lcn({step:o,onRefClick:a}){return o.type==="message"?(0,I2.jsx)(Scn,{msg:o}):o.type==="note"?(0,I2.jsx)(Icn,{note:o}):o.type==="group"?(0,I2.jsx)(Ccn,{group:o,...a!==void 0?{onRefClick:a}:{},renderStep:d=>(0,I2.jsx)(Lcn,{step:d,...a!==void 0?{onRefClick:a}:{}},d.id)}):null}function Tcn({laid:o,svgRef:a,onRefClick:d}){let{participants:g,steps:f,totalWidth:b,totalHeight:k}=o;return(0,I2.jsxs)("svg",{ref:a,width:b,height:k,viewBox:`0 0 ${b} ${k}`,xmlns:"http://www.w3.org/2000/svg",style:{fontFamily:"var(--archik-font, system-ui)"},children:[(0,I2.jsxs)("defs",{children:[(0,I2.jsx)(ymr,{id:ige}),(0,I2.jsx)(bmr,{id:oge})]}),g.map(m=>(0,I2.jsx)(kcn,{participant:m},m.id)),g.map(m=>(0,I2.jsx)(mcn,{participant:m,...m.kind!==void 0?{nodeKind:m.kind}:{}},m.id)),(0,I2.jsx)("g",{transform:`translate(0, ${56})`,children:f.map(m=>(0,I2.jsx)(Lcn,{step:m,...d!==void 0?{onRefClick:d}:{}},m.id))})]})}var vL=$i(ac(),1),jf=28;function $q({kind:o,iconAt:a,labelAt:d}){let g=Pw[o],f=g.icon,b=14;return(0,vL.jsxs)(vL.Fragment,{children:[(0,vL.jsx)("g",{transform:`translate(${a.cx-b/2}, ${a.cy-b/2})`,pointerEvents:"none","aria-hidden":"true",children:(0,vL.jsx)(f,{size:b,color:g.color,strokeWidth:1.8})}),(0,vL.jsx)("text",{x:d.cx,y:d.cy,textAnchor:"middle",fontSize:9.5,fontWeight:600,letterSpacing:"0.12em",fill:"var(--archik-node-caption)",children:o.toUpperCase()})]})}var mL=$i(ac(),1),wmr=24;function Ecn({node:o,selected:a}){let d=o.width,g=o.height,f=o.stack!==void 0,b=jf+(g-jf)/2,k=f?b-4:b+4,m=b+14,P=Math.max(0,d-wmr),N=zf(o.name,P,7.4),H=f?zf(o.stack,P,5.9):"";return(0,mL.jsxs)("g",{className:`archik-node archik-node--${o.kind}`,children:[(0,mL.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:d,height:g,rx:10,ry:10,fill:"var(--archik-node-fill)",stroke:a?"var(--archik-selected)":"var(--archik-node-stroke)",strokeWidth:a?1.8:1.4}),(0,mL.jsx)("line",{x1:0,y1:jf,x2:d,y2:jf,stroke:"var(--archik-node-stroke)",strokeOpacity:.25,strokeWidth:1}),(0,mL.jsx)($q,{kind:o.kind,iconAt:{cx:18,cy:jf/2},labelAt:{cx:d/2,cy:jf/2+3}}),(0,mL.jsx)("text",{x:d/2,y:k,textAnchor:"middle",fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:N}),f&&(0,mL.jsx)("text",{x:d/2,y:m,textAnchor:"middle",fontSize:11,fill:"var(--archik-node-text-dim)",children:H})]})}var kL=$i(ac(),1);function Pcn({node:o,selected:a}){let d=o.width,g=o.height,f=Math.min(g/2,28),b=o.stack!==void 0,k=jf+(g-jf)/2,m=b?k-4:k+4,P=k+14,N=Math.max(0,d-2*f-8),H=zf(o.name,N,7.4),j=b?zf(o.stack,N,5.9):"",W=a?"var(--archik-selected)":"var(--archik-node-stroke)";return(0,kL.jsxs)("g",{className:"archik-node archik-node--queue",children:[(0,kL.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:d,height:g,rx:f,ry:f,fill:"var(--archik-node-fill)",stroke:W,strokeWidth:a?1.8:1.4}),(0,kL.jsx)("line",{x1:f,y1:jf,x2:d-f,y2:jf,stroke:W,strokeOpacity:.25,strokeWidth:1}),(0,kL.jsx)($q,{kind:"queue",iconAt:{cx:f+8,cy:jf/2},labelAt:{cx:d/2,cy:jf/2+3}}),(0,kL.jsx)("text",{x:d/2,y:m,textAnchor:"middle",fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:H}),b&&(0,kL.jsx)("text",{x:d/2,y:P,textAnchor:"middle",fontSize:11,fill:"var(--archik-node-text-dim)",children:j})]})}var ML=$i(ac(),1),vmr=24;function Acn({node:o,selected:a}){let d=o.width,g=o.height,f=o.description!==void 0,b=jf,k=b+(g-b)/2,m=f?k-2:k+4,P=g-12,N=Math.max(0,d-vmr),H=zf(o.name,N,7.4),j=f?zf(o.description,N,5.9):"",W=a?"var(--archik-selected)":"var(--archik-node-stroke-soft)";return(0,ML.jsxs)("g",{className:"archik-node archik-node--external",children:[(0,ML.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:d,height:g,rx:8,ry:8,fill:"var(--archik-node-fill-tinted)",stroke:W,strokeWidth:a?1.8:1.2,strokeDasharray:a?void 0:"6 4"}),(0,ML.jsx)("line",{x1:6,y1:jf,x2:d-6,y2:jf,stroke:W,strokeOpacity:.25,strokeWidth:1}),(0,ML.jsx)($q,{kind:"external",iconAt:{cx:18,cy:jf/2},labelAt:{cx:d/2,cy:jf/2+3}}),(0,ML.jsx)("text",{x:d/2,y:m,textAnchor:"middle",fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:H}),f&&(0,ML.jsx)("text",{x:d/2,y:P,textAnchor:"middle",fontSize:10,fill:"var(--archik-node-text-dim)",children:j})]})}var G5=$i(ac(),1),mmr=28,kmr=10,Mmr=22;function Ncn({node:o,selected:a}){let d=o.width,g=o.height,f=d/2,b=kmr,k=Pw[o.kind],m=k.icon,P=a?"var(--archik-selected)":"var(--archik-node-stroke)",N=a?1.8:1.4,H=o.stack!==void 0,j=Math.max(0,d-mmr),W=zf(o.name,j,7.4),Y=H?zf(o.stack,j,5.9):"",ve=g,he=ve-Mmr,we=(he+ve)/2,Ct=(b+8+he)/2,Pe=H?Ct-4:Ct+4,wt=Ct+14;return(0,G5.jsxs)("g",{className:"archik-node archik-node--database",children:[(0,G5.jsx)("path",{className:a?"archik-selected-glow":void 0,d:Smr(d,g,b),fill:"var(--archik-node-fill)",stroke:P,strokeWidth:N,strokeLinejoin:"round"}),(0,G5.jsx)("ellipse",{cx:f,cy:b,rx:d/2,ry:b,fill:"var(--archik-node-fill)",stroke:P,strokeWidth:N}),(0,G5.jsx)("text",{x:f,y:Pe,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"var(--archik-node-text)",children:W}),H&&(0,G5.jsx)("text",{x:f,y:wt,textAnchor:"middle",fontSize:11,fill:"var(--archik-node-text-dim)",children:Y}),(0,G5.jsx)("line",{x1:4,y1:he,x2:d-4,y2:he,stroke:P,strokeOpacity:.45,strokeWidth:1}),(0,G5.jsx)("g",{transform:`translate(14, ${we-7})`,pointerEvents:"none","aria-hidden":"true",children:(0,G5.jsx)(m,{size:14,color:k.color,strokeWidth:1.9})}),(0,G5.jsx)("text",{x:f,y:we+4,textAnchor:"middle",fontSize:9.5,fontWeight:600,letterSpacing:"0.12em",fill:"var(--archik-node-caption)",children:o.kind.toUpperCase()})]})}var xmr=10;function Smr(o,a,d){let g=xmr;return[`M 0 ${d}`,`L 0 ${a-g}`,`A ${g} ${g} 0 0 0 ${g} ${a}`,`L ${o-g} ${a}`,`A ${g} ${g} 0 0 0 ${o} ${a-g}`,`L ${o} ${d}`,`A ${o/2} ${d} 0 0 0 0 ${d}`,"Z"].join(" ")}var Xx=$i(ac(),1),_mr=36,Rcn=18;function Ocn({node:o,selected:a}){let d=o.width,g=o.height,f=Pw[o.kind],b=f.icon,k=a?"var(--archik-selected)":"var(--archik-node-stroke)",m=a?1.8:1.4,P=o.stack!==void 0,N=Math.max(0,d-_mr),H=zf(o.name,N,7.4),j=P?zf(o.stack,N,5.9):"",W=d/2,Y=g*.55,ve=P?Y-4:Y+4,he=Y+14;return(0,Xx.jsxs)("g",{className:"archik-node archik-node--cloud",children:[(0,Xx.jsx)("path",{className:a?"archik-selected-glow":void 0,d:Cmr(d,g),fill:"var(--archik-node-fill)",stroke:k,strokeWidth:m,strokeLinejoin:"round"}),(0,Xx.jsx)("g",{transform:`translate(18, ${Rcn-6})`,pointerEvents:"none","aria-hidden":"true",children:(0,Xx.jsx)(b,{size:14,color:f.color,strokeWidth:1.9})}),(0,Xx.jsx)("text",{x:W,y:Rcn+4,textAnchor:"middle",fontSize:9.5,fontWeight:600,letterSpacing:"0.12em",fill:"var(--archik-node-caption)",children:o.kind.toUpperCase()}),(0,Xx.jsx)("text",{x:W,y:ve,textAnchor:"middle",fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:H}),P&&(0,Xx.jsx)("text",{x:W,y:he,textAnchor:"middle",fontSize:11,fill:"var(--archik-node-text-dim)",children:j})]})}function Cmr(o,a){let g=a-2,f=a*.62,b=Math.min(a*.18,14),k=o-4,m=a*.5,P=Math.min(k*.15,m*.85),N=Math.min(k*.18,m),H=Math.min(k*.15,m*.85),j=2*(P+N+H),W=Math.max(0,k-j)/4,Y=2,ve=o-2,he=Y+W,we=he+2*P,He=we+W,at=He+2*N,Ct=at+W,Pe=Ct+2*H;return[`M ${Y} ${g-b}`,`Q ${Y} ${g} ${Y+b} ${g}`,`L ${ve-b} ${g}`,`Q ${ve} ${g} ${ve} ${g-b}`,`L ${ve} ${f}`,`L ${Pe} ${f}`,`A ${H} ${H} 0 0 0 ${Ct} ${f}`,`L ${at} ${f}`,`A ${N} ${N} 0 0 0 ${He} ${f}`,`L ${we} ${f}`,`A ${P} ${P} 0 0 0 ${he} ${f}`,`L ${Y} ${f}`,"Z"].join(" ")}var Ky=$i(ac(),1),Uq=32,wOe=14,gft=14;function Dcn({node:o,selected:a,depth:d=0}){let g=o.width,f=o.height;if(!(o.children.length>0))return(0,Ky.jsx)(Lmr,{node:o,selected:!!a});let k=Pw[o.kind],m=k.icon,P=Math.min(.04+d*.06,.22),N=Math.min(.55+d*.12,.95),H=a?"var(--archik-selected)":"var(--archik-container-border)",j=a?1.8:1.2,W=Math.max(0,g-wOe*2-60),Y=zf(o.name,W,7.4);return(0,Ky.jsxs)("g",{className:`archik-node archik-node--${o.kind} archik-node--container`,children:[(0,Ky.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:g,height:f,rx:8,ry:8,fill:k.color,fillOpacity:P,stroke:H,strokeWidth:j,pointerEvents:"none"}),d>=1&&g>8&&f>8&&(0,Ky.jsx)("rect",{x:3,y:3,width:g-6,height:f-6,rx:6,ry:6,fill:"none",stroke:k.color,strokeOpacity:Math.min(.18+(d-1)*.06,.32),strokeWidth:1,pointerEvents:"none"}),(0,Ky.jsx)("path",{d:Imr(g,Uq,8),fill:k.color,fillOpacity:N*.18}),(0,Ky.jsx)("line",{x1:0,y1:Uq,x2:g,y2:Uq,stroke:H,strokeOpacity:.45,strokeWidth:1}),(0,Ky.jsx)("g",{transform:`translate(${wOe}, ${Uq/2-gft/2})`,pointerEvents:"none","aria-hidden":"true",children:(0,Ky.jsx)(m,{size:gft,color:k.color,strokeWidth:1.9})}),(0,Ky.jsx)("text",{x:wOe+gft+8,y:Uq/2+4,fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:Y}),(0,Ky.jsx)("text",{x:g-wOe,y:Uq/2+3,textAnchor:"end",fontSize:9.5,fontWeight:600,letterSpacing:"0.12em",fill:"var(--archik-node-caption)",children:o.kind.toUpperCase()})]})}function Imr(o,a,d){return`M ${d} 0 H ${o-d} A ${d} ${d} 0 0 1 ${o} ${d} V ${a} H 0 V ${d} A ${d} ${d} 0 0 1 ${d} 0 Z`}function Lmr({node:o,selected:a}){let d=o.width,g=o.height,f=Pw[o.kind],b=a?"var(--archik-selected)":"var(--archik-node-stroke-soft)";return(0,Ky.jsxs)("g",{className:`archik-node archik-node--${o.kind}`,children:[(0,Ky.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:d,height:g,rx:8,ry:8,fill:"var(--archik-node-fill-tinted)",stroke:b,strokeWidth:a?1.8:1.2,strokeDasharray:a?void 0:"5 4"}),(0,Ky.jsx)("text",{x:d/2,y:g/2+4,textAnchor:"middle",fontSize:12,fontWeight:600,fill:f.color,children:o.name})]})}var Yy=$i(ac(),1),rte=24,Fcn=10,yft=28;function zcn({node:o,selected:a,depth:d=0}){let g=o.width,f=o.height,b=Pw[o.kind],k=b.icon,m=o.kind==="external";if(o.children.length>0)return(0,Yy.jsx)(Tmr,{node:o,selected:!!a,depth:d});let P=a?"var(--archik-selected)":m?"var(--archik-node-stroke-soft)":"var(--archik-node-stroke)",N=m?"var(--archik-node-fill-tinted)":"var(--archik-node-fill)",H=o.kind==="queue"?Math.min(f/2,18):8;return(0,Yy.jsxs)("g",{className:`archik-node archik-node--${o.kind} archik-node--compact`,children:[(0,Yy.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:g,height:f,rx:H,ry:H,fill:N,stroke:P,strokeWidth:a?1.8:1.4,strokeDasharray:m&&!a?"5 4":void 0}),(0,Yy.jsx)("g",{transform:`translate(${Fcn}, ${f/2-7})`,pointerEvents:"none","aria-hidden":"true",children:(0,Yy.jsx)(k,{size:13,color:b.color,strokeWidth:1.9})}),(0,Yy.jsx)("text",{x:yft,y:f/2+4,fontSize:12,fontWeight:600,fill:"var(--archik-node-text)",children:zf(o.name,Math.max(0,g-yft-8),5.9)})]})}function Tmr({node:o,selected:a,depth:d}){let g=o.width,f=o.height,b=Pw[o.kind],k=b.icon,m=Math.min(.04+d*.035,.14),P=Math.min(.55+d*.08,.85),N=a?"var(--archik-selected)":"var(--archik-container-border)",H=Math.max(0,g-12-22),j=zf(o.name,H,5.9);return(0,Yy.jsxs)("g",{className:`archik-node archik-node--${o.kind} archik-node--compact archik-node--container`,children:[(0,Yy.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:g,height:f,rx:6,ry:6,fill:b.color,fillOpacity:m,stroke:N,strokeWidth:a?1.8:1.2}),(0,Yy.jsx)("path",{d:Emr(g,rte,6),fill:b.color,fillOpacity:P*.18}),(0,Yy.jsx)("line",{x1:0,y1:rte,x2:g,y2:rte,stroke:N,strokeOpacity:.45,strokeWidth:1}),(0,Yy.jsx)("g",{transform:`translate(${Fcn}, ${rte/2-6})`,pointerEvents:"none","aria-hidden":"true",children:(0,Yy.jsx)(k,{size:12,color:b.color,strokeWidth:1.9})}),(0,Yy.jsx)("text",{x:yft,y:rte/2+4,fontSize:12,fontWeight:600,fill:"var(--archik-node-text)",children:j})]})}function Emr(o,a,d){return`M ${d} 0 H ${o-d} A ${d} ${d} 0 0 1 ${o} ${d} V ${a} H 0 V ${d} A ${d} ${d} 0 0 1 ${d} 0 Z`}var xL=$i(lft(),1),Ag=$i(ac(),1),Pmr=12,Amr=18;function jcn({Icon:o,cx:a,cy:d,size:g=Pmr,color:f,strokeWidth:b=1.8}){return(0,Ag.jsx)("g",{transform:`translate(${a-g/2}, ${d-g/2})`,pointerEvents:"none","aria-hidden":"true",children:(0,Ag.jsx)(o,{size:g,color:f??"var(--archik-fg-dim)",strokeWidth:b})})}function Bcn(o){return(0,Ag.jsx)(jcn,{Icon:xL.Info,...o})}function Hcn(o){return(0,Ag.jsx)(jcn,{Icon:xL.StickyNote,...o})}function $cn({cx:o,cy:a,filePath:d,fileLabel:g,onClick:f,size:b=13}){return(0,Ag.jsxs)("g",{transform:`translate(${o-b/2}, ${a-b/2})`,style:{cursor:f?"pointer":"default"},onClick:f,children:[(0,Ag.jsx)("title",{children:`Cross-file edge \u2192 ${g} (${d})`}),(0,Ag.jsx)("circle",{cx:b/2,cy:b/2,r:b/2+.5,fill:"var(--archik-fg-dim)",fillOpacity:.12,stroke:"var(--archik-fg-dim)",strokeOpacity:.4,strokeWidth:1}),(0,Ag.jsx)("g",{transform:"translate(1, 1)",pointerEvents:"none",children:(0,Ag.jsx)(xL.ArrowUpRight,{size:b-2,color:"var(--archik-fg-muted)",strokeWidth:2.2})})]})}function Ucn({cx:o,cy:a,onClick:d,size:g=14}){return(0,Ag.jsxs)("g",{transform:`translate(${o-g/2}, ${a-g/2})`,style:{cursor:d?"pointer":"default"},onClick:d,children:[(0,Ag.jsx)("title",{children:"Open sub-architecture"}),(0,Ag.jsx)("circle",{cx:g/2,cy:g/2,r:g/2+.5,fill:"var(--archik-accent)",fillOpacity:.16,stroke:"var(--archik-accent)",strokeOpacity:.45,strokeWidth:1}),(0,Ag.jsx)("g",{transform:"translate(1, 1)",pointerEvents:"none",children:(0,Ag.jsx)(xL.ChevronDown,{size:g-2,color:"var(--archik-accent)",strokeWidth:2.2})})]})}function qcn(o,a,d){switch(o){case"queue":{let f=Math.min(d/2,28);return{right:{x:a-f-4,y:14}}}case"database":return{right:{x:a-14,y:d-11}};default:return{right:{x:a-14,y:14}}}}function Gcn(o,a){return Array.from({length:a},(d,g)=>({x:o.x-g*Amr,y:o.y}))}var ad=$i(ac(),1);function Nmr({node:o,selected:a,viewMode:d,depth:g}){if(d==="compact")return(0,ad.jsx)(zcn,{node:o,selected:a,depth:g});if(o.children.length>0)return(0,ad.jsx)(Dcn,{node:o,selected:a,depth:g});switch(o.kind){case"queue":return(0,ad.jsx)(Pcn,{node:o,selected:a});case"external":return(0,ad.jsx)(Acn,{node:o,selected:a});case"database":return(0,ad.jsx)(Ncn,{node:o,selected:a});case"cloud":return(0,ad.jsx)(Ocn,{node:o,selected:a});case"module":case"custom":case"service":case"function":case"worker":case"agent":case"cache":case"vectordb":case"storage":case"topic":case"stream":case"gateway":case"cdn":case"route":case"interface":case"adapter":case"port":case"llm":case"prompt":case"tool":case"auth":case"observability":case"frontend":case"page":case"component":case"store":case"hook":return(0,ad.jsx)(Ecn,{node:o,selected:a});default:{let f=o.kind;throw new Error("unreachable node kind")}}}function bft({node:o,selectedNodeIds:a,glowNodeIds:d,onSelectNode:g,onOpenSubFile:f,onCrossFileNavigate:b,crossFileByNode:k,viewMode:m="detailed",depth:P=0}){let N=a?.has(o.id)??!1,H=d?.has(o.id)??!1,j=o.children.length>0,W=j?P+1:P,Y=g?he=>{he.stopPropagation(),g(o.id,he)}:void 0,ve=o.description!==void 0&&o.description.length>0;return(0,ad.jsxs)("g",{"data-archik-node-id":o.id,...N?{"data-archik-selected":"true"}:{},...o.status!==void 0&&o.status!=="active"?{"data-archik-status":o.status}:{},transform:`translate(${o.x}, ${o.y})`,...Y!==void 0?{onClick:Y}:{},style:g?{cursor:"pointer"}:void 0,children:[H&&(0,ad.jsx)("rect",{x:-4,y:-4,width:o.width+8,height:o.height+8,rx:10,fill:"none",stroke:"var(--archik-status-proposed)",strokeWidth:2,opacity:.85,style:{pointerEvents:"none"}}),(0,ad.jsx)(Nmr,{node:o,selected:N,viewMode:m,depth:P}),m==="detailed"&&!j&&(()=>{let he=o.notes!==void 0&&o.notes.length>0,we=o.archikFile!==void 0&&o.archikFile.length>0,He=k?.get(o.id),at=He?Array.from(He).sort():[],Ct=[];we&&Ct.push("subarch");for(let ze of at)Ct.push({type:"crossfile",path:ze});if(ve&&Ct.push("info"),he&&Ct.push("notes"),Ct.length===0)return null;let Pe=qcn(o.kind,o.width,o.height),wt=Gcn(Pe.right,Ct.length);return(0,ad.jsx)(ad.Fragment,{children:Ct.map((ze,Qn)=>{let nn=wt[Qn];if(typeof ze=="object"&&ze.type==="crossfile"){let fr=ze.path,wr=fr.split("/").pop().replace(/\.archik\.yaml$/,""),Rr=b??f,mn=Rr?bi=>{bi.stopPropagation(),Rr(fr,wr)}:void 0;return(0,ad.jsx)($cn,{cx:nn.x,cy:nn.y,filePath:fr,fileLabel:wr,...mn?{onClick:mn}:{}},`xf-${fr}`)}if(ze==="subarch"){let fr=o.archikFile,wr=f?Rr=>{Rr.stopPropagation(),f(fr,o.name)}:void 0;return(0,ad.jsx)(Ucn,{cx:nn.x,cy:nn.y,...wr?{onClick:wr}:{}},"subarch")}return ze==="info"?(0,ad.jsx)(Bcn,{cx:nn.x,cy:nn.y,color:"var(--archik-node-caption)"},"info"):(0,ad.jsxs)("g",{children:[(0,ad.jsx)(Hcn,{cx:nn.x,cy:nn.y,color:"var(--archik-node-caption)"}),o.notes&&o.notes.length>1&&(0,ad.jsx)("text",{x:nn.x+7,y:nn.y-5,fontSize:8,fontWeight:700,fill:"var(--archik-accent)",textAnchor:"middle",pointerEvents:"none",children:o.notes.length})]},"notes")})})})(),o.children.map(he=>(0,ad.jsx)(bft,{node:he,viewMode:m,depth:W,...a!==void 0?{selectedNodeIds:a}:{},...d!==void 0?{glowNodeIds:d}:{},...g!==void 0?{onSelectNode:g}:{},...f!==void 0?{onOpenSubFile:f}:{},...b!==void 0?{onCrossFileNavigate:b}:{},...k!==void 0?{crossFileByNode:k}:{}},he.id))]})}var kz=$i(ac(),1),Aw="archik-arrow-filled",mz="archik-arrow-open",wft="archik-arrow-selected",V5="var(--archik-edge-filled)",ite="var(--archik-edge-dim)",Rmr={http_call:{stroke:V5,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Aw},grpc:{stroke:V5,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Aw},invokes:{stroke:V5,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Aw},routes_to:{stroke:V5,strokeWidth:1.4,markerId:Aw},websocket:{stroke:V5,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Aw,markerStartId:Aw},webhook:{stroke:V5,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Aw},reads:{stroke:V5,strokeWidth:1.4,markerId:mz},writes:{stroke:V5,strokeWidth:1.4,markerId:Aw},publishes:{stroke:V5,strokeWidth:1.4,markerId:Aw},subscribes:{stroke:V5,strokeWidth:1.4,markerId:Aw},streams_to:{stroke:V5,strokeWidth:1.4,markerId:Aw},implements:{stroke:ite,strokeWidth:1.2,markerId:mz},extends:{stroke:ite,strokeWidth:1.2,markerId:mz},depends_on:{stroke:ite,strokeWidth:1.2,markerId:mz},has_a:{stroke:ite,strokeWidth:1.2,markerId:Aw},uses:{stroke:ite,strokeWidth:1.2,markerId:mz}};function Vcn(o){return o.map(a=>`${a.x},${a.y}`).join(" ")}function Omr(o){if(o.length===0)return;let a=Math.floor(o.length/2);if(o.length%2===1)return o[a];let d=o[a-1],g=o[a];return{x:(d.x+g.x)/2,y:(d.y+g.y)/2}}function Wcn({edge:o,selectedEdgeIds:a,onSelectEdge:d}){let g=o.sections[0];if(!g)return null;let f=[g.startPoint,...g.bendPoints,g.endPoint],b=Rmr[o.relationship],k=o.labels[0],m=k?{x:k.x+k.width/2,y:k.y+k.height/2}:Omr(f),P=a?.has(o.id)??!1,N=o.status==="proposed"?"var(--archik-status-proposed)":o.status==="deprecated"?"var(--archik-status-deprecated)":void 0,H=P?"var(--archik-selected)":N??o.color??b.stroke,j=P?b.strokeWidth+.5:b.strokeWidth,W=P?wft:b.markerId,Y=!P&&b.markerStartId!==void 0?b.markerStartId:void 0,ve=!P&&b.animated?"archik-edge-flowing":void 0,he=b.strokeDasharray!==void 0?b.strokeDasharray.trim().split(/\s+/).reduce((at,Ct)=>at+Number(Ct),0):0,we=ve!==void 0&&he>0?{"--archik-dash-period":String(he)}:void 0,He=d?at=>{at.stopPropagation(),d(o.id,at)}:void 0;return(0,kz.jsxs)("g",{"data-archik-edge-id":o.id,"data-archik-edge-relationship":o.relationship,...P?{"data-archik-selected":"true"}:{},...o.status!==void 0&&o.status!=="active"?{"data-archik-status":o.status}:{},className:`archik-edge archik-edge--${o.relationship}`,...He!==void 0?{onClick:He}:{},style:d?{cursor:"pointer"}:void 0,children:[d&&(0,kz.jsx)("polyline",{"data-archik-edge-hitarea":"",points:Vcn(f),fill:"none",stroke:"transparent",strokeWidth:14,strokeLinecap:"round",strokeLinejoin:"round"}),(0,kz.jsx)("polyline",{className:ve,points:Vcn(f),fill:"none",stroke:H,strokeWidth:j,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:`url(#${W})`,...Y!==void 0?{markerStart:`url(#${Y})`}:{},...b.strokeDasharray!==void 0?{strokeDasharray:b.strokeDasharray}:{},...we!==void 0?{style:we}:{}}),o.label!==void 0&&m!==void 0&&(0,kz.jsx)("g",{transform:`translate(${m.x}, ${k?m.y+4:m.y-6})`,children:(0,kz.jsx)("text",{textAnchor:"middle",fontSize:11,fontWeight:P?700:500,fill:P?"var(--archik-selected)":"var(--archik-fg-dim)",stroke:"var(--archik-panel)",strokeWidth:P?4:3,paintOrder:"stroke",children:o.label})})]})}var Qy=$i(ac(),1);var vft={added:"var(--archik-success)",removed:"var(--archik-danger)",changed:"var(--archik-warning)"};function Dmr(o){let a=[],d=(g,f,b)=>{for(let k of g){let m=f+k.x,P=b+k.y;a.push({...k,absX:m,absY:P}),k.children.length>0&&d(k.children,m,P)}};return d(o,0,0),a}function Fmr(o){return o.replace(/[^a-z0-9-]/g,a=>`\\${a}`)}function Xcn({statuses:o,scopeClass:a}){let d=[];for(let[f,b]of o.nodes)b==="removed"&&d.push(f);if(d.length===0)return null;let g=d.map(f=>`.${a} [data-archik-node-id="${Fmr(f)}"] { opacity: 0.35; }`).join(`
504
+ ${Uy(d.errors)}`);return d.value}function uee(o){return Cht.default.stringify(o,{indent:2,lineWidth:0})}var nHn=6;function Iht(o,a){return lee.relative(o,a).split(lee.sep).join("/")||lee.basename(a)}function rHn(o){return o.endsWith(".archik.yaml")&&!o.endsWith(".archik.suggested.yaml")}async function um(o,a){let d=[],g=[],f=new Set,b=async m=>{if(f.has(m))return;f.add(m);let P;try{P=await eHn(m,"utf-8")}catch(N){g.push({abs:m,relPath:Iht(a,m),message:N instanceof Error?N.message:String(N)});return}try{let N=S2(P);d.push({abs:m,relPath:Iht(a,m),doc:N})}catch(N){g.push({abs:m,relPath:Iht(a,m),message:N instanceof Error?N.message:String(N)})}};await b(o);let k=async(m,P)=>{if(P>nHn)return;let N;try{N=await tHn(m,{withFileTypes:!0})}catch{return}for(let H of N){let j=lee.join(m,H.name);if(H.isDirectory()){await k(j,P+1);continue}H.isFile()&&rHn(H.name)&&await b(j)}};return await k(lee.join(a,".archik"),0),{docs:d,errors:g}}var $nn=$i(EQ(),1);import{readFile as dHn,readdir as fHn}from"node:fs/promises";import Hnn from"node:path";var iHn=cr.enum(["sync","async","return","create","destroy"]),oHn=cr.enum(["over","left_of","right_of"]),cHn=cr.enum(["alt","opt","loop","par","break","ref"]),aHn=cr.strictObject({id:$y,nodeId:$y,label:cr.string().min(1).optional()}),sHn=cr.strictObject({type:cr.literal("message"),id:$y,from:$y,to:$y,label:cr.string().min(1),arrow:iHn,activate:cr.boolean().optional(),status:gq.optional()}),uHn=cr.strictObject({type:cr.literal("note"),id:$y,position:oHn,participants:cr.array($y).min(1),text:cr.string().min(1),status:gq.optional()}),lHn=cr.lazy(()=>cr.strictObject({label:cr.string().optional(),steps:cr.array(jnn)})),hHn=cr.lazy(()=>cr.strictObject({type:cr.literal("group"),id:$y,kind:cHn,condition:cr.string().optional(),label:cr.string().optional(),branches:cr.array(lHn).optional(),seqFile:_ht.optional(),participants:cr.array($y).optional(),status:gq.optional()})),jnn=cr.lazy(()=>cr.union([sHn,uHn,hHn]));function Bnn(o,a){let d=[];for(let g of o)if(a.has(g.id)?d.push(g.id):a.add(g.id),g.type==="group"&&g.branches)for(let f of g.branches)d.push(...Bnn(f.steps,a));return d}var hee=cr.strictObject({version:cr.literal("1.0"),name:cr.string().min(1),description:cr.string().optional(),participants:cr.array(aHn).min(1),steps:cr.array(jnn)}).superRefine((o,a)=>{let d=new Set;for(let b=0;b<o.participants.length;b++){let k=o.participants[b];d.has(k.id)&&a.addIssue({code:cr.ZodIssueCode.custom,path:["participants",b,"id"],message:`duplicate participant id "${k.id}"`}),d.add(k.id)}let g=new Set,f=Bnn(o.steps,g);for(let b of f)a.addIssue({code:cr.ZodIssueCode.custom,path:["steps"],message:`duplicate step id "${b}"`})});async function B2e(o){let a=[],d=[],g=Hnn.join(o,".archik"),f;try{f=await fHn(g,{withFileTypes:!0,encoding:"utf8"})}catch{return{docs:a,errors:d}}return await Promise.all(f.filter(b=>!b.isDirectory()&&b.name.endsWith(".archik.seq.yaml")).map(async b=>{let k=Hnn.join(g,b.name),m=`.archik/${b.name}`,P;try{P=await dHn(k,"utf-8")}catch(N){d.push({abs:k,relPath:m,message:N instanceof Error?N.message:String(N)});return}try{let N=$nn.default.parse(P),H=hee.safeParse(N);if(!H.success){d.push({abs:k,relPath:m,message:H.error.issues.map(j=>j.message).join("; ")});return}a.push({abs:k,relPath:m,doc:H.data})}catch(N){d.push({abs:k,relPath:m,message:N instanceof Error?N.message:String(N)})}})),{docs:a,errors:d}}function Unn(o,a,d,g){o.forEach((f,b)=>{let k=`${g}.${b}`;f.type==="message"?(a.has(f.from)||d.push({path:`${k}.from`,message:`participant "${f.from}" is not declared in participants`}),a.has(f.to)||d.push({path:`${k}.to`,message:`participant "${f.to}" is not declared in participants`})):f.type==="note"?f.participants.forEach((m,P)=>{a.has(m)||d.push({path:`${k}.participants.${P}`,message:`participant "${m}" is not declared in participants`})}):f.type==="group"&&f.branches&&f.branches.forEach((m,P)=>{Unn(m.steps,a,d,`${k}.branches.${P}.steps`)})})}function qnn(o,a){let d=[],g=new Set;return o.participants.forEach((f,b)=>{g.add(f.id),a.has(f.nodeId)||d.push({path:`participants.${b}.nodeId`,message:`nodeId "${f.nodeId}" does not match any architecture node. Run \`npx archik q list\` to see available node ids.`})}),Unn(o.steps,g,d,"steps"),d}import dee from"node:path";function Bx(o){let a=dee.dirname(o),d=dee.basename(o),g=dee.extname(d),f=g.length>0?d.slice(0,-g.length):d;return dee.join(a,`${f}.suggested${g}`)}function wq(o){return dee.basename(o).endsWith(".archik.suggested.yaml")?"suggested":"normal"}function Gnn(o){return o.metadata?.suggestion!==void 0}function H2e(o){if(o.metadata?.suggestion===void 0)return o;let{suggestion:a,...d}=o.metadata,g={...o};return Object.keys(d).length===0?delete g.metadata:g.metadata=d,g}var yHn=o=>{let a=go(o,"json");return a!==void 0&&a!=="false"&&a!=="0"};function v9(o){console.log(JSON.stringify(o,null,2))}async function Jnn(o){let a=yHn(o),d;try{d=await mh(o._[0])}catch(He){let at=He instanceof Error?He.message:String(He);return a?v9({ok:!1,errors:[{path:"<root>",message:at}]}):console.error(`\u2717 ${at}`),1}let g=Vnn.relative(process.cwd(),d)||d,f;try{f=await gHn(d,"utf-8")}catch(He){let at=He instanceof Error?He.message:String(He);return a?v9({ok:!1,file:g,errors:[{path:"<root>",message:at}]}):(console.error(`\u2717 Cannot read ${g}`),console.error(at)),1}let b;try{b=Wnn.default.parse(f)}catch(He){let Ct=[{path:"<root>",message:`Invalid YAML: ${He instanceof Error?He.message:String(He)}`}];return a?v9({ok:!1,file:g,errors:Ct}):(console.error(`\u2717 ${g}`),console.error(Uy(Ct))),1}let k=rL(b);if(!k.ok)return a?v9({ok:!1,file:g,errors:k.errors}):(console.error(`\u2717 ${g}`),console.error(Uy(k.errors))),1;let m=x2(d),P=He=>pHn(Vnn.resolve(m,He)),N=bq(k.value,P);if(N.length>0)return a?v9({ok:!1,file:g,errors:N}):(console.error(`\u2717 ${g}`),console.error(Uy(N))),1;let H=wq(d),j=yq(k.value,H,P);if(j.length>0)return a?v9({ok:!1,file:g,errors:j}):(console.error(`\u2717 ${g}`),console.error(Uy(j))),1;let W=await um(d,m);if(W.errors.length>0){if(a)v9({ok:!1,file:g,errors:W.errors.map(He=>({path:He.relPath,message:He.message}))});else for(let He of W.errors)console.error(`\u2717 ${He.relPath}: ${He.message}`);return 1}let Y=new Set(W.docs.flatMap(He=>He.doc.nodes.map(at=>at.id))),ve=[];for(let{doc:He}of W.docs)ve.push(...znn(He,P));if(ve.length>0){if(a)v9({ok:!1,file:g,errors:ve});else{console.error("\u2717 seqFiles path errors:");for(let He of ve)console.error(` \u2717 ${He.path}: ${He.message}`)}return 1}let he=await B2e(m),we=0;for(let He of he.errors)a||console.error(`\u2717 ${He.relPath}: ${He.message}`),we++;for(let{relPath:He,doc:at}of he.docs){let Ct=qnn(at,Y);if(Ct.length>0){if(!a){console.error(`\u2717 ${He}`);for(let Pe of Ct)console.error(` \u2717 ${Pe.path}: ${Pe.message}`)}we+=Ct.length}}if(we>0)return a&&v9({ok:!1,file:g,errors:[{path:"<seq>",message:`${we} sequence diagram error(s)`}]}),1;if(a)v9({ok:!0,file:g,nodes:k.value.nodes.length,edges:k.value.edges.length});else{let He=W.docs.reduce((wt,ze)=>wt+ze.doc.nodes.length,0),at=W.docs.reduce((wt,ze)=>wt+ze.doc.edges.length,0),Ct=W.docs.length,Pe=Ct>1?` (${Ct} files)`:"";console.log(`\u2713 ${g}${Pe} \u2014 ${He} nodes, ${at} edges`)}return 0}var kft=$i(s3(),1),Mft=$i(nge(),1),oan=$i(EQ(),1);import{mkdir as nan,readFile as ran,writeFile as ian}from"node:fs/promises";import qq from"node:path";var icn=$i(ecn(),1);function ete(o,a){return o.length*a}function zf(o,a,d){if(a<=0)return"";let g=Math.floor(a/d);return o.length<=g?o:g<=1?"\u2026":o.slice(0,g-1)+"\u2026"}var tte={nodeSpacing:60,layerSpacing:100,padding:40,viewMode:"detailed"};function wGn(o){let a=o.nodeSpacing??tte.nodeSpacing,d=o.layerSpacing??tte.layerSpacing,g=o.padding??tte.padding;return{"elk.algorithm":"layered","elk.direction":"RIGHT","elk.edgeRouting":"ORTHOGONAL","elk.layered.spacing.nodeNodeBetweenLayers":String(d),"elk.spacing.nodeNode":String(a),"elk.padding":`[top=${g}, left=${g}, bottom=${g}, right=${g}]`,"elk.hierarchyHandling":"INCLUDE_CHILDREN","elk.edgeLabels.placement":"CENTER","elk.spacing.edgeLabel":"8","elk.spacing.labelLabel":"6","elk.spacing.edgeNode":"20","elk.spacing.edgeEdge":"12","elk.layered.spacing.edgeEdgeBetweenLayers":"12"}}var xh={width:172,height:82},tcn={width:172,height:90},vGn={service:xh,function:xh,worker:xh,agent:xh,database:{width:184,height:100},cache:tcn,vectordb:xh,storage:xh,queue:{width:188,height:80},topic:xh,stream:xh,gateway:xh,cdn:xh,route:xh,interface:xh,adapter:xh,port:xh,llm:xh,prompt:xh,tool:xh,auth:xh,observability:xh,cloud:{width:200,height:120},frontend:tcn,page:xh,component:xh,store:xh,hook:xh,external:{width:184,height:100},module:{width:240,height:130},custom:{width:240,height:130}},fl={width:152,height:36},ncn={width:200,height:80},mGn={service:fl,function:fl,worker:fl,agent:fl,database:fl,cache:fl,vectordb:fl,storage:fl,queue:{width:168,height:36},topic:fl,stream:fl,gateway:fl,cdn:fl,route:fl,interface:fl,adapter:fl,port:fl,llm:fl,prompt:fl,tool:fl,auth:fl,observability:fl,cloud:fl,frontend:fl,page:fl,component:fl,store:fl,hook:fl,external:{width:168,height:40},module:ncn,custom:ncn},kGn=24,rcn=320;function MGn(o,a,d){if(o.kind==="module"||o.kind==="custom")return a;if(d==="compact"){let m=36+ete(o.name,5.9)+12;return Math.max(a,Math.min(rcn,Math.ceil(m)))}let g=ete(o.name,7.4),f=o.stack!==void 0?ete(o.stack,5.9):0,b=Math.max(g,f)+kGn;return Math.max(a,Math.min(rcn,Math.ceil(b)))}var xGn={top:48,left:18,bottom:18,right:18};function SGn(o,a,d,g){let f=d[o.kind],b={id:o.id,width:MGn(o,f.width,g),height:f.height};if(a.length>0){b.children=a;let k=g==="compact"?{top:30,left:12,bottom:12,right:12}:xGn;b.layoutOptions={"elk.padding":`[top=${k.top}, left=${k.left}, bottom=${k.bottom}, right=${k.right}]`}}return b}function _Gn(o,a,d){let g=new Map;for(let m of o.nodes)g.set(m.id,m);let f=new Map;for(let m of o.nodes){let P=f.get(m.parentId)??[];P.push(m),f.set(m.parentId,P)}function b(m){let P=(f.get(m.id)??[]).map(b);return SGn(m,P,a,d)}return{roots:(f.get(void 0)??[]).map(b),byId:g}}function CGn(o){return o.fromFile===void 0&&o.toFile===void 0}function IGn(o){return o.edges.filter(CGn).map(a=>{let d={id:a.id,sources:[a.from],targets:[a.to]};return a.label!==void 0&&a.label.length>0&&(d.labels=[{text:a.label,width:Math.ceil(ete(a.label,5.9)),height:14}]),d})}function Ew(o){return o??0}function ocn(o,a){let d=a.get(o.id);if(!d)throw new Error(`ELK returned unknown node id "${o.id}"`);let g=(o.children??[]).map(f=>ocn(f,a));return{...d,x:Ew(o.x),y:Ew(o.y),width:Ew(o.width),height:Ew(o.height),children:g}}function LGn(o,a){let d=new Map,g=new Map,f=(N,H,j,W)=>{let Y=H+Ew(N.x),ve=j+Ew(N.y);d.set(N.id,{x:Y,y:ve}),g.set(N.id,W);let he=[...W,N.id];for(let we of N.children??[])f(we,Y,ve,he)};f(o,0,0,[]);let b=(N,H)=>{let j=g.get(N)??[],W=g.get(H)??[],Y=0;for(;Y<j.length&&Y<W.length&&j[Y]===W[Y];)Y++;let ve=Y===0?o.id:j[Y-1];return d.get(ve)??{x:0,y:0}},k=new Map,m=new Map,P=N=>{for(let H of N.edges??[]){let j=H.sources?.[0]??"",W=H.targets?.[0]??"",Y=b(j,W),ve=He=>({x:Ew(He.x)+Y.x,y:Ew(He.y)+Y.y}),he=(H.sections??[]).map(He=>({startPoint:ve(He.startPoint),endPoint:ve(He.endPoint),bendPoints:(He.bendPoints??[]).map(ve)}));k.set(H.id,he);let we=(H.labels??[]).map(He=>({text:typeof He.text=="string"?He.text:"",x:Ew(He.x)+Y.x,y:Ew(He.y)+Y.y,width:Ew(He.width),height:Ew(He.height)}));m.set(H.id,we)}for(let H of N.children??[])P(H)};return P(o),a.edges.map(N=>({...N,sections:k.get(N.id)??[],labels:m.get(N.id)??[]}))}var TGn=new icn.default;async function EGn(o,a={}){if(o.nodes.length===0)return{document:o,width:0,height:0,roots:[],edges:[]};let d=a.viewMode==="compact"?"compact":"detailed",g=d==="compact"?mGn:vGn,{roots:f,byId:b}=_Gn(o,g,d),k={id:"__root__",layoutOptions:wGn(a),children:f,edges:IGn(o)},m=await TGn.layout(k),P=(m.children??[]).map(N=>ocn(N,b));return{document:o,width:Ew(m.width),height:Ew(m.height),roots:P,edges:LGn(m,o)}}var rge={name:"elk",layout:EGn};var iei={[rge.name]:rge},PGn=rge;function Bq(o,a){return PGn.layout(o,a)}var ige="seq-arrow-filled",oge="seq-arrow-open";function AGn(o){return Math.max(160,o.length*8+80)}function ccn(o,a,d,g,f){let b=d,k=[];for(let m of o)if(m.type==="message"){let P=a.get(m.from),N=a.get(m.to),H=P?.cx??g,j=N?.cx??g;k.push({type:"message",id:m.id,fromCx:H,toCx:j,y:b,label:m.label,arrow:m.arrow,activate:m.activate??!1,isSelf:m.from===m.to,...m.status!==void 0?{status:m.status}:{}}),b+=m.from===m.to?56*1.5:56}else if(m.type==="note"){let P=m.participants.map(Y=>a.get(Y)?.cx).filter(Y=>Y!==void 0).sort((Y,ve)=>Y-ve),N=P[0]??g,H=P[P.length-1]??f,j=Math.max(m.text.length*7.5+24,H-N+16,80),W=(N+H)/2-j/2;k.push({type:"note",id:m.id,x:W,y:b,width:j,height:48,text:m.text,...m.status!==void 0?{status:m.status}:{}}),b+=56}else if(m.type==="group"){let P=g-12,N=f-g+24,H=b;b+=24;let j=[];if(m.branches)for(let W=0;W<m.branches.length;W++){let Y=m.branches[W],ve=b,{items:he,endY:we}=ccn(Y.steps,a,b,g,f);b=we,j.push({...Y.label!==void 0?{label:Y.label}:{},startY:ve,...W<m.branches.length-1?{dividerY:b}:{},steps:he}),W<m.branches.length-1&&(b+=4)}b+=12,k.push({type:"group",id:m.id,kind:m.kind,...m.condition!==void 0?{condition:m.condition}:{},...m.label!==void 0?{label:m.label}:{},...m.seqFile!==void 0?{seqFile:m.seqFile}:{},x:P,y:H,width:N,height:b-H,branches:j,...m.status!==void 0?{status:m.status}:{}})}return{items:k,endY:b}}function acn(o){let a=new Map;for(let d of o)if(d.type==="message"&&d.arrow==="destroy"&&a.set(d.toCx,d.y+56+20),d.type==="group")for(let g of d.branches)for(let[f,b]of acn(g.steps))a.set(f,b);return a}function scn(o,a){let d=o.participants.map(he=>AGn(he.label??he.nodeId)),g=32,f=o.participants.map((he,we)=>{let He=d[we],at=g+He/2;g+=He;let Ct=a?.get(he.nodeId);return{id:he.id,nodeId:he.nodeId,label:he.label??he.nodeId,cx:at,colWidth:He,...Ct!==void 0?{kind:Ct}:{},lifelineEndY:0}}),b=g+32,k=new Map(f.map(he=>[he.id,he])),m=f[0]?.cx??32,P=f[f.length-1]?.cx??b-32,N=24,{items:H,endY:j}=ccn(o.steps,k,N,m,P),W=56+j+24,Y=acn(H);return{participants:f.map(he=>({...he,lifelineEndY:Y.get(he.cx)??W})),steps:H,totalWidth:b,totalHeight:W}}var Ni=$i(lft(),1);var p3=$i(ac(),1),bcn=(o,a,d)=>({width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:a,strokeWidth:d,strokeLinecap:"round",strokeLinejoin:"round"});function wcn({size:o=16,color:a="currentColor",strokeWidth:d=1.8}){return(0,p3.jsxs)("svg",{...bcn(o,a,d),"aria-hidden":"true",children:[(0,p3.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3.5",ry:"3.5"}),(0,p3.jsx)("line",{x1:"9",y1:"9",x2:"9",y2:"13"}),(0,p3.jsx)("line",{x1:"15",y1:"9",x2:"15",y2:"13"}),(0,p3.jsx)("circle",{cx:"12",cy:"16.5",r:"1",fill:a,stroke:"none"})]})}function vcn({size:o=16,color:a="currentColor",strokeWidth:d=1.8}){return(0,p3.jsxs)("svg",{...bcn(o,a,d),"aria-hidden":"true",children:[(0,p3.jsx)("path",{d:"M 7.5 6 L 3.5 12 L 7.5 18"}),(0,p3.jsx)("path",{d:"M 16.5 6 L 20.5 12 L 16.5 18"}),(0,p3.jsx)("circle",{cx:"13",cy:"8.6",r:"0.9",fill:a,stroke:"none"}),(0,p3.jsx)("line",{x1:"13",y1:"11",x2:"11",y2:"16.5"})]})}var Pw={service:{color:"#38bdf8",icon:Ni.Server,description:"Long-running compute that owns business logic."},function:{color:"#22d3ee",icon:Ni.FunctionSquare,description:"Stateless function-as-a-service / lambda."},worker:{color:"#06b6d4",icon:Ni.Cog,description:"Background job processor or consumer loop."},agent:{color:"#14b8a6",icon:Ni.Bot,description:"Autonomous AI agent driving tools and actions."},database:{color:"#34d399",icon:Ni.Database,description:"Persistent state \u2014 relational, document, key-value."},cache:{color:"#a78bfa",icon:Ni.Layers,description:"In-memory store for fast reads."},vectordb:{color:"#c084fc",icon:Ni.Sparkles,description:"Vector store for embeddings / similarity search."},storage:{color:"#84cc16",icon:Ni.HardDrive,description:"Object / blob storage (S3, GCS, etc.)."},queue:{color:"#fbbf24",icon:Ni.SendHorizontal,description:"Asynchronous work queue with at-least-once delivery."},topic:{color:"#f97316",icon:Ni.Radio,description:"Pub/sub topic with multiple consumers."},stream:{color:"#fb923c",icon:Ni.Waves,description:"Append-only event log (Kafka, Kinesis)."},gateway:{color:"#6366f1",icon:Ni.DoorOpen,description:"API gateway, ingress, edge router."},cdn:{color:"#0ea5e9",icon:Ni.Globe,description:"Content delivery network / static edge."},route:{color:"#f59e0b",icon:Ni.Route,description:"HTTP / URL route \u2014 path + method mapped to a handler."},interface:{color:"#d946ef",icon:vcn,description:"Abstract contract \u2014 the <i> a system commits to."},adapter:{color:"#c026d3",icon:Ni.Cable,description:"Concrete implementation of an interface."},port:{color:"#a21caf",icon:wcn,description:"Hexagonal-architecture port \u2014 the socket an adapter plugs into."},llm:{color:"#a855f7",icon:Ni.Brain,description:"Large language model service."},prompt:{color:"#c4b5fd",icon:Ni.MessageSquare,description:"Prompt template / instruction set."},tool:{color:"#fde047",icon:Ni.Wrench,description:"Tool callable by an agent or LLM."},auth:{color:"#ef4444",icon:Ni.Lock,description:"Identity provider, auth service."},observability:{color:"#10b981",icon:Ni.Eye,description:"Metrics, logs, traces \u2014 operational telemetry."},cloud:{color:"#0284c7",icon:Ni.Cloud,description:"Managed cloud service (compute, hosted, etc.)."},frontend:{color:"#f472b6",icon:Ni.Monitor,description:"User-facing surface \u2014 browser, mobile, CLI."},page:{color:"#fb7185",icon:Ni.LayoutTemplate,description:"Route-level UI screen mapped to a URL."},component:{color:"#8b5cf6",icon:Ni.Component,description:"Reusable UI component / view fragment."},store:{color:"#facc15",icon:Ni.Boxes,description:"Client-side state container \u2014 Redux, Zustand, Pinia."},hook:{color:"#0d9488",icon:Ni.Anchor,description:"Reusable client logic \u2014 React hook, Vue composable."},external:{color:"#94a3b8",icon:Ni.ExternalLink,description:"Third-party system you don't own."},module:{color:"#7dd3fc",icon:Ni.Package,description:"Module / component grouping (logical container)."},custom:{color:"#64748b",icon:Ni.Box,description:"Container or anything not in the taxonomy."}};var vz=$i(ac(),1),yOe=36,bOe=64;function mcn({participant:o,nodeKind:a}){let d=a?Pw[a]:void 0,g=d?.color??"var(--archik-fg-muted)",f=(56-yOe)/2,b=d?.icon,k=b?bOe+9:bOe;return(0,vz.jsxs)("g",{transform:`translate(${o.cx-bOe}, ${f})`,children:[(0,vz.jsx)("rect",{width:bOe*2,height:yOe,rx:8,fill:"var(--archik-node-fill)",stroke:g,strokeWidth:1.4}),b&&(0,vz.jsx)("g",{transform:`translate(10, ${(yOe-14)/2})`,children:(0,vz.jsx)(b,{size:14,color:g,strokeWidth:1.5})}),(0,vz.jsx)("text",{x:k,y:yOe/2+4,textAnchor:"middle",fontSize:12,fontWeight:500,fill:"var(--archik-fg)",fontFamily:"inherit",children:o.label})]})}var Mcn=$i(ac(),1);function kcn({participant:o}){return(0,Mcn.jsx)("line",{x1:o.cx,y1:56,x2:o.cx,y2:o.lifelineEndY,stroke:"var(--archik-node-stroke)",strokeWidth:1,strokeDasharray:"4 4",opacity:.5})}var g3=$i(ac(),1),dft=32,fft=20,fmr=-6,xcn=8,pmr=20;function Scn({msg:o}){let a=o.arrow==="return",d=o.arrow==="async",g=o.arrow==="create",f=a||g,b=o.arrow==="destroy",k=a||d?oge:ige,m=o.status==="proposed"?.5:o.status==="deprecated"?.35:1;if(o.isSelf){let j=o.fromCx,W=o.y,Y=`M ${j} ${W} L ${j+dft} ${W} L ${j+dft} ${W+fft} L ${j} ${W+fft}`;return(0,g3.jsxs)("g",{opacity:m,children:[(0,g3.jsx)("path",{d:Y,fill:"none",stroke:"var(--archik-edge-filled)",strokeWidth:1.4,markerEnd:`url(#${k})`}),(0,g3.jsx)("text",{x:j+dft+6,y:W+fft/2+4,fontSize:11,fill:"var(--archik-fg)",fontFamily:"inherit",children:o.label})]})}let N=o.fromCx<o.toCx?o.toCx-6:o.toCx+6,H=(o.fromCx+o.toCx)/2;return(0,g3.jsxs)("g",{opacity:m,children:[o.activate&&(0,g3.jsx)("rect",{x:o.toCx-xcn/2,y:o.y-2,width:xcn,height:pmr,fill:"var(--archik-node-fill)",stroke:"var(--archik-node-stroke)",strokeWidth:1,rx:2}),(0,g3.jsx)("line",{x1:o.fromCx,y1:o.y,x2:N,y2:o.y,stroke:"var(--archik-edge-filled)",strokeWidth:1.4,strokeDasharray:f?"4 4":void 0,markerEnd:b?void 0:`url(#${k})`}),(0,g3.jsxs)("text",{x:H,y:o.y+fmr,textAnchor:"middle",fontSize:11,fill:"var(--archik-fg)",fontFamily:"inherit",children:[g&&"\xABcreate\xBB ",o.label]}),o.arrow==="destroy"&&(0,g3.jsxs)("g",{transform:`translate(${o.toCx-6}, ${o.y-6})`,children:[(0,g3.jsx)("line",{x1:0,y1:0,x2:12,y2:12,stroke:"var(--archik-fg-muted)",strokeWidth:1.5}),(0,g3.jsx)("line",{x1:12,y1:0,x2:0,y2:12,stroke:"var(--archik-fg-muted)",strokeWidth:1.5})]})]})}var P9=$i(ac(),1),gmr={alt:"#6366f1",opt:"#0ea5e9",loop:"#10b981",par:"#f59e0b",break:"#ef4444",ref:"#8b5cf6"},_cn=36,pft=18;function Ccn({group:o,renderStep:a,onRefClick:d}){let g=gmr[o.kind]??"var(--archik-fg-muted)",f=o.status==="proposed"?.55:o.status==="deprecated"?.35:1,b=o.kind==="ref"&&o.seqFile!==void 0&&d!==void 0;return(0,P9.jsxs)("g",{opacity:f,onClick:b?()=>d(o.seqFile):void 0,style:b?{cursor:"pointer"}:void 0,children:[(0,P9.jsx)("rect",{x:o.x,y:o.y,width:o.width,height:o.height,rx:4,fill:"none",stroke:g,strokeWidth:1.2,opacity:.6}),(0,P9.jsx)("rect",{x:o.x,y:o.y,width:_cn,height:pft,rx:4,fill:g,opacity:.8}),(0,P9.jsx)("text",{x:o.x+6,y:o.y+pft-5,fontSize:10,fontWeight:600,fill:"#fff",fontFamily:"inherit",children:o.kind}),(o.condition??o.label)&&(0,P9.jsx)("text",{x:o.x+_cn+6,y:o.y+pft-5,fontSize:10,fill:g,fontFamily:"inherit",children:o.condition??o.label}),o.branches.map((k,m)=>(0,P9.jsxs)("g",{children:[k.label&&(0,P9.jsx)("text",{x:o.x+6,y:k.startY+12,fontSize:10,fill:g,fontFamily:"inherit",children:k.label}),k.steps.map(P=>a(P)),k.dividerY!==void 0&&(0,P9.jsx)("line",{x1:o.x,y1:k.dividerY,x2:o.x+o.width,y2:k.dividerY,stroke:g,strokeWidth:1,strokeDasharray:"4 2",opacity:.5})]},m))]})}var Hq=$i(ac(),1);function Icn({note:o}){let{x:a,y:d,width:g,height:f,text:b}=o,k=o.status==="proposed"?.55:o.status==="deprecated"?.35:1;return(0,Hq.jsxs)("g",{opacity:k,children:[(0,Hq.jsx)("path",{d:`M ${a} ${d} L ${a+g-10} ${d} L ${a+g} ${d+10} L ${a+g} ${d+f} L ${a} ${d+f} Z`,fill:"var(--archik-node-fill)",stroke:"var(--archik-node-stroke)",strokeWidth:1.2}),(0,Hq.jsx)("path",{d:`M ${a+g-10} ${d} L ${a+g-10} ${d+10} L ${a+g} ${d+10}`,fill:"none",stroke:"var(--archik-node-stroke)",strokeWidth:1.2}),(0,Hq.jsx)("text",{x:a+8,y:d+8+11,fontSize:11,fill:"var(--archik-fg)",fontFamily:"inherit",children:b})]})}var I2=$i(ac(),1);function ymr({id:o}){return(0,I2.jsx)("marker",{id:o,viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:(0,I2.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"context-stroke"})})}function bmr({id:o}){return(0,I2.jsx)("marker",{id:o,viewBox:"0 0 12 12",refX:"11",refY:"6",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:(0,I2.jsx)("path",{d:"M 1 1 L 11 6 L 1 11",fill:"none",stroke:"context-stroke",strokeWidth:"1.5",strokeLinejoin:"round"})})}function Lcn({step:o,onRefClick:a}){return o.type==="message"?(0,I2.jsx)(Scn,{msg:o}):o.type==="note"?(0,I2.jsx)(Icn,{note:o}):o.type==="group"?(0,I2.jsx)(Ccn,{group:o,...a!==void 0?{onRefClick:a}:{},renderStep:d=>(0,I2.jsx)(Lcn,{step:d,...a!==void 0?{onRefClick:a}:{}},d.id)}):null}function Tcn({laid:o,svgRef:a,onRefClick:d}){let{participants:g,steps:f,totalWidth:b,totalHeight:k}=o;return(0,I2.jsxs)("svg",{ref:a,width:b,height:k,viewBox:`0 0 ${b} ${k}`,xmlns:"http://www.w3.org/2000/svg",style:{fontFamily:"var(--archik-font, system-ui)"},children:[(0,I2.jsxs)("defs",{children:[(0,I2.jsx)(ymr,{id:ige}),(0,I2.jsx)(bmr,{id:oge})]}),g.map(m=>(0,I2.jsx)(kcn,{participant:m},m.id)),g.map(m=>(0,I2.jsx)(mcn,{participant:m,...m.kind!==void 0?{nodeKind:m.kind}:{}},m.id)),(0,I2.jsx)("g",{transform:`translate(0, ${56})`,children:f.map(m=>(0,I2.jsx)(Lcn,{step:m,...d!==void 0?{onRefClick:d}:{}},m.id))})]})}var vL=$i(ac(),1),jf=28;function $q({kind:o,iconAt:a,labelAt:d}){let g=Pw[o],f=g.icon,b=14;return(0,vL.jsxs)(vL.Fragment,{children:[(0,vL.jsx)("g",{transform:`translate(${a.cx-b/2}, ${a.cy-b/2})`,pointerEvents:"none","aria-hidden":"true",children:(0,vL.jsx)(f,{size:b,color:g.color,strokeWidth:1.8})}),(0,vL.jsx)("text",{x:d.cx,y:d.cy,textAnchor:"middle",fontSize:9.5,fontWeight:600,letterSpacing:"0.12em",fill:"var(--archik-node-caption)",children:o.toUpperCase()})]})}var mL=$i(ac(),1),wmr=24;function Ecn({node:o,selected:a}){let d=o.width,g=o.height,f=o.stack!==void 0,b=jf+(g-jf)/2,k=f?b-4:b+4,m=b+14,P=Math.max(0,d-wmr),N=zf(o.name,P,7.4),H=f?zf(o.stack,P,5.9):"";return(0,mL.jsxs)("g",{className:`archik-node archik-node--${o.kind}`,children:[(0,mL.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:d,height:g,rx:10,ry:10,fill:"var(--archik-node-fill)",stroke:a?"var(--archik-selected)":"var(--archik-node-stroke)",strokeWidth:a?1.8:1.4}),(0,mL.jsx)("line",{x1:0,y1:jf,x2:d,y2:jf,stroke:"var(--archik-node-stroke)",strokeOpacity:.25,strokeWidth:1}),(0,mL.jsx)($q,{kind:o.kind,iconAt:{cx:18,cy:jf/2},labelAt:{cx:d/2,cy:jf/2+3}}),(0,mL.jsx)("text",{x:d/2,y:k,textAnchor:"middle",fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:N}),f&&(0,mL.jsx)("text",{x:d/2,y:m,textAnchor:"middle",fontSize:11,fill:"var(--archik-node-text-dim)",children:H})]})}var kL=$i(ac(),1);function Pcn({node:o,selected:a}){let d=o.width,g=o.height,f=Math.min(g/2,28),b=o.stack!==void 0,k=jf+(g-jf)/2,m=b?k-4:k+4,P=k+14,N=Math.max(0,d-2*f-8),H=zf(o.name,N,7.4),j=b?zf(o.stack,N,5.9):"",W=a?"var(--archik-selected)":"var(--archik-node-stroke)";return(0,kL.jsxs)("g",{className:"archik-node archik-node--queue",children:[(0,kL.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:d,height:g,rx:f,ry:f,fill:"var(--archik-node-fill)",stroke:W,strokeWidth:a?1.8:1.4}),(0,kL.jsx)("line",{x1:f,y1:jf,x2:d-f,y2:jf,stroke:W,strokeOpacity:.25,strokeWidth:1}),(0,kL.jsx)($q,{kind:"queue",iconAt:{cx:f+8,cy:jf/2},labelAt:{cx:d/2,cy:jf/2+3}}),(0,kL.jsx)("text",{x:d/2,y:m,textAnchor:"middle",fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:H}),b&&(0,kL.jsx)("text",{x:d/2,y:P,textAnchor:"middle",fontSize:11,fill:"var(--archik-node-text-dim)",children:j})]})}var ML=$i(ac(),1),vmr=24;function Acn({node:o,selected:a}){let d=o.width,g=o.height,f=o.description!==void 0,b=jf,k=b+(g-b)/2,m=f?k-2:k+4,P=g-12,N=Math.max(0,d-vmr),H=zf(o.name,N,7.4),j=f?zf(o.description,N,5.9):"",W=a?"var(--archik-selected)":"var(--archik-node-stroke-soft)";return(0,ML.jsxs)("g",{className:"archik-node archik-node--external",children:[(0,ML.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:d,height:g,rx:8,ry:8,fill:"var(--archik-node-fill-tinted)",stroke:W,strokeWidth:a?1.8:1.2,strokeDasharray:a?void 0:"6 4"}),(0,ML.jsx)("line",{x1:6,y1:jf,x2:d-6,y2:jf,stroke:W,strokeOpacity:.25,strokeWidth:1}),(0,ML.jsx)($q,{kind:"external",iconAt:{cx:18,cy:jf/2},labelAt:{cx:d/2,cy:jf/2+3}}),(0,ML.jsx)("text",{x:d/2,y:m,textAnchor:"middle",fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:H}),f&&(0,ML.jsx)("text",{x:d/2,y:P,textAnchor:"middle",fontSize:10,fill:"var(--archik-node-text-dim)",children:j})]})}var G5=$i(ac(),1),mmr=28,kmr=10,Mmr=22;function Ncn({node:o,selected:a}){let d=o.width,g=o.height,f=d/2,b=kmr,k=Pw[o.kind],m=k.icon,P=a?"var(--archik-selected)":"var(--archik-node-stroke)",N=a?1.8:1.4,H=o.stack!==void 0,j=Math.max(0,d-mmr),W=zf(o.name,j,7.4),Y=H?zf(o.stack,j,5.9):"",ve=g,he=ve-Mmr,we=(he+ve)/2,Ct=(b+8+he)/2,Pe=H?Ct-4:Ct+4,wt=Ct+14;return(0,G5.jsxs)("g",{className:"archik-node archik-node--database",children:[(0,G5.jsx)("path",{className:a?"archik-selected-glow":void 0,d:Smr(d,g,b),fill:"var(--archik-node-fill)",stroke:P,strokeWidth:N,strokeLinejoin:"round"}),(0,G5.jsx)("ellipse",{cx:f,cy:b,rx:d/2,ry:b,fill:"var(--archik-node-fill)",stroke:P,strokeWidth:N}),(0,G5.jsx)("text",{x:f,y:Pe,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"var(--archik-node-text)",children:W}),H&&(0,G5.jsx)("text",{x:f,y:wt,textAnchor:"middle",fontSize:11,fill:"var(--archik-node-text-dim)",children:Y}),(0,G5.jsx)("line",{x1:4,y1:he,x2:d-4,y2:he,stroke:P,strokeOpacity:.45,strokeWidth:1}),(0,G5.jsx)("g",{transform:`translate(14, ${we-7})`,pointerEvents:"none","aria-hidden":"true",children:(0,G5.jsx)(m,{size:14,color:k.color,strokeWidth:1.9})}),(0,G5.jsx)("text",{x:f,y:we+4,textAnchor:"middle",fontSize:9.5,fontWeight:600,letterSpacing:"0.12em",fill:"var(--archik-node-caption)",children:o.kind.toUpperCase()})]})}var xmr=10;function Smr(o,a,d){let g=xmr;return[`M 0 ${d}`,`L 0 ${a-g}`,`A ${g} ${g} 0 0 0 ${g} ${a}`,`L ${o-g} ${a}`,`A ${g} ${g} 0 0 0 ${o} ${a-g}`,`L ${o} ${d}`,`A ${o/2} ${d} 0 0 0 0 ${d}`,"Z"].join(" ")}var Xx=$i(ac(),1),_mr=36,Rcn=18;function Ocn({node:o,selected:a}){let d=o.width,g=o.height,f=Pw[o.kind],b=f.icon,k=a?"var(--archik-selected)":"var(--archik-node-stroke)",m=a?1.8:1.4,P=o.stack!==void 0,N=Math.max(0,d-_mr),H=zf(o.name,N,7.4),j=P?zf(o.stack,N,5.9):"",W=d/2,Y=g*.55,ve=P?Y-4:Y+4,he=Y+14;return(0,Xx.jsxs)("g",{className:"archik-node archik-node--cloud",children:[(0,Xx.jsx)("path",{className:a?"archik-selected-glow":void 0,d:Cmr(d,g),fill:"var(--archik-node-fill)",stroke:k,strokeWidth:m,strokeLinejoin:"round"}),(0,Xx.jsx)("g",{transform:`translate(18, ${Rcn-6})`,pointerEvents:"none","aria-hidden":"true",children:(0,Xx.jsx)(b,{size:14,color:f.color,strokeWidth:1.9})}),(0,Xx.jsx)("text",{x:W,y:Rcn+4,textAnchor:"middle",fontSize:9.5,fontWeight:600,letterSpacing:"0.12em",fill:"var(--archik-node-caption)",children:o.kind.toUpperCase()}),(0,Xx.jsx)("text",{x:W,y:ve,textAnchor:"middle",fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:H}),P&&(0,Xx.jsx)("text",{x:W,y:he,textAnchor:"middle",fontSize:11,fill:"var(--archik-node-text-dim)",children:j})]})}function Cmr(o,a){let g=a-2,f=a*.62,b=Math.min(a*.18,14),k=o-4,m=a*.5,P=Math.min(k*.15,m*.85),N=Math.min(k*.18,m),H=Math.min(k*.15,m*.85),j=2*(P+N+H),W=Math.max(0,k-j)/4,Y=2,ve=o-2,he=Y+W,we=he+2*P,He=we+W,at=He+2*N,Ct=at+W,Pe=Ct+2*H;return[`M ${Y} ${g-b}`,`Q ${Y} ${g} ${Y+b} ${g}`,`L ${ve-b} ${g}`,`Q ${ve} ${g} ${ve} ${g-b}`,`L ${ve} ${f}`,`L ${Pe} ${f}`,`A ${H} ${H} 0 0 0 ${Ct} ${f}`,`L ${at} ${f}`,`A ${N} ${N} 0 0 0 ${He} ${f}`,`L ${we} ${f}`,`A ${P} ${P} 0 0 0 ${he} ${f}`,`L ${Y} ${f}`,"Z"].join(" ")}var Ky=$i(ac(),1),Uq=32,wOe=14,gft=14;function Dcn({node:o,selected:a,depth:d=0}){let g=o.width,f=o.height;if(!(o.children.length>0))return(0,Ky.jsx)(Lmr,{node:o,selected:!!a});let k=Pw[o.kind],m=k.icon,P=Math.min(.04+d*.06,.22),N=Math.min(.55+d*.12,.95),H=a?"var(--archik-selected)":"var(--archik-container-border)",j=a?1.8:1.2,W=Math.max(0,g-wOe*2-60),Y=zf(o.name,W,7.4);return(0,Ky.jsxs)("g",{className:`archik-node archik-node--${o.kind} archik-node--container`,children:[(0,Ky.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:g,height:f,rx:8,ry:8,fill:k.color,fillOpacity:P,stroke:H,strokeWidth:j,pointerEvents:"none"}),d>=1&&g>8&&f>8&&(0,Ky.jsx)("rect",{x:3,y:3,width:g-6,height:f-6,rx:6,ry:6,fill:"none",stroke:k.color,strokeOpacity:Math.min(.18+(d-1)*.06,.32),strokeWidth:1,pointerEvents:"none"}),(0,Ky.jsx)("path",{d:Imr(g,Uq,8),fill:k.color,fillOpacity:N*.18}),(0,Ky.jsx)("line",{x1:0,y1:Uq,x2:g,y2:Uq,stroke:H,strokeOpacity:.45,strokeWidth:1}),(0,Ky.jsx)("g",{transform:`translate(${wOe}, ${Uq/2-gft/2})`,pointerEvents:"none","aria-hidden":"true",children:(0,Ky.jsx)(m,{size:gft,color:k.color,strokeWidth:1.9})}),(0,Ky.jsx)("text",{x:wOe+gft+8,y:Uq/2+4,fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:Y}),(0,Ky.jsx)("text",{x:g-wOe,y:Uq/2+3,textAnchor:"end",fontSize:9.5,fontWeight:600,letterSpacing:"0.12em",fill:"var(--archik-node-caption)",children:o.kind.toUpperCase()})]})}function Imr(o,a,d){return`M ${d} 0 H ${o-d} A ${d} ${d} 0 0 1 ${o} ${d} V ${a} H 0 V ${d} A ${d} ${d} 0 0 1 ${d} 0 Z`}function Lmr({node:o,selected:a}){let d=o.width,g=o.height,f=Pw[o.kind],b=a?"var(--archik-selected)":"var(--archik-node-stroke-soft)";return(0,Ky.jsxs)("g",{className:`archik-node archik-node--${o.kind}`,children:[(0,Ky.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:d,height:g,rx:8,ry:8,fill:"var(--archik-node-fill-tinted)",stroke:b,strokeWidth:a?1.8:1.2,strokeDasharray:a?void 0:"5 4"}),(0,Ky.jsx)("text",{x:d/2,y:g/2+4,textAnchor:"middle",fontSize:12,fontWeight:600,fill:f.color,children:o.name})]})}var Yy=$i(ac(),1),rte=24,Fcn=10,yft=28;function zcn({node:o,selected:a,depth:d=0}){let g=o.width,f=o.height,b=Pw[o.kind],k=b.icon,m=o.kind==="external";if(o.children.length>0)return(0,Yy.jsx)(Tmr,{node:o,selected:!!a,depth:d});let P=a?"var(--archik-selected)":m?"var(--archik-node-stroke-soft)":"var(--archik-node-stroke)",N=m?"var(--archik-node-fill-tinted)":"var(--archik-node-fill)",H=o.kind==="queue"?Math.min(f/2,18):8;return(0,Yy.jsxs)("g",{className:`archik-node archik-node--${o.kind} archik-node--compact`,children:[(0,Yy.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:g,height:f,rx:H,ry:H,fill:N,stroke:P,strokeWidth:a?1.8:1.4,strokeDasharray:m&&!a?"5 4":void 0}),(0,Yy.jsx)("g",{transform:`translate(${Fcn}, ${f/2-7})`,pointerEvents:"none","aria-hidden":"true",children:(0,Yy.jsx)(k,{size:13,color:b.color,strokeWidth:1.9})}),(0,Yy.jsx)("text",{x:yft,y:f/2+4,fontSize:12,fontWeight:600,fill:"var(--archik-node-text)",children:zf(o.name,Math.max(0,g-yft-8),5.9)})]})}function Tmr({node:o,selected:a,depth:d}){let g=o.width,f=o.height,b=Pw[o.kind],k=b.icon,m=Math.min(.04+d*.035,.14),P=Math.min(.55+d*.08,.85),N=a?"var(--archik-selected)":"var(--archik-container-border)",H=Math.max(0,g-12-22),j=zf(o.name,H,5.9);return(0,Yy.jsxs)("g",{className:`archik-node archik-node--${o.kind} archik-node--compact archik-node--container`,children:[(0,Yy.jsx)("rect",{className:a?"archik-selected-glow":void 0,width:g,height:f,rx:6,ry:6,fill:b.color,fillOpacity:m,stroke:N,strokeWidth:a?1.8:1.2}),(0,Yy.jsx)("path",{d:Emr(g,rte,6),fill:b.color,fillOpacity:P*.18}),(0,Yy.jsx)("line",{x1:0,y1:rte,x2:g,y2:rte,stroke:N,strokeOpacity:.45,strokeWidth:1}),(0,Yy.jsx)("g",{transform:`translate(${Fcn}, ${rte/2-6})`,pointerEvents:"none","aria-hidden":"true",children:(0,Yy.jsx)(k,{size:12,color:b.color,strokeWidth:1.9})}),(0,Yy.jsx)("text",{x:yft,y:rte/2+4,fontSize:12,fontWeight:600,fill:"var(--archik-node-text)",children:j})]})}function Emr(o,a,d){return`M ${d} 0 H ${o-d} A ${d} ${d} 0 0 1 ${o} ${d} V ${a} H 0 V ${d} A ${d} ${d} 0 0 1 ${d} 0 Z`}var xL=$i(lft(),1),Ag=$i(ac(),1),Pmr=12,Amr=18;function jcn({Icon:o,cx:a,cy:d,size:g=Pmr,color:f,strokeWidth:b=1.8}){return(0,Ag.jsx)("g",{transform:`translate(${a-g/2}, ${d-g/2})`,pointerEvents:"none","aria-hidden":"true",children:(0,Ag.jsx)(o,{size:g,color:f??"var(--archik-fg-dim)",strokeWidth:b})})}function Bcn(o){return(0,Ag.jsx)(jcn,{Icon:xL.Info,...o})}function Hcn(o){return(0,Ag.jsx)(jcn,{Icon:xL.StickyNote,...o})}function $cn({cx:o,cy:a,filePath:d,fileLabel:g,onClick:f,size:b=13}){return(0,Ag.jsxs)("g",{transform:`translate(${o-b/2}, ${a-b/2})`,style:{cursor:f?"pointer":"default"},onClick:f,children:[(0,Ag.jsx)("title",{children:`Cross-file edge \u2192 ${g} (${d})`}),(0,Ag.jsx)("circle",{cx:b/2,cy:b/2,r:b/2+.5,fill:"var(--archik-fg-dim)",fillOpacity:.12,stroke:"var(--archik-fg-dim)",strokeOpacity:.4,strokeWidth:1}),(0,Ag.jsx)("g",{transform:"translate(1, 1)",pointerEvents:"none",children:(0,Ag.jsx)(xL.ArrowUpRight,{size:b-2,color:"var(--archik-fg-muted)",strokeWidth:2.2})})]})}function Ucn({cx:o,cy:a,onClick:d,size:g=14}){return(0,Ag.jsxs)("g",{transform:`translate(${o-g/2}, ${a-g/2})`,style:{cursor:d?"pointer":"default"},onClick:d,children:[(0,Ag.jsx)("title",{children:"Open sub-architecture"}),(0,Ag.jsx)("circle",{cx:g/2,cy:g/2,r:g/2+.5,fill:"var(--archik-accent)",fillOpacity:.16,stroke:"var(--archik-accent)",strokeOpacity:.45,strokeWidth:1}),(0,Ag.jsx)("g",{transform:"translate(1, 1)",pointerEvents:"none",children:(0,Ag.jsx)(xL.ChevronDown,{size:g-2,color:"var(--archik-accent)",strokeWidth:2.2})})]})}function qcn(o,a,d){switch(o){case"queue":{let f=Math.min(d/2,28);return{right:{x:a-f-4,y:14}}}case"database":return{right:{x:a-14,y:d-11}};default:return{right:{x:a-14,y:14}}}}function Gcn(o,a){return Array.from({length:a},(d,g)=>({x:o.x-g*Amr,y:o.y}))}var ad=$i(ac(),1);function Nmr({node:o,selected:a,viewMode:d,depth:g}){if(d==="compact")return(0,ad.jsx)(zcn,{node:o,selected:a,depth:g});if(o.children.length>0)return(0,ad.jsx)(Dcn,{node:o,selected:a,depth:g});switch(o.kind){case"queue":return(0,ad.jsx)(Pcn,{node:o,selected:a});case"external":return(0,ad.jsx)(Acn,{node:o,selected:a});case"database":return(0,ad.jsx)(Ncn,{node:o,selected:a});case"cloud":return(0,ad.jsx)(Ocn,{node:o,selected:a});case"module":case"custom":case"service":case"function":case"worker":case"agent":case"cache":case"vectordb":case"storage":case"topic":case"stream":case"gateway":case"cdn":case"route":case"interface":case"adapter":case"port":case"llm":case"prompt":case"tool":case"auth":case"observability":case"frontend":case"page":case"component":case"store":case"hook":return(0,ad.jsx)(Ecn,{node:o,selected:a});default:{let f=o.kind;throw new Error("unreachable node kind")}}}function bft({node:o,selectedNodeIds:a,glowNodeIds:d,onSelectNode:g,onOpenSubFile:f,onCrossFileNavigate:b,crossFileByNode:k,viewMode:m="detailed",depth:P=0}){let N=a?.has(o.id)??!1,H=d?.has(o.id)??!1,j=o.children.length>0,W=j?P+1:P,Y=g?he=>{he.stopPropagation(),g(o.id,he)}:void 0,ve=o.description!==void 0&&o.description.length>0;return(0,ad.jsxs)("g",{"data-archik-node-id":o.id,...N?{"data-archik-selected":"true"}:{},...o.status!==void 0&&o.status!=="active"?{"data-archik-status":o.status}:{},transform:`translate(${o.x}, ${o.y})`,...Y!==void 0?{onClick:Y}:{},style:g?{cursor:"pointer"}:void 0,children:[H&&(0,ad.jsx)("rect",{x:-4,y:-4,width:o.width+8,height:o.height+8,rx:10,fill:"none",stroke:"var(--archik-status-proposed)",strokeWidth:2,opacity:.85,style:{pointerEvents:"none"}}),(0,ad.jsx)(Nmr,{node:o,selected:N,viewMode:m,depth:P}),m==="detailed"&&!j&&(()=>{let he=o.notes!==void 0&&o.notes.length>0,we=o.archikFile!==void 0&&o.archikFile.length>0,He=k?.get(o.id),at=He?Array.from(He).sort():[],Ct=[];we&&Ct.push("subarch");for(let ze of at)Ct.push({type:"crossfile",path:ze});if(ve&&Ct.push("info"),he&&Ct.push("notes"),Ct.length===0)return null;let Pe=qcn(o.kind,o.width,o.height),wt=Gcn(Pe.right,Ct.length);return(0,ad.jsx)(ad.Fragment,{children:Ct.map((ze,Qn)=>{let nn=wt[Qn];if(typeof ze=="object"&&ze.type==="crossfile"){let fr=ze.path,wr=fr.split("/").pop().replace(/\.archik\.yaml$/,""),Rr=b??f,mn=Rr?bi=>{bi.stopPropagation(),Rr(fr,wr)}:void 0;return(0,ad.jsx)($cn,{cx:nn.x,cy:nn.y,filePath:fr,fileLabel:wr,...mn?{onClick:mn}:{}},`xf-${fr}`)}if(ze==="subarch"){let fr=o.archikFile,wr=f?Rr=>{Rr.stopPropagation(),f(fr,o.name)}:void 0;return(0,ad.jsx)(Ucn,{cx:nn.x,cy:nn.y,...wr?{onClick:wr}:{}},"subarch")}return ze==="info"?(0,ad.jsx)(Bcn,{cx:nn.x,cy:nn.y,color:"var(--archik-node-caption)"},"info"):(0,ad.jsxs)("g",{children:[(0,ad.jsx)(Hcn,{cx:nn.x,cy:nn.y,color:"var(--archik-node-caption)"}),o.notes&&o.notes.length>1&&(0,ad.jsx)("text",{x:nn.x+7,y:nn.y-5,fontSize:8,fontWeight:700,fill:"var(--archik-accent)",textAnchor:"middle",pointerEvents:"none",children:o.notes.length})]},"notes")})})})(),o.children.map(he=>(0,ad.jsx)(bft,{node:he,viewMode:m,depth:W,...a!==void 0?{selectedNodeIds:a}:{},...d!==void 0?{glowNodeIds:d}:{},...g!==void 0?{onSelectNode:g}:{},...f!==void 0?{onOpenSubFile:f}:{},...b!==void 0?{onCrossFileNavigate:b}:{},...k!==void 0?{crossFileByNode:k}:{}},he.id))]})}var kz=$i(ac(),1),Aw="archik-arrow-filled",mz="archik-arrow-open",wft="archik-arrow-selected",V5="var(--archik-edge-filled)",ite="var(--archik-edge-dim)",Rmr={http_call:{stroke:V5,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Aw},grpc:{stroke:V5,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Aw},invokes:{stroke:V5,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Aw},routes_to:{stroke:V5,strokeWidth:1.4,markerId:Aw},websocket:{stroke:V5,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Aw,markerStartId:Aw},webhook:{stroke:V5,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Aw},reads:{stroke:V5,strokeWidth:1.4,markerId:mz},writes:{stroke:V5,strokeWidth:1.4,markerId:Aw},publishes:{stroke:V5,strokeWidth:1.4,markerId:Aw},subscribes:{stroke:V5,strokeWidth:1.4,markerId:Aw},streams_to:{stroke:V5,strokeWidth:1.4,markerId:Aw},implements:{stroke:ite,strokeWidth:1.2,markerId:mz},extends:{stroke:ite,strokeWidth:1.2,markerId:mz},depends_on:{stroke:ite,strokeWidth:1.2,markerId:mz},has_a:{stroke:ite,strokeWidth:1.2,markerId:Aw},uses:{stroke:ite,strokeWidth:1.2,markerId:mz}};function Vcn(o){return o.map(a=>`${a.x},${a.y}`).join(" ")}function Omr(o){if(o.length===0)return;let a=Math.floor(o.length/2);if(o.length%2===1)return o[a];let d=o[a-1],g=o[a];return{x:(d.x+g.x)/2,y:(d.y+g.y)/2}}function Wcn({edge:o,selectedEdgeIds:a,onSelectEdge:d}){let g=o.sections[0];if(!g)return null;let f=[g.startPoint,...g.bendPoints,g.endPoint],b=Rmr[o.relationship],k=o.labels[0],m=k?{x:k.x+k.width/2,y:k.y+k.height/2}:Omr(f),P=a?.has(o.id)??!1,N=o.status==="proposed"?"var(--archik-status-proposed)":o.status==="deprecated"?"var(--archik-status-deprecated)":void 0,H=P?"var(--archik-selected)":N??o.color??b.stroke,j=P?b.strokeWidth+.5:b.strokeWidth,W=P?wft:b.markerId,Y=!P&&b.markerStartId!==void 0?b.markerStartId:void 0,ve=!P&&b.animated?"archik-edge-flowing":void 0,he=b.strokeDasharray!==void 0?b.strokeDasharray.trim().split(/\s+/).reduce((at,Ct)=>at+Number(Ct),0):0,we=ve!==void 0&&he>0?{"--archik-dash-period":String(he)}:void 0,He=d?at=>{at.stopPropagation(),d(o.id,at)}:void 0;return(0,kz.jsxs)("g",{"data-archik-edge-id":o.id,"data-archik-edge-relationship":o.relationship,...P?{"data-archik-selected":"true"}:{},...o.status!==void 0&&o.status!=="active"?{"data-archik-status":o.status}:{},className:`archik-edge archik-edge--${o.relationship}`,...He!==void 0?{onClick:He}:{},style:d?{cursor:"pointer"}:void 0,children:[d&&(0,kz.jsx)("polyline",{"data-archik-edge-hitarea":"",points:Vcn(f),fill:"none",stroke:"transparent",strokeWidth:14,strokeLinecap:"round",strokeLinejoin:"round"}),(0,kz.jsx)("polyline",{className:ve,points:Vcn(f),fill:"none",stroke:H,strokeWidth:j,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:`url(#${W})`,...Y!==void 0?{markerStart:`url(#${Y})`}:{},...b.strokeDasharray!==void 0?{strokeDasharray:b.strokeDasharray}:{},...we!==void 0?{style:we}:{}}),o.label!==void 0&&m!==void 0&&(0,kz.jsx)("g",{transform:`translate(${m.x}, ${k?m.y+4:m.y-6})`,children:(0,kz.jsx)("text",{textAnchor:"middle",fontSize:11,fontWeight:P?700:500,fill:P?"var(--archik-selected)":"var(--archik-fg-dim)",stroke:"var(--archik-panel)",strokeWidth:P?4:3,paintOrder:"stroke",children:o.label})})]})}var Qy=$i(ac(),1);var vft={added:"var(--archik-success)",removed:"var(--archik-danger)",changed:"var(--archik-warning)"};function Dmr(o){let a=[],d=(g,f,b)=>{for(let k of g){let m=f+k.x,P=b+k.y;a.push({...k,absX:m,absY:P}),k.children.length>0&&d(k.children,m,P)}};return d(o,0,0),a}function Fmr(o){return o.replace(/[^a-z0-9-]/g,a=>`\\${a}`)}function Xcn({statuses:o,scopeClass:a}){let d=[];for(let[f,b]of o.nodes)b==="removed"&&d.push(f);if(d.length===0)return null;let g=d.map(f=>`.${a} [data-archik-node-id="${Fmr(f)}"] { opacity: 0.35; }`).join(`
505
505
  `);return(0,Qy.jsx)("style",{children:g})}function Kcn({positioned:o,statuses:a}){return(0,Qy.jsx)("g",{className:"archik-diff-nodes",pointerEvents:"none",children:Dmr(o.roots).map(d=>{let g=a.nodes.get(d.id);return g===void 0||g==="unchanged"?null:(0,Qy.jsx)(zmr,{node:d,status:g},d.id)})})}function zmr({node:o,status:a}){let d=vft[a],g=o.absX+-3,f=o.absY+-3,b=o.width- -6,k=o.height- -6,m=a==="removed"?"5 4":void 0,P=Jcn(o.kind,g-1,f-1,b+2,k+2),N=Jcn(o.kind,g,f,b,k);return(0,Qy.jsxs)("g",{children:[(0,Qy.jsx)("path",{d:P,fill:"none",stroke:d,strokeOpacity:.25,strokeWidth:6,strokeLinejoin:"round"}),(0,Qy.jsx)("path",{d:N,fill:"none",stroke:d,strokeWidth:2.2,strokeLinejoin:"round",...m!==void 0?{strokeDasharray:m}:{},opacity:.95}),(0,Qy.jsx)(Hmr,{x:g+b-6,y:f-6,status:a})]})}function Jcn(o,a,d,g,f){switch(o){case"queue":{let b=Math.min(f/2,28);return Zcn(a,d,g,f,b)}case"database":return jmr(a,d,g,f,12);case"cloud":return Bmr(a,d,g,f);default:return Zcn(a,d,g,f,10)}}function Zcn(o,a,d,g,f){let b=Math.min(f,d/2),k=Math.min(f,g/2);return[`M ${o+b} ${a}`,`H ${o+d-b}`,`A ${b} ${k} 0 0 1 ${o+d} ${a+k}`,`V ${a+g-k}`,`A ${b} ${k} 0 0 1 ${o+d-b} ${a+g}`,`H ${o+b}`,`A ${b} ${k} 0 0 1 ${o} ${a+g-k}`,`V ${a+k}`,`A ${b} ${k} 0 0 1 ${o+b} ${a}`,"Z"].join(" ")}function jmr(o,a,d,g,f){return[`M ${o} ${a+f}`,`L ${o} ${a+g-10}`,`A 10 10 0 0 0 ${o+10} ${a+g}`,`L ${o+d-10} ${a+g}`,`A 10 10 0 0 0 ${o+d} ${a+g-10}`,`L ${o+d} ${a+f}`,`A ${d/2} ${f} 0 0 0 ${o} ${a+f}`,"Z"].join(" ")}function Bmr(o,a,d,g){let b=g-2,k=g*.62,m=Math.min(g*.18,14),P=d-4,N=g*.5,H=Math.min(P*.15,N*.85),j=Math.min(P*.18,N),W=Math.min(P*.15,N*.85),Y=2*(H+j+W),ve=Math.max(0,P-Y)/4,he=2,we=d-2,He=he+ve,at=He+2*H,Ct=at+ve,Pe=Ct+2*j,wt=Pe+ve,ze=wt+2*W;return[`M ${o+he} ${a+b-m}`,`Q ${o+he} ${a+b} ${o+he+m} ${a+b}`,`L ${o+we-m} ${a+b}`,`Q ${o+we} ${a+b} ${o+we} ${a+b-m}`,`L ${o+we} ${a+k}`,`L ${o+ze} ${a+k}`,`A ${W} ${W} 0 0 0 ${o+wt} ${a+k}`,`L ${o+Pe} ${a+k}`,`A ${j} ${j} 0 0 0 ${o+Ct} ${a+k}`,`L ${o+at} ${a+k}`,`A ${H} ${H} 0 0 0 ${o+He} ${a+k}`,`L ${o+he} ${a+k}`,"Z"].join(" ")}function Hmr({x:o,y:a,status:d}){let g=d==="added"?"+":d==="removed"?"\u2212":"~";return(0,Qy.jsxs)("g",{transform:`translate(${o}, ${a})`,children:[(0,Qy.jsx)("circle",{r:9,fill:vft[d],stroke:"var(--archik-canvas)",strokeWidth:1.5}),(0,Qy.jsx)("text",{textAnchor:"middle",y:4,fontSize:12,fontWeight:700,fill:"white",children:g})]})}function Ycn({positioned:o,statuses:a}){return(0,Qy.jsx)("g",{className:"archik-diff-edges",pointerEvents:"none",children:o.edges.map(d=>{let g=a.edges.get(d.id);return g===void 0||g==="unchanged"?null:(0,Qy.jsx)($mr,{edge:d,status:g},d.id)})})}function $mr({edge:o,status:a}){let d=o.sections[0];if(!d)return null;let g=[d.startPoint,...d.bendPoints,d.endPoint];return(0,Qy.jsx)("polyline",{points:g.map(f=>`${f.x},${f.y}`).join(" "),fill:"none",stroke:vft[a],strokeWidth:3,strokeOpacity:.55,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:a==="removed"?"8 4":void 0})}var nu=$i(ac(),1),vOe=24;function Umr({id:o}){return(0,nu.jsx)("marker",{id:o,viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:(0,nu.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"context-stroke"})})}function qmr({id:o}){return(0,nu.jsx)("marker",{id:o,viewBox:"0 0 12 12",refX:"11",refY:"6",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:(0,nu.jsx)("path",{d:"M 1 1 L 11 6 L 1 11",fill:"none",stroke:"context-stroke",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round"})})}function Gmr({id:o}){return(0,nu.jsx)("marker",{id:o,viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:(0,nu.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--archik-selected)"})})}function mft({positioned:o,viewMode:a="detailed",selectedNodeIds:d,selectedEdgeIds:g,glowNodeIds:f,onSelectNode:b,onSelectEdge:k,onOpenSubFile:m,onCrossFileNavigate:P}){let N=new Map;for(let H of o.edges){if(H.toFile!==void 0){let j=N.get(H.from)??new Set;j.add(H.toFile),N.set(H.from,j)}if(H.fromFile!==void 0){let j=N.get(H.to)??new Set;j.add(H.fromFile),N.set(H.to,j)}}return(0,nu.jsxs)(nu.Fragment,{children:[(0,nu.jsxs)("defs",{children:[(0,nu.jsx)(Umr,{id:Aw}),(0,nu.jsx)(qmr,{id:mz}),(0,nu.jsx)(Gmr,{id:wft})]}),(0,nu.jsx)("g",{className:"archik-edges",children:o.edges.map(H=>(0,nu.jsx)(Wcn,{edge:H,...g!==void 0?{selectedEdgeIds:g}:{},...k!==void 0?{onSelectEdge:k}:{}},H.id))}),(0,nu.jsx)("g",{className:"archik-nodes",children:o.roots.map(H=>(0,nu.jsx)(bft,{node:H,viewMode:a,crossFileByNode:N,...d!==void 0?{selectedNodeIds:d}:{},...f!==void 0?{glowNodeIds:f}:{},...b!==void 0?{onSelectNode:b}:{},...m!==void 0?{onOpenSubFile:m}:{},...P!==void 0?{onCrossFileNavigate:P}:{}},H.id))})]})}function Vmr(o,a){let d=(g,f,b)=>{for(let k of g){if(k.id===a)return{x:f+k.x+k.width/2,y:b+k.y+k.height/2};let m=d(k.children,f+k.x,b+k.y);if(m)return m}return null};return d(o.roots,0,0)}function Qcn({positioned:o,className:a,zoom:d=1,viewMode:g="detailed",svgRef:f,dragGhost:b,selectedNodeIds:k,selectedEdgeIds:m,glowNodeIds:P,onSelectNode:N,onSelectEdge:H,onSelectNothing:j,onOpenSubFile:W,onCrossFileNavigate:Y,diffStatuses:ve}){let he=Math.max(o.width,1),we=Math.max(o.height,1),He=-vOe,at=-vOe,Ct=he+vOe*2,Pe=we+vOe*2,wt=b?Vmr(o,b.fromId):null;return(0,nu.jsxs)("svg",{ref:f,className:a,xmlns:"http://www.w3.org/2000/svg",width:Ct*d,height:Pe*d,viewBox:`${He} ${at} ${Ct} ${Pe}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",flexShrink:0},onClick:j,children:[ve&&(0,nu.jsx)(Xcn,{statuses:ve,scopeClass:"archik-diff-base"}),(0,nu.jsx)("g",{className:ve?"archik-diff-base":void 0,children:(0,nu.jsx)(mft,{positioned:o,viewMode:g,...k!==void 0?{selectedNodeIds:k}:{},...m!==void 0?{selectedEdgeIds:m}:{},...P!==void 0?{glowNodeIds:P}:{},...N!==void 0?{onSelectNode:N}:{},...H!==void 0?{onSelectEdge:H}:{},...W!==void 0?{onOpenSubFile:W}:{},...Y!==void 0?{onCrossFileNavigate:Y}:{}})}),ve&&(0,nu.jsxs)(nu.Fragment,{children:[(0,nu.jsx)(Ycn,{positioned:o,statuses:ve}),(0,nu.jsx)(Kcn,{positioned:o,statuses:ve})]}),b&&wt&&(0,nu.jsxs)("g",{className:"archik-drag-ghost",pointerEvents:"none",children:[(0,nu.jsx)("line",{x1:wt.x,y1:wt.y,x2:b.pointerX,y2:b.pointerY,stroke:"var(--archik-selected)",strokeWidth:1.6,strokeDasharray:"6 4",strokeLinecap:"round",opacity:.85}),(0,nu.jsx)("circle",{cx:b.pointerX,cy:b.pointerY,r:4,fill:"var(--archik-selected)",opacity:.9})]})]})}var ean={"--archik-canvas":"#050912","--archik-panel":"#0c1426","--archik-surface":"#14203a","--archik-surface-hover":"#1c2c4d","--archik-fg":"#e6edf7","--archik-fg-dim":"#8b9bb8","--archik-fg-muted":"#5b6a87","--archik-border":"#1d2b48","--archik-border-strong":"#2c3e63","--archik-accent":"#22d3ee","--archik-accent-bright":"#67e8f9","--archik-magenta":"#f472b6","--archik-success":"#34d399","--archik-warning":"#fbbf24","--archik-danger":"#fb7185","--archik-node-fill":"#0c1426","--archik-node-fill-tinted":"#142037","--archik-node-fill-frame":"#14203a","--archik-node-stroke":"#2c3e63","--archik-node-stroke-soft":"#1d2b48","--archik-node-text":"#e6edf7","--archik-node-text-dim":"#b6c2d8","--archik-node-caption":"#67e8f9","--archik-node-chrome-dot":"#475878","--archik-edge-filled":"#cbd5e1","--archik-edge-open":"#94a3b8","--archik-edge-dim":"#64748b","--archik-edge-async":"#67e8f9","--archik-grid-minor":"#0d1830","--archik-grid-major":"#182748","--archik-selected":"#22d3ee","--archik-selected-glow":"rgba(34, 211, 238, 0.28)"},tan={"--archik-canvas":"#f8fafc","--archik-panel":"#ffffff","--archik-surface":"#f1f5f9","--archik-surface-hover":"#e2e8f0","--archik-fg":"#0f172a","--archik-fg-dim":"#475569","--archik-fg-muted":"#94a3b8","--archik-border":"#e2e8f0","--archik-border-strong":"#cbd5e1","--archik-accent":"#2563eb","--archik-accent-bright":"#3b82f6","--archik-magenta":"#db2777","--archik-success":"#10b981","--archik-warning":"#d97706","--archik-danger":"#e11d48","--archik-node-fill":"#ffffff","--archik-node-fill-tinted":"#f1f5f9","--archik-node-fill-frame":"#ffffff","--archik-node-stroke":"#0f172a","--archik-node-stroke-soft":"#475569","--archik-node-text":"#0f172a","--archik-node-text-dim":"#475569","--archik-node-caption":"#64748b","--archik-node-chrome-dot":"#cbd5f5","--archik-edge-filled":"#0f172a","--archik-edge-open":"#334155","--archik-edge-dim":"#64748b","--archik-edge-async":"#2563eb","--archik-grid-minor":"#e2e8f0","--archik-grid-major":"#cbd5e1","--archik-selected":"#2563eb","--archik-selected-glow":"rgba(37, 99, 235, 0.18)"};function ote(o,a="dark"){let d=a==="light"?tan:ean;return o.replace(/var\(--archik-([a-z0-9-]+)\)/g,(g,f)=>d[`--archik-${f}`]??g)}function cte(o,a="dark"){let g=(a==="light"?tan:ean)["--archik-canvas"]??"#050912",f=o.match(/<svg\b[^>]*viewBox="([^"]+)"/),[b,k,m,P]=(f?.[1]??"0 0 0 0").split(/\s+/),N=`<rect x="${b}" y="${k}" width="${m}" height="${P}" fill="${g}"/>`;return o.replace(/(<svg\b[^>]*>)/,`$1${N}`)}async function Wmr(o,a){let d=go(a,"out")??"sequence.svg",g=go(a,"theme")??"dark";if(g!=="dark"&&g!=="light")return console.error(`\u2717 --theme must be "dark" or "light" (got "${g}")`),1;let f=g,b;try{b=await ran(o,"utf-8")}catch{return console.error(`\u2717 Cannot read ${o}`),1}let k=oan.default.parse(b),m=hee.safeParse(k);if(!m.success)return console.error(`\u2717 ${o}: ${m.error.issues.map(we=>we.message).join("; ")}`),1;let P=qq.resolve(o),N=x2(P),H;try{let we=await mh(void 0,N),He=await um(we,N),at=new Map;for(let{doc:Ct}of He.docs)for(let Pe of Ct.nodes)at.set(Pe.id,Pe.kind);H=at}catch{}let j=scn(m.data,H),W=(0,Mft.renderToStaticMarkup)((0,kft.createElement)(Tcn,{laid:j})),ve=`<?xml version="1.0" encoding="UTF-8"?>
506
506
  ${cte(ote(W,f),f)}
507
507
  `,he=qq.resolve(d);return await nan(qq.dirname(he),{recursive:!0}),await ian(he,ve,"utf-8"),console.log(`\u2713 Rendered sequence "${m.data.name}" \u2192 ${d}`),0}async function ate(o){let a=go(o,"seq");if(a!==void 0)return Wmr(a,o);let d;try{d=await mh(o._[0])}catch(we){return console.error(`\u2717 ${we instanceof Error?we.message:String(we)}`),1}let g=qq.relative(process.cwd(),d)||d,f=go(o,"out")??"diagram.svg",b=go(o,"theme")??"dark";if(b!=="dark"&&b!=="light")return console.error(`\u2717 --theme must be "dark" or "light" (got "${b}")`),1;let k=b,m;try{m=await ran(d,"utf-8")}catch(we){return console.error(`\u2717 Cannot read ${g}`),console.error(we instanceof Error?we.message:String(we)),1}try{S2(m)}catch(we){return console.error(`\u2717 ${g}`),console.error(we instanceof Error?we.message:String(we)),1}let P=x2(d),N=await um(d,P);for(let we of N.errors)console.error(`warn: ${we.relPath}: ${we.message}`);let H={version:"1.0",name:"merged",nodes:N.docs.flatMap(we=>we.doc.nodes),edges:N.docs.flatMap(we=>we.doc.edges)},j=await Bq(H),W=(0,Mft.renderToStaticMarkup)((0,kft.createElement)(Qcn,{positioned:j})),ve=`<?xml version="1.0" encoding="UTF-8"?>