fern-api 4.32.1 → 4.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +9 -9
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -1456,8 +1456,8 @@ ${o}`;break;case"retry":Btc(o)&&(r[i]=o);break;case"id":Otc(o)&&(r[i]=o);break;c
|
|
|
1456
1456
|
|
|
1457
1457
|
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){o(s);continue}if(e.external){let c=e.external.registry.get(s[0])?.id;if(t!==s[0]&&c){o(s);continue}}if(e.metadataRegistry.get(s[0])?.id){o(s);continue}if(a.cycle){o(s);continue}if(a.count>1&&e.reused==="ref"){o(s);continue}}}function $le(e,t){let r=e.seen.get(t);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");let n=s=>{let a=e.seen.get(s);if(a.ref===null)return;let u=a.def??a.schema,c={...u},l=a.ref;if(a.ref=null,l){n(l);let d=e.seen.get(l),f=d.schema;if(f.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(f)):Object.assign(u,f),Object.assign(u,c),s._zod.parent===l)for(let h in u)h==="$ref"||h==="allOf"||h in c||delete u[h];if(f.$ref&&d.def)for(let h in u)h==="$ref"||h==="allOf"||h in d.def&&JSON.stringify(u[h])===JSON.stringify(d.def[h])&&delete u[h]}let p=s._zod.parent;if(p&&p!==l){n(p);let d=e.seen.get(p);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(let f in u)f==="$ref"||f==="allOf"||f in d.def&&JSON.stringify(u[f])===JSON.stringify(d.def[f])&&delete u[f]}e.override({zodSchema:s,jsonSchema:u,path:a.path??[]})};for(let s of[...e.seen.entries()].reverse())n(s[0]);let i={};if(e.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let s=e.external.registry.get(t)?.id;if(!s)throw new Error("Schema is missing an `id` property");i.$id=e.external.uri(s)}Object.assign(i,r.def??r.schema);let o=e.external?.defs??{};for(let s of e.seen.entries()){let a=s[1];a.def&&a.defId&&(o[a.defId]=a.def)}e.external||Object.keys(o).length>0&&(e.target==="draft-2020-12"?i.$defs=o:i.definitions=o);try{let s=JSON.parse(JSON.stringify(i));return Object.defineProperty(s,"~standard",{value:{...t["~standard"],jsonSchema:{input:z4e(t,"input",e.processors),output:z4e(t,"output",e.processors)}},enumerable:!1,writable:!1}),s}catch{throw new Error("Error converting schema to JSON.")}}function HO(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return HO(n.element,r);if(n.type==="set")return HO(n.valueType,r);if(n.type==="lazy")return HO(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return HO(n.innerType,r);if(n.type==="intersection")return HO(n.left,r)||HO(n.right,r);if(n.type==="record"||n.type==="map")return HO(n.keyType,r)||HO(n.valueType,r);if(n.type==="pipe")return HO(n.in,r)||HO(n.out,r);if(n.type==="object"){for(let i in n.shape)if(HO(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(let i of n.options)if(HO(i,r))return!0;return!1}if(n.type==="tuple"){for(let i of n.items)if(HO(i,r))return!0;return!!(n.rest&&HO(n.rest,r))}return!1}var n7n=(e,t={})=>r=>{let n=Gle({...r,processors:t});return cm(e,n),Wle(n,e),$le(n,e)},z4e=(e,t,r={})=>n=>{let{libraryOptions:i,target:o}=n??{},s=Gle({...i??{},target:o,io:t,processors:r});return cm(e,s),Wle(s,e),$le(s,e)};var GDc={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},i7n=(e,t,r,n)=>{let i=r;i.type="string";let{minimum:o,maximum:s,format:a,patterns:u,contentEncoding:c}=e._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),a&&(i.format=GDc[a]??a,i.format===""&&delete i.format,a==="time"&&delete i.format),c&&(i.contentEncoding=c),u&&u.size>0){let l=[...u];l.length===1?i.pattern=l[0].source:l.length>1&&(i.allOf=[...l.map(p=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:p.source}))])}},o7n=(e,t,r,n)=>{let i=r,{minimum:o,maximum:s,format:a,multipleOf:u,exclusiveMaximum:c,exclusiveMinimum:l}=e._zod.bag;typeof a=="string"&&a.includes("int")?i.type="integer":i.type="number",typeof l=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l),typeof o=="number"&&(i.minimum=o,typeof l=="number"&&t.target!=="draft-04"&&(l>=o?delete i.minimum:delete i.exclusiveMinimum)),typeof c=="number"&&(t.target==="draft-04"||t.target==="openapi-3.0"?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c),typeof s=="number"&&(i.maximum=s,typeof c=="number"&&t.target!=="draft-04"&&(c<=s?delete i.maximum:delete i.exclusiveMaximum)),typeof u=="number"&&(i.multipleOf=u)},s7n=(e,t,r,n)=>{r.type="boolean"},a7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("BigInt cannot be represented in JSON Schema")},u7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Symbols cannot be represented in JSON Schema")},c7n=(e,t,r,n)=>{t.target==="openapi-3.0"?(r.type="string",r.nullable=!0,r.enum=[null]):r.type="null"},l7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Undefined cannot be represented in JSON Schema")},p7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Void cannot be represented in JSON Schema")},f7n=(e,t,r,n)=>{r.not={}},d7n=(e,t,r,n)=>{},m7n=(e,t,r,n)=>{},h7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Date cannot be represented in JSON Schema")},g7n=(e,t,r,n)=>{let i=e._zod.def,o=Rdt(i.entries);o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o},A7n=(e,t,r,n)=>{let i=e._zod.def,o=[];for(let s of i.values)if(s===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){let s=o[0];r.type=s===null?"null":typeof s,t.target==="draft-04"||t.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o},y7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("NaN cannot be represented in JSON Schema")},b7n=(e,t,r,n)=>{let i=r,o=e._zod.pattern;if(!o)throw new Error("Pattern not found in template literal");i.type="string",i.pattern=o.source},E7n=(e,t,r,n)=>{let i=r,o={type:"string",format:"binary",contentEncoding:"binary"},{minimum:s,maximum:a,mime:u}=e._zod.bag;s!==void 0&&(o.minLength=s),a!==void 0&&(o.maxLength=a),u?u.length===1?(o.contentMediaType=u[0],Object.assign(i,o)):(Object.assign(i,o),i.anyOf=u.map(c=>({contentMediaType:c}))):Object.assign(i,o)},v7n=(e,t,r,n)=>{r.type="boolean"},I7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},w7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Function types cannot be represented in JSON Schema")},C7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},x7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Map cannot be represented in JSON Schema")},_7n=(e,t,r,n)=>{if(t.unrepresentable==="throw")throw new Error("Set cannot be represented in JSON Schema")},S7n=(e,t,r,n)=>{let i=r,o=e._zod.def,{minimum:s,maximum:a}=e._zod.bag;typeof s=="number"&&(i.minItems=s),typeof a=="number"&&(i.maxItems=a),i.type="array",i.items=cm(o.element,t,{...n,path:[...n.path,"items"]})},B7n=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object",i.properties={};let s=o.shape;for(let c in s)i.properties[c]=cm(s[c],t,{...n,path:[...n.path,"properties",c]});let a=new Set(Object.keys(s)),u=new Set([...a].filter(c=>{let l=o.shape[c]._zod;return t.io==="input"?l.optin===void 0:l.optout===void 0}));u.size>0&&(i.required=Array.from(u)),o.catchall?._zod.def.type==="never"?i.additionalProperties=!1:o.catchall?o.catchall&&(i.additionalProperties=cm(o.catchall,t,{...n,path:[...n.path,"additionalProperties"]})):t.io==="output"&&(i.additionalProperties=!1)},h9t=(e,t,r,n)=>{let i=e._zod.def,o=i.inclusive===!1,s=i.options.map((a,u)=>cm(a,t,{...n,path:[...n.path,o?"oneOf":"anyOf",u]}));o?r.oneOf=s:r.anyOf=s},O7n=(e,t,r,n)=>{let i=e._zod.def,o=cm(i.left,t,{...n,path:[...n.path,"allOf",0]}),s=cm(i.right,t,{...n,path:[...n.path,"allOf",1]}),a=c=>"allOf"in c&&Object.keys(c).length===1,u=[...a(o)?o.allOf:[o],...a(s)?s.allOf:[s]];r.allOf=u},P7n=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="array";let s=t.target==="draft-2020-12"?"prefixItems":"items",a=t.target==="draft-2020-12"||t.target==="openapi-3.0"?"items":"additionalItems",u=o.items.map((d,f)=>cm(d,t,{...n,path:[...n.path,s,f]})),c=o.rest?cm(o.rest,t,{...n,path:[...n.path,a,...t.target==="openapi-3.0"?[o.items.length]:[]]}):null;t.target==="draft-2020-12"?(i.prefixItems=u,c&&(i.items=c)):t.target==="openapi-3.0"?(i.items={anyOf:u},c&&i.items.anyOf.push(c),i.minItems=u.length,c||(i.maxItems=u.length)):(i.items=u,c&&(i.additionalItems=c));let{minimum:l,maximum:p}=e._zod.bag;typeof l=="number"&&(i.minItems=l),typeof p=="number"&&(i.maxItems=p)},T7n=(e,t,r,n)=>{let i=r,o=e._zod.def;i.type="object";let s=o.keyType,u=s._zod.bag?.patterns;if(o.mode==="loose"&&u&&u.size>0){let l=cm(o.valueType,t,{...n,path:[...n.path,"patternProperties","*"]});i.patternProperties={};for(let p of u)i.patternProperties[p.source]=l}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(i.propertyNames=cm(o.keyType,t,{...n,path:[...n.path,"propertyNames"]})),i.additionalProperties=cm(o.valueType,t,{...n,path:[...n.path,"additionalProperties"]});let c=s._zod.values;if(c){let l=[...c].filter(p=>typeof p=="string"||typeof p=="number");l.length>0&&(i.required=l)}},D7n=(e,t,r,n)=>{let i=e._zod.def,o=cm(i.innerType,t,n),s=t.seen.get(e);t.target==="openapi-3.0"?(s.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},R7n=(e,t,r,n)=>{let i=e._zod.def;cm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},F7n=(e,t,r,n)=>{let i=e._zod.def;cm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},k7n=(e,t,r,n)=>{let i=e._zod.def;cm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Q7n=(e,t,r,n)=>{let i=e._zod.def;cm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},N7n=(e,t,r,n)=>{let i=e._zod.def,o=t.io==="input"?i.in._zod.def.type==="transform"?i.out:i.in:i.out;cm(o,t,n);let s=t.seen.get(e);s.ref=o},j7n=(e,t,r,n)=>{let i=e._zod.def;cm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType,r.readOnly=!0},M7n=(e,t,r,n)=>{let i=e._zod.def;cm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},g9t=(e,t,r,n)=>{let i=e._zod.def;cm(i.innerType,t,n);let o=t.seen.get(e);o.ref=i.innerType},L7n=(e,t,r,n)=>{let i=e._zod.innerType;cm(i,t,n);let o=t.seen.get(e);o.ref=i},m9t={string:i7n,number:o7n,boolean:s7n,bigint:a7n,symbol:u7n,null:c7n,undefined:l7n,void:p7n,never:f7n,any:d7n,unknown:m7n,date:h7n,enum:g7n,literal:A7n,nan:y7n,template_literal:b7n,file:E7n,success:v7n,custom:I7n,function:w7n,transform:C7n,map:x7n,set:_7n,array:S7n,object:B7n,union:h9t,intersection:O7n,tuple:P7n,record:T7n,nullable:D7n,nonoptional:R7n,default:F7n,prefault:k7n,catch:Q7n,pipe:N7n,readonly:j7n,promise:M7n,optional:g9t,lazy:L7n};function A9t(e,t){if("_idmap"in e){let n=e,i=Gle({...t,processors:m9t}),o={};for(let u of n._idmap.entries()){let[c,l]=u;cm(l,i)}let s={},a={registry:n,uri:t?.uri,defs:o};i.external=a;for(let u of n._idmap.entries()){let[c,l]=u;Wle(i,l),s[c]=$le(i,l)}if(Object.keys(o).length>0){let u=i.target==="draft-2020-12"?"$defs":"definitions";s.__shared={[u]:o}}return{schemas:s}}let r=Gle({...t,processors:m9t});return cm(e,r),Wle(r,e),$le(r,e)}var y9t=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(t){this.ctx.counter=t}get seen(){return this.ctx.seen}constructor(t){let r=t?.target??"draft-2020-12";r==="draft-4"&&(r="draft-04"),r==="draft-7"&&(r="draft-07"),this.ctx=Gle({processors:m9t,target:r,...t?.metadata&&{metadata:t.metadata},...t?.unrepresentable&&{unrepresentable:t.unrepresentable},...t?.override&&{override:t.override},...t?.io&&{io:t.io}})}process(t,r={path:[],schemaPath:[]}){return cm(t,this.ctx,r)}emit(t,r){r&&(r.cycles&&(this.ctx.cycles=r.cycles),r.reused&&(this.ctx.reused=r.reused),r.external&&(this.ctx.external=r.external)),Wle(this.ctx,t);let n=$le(this.ctx,t),{"~standard":i,...o}=n;return o}};var f9o={};var Ydt={};Y(Ydt,{ZodAny:()=>lWn,ZodArray:()=>mWn,ZodBase64:()=>M9t,ZodBase64URL:()=>L9t,ZodBigInt:()=>K4e,ZodBigIntFormat:()=>V9t,ZodBoolean:()=>H4e,ZodCIDRv4:()=>N9t,ZodCIDRv6:()=>j9t,ZodCUID:()=>P9t,ZodCUID2:()=>T9t,ZodCatch:()=>QWn,ZodCodec:()=>Y9t,ZodCustom:()=>umt,ZodCustomStringFormat:()=>W4e,ZodDate:()=>nmt,ZodDefault:()=>PWn,ZodDiscriminatedUnion:()=>gWn,ZodE164:()=>U9t,ZodEmail:()=>S9t,ZodEmoji:()=>B9t,ZodEnum:()=>q4e,ZodExactOptional:()=>SWn,ZodFile:()=>xWn,ZodFunction:()=>GWn,ZodGUID:()=>Xdt,ZodIPv4:()=>k9t,ZodIPv6:()=>Q9t,ZodIntersection:()=>AWn,ZodJWT:()=>z9t,ZodKSUID:()=>F9t,ZodLazy:()=>zWn,ZodLiteral:()=>CWn,ZodMAC:()=>nWn,ZodMap:()=>IWn,ZodNaN:()=>jWn,ZodNanoID:()=>O9t,ZodNever:()=>fWn,ZodNonOptional:()=>K9t,ZodNull:()=>uWn,ZodNullable:()=>OWn,ZodNumber:()=>$4e,ZodNumberFormat:()=>e_e,ZodObject:()=>omt,ZodOptional:()=>H9t,ZodPipe:()=>J9t,ZodPrefault:()=>DWn,ZodPromise:()=>qWn,ZodReadonly:()=>MWn,ZodRecord:()=>amt,ZodSet:()=>wWn,ZodString:()=>G4e,ZodStringFormat:()=>Ih,ZodSuccess:()=>kWn,ZodSymbol:()=>sWn,ZodTemplateLiteral:()=>UWn,ZodTransform:()=>_Wn,ZodTuple:()=>bWn,ZodType:()=>dl,ZodULID:()=>D9t,ZodURL:()=>rmt,ZodUUID:()=>M9,ZodUndefined:()=>aWn,ZodUnion:()=>smt,ZodUnknown:()=>pWn,ZodVoid:()=>dWn,ZodXID:()=>R9t,ZodXor:()=>hWn,_ZodString:()=>_9t,_default:()=>TWn,_function:()=>bGo,any:()=>Y9o,array:()=>imt,base64:()=>F9o,base64url:()=>k9o,bigint:()=>W9o,boolean:()=>oWn,catch:()=>NWn,check:()=>EGo,cidrv4:()=>D9o,cidrv6:()=>R9o,codec:()=>gGo,cuid:()=>C9o,cuid2:()=>x9o,custom:()=>vGo,date:()=>Z9o,describe:()=>IGo,discriminatedUnion:()=>oGo,e164:()=>Q9o,email:()=>m9o,emoji:()=>I9o,enum:()=>W9t,exactOptional:()=>BWn,file:()=>fGo,float32:()=>z9o,float64:()=>V9o,function:()=>bGo,guid:()=>h9o,hash:()=>U9o,hex:()=>L9o,hostname:()=>M9o,httpUrl:()=>v9o,instanceof:()=>CGo,int:()=>x9t,int32:()=>q9o,int64:()=>$9o,intersection:()=>yWn,ipv4:()=>O9o,ipv6:()=>T9o,json:()=>_Go,jwt:()=>N9o,keyof:()=>eGo,ksuid:()=>B9o,lazy:()=>VWn,literal:()=>pGo,looseObject:()=>nGo,looseRecord:()=>aGo,mac:()=>P9o,map:()=>uGo,meta:()=>wGo,nan:()=>hGo,nanoid:()=>w9o,nativeEnum:()=>lGo,never:()=>q9t,nonoptional:()=>FWn,null:()=>cWn,nullable:()=>emt,nullish:()=>dGo,number:()=>iWn,object:()=>tGo,optional:()=>Zdt,partialRecord:()=>sGo,pipe:()=>tmt,prefault:()=>RWn,preprocess:()=>SGo,promise:()=>yGo,readonly:()=>LWn,record:()=>vWn,refine:()=>WWn,set:()=>cGo,strictObject:()=>rGo,string:()=>C9t,stringFormat:()=>j9o,stringbool:()=>xGo,success:()=>mGo,superRefine:()=>$Wn,symbol:()=>K9o,templateLiteral:()=>AGo,transform:()=>$9t,tuple:()=>EWn,uint32:()=>G9o,uint64:()=>H9o,ulid:()=>_9o,undefined:()=>J9o,union:()=>G9t,unknown:()=>Zxe,url:()=>E9o,uuid:()=>g9o,uuidv4:()=>A9o,uuidv6:()=>y9o,uuidv7:()=>b9o,void:()=>X9o,xid:()=>S9o,xor:()=>iGo});var b9t={};Y(b9t,{endsWith:()=>F4e,gt:()=>N9,gte:()=>$O,includes:()=>D4e,length:()=>Xxe,lowercase:()=>P4e,lt:()=>Q9,lte:()=>X2,maxLength:()=>Yxe,maxSize:()=>qle,mime:()=>k4e,minLength:()=>Wre,minSize:()=>j9,multipleOf:()=>Vle,negative:()=>l9t,nonnegative:()=>f9t,nonpositive:()=>p9t,normalize:()=>Q4e,overwrite:()=>K5,positive:()=>c9t,property:()=>d9t,regex:()=>O4e,size:()=>Jxe,slugify:()=>L4e,startsWith:()=>R4e,toLowerCase:()=>j4e,toUpperCase:()=>M4e,trim:()=>N4e,uppercase:()=>T4e});var V4e={};Y(V4e,{ZodISODate:()=>v9t,ZodISODateTime:()=>E9t,ZodISODuration:()=>w9t,ZodISOTime:()=>I9t,date:()=>z7n,datetime:()=>U7n,duration:()=>q7n,time:()=>V7n});var E9t=nr("ZodISODateTime",(e,t)=>{y9n.init(e,t),Ih.init(e,t)});function U7n(e){return IGn(E9t,e)}var v9t=nr("ZodISODate",(e,t)=>{b9n.init(e,t),Ih.init(e,t)});function z7n(e){return wGn(v9t,e)}var I9t=nr("ZodISOTime",(e,t)=>{E9n.init(e,t),Ih.init(e,t)});function V7n(e){return CGn(I9t,e)}var w9t=nr("ZodISODuration",(e,t)=>{v9n.init(e,t),Ih.init(e,t)});function q7n(e){return xGn(w9t,e)}var d9o=(e,t)=>{jdt.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>Ldt(e,r)},flatten:{value:r=>Mdt(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,E4e,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,E4e,2)}},isEmpty:{get(){return e.issues.length===0}}})},$Dc=nr("ZodError",d9o),VD=nr("ZodError",d9o,{Parent:Error});var G7n=w4e(VD),W7n=C4e(VD),$7n=x4e(VD),H7n=_4e(VD),K7n=Aqt(VD),J7n=yqt(VD),Y7n=bqt(VD),X7n=Eqt(VD),Z7n=vqt(VD),eWn=Iqt(VD),tWn=wqt(VD),rWn=Cqt(VD);var dl=nr("ZodType",(e,t)=>(rc.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:z4e(e,"input"),output:z4e(e,"output")}}),e.toJSONSchema=n7n(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(oi.mergeDefs(t,{checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]}),{parent:!0}),e.with=e.check,e.clone=(r,n)=>WO(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.parse=(r,n)=>G7n(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>$7n(e,r,n),e.parseAsync=async(r,n)=>W7n(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>H7n(e,r,n),e.spa=e.safeParseAsync,e.encode=(r,n)=>K7n(e,r,n),e.decode=(r,n)=>J7n(e,r,n),e.encodeAsync=async(r,n)=>Y7n(e,r,n),e.decodeAsync=async(r,n)=>X7n(e,r,n),e.safeEncode=(r,n)=>Z7n(e,r,n),e.safeDecode=(r,n)=>eWn(e,r,n),e.safeEncodeAsync=async(r,n)=>tWn(e,r,n),e.safeDecodeAsync=async(r,n)=>rWn(e,r,n),e.refine=(r,n)=>e.check(WWn(r,n)),e.superRefine=r=>e.check($Wn(r)),e.overwrite=r=>e.check(K5(r)),e.optional=()=>Zdt(e),e.exactOptional=()=>BWn(e),e.nullable=()=>emt(e),e.nullish=()=>Zdt(emt(e)),e.nonoptional=r=>FWn(e,r),e.array=()=>imt(e),e.or=r=>G9t([e,r]),e.and=r=>yWn(e,r),e.transform=r=>tmt(e,$9t(r)),e.default=r=>TWn(e,r),e.prefault=r=>RWn(e,r),e.catch=r=>NWn(e,r),e.pipe=r=>tmt(e,r),e.readonly=()=>LWn(e),e.describe=r=>{let n=e.clone();return s_.add(n,{description:r}),n},Object.defineProperty(e,"description",{get(){return s_.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return s_.get(e);let n=e.clone();return s_.add(n,r[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),_9t=nr("_ZodString",(e,t)=>{Kxe.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(n,i,o)=>i7n(e,n,i,o);let r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...n)=>e.check(O4e(...n)),e.includes=(...n)=>e.check(D4e(...n)),e.startsWith=(...n)=>e.check(R4e(...n)),e.endsWith=(...n)=>e.check(F4e(...n)),e.min=(...n)=>e.check(Wre(...n)),e.max=(...n)=>e.check(Yxe(...n)),e.length=(...n)=>e.check(Xxe(...n)),e.nonempty=(...n)=>e.check(Wre(1,...n)),e.lowercase=n=>e.check(P4e(n)),e.uppercase=n=>e.check(T4e(n)),e.trim=()=>e.check(N4e()),e.normalize=(...n)=>e.check(Q4e(...n)),e.toLowerCase=()=>e.check(j4e()),e.toUpperCase=()=>e.check(M4e()),e.slugify=()=>e.check(L4e())}),G4e=nr("ZodString",(e,t)=>{Kxe.init(e,t),_9t.init(e,t),e.email=r=>e.check(Vqt(S9t,r)),e.url=r=>e.check(Jdt(rmt,r)),e.jwt=r=>e.check(u9t(z9t,r)),e.emoji=r=>e.check(Hqt(B9t,r)),e.guid=r=>e.check(Kdt(Xdt,r)),e.uuid=r=>e.check(qqt(M9,r)),e.uuidv4=r=>e.check(Gqt(M9,r)),e.uuidv6=r=>e.check(Wqt(M9,r)),e.uuidv7=r=>e.check($qt(M9,r)),e.nanoid=r=>e.check(Kqt(O9t,r)),e.guid=r=>e.check(Kdt(Xdt,r)),e.cuid=r=>e.check(Jqt(P9t,r)),e.cuid2=r=>e.check(Yqt(T9t,r)),e.ulid=r=>e.check(Xqt(D9t,r)),e.base64=r=>e.check(o9t(M9t,r)),e.base64url=r=>e.check(s9t(L9t,r)),e.xid=r=>e.check(Zqt(R9t,r)),e.ksuid=r=>e.check(e9t(F9t,r)),e.ipv4=r=>e.check(t9t(k9t,r)),e.ipv6=r=>e.check(r9t(Q9t,r)),e.cidrv4=r=>e.check(n9t(N9t,r)),e.cidrv6=r=>e.check(i9t(j9t,r)),e.e164=r=>e.check(a9t(U9t,r)),e.datetime=r=>e.check(U7n(r)),e.date=r=>e.check(z7n(r)),e.time=r=>e.check(V7n(r)),e.duration=r=>e.check(q7n(r))});function C9t(e){return yGn(G4e,e)}var Ih=nr("ZodStringFormat",(e,t)=>{vh.init(e,t),_9t.init(e,t)}),S9t=nr("ZodEmail",(e,t)=>{c9n.init(e,t),Ih.init(e,t)});function m9o(e){return Vqt(S9t,e)}var Xdt=nr("ZodGUID",(e,t)=>{a9n.init(e,t),Ih.init(e,t)});function h9o(e){return Kdt(Xdt,e)}var M9=nr("ZodUUID",(e,t)=>{u9n.init(e,t),Ih.init(e,t)});function g9o(e){return qqt(M9,e)}function A9o(e){return Gqt(M9,e)}function y9o(e){return Wqt(M9,e)}function b9o(e){return $qt(M9,e)}var rmt=nr("ZodURL",(e,t)=>{l9n.init(e,t),Ih.init(e,t)});function E9o(e){return Jdt(rmt,e)}function v9o(e){return Jdt(rmt,{protocol:/^https?$/,hostname:Hj.domain,...oi.normalizeParams(e)})}var B9t=nr("ZodEmoji",(e,t)=>{p9n.init(e,t),Ih.init(e,t)});function I9o(e){return Hqt(B9t,e)}var O9t=nr("ZodNanoID",(e,t)=>{f9n.init(e,t),Ih.init(e,t)});function w9o(e){return Kqt(O9t,e)}var P9t=nr("ZodCUID",(e,t)=>{d9n.init(e,t),Ih.init(e,t)});function C9o(e){return Jqt(P9t,e)}var T9t=nr("ZodCUID2",(e,t)=>{m9n.init(e,t),Ih.init(e,t)});function x9o(e){return Yqt(T9t,e)}var D9t=nr("ZodULID",(e,t)=>{h9n.init(e,t),Ih.init(e,t)});function _9o(e){return Xqt(D9t,e)}var R9t=nr("ZodXID",(e,t)=>{g9n.init(e,t),Ih.init(e,t)});function S9o(e){return Zqt(R9t,e)}var F9t=nr("ZodKSUID",(e,t)=>{A9n.init(e,t),Ih.init(e,t)});function B9o(e){return e9t(F9t,e)}var k9t=nr("ZodIPv4",(e,t)=>{I9n.init(e,t),Ih.init(e,t)});function O9o(e){return t9t(k9t,e)}var nWn=nr("ZodMAC",(e,t)=>{C9n.init(e,t),Ih.init(e,t)});function P9o(e){return EGn(nWn,e)}var Q9t=nr("ZodIPv6",(e,t)=>{w9n.init(e,t),Ih.init(e,t)});function T9o(e){return r9t(Q9t,e)}var N9t=nr("ZodCIDRv4",(e,t)=>{x9n.init(e,t),Ih.init(e,t)});function D9o(e){return n9t(N9t,e)}var j9t=nr("ZodCIDRv6",(e,t)=>{_9n.init(e,t),Ih.init(e,t)});function R9o(e){return i9t(j9t,e)}var M9t=nr("ZodBase64",(e,t)=>{B9n.init(e,t),Ih.init(e,t)});function F9o(e){return o9t(M9t,e)}var L9t=nr("ZodBase64URL",(e,t)=>{O9n.init(e,t),Ih.init(e,t)});function k9o(e){return s9t(L9t,e)}var U9t=nr("ZodE164",(e,t)=>{P9n.init(e,t),Ih.init(e,t)});function Q9o(e){return a9t(U9t,e)}var z9t=nr("ZodJWT",(e,t)=>{T9n.init(e,t),Ih.init(e,t)});function N9o(e){return u9t(z9t,e)}var W4e=nr("ZodCustomStringFormat",(e,t)=>{D9n.init(e,t),Ih.init(e,t)});function j9o(e,t,r={}){return U4e(W4e,e,t,r)}function M9o(e){return U4e(W4e,"hostname",Hj.hostname,e)}function L9o(e){return U4e(W4e,"hex",Hj.hex,e)}function U9o(e,t){let r=t?.enc??"hex",n=`${e}_${r}`,i=Hj[n];if(!i)throw new Error(`Unrecognized hash format: ${n}`);return U4e(W4e,n,i,t)}var $4e=nr("ZodNumber",(e,t)=>{Fqt.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(n,i,o)=>o7n(e,n,i,o),e.gt=(n,i)=>e.check(N9(n,i)),e.gte=(n,i)=>e.check($O(n,i)),e.min=(n,i)=>e.check($O(n,i)),e.lt=(n,i)=>e.check(Q9(n,i)),e.lte=(n,i)=>e.check(X2(n,i)),e.max=(n,i)=>e.check(X2(n,i)),e.int=n=>e.check(x9t(n)),e.safe=n=>e.check(x9t(n)),e.positive=n=>e.check(N9(0,n)),e.nonnegative=n=>e.check($O(0,n)),e.negative=n=>e.check(Q9(0,n)),e.nonpositive=n=>e.check(X2(0,n)),e.multipleOf=(n,i)=>e.check(Vle(n,i)),e.step=(n,i)=>e.check(Vle(n,i)),e.finite=()=>e;let r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function iWn(e){return _Gn($4e,e)}var e_e=nr("ZodNumberFormat",(e,t)=>{R9n.init(e,t),$4e.init(e,t)});function x9t(e){return BGn(e_e,e)}function z9o(e){return OGn(e_e,e)}function V9o(e){return PGn(e_e,e)}function q9o(e){return TGn(e_e,e)}function G9o(e){return DGn(e_e,e)}var H4e=nr("ZodBoolean",(e,t)=>{qdt.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>s7n(e,r,n,i)});function oWn(e){return RGn(H4e,e)}var K4e=nr("ZodBigInt",(e,t)=>{kqt.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(n,i,o)=>a7n(e,n,i,o),e.gte=(n,i)=>e.check($O(n,i)),e.min=(n,i)=>e.check($O(n,i)),e.gt=(n,i)=>e.check(N9(n,i)),e.gte=(n,i)=>e.check($O(n,i)),e.min=(n,i)=>e.check($O(n,i)),e.lt=(n,i)=>e.check(Q9(n,i)),e.lte=(n,i)=>e.check(X2(n,i)),e.max=(n,i)=>e.check(X2(n,i)),e.positive=n=>e.check(N9(BigInt(0),n)),e.negative=n=>e.check(Q9(BigInt(0),n)),e.nonpositive=n=>e.check(X2(BigInt(0),n)),e.nonnegative=n=>e.check($O(BigInt(0),n)),e.multipleOf=(n,i)=>e.check(Vle(n,i));let r=e._zod.bag;e.minValue=r.minimum??null,e.maxValue=r.maximum??null,e.format=r.format??null});function W9o(e){return kGn(K4e,e)}var V9t=nr("ZodBigIntFormat",(e,t)=>{F9n.init(e,t),K4e.init(e,t)});function $9o(e){return NGn(V9t,e)}function H9o(e){return jGn(V9t,e)}var sWn=nr("ZodSymbol",(e,t)=>{k9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>u7n(e,r,n,i)});function K9o(e){return MGn(sWn,e)}var aWn=nr("ZodUndefined",(e,t)=>{Q9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>l7n(e,r,n,i)});function J9o(e){return LGn(aWn,e)}var uWn=nr("ZodNull",(e,t)=>{N9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>c7n(e,r,n,i)});function cWn(e){return UGn(uWn,e)}var lWn=nr("ZodAny",(e,t)=>{j9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>d7n(e,r,n,i)});function Y9o(){return zGn(lWn)}var pWn=nr("ZodUnknown",(e,t)=>{M9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>m7n(e,r,n,i)});function Zxe(){return VGn(pWn)}var fWn=nr("ZodNever",(e,t)=>{L9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>f7n(e,r,n,i)});function q9t(e){return qGn(fWn,e)}var dWn=nr("ZodVoid",(e,t)=>{U9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>p7n(e,r,n,i)});function X9o(e){return GGn(dWn,e)}var nmt=nr("ZodDate",(e,t)=>{z9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(n,i,o)=>h7n(e,n,i,o),e.min=(n,i)=>e.check($O(n,i)),e.max=(n,i)=>e.check(X2(n,i));let r=e._zod.bag;e.minDate=r.minimum?new Date(r.minimum):null,e.maxDate=r.maximum?new Date(r.maximum):null});function Z9o(e){return WGn(nmt,e)}var mWn=nr("ZodArray",(e,t)=>{V9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>S7n(e,r,n,i),e.element=t.element,e.min=(r,n)=>e.check(Wre(r,n)),e.nonempty=r=>e.check(Wre(1,r)),e.max=(r,n)=>e.check(Yxe(r,n)),e.length=(r,n)=>e.check(Xxe(r,n)),e.unwrap=()=>e.element});function imt(e,t){return KGn(mWn,e,t)}function eGo(e){let t=e._zod.def.shape;return W9t(Object.keys(t))}var omt=nr("ZodObject",(e,t)=>{q9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>B7n(e,r,n,i),oi.defineLazy(e,"shape",()=>t.shape),e.keyof=()=>W9t(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:Zxe()}),e.loose=()=>e.clone({...e._zod.def,catchall:Zxe()}),e.strict=()=>e.clone({...e._zod.def,catchall:q9t()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>oi.extend(e,r),e.safeExtend=r=>oi.safeExtend(e,r),e.merge=r=>oi.merge(e,r),e.pick=r=>oi.pick(e,r),e.omit=r=>oi.omit(e,r),e.partial=(...r)=>oi.partial(H9t,e,r[0]),e.required=(...r)=>oi.required(K9t,e,r[0])});function tGo(e,t){let r={type:"object",shape:e??{},...oi.normalizeParams(t)};return new omt(r)}function rGo(e,t){return new omt({type:"object",shape:e,catchall:q9t(),...oi.normalizeParams(t)})}function nGo(e,t){return new omt({type:"object",shape:e,catchall:Zxe(),...oi.normalizeParams(t)})}var smt=nr("ZodUnion",(e,t)=>{Gdt.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>h9t(e,r,n,i),e.options=t.options});function G9t(e,t){return new smt({type:"union",options:e,...oi.normalizeParams(t)})}var hWn=nr("ZodXor",(e,t)=>{smt.init(e,t),G9n.init(e,t),e._zod.processJSONSchema=(r,n,i)=>h9t(e,r,n,i),e.options=t.options});function iGo(e,t){return new hWn({type:"union",options:e,inclusive:!1,...oi.normalizeParams(t)})}var gWn=nr("ZodDiscriminatedUnion",(e,t)=>{smt.init(e,t),W9n.init(e,t)});function oGo(e,t,r){return new gWn({type:"union",options:t,discriminator:e,...oi.normalizeParams(r)})}var AWn=nr("ZodIntersection",(e,t)=>{$9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>O7n(e,r,n,i)});function yWn(e,t){return new AWn({type:"intersection",left:e,right:t})}var bWn=nr("ZodTuple",(e,t)=>{Qqt.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>P7n(e,r,n,i),e.rest=r=>e.clone({...e._zod.def,rest:r})});function EWn(e,t,r){let n=t instanceof rc,i=n?r:t,o=n?t:null;return new bWn({type:"tuple",items:e,rest:o,...oi.normalizeParams(i)})}var amt=nr("ZodRecord",(e,t)=>{H9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>T7n(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType});function vWn(e,t,r){return new amt({type:"record",keyType:e,valueType:t,...oi.normalizeParams(r)})}function sGo(e,t,r){let n=WO(e);return n._zod.values=void 0,new amt({type:"record",keyType:n,valueType:t,...oi.normalizeParams(r)})}function aGo(e,t,r){return new amt({type:"record",keyType:e,valueType:t,mode:"loose",...oi.normalizeParams(r)})}var IWn=nr("ZodMap",(e,t)=>{K9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>x7n(e,r,n,i),e.keyType=t.keyType,e.valueType=t.valueType,e.min=(...r)=>e.check(j9(...r)),e.nonempty=r=>e.check(j9(1,r)),e.max=(...r)=>e.check(qle(...r)),e.size=(...r)=>e.check(Jxe(...r))});function uGo(e,t,r){return new IWn({type:"map",keyType:e,valueType:t,...oi.normalizeParams(r)})}var wWn=nr("ZodSet",(e,t)=>{J9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>_7n(e,r,n,i),e.min=(...r)=>e.check(j9(...r)),e.nonempty=r=>e.check(j9(1,r)),e.max=(...r)=>e.check(qle(...r)),e.size=(...r)=>e.check(Jxe(...r))});function cGo(e,t){return new wWn({type:"set",valueType:e,...oi.normalizeParams(t)})}var q4e=nr("ZodEnum",(e,t)=>{Y9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(n,i,o)=>g7n(e,n,i,o),e.enum=t.entries,e.options=Object.values(t.entries);let r=new Set(Object.keys(t.entries));e.extract=(n,i)=>{let o={};for(let s of n)if(r.has(s))o[s]=t.entries[s];else throw new Error(`Key ${s} not found in enum`);return new q4e({...t,checks:[],...oi.normalizeParams(i),entries:o})},e.exclude=(n,i)=>{let o={...t.entries};for(let s of n)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new q4e({...t,checks:[],...oi.normalizeParams(i),entries:o})}});function W9t(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new q4e({type:"enum",entries:r,...oi.normalizeParams(t)})}function lGo(e,t){return new q4e({type:"enum",entries:e,...oi.normalizeParams(t)})}var CWn=nr("ZodLiteral",(e,t)=>{X9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>A7n(e,r,n,i),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function pGo(e,t){return new CWn({type:"literal",values:Array.isArray(e)?e:[e],...oi.normalizeParams(t)})}var xWn=nr("ZodFile",(e,t)=>{Z9n.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>E7n(e,r,n,i),e.min=(r,n)=>e.check(j9(r,n)),e.max=(r,n)=>e.check(qle(r,n)),e.mime=(r,n)=>e.check(k4e(Array.isArray(r)?r:[r],n))});function fGo(e){return JGn(xWn,e)}var _Wn=nr("ZodTransform",(e,t)=>{eGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>C7n(e,r,n,i),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new jle(e.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(oi.issue(o,r.value,t));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=e),r.issues.push(oi.issue(s))}};let i=t.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r)):(r.value=i,r)}});function $9t(e){return new _Wn({type:"transform",transform:e})}var H9t=nr("ZodOptional",(e,t)=>{Nqt.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>g9t(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function Zdt(e){return new H9t({type:"optional",innerType:e})}var SWn=nr("ZodExactOptional",(e,t)=>{tGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>g9t(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function BWn(e){return new SWn({type:"optional",innerType:e})}var OWn=nr("ZodNullable",(e,t)=>{rGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>D7n(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function emt(e){return new OWn({type:"nullable",innerType:e})}function dGo(e){return Zdt(emt(e))}var PWn=nr("ZodDefault",(e,t)=>{nGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>F7n(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function TWn(e,t){return new PWn({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():oi.shallowClone(t)}})}var DWn=nr("ZodPrefault",(e,t)=>{iGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>k7n(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function RWn(e,t){return new DWn({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():oi.shallowClone(t)}})}var K9t=nr("ZodNonOptional",(e,t)=>{oGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>R7n(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function FWn(e,t){return new K9t({type:"nonoptional",innerType:e,...oi.normalizeParams(t)})}var kWn=nr("ZodSuccess",(e,t)=>{sGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>v7n(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function mGo(e){return new kWn({type:"success",innerType:e})}var QWn=nr("ZodCatch",(e,t)=>{aGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>Q7n(e,r,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function NWn(e,t){return new QWn({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var jWn=nr("ZodNaN",(e,t)=>{uGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>y7n(e,r,n,i)});function hGo(e){return HGn(jWn,e)}var J9t=nr("ZodPipe",(e,t)=>{cGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>N7n(e,r,n,i),e.in=t.in,e.out=t.out});function tmt(e,t){return new J9t({type:"pipe",in:e,out:t})}var Y9t=nr("ZodCodec",(e,t)=>{J9t.init(e,t),Wdt.init(e,t)});function gGo(e,t,r){return new Y9t({type:"pipe",in:e,out:t,transform:r.decode,reverseTransform:r.encode})}var MWn=nr("ZodReadonly",(e,t)=>{lGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>j7n(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function LWn(e){return new MWn({type:"readonly",innerType:e})}var UWn=nr("ZodTemplateLiteral",(e,t)=>{pGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>b7n(e,r,n,i)});function AGo(e,t){return new UWn({type:"template_literal",parts:e,...oi.normalizeParams(t)})}var zWn=nr("ZodLazy",(e,t)=>{mGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>L7n(e,r,n,i),e.unwrap=()=>e._zod.def.getter()});function VWn(e){return new zWn({type:"lazy",getter:e})}var qWn=nr("ZodPromise",(e,t)=>{dGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>M7n(e,r,n,i),e.unwrap=()=>e._zod.def.innerType});function yGo(e){return new qWn({type:"promise",innerType:e})}var GWn=nr("ZodFunction",(e,t)=>{fGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>w7n(e,r,n,i)});function bGo(e){return new GWn({type:"function",input:Array.isArray(e?.input)?EWn(e?.input):e?.input??imt(Zxe()),output:e?.output??Zxe()})}var umt=nr("ZodCustom",(e,t)=>{hGn.init(e,t),dl.init(e,t),e._zod.processJSONSchema=(r,n,i)=>I7n(e,r,n,i)});function EGo(e){let t=new Kh({check:"custom"});return t._zod.check=e,t}function vGo(e,t){return YGn(umt,e??(()=>!0),t)}function WWn(e,t={}){return XGn(umt,e,t)}function $Wn(e){return ZGn(e)}var IGo=e7n,wGo=t7n;function CGo(e,t={}){let r=new umt({type:"custom",check:"custom",fn:n=>n instanceof e,abort:!0,...oi.normalizeParams(t)});return r._zod.bag.Class=e,r._zod.check=n=>{n.value instanceof e||n.issues.push({code:"invalid_type",expected:e.name,input:n.value,inst:r,path:[...r._zod.def.path??[]]})},r}var xGo=(...e)=>r7n({Codec:Y9t,Boolean:H4e,String:G4e},...e);function _Go(e){let t=VWn(()=>G9t([C9t(e),iWn(),oWn(),cWn(),imt(t),vWn(C9t(),t)]));return t}function SGo(e,t){return tmt($9t(e),t)}var KDc={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 JDc(e){Vb({customError:e})}function YDc(){return Vb().customError}var HWn;HWn||(HWn={});var Eo={...Ydt,...b9t,iso:V4e},XDc=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 ZDc(e,t){let r=e.$schema;return r==="https://json-schema.org/draft/2020-12/schema"?"draft-2020-12":r==="http://json-schema.org/draft-07/schema#"?"draft-7":r==="http://json-schema.org/draft-04/schema#"?"draft-4":t??"draft-2020-12"}function eRc(e,t){if(!e.startsWith("#"))throw new Error("External $ref is not supported, only local refs (#/...) are allowed");let r=e.slice(1).split("/").filter(Boolean);if(r.length===0)return t.rootSchema;let n=t.version==="draft-2020-12"?"$defs":"definitions";if(r[0]===n){let i=r[1];if(!i||!t.defs[i])throw new Error(`Reference not found: ${e}`);return t.defs[i]}throw new Error(`Reference not found: ${e}`)}function BGo(e,t){if(e.not!==void 0){if(typeof e.not=="object"&&Object.keys(e.not).length===0)return Eo.never();throw new Error("not is not supported in Zod (except { not: {} } for never)")}if(e.unevaluatedItems!==void 0)throw new Error("unevaluatedItems is not supported");if(e.unevaluatedProperties!==void 0)throw new Error("unevaluatedProperties is not supported");if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw new Error("Conditional schemas (if/then/else) are not supported");if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw new Error("dependentSchemas and dependentRequired are not supported");if(e.$ref){let i=e.$ref;if(t.refs.has(i))return t.refs.get(i);if(t.processing.has(i))return Eo.lazy(()=>{if(!t.refs.has(i))throw new Error(`Circular reference not resolved: ${i}`);return t.refs.get(i)});t.processing.add(i);let o=eRc(i,t),s=pS(o,t);return t.refs.set(i,s),t.processing.delete(i),s}if(e.enum!==void 0){let i=e.enum;if(t.version==="openapi-3.0"&&e.nullable===!0&&i.length===1&&i[0]===null)return Eo.null();if(i.length===0)return Eo.never();if(i.length===1)return Eo.literal(i[0]);if(i.every(s=>typeof s=="string"))return Eo.enum(i);let o=i.map(s=>Eo.literal(s));return o.length<2?o[0]:Eo.union([o[0],o[1],...o.slice(2)])}if(e.const!==void 0)return Eo.literal(e.const);let r=e.type;if(Array.isArray(r)){let i=r.map(o=>{let s={...e,type:o};return BGo(s,t)});return i.length===0?Eo.never():i.length===1?i[0]:Eo.union(i)}if(!r)return Eo.any();let n;switch(r){case"string":{let i=Eo.string();if(e.format){let o=e.format;o==="email"?i=i.check(Eo.email()):o==="uri"||o==="uri-reference"?i=i.check(Eo.url()):o==="uuid"||o==="guid"?i=i.check(Eo.uuid()):o==="date-time"?i=i.check(Eo.iso.datetime()):o==="date"?i=i.check(Eo.iso.date()):o==="time"?i=i.check(Eo.iso.time()):o==="duration"?i=i.check(Eo.iso.duration()):o==="ipv4"?i=i.check(Eo.ipv4()):o==="ipv6"?i=i.check(Eo.ipv6()):o==="mac"?i=i.check(Eo.mac()):o==="cidr"?i=i.check(Eo.cidrv4()):o==="cidr-v6"?i=i.check(Eo.cidrv6()):o==="base64"?i=i.check(Eo.base64()):o==="base64url"?i=i.check(Eo.base64url()):o==="e164"?i=i.check(Eo.e164()):o==="jwt"?i=i.check(Eo.jwt()):o==="emoji"?i=i.check(Eo.emoji()):o==="nanoid"?i=i.check(Eo.nanoid()):o==="cuid"?i=i.check(Eo.cuid()):o==="cuid2"?i=i.check(Eo.cuid2()):o==="ulid"?i=i.check(Eo.ulid()):o==="xid"?i=i.check(Eo.xid()):o==="ksuid"&&(i=i.check(Eo.ksuid()))}typeof e.minLength=="number"&&(i=i.min(e.minLength)),typeof e.maxLength=="number"&&(i=i.max(e.maxLength)),e.pattern&&(i=i.regex(new RegExp(e.pattern))),n=i;break}case"number":case"integer":{let i=r==="integer"?Eo.number().int():Eo.number();typeof e.minimum=="number"&&(i=i.min(e.minimum)),typeof e.maximum=="number"&&(i=i.max(e.maximum)),typeof e.exclusiveMinimum=="number"?i=i.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum=="number"&&(i=i.gt(e.minimum)),typeof e.exclusiveMaximum=="number"?i=i.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum=="number"&&(i=i.lt(e.maximum)),typeof e.multipleOf=="number"&&(i=i.multipleOf(e.multipleOf)),n=i;break}case"boolean":{n=Eo.boolean();break}case"null":{n=Eo.null();break}case"object":{let i={},o=e.properties||{},s=new Set(e.required||[]);for(let[u,c]of Object.entries(o)){let l=pS(c,t);i[u]=s.has(u)?l:l.optional()}if(e.propertyNames){let u=pS(e.propertyNames,t),c=e.additionalProperties&&typeof e.additionalProperties=="object"?pS(e.additionalProperties,t):Eo.any();if(Object.keys(i).length===0){n=Eo.record(u,c);break}let l=Eo.object(i).passthrough(),p=Eo.looseRecord(u,c);n=Eo.intersection(l,p);break}if(e.patternProperties){let u=e.patternProperties,c=Object.keys(u),l=[];for(let d of c){let f=pS(u[d],t),m=Eo.string().regex(new RegExp(d));l.push(Eo.looseRecord(m,f))}let p=[];if(Object.keys(i).length>0&&p.push(Eo.object(i).passthrough()),p.push(...l),p.length===0)n=Eo.object({}).passthrough();else if(p.length===1)n=p[0];else{let d=Eo.intersection(p[0],p[1]);for(let f=2;f<p.length;f++)d=Eo.intersection(d,p[f]);n=d}break}let a=Eo.object(i);e.additionalProperties===!1?n=a.strict():typeof e.additionalProperties=="object"?n=a.catchall(pS(e.additionalProperties,t)):n=a.passthrough();break}case"array":{let i=e.prefixItems,o=e.items;if(i&&Array.isArray(i)){let s=i.map(u=>pS(u,t)),a=o&&typeof o=="object"&&!Array.isArray(o)?pS(o,t):void 0;a?n=Eo.tuple(s).rest(a):n=Eo.tuple(s),typeof e.minItems=="number"&&(n=n.check(Eo.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(Eo.maxLength(e.maxItems)))}else if(Array.isArray(o)){let s=o.map(u=>pS(u,t)),a=e.additionalItems&&typeof e.additionalItems=="object"?pS(e.additionalItems,t):void 0;a?n=Eo.tuple(s).rest(a):n=Eo.tuple(s),typeof e.minItems=="number"&&(n=n.check(Eo.minLength(e.minItems))),typeof e.maxItems=="number"&&(n=n.check(Eo.maxLength(e.maxItems)))}else if(o!==void 0){let s=pS(o,t),a=Eo.array(s);typeof e.minItems=="number"&&(a=a.min(e.minItems)),typeof e.maxItems=="number"&&(a=a.max(e.maxItems)),n=a}else n=Eo.array(Eo.any());break}default:throw new Error(`Unsupported type: ${r}`)}return e.description&&(n=n.describe(e.description)),e.default!==void 0&&(n=n.default(e.default)),n}function pS(e,t){if(typeof e=="boolean")return e?Eo.any():Eo.never();let r=BGo(e,t),n=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let a=e.anyOf.map(c=>pS(c,t)),u=Eo.union(a);r=n?Eo.intersection(r,u):u}if(e.oneOf&&Array.isArray(e.oneOf)){let a=e.oneOf.map(c=>pS(c,t)),u=Eo.xor(a);r=n?Eo.intersection(r,u):u}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)r=n?r:Eo.any();else{let a=n?r:pS(e.allOf[0],t),u=n?0:1;for(let c=u;c<e.allOf.length;c++)a=Eo.intersection(a,pS(e.allOf[c],t));r=a}e.nullable===!0&&t.version==="openapi-3.0"&&(r=Eo.nullable(r)),e.readOnly===!0&&(r=Eo.readonly(r));let i={},o=["$id","id","$comment","$anchor","$vocabulary","$dynamicRef","$dynamicAnchor"];for(let a of o)a in e&&(i[a]=e[a]);let s=["contentEncoding","contentMediaType","contentSchema"];for(let a of s)a in e&&(i[a]=e[a]);for(let a of Object.keys(e))XDc.has(a)||(i[a]=e[a]);return Object.keys(i).length>0&&t.registry.add(r,i),r}function OGo(e,t){if(typeof e=="boolean")return e?Eo.any():Eo.never();let r=ZDc(e,t?.defaultTarget),n=e.$defs||e.definitions||{},i={version:r,defs:n,refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??s_};return pS(e,i)}var KWn={};Y(KWn,{bigint:()=>iRc,boolean:()=>nRc,date:()=>oRc,number:()=>rRc,string:()=>tRc});function tRc(e){return bGn(G4e,e)}function rRc(e){return SGn($4e,e)}function nRc(e){return FGn(H4e,e)}function iRc(e){return QGn(K4e,e)}function oRc(e){return $Gn(nmt,e)}Vb(jqt());var kw={};Y(kw,{DocsYmlSchemas:()=>p$n,RawSchemas:()=>K$n});var p$n={};Y(p$n,{AIChatConfig:()=>XWn,AIChatDatasource:()=>m7o,AIChatLocation:()=>DGo,AIChatModel:()=>RGo,AIChatWebsiteDatasource:()=>d7o,AbsoluteProductPath:()=>gWo,AiExamplesConfig:()=>f7o,AnalyticsConfig:()=>p7o,AnnouncementConfig:()=>tGt,ApiReferenceConfiguration:()=>iWo,ApiReferenceEndpointConfiguration:()=>Z7o,ApiReferenceLayoutItem:()=>pmt,ApiReferenceOperationConfiguration:()=>eWo,ApiReferencePackageConfiguration:()=>nWo,ApiReferencePackageConfigurationWithOptions:()=>rWo,ApiReferenceSectionConfiguration:()=>tWo,Audience:()=>cmt,AudienceId:()=>JWn,Availability:()=>Hre,BackgroundImageConfiguration:()=>r7o,BackgroundImageThemedConfig:()=>t7o,BodyThemeConfig:()=>$Go,ChangelogConfiguration:()=>J7o,ChangelogFolderRelativePath:()=>e$n,ColorConfig:()=>rv,ColorThemedConfig:()=>XGo,ColorsConfiguration:()=>v7o,ContentAlignment:()=>UGo,CssConfig:()=>n7o,CustomDomain:()=>ZGo,CustomPageAction:()=>I7o,DocsConfiguration:()=>cRc,DocsInstance:()=>S7o,DocsSettingsConfig:()=>E7o,DocsTypographyConfig:()=>A7o,EditThisPageConfig:()=>_7o,EditThisPageLaunch:()=>FGo,ExperimentalConfig:()=>q7o,ExternalProduct:()=>dWo,FeatureFlag:()=>YWn,FeatureFlagConfiguration:()=>i7o,FolderConfiguration:()=>X7o,FontConfig:()=>X9t,FontConfigPath:()=>g7o,FontConfigVariant:()=>h7o,FontDisplay:()=>NGo,FontStyle:()=>i$n,FontWeight:()=>s$n,FooterLinksConfig:()=>Q7o,FooterNavThemeConfig:()=>GGo,FullStoryAnalyticsConfig:()=>s7o,GTMConfig:()=>c7o,GitLibraryInputSchema:()=>G7o,GithubEditThisPageConfig:()=>x7o,GoogleAnalytics4Config:()=>l7o,HeaderPosition:()=>zGo,HttpSnippetLanguage:()=>JGo,HttpSnippetsConfig:()=>e7o,IntegrationsConfig:()=>V7o,IntercomConfig:()=>a7o,InternalProduct:()=>fWo,JsConfig:()=>L7o,JsConfigOptions:()=>ZWn,JsFileConfig:()=>j7o,JsFileConfigSettings:()=>N7o,JsRemoteConfig:()=>M7o,JsScriptStrategy:()=>o$n,Language:()=>r$n,LanguageSwitcherThemeConfig:()=>qGo,LayoutConfig:()=>b7o,LibraryConfiguration:()=>K7o,LibraryInputConfiguration:()=>$7o,LibraryLanguage:()=>QGo,LibraryName:()=>t$n,LibraryOutputConfiguration:()=>H7o,LibraryReferenceConfiguration:()=>Y7o,LinkConfiguration:()=>u$n,LogoConfiguration:()=>B7o,MetadataConfig:()=>U7o,NavbarDropdownConfig:()=>F7o,NavbarGithubConfig:()=>R7o,NavbarGithubConfigWithOptions:()=>D7o,NavbarLink:()=>k7o,NavbarLinkConfig:()=>t_e,NavigationConfig:()=>rGt,NavigationItem:()=>fmt,PageActionOption:()=>TGo,PageActionOptions:()=>w7o,PageActionsConfig:()=>C7o,PageActionsThemeConfig:()=>KGo,PageConfiguration:()=>X4e,PathLibraryInputSchema:()=>W7o,PlaygroundButtonSettings:()=>T7o,PlaygroundSettings:()=>lmt,PostHogConfig:()=>u7o,ProductConfig:()=>mWo,ProductConfigBase:()=>l$n,ProductFileConfig:()=>uRc,ProductPath:()=>aRc,ProductSwitcherThemeConfig:()=>VGo,ProgrammingLanguage:()=>PGo,RedirectConfig:()=>z7o,RelativeProductPath:()=>hWo,Role:()=>a$n,RoleId:()=>Z9t,SearchbarPlacement:()=>jGo,SectionConfiguration:()=>oWo,SegmentConfig:()=>o7o,SidebarThemeConfig:()=>HGo,SnippetLanguageConfiguration:()=>L9,SnippetsConfiguration:()=>P7o,SwitcherPlacement:()=>LGo,TabConfig:()=>nGt,TabId:()=>J4e,TabVariant:()=>aWo,TabbedNavigationConfig:()=>pWo,TabbedNavigationItem:()=>lWo,TabbedNavigationItemWithLayout:()=>uWo,TabbedNavigationItemWithVariants:()=>cWo,TabsPlacement:()=>MGo,TabsThemeConfig:()=>WGo,Target:()=>Y4e,ThemeConfig:()=>y7o,TitleSource:()=>n$n,TwitterCardSetting:()=>YGo,UntabbedNavigationConfig:()=>sWo,VersionAvailability:()=>kGo,VersionConfig:()=>c$n,VersionFileConfig:()=>sRc,VersionedSnippetLanguageConfiguration:()=>O7o,WithFeatureFlags:()=>dS,WithPermissions:()=>fS,WithViewers:()=>eGt});var J4e=ne.string(),e$n=ne.string(),JWn=ne.string(),Z9t=ne.string(),t$n=ne.string(),PGo=ne.enum(["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]),r$n=ne.enum(["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]),TGo=ne.enum(["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]),DGo=ne.enum(["docs","slack","discord"]),RGo=ne.enum(["claude-3.7","claude-4","command-a"]),FGo=ne.enum(["github","dashboard"]),Hre=ne.enum(["stable","generally-available","in-development","pre-release","deprecated","beta"]),kGo=ne.enum(["deprecated","ga","stable","beta"]),n$n=ne.enum(["frontmatter","filename"]),QGo=ne.enum(["python","cpp"]),i$n=ne.enum(["normal","italic"]),NGo=ne.enum(["auto","block","swap","fallback","optional"]),jGo=ne.enum(["header","header-tabs","sidebar"]),MGo=ne.enum(["header","sidebar"]),LGo=ne.enum(["header","sidebar"]),UGo=ne.enum(["center","left"]),zGo=ne.enum(["fixed","static"]),VGo=ne.enum(["default","toggle"]),qGo=ne.enum(["default","minimal"]),GGo=ne.enum(["default","minimal"]),WGo=ne.enum(["default","bubble"]),$Go=ne.enum(["default","canvas"]),HGo=ne.enum(["default","minimal"]),KGo=ne.enum(["default","toolbar"]),JGo=ne.enum(["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]),Y4e=ne.enum(["_blank","_self","_parent","_top"]),YGo=ne.enum(["summary","summary_large_image","app","player"]),o$n=ne.enum(["beforeInteractive","afterInteractive","lazyOnload"]),s$n=ne.union([ne.string(),ne.number().int()]),XGo=ne.object({dark:ne.string().optional(),light:ne.string().optional()}),rv=ne.union([ne.string(),XGo]),cmt=ne.union([JWn,ne.array(JWn)]),a$n=ne.union([Z9t,ne.array(Z9t)]),ZGo=ne.union([ne.string(),ne.array(ne.string())]),e7o=ne.union([ne.boolean(),ne.array(JGo)]),t7o=ne.object({dark:ne.string().optional(),light:ne.string().optional()}),r7o=ne.union([ne.string(),t7o]),n7o=ne.union([ne.string(),ne.array(ne.string())]),fS=ne.object({viewers:a$n.optional(),orphaned:ne.boolean().optional()}),YWn=ne.object({flag:ne.string(),"fallback-value":ne.unknown().optional(),match:ne.unknown().optional()}),i7o=ne.union([ne.string(),YWn,ne.array(YWn)]),dS=ne.object({"feature-flag":i7o.optional()}),eGt=ne.object({viewers:a$n.optional()}),o7o=ne.object({"write-key":ne.string()}),s7o=ne.object({"org-id":ne.string()}),a7o=ne.object({"app-id":ne.string(),"api-base":ne.string().optional()}),u7o=ne.object({"api-key":ne.string(),endpoint:ne.string().optional()}),c7o=ne.object({"container-id":ne.string()}),l7o=ne.object({"measurement-id":ne.string()}),p7o=ne.object({segment:o7o.optional(),fullstory:s7o.optional(),intercom:a7o.optional(),posthog:u7o.optional(),gtm:c7o.optional(),ga4:l7o.optional()}),f7o=ne.object({enabled:ne.boolean().optional(),style:ne.string().optional()}),d7o=ne.object({url:ne.string(),title:ne.string().optional()}),m7o=d7o,XWn=ne.object({model:RGo.optional(),"system-prompt":ne.string().optional(),location:ne.array(DGo).optional(),datasources:ne.array(m7o).optional()}),h7o=ne.object({path:ne.string(),weight:s$n.optional(),style:i$n.optional()}),g7o=ne.union([ne.string(),h7o]),X9t=ne.object({name:ne.string().optional(),path:ne.string().optional(),weight:s$n.optional(),style:i$n.optional(),paths:ne.array(g7o).optional(),display:NGo.optional(),fallback:ne.array(ne.string()).optional(),"font-variation-settings":ne.string().optional()}),A7o=ne.object({headingsFont:X9t.optional(),bodyFont:X9t.optional(),codeFont:X9t.optional()}),y7o=ne.object({sidebar:HGo.optional(),body:$Go.optional(),tabs:WGo.optional(),"page-actions":KGo.optional(),"footer-nav":GGo.optional(),"language-switcher":qGo.optional(),"product-switcher":VGo.optional()}),b7o=ne.object({"page-width":ne.string().optional(),"content-width":ne.string().optional(),"sidebar-width":ne.string().optional(),"header-height":ne.string().optional(),"searchbar-placement":jGo.optional(),"tabs-placement":MGo.optional(),"switcher-placement":LGo.optional(),"content-alignment":UGo.optional(),"header-position":zGo.optional(),"disable-header":ne.boolean().optional(),"hide-nav-links":ne.boolean().optional(),"hide-feedback":ne.boolean().optional()}),E7o=ne.object({"search-text":ne.string().optional(),"disable-search":ne.boolean().optional(),"dark-mode-code":ne.boolean().optional(),"default-search-filters":ne.boolean().optional(),"http-snippets":e7o.optional(),"hide-404-page":ne.boolean().optional(),"use-javascript-as-typescript":ne.boolean().optional(),"disable-explorer-proxy":ne.boolean().optional(),"disable-analytics":ne.boolean().optional(),language:r$n.optional(),"folder-title-source":n$n.optional(),"substitute-env-vars":ne.boolean().optional()}),v7o=ne.object({"accent-primary":rv.optional(),accentPrimary:rv.optional(),background:rv.optional(),border:rv.optional(),"sidebar-background":rv.optional(),"header-background":rv.optional(),"card-background":rv.optional(),"accent-1":rv.optional(),"accent-2":rv.optional(),"accent-3":rv.optional(),"accent-4":rv.optional(),"accent-5":rv.optional(),"accent-6":rv.optional(),"accent-7":rv.optional(),"accent-8":rv.optional(),"accent-9":rv.optional(),"accent-10":rv.optional(),"accent-11":rv.optional(),"accent-12":rv.optional()}),I7o=ne.object({title:ne.string(),subtitle:ne.string().optional(),url:ne.string(),icon:ne.string().optional(),default:ne.boolean().optional()}),w7o=ne.object({"copy-page":ne.boolean().optional(),"view-as-markdown":ne.boolean().optional(),"ask-ai":ne.boolean().optional(),chatgpt:ne.boolean().optional(),claude:ne.boolean().optional(),cursor:ne.boolean().optional(),vscode:ne.boolean().optional(),custom:ne.array(I7o).optional()}),C7o=ne.object({default:TGo.optional(),options:w7o.optional()}),x7o=ne.object({host:ne.string().optional(),owner:ne.string(),repo:ne.string(),branch:ne.string().optional()}),_7o=ne.object({github:x7o.optional(),launch:FGo.optional()}),S7o=ne.object({url:ne.string(),"custom-domain":ZGo.optional(),private:ne.boolean().optional(),"edit-this-page":_7o.optional(),audiences:cmt.optional()}),B7o=ne.object({dark:ne.string().optional(),light:ne.string().optional(),height:ne.number().optional(),href:ne.string().optional(),"right-text":ne.string().optional()}),u$n=ne.object({link:ne.string(),href:ne.string(),icon:ne.string().optional(),target:Y4e.optional()}),O7o=ne.object({version:ne.string(),package:ne.string()}),L9=ne.union([ne.string(),O7o]),P7o=ne.object({python:L9.optional(),typescript:L9.optional(),go:L9.optional(),java:L9.optional(),ruby:L9.optional(),csharp:L9.optional(),php:L9.optional(),swift:L9.optional(),rust:L9.optional()}),T7o=ne.object({href:ne.string().optional()}),lmt=ne.object({hidden:ne.boolean().optional(),environments:ne.array(ne.string()).optional(),button:T7o.optional(),oauth:ne.boolean().optional(),"limit-websocket-messages-per-connection":ne.number().int().optional()}),tGt=ne.object({message:ne.string()}),t_e=eGt.merge(ne.object({href:ne.string().optional(),target:Y4e.optional(),url:ne.string().optional(),text:ne.string().optional(),icon:ne.string().optional(),rightIcon:ne.string().optional(),rounded:ne.boolean().optional()})),D7o=eGt.merge(ne.object({url:ne.string(),target:Y4e.optional()})),R7o=ne.union([ne.string(),D7o]),F7o=eGt.merge(ne.object({links:ne.array(t_e),text:ne.string().optional(),icon:ne.string().optional(),rightIcon:ne.string().optional(),rounded:ne.boolean().optional()})),k7o=ne.union([t_e.merge(ne.object({type:ne.literal("filled")})),t_e.merge(ne.object({type:ne.literal("outlined")})),t_e.merge(ne.object({type:ne.literal("minimal")})),ne.object({type:ne.literal("github"),value:R7o}),F7o.merge(ne.object({type:ne.literal("dropdown")})),t_e.merge(ne.object({type:ne.literal("primary")})),t_e.merge(ne.object({type:ne.literal("secondary")}))]),Q7o=ne.object({github:ne.string().optional(),twitter:ne.string().optional(),x:ne.string().optional(),linkedin:ne.string().optional(),youtube:ne.string().optional(),instagram:ne.string().optional(),facebook:ne.string().optional(),discord:ne.string().optional(),slack:ne.string().optional(),hackernews:ne.string().optional(),medium:ne.string().optional(),website:ne.string().optional()}),N7o=ne.object({path:ne.string(),strategy:o$n.optional()}),j7o=ne.union([ne.string(),N7o]),M7o=ne.object({url:ne.string(),strategy:o$n.optional()}),ZWn=ne.union([M7o,j7o]),L7o=ne.union([ZWn,ne.array(ZWn)]),U7o=ne.object({"og:site_name":ne.string().optional(),"og:title":ne.string().optional(),"og:description":ne.string().optional(),"og:url":ne.string().optional(),"og:image":ne.string().optional(),"og:image:width":ne.number().optional(),"og:image:height":ne.number().optional(),"og:locale":ne.string().optional(),"og:logo":ne.string().optional(),"twitter:title":ne.string().optional(),"twitter:description":ne.string().optional(),"twitter:handle":ne.string().optional(),"twitter:image":ne.string().optional(),"twitter:site":ne.string().optional(),"twitter:url":ne.string().optional(),"twitter:card":YGo.optional(),"canonical-host":ne.string().optional()}),z7o=ne.object({source:ne.string(),destination:ne.string(),permanent:ne.boolean().optional()}),V7o=ne.object({intercom:ne.string().optional()}),q7o=ne.object({"mdx-components":ne.array(ne.string()).optional(),"disable-stream-toggle":ne.boolean().optional(),"openapi-parser-v2":ne.boolean().optional(),"openapi-parser-v3":ne.boolean().optional(),"dynamic-snippets":ne.boolean().optional(),"ai-examples":ne.boolean().optional(),"ai-example-style-instructions":ne.string().optional(),"exclude-apis":ne.boolean().optional(),"basepath-aware":ne.boolean().optional()}),G7o=ne.object({git:ne.string(),subpath:ne.string().optional()}),W7o=ne.object({path:ne.string()}),$7o=ne.union([G7o,W7o]),H7o=ne.object({path:ne.string()}),K7o=ne.object({input:$7o,output:H7o,lang:QGo}),X4e=fS.merge(dS).merge(ne.object({page:ne.string(),path:ne.string(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional(),noindex:ne.boolean().optional(),availability:Hre.optional()})),J7o=fS.merge(dS).merge(ne.object({changelog:e$n,title:ne.string().optional(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional()})),Y7o=fS.merge(dS).merge(ne.object({library:t$n,title:ne.string().optional(),slug:ne.string().optional()})),X7o=fS.merge(dS).merge(ne.object({folder:ne.string(),title:ne.string().optional(),"title-source":n$n.optional(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional(),"skip-slug":ne.boolean().optional(),collapsed:ne.union([ne.boolean(),ne.literal("open-by-default")]).optional(),collapsible:ne.boolean().optional(),"collapsed-by-default":ne.boolean().optional(),availability:Hre.optional()})),Z7o=fS.merge(dS).merge(ne.object({endpoint:ne.string(),title:ne.string().optional(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional(),availability:Hre.optional(),playground:lmt.optional()})),eWo=fS.merge(dS).merge(ne.object({operation:ne.string(),title:ne.string().optional(),slug:ne.string().optional(),hidden:ne.boolean().optional(),availability:Hre.optional()})),pmt=ne.lazy(()=>ne.union([ne.string(),ne.record(ne.string(),nWo),tWo,Z7o,eWo,X4e,u$n])),tWo=fS.merge(dS).merge(ne.object({section:ne.string(),"referenced-packages":ne.array(ne.string()).optional(),summary:ne.string().optional(),contents:ne.array(pmt).optional(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional(),"skip-slug":ne.boolean().optional(),collapsed:ne.union([ne.boolean(),ne.literal("open-by-default")]).optional(),collapsible:ne.boolean().optional(),"collapsed-by-default":ne.boolean().optional(),availability:Hre.optional(),playground:lmt.optional()})),rWo=fS.merge(dS).merge(ne.object({title:ne.string().optional(),summary:ne.string().optional(),contents:ne.array(pmt).optional(),availability:Hre.optional(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional(),"skip-slug":ne.boolean().optional(),playground:lmt.optional()})),nWo=ne.lazy(()=>ne.union([ne.array(pmt),rWo])),iWo=fS.merge(dS).merge(ne.object({api:ne.string(),"api-name":ne.string().optional(),openrpc:ne.string().optional(),audiences:cmt.optional(),"display-errors":ne.boolean().optional(),"tag-description-pages":ne.boolean().optional(),snippets:P7o.optional(),postman:ne.string().optional(),summary:ne.string().optional(),layout:ne.array(pmt).optional(),collapsed:ne.union([ne.boolean(),ne.literal("open-by-default")]).optional(),icon:ne.string().optional(),slug:ne.string().optional(),hidden:ne.boolean().optional(),availability:Hre.optional(),"skip-slug":ne.boolean().optional(),alphabetized:ne.boolean().optional(),flattened:ne.boolean().optional(),paginated:ne.boolean().optional(),playground:lmt.optional()})),fmt=ne.lazy(()=>ne.union([X4e,oWo,iWo,Y7o,u$n,J7o,X7o])),oWo=fS.merge(dS).merge(ne.object({section:ne.string(),path:ne.string().optional(),contents:ne.array(fmt),collapsed:ne.union([ne.boolean(),ne.literal("open-by-default")]).optional(),collapsible:ne.boolean().optional(),"collapsed-by-default":ne.boolean().optional(),slug:ne.string().optional(),icon:ne.string().optional(),hidden:ne.boolean().optional(),"skip-slug":ne.boolean().optional(),availability:Hre.optional()})),sWo=ne.array(fmt),aWo=fS.merge(dS).merge(ne.object({title:ne.string(),subtitle:ne.string().optional(),icon:ne.string().optional(),layout:ne.array(fmt),slug:ne.string().optional(),"skip-slug":ne.boolean().optional(),hidden:ne.boolean().optional(),default:ne.boolean().optional()})),uWo=ne.object({tab:J4e,layout:ne.array(fmt).optional()}),cWo=ne.object({tab:J4e,variants:ne.array(aWo)}),lWo=ne.union([uWo,cWo]),pWo=ne.array(lWo),rGt=ne.union([sWo,pWo]),nGt=fS.merge(dS).merge(ne.object({"display-name":ne.string(),icon:ne.string().optional(),slug:ne.string().optional(),"skip-slug":ne.boolean().optional(),hidden:ne.boolean().optional(),href:ne.string().optional(),target:Y4e.optional(),changelog:e$n.optional()})),c$n=fS.merge(dS).merge(ne.object({"display-name":ne.string(),path:ne.string(),slug:ne.string().optional(),availability:kGo.optional(),audiences:cmt.optional(),hidden:ne.boolean().optional(),announcement:tGt.optional()})),sRc=ne.object({tabs:ne.record(J4e,nGt).optional(),"landing-page":X4e.optional(),navigation:rGt}),l$n=fS.merge(dS).merge(ne.object({"display-name":ne.string(),subtitle:ne.string().optional(),icon:ne.string().optional(),image:ne.string().optional(),versions:ne.array(c$n).optional(),audiences:cmt.optional()})),fWo=l$n.merge(ne.object({path:ne.string(),slug:ne.string().optional(),announcement:tGt.optional()})),dWo=l$n.merge(ne.object({href:ne.string(),target:Y4e.optional()})),mWo=ne.union([fWo,dWo]),hWo=fS.merge(dS).merge(ne.object({"display-name":ne.string(),path:ne.string(),slug:ne.string().optional()})),gWo=ne.object({href:ne.string()}),aRc=ne.union([hWo,gWo]),uRc=ne.object({tabs:ne.record(J4e,nGt).optional(),"landing-page":X4e.optional(),navigation:rGt}),cRc=ne.object({instances:ne.array(S7o),title:ne.string().optional(),libraries:ne.record(t$n,K7o).optional(),analytics:p7o.optional(),announcement:tGt.optional(),roles:ne.array(Z9t).optional(),tabs:ne.record(J4e,nGt).optional(),versions:ne.array(c$n).optional(),products:ne.array(mWo).optional(),"landing-page":X4e.optional(),navigation:rGt.optional(),"navbar-links":ne.array(k7o).optional(),"footer-links":Q7o.optional(),"page-actions":C7o.optional(),experimental:q7o.optional(),"default-language":PGo.optional(),languages:ne.array(r$n).optional(),"ai-chat":XWn.optional(),"ai-search":XWn.optional(),"ai-examples":f7o.optional(),metadata:U7o.optional(),redirects:ne.array(z7o).optional(),logo:B7o.optional(),favicon:ne.string().optional(),"background-image":r7o.optional(),colors:v7o.optional(),typography:A7o.optional(),layout:b7o.optional(),settings:E7o.optional(),theme:y7o.optional(),integrations:V7o.optional(),css:n7o.optional(),js:L7o.optional(),header:ne.string().optional(),footer:ne.string().optional()});var K$n={};Y(K$n,{AiChatLocation:()=>f$n,AiChatModel:()=>d$n,Availability:()=>m$n,BodyThemeConfig:()=>h$n,ContentAlignment:()=>g$n,EditThisPageLaunch:()=>A$n,FernDocsConfig:()=>L$n,FernDocsConfigError:()=>dmt,FernDocsConfigTimeoutError:()=>mmt,FontDisplay:()=>y$n,FontStyle:()=>b$n,FooterNavThemeConfig:()=>E$n,HeaderPosition:()=>v$n,HttpSnippetLanguage:()=>I$n,JsScriptStrategy:()=>w$n,Language:()=>C$n,LanguageSwitcherThemeConfig:()=>x$n,LibraryLanguage:()=>_$n,PageActionOption:()=>S$n,PageActionsThemeConfig:()=>B$n,ProductSwitcherThemeConfig:()=>O$n,ProgrammingLanguage:()=>P$n,SearchbarPlacement:()=>T$n,Serializer:()=>qD,SidebarThemeConfig:()=>D$n,SwitcherPlacement:()=>R$n,TabsPlacement:()=>F$n,TabsThemeConfig:()=>k$n,Target:()=>Q$n,TitleSource:()=>N$n,TwitterCardSetting:()=>j$n,VersionAvailability:()=>M$n,docs:()=>iGt,logging:()=>z$n,serialization:()=>qD});var L$n={};Y(L$n,{AiChatLocation:()=>f$n,AiChatModel:()=>d$n,Availability:()=>m$n,BodyThemeConfig:()=>h$n,ContentAlignment:()=>g$n,EditThisPageLaunch:()=>A$n,FontDisplay:()=>y$n,FontStyle:()=>b$n,FooterNavThemeConfig:()=>E$n,HeaderPosition:()=>v$n,HttpSnippetLanguage:()=>I$n,JsScriptStrategy:()=>w$n,Language:()=>C$n,LanguageSwitcherThemeConfig:()=>x$n,LibraryLanguage:()=>_$n,PageActionOption:()=>S$n,PageActionsThemeConfig:()=>B$n,ProductSwitcherThemeConfig:()=>O$n,ProgrammingLanguage:()=>P$n,SearchbarPlacement:()=>T$n,SidebarThemeConfig:()=>D$n,SwitcherPlacement:()=>R$n,TabsPlacement:()=>F$n,TabsThemeConfig:()=>k$n,Target:()=>Q$n,TitleSource:()=>N$n,TwitterCardSetting:()=>j$n,VersionAvailability:()=>M$n,docs:()=>iGt});var iGt={};Y(iGt,{AiChatLocation:()=>f$n,AiChatModel:()=>d$n,Availability:()=>m$n,BodyThemeConfig:()=>h$n,ContentAlignment:()=>g$n,EditThisPageLaunch:()=>A$n,FontDisplay:()=>y$n,FontStyle:()=>b$n,FooterNavThemeConfig:()=>E$n,HeaderPosition:()=>v$n,HttpSnippetLanguage:()=>I$n,JsScriptStrategy:()=>w$n,Language:()=>C$n,LanguageSwitcherThemeConfig:()=>x$n,LibraryLanguage:()=>_$n,PageActionOption:()=>S$n,PageActionsThemeConfig:()=>B$n,ProductSwitcherThemeConfig:()=>O$n,ProgrammingLanguage:()=>P$n,SearchbarPlacement:()=>T$n,SidebarThemeConfig:()=>D$n,SwitcherPlacement:()=>R$n,TabsPlacement:()=>F$n,TabsThemeConfig:()=>k$n,Target:()=>Q$n,TitleSource:()=>N$n,TwitterCardSetting:()=>j$n,VersionAvailability:()=>M$n});var f$n={Docs:"docs",Slack:"slack",Discord:"discord"};var d$n={Claude37:"claude-3.7",Claude4:"claude-4",CommandA:"command-a"};var m$n={Stable:"stable",GenerallyAvailable:"generally-available",InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",Beta:"beta"};var h$n={Default:"default",Canvas:"canvas"};var g$n={Center:"center",Left:"left"};var A$n={Github:"github",Dashboard:"dashboard"};var y$n={Auto:"auto",Block:"block",Swap:"swap",Fallback:"fallback",Optional:"optional"};var b$n={Normal:"normal",Italic:"italic"};var E$n={Default:"default",Minimal:"minimal"};var v$n={Fixed:"fixed",Static:"static"};var I$n={Curl:"curl",Csharp:"csharp",Go:"go",Java:"java",Javascript:"javascript",Php:"php",Python:"python",Ruby:"ruby",Swift:"swift",Typescript:"typescript"};var w$n={BeforeInteractive:"beforeInteractive",AfterInteractive:"afterInteractive",LazyOnload:"lazyOnload"};var C$n={En:"en",Es:"es",Fr:"fr",De:"de",It:"it",Pt:"pt",Ja:"ja",Zh:"zh",Ko:"ko",El:"el",No:"no",Pl:"pl",Ru:"ru",Sv:"sv",Tr:"tr"};var x$n={Default:"default",Minimal:"minimal"};var _$n={Python:"python",Cpp:"cpp"};var S$n={CopyPage:"copy-page",ViewAsMarkdown:"view-as-markdown",AskAi:"ask-ai",Chatgpt:"chatgpt",Claude:"claude",Cursor:"cursor",Vscode:"vscode"};var B$n={Default:"default",Toolbar:"toolbar"};var O$n={Default:"default",Toggle:"toggle"};var P$n={Typescript:"typescript",Javascript:"javascript",Python:"python",Java:"java",Go:"go",Ruby:"ruby",Csharp:"csharp",Php:"php",Swift:"swift",Rust:"rust",Nodets:"nodets",Nodejs:"nodejs",Dotnet:"dotnet",Curl:"curl",Jvm:"jvm",Ts:"ts",Js:"js"};var T$n={Header:"header",HeaderTabs:"header-tabs",Sidebar:"sidebar"};var D$n={Default:"default",Minimal:"minimal"};var R$n={Header:"header",Sidebar:"sidebar"};var F$n={Header:"header",Sidebar:"sidebar"};var k$n={Default:"default",Bubble:"bubble"};var Q$n={Blank:"_blank",Self:"_self",Parent:"_parent",Top:"_top"};var N$n={Frontmatter:"frontmatter",Filename:"filename"};var j$n={Summary:"summary",SummaryLargeImage:"summary_large_image",App:"app",Player:"player"};var M$n={Deprecated:"deprecated",Ga:"ga",Stable:"stable",Beta:"beta"};var AWo=(e,t,r)=>JSON.stringify(e,t,r);var dmt=class extends Error{statusCode;body;rawResponse;constructor({message:t,statusCode:r,body:n,rawResponse:i}){super(lRc({message:t,statusCode:r,body:n})),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.statusCode=r,this.body=n,this.rawResponse=i}};function lRc({message:e,statusCode:t,body:r}){let n=[];return e!=null&&n.push(e),t!=null&&n.push(`Status code: ${t.toString()}`),r!=null&&n.push(`Body: ${AWo(r,void 0,2)}`),n.join(`
|
|
1458
1458
|
`)}var mmt=class extends Error{constructor(t){super(t),Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};var J5={Debug:"debug",Info:"info",Warn:"warn",Error:"error"},yWo={[J5.Debug]:1,[J5.Info]:2,[J5.Warn]:3,[J5.Error]:4},hmt=class{debug(t,...r){console.debug(t,...r)}info(t,...r){console.info(t,...r)}warn(t,...r){console.warn(t,...r)}error(t,...r){console.error(t,...r)}},U$n=class{level;logger;silent;constructor(t){this.level=yWo[t.level],this.logger=t.logger,this.silent=t.silent}shouldLog(t){return!this.silent&&this.level<=yWo[t]}isDebug(){return this.shouldLog(J5.Debug)}debug(t,...r){this.isDebug()&&this.logger.debug(t,...r)}isInfo(){return this.shouldLog(J5.Info)}info(t,...r){this.isInfo()&&this.logger.info(t,...r)}isWarn(){return this.shouldLog(J5.Warn)}warn(t,...r){this.isWarn()&&this.logger.warn(t,...r)}isError(){return this.shouldLog(J5.Error)}error(t,...r){this.isError()&&this.logger.error(t,...r)}};var Zrg=new U$n({level:J5.Info,logger:new hmt,silent:!0});var z$n;(function(e){e.LogLevel=J5,e.ConsoleLogger=hmt})(z$n||(z$n={}));var qD={};Y(qD,{AbsoluteProductPath:()=>cGt,AiChatConfig:()=>ymt,AiChatDatasource:()=>pGt,AiChatLocation:()=>fGt,AiChatModel:()=>dGt,AiChatWebsiteDatasource:()=>lGt,AiExamplesConfig:()=>mGt,AnalyticsConfig:()=>vGt,AnnouncementConfig:()=>Hle,ApiReferenceConfiguration:()=>_Gt,ApiReferenceEndpointConfiguration:()=>SGt,ApiReferenceLayoutItem:()=>V9,ApiReferenceOperationConfiguration:()=>BGt,ApiReferencePackageConfiguration:()=>OGt,ApiReferencePackageConfigurationWithOptions:()=>TGt,ApiReferenceSectionConfiguration:()=>PGt,Audience:()=>U9,AudienceId:()=>bmt,Availability:()=>Fw,BackgroundImageConfiguration:()=>RGt,BackgroundImageThemedConfig:()=>DGt,BodyThemeConfig:()=>FGt,ChangelogConfiguration:()=>kGt,ChangelogFolderRelativePath:()=>iLe,ColorConfig:()=>qb,ColorThemedConfig:()=>QGt,ColorsConfiguration:()=>NGt,ContentAlignment:()=>jGt,CssConfig:()=>MGt,CustomDomain:()=>LGt,CustomPageAction:()=>UGt,DocsConfiguration:()=>WWo,DocsInstance:()=>GGt,DocsSettingsConfig:()=>HGt,DocsTypographyConfig:()=>XGt,EditThisPageConfig:()=>qGt,EditThisPageLaunch:()=>zGt,ExperimentalConfig:()=>ZGt,ExternalProduct:()=>k7t,FeatureFlag:()=>Emt,FeatureFlagConfiguration:()=>xGt,FolderConfiguration:()=>$7t,FontConfig:()=>cLe,FontConfigPath:()=>JGt,FontConfigVariant:()=>KGt,FontDisplay:()=>YGt,FontStyle:()=>aLe,FontWeight:()=>uLe,FooterLinksConfig:()=>e7t,FooterNavThemeConfig:()=>L7t,FullStoryAnalyticsConfig:()=>hGt,GitLibraryInputSchema:()=>f7t,GithubEditThisPageConfig:()=>VGt,GoogleAnalytics4Config:()=>gGt,GtmConfig:()=>AGt,HeaderPosition:()=>s7t,HttpSnippetLanguage:()=>WGt,HttpSnippetsConfig:()=>$Gt,IntegrationsConfig:()=>t7t,IntercomConfig:()=>yGt,InternalProduct:()=>Q7t,JsConfig:()=>o7t,JsConfigOptions:()=>vmt,JsFileConfig:()=>n7t,JsFileConfigSettings:()=>r7t,JsRemoteConfig:()=>i7t,JsScriptStrategy:()=>lLe,Language:()=>oLe,LanguageSwitcherThemeConfig:()=>U7t,LayoutConfig:()=>l7t,LibraryConfig:()=>p7t,LibraryConfiguration:()=>A7t,LibraryInputConfiguration:()=>m7t,LibraryLanguage:()=>h7t,LibraryName:()=>pLe,LibraryOutputConfiguration:()=>g7t,LibraryReferenceConfiguration:()=>H7t,LinkConfiguration:()=>nLe,LogoConfiguration:()=>y7t,MetadataConfig:()=>E7t,NavbarDropdownConfig:()=>v7t,NavbarGithubConfig:()=>w7t,NavbarGithubConfigWithOptions:()=>I7t,NavbarLink:()=>C7t,NavbarLinkConfig:()=>q9,NavigationConfig:()=>Jle,NavigationItem:()=>G9,PageActionOption:()=>T7t,PageActionOptions:()=>D7t,PageActionsConfig:()=>R7t,PageActionsThemeConfig:()=>z7t,PageConfiguration:()=>Yj,PathLibraryInputSchema:()=>d7t,PlaygroundButtonSettings:()=>IGt,PlaygroundSettings:()=>z9,PostHogConfig:()=>bGt,ProductConfig:()=>N7t,ProductConfigBase:()=>dLe,ProductFileConfig:()=>$Wo,ProductPath:()=>HWo,ProductSwitcherThemeConfig:()=>V7t,ProgrammingLanguage:()=>j7t,RedirectConfig:()=>M7t,RelativeProductPath:()=>J7t,Role:()=>rLe,RoleId:()=>n_e,SearchbarPlacement:()=>a7t,SectionConfiguration:()=>K7t,SegmentConfig:()=>EGt,SidebarThemeConfig:()=>q7t,SnippetLanguageConfiguration:()=>Kj,SnippetsConfiguration:()=>CGt,SwitcherPlacement:()=>u7t,TabConfig:()=>Yle,TabId:()=>Xj,TabVariant:()=>_7t,TabbedNavigationConfig:()=>O7t,TabbedNavigationItem:()=>B7t,TabbedNavigationItemWithLayout:()=>x7t,TabbedNavigationItemWithVariants:()=>S7t,TabsPlacement:()=>c7t,TabsThemeConfig:()=>G7t,Target:()=>Jj,ThemeConfig:()=>W7t,TitleSource:()=>sLe,TwitterCardSetting:()=>b7t,UntabbedNavigationConfig:()=>P7t,VersionAvailability:()=>F7t,VersionConfig:()=>fLe,VersionFileConfig:()=>KWo,VersionedSnippetLanguageConfiguration:()=>wGt,WithFeatureFlags:()=>pd,WithPermissions:()=>fd,WithViewers:()=>Kle,docs:()=>H$n});var H$n={};Y(H$n,{AbsoluteProductPath:()=>cGt,AiChatConfig:()=>ymt,AiChatDatasource:()=>pGt,AiChatLocation:()=>fGt,AiChatModel:()=>dGt,AiChatWebsiteDatasource:()=>lGt,AiExamplesConfig:()=>mGt,AnalyticsConfig:()=>vGt,AnnouncementConfig:()=>Hle,ApiReferenceConfiguration:()=>_Gt,ApiReferenceEndpointConfiguration:()=>SGt,ApiReferenceLayoutItem:()=>V9,ApiReferenceOperationConfiguration:()=>BGt,ApiReferencePackageConfiguration:()=>OGt,ApiReferencePackageConfigurationWithOptions:()=>TGt,ApiReferenceSectionConfiguration:()=>PGt,Audience:()=>U9,AudienceId:()=>bmt,Availability:()=>Fw,BackgroundImageConfiguration:()=>RGt,BackgroundImageThemedConfig:()=>DGt,BodyThemeConfig:()=>FGt,ChangelogConfiguration:()=>kGt,ChangelogFolderRelativePath:()=>iLe,ColorConfig:()=>qb,ColorThemedConfig:()=>QGt,ColorsConfiguration:()=>NGt,ContentAlignment:()=>jGt,CssConfig:()=>MGt,CustomDomain:()=>LGt,CustomPageAction:()=>UGt,DocsConfiguration:()=>WWo,DocsInstance:()=>GGt,DocsSettingsConfig:()=>HGt,DocsTypographyConfig:()=>XGt,EditThisPageConfig:()=>qGt,EditThisPageLaunch:()=>zGt,ExperimentalConfig:()=>ZGt,ExternalProduct:()=>k7t,FeatureFlag:()=>Emt,FeatureFlagConfiguration:()=>xGt,FolderConfiguration:()=>$7t,FontConfig:()=>cLe,FontConfigPath:()=>JGt,FontConfigVariant:()=>KGt,FontDisplay:()=>YGt,FontStyle:()=>aLe,FontWeight:()=>uLe,FooterLinksConfig:()=>e7t,FooterNavThemeConfig:()=>L7t,FullStoryAnalyticsConfig:()=>hGt,GitLibraryInputSchema:()=>f7t,GithubEditThisPageConfig:()=>VGt,GoogleAnalytics4Config:()=>gGt,GtmConfig:()=>AGt,HeaderPosition:()=>s7t,HttpSnippetLanguage:()=>WGt,HttpSnippetsConfig:()=>$Gt,IntegrationsConfig:()=>t7t,IntercomConfig:()=>yGt,InternalProduct:()=>Q7t,JsConfig:()=>o7t,JsConfigOptions:()=>vmt,JsFileConfig:()=>n7t,JsFileConfigSettings:()=>r7t,JsRemoteConfig:()=>i7t,JsScriptStrategy:()=>lLe,Language:()=>oLe,LanguageSwitcherThemeConfig:()=>U7t,LayoutConfig:()=>l7t,LibraryConfig:()=>p7t,LibraryConfiguration:()=>A7t,LibraryInputConfiguration:()=>m7t,LibraryLanguage:()=>h7t,LibraryName:()=>pLe,LibraryOutputConfiguration:()=>g7t,LibraryReferenceConfiguration:()=>H7t,LinkConfiguration:()=>nLe,LogoConfiguration:()=>y7t,MetadataConfig:()=>E7t,NavbarDropdownConfig:()=>v7t,NavbarGithubConfig:()=>w7t,NavbarGithubConfigWithOptions:()=>I7t,NavbarLink:()=>C7t,NavbarLinkConfig:()=>q9,NavigationConfig:()=>Jle,NavigationItem:()=>G9,PageActionOption:()=>T7t,PageActionOptions:()=>D7t,PageActionsConfig:()=>R7t,PageActionsThemeConfig:()=>z7t,PageConfiguration:()=>Yj,PathLibraryInputSchema:()=>d7t,PlaygroundButtonSettings:()=>IGt,PlaygroundSettings:()=>z9,PostHogConfig:()=>bGt,ProductConfig:()=>N7t,ProductConfigBase:()=>dLe,ProductFileConfig:()=>$Wo,ProductPath:()=>HWo,ProductSwitcherThemeConfig:()=>V7t,ProgrammingLanguage:()=>j7t,RedirectConfig:()=>M7t,RelativeProductPath:()=>J7t,Role:()=>rLe,RoleId:()=>n_e,SearchbarPlacement:()=>a7t,SectionConfiguration:()=>K7t,SegmentConfig:()=>EGt,SidebarThemeConfig:()=>q7t,SnippetLanguageConfiguration:()=>Kj,SnippetsConfiguration:()=>CGt,SwitcherPlacement:()=>u7t,TabConfig:()=>Yle,TabId:()=>Xj,TabVariant:()=>_7t,TabbedNavigationConfig:()=>O7t,TabbedNavigationItem:()=>B7t,TabbedNavigationItemWithLayout:()=>x7t,TabbedNavigationItemWithVariants:()=>S7t,TabsPlacement:()=>c7t,TabsThemeConfig:()=>G7t,Target:()=>Jj,ThemeConfig:()=>W7t,TitleSource:()=>sLe,TwitterCardSetting:()=>b7t,UntabbedNavigationConfig:()=>P7t,VersionAvailability:()=>F7t,VersionConfig:()=>fLe,VersionFileConfig:()=>KWo,VersionedSnippetLanguageConfiguration:()=>wGt,WithFeatureFlags:()=>pd,WithPermissions:()=>fd,WithViewers:()=>Kle});var ie={};Y(ie,{JsonError:()=>Z4e,ParseError:()=>eLe,any:()=>DWo,bigint:()=>EWo,boolean:()=>RWo,booleanLiteral:()=>PWo,date:()=>vWo,discriminant:()=>VWo,enum_:()=>sGt,getObjectLikeUtils:()=>Y5,getObjectUtils:()=>r_e,getSchemaUtils:()=>ld,isProperty:()=>Jre,lazy:()=>IWo,lazyObject:()=>BWo,list:()=>uGt,never:()=>FWo,number:()=>kWo,object:()=>aGt,objectWithoutOptionalProperties:()=>SWo,optional:()=>V$n,property:()=>CWo,record:()=>MWo,set:()=>LWo,string:()=>QWo,stringLiteral:()=>TWo,transform:()=>q$n,undiscriminatedUnion:()=>zWo,union:()=>GWo,unknown:()=>NWo,withParsedProperties:()=>$$n});var nc={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function kf(e,t){return`Expected ${t}. Received ${fRc(e)}.`}function fRc(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function Dw(e){return{...e,json:bWo(e.json),parse:bWo(e.parse)}}function bWo(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
1459
|
-
`)),{ok:!0,value:t}):n}}function oGt(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var Z4e=class e extends Error{errors;constructor(t){super(t.map(oGt).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var eLe=class e extends Error{errors;constructor(t){super(t.map(oGt).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function ld(e){return{nullable:()=>dRc(e),optional:()=>V$n(e),optionalNullable:()=>mRc(e),transform:t=>q$n(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new eLe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new Z4e(n.errors)}}}function dRc(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>nc.NULLABLE};return{...t,...ld(t)}}function V$n(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>nc.OPTIONAL};return{...t,...ld(t)}}function mRc(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>nc.OPTIONAL_NULLABLE};return{...t,...ld(t)}}function q$n(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...ld(r)}}function EWo(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:kf(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:kf(t,"bigint")}]}:{ok:!0,value:t},getType:()=>nc.BIGINT};return{...Dw(e),...ld(e)}}var hRc=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function vWo(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:kf(t,"string")}]}:hRc.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:kf(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:kf(t,"Date object")}]},getType:()=>nc.DATE};return{...Dw(e),...ld(e)}}function Rw(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...Dw(r),...ld(r)}}}function sGt(e){let t=new Set(e);return Rw(nc.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:kf(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:kf(n,"enum")}]}:{ok:!0,value:n})()}function IWo(e){let t=G$n(e);return{...t,...ld(t)}}function G$n(e){return{parse:(t,r)=>tLe(e).parse(t,r),json:(t,r)=>tLe(e).json(t,r),getType:()=>tLe(e).getType()}}function tLe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function W$n(e){return Object.entries(e)}function gmt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function Kre(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function Amt(e){return Object.keys(e)}function wWo(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var gRc=Object.prototype.hasOwnProperty;function Y5(e){return{withParsedProperties:t=>$$n(e,t)}}function $$n(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(gRc.call(t,a)){let u=t[a];s[a]=typeof u=="function"?u(o.value):u}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Kre(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:kf(n,"object")}]};let o=new Set(Object.keys(t)),s=gmt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...ld(r),...Y5(r)}}function CWo(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Jre(e){return e.isProperty}var ARc=Object.prototype.hasOwnProperty;function aGt(e){let t;function r(){if(t==null){t={};for(let[d,f]of W$n(e)){let m=Jre(f)?f.rawKey:d,h=Jre(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of W$n(e)){let m=Jre(f)?f.rawKey:d,h=Jre(f)?f.valueSchema:f;yRc(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function u(){return i==null&&a(),i}function c(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>Jre(f)?f.rawKey:d),_getParsedProperties:()=>Amt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return xWo({value:d,requiredKeys:a(),requiredKeysSet:c(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let E=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return xWo({value:d,requiredKeys:u(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return Jre(g)?{transformedKey:g.rawKey,transform:A=>{let E=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:E})}}:{transformedKey:h,transform:A=>{let E=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>nc.OBJECT};return{...Dw(p),...ld(p),...Y5(p),...r_e(p)}}function xWo({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Kre(e))return{ok:!1,errors:[{path:s,message:kf(e,"object")}]};let a=t.length,u=[],c={};for(let l in e){if(!ARc.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?c[d.transformedKey]=f.value:(c[l]=p,u.push(...f.errors))}else switch(i){case"fail":u.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=p;break}}if(a>0)for(let l of t)l in e||u.push({path:s,message:`Missing required key "${l}"`});return u.length===0||o?{ok:!0,value:c}:{ok:!1,errors:u}}function r_e(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>_Wo({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>_Wo({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>nc.OBJECT};return{...r,...ld(r),...Y5(r),...r_e(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))t.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))r.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},getType:()=>nc.OBJECT};return{...n,...ld(n),...Y5(n),...r_e(n)}}}}function _Wo({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Kre(t))return{ok:!1,errors:[{path:i,message:kf(t,"object")}]};let o=new Set(e),[s,a]=wWo(Amt(t),l=>o.has(l)),u=r(gmt(t,a)),c=n(gmt(t,s));return u.ok&&c.ok?{ok:!0,value:{...u.value,...c.value}}:{ok:!1,errors:[...u.ok?[]:u.errors,...c.ok?[]:c.errors]}}function yRc(e){return!bRc(e)}function bRc(e){switch(e.getType()){case nc.ANY:case nc.UNKNOWN:case nc.OPTIONAL:case nc.OPTIONAL_NULLABLE:return!0;default:return!1}}function SWo(e){return aGt(e)}function BWo(e){let t={...G$n(e),_getRawProperties:()=>tLe(e)._getRawProperties(),_getParsedProperties:()=>tLe(e)._getParsedProperties()};return{...t,...ld(t),...Y5(t),...r_e(t)}}function uGt(e){let t={parse:(r,n)=>OWo(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>OWo(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>nc.LIST};return{...Dw(t),...ld(t)}}function OWo(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:kf(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function PWo(e){return Rw(nc.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:kf(r,`${e.toString()}`)}]})()}function TWo(e){return Rw(nc.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:kf(r,`"${e}"`)}]})()}var DWo=Rw(nc.ANY,e=>({ok:!0,value:e}));var RWo=Rw(nc.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kf(e,"boolean")}]});var FWo=Rw(nc.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var kWo=Rw(nc.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kf(e,"number")}]});var QWo=Rw(nc.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kf(e,"string")}]});var NWo=Rw(nc.UNKNOWN,e=>({ok:!0,value:e}));var ERc=Object.prototype.hasOwnProperty;function MWo(e,t){let r={parse:(n,i)=>jWo({value:n,isKeyNumeric:e.getType()===nc.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>jWo({value:n,isKeyNumeric:e.getType()===nc.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>nc.RECORD};return{...Dw(r),...ld(r)}}function jWo({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Kre(e))return{ok:!1,errors:[{path:i,message:kf(e,"object")}]};let o={},s=[];for(let a in e){if(!ERc.call(e,a))continue;let u=e[a];if(u===void 0)continue;let c=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(c=d)}let l=r(c),p=n(u,c);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function LWo(e){let t=uGt(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:kf(n,"Set")}]},getType:()=>nc.SET};return{...Dw(r),...ld(r)}}function zWo(e){let t={parse:(r,n)=>UWo((i,o)=>i.parse(r,o),e,n),json:(r,n)=>UWo((i,o)=>i.json(r,o),e,n),getType:()=>nc.UNDISCRIMINATED_UNION};return{...Dw(t),...ld(t)}}function UWo(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function VWo(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var vRc=Object.prototype.hasOwnProperty;function GWo(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=sGt(Amt(t)),o={parse:(s,a)=>qWo({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:u=>i.parse(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.parse(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>qWo({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:u=>i.json(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.json(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>nc.UNION};return{...Dw(o),...ld(o),...Y5(o)}}function qWo({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Kre(e))return{ok:!1,errors:[{path:a,message:kf(e,"object")}]};let u=e[t],c={};for(let f in e)vRc.call(e,f)&&f!==t&&(c[f]=e[f]);if(u==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(u);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...c}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(c,p);return d.ok?{ok:!0,value:{[r]:u,...d.value}}:d}var cGt=ie.object({href:ie.string()});var lGt=ie.object({url:ie.string(),title:ie.string().optional()});var pGt=ie.undiscriminatedUnion([lGt]);var fGt=ie.enum_(["docs","slack","discord"]);var dGt=ie.enum_(["claude-3.7","claude-4","command-a"]);var ymt=ie.object({model:dGt.optional(),systemPrompt:ie.property("system-prompt",ie.string().optional()),location:ie.list(fGt).optional(),datasources:ie.list(pGt).optional()});var mGt=ie.object({enabled:ie.boolean().optional(),style:ie.string().optional()});var hGt=ie.object({orgId:ie.property("org-id",ie.string())});var gGt=ie.object({measurementId:ie.property("measurement-id",ie.string())});var AGt=ie.object({containerId:ie.property("container-id",ie.string())});var yGt=ie.object({appId:ie.property("app-id",ie.string()),apiBase:ie.property("api-base",ie.string().optional())});var bGt=ie.object({apiKey:ie.property("api-key",ie.string()),endpoint:ie.string().optional()});var EGt=ie.object({writeKey:ie.property("write-key",ie.string())});var vGt=ie.object({segment:EGt.optional(),fullstory:hGt.optional(),intercom:yGt.optional(),posthog:bGt.optional(),gtm:AGt.optional(),ga4:gGt.optional()});var Hle=ie.object({message:ie.string()});var bmt=ie.string();var U9=ie.undiscriminatedUnion([bmt,ie.list(bmt)]);var Fw=ie.enum_(["stable","generally-available","in-development","pre-release","deprecated","beta"]);var IGt=ie.object({href:ie.string().optional()});var z9=ie.object({hidden:ie.boolean().optional(),environments:ie.list(ie.string()).optional(),button:IGt.optional(),oauth:ie.boolean().optional(),limitWebsocketMessagesPerConnection:ie.property("limit-websocket-messages-per-connection",ie.number().optional())});var wGt=ie.object({version:ie.string(),package:ie.string()});var Kj=ie.undiscriminatedUnion([ie.string(),wGt]);var CGt=ie.object({python:Kj.optional(),typescript:Kj.optional(),go:Kj.optional(),java:Kj.optional(),ruby:Kj.optional(),csharp:Kj.optional(),php:Kj.optional(),swift:Kj.optional(),rust:Kj.optional()});var Emt=ie.object({flag:ie.string(),fallbackValue:ie.property("fallback-value",ie.unknown().optional()),match:ie.unknown().optional()});var xGt=ie.undiscriminatedUnion([ie.string(),Emt,ie.list(Emt)]);var pd=ie.object({featureFlag:ie.property("feature-flag",xGt.optional())});var n_e=ie.string();var rLe=ie.undiscriminatedUnion([n_e,ie.list(n_e)]);var fd=ie.object({viewers:rLe.optional(),orphaned:ie.boolean().optional()});var _Gt=ie.object({api:ie.string(),apiName:ie.property("api-name",ie.string().optional()),openrpc:ie.string().optional(),audiences:U9.optional(),displayErrors:ie.property("display-errors",ie.boolean().optional()),tagDescriptionPages:ie.property("tag-description-pages",ie.boolean().optional()),snippets:CGt.optional(),postman:ie.string().optional(),summary:ie.string().optional(),layout:ie.list(ie.lazy(()=>V9)).optional(),collapsed:ie.undiscriminatedUnion([ie.boolean(),ie.stringLiteral("open-by-default")]).optional(),icon:ie.string().optional(),slug:ie.string().optional(),hidden:ie.boolean().optional(),availability:Fw.optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),alphabetized:ie.boolean().optional(),flattened:ie.boolean().optional(),paginated:ie.boolean().optional(),playground:z9.optional()}).extend(fd).extend(pd);var SGt=ie.object({endpoint:ie.string(),title:ie.string().optional(),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional(),availability:Fw.optional(),playground:z9.optional()}).extend(fd).extend(pd);var BGt=ie.object({operation:ie.string(),title:ie.string().optional(),slug:ie.string().optional(),hidden:ie.boolean().optional(),availability:Fw.optional()}).extend(fd).extend(pd);var Jj=ie.enum_(["_blank","_self","_parent","_top"]);var nLe=ie.object({link:ie.string(),href:ie.string(),icon:ie.string().optional(),target:Jj.optional()});var Yj=ie.object({page:ie.string(),path:ie.string(),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional(),noindex:ie.boolean().optional(),availability:Fw.optional()}).extend(fd).extend(pd);var V9=ie.undiscriminatedUnion([ie.string(),ie.record(ie.string(),ie.lazy(()=>OGt)),ie.lazyObject(()=>PGt),SGt,BGt,Yj,nLe]);var OGt=ie.undiscriminatedUnion([ie.list(ie.lazy(()=>V9)),ie.lazyObject(()=>TGt)]);var TGt=ie.object({title:ie.string().optional(),summary:ie.string().optional(),contents:ie.list(ie.lazy(()=>V9)).optional(),availability:Fw.optional(),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),playground:z9.optional()}).extend(fd).extend(pd);var PGt=ie.object({section:ie.string(),referencedPackages:ie.property("referenced-packages",ie.list(ie.string()).optional()),summary:ie.string().optional(),contents:ie.list(ie.lazy(()=>V9)).optional(),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),collapsed:ie.undiscriminatedUnion([ie.boolean(),ie.stringLiteral("open-by-default")]).optional(),collapsible:ie.boolean().optional(),collapsedByDefault:ie.property("collapsed-by-default",ie.boolean().optional()),availability:Fw.optional(),playground:z9.optional()}).extend(fd).extend(pd);var DGt=ie.object({dark:ie.string().optional(),light:ie.string().optional()});var RGt=ie.undiscriminatedUnion([ie.string(),DGt]);var FGt=ie.enum_(["default","canvas"]);var iLe=ie.string();var kGt=ie.object({changelog:iLe,title:ie.string().optional(),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional()}).extend(fd).extend(pd);var QGt=ie.object({dark:ie.string().optional(),light:ie.string().optional()});var qb=ie.undiscriminatedUnion([ie.string(),QGt]);var NGt=ie.object({accentPrimary:ie.property("accent-primary",qb.optional()),accentPrimaryDeprecated:ie.property("accentPrimary",qb.optional()),background:qb.optional(),border:qb.optional(),sidebarBackground:ie.property("sidebar-background",qb.optional()),headerBackground:ie.property("header-background",qb.optional()),cardBackground:ie.property("card-background",qb.optional()),accent1:ie.property("accent-1",qb.optional()),accent2:ie.property("accent-2",qb.optional()),accent3:ie.property("accent-3",qb.optional()),accent4:ie.property("accent-4",qb.optional()),accent5:ie.property("accent-5",qb.optional()),accent6:ie.property("accent-6",qb.optional()),accent7:ie.property("accent-7",qb.optional()),accent8:ie.property("accent-8",qb.optional()),accent9:ie.property("accent-9",qb.optional()),accent10:ie.property("accent-10",qb.optional()),accent11:ie.property("accent-11",qb.optional()),accent12:ie.property("accent-12",qb.optional())});var jGt=ie.enum_(["center","left"]);var MGt=ie.undiscriminatedUnion([ie.string(),ie.list(ie.string())]);var LGt=ie.undiscriminatedUnion([ie.string(),ie.list(ie.string())]);var UGt=ie.object({title:ie.string(),subtitle:ie.string().optional(),url:ie.string(),icon:ie.string().optional(),default:ie.boolean().optional()});var zGt=ie.enum_(["github","dashboard"]);var VGt=ie.object({host:ie.string().optional(),owner:ie.string(),repo:ie.string(),branch:ie.string().optional()});var qGt=ie.object({github:VGt.optional(),launch:zGt.optional()});var GGt=ie.object({url:ie.string(),customDomain:ie.property("custom-domain",LGt.optional()),private:ie.boolean().optional(),editThisPage:ie.property("edit-this-page",qGt.optional()),audiences:U9.optional()});var WGt=ie.enum_(["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]);var $Gt=ie.undiscriminatedUnion([ie.boolean(),ie.list(WGt)]);var oLe=ie.enum_(["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]);var sLe=ie.enum_(["frontmatter","filename"]);var HGt=ie.object({searchText:ie.property("search-text",ie.string().optional()),disableSearch:ie.property("disable-search",ie.boolean().optional()),darkModeCode:ie.property("dark-mode-code",ie.boolean().optional()),defaultSearchFilters:ie.property("default-search-filters",ie.boolean().optional()),httpSnippets:ie.property("http-snippets",$Gt.optional()),hide404Page:ie.property("hide-404-page",ie.boolean().optional()),useJavascriptAsTypescript:ie.property("use-javascript-as-typescript",ie.boolean().optional()),disableExplorerProxy:ie.property("disable-explorer-proxy",ie.boolean().optional()),disableAnalytics:ie.property("disable-analytics",ie.boolean().optional()),language:oLe.optional(),folderTitleSource:ie.property("folder-title-source",sLe.optional()),substituteEnvVars:ie.property("substitute-env-vars",ie.boolean().optional())});var aLe=ie.enum_(["normal","italic"]);var uLe=ie.undiscriminatedUnion([ie.string(),ie.number()]);var KGt=ie.object({path:ie.string(),weight:uLe.optional(),style:aLe.optional()});var JGt=ie.undiscriminatedUnion([ie.string(),KGt]);var YGt=ie.enum_(["auto","block","swap","fallback","optional"]);var cLe=ie.object({name:ie.string().optional(),path:ie.string().optional(),weight:uLe.optional(),style:aLe.optional(),paths:ie.list(JGt).optional(),display:YGt.optional(),fallback:ie.list(ie.string()).optional(),fontVariationSettings:ie.property("font-variation-settings",ie.string().optional())});var XGt=ie.object({headingsFont:cLe.optional(),bodyFont:cLe.optional(),codeFont:cLe.optional()});var ZGt=ie.object({mdxComponents:ie.property("mdx-components",ie.list(ie.string()).optional()),disableStreamToggle:ie.property("disable-stream-toggle",ie.boolean().optional()),openapiParserV2:ie.property("openapi-parser-v2",ie.boolean().optional()),openapiParserV3:ie.property("openapi-parser-v3",ie.boolean().optional()),dynamicSnippets:ie.property("dynamic-snippets",ie.boolean().optional()),aiExamples:ie.property("ai-examples",ie.boolean().optional()),aiExampleStyleInstructions:ie.property("ai-example-style-instructions",ie.string().optional()),excludeApis:ie.property("exclude-apis",ie.boolean().optional()),basepathAware:ie.property("basepath-aware",ie.boolean().optional())});var e7t=ie.object({github:ie.string().optional(),twitter:ie.string().optional(),x:ie.string().optional(),linkedin:ie.string().optional(),youtube:ie.string().optional(),instagram:ie.string().optional(),facebook:ie.string().optional(),discord:ie.string().optional(),slack:ie.string().optional(),hackernews:ie.string().optional(),medium:ie.string().optional(),website:ie.string().optional()});var t7t=ie.object({intercom:ie.string().optional()});var lLe=ie.enum_(["beforeInteractive","afterInteractive","lazyOnload"]);var r7t=ie.object({path:ie.string(),strategy:lLe.optional()});var n7t=ie.undiscriminatedUnion([ie.string(),r7t]);var i7t=ie.object({url:ie.string(),strategy:lLe.optional()});var vmt=ie.undiscriminatedUnion([i7t,n7t]);var o7t=ie.undiscriminatedUnion([vmt,ie.list(vmt)]);var s7t=ie.enum_(["fixed","static"]);var a7t=ie.enum_(["header","header-tabs","sidebar"]);var u7t=ie.enum_(["header","sidebar"]);var c7t=ie.enum_(["header","sidebar"]);var l7t=ie.object({pageWidth:ie.property("page-width",ie.string().optional()),contentWidth:ie.property("content-width",ie.string().optional()),sidebarWidth:ie.property("sidebar-width",ie.string().optional()),headerHeight:ie.property("header-height",ie.string().optional()),searchbarPlacement:ie.property("searchbar-placement",a7t.optional()),tabsPlacement:ie.property("tabs-placement",c7t.optional()),switcherPlacement:ie.property("switcher-placement",u7t.optional()),contentAlignment:ie.property("content-alignment",jGt.optional()),headerPosition:ie.property("header-position",s7t.optional()),disableHeader:ie.property("disable-header",ie.boolean().optional()),hideNavLinks:ie.property("hide-nav-links",ie.boolean().optional()),hideFeedback:ie.property("hide-feedback",ie.boolean().optional())});var p7t=ie.object({doxyfile:ie.string().optional()});var f7t=ie.object({git:ie.string(),subpath:ie.string().optional()});var d7t=ie.object({path:ie.string()});var m7t=ie.undiscriminatedUnion([f7t,d7t]);var h7t=ie.enum_(["python","cpp"]);var g7t=ie.object({path:ie.string()});var A7t=ie.object({input:m7t,output:g7t,lang:h7t,config:p7t.optional()});var pLe=ie.string();var y7t=ie.object({dark:ie.string().optional(),light:ie.string().optional(),height:ie.number().optional(),href:ie.string().optional(),rightText:ie.property("right-text",ie.string().optional())});var b7t=ie.enum_(["summary","summary_large_image","app","player"]);var E7t=ie.object({ogSiteName:ie.property("og:site_name",ie.string().optional()),ogTitle:ie.property("og:title",ie.string().optional()),ogDescription:ie.property("og:description",ie.string().optional()),ogUrl:ie.property("og:url",ie.string().optional()),ogImage:ie.property("og:image",ie.string().optional()),ogImageWidth:ie.property("og:image:width",ie.number().optional()),ogImageHeight:ie.property("og:image:height",ie.number().optional()),ogLocale:ie.property("og:locale",ie.string().optional()),ogLogo:ie.property("og:logo",ie.string().optional()),twitterTitle:ie.property("twitter:title",ie.string().optional()),twitterDescription:ie.property("twitter:description",ie.string().optional()),twitterHandle:ie.property("twitter:handle",ie.string().optional()),twitterImage:ie.property("twitter:image",ie.string().optional()),twitterSite:ie.property("twitter:site",ie.string().optional()),twitterUrl:ie.property("twitter:url",ie.string().optional()),twitterCard:ie.property("twitter:card",b7t.optional()),ogDynamic:ie.property("og:dynamic",ie.boolean().optional()),ogBackgroundImage:ie.property("og:background-image",ie.string().optional()),canonicalHost:ie.property("canonical-host",ie.string().optional())});var Kle=ie.object({viewers:rLe.optional()});var q9=ie.object({href:ie.string().optional(),target:Jj.optional(),url:ie.string().optional(),text:ie.string().optional(),icon:ie.string().optional(),rightIcon:ie.string().optional(),rounded:ie.boolean().optional()}).extend(Kle);var v7t=ie.object({links:ie.list(q9),text:ie.string().optional(),icon:ie.string().optional(),rightIcon:ie.string().optional(),rounded:ie.boolean().optional()}).extend(Kle);var I7t=ie.object({url:ie.string(),target:Jj.optional()}).extend(Kle);var w7t=ie.undiscriminatedUnion([ie.string(),I7t]);var C7t=ie.union("type",{filled:q9,outlined:q9,minimal:q9,github:ie.object({value:w7t}),dropdown:v7t,primary:q9,secondary:q9}).transform({transform:e=>e,untransform:e=>e});var Xj=ie.string();var x7t=ie.object({tab:Xj,layout:ie.list(ie.lazy(()=>G9)).optional()});var _7t=ie.object({title:ie.string(),subtitle:ie.string().optional(),icon:ie.string().optional(),layout:ie.list(ie.lazy(()=>G9)),slug:ie.string().optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),hidden:ie.boolean().optional(),default:ie.boolean().optional()}).extend(fd).extend(pd);var S7t=ie.object({tab:Xj,variants:ie.list(_7t)});var B7t=ie.undiscriminatedUnion([x7t,S7t]);var O7t=ie.list(B7t);var P7t=ie.list(ie.lazy(()=>G9));var Jle=ie.undiscriminatedUnion([P7t,O7t]);var T7t=ie.enum_(["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]);var D7t=ie.object({copyPage:ie.property("copy-page",ie.boolean().optional()),viewAsMarkdown:ie.property("view-as-markdown",ie.boolean().optional()),askAi:ie.property("ask-ai",ie.boolean().optional()),chatgpt:ie.boolean().optional(),claude:ie.boolean().optional(),cursor:ie.boolean().optional(),vscode:ie.boolean().optional(),custom:ie.list(UGt).optional()});var R7t=ie.object({default:T7t.optional(),options:D7t.optional()});var F7t=ie.enum_(["deprecated","ga","stable","beta"]);var fLe=ie.object({displayName:ie.property("display-name",ie.string()),path:ie.string(),slug:ie.string().optional(),availability:F7t.optional(),audiences:U9.optional(),hidden:ie.boolean().optional(),announcement:Hle.optional()}).extend(fd).extend(pd);var dLe=ie.object({displayName:ie.property("display-name",ie.string()),subtitle:ie.string().optional(),icon:ie.string().optional(),image:ie.string().optional(),versions:ie.list(fLe).optional(),audiences:U9.optional()}).extend(fd).extend(pd);var k7t=ie.object({href:ie.string(),target:Jj.optional()}).extend(dLe);var Q7t=ie.object({path:ie.string(),slug:ie.string().optional(),announcement:Hle.optional()}).extend(dLe);var N7t=ie.undiscriminatedUnion([Q7t,k7t]);var j7t=ie.enum_(["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]);var M7t=ie.object({source:ie.string(),destination:ie.string(),permanent:ie.boolean().optional()});var Yle=ie.object({displayName:ie.property("display-name",ie.string()),icon:ie.string().optional(),slug:ie.string().optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),hidden:ie.boolean().optional(),href:ie.string().optional(),target:Jj.optional(),changelog:iLe.optional()}).extend(fd).extend(pd);var L7t=ie.enum_(["default","minimal"]);var U7t=ie.enum_(["default","minimal"]);var z7t=ie.enum_(["default","toolbar"]);var V7t=ie.enum_(["default","toggle"]);var q7t=ie.enum_(["default","minimal"]);var G7t=ie.enum_(["default","bubble"]);var W7t=ie.object({sidebar:q7t.optional(),body:FGt.optional(),tabs:G7t.optional(),pageActions:ie.property("page-actions",z7t.optional()),footerNav:ie.property("footer-nav",L7t.optional()),languageSwitcher:ie.property("language-switcher",U7t.optional()),productSwitcher:ie.property("product-switcher",V7t.optional())});var WWo=ie.object({instances:ie.list(GGt),title:ie.string().optional(),libraries:ie.record(pLe,A7t).optional(),analytics:vGt.optional(),announcement:Hle.optional(),roles:ie.list(n_e).optional(),tabs:ie.record(Xj,Yle).optional(),versions:ie.list(fLe).optional(),products:ie.list(N7t).optional(),landingPage:ie.property("landing-page",Yj.optional()),navigation:Jle.optional(),navbarLinks:ie.property("navbar-links",ie.list(C7t).optional()),footerLinks:ie.property("footer-links",e7t.optional()),pageActions:ie.property("page-actions",R7t.optional()),experimental:ZGt.optional(),defaultLanguage:ie.property("default-language",j7t.optional()),languages:ie.list(oLe).optional(),aiChat:ie.property("ai-chat",ymt.optional()),aiSearch:ie.property("ai-search",ymt.optional()),aiExamples:ie.property("ai-examples",mGt.optional()),metadata:E7t.optional(),redirects:ie.list(M7t).optional(),logo:y7t.optional(),favicon:ie.string().optional(),backgroundImage:ie.property("background-image",RGt.optional()),colors:NGt.optional(),typography:XGt.optional(),layout:l7t.optional(),settings:HGt.optional(),theme:W7t.optional(),integrations:t7t.optional(),css:MGt.optional(),js:o7t.optional(),header:ie.string().optional(),footer:ie.string().optional()});var $7t=ie.object({folder:ie.string(),title:ie.string().optional(),titleSource:ie.property("title-source",sLe.optional()),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),collapsed:ie.undiscriminatedUnion([ie.boolean(),ie.stringLiteral("open-by-default")]).optional(),collapsible:ie.boolean().optional(),collapsedByDefault:ie.property("collapsed-by-default",ie.boolean().optional()),availability:Fw.optional()}).extend(fd).extend(pd);var H7t=ie.object({library:pLe,title:ie.string().optional(),slug:ie.string().optional()}).extend(fd).extend(pd);var G9=ie.undiscriminatedUnion([Yj,ie.lazyObject(()=>K7t),_Gt,H7t,nLe,kGt,$7t]);var $Wo=ie.object({tabs:ie.record(Xj,Yle).optional(),landingPage:ie.property("landing-page",Yj.optional()),navigation:Jle});var J7t=ie.object({displayName:ie.property("display-name",ie.string()),path:ie.string(),slug:ie.string().optional()}).extend(fd).extend(pd);var HWo=ie.undiscriminatedUnion([J7t,cGt]);var K7t=ie.object({section:ie.string(),path:ie.string().optional(),contents:ie.list(ie.lazy(()=>G9)),collapsed:ie.undiscriminatedUnion([ie.boolean(),ie.stringLiteral("open-by-default")]).optional(),collapsible:ie.boolean().optional(),collapsedByDefault:ie.property("collapsed-by-default",ie.boolean().optional()),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),availability:Fw.optional()}).extend(fd).extend(pd);var KWo=ie.object({tabs:ie.record(Xj,Yle).optional(),landingPage:ie.property("landing-page",Yj.optional()),navigation:Jle});var JWo=require("fs/promises");var IRc=/\r?\n/;async function Xle({absolutePathToFernignore:e}){let t=(await(0,JWo.readFile)(e)).toString();return YWo(t)}function YWo(e){return[lS,...e.trim().split(IRc).map(t=>{let r=t.indexOf("#");return r!==-1?t.slice(0,r).trim():t.trim()}).filter(t=>t.length>0)]}var bn={};Y(bn,{API_ORIGIN_LOCATION_KEY:()=>QVo,API_SETTINGS_KEY:()=>LVo,ASYNC_API_LOCATION_KEY:()=>NVo,CoerceConstsTo:()=>p$o,DEFAULT_GROUP_GENERATORS_CONFIG_KEY:()=>b4e,DEFAULT_GROUP_NAME:()=>Pdt,DefaultIntegerFormat:()=>f$o,ExampleStyle:()=>d$o,FormParameterEncoding:()=>m$o,GenerationLanguage:()=>XWo,GithubCommitAndReleaseMode:()=>E$o,GithubLicenseType:()=>I$o,GithubSelfhostedMode:()=>v$o,Language:()=>h$o,MessageNamingSettingsSchema:()=>g$o,ModelProvider:()=>t$o,OPENAPI_LOCATION_KEY:()=>jVo,OPENAPI_OVERRIDES_LOCATION_KEY:()=>MVo,PathParameterOrder:()=>A$o,RemoveDiscriminantsFromSchemas:()=>y$o,UnionSettingsSchema:()=>b$o,ai:()=>J$n,fernDefinition:()=>X$n,generators:()=>Z$n,getPackageName:()=>ZWo,group:()=>eHn,isApiConfigurationV2Schema:()=>Z$o,isAsyncApiSpecSchema:()=>eHo,isConjureSchema:()=>tHo,isGraphQLSpecSchema:()=>rHo,isNamespacedApiConfiguration:()=>nHo,isOpenApiSpecSchema:()=>iHo,isOpenRpcSpecSchema:()=>oHo,isProtoSpecSchema:()=>sHo,isRawProtobufAPIDefinitionSchema:()=>e$o,license:()=>tHn,replay:()=>w$o,reviewers:()=>C$o,serialization:()=>wHn});var XWo={TYPESCRIPT:"typescript",JAVA:"java",PYTHON:"python",GO:"go",RUBY:"ruby",CSHARP:"csharp",SWIFT:"swift",PHP:"php",RUST:"rust"};function ZWo({generatorInvocation:e}){return e.language==="go"?wRc(e):e.outputMode._visit({downloadFiles:()=>{},github:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),githubV2:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),publish:()=>{},publishV2:()=>{},_other:()=>{}})}function wRc(e){return e.outputMode._visit({downloadFiles:()=>{},github:t=>`github.com/${t.owner}/${t.repo}`,githubV2:t=>`github.com/${t.owner}/${t.repo}`,publish:()=>{},publishV2:()=>{},_other:()=>{}})}function e$o(e){return typeof e!="string"&&"proto"in e}var J$n={};Y(J$n,{ModelProvider:()=>t$o});var t$o={Openai:"openai",Anthropic:"anthropic",Bedrock:"bedrock"};var X$n={};Y(X$n,{AvailabilityStatusSchema:()=>n$o,auth:()=>r$o,availability:()=>Y$n,commons:()=>i$o,encoding:()=>o$o,environments:()=>s$o,file:()=>a$o,service:()=>u$o,types:()=>c$o,validation:()=>l$o});var r$o={};var Y$n={};Y(Y$n,{AvailabilityStatusSchema:()=>n$o});var n$o={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var i$o={};var o$o={};var s$o={};var a$o={};var u$o={};var c$o={};var l$o={};var Z$n={};Y(Z$n,{CoerceConstsTo:()=>p$o,DefaultIntegerFormat:()=>f$o,ExampleStyle:()=>d$o,FormParameterEncoding:()=>m$o,Language:()=>h$o,MessageNamingSettingsSchema:()=>g$o,PathParameterOrder:()=>A$o,RemoveDiscriminantsFromSchemas:()=>y$o,UnionSettingsSchema:()=>b$o});var p$o={Literals:"literals",Enums:"enums"};var f$o={Int32:"int32",Int64:"int64",Uint32:"uint32",Uint64:"uint64"};var d$o={Minimal:"minimal",Comprehensive:"comprehensive"};var m$o={Form:"form",Json:"json"};var h$o={Java:"java",Python:"python",Go:"go",Ruby:"ruby",Csharp:"csharp",Typescript:"typescript",Php:"php",Rust:"rust",Swift:"swift"};var g$o={V1:"v1",V2:"v2"};var A$o={UrlOrder:"url-order",SpecOrder:"spec-order"};var y$o={Always:"always",Never:"never"};var b$o={V1:"v1"};var eHn={};Y(eHn,{GithubCommitAndReleaseMode:()=>E$o,GithubSelfhostedMode:()=>v$o});var E$o={Commit:"commit",Release:"release"};var v$o={PullRequest:"pull-request",Push:"push"};var tHn={};Y(tHn,{GithubLicenseType:()=>I$o});var I$o={Mit:"MIT",Apache:"Apache-2.0"};var w$o={};var C$o={};var wHn={};Y(wHn,{AiServicesSchema:()=>nWt,ApiConfigurationSchema:()=>u$t,ApiConfigurationSchemaInternal:()=>PLe,ApiConfigurationV2Schema:()=>s$t,ApiConfigurationV2SettingsSchema:()=>RLe,ApiConfigurationV2SpecsSchema:()=>FLe,ApiDefinitionList:()=>GWt,ApiDefinitionPathSchema:()=>rpe,ApiDefinitionSchema:()=>qWt,ApiDefinitionSettingsSchema:()=>_Le,ApiDefinitionWithOverridesSchema:()=>SLe,AsyncApiSettingsSchema:()=>DLe,AsyncApiSpecSchema:()=>e$t,BaseApiSettingsSchema:()=>TLe,CoerceConstsTo:()=>WWt,ConjureSchema:()=>ZWt,CratesOutputLocationSchema:()=>f$t,DefaultIntegerFormat:()=>$Wt,ExampleStyle:()=>c$t,FormParameterEncoding:()=>HWt,GeneratorApiSettingsSchema:()=>p$t,GeneratorGroupSchema:()=>F$t,GeneratorInvocationSchema:()=>R$t,GeneratorOutputSchema:()=>I$t,GeneratorPublishMetadataSchema:()=>_mt,GeneratorSnippetsSchema:()=>x$t,GeneratorsConfigurationSchema:()=>X$o,GeneratorsOpenApiObjectSchema:()=>Q$t,GeneratorsOpenApiSchema:()=>N$t,GithubCommitAndReleaseMode:()=>_$t,GithubCommitAndReleaseSchema:()=>S$t,GithubConfigurationSchema:()=>D$t,GithubLicenseCustomSchema:()=>w$t,GithubLicenseSchema:()=>eM,GithubLicenseType:()=>C$t,GithubPullRequestSchema:()=>B$t,GithubPushSchema:()=>O$t,GithubSelfhostedMode:()=>P$t,GithubSelfhostedSchema:()=>T$t,GraphQlSpecSchema:()=>t$t,Language:()=>j$t,LocalFileSystemOutputLocationSchema:()=>d$t,MavenOutputLocationSchema:()=>h$t,MavenOutputSignatureSchema:()=>m$t,MessageNamingSettingsSchema:()=>wLe,ModelName:()=>tWt,ModelProvider:()=>rWt,NamespacedApiConfigurationSchema:()=>a$t,NpmOutputLocationSchema:()=>g$t,NugetOutputLocationSchema:()=>A$t,OpenApiExampleGenerationSchema:()=>KWt,OpenApiFilterSchema:()=>JWt,OpenApiSettingsSchema:()=>npe,OpenApiSpecSchema:()=>r$t,OpenRpcSpecSchema:()=>n$t,OutputMetadataAuthor:()=>l$t,OutputMetadataSchema:()=>ipe,OverridesSchema:()=>Zj,PathParameterOrder:()=>CLe,PostmanOutputLocationSchema:()=>y$t,ProtobufApiDefinitionSchema:()=>OLe,ProtobufDefinitionSchema:()=>BLe,ProtobufSpecSchema:()=>i$t,PypiOutputLocationSchema:()=>E$t,PypiOutputMetadataSchema:()=>b$t,ReadmeCustomSectionSchema:()=>M$t,ReadmeEndpointObjectSchema:()=>L$t,ReadmeEndpointSchema:()=>Smt,ReadmeSchema:()=>U$t,RemoveDiscriminantsFromSchemas:()=>xLe,ReplayConfigSchema:()=>k$t,RequestOrResponseExampleGenerationSchema:()=>Cmt,ResolveAliases:()=>XWt,ResolveAliasesSchema:()=>YWt,ReviewerSchema:()=>xmt,ReviewersSchema:()=>ope,RubyGemsOutputLocationSchema:()=>v$t,SpecSchema:()=>o$t,UnionSettingsSchema:()=>VWt,WhitelabelConfigurationSchema:()=>V$t,WhitelabelGithubConfigurationSchema:()=>z$t,ai:()=>aHn,fernDefinition:()=>AHn,generators:()=>yHn,group:()=>bHn,license:()=>EHn,replay:()=>vHn,reviewers:()=>IHn});var aHn={};Y(aHn,{AiServicesSchema:()=>nWt,ModelName:()=>tWt,ModelProvider:()=>rWt});var ve={};Y(ve,{JsonError:()=>mLe,ParseError:()=>hLe,any:()=>j$o,bigint:()=>_$o,boolean:()=>M$o,booleanLiteral:()=>Q$o,date:()=>S$o,discriminant:()=>K$o,enum_:()=>X7t,getObjectLikeUtils:()=>X5,getObjectUtils:()=>i_e,getSchemaUtils:()=>dd,isProperty:()=>Xre,lazy:()=>B$o,lazyObject:()=>F$o,list:()=>eWt,never:()=>L$o,number:()=>U$o,object:()=>Z7t,objectWithoutOptionalProperties:()=>R$o,optional:()=>rHn,property:()=>P$o,record:()=>G$o,set:()=>W$o,string:()=>z$o,stringLiteral:()=>N$o,transform:()=>nHn,undiscriminatedUnion:()=>H$o,union:()=>Y$o,unknown:()=>V$o,withParsedProperties:()=>sHn});var ic={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function Qf(e,t){return`Expected ${t}. Received ${CRc(e)}.`}function CRc(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function Qw(e){return{...e,json:x$o(e.json),parse:x$o(e.parse)}}function x$o(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
1460
|
-
`)),{ok:!0,value:t}):n}}function Y7t(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var mLe=class e extends Error{errors;constructor(t){super(t.map(Y7t).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var hLe=class e extends Error{errors;constructor(t){super(t.map(Y7t).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function dd(e){return{nullable:()=>xRc(e),optional:()=>rHn(e),optionalNullable:()=>_Rc(e),transform:t=>nHn(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new hLe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new mLe(n.errors)}}}function xRc(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>ic.NULLABLE};return{...t,...dd(t)}}function rHn(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>ic.OPTIONAL};return{...t,...dd(t)}}function _Rc(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>ic.OPTIONAL_NULLABLE};return{...t,...dd(t)}}function nHn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...dd(r)}}function _$o(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:Qf(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:Qf(t,"bigint")}]}:{ok:!0,value:t},getType:()=>ic.BIGINT};return{...Qw(e),...dd(e)}}var SRc=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function S$o(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Qf(t,"string")}]}:SRc.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:Qf(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:Qf(t,"Date object")}]},getType:()=>ic.DATE};return{...Qw(e),...dd(e)}}function Nw(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...Qw(r),...dd(r)}}}function X7t(e){let t=new Set(e);return Nw(ic.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:Qf(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:Qf(n,"enum")}]}:{ok:!0,value:n})()}function B$o(e){let t=iHn(e);return{...t,...dd(t)}}function iHn(e){return{parse:(t,r)=>gLe(e).parse(t,r),json:(t,r)=>gLe(e).json(t,r),getType:()=>gLe(e).getType()}}function gLe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function oHn(e){return Object.entries(e)}function Imt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function Yre(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function wmt(e){return Object.keys(e)}function O$o(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var BRc=Object.prototype.hasOwnProperty;function X5(e){return{withParsedProperties:t=>sHn(e,t)}}function sHn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(BRc.call(t,a)){let u=t[a];s[a]=typeof u=="function"?u(o.value):u}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Yre(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Qf(n,"object")}]};let o=new Set(Object.keys(t)),s=Imt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...dd(r),...X5(r)}}function P$o(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Xre(e){return e.isProperty}var ORc=Object.prototype.hasOwnProperty;function Z7t(e){let t;function r(){if(t==null){t={};for(let[d,f]of oHn(e)){let m=Xre(f)?f.rawKey:d,h=Xre(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of oHn(e)){let m=Xre(f)?f.rawKey:d,h=Xre(f)?f.valueSchema:f;PRc(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function u(){return i==null&&a(),i}function c(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>Xre(f)?f.rawKey:d),_getParsedProperties:()=>wmt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return T$o({value:d,requiredKeys:a(),requiredKeysSet:c(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let E=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return T$o({value:d,requiredKeys:u(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return Xre(g)?{transformedKey:g.rawKey,transform:A=>{let E=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:E})}}:{transformedKey:h,transform:A=>{let E=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>ic.OBJECT};return{...Qw(p),...dd(p),...X5(p),...i_e(p)}}function T$o({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Yre(e))return{ok:!1,errors:[{path:s,message:Qf(e,"object")}]};let a=t.length,u=[],c={};for(let l in e){if(!ORc.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?c[d.transformedKey]=f.value:(c[l]=p,u.push(...f.errors))}else switch(i){case"fail":u.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=p;break}}if(a>0)for(let l of t)l in e||u.push({path:s,message:`Missing required key "${l}"`});return u.length===0||o?{ok:!0,value:c}:{ok:!1,errors:u}}function i_e(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>D$o({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>D$o({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>ic.OBJECT};return{...r,...dd(r),...X5(r),...i_e(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))t.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))r.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},getType:()=>ic.OBJECT};return{...n,...dd(n),...X5(n),...i_e(n)}}}}function D$o({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Yre(t))return{ok:!1,errors:[{path:i,message:Qf(t,"object")}]};let o=new Set(e),[s,a]=O$o(wmt(t),l=>o.has(l)),u=r(Imt(t,a)),c=n(Imt(t,s));return u.ok&&c.ok?{ok:!0,value:{...u.value,...c.value}}:{ok:!1,errors:[...u.ok?[]:u.errors,...c.ok?[]:c.errors]}}function PRc(e){return!TRc(e)}function TRc(e){switch(e.getType()){case ic.ANY:case ic.UNKNOWN:case ic.OPTIONAL:case ic.OPTIONAL_NULLABLE:return!0;default:return!1}}function R$o(e){return Z7t(e)}function F$o(e){let t={...iHn(e),_getRawProperties:()=>gLe(e)._getRawProperties(),_getParsedProperties:()=>gLe(e)._getParsedProperties()};return{...t,...dd(t),...X5(t),...i_e(t)}}function eWt(e){let t={parse:(r,n)=>k$o(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>k$o(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>ic.LIST};return{...Qw(t),...dd(t)}}function k$o(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:Qf(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function Q$o(e){return Nw(ic.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Qf(r,`${e.toString()}`)}]})()}function N$o(e){return Nw(ic.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Qf(r,`"${e}"`)}]})()}var j$o=Nw(ic.ANY,e=>({ok:!0,value:e}));var M$o=Nw(ic.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Qf(e,"boolean")}]});var L$o=Nw(ic.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var U$o=Nw(ic.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Qf(e,"number")}]});var z$o=Nw(ic.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Qf(e,"string")}]});var V$o=Nw(ic.UNKNOWN,e=>({ok:!0,value:e}));var DRc=Object.prototype.hasOwnProperty;function G$o(e,t){let r={parse:(n,i)=>q$o({value:n,isKeyNumeric:e.getType()===ic.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>q$o({value:n,isKeyNumeric:e.getType()===ic.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>ic.RECORD};return{...Qw(r),...dd(r)}}function q$o({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Yre(e))return{ok:!1,errors:[{path:i,message:Qf(e,"object")}]};let o={},s=[];for(let a in e){if(!DRc.call(e,a))continue;let u=e[a];if(u===void 0)continue;let c=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(c=d)}let l=r(c),p=n(u,c);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function W$o(e){let t=eWt(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Qf(n,"Set")}]},getType:()=>ic.SET};return{...Qw(r),...dd(r)}}function H$o(e){let t={parse:(r,n)=>$$o((i,o)=>i.parse(r,o),e,n),json:(r,n)=>$$o((i,o)=>i.json(r,o),e,n),getType:()=>ic.UNDISCRIMINATED_UNION};return{...Qw(t),...dd(t)}}function $$o(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function K$o(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var RRc=Object.prototype.hasOwnProperty;function Y$o(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=X7t(wmt(t)),o={parse:(s,a)=>J$o({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:u=>i.parse(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.parse(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>J$o({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:u=>i.json(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.json(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>ic.UNION};return{...Qw(o),...dd(o),...X5(o)}}function J$o({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Yre(e))return{ok:!1,errors:[{path:a,message:Qf(e,"object")}]};let u=e[t],c={};for(let f in e)RRc.call(e,f)&&f!==t&&(c[f]=e[f]);if(u==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(u);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...c}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(c,p);return d.ok?{ok:!0,value:{[r]:u,...d.value}}:d}var tWt=ve.string();var rWt=ve.enum_(["openai","anthropic","bedrock"]);var nWt=ve.object({provider:rWt,model:tWt});var AHn={};Y(AHn,{AnyAuthItem:()=>iWt,AnyAuthSchemesSchema:()=>oWt,ApiAuthSchema:()=>yLe,AuthSchemeDeclarationSchema:()=>epe,AuthSchemeReferenceSchema:()=>ALe,AuthScope:()=>gWt,AuthVariable:()=>o_e,AvailabilitySchema:()=>CWt,AvailabilityStatusSchema:()=>ELe,AvailabilityUnionSchema:()=>xWt,BaseTypeReferenceSchema:()=>jWt,BasicAuthSchemeSchema:()=>uWt,BearerAuthSchemeSchema:()=>mWt,EncodingSchema:()=>BWt,EndpointSecuritySchema:()=>aWt,EndpointSecuritySchemaDetails:()=>sWt,EnvironmentSchema:()=>TWt,HeaderAuthSchemeSchema:()=>hWt,HttpHeaderSchema:()=>ILe,InferredAuthenticatedRequestHeader:()=>cWt,InferredBearerAuthSchema:()=>fWt,InferredGetTokenEndpointSchema:()=>pWt,InferredGetTokenEndpointSchemaObject:()=>lWt,ListValidationSchema:()=>RWt,MapValidationSchema:()=>FWt,MultipleBaseUrlsEnvironmentSchema:()=>OWt,NumberValidationSchema:()=>kWt,OAuthAccessTokenRequestPropertiesSchema:()=>AWt,OAuthAccessTokenResponsePropertiesSchema:()=>yWt,OAuthGetTokenEndpointSchema:()=>bWt,OAuthRefreshTokenEndpointSchema:()=>IWt,OAuthRefreshTokenRequestPropertiesSchema:()=>EWt,OAuthRefreshTokenResponsePropertiesSchema:()=>vWt,OAuthSchemeSchema:()=>wWt,ProtobufTypeSchema:()=>SWt,ServerVariableSchema:()=>vLe,SingleBaseUrlEnvironmentSchema:()=>PWt,StringValidationSchema:()=>QWt,TokenBearerAuthSchema:()=>dWt,TypeReferenceDeclarationWithEnvOverride:()=>UWt,TypeReferenceDeclarationWithEnvOverrideSchema:()=>LWt,TypeReferenceDeclarationWithName:()=>MWt,ValidationSchema:()=>NWt,WithAudiences:()=>tpe,WithAvailability:()=>_Wt,WithDocsSchema:()=>cy,WithEnvironmentVariable:()=>bLe,WithEnvironmentsSchema:()=>DWt,WithHeadersSchema:()=>zWt,WithName:()=>Zle,auth:()=>uHn,availability:()=>cHn,commons:()=>lHn,encoding:()=>pHn,environments:()=>fHn,file:()=>dHn,service:()=>mHn,types:()=>hHn,validation:()=>gHn});var uHn={};Y(uHn,{AnyAuthItem:()=>iWt,AnyAuthSchemesSchema:()=>oWt,ApiAuthSchema:()=>yLe,AuthSchemeDeclarationSchema:()=>epe,AuthSchemeReferenceSchema:()=>ALe,AuthScope:()=>gWt,AuthVariable:()=>o_e,BasicAuthSchemeSchema:()=>uWt,BearerAuthSchemeSchema:()=>mWt,EndpointSecuritySchema:()=>aWt,EndpointSecuritySchemaDetails:()=>sWt,HeaderAuthSchemeSchema:()=>hWt,InferredAuthenticatedRequestHeader:()=>cWt,InferredBearerAuthSchema:()=>fWt,InferredGetTokenEndpointSchema:()=>pWt,InferredGetTokenEndpointSchemaObject:()=>lWt,OAuthAccessTokenRequestPropertiesSchema:()=>AWt,OAuthAccessTokenResponsePropertiesSchema:()=>yWt,OAuthGetTokenEndpointSchema:()=>bWt,OAuthRefreshTokenEndpointSchema:()=>IWt,OAuthRefreshTokenRequestPropertiesSchema:()=>EWt,OAuthRefreshTokenResponsePropertiesSchema:()=>vWt,OAuthSchemeSchema:()=>wWt,TokenBearerAuthSchema:()=>dWt,WithEnvironmentVariable:()=>bLe});var cy=ve.object({docs:ve.string().optional()});var ALe=ve.object({scheme:ve.string()}).extend(cy);var iWt=ve.undiscriminatedUnion([ve.string(),ALe]);var oWt=ve.object({any:ve.list(iWt)}).extend(cy);var sWt=ve.object({});var aWt=ve.object({"endpoint-security":sWt}).extend(cy);var yLe=ve.undiscriminatedUnion([ve.string(),ALe,oWt,aWt]);var Zle=ve.object({name:ve.string().optional()});var bLe=ve.object({env:ve.string().optional()});var o_e=ve.object({omit:ve.boolean().optional()}).extend(bLe).extend(Zle);var uWt=ve.object({scheme:ve.stringLiteral("basic"),username:o_e.optional(),password:o_e.optional()}).extend(cy);var cWt=ve.object({"response-property":ve.string(),"header-name":ve.string(),"value-prefix":ve.string().optional()});var lWt=ve.object({endpoint:ve.string(),"expiry-response-property":ve.string().optional(),"authenticated-request-headers":ve.list(cWt).optional()});var pWt=ve.undiscriminatedUnion([ve.string(),lWt]);var fWt=ve.object({scheme:ve.stringLiteral("bearer"),"get-token":pWt}).extend(cy);var dWt=ve.object({scheme:ve.stringLiteral("bearer"),token:o_e.optional()}).extend(cy);var mWt=ve.undiscriminatedUnion([dWt,fWt]);var hWt=ve.object({header:ve.string(),type:ve.string().optional(),prefix:ve.string().optional()}).extend(bLe).extend(Zle).extend(cy);var gWt=ve.string();var AWt=ve.object({"client-id":ve.string().optional(),"client-secret":ve.string().optional(),scopes:ve.string().optional()});var yWt=ve.object({"access-token":ve.string().optional(),"expires-in":ve.string().optional(),"refresh-token":ve.string().optional()});var bWt=ve.object({endpoint:ve.string(),"request-properties":AWt.optional(),"response-properties":yWt.optional()});var EWt=ve.object({"refresh-token":ve.string()});var vWt=ve.object({"access-token":ve.string().optional(),"expires-in":ve.string().optional(),"refresh-token":ve.string().optional()});var IWt=ve.object({endpoint:ve.string(),"request-properties":EWt.optional(),"response-properties":vWt.optional()});var wWt=ve.object({scheme:ve.stringLiteral("oauth"),type:ve.stringLiteral("client-credentials"),scopes:ve.list(gWt).optional(),"client-id-env":ve.string().optional(),"client-secret-env":ve.string().optional(),"token-prefix":ve.string().optional(),"token-header":ve.string().optional(),"get-token":bWt,"refresh-token":IWt.optional()}).extend(cy);var epe=ve.undiscriminatedUnion([wWt,hWt,uWt,mWt]);var cHn={};Y(cHn,{AvailabilitySchema:()=>CWt,AvailabilityStatusSchema:()=>ELe,AvailabilityUnionSchema:()=>xWt});var ELe=ve.enum_(["in-development","pre-release","deprecated","generally-available"]);var CWt=ve.object({status:ELe,message:ve.string().optional()});var xWt=ve.undiscriminatedUnion([ELe,CWt]);var lHn={};Y(lHn,{WithAudiences:()=>tpe,WithAvailability:()=>_Wt,WithDocsSchema:()=>cy,WithName:()=>Zle});var tpe=ve.object({audiences:ve.list(ve.string()).optional()});var _Wt=ve.object({availability:xWt.optional()});var pHn={};Y(pHn,{EncodingSchema:()=>BWt,ProtobufTypeSchema:()=>SWt});var SWt=ve.object({type:ve.string()});var BWt=ve.object({proto:SWt.optional()});var fHn={};Y(fHn,{EnvironmentSchema:()=>TWt,MultipleBaseUrlsEnvironmentSchema:()=>OWt,ServerVariableSchema:()=>vLe,SingleBaseUrlEnvironmentSchema:()=>PWt,WithEnvironmentsSchema:()=>DWt});var vLe=ve.object({id:ve.string(),default:ve.string().optional(),values:ve.list(ve.string()).optional()});var OWt=ve.object({urls:ve.record(ve.string(),ve.string()),"url-templates":ve.record(ve.string(),ve.string()).optional(),"default-urls":ve.record(ve.string(),ve.string()).optional(),variables:ve.record(ve.string(),ve.list(vLe)).optional()}).extend(tpe).extend(cy);var PWt=ve.object({url:ve.string(),"default-url":ve.string().optional(),"url-template":ve.string().optional(),variables:ve.list(vLe).optional()}).extend(tpe).extend(cy);var TWt=ve.undiscriminatedUnion([ve.string(),PWt,OWt]);var DWt=ve.object({"default-url":ve.string().optional(),"default-environment":ve.string().optional(),environments:ve.record(ve.string(),TWt).optional()});var dHn={};Y(dHn,{WithHeadersSchema:()=>zWt});var RWt=ve.object({minItems:ve.number().optional(),maxItems:ve.number().optional()});var FWt=ve.object({minProperties:ve.number().optional(),maxProperties:ve.number().optional()});var kWt=ve.object({min:ve.number().optional(),max:ve.number().optional(),exclusiveMin:ve.boolean().optional(),exclusiveMax:ve.boolean().optional(),multipleOf:ve.number().optional()});var QWt=ve.object({minLength:ve.number().optional(),maxLength:ve.number().optional(),pattern:ve.string().optional(),format:ve.string().optional()});var NWt=ve.undiscriminatedUnion([QWt,kWt,RWt,FWt]);var jWt=ve.object({default:ve.unknown().optional(),encoding:BWt.optional(),validation:NWt.optional()}).extend(cy).extend(_Wt);var MWt=ve.object({type:ve.string()}).extend(jWt).extend(Zle).extend(tpe);var LWt=ve.object({env:ve.string().optional()}).extend(MWt);var UWt=ve.undiscriminatedUnion([ve.string(),LWt]);var ILe=UWt;var zWt=ve.object({headers:ve.record(ve.string(),ILe).optional()});var mHn={};Y(mHn,{HttpHeaderSchema:()=>ILe,TypeReferenceDeclarationWithEnvOverride:()=>UWt,TypeReferenceDeclarationWithEnvOverrideSchema:()=>LWt});var hHn={};Y(hHn,{BaseTypeReferenceSchema:()=>jWt,TypeReferenceDeclarationWithName:()=>MWt});var gHn={};Y(gHn,{ListValidationSchema:()=>RWt,MapValidationSchema:()=>FWt,NumberValidationSchema:()=>kWt,StringValidationSchema:()=>QWt,ValidationSchema:()=>NWt});var yHn={};Y(yHn,{ApiConfigurationSchema:()=>u$t,ApiConfigurationSchemaInternal:()=>PLe,ApiConfigurationV2Schema:()=>s$t,ApiConfigurationV2SettingsSchema:()=>RLe,ApiConfigurationV2SpecsSchema:()=>FLe,ApiDefinitionList:()=>GWt,ApiDefinitionPathSchema:()=>rpe,ApiDefinitionSchema:()=>qWt,ApiDefinitionSettingsSchema:()=>_Le,ApiDefinitionWithOverridesSchema:()=>SLe,AsyncApiSettingsSchema:()=>DLe,AsyncApiSpecSchema:()=>e$t,BaseApiSettingsSchema:()=>TLe,CoerceConstsTo:()=>WWt,ConjureSchema:()=>ZWt,DefaultIntegerFormat:()=>$Wt,ExampleStyle:()=>c$t,FormParameterEncoding:()=>HWt,GeneratorsConfigurationSchema:()=>X$o,GeneratorsOpenApiObjectSchema:()=>Q$t,GeneratorsOpenApiSchema:()=>N$t,GraphQlSpecSchema:()=>t$t,Language:()=>j$t,MessageNamingSettingsSchema:()=>wLe,NamespacedApiConfigurationSchema:()=>a$t,OpenApiExampleGenerationSchema:()=>KWt,OpenApiFilterSchema:()=>JWt,OpenApiSettingsSchema:()=>npe,OpenApiSpecSchema:()=>r$t,OpenRpcSpecSchema:()=>n$t,OutputMetadataAuthor:()=>l$t,OutputMetadataSchema:()=>ipe,OverridesSchema:()=>Zj,PathParameterOrder:()=>CLe,ProtobufApiDefinitionSchema:()=>OLe,ProtobufDefinitionSchema:()=>BLe,ProtobufSpecSchema:()=>i$t,ReadmeCustomSectionSchema:()=>M$t,ReadmeEndpointObjectSchema:()=>L$t,ReadmeEndpointSchema:()=>Smt,ReadmeSchema:()=>U$t,RemoveDiscriminantsFromSchemas:()=>xLe,RequestOrResponseExampleGenerationSchema:()=>Cmt,ResolveAliases:()=>XWt,ResolveAliasesSchema:()=>YWt,SpecSchema:()=>o$t,UnionSettingsSchema:()=>VWt,WhitelabelConfigurationSchema:()=>V$t,WhitelabelGithubConfigurationSchema:()=>z$t});var rpe=ve.string();var wLe=ve.enum_(["v1","v2"]);var CLe=ve.enum_(["url-order","spec-order"]);var xLe=ve.enum_(["always","never"]);var VWt=ve.enum_(["v1"]);var _Le=ve.object({"use-title":ve.boolean().optional(),unions:VWt.optional(),"message-naming":wLe.optional(),"respect-nullable-schemas":ve.boolean().optional(),"only-include-referenced-schemas":ve.boolean().optional(),"inline-path-parameters":ve.boolean().optional(),"idiomatic-request-names":ve.boolean().optional(),"wrap-references-to-nullable-in-optional":ve.boolean().optional(),"coerce-optional-schemas-to-nullable":ve.boolean().optional(),"group-environments-by-host":ve.boolean().optional(),"remove-discriminants-from-schemas":xLe.optional(),"path-parameter-order":CLe.optional()});var Zj=ve.undiscriminatedUnion([ve.string(),ve.list(ve.string())]);var SLe=ve.object({path:rpe,origin:ve.string().optional(),overrides:Zj.optional(),audiences:ve.list(ve.string()).optional(),settings:_Le.optional()});var BLe=ve.object({target:ve.string().optional(),root:ve.string(),overrides:Zj.optional(),"local-generation":ve.boolean().optional(),"from-openapi":ve.boolean().optional(),dependencies:ve.list(ve.string()).optional()});var OLe=ve.object({proto:BLe});var qWt=ve.undiscriminatedUnion([rpe,SLe,OLe]);var GWt=ve.list(qWt);var PLe=ve.undiscriminatedUnion([rpe,SLe,GWt,OLe]);var WWt=ve.enum_(["literals","enums"]);var TLe=ve.object({"respect-nullable-schemas":ve.boolean().optional(),"title-as-schema-name":ve.boolean().optional(),"optional-additional-properties":ve.boolean().optional(),"coerce-enums-to-literals":ve.boolean().optional(),"idiomatic-request-names":ve.boolean().optional(),"wrap-references-to-nullable-in-optional":ve.boolean().optional(),"coerce-optional-schemas-to-nullable":ve.boolean().optional(),"group-environments-by-host":ve.boolean().optional(),"remove-discriminants-from-schemas":xLe.optional(),"path-parameter-order":CLe.optional(),"resolve-schema-collisions":ve.boolean().optional(),"infer-forward-compatible":ve.boolean().optional(),"coerce-consts-to":WWt.optional()});var DLe=ve.object({"message-naming":wLe.optional()}).extend(TLe);var $Wt=ve.enum_(["int32","int64","uint32","uint64"]);var HWt=ve.enum_(["form","json"]);var Cmt=ve.object({"max-depth":ve.number().optional()});var KWt=ve.object({request:Cmt.optional(),response:Cmt.optional()});var JWt=ve.object({endpoints:ve.list(ve.string()).optional()});var YWt=ve.object({except:ve.list(ve.string()).optional()});var XWt=ve.undiscriminatedUnion([ve.boolean(),YWt]);var npe=ve.object({"only-include-referenced-schemas":ve.boolean().optional(),"inline-path-parameters":ve.boolean().optional(),"prefer-undiscriminated-unions-with-literals":ve.boolean().optional(),"object-query-parameters":ve.boolean().optional(),"respect-readonly-schemas":ve.boolean().optional(),"respect-forward-compatible-enums":ve.boolean().optional(),"use-bytes-for-binary-response":ve.boolean().optional(),"default-form-parameter-encoding":HWt.optional(),filter:JWt.optional(),"example-generation":KWt.optional(),"additional-properties-defaults-to":ve.boolean().optional(),"type-dates-as-strings":ve.boolean().optional(),"preserve-single-schema-oneof":ve.boolean().optional(),"inline-all-of-schemas":ve.boolean().optional(),"resolve-aliases":XWt.optional(),"group-multi-api-environments":ve.boolean().optional(),"default-integer-format":$Wt.optional()}).extend(TLe);var RLe=ve.object({}).extend(npe).extend(DLe);var ZWt=ve.object({conjure:ve.string()});var e$t=ve.object({asyncapi:ve.string(),origin:ve.string().optional(),overrides:Zj.optional(),namespace:ve.string().optional(),settings:DLe.optional()});var t$t=ve.object({graphql:ve.string(),origin:ve.string().optional(),overrides:ve.string().optional(),name:ve.string().optional()});var r$t=ve.object({openapi:ve.string(),origin:ve.string().optional(),overrides:Zj.optional(),overlays:ve.string().optional(),namespace:ve.string().optional(),settings:npe.optional()});var n$t=ve.object({openrpc:ve.string(),overrides:Zj.optional(),namespace:ve.string().optional()});var i$t=ve.object({proto:BLe});var o$t=ve.undiscriminatedUnion([r$t,e$t,i$t,n$t,t$t]);var FLe=ve.undiscriminatedUnion([ve.list(o$t),ZWt]);var s$t=ve.object({auth:yLe.optional(),"auth-schemes":ve.record(ve.string(),epe).optional(),specs:FLe,settings:RLe.optional()}).extend(zWt).extend(DWt);var a$t=ve.object({namespaces:ve.record(ve.string(),PLe)});var u$t=ve.undiscriminatedUnion([PLe,a$t,s$t]);var c$t=ve.enum_(["minimal","comprehensive"]);var l$t=ve.object({name:ve.string(),email:ve.string()});var ipe=ve.object({description:ve.string().optional(),authors:ve.list(l$t).optional()});var xmt=ve.object({name:ve.string()});var ope=ve.object({teams:ve.list(xmt).optional(),users:ve.list(xmt).optional()});var p$t=ve.object({auth:yLe.optional(),"auth-schemes":ve.record(ve.string(),epe).optional(),headers:ve.record(ve.string(),ILe).optional(),settings:RLe.optional(),specs:FLe.optional()});var f$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),token:ve.string().optional()});var d$t=ve.object({path:ve.string()});var m$t=ve.object({keyId:ve.string(),password:ve.string(),secretKey:ve.string()});var h$t=ve.object({url:ve.string().optional(),coordinate:ve.string(),username:ve.string().optional(),password:ve.string().optional(),signature:m$t.optional()});var g$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),token:ve.string().optional()});var A$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),"api-key":ve.string().optional()});var y$t=ve.object({"api-key":ve.string(),"workspace-id":ve.string(),"collection-id":ve.string().optional()});var b$t=ve.object({keywords:ve.list(ve.string()).optional(),"documentation-link":ve.string().optional(),"homepage-link":ve.string().optional()}).extend(ipe);var E$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),token:ve.string().optional(),username:ve.string().optional(),password:ve.string().optional(),metadata:b$t.optional()});var v$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),"api-key":ve.string().optional()});var I$t=ve.union("location",{npm:g$t,maven:h$t,pypi:E$t,postman:y$t,"local-file-system":d$t,nuget:A$t,rubygems:v$t,crates:f$t}).transform({transform:e=>e,untransform:e=>e});var w$t=ve.object({custom:ve.string()});var C$t=ve.enum_(["MIT","Apache-2.0"]);var eM=ve.undiscriminatedUnion([C$t,w$t]);var _mt=ve.object({"package-description":ve.string().optional(),email:ve.string().optional(),"reference-url":ve.string().optional(),author:ve.string().optional(),license:eM.optional()});var x$t=ve.object({path:ve.string()});var _$t=ve.enum_(["commit","release"]);var S$t=ve.object({repository:ve.string(),license:eM.optional(),mode:_$t.optional()});var B$t=ve.object({repository:ve.string(),branch:ve.string().optional(),license:eM.optional(),mode:ve.stringLiteral("pull-request"),reviewers:ope.optional()});var O$t=ve.object({repository:ve.string(),license:eM.optional(),mode:ve.stringLiteral("push"),branch:ve.string().optional()});var P$t=ve.enum_(["pull-request","push"]);var T$t=ve.object({uri:ve.string(),token:ve.string(),mode:P$t.optional(),branch:ve.string().optional(),license:eM.optional()});var D$t=ve.undiscriminatedUnion([T$t,S$t,B$t,O$t]);var R$t=ve.object({name:ve.string(),version:ve.string(),output:I$t.optional(),github:D$t.optional(),config:ve.unknown().optional(),metadata:_mt.optional(),keywords:ve.list(ve.string()).optional(),snippets:x$t.optional(),"ir-version":ve.string().optional(),"smart-casing":ve.boolean().optional(),api:p$t.optional(),"disable-examples":ve.boolean().optional(),"publish-metadata":_mt.optional(),autorelease:ve.boolean().optional()});var F$t=ve.object({audiences:ve.list(ve.string()).optional(),generators:ve.list(R$t),metadata:ipe.optional(),reviewers:ope.optional()});var k$t=ve.object({enabled:ve.boolean()});var Q$t=ve.object({path:ve.string(),origin:ve.string().optional(),overrides:ve.string().optional(),"disable-examples":ve.boolean().optional(),settings:npe});var N$t=ve.undiscriminatedUnion([Q$t,ve.string()]);var j$t=ve.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var M$t=ve.object({title:ve.string(),language:j$t,content:ve.string()});var L$t=ve.object({method:ve.string(),path:ve.string(),stream:ve.boolean().optional()});var Smt=ve.undiscriminatedUnion([ve.string(),L$t]);var U$t=ve.object({bannerLink:ve.string().optional(),introduction:ve.string().optional(),apiReferenceLink:ve.string().optional(),apiName:ve.string().optional(),disabledSections:ve.list(ve.string()).optional(),defaultEndpoint:Smt.optional(),features:ve.record(ve.string(),ve.list(Smt)).optional(),customSections:ve.list(M$t).optional(),exampleStyle:c$t.optional()});var z$t=ve.object({username:ve.string(),email:ve.string(),token:ve.string()});var V$t=ve.object({github:z$t.optional()});var X$o=ve.object({"auth-schemes":ve.record(ve.string(),epe).optional(),api:u$t.optional(),whitelabel:V$t.optional(),metadata:ipe.optional(),readme:U$t.optional(),"default-group":ve.string().optional(),aliases:ve.record(ve.string(),ve.list(ve.string())).optional(),groups:ve.record(ve.string(),F$t).optional(),reviewers:ope.optional(),replay:k$t.optional(),ai:nWt.optional(),autorelease:ve.boolean().optional(),openapi:N$t.optional(),"openapi-overrides":ve.string().optional(),"spec-origin":ve.string().optional(),"async-api":ve.string().optional(),"api-settings":_Le.optional()});var bHn={};Y(bHn,{CratesOutputLocationSchema:()=>f$t,GeneratorApiSettingsSchema:()=>p$t,GeneratorGroupSchema:()=>F$t,GeneratorInvocationSchema:()=>R$t,GeneratorOutputSchema:()=>I$t,GeneratorPublishMetadataSchema:()=>_mt,GeneratorSnippetsSchema:()=>x$t,GithubCommitAndReleaseMode:()=>_$t,GithubCommitAndReleaseSchema:()=>S$t,GithubConfigurationSchema:()=>D$t,GithubPullRequestSchema:()=>B$t,GithubPushSchema:()=>O$t,GithubSelfhostedMode:()=>P$t,GithubSelfhostedSchema:()=>T$t,LocalFileSystemOutputLocationSchema:()=>d$t,MavenOutputLocationSchema:()=>h$t,MavenOutputSignatureSchema:()=>m$t,NpmOutputLocationSchema:()=>g$t,NugetOutputLocationSchema:()=>A$t,PostmanOutputLocationSchema:()=>y$t,PypiOutputLocationSchema:()=>E$t,PypiOutputMetadataSchema:()=>b$t,RubyGemsOutputLocationSchema:()=>v$t});var EHn={};Y(EHn,{GithubLicenseCustomSchema:()=>w$t,GithubLicenseSchema:()=>eM,GithubLicenseType:()=>C$t});var vHn={};Y(vHn,{ReplayConfigSchema:()=>k$t});var IHn={};Y(IHn,{ReviewerSchema:()=>xmt,ReviewersSchema:()=>ope});function Z$o(e){return e?.specs!=null}function eHo(e){return e?.asyncapi!=null}function tHo(e){return e?.conjure!=null}function rHo(e){return e?.graphql!=null}function nHo(e){return e?.namespaces!=null}function iHo(e){return e?.openapi!=null}function oHo(e){return e?.openrpc!=null}function sHo(e){return e?.proto!=null}var FRc={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!0,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,groupEnvironmentsByHost:!1,removeDiscriminantsFromSchemas:bn.RemoveDiscriminantsFromSchemas.Always};function kRc(e){let{defaults:t,options:r,overrides:n,overrideOnly:i=new Set,undefinedIfAbsent:o=new Set}=e,s={};for(let a of Object.keys(t))i.has(a)?s[a]=n?.[a]!==void 0?n[a]:t[a]:o.has(a)?s[a]=n?.[a]!==void 0?n[a]:r?.[a]!==void 0?r[a]:void 0:s[a]=n?.[a]??r?.[a]??t[a];return s}function s_e({options:e,overrides:t}){return kRc({defaults:FRc,options:e,overrides:t})}gg();gg();Rt();var kLe={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return kLe._visit(this,t)}}),_visit:(e,t)=>e.type==="protobuf"?t.protobuf(e):t._other(e)};var jw={basic:e=>({...e,type:"basic",_visit:function(t){return jw._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return jw._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return jw._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return jw._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return jw._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"query":return t.query(e);case"oauth":return t.oauth(e);default:return t._other(e)}}};var mS={openapi:e=>({...e,type:"openapi",_visit:function(t){return mS._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return mS._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"openapi":return t.openapi(e);case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var Ha={primitive:e=>({value:e,type:"primitive",_visit:function(t){return Ha._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Ha._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return Ha._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return Ha._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return Ha._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return Ha._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Ha._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return Ha._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return Ha._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"null":return t.null(e);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var spe={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return spe._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return spe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e.value);case"undiscriminated":return t.undiscriminated(e.value);default:return t._other(e)}}};var ape={boolean:e=>({value:e,type:"boolean",_visit:function(t){return ape._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return ape._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var as={int:e=>({value:e,type:"int",_visit:function(t){return as._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return as._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return as._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return as._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return as._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return as._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return as._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return as._visit(this,t)}}),datetimeRfc2822:e=>({value:e,type:"datetimeRfc2822",_visit:function(t){return as._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return as._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return as._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return as._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e.value);case"int64":return t.int64(e.value);case"uint":return t.uint(e.value);case"uint64":return t.uint64(e.value);case"float":return t.float(e.value);case"double":return t.double(e.value);case"string":return t.string(e.value);case"datetime":return t.datetime(e.value);case"datetimeRfc2822":return t.datetimeRfc2822(e.value);case"date":return t.date(e.value);case"base64":return t.base64(e.value);case"boolean":return t.boolean(e.value);default:return t._other(e)}}};var Jh={};Y(Jh,{AsymmetricAlgorithm:()=>upe,Availability:()=>Mw,CustomCodeSample:()=>W9,DiscriminatorContext:()=>CHn,EndpointExample:()=>tM,EndpointResponseExample:()=>rM,HttpMethod:()=>Lw,LiteralSchemaValue:()=>wg,MultipartRequestPropertyEncoding:()=>xHn,MultipartSchema:()=>$9,OneOfSchema:()=>H9,Pagination:()=>bI,PrimitiveSchemaValue:()=>Mc,Request:()=>Z5,Response:()=>a_,RetriesConfiguration:()=>Bmt,Schema:()=>aa,SupportedSdkLanguage:()=>Uw,WebhookHttpMethod:()=>_Hn,WebhookPayloadComponent:()=>Omt,WebhookSignatureAlgorithm:()=>Pmt,WebhookSignatureEncoding:()=>SHn,WebhookSignatureVerification:()=>a_e,WebhookTimestampFormat:()=>q$t,WebsocketMessageOrigin:()=>BHn});var QRc={RsaSha256:"rsa-sha256",RsaSha384:"rsa-sha384",RsaSha512:"rsa-sha512",EcdsaSha256:"ecdsa-sha256",EcdsaSha384:"ecdsa-sha384",EcdsaSha512:"ecdsa-sha512",Ed25519:"ed25519"},upe={...QRc,_visit:(e,t)=>{switch(e){case upe.RsaSha256:return t.rsaSha256();case upe.RsaSha384:return t.rsaSha384();case upe.RsaSha512:return t.rsaSha512();case upe.EcdsaSha256:return t.ecdsaSha256();case upe.EcdsaSha384:return t.ecdsaSha384();case upe.EcdsaSha512:return t.ecdsaSha512();case upe.Ed25519:return t.ed25519();default:return t._other()}}};var NRc={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated"},Mw={...NRc,_visit:(e,t)=>{switch(e){case Mw.GenerallyAvailable:return t.generallyAvailable();case Mw.Beta:return t.beta();case Mw.Deprecated:return t.deprecated();default:return t._other()}}};var W9={language:e=>({...e,type:"language",_visit:function(t){return W9._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return W9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"language":return t.language(e);case"sdk":return t.sdk(e);default:return t._other(e)}}};var jRc={Data:"data",Protocol:"protocol"},CHn={...jRc,_visit:(e,t)=>{switch(e){case CHn.Data:return t.data();case CHn.Protocol:return t.protocol();default:return t._other()}}};var tM={unknown:e=>({value:e,type:"unknown",_visit:function(t){return tM._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return tM._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"unknown":return t.unknown(e.value);case"full":return t.full(e);default:return t._other(e)}}};var rM={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return rM._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return rM._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"withStreaming":return t.withStreaming(e);case"withoutStreaming":return t.withoutStreaming(e.value);default:return t._other(e)}}};var MRc={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE"},Lw={...MRc,_visit:(e,t)=>{switch(e){case Lw.Get:return t.get();case Lw.Post:return t.post();case Lw.Put:return t.put();case Lw.Patch:return t.patch();case Lw.Delete:return t.delete();case Lw.Head:return t.head();case Lw.Options:return t.options();case Lw.Trace:return t.trace();default:return t._other()}}};var wg={boolean:e=>({value:e,type:"boolean",_visit:function(t){return wg._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return wg._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var LRc={Json:"json",Form:"form"},xHn={...LRc,_visit:(e,t)=>{switch(e){case xHn.Json:return t.json();case xHn.Form:return t.form();default:return t._other()}}};var $9={file:e=>({...e,type:"file",_visit:function(t){return $9._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return $9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e.value);default:return t._other(e)}}};var H9={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return H9._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return H9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var bI={cursor:e=>({...e,type:"cursor",_visit:function(t){return bI._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return bI._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return bI._visit(this,t)}}),uri:e=>({...e,type:"uri",_visit:function(t){return bI._visit(this,t)}}),path:e=>({...e,type:"path",_visit:function(t){return bI._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);case"custom":return t.custom(e);case"uri":return t.uri(e);case"path":return t.path(e);default:return t._other(e)}}};var Mc={int:e=>({...e,type:"int",_visit:function(t){return Mc._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Mc._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Mc._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Mc._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Mc._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Mc._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Mc._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Mc._visit(this,e)}}),datetimeRfc2822:()=>({type:"datetimeRfc2822",_visit:function(e){return Mc._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Mc._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Mc._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Mc._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint();case"uint64":return t.uint64();case"float":return t.float();case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime();case"datetimeRfc2822":return t.datetimeRfc2822();case"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var Z5={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return Z5._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return Z5._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Z5._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return Z5._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var a_={file:e=>({...e,type:"file",_visit:function(t){return a_._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return a_._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return a_._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return a_._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return a_._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return a_._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return a_._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var Bmt={disabled:e=>({value:e,type:"disabled",_visit:function(t){return Bmt._visit(this,t)}}),_visit:(e,t)=>e.type==="disabled"?t.disabled(e.value):t._other(e)};var aa={primitive:e=>({...e,type:"primitive",_visit:function(t){return aa._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return aa._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return aa._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return aa._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return aa._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return aa._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return aa._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return aa._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return aa._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return aa._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return aa._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var URc={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",Js:"js",Node:"node",Ts:"ts",Nodets:"nodets",Golang:"golang",Dotnet:"dotnet",Jvm:"jvm"},Uw={...URc,_visit:(e,t)=>{switch(e){case Uw.Curl:return t.curl();case Uw.Python:return t.python();case Uw.Javascript:return t.javascript();case Uw.Typescript:return t.typescript();case Uw.Go:return t.go();case Uw.Ruby:return t.ruby();case Uw.Csharp:return t.csharp();case Uw.Java:return t.java();case Uw.Js:return t.js();case Uw.Node:return t.node();case Uw.Ts:return t.ts();case Uw.Nodets:return t.nodets();case Uw.Golang:return t.golang();case Uw.Dotnet:return t.dotnet();case Uw.Jvm:return t.jvm();default:return t._other()}}};var zRc={Get:"GET",Post:"POST"},_Hn={...zRc,_visit:(e,t)=>{switch(e){case _Hn.Get:return t.get();case _Hn.Post:return t.post();default:return t._other()}}};var VRc={Body:"body",Timestamp:"timestamp",NotificationUrl:"notification-url",MessageId:"message-id"},Omt={...VRc,_visit:(e,t)=>{switch(e){case Omt.Body:return t.body();case Omt.Timestamp:return t.timestamp();case Omt.NotificationUrl:return t.notificationUrl();case Omt.MessageId:return t.messageId();default:return t._other()}}};var qRc={Sha256:"sha256",Sha1:"sha1",Sha384:"sha384",Sha512:"sha512"},Pmt={...qRc,_visit:(e,t)=>{switch(e){case Pmt.Sha256:return t.sha256();case Pmt.Sha1:return t.sha1();case Pmt.Sha384:return t.sha384();case Pmt.Sha512:return t.sha512();default:return t._other()}}};var GRc={Base64:"base64",Hex:"hex"},SHn={...GRc,_visit:(e,t)=>{switch(e){case SHn.Base64:return t.base64();case SHn.Hex:return t.hex();default:return t._other()}}};var a_e={hmac:e=>({...e,type:"hmac",_visit:function(t){return a_e._visit(this,t)}}),asymmetric:e=>({...e,type:"asymmetric",_visit:function(t){return a_e._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"hmac":return t.hmac(e);case"asymmetric":return t.asymmetric(e);default:return t._other(e)}}};var WRc={UnixSeconds:"unix-seconds",UnixMillis:"unix-millis",Iso8601:"iso8601"},q$t={...WRc,_visit:(e,t)=>{switch(e){case q$t.UnixSeconds:return t.unixSeconds();case q$t.UnixMillis:return t.unixMillis();case q$t.Iso8601:return t.iso8601();default:return t._other()}}};var $Rc={Client:"client",Server:"server"},BHn={...$Rc,_visit:(e,t)=>{switch(e){case BHn.Client:return t.client();case BHn.Server:return t.server();default:return t._other()}}};var Z2={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return Z2._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return Z2._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var Ii={int:e=>({...e,type:"int",_visit:function(t){return Ii._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Ii._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Ii._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Ii._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Ii._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Ii._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Ii._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Ii._visit(this,t)}}),datetimeRfc2822:e=>({...e,type:"datetimeRfc2822",_visit:function(t){return Ii._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Ii._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Ii._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Ii._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint(e);case"uint64":return t.uint64(e);case"float":return t.float(e);case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime(e);case"datetimeRfc2822":return t.datetimeRfc2822(e);case"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var KO={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return KO._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return KO._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return KO._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return KO._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var wh={file:e=>({...e,type:"file",_visit:function(t){return wh._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return wh._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return wh._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return wh._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return wh._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return wh._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return wh._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var Fr={primitive:e=>({...e,type:"primitive",_visit:function(t){return Fr._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Fr._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Fr._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Fr._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Fr._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Fr._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Fr._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Fr._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Fr._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Fr._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Fr._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var ua={};Y(ua,{AllOfPropertyConflict:()=>zLe,ArraySchema:()=>yHt,ArraySchemaWithExample:()=>SKt,AsymmetricAlgorithm:()=>bHt,AsymmetricWebhookSignatureVerification:()=>vHt,Availability:()=>rHt,Base64WithExample:()=>BKt,BasicSecurityScheme:()=>K$t,BearerSecurityScheme:()=>J$t,BooleanSchema:()=>IHt,BooleanWithExample:()=>OKt,BytesResponse:()=>GLe,CasingOverrides:()=>aHt,CommonProperty:()=>wHt,CommonPropertyWithExample:()=>PKt,CursorPagination:()=>CHt,CustomCodeSample:()=>BHt,CustomCodeSampleLanguage:()=>xHt,CustomCodeSampleSdk:()=>SHt,CustomPagination:()=>OHt,DateWithExample:()=>TKt,DatetimeWithExample:()=>Fmt,DiscriminatedOneOfSchema:()=>PHt,DiscriminatedOneOfSchemaWithExample:()=>DKt,DiscriminatorContext:()=>WLe,DoubleSchema:()=>THt,DoubleWithExample:()=>RKt,Encoding:()=>X$t,Endpoint:()=>HHt,EndpointExample:()=>KLe,EndpointResponseExample:()=>FHt,EndpointSdkName:()=>Y9,EndpointSecurity:()=>JLe,EndpointWithExample:()=>kHo,EnumSchema:()=>MLe,EnumSchemaWithExample:()=>UKt,EnumValue:()=>lpe,ErrorExample:()=>NHt,FernExample:()=>DHt,FileResponse:()=>iUe,FileSchema:()=>GHt,FloatWithExample:()=>zKt,FormUrlEncodedRequest:()=>zHt,FullEndpointExample:()=>QHt,FullExample:()=>lm,FullObjectExample:()=>hHt,FullOneOfExample:()=>gHt,GlobalHeader:()=>KHt,GlobalSecurity:()=>JHt,Header:()=>fpe,HeaderExample:()=>$Le,HeaderSecurityScheme:()=>Z$t,HeaderWithExample:()=>gpe,HmacWebhookSignatureVerification:()=>eKt,HttpEndpointServer:()=>YLe,HttpError:()=>jHt,HttpErrorWithExample:()=>FKt,HttpMethod:()=>XLe,IdempotencyHeader:()=>tKt,Int64WithExample:()=>VKt,IntSchema:()=>rKt,IntWithExample:()=>qKt,JsonRequest:()=>VHt,JsonRequestWithExample:()=>QKt,JsonResponse:()=>oUe,JsonResponseWithExample:()=>mUe,KeyValuePair:()=>AHt,LiteralExample:()=>dHt,LiteralSchema:()=>uUe,LiteralSchemaValue:()=>nKt,LongSchema:()=>iKt,MapSchema:()=>aKt,MapSchemaWithExample:()=>KKt,MultipartFormDataWebhookPayload:()=>uKt,MultipartFormDataWebhookPayloadWithExample:()=>JKt,MultipartRequest:()=>rUe,MultipartRequestProperty:()=>dpe,MultipartRequestPropertyEncoding:()=>qHt,MultipartSchema:()=>WHt,NamedFullExample:()=>GD,Namespace:()=>eHt,NamespaceId:()=>tHt,NullExample:()=>mHt,NullableSchema:()=>cKt,NullableSchemaWithExample:()=>YKt,OauthSecurityScheme:()=>uHt,ObjectProperty:()=>lKt,ObjectPropertyConflictInfo:()=>cUe,ObjectPropertyWithExample:()=>XKt,ObjectSchema:()=>pKt,ObjectSchemaWithExample:()=>ZKt,OctetStreamRequest:()=>nUe,OffsetPagination:()=>MHt,OneOfSchema:()=>fKt,OneOfSchemaWithExample:()=>eJt,OpenApiIntermediateRepresentation:()=>FHo,OpenApiSource:()=>iHt,OptionalSchema:()=>xKt,OptionalSchemaWithExample:()=>rJt,Pagination:()=>ZLe,ParseFormUrlEncodedRequest:()=>NKt,ParseMultipartRequest:()=>jKt,ParseOctetStreamRequest:()=>MKt,PathPagination:()=>LHt,PathParameter:()=>eUe,PathParameterExample:()=>kHt,PathParameterWithExample:()=>kKt,PrimitiveExample:()=>LLe,PrimitiveSchema:()=>hpe,PrimitiveSchemaValue:()=>sKt,PrimitiveSchemaValueWithExample:()=>HKt,PrimitiveSchemaWithExample:()=>gUe,PropertyKey:()=>ULe,ProtobufEncoding:()=>Y$t,ProtobufSource:()=>oHt,QueryParameter:()=>tUe,QueryParameterExample:()=>HLe,QueryParameterWithExample:()=>dUe,QuerySecurityScheme:()=>cHt,ReferencedSchema:()=>X9,Request:()=>$Ht,RequestWithExample:()=>LKt,Response:()=>sUe,ResponseWithExample:()=>hUe,RetriesConfiguration:()=>aUe,Schema:()=>Sc,SchemaId:()=>JO,SchemaWithExample:()=>ff,Schemas:()=>mKt,SdkGroup:()=>nHt,SdkGroupInfo:()=>hKt,SdkGroupName:()=>cpe,SecurityScheme:()=>lHt,SecuritySchemeId:()=>ppe,Server:()=>Rmt,ServerVariable:()=>pHt,Source:()=>sHt,StatusCode:()=>K9,StreamingResponseExample:()=>RHt,StringSchema:()=>oKt,StringSchemaWithExample:()=>GKt,SupportedSdkLanguage:()=>_Ht,Tag:()=>fHt,TagId:()=>YO,Tags:()=>gKt,TextResponse:()=>mpe,Uint64WithExample:()=>WKt,UintWithExample:()=>$Kt,UnDiscriminatedOneOfSchema:()=>dKt,UnDiscriminatedOneOfSchemaWithExample:()=>tJt,UnknownSchema:()=>_Kt,UnknownSchemaWithExample:()=>nJt,UriPagination:()=>UHt,Webhook:()=>AKt,WebhookExampleCall:()=>lUe,WebhookHttpMethod:()=>pUe,WebhookPayloadComponent:()=>YHt,WebhookPayloadFormat:()=>XHt,WebhookSignatureAlgorithm:()=>ZHt,WebhookSignatureEncoding:()=>VLe,WebhookSignatureVerification:()=>fUe,WebhookTimestamp:()=>qLe,WebhookTimestampFormat:()=>EHt,WebhookWithExample:()=>QHo,WebsocketChannel:()=>CKt,WebsocketHandshake:()=>yKt,WebsocketHandshakeWithExample:()=>NHo,WebsocketMessageExample:()=>IKt,WebsocketMessageOrigin:()=>bKt,WebsocketMessageSchema:()=>EKt,WebsocketServer:()=>vKt,WebsocketSessionExample:()=>wKt,WithAvailability:()=>ts,WithDescription:()=>pn,WithEncoding:()=>qw,WithInline:()=>pf,WithName:()=>bu,WithNamespace:()=>Va,WithSdkGroupName:()=>sc,WithSdkMethodName:()=>J9,WithSource:()=>Lo,WithStatusCode:()=>nM,WithTitle:()=>ac,commons:()=>FHn,example:()=>kHn,finalIr:()=>QHn,parseIr:()=>NHn});var FHn={};Y(FHn,{BasicSecurityScheme:()=>K$t,BearerSecurityScheme:()=>J$t,Encoding:()=>X$t,HeaderSecurityScheme:()=>Z$t,Namespace:()=>eHt,NamespaceId:()=>tHt,OauthSecurityScheme:()=>uHt,OpenApiSource:()=>iHt,ProtobufEncoding:()=>Y$t,ProtobufSource:()=>oHt,QuerySecurityScheme:()=>cHt,SchemaId:()=>JO,SdkGroup:()=>nHt,SdkGroupName:()=>cpe,SecurityScheme:()=>lHt,SecuritySchemeId:()=>ppe,Server:()=>Rmt,ServerVariable:()=>pHt,Source:()=>sHt,StatusCode:()=>K9,Tag:()=>fHt,TagId:()=>YO,WithAvailability:()=>ts,WithDescription:()=>pn,WithEncoding:()=>qw,WithInline:()=>pf,WithName:()=>bu,WithNamespace:()=>Va,WithSdkGroupName:()=>sc,WithSdkMethodName:()=>J9,WithSource:()=>Lo,WithStatusCode:()=>nM,WithTitle:()=>ac});var G={};Y(G,{JsonError:()=>QLe,ParseError:()=>NLe,any:()=>EHo,bigint:()=>uHo,boolean:()=>vHo,booleanLiteral:()=>yHo,date:()=>cHo,discriminant:()=>THo,enum_:()=>W$t,getObjectLikeUtils:()=>e8,getObjectUtils:()=>u_e,getSchemaUtils:()=>md,isProperty:()=>ene,lazy:()=>lHo,lazyObject:()=>gHo,list:()=>H$t,never:()=>IHo,number:()=>wHo,object:()=>$$t,objectWithoutOptionalProperties:()=>hHo,optional:()=>OHn,property:()=>fHo,record:()=>SHo,set:()=>BHo,string:()=>CHo,stringLiteral:()=>bHo,transform:()=>PHn,undiscriminatedUnion:()=>PHo,union:()=>RHo,unknown:()=>xHo,withParsedProperties:()=>RHn});var oc={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function Nf(e,t){return`Expected ${t}. Received ${HRc(e)}.`}function HRc(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function zw(e){return{...e,json:aHo(e.json),parse:aHo(e.parse)}}function aHo(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
1459
|
+
`)),{ok:!0,value:t}):n}}function oGt(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var Z4e=class e extends Error{errors;constructor(t){super(t.map(oGt).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var eLe=class e extends Error{errors;constructor(t){super(t.map(oGt).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function ld(e){return{nullable:()=>dRc(e),optional:()=>V$n(e),optionalNullable:()=>mRc(e),transform:t=>q$n(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new eLe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new Z4e(n.errors)}}}function dRc(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>nc.NULLABLE};return{...t,...ld(t)}}function V$n(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>nc.OPTIONAL};return{...t,...ld(t)}}function mRc(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>nc.OPTIONAL_NULLABLE};return{...t,...ld(t)}}function q$n(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...ld(r)}}function EWo(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:kf(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:kf(t,"bigint")}]}:{ok:!0,value:t},getType:()=>nc.BIGINT};return{...Dw(e),...ld(e)}}var hRc=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function vWo(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:kf(t,"string")}]}:hRc.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:kf(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:kf(t,"Date object")}]},getType:()=>nc.DATE};return{...Dw(e),...ld(e)}}function Rw(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...Dw(r),...ld(r)}}}function sGt(e){let t=new Set(e);return Rw(nc.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:kf(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:kf(n,"enum")}]}:{ok:!0,value:n})()}function IWo(e){let t=G$n(e);return{...t,...ld(t)}}function G$n(e){return{parse:(t,r)=>tLe(e).parse(t,r),json:(t,r)=>tLe(e).json(t,r),getType:()=>tLe(e).getType()}}function tLe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function W$n(e){return Object.entries(e)}function gmt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function Kre(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function Amt(e){return Object.keys(e)}function wWo(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var gRc=Object.prototype.hasOwnProperty;function Y5(e){return{withParsedProperties:t=>$$n(e,t)}}function $$n(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(gRc.call(t,a)){let u=t[a];s[a]=typeof u=="function"?u(o.value):u}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Kre(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:kf(n,"object")}]};let o=new Set(Object.keys(t)),s=gmt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...ld(r),...Y5(r)}}function CWo(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Jre(e){return e.isProperty}var ARc=Object.prototype.hasOwnProperty;function aGt(e){let t;function r(){if(t==null){t={};for(let[d,f]of W$n(e)){let m=Jre(f)?f.rawKey:d,h=Jre(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of W$n(e)){let m=Jre(f)?f.rawKey:d,h=Jre(f)?f.valueSchema:f;yRc(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function u(){return i==null&&a(),i}function c(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>Jre(f)?f.rawKey:d),_getParsedProperties:()=>Amt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return xWo({value:d,requiredKeys:a(),requiredKeysSet:c(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let E=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return xWo({value:d,requiredKeys:u(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return Jre(g)?{transformedKey:g.rawKey,transform:A=>{let E=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:E})}}:{transformedKey:h,transform:A=>{let E=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>nc.OBJECT};return{...Dw(p),...ld(p),...Y5(p),...r_e(p)}}function xWo({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Kre(e))return{ok:!1,errors:[{path:s,message:kf(e,"object")}]};let a=t.length,u=[],c={};for(let l in e){if(!ARc.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?c[d.transformedKey]=f.value:(c[l]=p,u.push(...f.errors))}else switch(i){case"fail":u.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=p;break}}if(a>0)for(let l of t)l in e||u.push({path:s,message:`Missing required key "${l}"`});return u.length===0||o?{ok:!0,value:c}:{ok:!1,errors:u}}function r_e(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>_Wo({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>_Wo({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>nc.OBJECT};return{...r,...ld(r),...Y5(r),...r_e(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))t.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))r.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},getType:()=>nc.OBJECT};return{...n,...ld(n),...Y5(n),...r_e(n)}}}}function _Wo({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Kre(t))return{ok:!1,errors:[{path:i,message:kf(t,"object")}]};let o=new Set(e),[s,a]=wWo(Amt(t),l=>o.has(l)),u=r(gmt(t,a)),c=n(gmt(t,s));return u.ok&&c.ok?{ok:!0,value:{...u.value,...c.value}}:{ok:!1,errors:[...u.ok?[]:u.errors,...c.ok?[]:c.errors]}}function yRc(e){return!bRc(e)}function bRc(e){switch(e.getType()){case nc.ANY:case nc.UNKNOWN:case nc.OPTIONAL:case nc.OPTIONAL_NULLABLE:return!0;default:return!1}}function SWo(e){return aGt(e)}function BWo(e){let t={...G$n(e),_getRawProperties:()=>tLe(e)._getRawProperties(),_getParsedProperties:()=>tLe(e)._getParsedProperties()};return{...t,...ld(t),...Y5(t),...r_e(t)}}function uGt(e){let t={parse:(r,n)=>OWo(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>OWo(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>nc.LIST};return{...Dw(t),...ld(t)}}function OWo(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:kf(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function PWo(e){return Rw(nc.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:kf(r,`${e.toString()}`)}]})()}function TWo(e){return Rw(nc.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:kf(r,`"${e}"`)}]})()}var DWo=Rw(nc.ANY,e=>({ok:!0,value:e}));var RWo=Rw(nc.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kf(e,"boolean")}]});var FWo=Rw(nc.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var kWo=Rw(nc.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kf(e,"number")}]});var QWo=Rw(nc.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:kf(e,"string")}]});var NWo=Rw(nc.UNKNOWN,e=>({ok:!0,value:e}));var ERc=Object.prototype.hasOwnProperty;function MWo(e,t){let r={parse:(n,i)=>jWo({value:n,isKeyNumeric:e.getType()===nc.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>jWo({value:n,isKeyNumeric:e.getType()===nc.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>nc.RECORD};return{...Dw(r),...ld(r)}}function jWo({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Kre(e))return{ok:!1,errors:[{path:i,message:kf(e,"object")}]};let o={},s=[];for(let a in e){if(!ERc.call(e,a))continue;let u=e[a];if(u===void 0)continue;let c=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(c=d)}let l=r(c),p=n(u,c);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function LWo(e){let t=uGt(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:kf(n,"Set")}]},getType:()=>nc.SET};return{...Dw(r),...ld(r)}}function zWo(e){let t={parse:(r,n)=>UWo((i,o)=>i.parse(r,o),e,n),json:(r,n)=>UWo((i,o)=>i.json(r,o),e,n),getType:()=>nc.UNDISCRIMINATED_UNION};return{...Dw(t),...ld(t)}}function UWo(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function VWo(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var vRc=Object.prototype.hasOwnProperty;function GWo(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=sGt(Amt(t)),o={parse:(s,a)=>qWo({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:u=>i.parse(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.parse(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>qWo({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:u=>i.json(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.json(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>nc.UNION};return{...Dw(o),...ld(o),...Y5(o)}}function qWo({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Kre(e))return{ok:!1,errors:[{path:a,message:kf(e,"object")}]};let u=e[t],c={};for(let f in e)vRc.call(e,f)&&f!==t&&(c[f]=e[f]);if(u==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(u);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...c}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(c,p);return d.ok?{ok:!0,value:{[r]:u,...d.value}}:d}var cGt=ie.object({href:ie.string()});var lGt=ie.object({url:ie.string(),title:ie.string().optional()});var pGt=ie.undiscriminatedUnion([lGt]);var fGt=ie.enum_(["docs","slack","discord"]);var dGt=ie.enum_(["claude-3.7","claude-4","command-a"]);var ymt=ie.object({model:dGt.optional(),systemPrompt:ie.property("system-prompt",ie.string().optional()),location:ie.list(fGt).optional(),datasources:ie.list(pGt).optional()});var mGt=ie.object({enabled:ie.boolean().optional(),style:ie.string().optional()});var hGt=ie.object({orgId:ie.property("org-id",ie.string())});var gGt=ie.object({measurementId:ie.property("measurement-id",ie.string())});var AGt=ie.object({containerId:ie.property("container-id",ie.string())});var yGt=ie.object({appId:ie.property("app-id",ie.string()),apiBase:ie.property("api-base",ie.string().optional())});var bGt=ie.object({apiKey:ie.property("api-key",ie.string()),endpoint:ie.string().optional()});var EGt=ie.object({writeKey:ie.property("write-key",ie.string())});var vGt=ie.object({segment:EGt.optional(),fullstory:hGt.optional(),intercom:yGt.optional(),posthog:bGt.optional(),gtm:AGt.optional(),ga4:gGt.optional()});var Hle=ie.object({message:ie.string()});var bmt=ie.string();var U9=ie.undiscriminatedUnion([bmt,ie.list(bmt)]);var Fw=ie.enum_(["stable","generally-available","in-development","pre-release","deprecated","beta"]);var IGt=ie.object({href:ie.string().optional()});var z9=ie.object({hidden:ie.boolean().optional(),environments:ie.list(ie.string()).optional(),button:IGt.optional(),oauth:ie.boolean().optional(),limitWebsocketMessagesPerConnection:ie.property("limit-websocket-messages-per-connection",ie.number().optional())});var wGt=ie.object({version:ie.string(),package:ie.string()});var Kj=ie.undiscriminatedUnion([ie.string(),wGt]);var CGt=ie.object({python:Kj.optional(),typescript:Kj.optional(),go:Kj.optional(),java:Kj.optional(),ruby:Kj.optional(),csharp:Kj.optional(),php:Kj.optional(),swift:Kj.optional(),rust:Kj.optional()});var Emt=ie.object({flag:ie.string(),fallbackValue:ie.property("fallback-value",ie.unknown().optional()),match:ie.unknown().optional()});var xGt=ie.undiscriminatedUnion([ie.string(),Emt,ie.list(Emt)]);var pd=ie.object({featureFlag:ie.property("feature-flag",xGt.optional())});var n_e=ie.string();var rLe=ie.undiscriminatedUnion([n_e,ie.list(n_e)]);var fd=ie.object({viewers:rLe.optional(),orphaned:ie.boolean().optional()});var _Gt=ie.object({api:ie.string(),apiName:ie.property("api-name",ie.string().optional()),openrpc:ie.string().optional(),audiences:U9.optional(),displayErrors:ie.property("display-errors",ie.boolean().optional()),tagDescriptionPages:ie.property("tag-description-pages",ie.boolean().optional()),snippets:CGt.optional(),postman:ie.string().optional(),summary:ie.string().optional(),layout:ie.list(ie.lazy(()=>V9)).optional(),collapsed:ie.undiscriminatedUnion([ie.boolean(),ie.stringLiteral("open-by-default")]).optional(),icon:ie.string().optional(),slug:ie.string().optional(),hidden:ie.boolean().optional(),availability:Fw.optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),alphabetized:ie.boolean().optional(),flattened:ie.boolean().optional(),paginated:ie.boolean().optional(),playground:z9.optional()}).extend(fd).extend(pd);var SGt=ie.object({endpoint:ie.string(),title:ie.string().optional(),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional(),availability:Fw.optional(),playground:z9.optional()}).extend(fd).extend(pd);var BGt=ie.object({operation:ie.string(),title:ie.string().optional(),slug:ie.string().optional(),hidden:ie.boolean().optional(),availability:Fw.optional()}).extend(fd).extend(pd);var Jj=ie.enum_(["_blank","_self","_parent","_top"]);var nLe=ie.object({link:ie.string(),href:ie.string(),icon:ie.string().optional(),target:Jj.optional()});var Yj=ie.object({page:ie.string(),path:ie.string(),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional(),noindex:ie.boolean().optional(),availability:Fw.optional()}).extend(fd).extend(pd);var V9=ie.undiscriminatedUnion([ie.string(),ie.record(ie.string(),ie.lazy(()=>OGt)),ie.lazyObject(()=>PGt),SGt,BGt,Yj,nLe]);var OGt=ie.undiscriminatedUnion([ie.list(ie.lazy(()=>V9)),ie.lazyObject(()=>TGt)]);var TGt=ie.object({title:ie.string().optional(),summary:ie.string().optional(),contents:ie.list(ie.lazy(()=>V9)).optional(),availability:Fw.optional(),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),playground:z9.optional()}).extend(fd).extend(pd);var PGt=ie.object({section:ie.string(),referencedPackages:ie.property("referenced-packages",ie.list(ie.string()).optional()),summary:ie.string().optional(),contents:ie.list(ie.lazy(()=>V9)).optional(),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),collapsed:ie.undiscriminatedUnion([ie.boolean(),ie.stringLiteral("open-by-default")]).optional(),collapsible:ie.boolean().optional(),collapsedByDefault:ie.property("collapsed-by-default",ie.boolean().optional()),availability:Fw.optional(),playground:z9.optional()}).extend(fd).extend(pd);var DGt=ie.object({dark:ie.string().optional(),light:ie.string().optional()});var RGt=ie.undiscriminatedUnion([ie.string(),DGt]);var FGt=ie.enum_(["default","canvas"]);var iLe=ie.string();var kGt=ie.object({changelog:iLe,title:ie.string().optional(),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional()}).extend(fd).extend(pd);var QGt=ie.object({dark:ie.string().optional(),light:ie.string().optional()});var qb=ie.undiscriminatedUnion([ie.string(),QGt]);var NGt=ie.object({accentPrimary:ie.property("accent-primary",qb.optional()),accentPrimaryDeprecated:ie.property("accentPrimary",qb.optional()),background:qb.optional(),border:qb.optional(),sidebarBackground:ie.property("sidebar-background",qb.optional()),headerBackground:ie.property("header-background",qb.optional()),cardBackground:ie.property("card-background",qb.optional()),accent1:ie.property("accent-1",qb.optional()),accent2:ie.property("accent-2",qb.optional()),accent3:ie.property("accent-3",qb.optional()),accent4:ie.property("accent-4",qb.optional()),accent5:ie.property("accent-5",qb.optional()),accent6:ie.property("accent-6",qb.optional()),accent7:ie.property("accent-7",qb.optional()),accent8:ie.property("accent-8",qb.optional()),accent9:ie.property("accent-9",qb.optional()),accent10:ie.property("accent-10",qb.optional()),accent11:ie.property("accent-11",qb.optional()),accent12:ie.property("accent-12",qb.optional())});var jGt=ie.enum_(["center","left"]);var MGt=ie.undiscriminatedUnion([ie.string(),ie.list(ie.string())]);var LGt=ie.undiscriminatedUnion([ie.string(),ie.list(ie.string())]);var UGt=ie.object({title:ie.string(),subtitle:ie.string().optional(),url:ie.string(),icon:ie.string().optional(),default:ie.boolean().optional()});var zGt=ie.enum_(["github","dashboard"]);var VGt=ie.object({host:ie.string().optional(),owner:ie.string(),repo:ie.string(),branch:ie.string().optional()});var qGt=ie.object({github:VGt.optional(),launch:zGt.optional()});var GGt=ie.object({url:ie.string(),customDomain:ie.property("custom-domain",LGt.optional()),private:ie.boolean().optional(),editThisPage:ie.property("edit-this-page",qGt.optional()),audiences:U9.optional()});var WGt=ie.enum_(["curl","csharp","go","java","javascript","php","python","ruby","swift","typescript"]);var $Gt=ie.undiscriminatedUnion([ie.boolean(),ie.list(WGt)]);var oLe=ie.enum_(["en","es","fr","de","it","pt","ja","zh","ko","el","no","pl","ru","sv","tr"]);var sLe=ie.enum_(["frontmatter","filename"]);var HGt=ie.object({searchText:ie.property("search-text",ie.string().optional()),disableSearch:ie.property("disable-search",ie.boolean().optional()),darkModeCode:ie.property("dark-mode-code",ie.boolean().optional()),defaultSearchFilters:ie.property("default-search-filters",ie.boolean().optional()),httpSnippets:ie.property("http-snippets",$Gt.optional()),hide404Page:ie.property("hide-404-page",ie.boolean().optional()),useJavascriptAsTypescript:ie.property("use-javascript-as-typescript",ie.boolean().optional()),disableExplorerProxy:ie.property("disable-explorer-proxy",ie.boolean().optional()),disableAnalytics:ie.property("disable-analytics",ie.boolean().optional()),language:oLe.optional(),folderTitleSource:ie.property("folder-title-source",sLe.optional()),substituteEnvVars:ie.property("substitute-env-vars",ie.boolean().optional())});var aLe=ie.enum_(["normal","italic"]);var uLe=ie.undiscriminatedUnion([ie.string(),ie.number()]);var KGt=ie.object({path:ie.string(),weight:uLe.optional(),style:aLe.optional()});var JGt=ie.undiscriminatedUnion([ie.string(),KGt]);var YGt=ie.enum_(["auto","block","swap","fallback","optional"]);var cLe=ie.object({name:ie.string().optional(),path:ie.string().optional(),weight:uLe.optional(),style:aLe.optional(),paths:ie.list(JGt).optional(),display:YGt.optional(),fallback:ie.list(ie.string()).optional(),fontVariationSettings:ie.property("font-variation-settings",ie.string().optional())});var XGt=ie.object({headingsFont:cLe.optional(),bodyFont:cLe.optional(),codeFont:cLe.optional()});var ZGt=ie.object({mdxComponents:ie.property("mdx-components",ie.list(ie.string()).optional()),disableStreamToggle:ie.property("disable-stream-toggle",ie.boolean().optional()),openapiParserV2:ie.property("openapi-parser-v2",ie.boolean().optional()),openapiParserV3:ie.property("openapi-parser-v3",ie.boolean().optional()),dynamicSnippets:ie.property("dynamic-snippets",ie.boolean().optional()),aiExamples:ie.property("ai-examples",ie.boolean().optional()),aiExampleStyleInstructions:ie.property("ai-example-style-instructions",ie.string().optional()),excludeApis:ie.property("exclude-apis",ie.boolean().optional()),basepathAware:ie.property("basepath-aware",ie.boolean().optional())});var e7t=ie.object({github:ie.string().optional(),twitter:ie.string().optional(),x:ie.string().optional(),linkedin:ie.string().optional(),youtube:ie.string().optional(),instagram:ie.string().optional(),facebook:ie.string().optional(),discord:ie.string().optional(),slack:ie.string().optional(),hackernews:ie.string().optional(),medium:ie.string().optional(),website:ie.string().optional()});var t7t=ie.object({intercom:ie.string().optional()});var lLe=ie.enum_(["beforeInteractive","afterInteractive","lazyOnload"]);var r7t=ie.object({path:ie.string(),strategy:lLe.optional()});var n7t=ie.undiscriminatedUnion([ie.string(),r7t]);var i7t=ie.object({url:ie.string(),strategy:lLe.optional()});var vmt=ie.undiscriminatedUnion([i7t,n7t]);var o7t=ie.undiscriminatedUnion([vmt,ie.list(vmt)]);var s7t=ie.enum_(["fixed","static"]);var a7t=ie.enum_(["header","header-tabs","sidebar"]);var u7t=ie.enum_(["header","sidebar"]);var c7t=ie.enum_(["header","sidebar"]);var l7t=ie.object({pageWidth:ie.property("page-width",ie.string().optional()),contentWidth:ie.property("content-width",ie.string().optional()),sidebarWidth:ie.property("sidebar-width",ie.string().optional()),headerHeight:ie.property("header-height",ie.string().optional()),searchbarPlacement:ie.property("searchbar-placement",a7t.optional()),tabsPlacement:ie.property("tabs-placement",c7t.optional()),switcherPlacement:ie.property("switcher-placement",u7t.optional()),contentAlignment:ie.property("content-alignment",jGt.optional()),headerPosition:ie.property("header-position",s7t.optional()),disableHeader:ie.property("disable-header",ie.boolean().optional()),hideNavLinks:ie.property("hide-nav-links",ie.boolean().optional()),hideFeedback:ie.property("hide-feedback",ie.boolean().optional())});var p7t=ie.object({doxyfile:ie.string().optional()});var f7t=ie.object({git:ie.string(),subpath:ie.string().optional()});var d7t=ie.object({path:ie.string()});var m7t=ie.undiscriminatedUnion([f7t,d7t]);var h7t=ie.enum_(["python","cpp"]);var g7t=ie.object({path:ie.string()});var A7t=ie.object({input:m7t,output:g7t,lang:h7t,config:p7t.optional()});var pLe=ie.string();var y7t=ie.object({dark:ie.string().optional(),light:ie.string().optional(),height:ie.number().optional(),href:ie.string().optional(),rightText:ie.property("right-text",ie.string().optional())});var b7t=ie.enum_(["summary","summary_large_image","app","player"]);var E7t=ie.object({ogSiteName:ie.property("og:site_name",ie.string().optional()),ogTitle:ie.property("og:title",ie.string().optional()),ogDescription:ie.property("og:description",ie.string().optional()),ogUrl:ie.property("og:url",ie.string().optional()),ogImage:ie.property("og:image",ie.string().optional()),ogImageWidth:ie.property("og:image:width",ie.number().optional()),ogImageHeight:ie.property("og:image:height",ie.number().optional()),ogLocale:ie.property("og:locale",ie.string().optional()),ogLogo:ie.property("og:logo",ie.string().optional()),twitterTitle:ie.property("twitter:title",ie.string().optional()),twitterDescription:ie.property("twitter:description",ie.string().optional()),twitterHandle:ie.property("twitter:handle",ie.string().optional()),twitterImage:ie.property("twitter:image",ie.string().optional()),twitterSite:ie.property("twitter:site",ie.string().optional()),twitterUrl:ie.property("twitter:url",ie.string().optional()),twitterCard:ie.property("twitter:card",b7t.optional()),ogDynamic:ie.property("og:dynamic",ie.boolean().optional()),ogBackgroundImage:ie.property("og:background-image",ie.string().optional()),canonicalHost:ie.property("canonical-host",ie.string().optional())});var Kle=ie.object({viewers:rLe.optional()});var q9=ie.object({href:ie.string().optional(),target:Jj.optional(),url:ie.string().optional(),text:ie.string().optional(),icon:ie.string().optional(),rightIcon:ie.string().optional(),rounded:ie.boolean().optional()}).extend(Kle);var v7t=ie.object({links:ie.list(q9),text:ie.string().optional(),icon:ie.string().optional(),rightIcon:ie.string().optional(),rounded:ie.boolean().optional()}).extend(Kle);var I7t=ie.object({url:ie.string(),target:Jj.optional()}).extend(Kle);var w7t=ie.undiscriminatedUnion([ie.string(),I7t]);var C7t=ie.union("type",{filled:q9,outlined:q9,minimal:q9,github:ie.object({value:w7t}),dropdown:v7t,primary:q9,secondary:q9}).transform({transform:e=>e,untransform:e=>e});var Xj=ie.string();var x7t=ie.object({tab:Xj,layout:ie.list(ie.lazy(()=>G9)).optional()});var _7t=ie.object({title:ie.string(),subtitle:ie.string().optional(),icon:ie.string().optional(),layout:ie.list(ie.lazy(()=>G9)),slug:ie.string().optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),hidden:ie.boolean().optional(),default:ie.boolean().optional()}).extend(fd).extend(pd);var S7t=ie.object({tab:Xj,variants:ie.list(_7t)});var B7t=ie.undiscriminatedUnion([x7t,S7t]);var O7t=ie.list(B7t);var P7t=ie.list(ie.lazy(()=>G9));var Jle=ie.undiscriminatedUnion([P7t,O7t]);var T7t=ie.enum_(["copy-page","view-as-markdown","ask-ai","chatgpt","claude","cursor","vscode"]);var D7t=ie.object({copyPage:ie.property("copy-page",ie.boolean().optional()),viewAsMarkdown:ie.property("view-as-markdown",ie.boolean().optional()),askAi:ie.property("ask-ai",ie.boolean().optional()),chatgpt:ie.boolean().optional(),claude:ie.boolean().optional(),cursor:ie.boolean().optional(),vscode:ie.boolean().optional(),custom:ie.list(UGt).optional()});var R7t=ie.object({default:T7t.optional(),options:D7t.optional()});var F7t=ie.enum_(["deprecated","ga","stable","beta"]);var fLe=ie.object({displayName:ie.property("display-name",ie.string()),path:ie.string(),slug:ie.string().optional(),availability:F7t.optional(),audiences:U9.optional(),hidden:ie.boolean().optional(),announcement:Hle.optional()}).extend(fd).extend(pd);var dLe=ie.object({displayName:ie.property("display-name",ie.string()),subtitle:ie.string().optional(),icon:ie.string().optional(),image:ie.string().optional(),versions:ie.list(fLe).optional(),audiences:U9.optional()}).extend(fd).extend(pd);var k7t=ie.object({href:ie.string(),target:Jj.optional()}).extend(dLe);var Q7t=ie.object({path:ie.string(),slug:ie.string().optional(),announcement:Hle.optional()}).extend(dLe);var N7t=ie.undiscriminatedUnion([Q7t,k7t]);var j7t=ie.enum_(["typescript","javascript","python","java","go","ruby","csharp","php","swift","rust","nodets","nodejs","dotnet","curl","jvm","ts","js"]);var M7t=ie.object({source:ie.string(),destination:ie.string(),permanent:ie.boolean().optional()});var Yle=ie.object({displayName:ie.property("display-name",ie.string()),icon:ie.string().optional(),slug:ie.string().optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),hidden:ie.boolean().optional(),href:ie.string().optional(),target:Jj.optional(),changelog:iLe.optional()}).extend(fd).extend(pd);var L7t=ie.enum_(["default","minimal"]);var U7t=ie.enum_(["default","minimal"]);var z7t=ie.enum_(["default","toolbar"]);var V7t=ie.enum_(["default","toggle"]);var q7t=ie.enum_(["default","minimal"]);var G7t=ie.enum_(["default","bubble"]);var W7t=ie.object({sidebar:q7t.optional(),body:FGt.optional(),tabs:G7t.optional(),pageActions:ie.property("page-actions",z7t.optional()),footerNav:ie.property("footer-nav",L7t.optional()),languageSwitcher:ie.property("language-switcher",U7t.optional()),productSwitcher:ie.property("product-switcher",V7t.optional())});var WWo=ie.object({instances:ie.list(GGt),title:ie.string().optional(),libraries:ie.record(pLe,A7t).optional(),analytics:vGt.optional(),announcement:Hle.optional(),roles:ie.list(n_e).optional(),tabs:ie.record(Xj,Yle).optional(),versions:ie.list(fLe).optional(),products:ie.list(N7t).optional(),landingPage:ie.property("landing-page",Yj.optional()),navigation:Jle.optional(),navbarLinks:ie.property("navbar-links",ie.list(C7t).optional()),footerLinks:ie.property("footer-links",e7t.optional()),pageActions:ie.property("page-actions",R7t.optional()),experimental:ZGt.optional(),defaultLanguage:ie.property("default-language",j7t.optional()),languages:ie.list(oLe).optional(),aiChat:ie.property("ai-chat",ymt.optional()),aiSearch:ie.property("ai-search",ymt.optional()),aiExamples:ie.property("ai-examples",mGt.optional()),metadata:E7t.optional(),redirects:ie.list(M7t).optional(),logo:y7t.optional(),favicon:ie.string().optional(),backgroundImage:ie.property("background-image",RGt.optional()),colors:NGt.optional(),typography:XGt.optional(),layout:l7t.optional(),settings:HGt.optional(),theme:W7t.optional(),integrations:t7t.optional(),css:MGt.optional(),js:o7t.optional(),header:ie.string().optional(),footer:ie.string().optional()});var $7t=ie.object({folder:ie.string(),title:ie.string().optional(),titleSource:ie.property("title-source",sLe.optional()),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),collapsed:ie.undiscriminatedUnion([ie.boolean(),ie.stringLiteral("open-by-default")]).optional(),collapsible:ie.boolean().optional(),collapsedByDefault:ie.property("collapsed-by-default",ie.boolean().optional()),availability:Fw.optional()}).extend(fd).extend(pd);var H7t=ie.object({library:pLe,title:ie.string().optional(),slug:ie.string().optional()}).extend(fd).extend(pd);var G9=ie.undiscriminatedUnion([Yj,ie.lazyObject(()=>K7t),_Gt,H7t,nLe,kGt,$7t]);var $Wo=ie.object({tabs:ie.record(Xj,Yle).optional(),landingPage:ie.property("landing-page",Yj.optional()),navigation:Jle});var J7t=ie.object({displayName:ie.property("display-name",ie.string()),path:ie.string(),slug:ie.string().optional()}).extend(fd).extend(pd);var HWo=ie.undiscriminatedUnion([J7t,cGt]);var K7t=ie.object({section:ie.string(),path:ie.string().optional(),contents:ie.list(ie.lazy(()=>G9)),collapsed:ie.undiscriminatedUnion([ie.boolean(),ie.stringLiteral("open-by-default")]).optional(),collapsible:ie.boolean().optional(),collapsedByDefault:ie.property("collapsed-by-default",ie.boolean().optional()),slug:ie.string().optional(),icon:ie.string().optional(),hidden:ie.boolean().optional(),skipSlug:ie.property("skip-slug",ie.boolean().optional()),availability:Fw.optional()}).extend(fd).extend(pd);var KWo=ie.object({tabs:ie.record(Xj,Yle).optional(),landingPage:ie.property("landing-page",Yj.optional()),navigation:Jle});var JWo=require("fs/promises");var IRc=/\r?\n/;async function Xle({absolutePathToFernignore:e}){let t=(await(0,JWo.readFile)(e)).toString();return YWo(t)}function YWo(e){return[lS,...e.trim().split(IRc).map(t=>{let r=t.indexOf("#");return r!==-1?t.slice(0,r).trim():t.trim()}).filter(t=>t.length>0)]}var bn={};Y(bn,{API_ORIGIN_LOCATION_KEY:()=>QVo,API_SETTINGS_KEY:()=>LVo,ASYNC_API_LOCATION_KEY:()=>NVo,CoerceConstsTo:()=>p$o,DEFAULT_GROUP_GENERATORS_CONFIG_KEY:()=>b4e,DEFAULT_GROUP_NAME:()=>Pdt,DefaultIntegerFormat:()=>f$o,ExampleStyle:()=>d$o,FormParameterEncoding:()=>m$o,GenerationLanguage:()=>XWo,GithubCommitAndReleaseMode:()=>E$o,GithubLicenseType:()=>I$o,GithubSelfhostedMode:()=>v$o,Language:()=>h$o,MessageNamingSettingsSchema:()=>g$o,ModelProvider:()=>t$o,OPENAPI_LOCATION_KEY:()=>jVo,OPENAPI_OVERRIDES_LOCATION_KEY:()=>MVo,PathParameterOrder:()=>A$o,RemoveDiscriminantsFromSchemas:()=>y$o,UnionSettingsSchema:()=>b$o,ai:()=>J$n,fernDefinition:()=>X$n,generators:()=>Z$n,getPackageName:()=>ZWo,group:()=>eHn,isApiConfigurationV2Schema:()=>Z$o,isAsyncApiSpecSchema:()=>eHo,isConjureSchema:()=>tHo,isGraphQLSpecSchema:()=>rHo,isNamespacedApiConfiguration:()=>nHo,isOpenApiSpecSchema:()=>iHo,isOpenRpcSpecSchema:()=>oHo,isProtoSpecSchema:()=>sHo,isRawProtobufAPIDefinitionSchema:()=>e$o,license:()=>tHn,replay:()=>w$o,reviewers:()=>C$o,serialization:()=>wHn});var XWo={TYPESCRIPT:"typescript",JAVA:"java",PYTHON:"python",GO:"go",RUBY:"ruby",CSHARP:"csharp",SWIFT:"swift",PHP:"php",RUST:"rust"};function ZWo({generatorInvocation:e}){return e.language==="go"?wRc(e):e.outputMode._visit({downloadFiles:()=>{},github:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),githubV2:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),publish:()=>{},publishV2:()=>{},_other:()=>{}})}function wRc(e){return e.outputMode._visit({downloadFiles:()=>{},github:t=>`github.com/${t.owner}/${t.repo}`,githubV2:t=>`github.com/${t.owner}/${t.repo}`,publish:()=>{},publishV2:()=>{},_other:()=>{}})}function e$o(e){return typeof e!="string"&&"proto"in e}var J$n={};Y(J$n,{ModelProvider:()=>t$o});var t$o={Openai:"openai",Anthropic:"anthropic",Bedrock:"bedrock"};var X$n={};Y(X$n,{AvailabilityStatusSchema:()=>n$o,auth:()=>r$o,availability:()=>Y$n,commons:()=>i$o,encoding:()=>o$o,environments:()=>s$o,file:()=>a$o,service:()=>u$o,types:()=>c$o,validation:()=>l$o});var r$o={};var Y$n={};Y(Y$n,{AvailabilityStatusSchema:()=>n$o});var n$o={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var i$o={};var o$o={};var s$o={};var a$o={};var u$o={};var c$o={};var l$o={};var Z$n={};Y(Z$n,{CoerceConstsTo:()=>p$o,DefaultIntegerFormat:()=>f$o,ExampleStyle:()=>d$o,FormParameterEncoding:()=>m$o,Language:()=>h$o,MessageNamingSettingsSchema:()=>g$o,PathParameterOrder:()=>A$o,RemoveDiscriminantsFromSchemas:()=>y$o,UnionSettingsSchema:()=>b$o});var p$o={Literals:"literals",Enums:"enums",EnumsCoerceableToLiterals:"enums-coerceable-to-literals"};var f$o={Int32:"int32",Int64:"int64",Uint32:"uint32",Uint64:"uint64"};var d$o={Minimal:"minimal",Comprehensive:"comprehensive"};var m$o={Form:"form",Json:"json"};var h$o={Java:"java",Python:"python",Go:"go",Ruby:"ruby",Csharp:"csharp",Typescript:"typescript",Php:"php",Rust:"rust",Swift:"swift"};var g$o={V1:"v1",V2:"v2"};var A$o={UrlOrder:"url-order",SpecOrder:"spec-order"};var y$o={Always:"always",Never:"never"};var b$o={V1:"v1"};var eHn={};Y(eHn,{GithubCommitAndReleaseMode:()=>E$o,GithubSelfhostedMode:()=>v$o});var E$o={Commit:"commit",Release:"release"};var v$o={PullRequest:"pull-request",Push:"push"};var tHn={};Y(tHn,{GithubLicenseType:()=>I$o});var I$o={Mit:"MIT",Apache:"Apache-2.0"};var w$o={};var C$o={};var wHn={};Y(wHn,{AiServicesSchema:()=>nWt,ApiConfigurationSchema:()=>u$t,ApiConfigurationSchemaInternal:()=>PLe,ApiConfigurationV2Schema:()=>s$t,ApiConfigurationV2SettingsSchema:()=>RLe,ApiConfigurationV2SpecsSchema:()=>FLe,ApiDefinitionList:()=>GWt,ApiDefinitionPathSchema:()=>rpe,ApiDefinitionSchema:()=>qWt,ApiDefinitionSettingsSchema:()=>_Le,ApiDefinitionWithOverridesSchema:()=>SLe,AsyncApiSettingsSchema:()=>DLe,AsyncApiSpecSchema:()=>e$t,BaseApiSettingsSchema:()=>TLe,CoerceConstsTo:()=>WWt,ConjureSchema:()=>ZWt,CratesOutputLocationSchema:()=>f$t,DefaultIntegerFormat:()=>$Wt,ExampleStyle:()=>c$t,FormParameterEncoding:()=>HWt,GeneratorApiSettingsSchema:()=>p$t,GeneratorGroupSchema:()=>F$t,GeneratorInvocationSchema:()=>R$t,GeneratorOutputSchema:()=>I$t,GeneratorPublishMetadataSchema:()=>_mt,GeneratorSnippetsSchema:()=>x$t,GeneratorsConfigurationSchema:()=>X$o,GeneratorsOpenApiObjectSchema:()=>Q$t,GeneratorsOpenApiSchema:()=>N$t,GithubCommitAndReleaseMode:()=>_$t,GithubCommitAndReleaseSchema:()=>S$t,GithubConfigurationSchema:()=>D$t,GithubLicenseCustomSchema:()=>w$t,GithubLicenseSchema:()=>eM,GithubLicenseType:()=>C$t,GithubPullRequestSchema:()=>B$t,GithubPushSchema:()=>O$t,GithubSelfhostedMode:()=>P$t,GithubSelfhostedSchema:()=>T$t,GraphQlSpecSchema:()=>t$t,Language:()=>j$t,LocalFileSystemOutputLocationSchema:()=>d$t,MavenOutputLocationSchema:()=>h$t,MavenOutputSignatureSchema:()=>m$t,MessageNamingSettingsSchema:()=>wLe,ModelName:()=>tWt,ModelProvider:()=>rWt,NamespacedApiConfigurationSchema:()=>a$t,NpmOutputLocationSchema:()=>g$t,NugetOutputLocationSchema:()=>A$t,OpenApiExampleGenerationSchema:()=>KWt,OpenApiFilterSchema:()=>JWt,OpenApiSettingsSchema:()=>npe,OpenApiSpecSchema:()=>r$t,OpenRpcSpecSchema:()=>n$t,OutputMetadataAuthor:()=>l$t,OutputMetadataSchema:()=>ipe,OverridesSchema:()=>Zj,PathParameterOrder:()=>CLe,PostmanOutputLocationSchema:()=>y$t,ProtobufApiDefinitionSchema:()=>OLe,ProtobufDefinitionSchema:()=>BLe,ProtobufSpecSchema:()=>i$t,PypiOutputLocationSchema:()=>E$t,PypiOutputMetadataSchema:()=>b$t,ReadmeCustomSectionSchema:()=>M$t,ReadmeEndpointObjectSchema:()=>L$t,ReadmeEndpointSchema:()=>Smt,ReadmeSchema:()=>U$t,RemoveDiscriminantsFromSchemas:()=>xLe,ReplayConfigSchema:()=>k$t,RequestOrResponseExampleGenerationSchema:()=>Cmt,ResolveAliases:()=>XWt,ResolveAliasesSchema:()=>YWt,ReviewerSchema:()=>xmt,ReviewersSchema:()=>ope,RubyGemsOutputLocationSchema:()=>v$t,SpecSchema:()=>o$t,UnionSettingsSchema:()=>VWt,WhitelabelConfigurationSchema:()=>V$t,WhitelabelGithubConfigurationSchema:()=>z$t,ai:()=>aHn,fernDefinition:()=>AHn,generators:()=>yHn,group:()=>bHn,license:()=>EHn,replay:()=>vHn,reviewers:()=>IHn});var aHn={};Y(aHn,{AiServicesSchema:()=>nWt,ModelName:()=>tWt,ModelProvider:()=>rWt});var ve={};Y(ve,{JsonError:()=>mLe,ParseError:()=>hLe,any:()=>j$o,bigint:()=>_$o,boolean:()=>M$o,booleanLiteral:()=>Q$o,date:()=>S$o,discriminant:()=>K$o,enum_:()=>X7t,getObjectLikeUtils:()=>X5,getObjectUtils:()=>i_e,getSchemaUtils:()=>dd,isProperty:()=>Xre,lazy:()=>B$o,lazyObject:()=>F$o,list:()=>eWt,never:()=>L$o,number:()=>U$o,object:()=>Z7t,objectWithoutOptionalProperties:()=>R$o,optional:()=>rHn,property:()=>P$o,record:()=>G$o,set:()=>W$o,string:()=>z$o,stringLiteral:()=>N$o,transform:()=>nHn,undiscriminatedUnion:()=>H$o,union:()=>Y$o,unknown:()=>V$o,withParsedProperties:()=>sHn});var ic={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function Qf(e,t){return`Expected ${t}. Received ${CRc(e)}.`}function CRc(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function Qw(e){return{...e,json:x$o(e.json),parse:x$o(e.parse)}}function x$o(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
1460
|
+
`)),{ok:!0,value:t}):n}}function Y7t(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var mLe=class e extends Error{errors;constructor(t){super(t.map(Y7t).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var hLe=class e extends Error{errors;constructor(t){super(t.map(Y7t).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function dd(e){return{nullable:()=>xRc(e),optional:()=>rHn(e),optionalNullable:()=>_Rc(e),transform:t=>nHn(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new hLe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new mLe(n.errors)}}}function xRc(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>ic.NULLABLE};return{...t,...dd(t)}}function rHn(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>ic.OPTIONAL};return{...t,...dd(t)}}function _Rc(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>ic.OPTIONAL_NULLABLE};return{...t,...dd(t)}}function nHn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...dd(r)}}function _$o(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:Qf(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:Qf(t,"bigint")}]}:{ok:!0,value:t},getType:()=>ic.BIGINT};return{...Qw(e),...dd(e)}}var SRc=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function S$o(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Qf(t,"string")}]}:SRc.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:Qf(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:Qf(t,"Date object")}]},getType:()=>ic.DATE};return{...Qw(e),...dd(e)}}function Nw(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...Qw(r),...dd(r)}}}function X7t(e){let t=new Set(e);return Nw(ic.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:Qf(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:Qf(n,"enum")}]}:{ok:!0,value:n})()}function B$o(e){let t=iHn(e);return{...t,...dd(t)}}function iHn(e){return{parse:(t,r)=>gLe(e).parse(t,r),json:(t,r)=>gLe(e).json(t,r),getType:()=>gLe(e).getType()}}function gLe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function oHn(e){return Object.entries(e)}function Imt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function Yre(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function wmt(e){return Object.keys(e)}function O$o(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var BRc=Object.prototype.hasOwnProperty;function X5(e){return{withParsedProperties:t=>sHn(e,t)}}function sHn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(BRc.call(t,a)){let u=t[a];s[a]=typeof u=="function"?u(o.value):u}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Yre(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Qf(n,"object")}]};let o=new Set(Object.keys(t)),s=Imt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...dd(r),...X5(r)}}function P$o(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function Xre(e){return e.isProperty}var ORc=Object.prototype.hasOwnProperty;function Z7t(e){let t;function r(){if(t==null){t={};for(let[d,f]of oHn(e)){let m=Xre(f)?f.rawKey:d,h=Xre(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of oHn(e)){let m=Xre(f)?f.rawKey:d,h=Xre(f)?f.valueSchema:f;PRc(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function u(){return i==null&&a(),i}function c(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>Xre(f)?f.rawKey:d),_getParsedProperties:()=>wmt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return T$o({value:d,requiredKeys:a(),requiredKeysSet:c(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let E=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return T$o({value:d,requiredKeys:u(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return Xre(g)?{transformedKey:g.rawKey,transform:A=>{let E=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:E})}}:{transformedKey:h,transform:A=>{let E=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>ic.OBJECT};return{...Qw(p),...dd(p),...X5(p),...i_e(p)}}function T$o({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Yre(e))return{ok:!1,errors:[{path:s,message:Qf(e,"object")}]};let a=t.length,u=[],c={};for(let l in e){if(!ORc.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?c[d.transformedKey]=f.value:(c[l]=p,u.push(...f.errors))}else switch(i){case"fail":u.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=p;break}}if(a>0)for(let l of t)l in e||u.push({path:s,message:`Missing required key "${l}"`});return u.length===0||o?{ok:!0,value:c}:{ok:!1,errors:u}}function i_e(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>D$o({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>D$o({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>ic.OBJECT};return{...r,...dd(r),...X5(r),...i_e(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))t.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))r.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},getType:()=>ic.OBJECT};return{...n,...dd(n),...X5(n),...i_e(n)}}}}function D$o({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Yre(t))return{ok:!1,errors:[{path:i,message:Qf(t,"object")}]};let o=new Set(e),[s,a]=O$o(wmt(t),l=>o.has(l)),u=r(Imt(t,a)),c=n(Imt(t,s));return u.ok&&c.ok?{ok:!0,value:{...u.value,...c.value}}:{ok:!1,errors:[...u.ok?[]:u.errors,...c.ok?[]:c.errors]}}function PRc(e){return!TRc(e)}function TRc(e){switch(e.getType()){case ic.ANY:case ic.UNKNOWN:case ic.OPTIONAL:case ic.OPTIONAL_NULLABLE:return!0;default:return!1}}function R$o(e){return Z7t(e)}function F$o(e){let t={...iHn(e),_getRawProperties:()=>gLe(e)._getRawProperties(),_getParsedProperties:()=>gLe(e)._getParsedProperties()};return{...t,...dd(t),...X5(t),...i_e(t)}}function eWt(e){let t={parse:(r,n)=>k$o(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>k$o(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>ic.LIST};return{...Qw(t),...dd(t)}}function k$o(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:Qf(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function Q$o(e){return Nw(ic.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Qf(r,`${e.toString()}`)}]})()}function N$o(e){return Nw(ic.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Qf(r,`"${e}"`)}]})()}var j$o=Nw(ic.ANY,e=>({ok:!0,value:e}));var M$o=Nw(ic.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Qf(e,"boolean")}]});var L$o=Nw(ic.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var U$o=Nw(ic.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Qf(e,"number")}]});var z$o=Nw(ic.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Qf(e,"string")}]});var V$o=Nw(ic.UNKNOWN,e=>({ok:!0,value:e}));var DRc=Object.prototype.hasOwnProperty;function G$o(e,t){let r={parse:(n,i)=>q$o({value:n,isKeyNumeric:e.getType()===ic.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>q$o({value:n,isKeyNumeric:e.getType()===ic.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>ic.RECORD};return{...Qw(r),...dd(r)}}function q$o({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Yre(e))return{ok:!1,errors:[{path:i,message:Qf(e,"object")}]};let o={},s=[];for(let a in e){if(!DRc.call(e,a))continue;let u=e[a];if(u===void 0)continue;let c=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(c=d)}let l=r(c),p=n(u,c);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function W$o(e){let t=eWt(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Qf(n,"Set")}]},getType:()=>ic.SET};return{...Qw(r),...dd(r)}}function H$o(e){let t={parse:(r,n)=>$$o((i,o)=>i.parse(r,o),e,n),json:(r,n)=>$$o((i,o)=>i.json(r,o),e,n),getType:()=>ic.UNDISCRIMINATED_UNION};return{...Qw(t),...dd(t)}}function $$o(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function K$o(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var RRc=Object.prototype.hasOwnProperty;function Y$o(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=X7t(wmt(t)),o={parse:(s,a)=>J$o({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:u=>i.parse(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.parse(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>J$o({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:u=>i.json(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.json(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>ic.UNION};return{...Qw(o),...dd(o),...X5(o)}}function J$o({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Yre(e))return{ok:!1,errors:[{path:a,message:Qf(e,"object")}]};let u=e[t],c={};for(let f in e)RRc.call(e,f)&&f!==t&&(c[f]=e[f]);if(u==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(u);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...c}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(c,p);return d.ok?{ok:!0,value:{[r]:u,...d.value}}:d}var tWt=ve.string();var rWt=ve.enum_(["openai","anthropic","bedrock"]);var nWt=ve.object({provider:rWt,model:tWt});var AHn={};Y(AHn,{AnyAuthItem:()=>iWt,AnyAuthSchemesSchema:()=>oWt,ApiAuthSchema:()=>yLe,AuthSchemeDeclarationSchema:()=>epe,AuthSchemeReferenceSchema:()=>ALe,AuthScope:()=>gWt,AuthVariable:()=>o_e,AvailabilitySchema:()=>CWt,AvailabilityStatusSchema:()=>ELe,AvailabilityUnionSchema:()=>xWt,BaseTypeReferenceSchema:()=>jWt,BasicAuthSchemeSchema:()=>uWt,BearerAuthSchemeSchema:()=>mWt,EncodingSchema:()=>BWt,EndpointSecuritySchema:()=>aWt,EndpointSecuritySchemaDetails:()=>sWt,EnvironmentSchema:()=>TWt,HeaderAuthSchemeSchema:()=>hWt,HttpHeaderSchema:()=>ILe,InferredAuthenticatedRequestHeader:()=>cWt,InferredBearerAuthSchema:()=>fWt,InferredGetTokenEndpointSchema:()=>pWt,InferredGetTokenEndpointSchemaObject:()=>lWt,ListValidationSchema:()=>RWt,MapValidationSchema:()=>FWt,MultipleBaseUrlsEnvironmentSchema:()=>OWt,NumberValidationSchema:()=>kWt,OAuthAccessTokenRequestPropertiesSchema:()=>AWt,OAuthAccessTokenResponsePropertiesSchema:()=>yWt,OAuthGetTokenEndpointSchema:()=>bWt,OAuthRefreshTokenEndpointSchema:()=>IWt,OAuthRefreshTokenRequestPropertiesSchema:()=>EWt,OAuthRefreshTokenResponsePropertiesSchema:()=>vWt,OAuthSchemeSchema:()=>wWt,ProtobufTypeSchema:()=>SWt,ServerVariableSchema:()=>vLe,SingleBaseUrlEnvironmentSchema:()=>PWt,StringValidationSchema:()=>QWt,TokenBearerAuthSchema:()=>dWt,TypeReferenceDeclarationWithEnvOverride:()=>UWt,TypeReferenceDeclarationWithEnvOverrideSchema:()=>LWt,TypeReferenceDeclarationWithName:()=>MWt,ValidationSchema:()=>NWt,WithAudiences:()=>tpe,WithAvailability:()=>_Wt,WithDocsSchema:()=>cy,WithEnvironmentVariable:()=>bLe,WithEnvironmentsSchema:()=>DWt,WithHeadersSchema:()=>zWt,WithName:()=>Zle,auth:()=>uHn,availability:()=>cHn,commons:()=>lHn,encoding:()=>pHn,environments:()=>fHn,file:()=>dHn,service:()=>mHn,types:()=>hHn,validation:()=>gHn});var uHn={};Y(uHn,{AnyAuthItem:()=>iWt,AnyAuthSchemesSchema:()=>oWt,ApiAuthSchema:()=>yLe,AuthSchemeDeclarationSchema:()=>epe,AuthSchemeReferenceSchema:()=>ALe,AuthScope:()=>gWt,AuthVariable:()=>o_e,BasicAuthSchemeSchema:()=>uWt,BearerAuthSchemeSchema:()=>mWt,EndpointSecuritySchema:()=>aWt,EndpointSecuritySchemaDetails:()=>sWt,HeaderAuthSchemeSchema:()=>hWt,InferredAuthenticatedRequestHeader:()=>cWt,InferredBearerAuthSchema:()=>fWt,InferredGetTokenEndpointSchema:()=>pWt,InferredGetTokenEndpointSchemaObject:()=>lWt,OAuthAccessTokenRequestPropertiesSchema:()=>AWt,OAuthAccessTokenResponsePropertiesSchema:()=>yWt,OAuthGetTokenEndpointSchema:()=>bWt,OAuthRefreshTokenEndpointSchema:()=>IWt,OAuthRefreshTokenRequestPropertiesSchema:()=>EWt,OAuthRefreshTokenResponsePropertiesSchema:()=>vWt,OAuthSchemeSchema:()=>wWt,TokenBearerAuthSchema:()=>dWt,WithEnvironmentVariable:()=>bLe});var cy=ve.object({docs:ve.string().optional()});var ALe=ve.object({scheme:ve.string()}).extend(cy);var iWt=ve.undiscriminatedUnion([ve.string(),ALe]);var oWt=ve.object({any:ve.list(iWt)}).extend(cy);var sWt=ve.object({});var aWt=ve.object({"endpoint-security":sWt}).extend(cy);var yLe=ve.undiscriminatedUnion([ve.string(),ALe,oWt,aWt]);var Zle=ve.object({name:ve.string().optional()});var bLe=ve.object({env:ve.string().optional()});var o_e=ve.object({omit:ve.boolean().optional()}).extend(bLe).extend(Zle);var uWt=ve.object({scheme:ve.stringLiteral("basic"),username:o_e.optional(),password:o_e.optional()}).extend(cy);var cWt=ve.object({"response-property":ve.string(),"header-name":ve.string(),"value-prefix":ve.string().optional()});var lWt=ve.object({endpoint:ve.string(),"expiry-response-property":ve.string().optional(),"authenticated-request-headers":ve.list(cWt).optional()});var pWt=ve.undiscriminatedUnion([ve.string(),lWt]);var fWt=ve.object({scheme:ve.stringLiteral("bearer"),"get-token":pWt}).extend(cy);var dWt=ve.object({scheme:ve.stringLiteral("bearer"),token:o_e.optional()}).extend(cy);var mWt=ve.undiscriminatedUnion([dWt,fWt]);var hWt=ve.object({header:ve.string(),type:ve.string().optional(),prefix:ve.string().optional()}).extend(bLe).extend(Zle).extend(cy);var gWt=ve.string();var AWt=ve.object({"client-id":ve.string().optional(),"client-secret":ve.string().optional(),scopes:ve.string().optional()});var yWt=ve.object({"access-token":ve.string().optional(),"expires-in":ve.string().optional(),"refresh-token":ve.string().optional()});var bWt=ve.object({endpoint:ve.string(),"request-properties":AWt.optional(),"response-properties":yWt.optional()});var EWt=ve.object({"refresh-token":ve.string()});var vWt=ve.object({"access-token":ve.string().optional(),"expires-in":ve.string().optional(),"refresh-token":ve.string().optional()});var IWt=ve.object({endpoint:ve.string(),"request-properties":EWt.optional(),"response-properties":vWt.optional()});var wWt=ve.object({scheme:ve.stringLiteral("oauth"),type:ve.stringLiteral("client-credentials"),scopes:ve.list(gWt).optional(),"client-id-env":ve.string().optional(),"client-secret-env":ve.string().optional(),"token-prefix":ve.string().optional(),"token-header":ve.string().optional(),"get-token":bWt,"refresh-token":IWt.optional()}).extend(cy);var epe=ve.undiscriminatedUnion([wWt,hWt,uWt,mWt]);var cHn={};Y(cHn,{AvailabilitySchema:()=>CWt,AvailabilityStatusSchema:()=>ELe,AvailabilityUnionSchema:()=>xWt});var ELe=ve.enum_(["in-development","pre-release","deprecated","generally-available"]);var CWt=ve.object({status:ELe,message:ve.string().optional()});var xWt=ve.undiscriminatedUnion([ELe,CWt]);var lHn={};Y(lHn,{WithAudiences:()=>tpe,WithAvailability:()=>_Wt,WithDocsSchema:()=>cy,WithName:()=>Zle});var tpe=ve.object({audiences:ve.list(ve.string()).optional()});var _Wt=ve.object({availability:xWt.optional()});var pHn={};Y(pHn,{EncodingSchema:()=>BWt,ProtobufTypeSchema:()=>SWt});var SWt=ve.object({type:ve.string()});var BWt=ve.object({proto:SWt.optional()});var fHn={};Y(fHn,{EnvironmentSchema:()=>TWt,MultipleBaseUrlsEnvironmentSchema:()=>OWt,ServerVariableSchema:()=>vLe,SingleBaseUrlEnvironmentSchema:()=>PWt,WithEnvironmentsSchema:()=>DWt});var vLe=ve.object({id:ve.string(),default:ve.string().optional(),values:ve.list(ve.string()).optional()});var OWt=ve.object({urls:ve.record(ve.string(),ve.string()),"url-templates":ve.record(ve.string(),ve.string()).optional(),"default-urls":ve.record(ve.string(),ve.string()).optional(),variables:ve.record(ve.string(),ve.list(vLe)).optional()}).extend(tpe).extend(cy);var PWt=ve.object({url:ve.string(),"default-url":ve.string().optional(),"url-template":ve.string().optional(),variables:ve.list(vLe).optional()}).extend(tpe).extend(cy);var TWt=ve.undiscriminatedUnion([ve.string(),PWt,OWt]);var DWt=ve.object({"default-url":ve.string().optional(),"default-environment":ve.string().optional(),environments:ve.record(ve.string(),TWt).optional()});var dHn={};Y(dHn,{WithHeadersSchema:()=>zWt});var RWt=ve.object({minItems:ve.number().optional(),maxItems:ve.number().optional()});var FWt=ve.object({minProperties:ve.number().optional(),maxProperties:ve.number().optional()});var kWt=ve.object({min:ve.number().optional(),max:ve.number().optional(),exclusiveMin:ve.boolean().optional(),exclusiveMax:ve.boolean().optional(),multipleOf:ve.number().optional()});var QWt=ve.object({minLength:ve.number().optional(),maxLength:ve.number().optional(),pattern:ve.string().optional(),format:ve.string().optional()});var NWt=ve.undiscriminatedUnion([QWt,kWt,RWt,FWt]);var jWt=ve.object({default:ve.unknown().optional(),encoding:BWt.optional(),validation:NWt.optional()}).extend(cy).extend(_Wt);var MWt=ve.object({type:ve.string()}).extend(jWt).extend(Zle).extend(tpe);var LWt=ve.object({env:ve.string().optional()}).extend(MWt);var UWt=ve.undiscriminatedUnion([ve.string(),LWt]);var ILe=UWt;var zWt=ve.object({headers:ve.record(ve.string(),ILe).optional()});var mHn={};Y(mHn,{HttpHeaderSchema:()=>ILe,TypeReferenceDeclarationWithEnvOverride:()=>UWt,TypeReferenceDeclarationWithEnvOverrideSchema:()=>LWt});var hHn={};Y(hHn,{BaseTypeReferenceSchema:()=>jWt,TypeReferenceDeclarationWithName:()=>MWt});var gHn={};Y(gHn,{ListValidationSchema:()=>RWt,MapValidationSchema:()=>FWt,NumberValidationSchema:()=>kWt,StringValidationSchema:()=>QWt,ValidationSchema:()=>NWt});var yHn={};Y(yHn,{ApiConfigurationSchema:()=>u$t,ApiConfigurationSchemaInternal:()=>PLe,ApiConfigurationV2Schema:()=>s$t,ApiConfigurationV2SettingsSchema:()=>RLe,ApiConfigurationV2SpecsSchema:()=>FLe,ApiDefinitionList:()=>GWt,ApiDefinitionPathSchema:()=>rpe,ApiDefinitionSchema:()=>qWt,ApiDefinitionSettingsSchema:()=>_Le,ApiDefinitionWithOverridesSchema:()=>SLe,AsyncApiSettingsSchema:()=>DLe,AsyncApiSpecSchema:()=>e$t,BaseApiSettingsSchema:()=>TLe,CoerceConstsTo:()=>WWt,ConjureSchema:()=>ZWt,DefaultIntegerFormat:()=>$Wt,ExampleStyle:()=>c$t,FormParameterEncoding:()=>HWt,GeneratorsConfigurationSchema:()=>X$o,GeneratorsOpenApiObjectSchema:()=>Q$t,GeneratorsOpenApiSchema:()=>N$t,GraphQlSpecSchema:()=>t$t,Language:()=>j$t,MessageNamingSettingsSchema:()=>wLe,NamespacedApiConfigurationSchema:()=>a$t,OpenApiExampleGenerationSchema:()=>KWt,OpenApiFilterSchema:()=>JWt,OpenApiSettingsSchema:()=>npe,OpenApiSpecSchema:()=>r$t,OpenRpcSpecSchema:()=>n$t,OutputMetadataAuthor:()=>l$t,OutputMetadataSchema:()=>ipe,OverridesSchema:()=>Zj,PathParameterOrder:()=>CLe,ProtobufApiDefinitionSchema:()=>OLe,ProtobufDefinitionSchema:()=>BLe,ProtobufSpecSchema:()=>i$t,ReadmeCustomSectionSchema:()=>M$t,ReadmeEndpointObjectSchema:()=>L$t,ReadmeEndpointSchema:()=>Smt,ReadmeSchema:()=>U$t,RemoveDiscriminantsFromSchemas:()=>xLe,RequestOrResponseExampleGenerationSchema:()=>Cmt,ResolveAliases:()=>XWt,ResolveAliasesSchema:()=>YWt,SpecSchema:()=>o$t,UnionSettingsSchema:()=>VWt,WhitelabelConfigurationSchema:()=>V$t,WhitelabelGithubConfigurationSchema:()=>z$t});var rpe=ve.string();var wLe=ve.enum_(["v1","v2"]);var CLe=ve.enum_(["url-order","spec-order"]);var xLe=ve.enum_(["always","never"]);var VWt=ve.enum_(["v1"]);var _Le=ve.object({"use-title":ve.boolean().optional(),unions:VWt.optional(),"message-naming":wLe.optional(),"respect-nullable-schemas":ve.boolean().optional(),"only-include-referenced-schemas":ve.boolean().optional(),"inline-path-parameters":ve.boolean().optional(),"idiomatic-request-names":ve.boolean().optional(),"wrap-references-to-nullable-in-optional":ve.boolean().optional(),"coerce-optional-schemas-to-nullable":ve.boolean().optional(),"group-environments-by-host":ve.boolean().optional(),"remove-discriminants-from-schemas":xLe.optional(),"path-parameter-order":CLe.optional()});var Zj=ve.undiscriminatedUnion([ve.string(),ve.list(ve.string())]);var SLe=ve.object({path:rpe,origin:ve.string().optional(),overrides:Zj.optional(),audiences:ve.list(ve.string()).optional(),settings:_Le.optional()});var BLe=ve.object({target:ve.string().optional(),root:ve.string(),overrides:Zj.optional(),"local-generation":ve.boolean().optional(),"from-openapi":ve.boolean().optional(),dependencies:ve.list(ve.string()).optional()});var OLe=ve.object({proto:BLe});var qWt=ve.undiscriminatedUnion([rpe,SLe,OLe]);var GWt=ve.list(qWt);var PLe=ve.undiscriminatedUnion([rpe,SLe,GWt,OLe]);var WWt=ve.enum_(["literals","enums","enums-coerceable-to-literals"]);var TLe=ve.object({"respect-nullable-schemas":ve.boolean().optional(),"title-as-schema-name":ve.boolean().optional(),"optional-additional-properties":ve.boolean().optional(),"coerce-enums-to-literals":ve.boolean().optional(),"idiomatic-request-names":ve.boolean().optional(),"wrap-references-to-nullable-in-optional":ve.boolean().optional(),"coerce-optional-schemas-to-nullable":ve.boolean().optional(),"group-environments-by-host":ve.boolean().optional(),"remove-discriminants-from-schemas":xLe.optional(),"path-parameter-order":CLe.optional(),"resolve-schema-collisions":ve.boolean().optional(),"infer-forward-compatible":ve.boolean().optional(),"coerce-consts-to":WWt.optional()});var DLe=ve.object({"message-naming":wLe.optional()}).extend(TLe);var $Wt=ve.enum_(["int32","int64","uint32","uint64"]);var HWt=ve.enum_(["form","json"]);var Cmt=ve.object({"max-depth":ve.number().optional()});var KWt=ve.object({request:Cmt.optional(),response:Cmt.optional()});var JWt=ve.object({endpoints:ve.list(ve.string()).optional()});var YWt=ve.object({except:ve.list(ve.string()).optional()});var XWt=ve.undiscriminatedUnion([ve.boolean(),YWt]);var npe=ve.object({"only-include-referenced-schemas":ve.boolean().optional(),"inline-path-parameters":ve.boolean().optional(),"prefer-undiscriminated-unions-with-literals":ve.boolean().optional(),"object-query-parameters":ve.boolean().optional(),"respect-readonly-schemas":ve.boolean().optional(),"respect-forward-compatible-enums":ve.boolean().optional(),"use-bytes-for-binary-response":ve.boolean().optional(),"default-form-parameter-encoding":HWt.optional(),filter:JWt.optional(),"example-generation":KWt.optional(),"additional-properties-defaults-to":ve.boolean().optional(),"type-dates-as-strings":ve.boolean().optional(),"preserve-single-schema-oneof":ve.boolean().optional(),"inline-all-of-schemas":ve.boolean().optional(),"resolve-aliases":XWt.optional(),"group-multi-api-environments":ve.boolean().optional(),"default-integer-format":$Wt.optional()}).extend(TLe);var RLe=ve.object({}).extend(npe).extend(DLe);var ZWt=ve.object({conjure:ve.string()});var e$t=ve.object({asyncapi:ve.string(),origin:ve.string().optional(),overrides:Zj.optional(),namespace:ve.string().optional(),settings:DLe.optional()});var t$t=ve.object({graphql:ve.string(),origin:ve.string().optional(),overrides:ve.string().optional(),name:ve.string().optional()});var r$t=ve.object({openapi:ve.string(),origin:ve.string().optional(),overrides:Zj.optional(),overlays:ve.string().optional(),namespace:ve.string().optional(),settings:npe.optional()});var n$t=ve.object({openrpc:ve.string(),overrides:Zj.optional(),namespace:ve.string().optional()});var i$t=ve.object({proto:BLe});var o$t=ve.undiscriminatedUnion([r$t,e$t,i$t,n$t,t$t]);var FLe=ve.undiscriminatedUnion([ve.list(o$t),ZWt]);var s$t=ve.object({auth:yLe.optional(),"auth-schemes":ve.record(ve.string(),epe).optional(),specs:FLe,settings:RLe.optional()}).extend(zWt).extend(DWt);var a$t=ve.object({namespaces:ve.record(ve.string(),PLe)});var u$t=ve.undiscriminatedUnion([PLe,a$t,s$t]);var c$t=ve.enum_(["minimal","comprehensive"]);var l$t=ve.object({name:ve.string(),email:ve.string()});var ipe=ve.object({description:ve.string().optional(),authors:ve.list(l$t).optional()});var xmt=ve.object({name:ve.string()});var ope=ve.object({teams:ve.list(xmt).optional(),users:ve.list(xmt).optional()});var p$t=ve.object({auth:yLe.optional(),"auth-schemes":ve.record(ve.string(),epe).optional(),headers:ve.record(ve.string(),ILe).optional(),settings:RLe.optional(),specs:FLe.optional()});var f$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),token:ve.string().optional()});var d$t=ve.object({path:ve.string()});var m$t=ve.object({keyId:ve.string(),password:ve.string(),secretKey:ve.string()});var h$t=ve.object({url:ve.string().optional(),coordinate:ve.string(),username:ve.string().optional(),password:ve.string().optional(),signature:m$t.optional()});var g$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),token:ve.string().optional()});var A$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),"api-key":ve.string().optional()});var y$t=ve.object({"api-key":ve.string(),"workspace-id":ve.string(),"collection-id":ve.string().optional()});var b$t=ve.object({keywords:ve.list(ve.string()).optional(),"documentation-link":ve.string().optional(),"homepage-link":ve.string().optional()}).extend(ipe);var E$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),token:ve.string().optional(),username:ve.string().optional(),password:ve.string().optional(),metadata:b$t.optional()});var v$t=ve.object({url:ve.string().optional(),"package-name":ve.string(),"api-key":ve.string().optional()});var I$t=ve.union("location",{npm:g$t,maven:h$t,pypi:E$t,postman:y$t,"local-file-system":d$t,nuget:A$t,rubygems:v$t,crates:f$t}).transform({transform:e=>e,untransform:e=>e});var w$t=ve.object({custom:ve.string()});var C$t=ve.enum_(["MIT","Apache-2.0"]);var eM=ve.undiscriminatedUnion([C$t,w$t]);var _mt=ve.object({"package-description":ve.string().optional(),email:ve.string().optional(),"reference-url":ve.string().optional(),author:ve.string().optional(),license:eM.optional()});var x$t=ve.object({path:ve.string()});var _$t=ve.enum_(["commit","release"]);var S$t=ve.object({repository:ve.string(),license:eM.optional(),mode:_$t.optional()});var B$t=ve.object({repository:ve.string(),branch:ve.string().optional(),license:eM.optional(),mode:ve.stringLiteral("pull-request"),reviewers:ope.optional()});var O$t=ve.object({repository:ve.string(),license:eM.optional(),mode:ve.stringLiteral("push"),branch:ve.string().optional()});var P$t=ve.enum_(["pull-request","push"]);var T$t=ve.object({uri:ve.string(),token:ve.string(),mode:P$t.optional(),branch:ve.string().optional(),license:eM.optional()});var D$t=ve.undiscriminatedUnion([T$t,S$t,B$t,O$t]);var R$t=ve.object({name:ve.string(),version:ve.string(),output:I$t.optional(),github:D$t.optional(),config:ve.unknown().optional(),metadata:_mt.optional(),keywords:ve.list(ve.string()).optional(),snippets:x$t.optional(),"ir-version":ve.string().optional(),"smart-casing":ve.boolean().optional(),api:p$t.optional(),"disable-examples":ve.boolean().optional(),"publish-metadata":_mt.optional(),autorelease:ve.boolean().optional()});var F$t=ve.object({audiences:ve.list(ve.string()).optional(),generators:ve.list(R$t),metadata:ipe.optional(),reviewers:ope.optional()});var k$t=ve.object({enabled:ve.boolean()});var Q$t=ve.object({path:ve.string(),origin:ve.string().optional(),overrides:ve.string().optional(),"disable-examples":ve.boolean().optional(),settings:npe});var N$t=ve.undiscriminatedUnion([Q$t,ve.string()]);var j$t=ve.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var M$t=ve.object({title:ve.string(),language:j$t,content:ve.string()});var L$t=ve.object({method:ve.string(),path:ve.string(),stream:ve.boolean().optional()});var Smt=ve.undiscriminatedUnion([ve.string(),L$t]);var U$t=ve.object({bannerLink:ve.string().optional(),introduction:ve.string().optional(),apiReferenceLink:ve.string().optional(),apiName:ve.string().optional(),disabledSections:ve.list(ve.string()).optional(),defaultEndpoint:Smt.optional(),features:ve.record(ve.string(),ve.list(Smt)).optional(),customSections:ve.list(M$t).optional(),exampleStyle:c$t.optional()});var z$t=ve.object({username:ve.string(),email:ve.string(),token:ve.string()});var V$t=ve.object({github:z$t.optional()});var X$o=ve.object({"auth-schemes":ve.record(ve.string(),epe).optional(),api:u$t.optional(),whitelabel:V$t.optional(),metadata:ipe.optional(),readme:U$t.optional(),"default-group":ve.string().optional(),aliases:ve.record(ve.string(),ve.list(ve.string())).optional(),groups:ve.record(ve.string(),F$t).optional(),reviewers:ope.optional(),replay:k$t.optional(),ai:nWt.optional(),autorelease:ve.boolean().optional(),openapi:N$t.optional(),"openapi-overrides":ve.string().optional(),"spec-origin":ve.string().optional(),"async-api":ve.string().optional(),"api-settings":_Le.optional()});var bHn={};Y(bHn,{CratesOutputLocationSchema:()=>f$t,GeneratorApiSettingsSchema:()=>p$t,GeneratorGroupSchema:()=>F$t,GeneratorInvocationSchema:()=>R$t,GeneratorOutputSchema:()=>I$t,GeneratorPublishMetadataSchema:()=>_mt,GeneratorSnippetsSchema:()=>x$t,GithubCommitAndReleaseMode:()=>_$t,GithubCommitAndReleaseSchema:()=>S$t,GithubConfigurationSchema:()=>D$t,GithubPullRequestSchema:()=>B$t,GithubPushSchema:()=>O$t,GithubSelfhostedMode:()=>P$t,GithubSelfhostedSchema:()=>T$t,LocalFileSystemOutputLocationSchema:()=>d$t,MavenOutputLocationSchema:()=>h$t,MavenOutputSignatureSchema:()=>m$t,NpmOutputLocationSchema:()=>g$t,NugetOutputLocationSchema:()=>A$t,PostmanOutputLocationSchema:()=>y$t,PypiOutputLocationSchema:()=>E$t,PypiOutputMetadataSchema:()=>b$t,RubyGemsOutputLocationSchema:()=>v$t});var EHn={};Y(EHn,{GithubLicenseCustomSchema:()=>w$t,GithubLicenseSchema:()=>eM,GithubLicenseType:()=>C$t});var vHn={};Y(vHn,{ReplayConfigSchema:()=>k$t});var IHn={};Y(IHn,{ReviewerSchema:()=>xmt,ReviewersSchema:()=>ope});function Z$o(e){return e?.specs!=null}function eHo(e){return e?.asyncapi!=null}function tHo(e){return e?.conjure!=null}function rHo(e){return e?.graphql!=null}function nHo(e){return e?.namespaces!=null}function iHo(e){return e?.openapi!=null}function oHo(e){return e?.openrpc!=null}function sHo(e){return e?.proto!=null}var FRc={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!0,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,groupEnvironmentsByHost:!1,removeDiscriminantsFromSchemas:bn.RemoveDiscriminantsFromSchemas.Always};function kRc(e){let{defaults:t,options:r,overrides:n,overrideOnly:i=new Set,undefinedIfAbsent:o=new Set}=e,s={};for(let a of Object.keys(t))i.has(a)?s[a]=n?.[a]!==void 0?n[a]:t[a]:o.has(a)?s[a]=n?.[a]!==void 0?n[a]:r?.[a]!==void 0?r[a]:void 0:s[a]=n?.[a]??r?.[a]??t[a];return s}function s_e({options:e,overrides:t}){return kRc({defaults:FRc,options:e,overrides:t})}gg();gg();Rt();var kLe={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return kLe._visit(this,t)}}),_visit:(e,t)=>e.type==="protobuf"?t.protobuf(e):t._other(e)};var jw={basic:e=>({...e,type:"basic",_visit:function(t){return jw._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return jw._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return jw._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return jw._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return jw._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"basic":return t.basic(e);case"bearer":return t.bearer(e);case"header":return t.header(e);case"query":return t.query(e);case"oauth":return t.oauth(e);default:return t._other(e)}}};var mS={openapi:e=>({...e,type:"openapi",_visit:function(t){return mS._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return mS._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"openapi":return t.openapi(e);case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var Ha={primitive:e=>({value:e,type:"primitive",_visit:function(t){return Ha._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Ha._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return Ha._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return Ha._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return Ha._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return Ha._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Ha._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return Ha._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return Ha._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"null":return t.null(e);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var spe={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return spe._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return spe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e.value);case"undiscriminated":return t.undiscriminated(e.value);default:return t._other(e)}}};var ape={boolean:e=>({value:e,type:"boolean",_visit:function(t){return ape._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return ape._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var as={int:e=>({value:e,type:"int",_visit:function(t){return as._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return as._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return as._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return as._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return as._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return as._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return as._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return as._visit(this,t)}}),datetimeRfc2822:e=>({value:e,type:"datetimeRfc2822",_visit:function(t){return as._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return as._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return as._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return as._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e.value);case"int64":return t.int64(e.value);case"uint":return t.uint(e.value);case"uint64":return t.uint64(e.value);case"float":return t.float(e.value);case"double":return t.double(e.value);case"string":return t.string(e.value);case"datetime":return t.datetime(e.value);case"datetimeRfc2822":return t.datetimeRfc2822(e.value);case"date":return t.date(e.value);case"base64":return t.base64(e.value);case"boolean":return t.boolean(e.value);default:return t._other(e)}}};var Jh={};Y(Jh,{AsymmetricAlgorithm:()=>upe,Availability:()=>Mw,CustomCodeSample:()=>W9,DiscriminatorContext:()=>CHn,EndpointExample:()=>tM,EndpointResponseExample:()=>rM,HttpMethod:()=>Lw,LiteralSchemaValue:()=>wg,MultipartRequestPropertyEncoding:()=>xHn,MultipartSchema:()=>$9,OneOfSchema:()=>H9,Pagination:()=>bI,PrimitiveSchemaValue:()=>Mc,Request:()=>Z5,Response:()=>a_,RetriesConfiguration:()=>Bmt,Schema:()=>aa,SupportedSdkLanguage:()=>Uw,WebhookHttpMethod:()=>_Hn,WebhookPayloadComponent:()=>Omt,WebhookSignatureAlgorithm:()=>Pmt,WebhookSignatureEncoding:()=>SHn,WebhookSignatureVerification:()=>a_e,WebhookTimestampFormat:()=>q$t,WebsocketMessageOrigin:()=>BHn});var QRc={RsaSha256:"rsa-sha256",RsaSha384:"rsa-sha384",RsaSha512:"rsa-sha512",EcdsaSha256:"ecdsa-sha256",EcdsaSha384:"ecdsa-sha384",EcdsaSha512:"ecdsa-sha512",Ed25519:"ed25519"},upe={...QRc,_visit:(e,t)=>{switch(e){case upe.RsaSha256:return t.rsaSha256();case upe.RsaSha384:return t.rsaSha384();case upe.RsaSha512:return t.rsaSha512();case upe.EcdsaSha256:return t.ecdsaSha256();case upe.EcdsaSha384:return t.ecdsaSha384();case upe.EcdsaSha512:return t.ecdsaSha512();case upe.Ed25519:return t.ed25519();default:return t._other()}}};var NRc={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated"},Mw={...NRc,_visit:(e,t)=>{switch(e){case Mw.GenerallyAvailable:return t.generallyAvailable();case Mw.Beta:return t.beta();case Mw.Deprecated:return t.deprecated();default:return t._other()}}};var W9={language:e=>({...e,type:"language",_visit:function(t){return W9._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return W9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"language":return t.language(e);case"sdk":return t.sdk(e);default:return t._other(e)}}};var jRc={Data:"data",Protocol:"protocol"},CHn={...jRc,_visit:(e,t)=>{switch(e){case CHn.Data:return t.data();case CHn.Protocol:return t.protocol();default:return t._other()}}};var tM={unknown:e=>({value:e,type:"unknown",_visit:function(t){return tM._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return tM._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"unknown":return t.unknown(e.value);case"full":return t.full(e);default:return t._other(e)}}};var rM={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return rM._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return rM._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"withStreaming":return t.withStreaming(e);case"withoutStreaming":return t.withoutStreaming(e.value);default:return t._other(e)}}};var MRc={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE"},Lw={...MRc,_visit:(e,t)=>{switch(e){case Lw.Get:return t.get();case Lw.Post:return t.post();case Lw.Put:return t.put();case Lw.Patch:return t.patch();case Lw.Delete:return t.delete();case Lw.Head:return t.head();case Lw.Options:return t.options();case Lw.Trace:return t.trace();default:return t._other()}}};var wg={boolean:e=>({value:e,type:"boolean",_visit:function(t){return wg._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return wg._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"boolean":return t.boolean(e.value);case"string":return t.string(e.value);default:return t._other(e)}}};var LRc={Json:"json",Form:"form"},xHn={...LRc,_visit:(e,t)=>{switch(e){case xHn.Json:return t.json();case xHn.Form:return t.form();default:return t._other()}}};var $9={file:e=>({...e,type:"file",_visit:function(t){return $9._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return $9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e.value);default:return t._other(e)}}};var H9={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return H9._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return H9._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var bI={cursor:e=>({...e,type:"cursor",_visit:function(t){return bI._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return bI._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return bI._visit(this,t)}}),uri:e=>({...e,type:"uri",_visit:function(t){return bI._visit(this,t)}}),path:e=>({...e,type:"path",_visit:function(t){return bI._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);case"custom":return t.custom(e);case"uri":return t.uri(e);case"path":return t.path(e);default:return t._other(e)}}};var Mc={int:e=>({...e,type:"int",_visit:function(t){return Mc._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Mc._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Mc._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Mc._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Mc._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Mc._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Mc._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Mc._visit(this,e)}}),datetimeRfc2822:()=>({type:"datetimeRfc2822",_visit:function(e){return Mc._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Mc._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Mc._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Mc._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint();case"uint64":return t.uint64();case"float":return t.float();case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime();case"datetimeRfc2822":return t.datetimeRfc2822();case"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var Z5={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return Z5._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return Z5._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Z5._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return Z5._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var a_={file:e=>({...e,type:"file",_visit:function(t){return a_._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return a_._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return a_._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return a_._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return a_._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return a_._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return a_._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var Bmt={disabled:e=>({value:e,type:"disabled",_visit:function(t){return Bmt._visit(this,t)}}),_visit:(e,t)=>e.type==="disabled"?t.disabled(e.value):t._other(e)};var aa={primitive:e=>({...e,type:"primitive",_visit:function(t){return aa._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return aa._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return aa._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return aa._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return aa._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return aa._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return aa._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return aa._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return aa._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return aa._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return aa._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var URc={Curl:"curl",Python:"python",Javascript:"javascript",Typescript:"typescript",Go:"go",Ruby:"ruby",Csharp:"csharp",Java:"java",Js:"js",Node:"node",Ts:"ts",Nodets:"nodets",Golang:"golang",Dotnet:"dotnet",Jvm:"jvm"},Uw={...URc,_visit:(e,t)=>{switch(e){case Uw.Curl:return t.curl();case Uw.Python:return t.python();case Uw.Javascript:return t.javascript();case Uw.Typescript:return t.typescript();case Uw.Go:return t.go();case Uw.Ruby:return t.ruby();case Uw.Csharp:return t.csharp();case Uw.Java:return t.java();case Uw.Js:return t.js();case Uw.Node:return t.node();case Uw.Ts:return t.ts();case Uw.Nodets:return t.nodets();case Uw.Golang:return t.golang();case Uw.Dotnet:return t.dotnet();case Uw.Jvm:return t.jvm();default:return t._other()}}};var zRc={Get:"GET",Post:"POST"},_Hn={...zRc,_visit:(e,t)=>{switch(e){case _Hn.Get:return t.get();case _Hn.Post:return t.post();default:return t._other()}}};var VRc={Body:"body",Timestamp:"timestamp",NotificationUrl:"notification-url",MessageId:"message-id"},Omt={...VRc,_visit:(e,t)=>{switch(e){case Omt.Body:return t.body();case Omt.Timestamp:return t.timestamp();case Omt.NotificationUrl:return t.notificationUrl();case Omt.MessageId:return t.messageId();default:return t._other()}}};var qRc={Sha256:"sha256",Sha1:"sha1",Sha384:"sha384",Sha512:"sha512"},Pmt={...qRc,_visit:(e,t)=>{switch(e){case Pmt.Sha256:return t.sha256();case Pmt.Sha1:return t.sha1();case Pmt.Sha384:return t.sha384();case Pmt.Sha512:return t.sha512();default:return t._other()}}};var GRc={Base64:"base64",Hex:"hex"},SHn={...GRc,_visit:(e,t)=>{switch(e){case SHn.Base64:return t.base64();case SHn.Hex:return t.hex();default:return t._other()}}};var a_e={hmac:e=>({...e,type:"hmac",_visit:function(t){return a_e._visit(this,t)}}),asymmetric:e=>({...e,type:"asymmetric",_visit:function(t){return a_e._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"hmac":return t.hmac(e);case"asymmetric":return t.asymmetric(e);default:return t._other(e)}}};var WRc={UnixSeconds:"unix-seconds",UnixMillis:"unix-millis",Iso8601:"iso8601"},q$t={...WRc,_visit:(e,t)=>{switch(e){case q$t.UnixSeconds:return t.unixSeconds();case q$t.UnixMillis:return t.unixMillis();case q$t.Iso8601:return t.iso8601();default:return t._other()}}};var $Rc={Client:"client",Server:"server"},BHn={...$Rc,_visit:(e,t)=>{switch(e){case BHn.Client:return t.client();case BHn.Server:return t.server();default:return t._other()}}};var Z2={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return Z2._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return Z2._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"discriminated":return t.discriminated(e);case"undiscriminated":return t.undiscriminated(e);default:return t._other(e)}}};var Ii={int:e=>({...e,type:"int",_visit:function(t){return Ii._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Ii._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Ii._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Ii._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Ii._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Ii._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Ii._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Ii._visit(this,t)}}),datetimeRfc2822:e=>({...e,type:"datetimeRfc2822",_visit:function(t){return Ii._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Ii._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Ii._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Ii._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"int":return t.int(e);case"int64":return t.int64(e);case"uint":return t.uint(e);case"uint64":return t.uint64(e);case"float":return t.float(e);case"double":return t.double(e);case"string":return t.string(e);case"datetime":return t.datetime(e);case"datetimeRfc2822":return t.datetimeRfc2822(e);case"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var KO={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return KO._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return KO._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return KO._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return KO._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var wh={file:e=>({...e,type:"file",_visit:function(t){return wh._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return wh._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return wh._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return wh._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return wh._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return wh._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return wh._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var Fr={primitive:e=>({...e,type:"primitive",_visit:function(t){return Fr._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Fr._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Fr._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Fr._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Fr._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Fr._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Fr._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Fr._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Fr._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Fr._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Fr._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e);case"object":return t.object(e);case"array":return t.array(e);case"map":return t.map(e);case"optional":return t.optional(e);case"enum":return t.enum(e);case"reference":return t.reference(e);case"literal":return t.literal(e);case"oneOf":return t.oneOf(e.value);case"nullable":return t.nullable(e);case"unknown":return t.unknown(e);default:return t._other(e)}}};var ua={};Y(ua,{AllOfPropertyConflict:()=>zLe,ArraySchema:()=>yHt,ArraySchemaWithExample:()=>SKt,AsymmetricAlgorithm:()=>bHt,AsymmetricWebhookSignatureVerification:()=>vHt,Availability:()=>rHt,Base64WithExample:()=>BKt,BasicSecurityScheme:()=>K$t,BearerSecurityScheme:()=>J$t,BooleanSchema:()=>IHt,BooleanWithExample:()=>OKt,BytesResponse:()=>GLe,CasingOverrides:()=>aHt,CommonProperty:()=>wHt,CommonPropertyWithExample:()=>PKt,CursorPagination:()=>CHt,CustomCodeSample:()=>BHt,CustomCodeSampleLanguage:()=>xHt,CustomCodeSampleSdk:()=>SHt,CustomPagination:()=>OHt,DateWithExample:()=>TKt,DatetimeWithExample:()=>Fmt,DiscriminatedOneOfSchema:()=>PHt,DiscriminatedOneOfSchemaWithExample:()=>DKt,DiscriminatorContext:()=>WLe,DoubleSchema:()=>THt,DoubleWithExample:()=>RKt,Encoding:()=>X$t,Endpoint:()=>HHt,EndpointExample:()=>KLe,EndpointResponseExample:()=>FHt,EndpointSdkName:()=>Y9,EndpointSecurity:()=>JLe,EndpointWithExample:()=>kHo,EnumSchema:()=>MLe,EnumSchemaWithExample:()=>UKt,EnumValue:()=>lpe,ErrorExample:()=>NHt,FernExample:()=>DHt,FileResponse:()=>iUe,FileSchema:()=>GHt,FloatWithExample:()=>zKt,FormUrlEncodedRequest:()=>zHt,FullEndpointExample:()=>QHt,FullExample:()=>lm,FullObjectExample:()=>hHt,FullOneOfExample:()=>gHt,GlobalHeader:()=>KHt,GlobalSecurity:()=>JHt,Header:()=>fpe,HeaderExample:()=>$Le,HeaderSecurityScheme:()=>Z$t,HeaderWithExample:()=>gpe,HmacWebhookSignatureVerification:()=>eKt,HttpEndpointServer:()=>YLe,HttpError:()=>jHt,HttpErrorWithExample:()=>FKt,HttpMethod:()=>XLe,IdempotencyHeader:()=>tKt,Int64WithExample:()=>VKt,IntSchema:()=>rKt,IntWithExample:()=>qKt,JsonRequest:()=>VHt,JsonRequestWithExample:()=>QKt,JsonResponse:()=>oUe,JsonResponseWithExample:()=>mUe,KeyValuePair:()=>AHt,LiteralExample:()=>dHt,LiteralSchema:()=>uUe,LiteralSchemaValue:()=>nKt,LongSchema:()=>iKt,MapSchema:()=>aKt,MapSchemaWithExample:()=>KKt,MultipartFormDataWebhookPayload:()=>uKt,MultipartFormDataWebhookPayloadWithExample:()=>JKt,MultipartRequest:()=>rUe,MultipartRequestProperty:()=>dpe,MultipartRequestPropertyEncoding:()=>qHt,MultipartSchema:()=>WHt,NamedFullExample:()=>GD,Namespace:()=>eHt,NamespaceId:()=>tHt,NullExample:()=>mHt,NullableSchema:()=>cKt,NullableSchemaWithExample:()=>YKt,OauthSecurityScheme:()=>uHt,ObjectProperty:()=>lKt,ObjectPropertyConflictInfo:()=>cUe,ObjectPropertyWithExample:()=>XKt,ObjectSchema:()=>pKt,ObjectSchemaWithExample:()=>ZKt,OctetStreamRequest:()=>nUe,OffsetPagination:()=>MHt,OneOfSchema:()=>fKt,OneOfSchemaWithExample:()=>eJt,OpenApiIntermediateRepresentation:()=>FHo,OpenApiSource:()=>iHt,OptionalSchema:()=>xKt,OptionalSchemaWithExample:()=>rJt,Pagination:()=>ZLe,ParseFormUrlEncodedRequest:()=>NKt,ParseMultipartRequest:()=>jKt,ParseOctetStreamRequest:()=>MKt,PathPagination:()=>LHt,PathParameter:()=>eUe,PathParameterExample:()=>kHt,PathParameterWithExample:()=>kKt,PrimitiveExample:()=>LLe,PrimitiveSchema:()=>hpe,PrimitiveSchemaValue:()=>sKt,PrimitiveSchemaValueWithExample:()=>HKt,PrimitiveSchemaWithExample:()=>gUe,PropertyKey:()=>ULe,ProtobufEncoding:()=>Y$t,ProtobufSource:()=>oHt,QueryParameter:()=>tUe,QueryParameterExample:()=>HLe,QueryParameterWithExample:()=>dUe,QuerySecurityScheme:()=>cHt,ReferencedSchema:()=>X9,Request:()=>$Ht,RequestWithExample:()=>LKt,Response:()=>sUe,ResponseWithExample:()=>hUe,RetriesConfiguration:()=>aUe,Schema:()=>Sc,SchemaId:()=>JO,SchemaWithExample:()=>ff,Schemas:()=>mKt,SdkGroup:()=>nHt,SdkGroupInfo:()=>hKt,SdkGroupName:()=>cpe,SecurityScheme:()=>lHt,SecuritySchemeId:()=>ppe,Server:()=>Rmt,ServerVariable:()=>pHt,Source:()=>sHt,StatusCode:()=>K9,StreamingResponseExample:()=>RHt,StringSchema:()=>oKt,StringSchemaWithExample:()=>GKt,SupportedSdkLanguage:()=>_Ht,Tag:()=>fHt,TagId:()=>YO,Tags:()=>gKt,TextResponse:()=>mpe,Uint64WithExample:()=>WKt,UintWithExample:()=>$Kt,UnDiscriminatedOneOfSchema:()=>dKt,UnDiscriminatedOneOfSchemaWithExample:()=>tJt,UnknownSchema:()=>_Kt,UnknownSchemaWithExample:()=>nJt,UriPagination:()=>UHt,Webhook:()=>AKt,WebhookExampleCall:()=>lUe,WebhookHttpMethod:()=>pUe,WebhookPayloadComponent:()=>YHt,WebhookPayloadFormat:()=>XHt,WebhookSignatureAlgorithm:()=>ZHt,WebhookSignatureEncoding:()=>VLe,WebhookSignatureVerification:()=>fUe,WebhookTimestamp:()=>qLe,WebhookTimestampFormat:()=>EHt,WebhookWithExample:()=>QHo,WebsocketChannel:()=>CKt,WebsocketHandshake:()=>yKt,WebsocketHandshakeWithExample:()=>NHo,WebsocketMessageExample:()=>IKt,WebsocketMessageOrigin:()=>bKt,WebsocketMessageSchema:()=>EKt,WebsocketServer:()=>vKt,WebsocketSessionExample:()=>wKt,WithAvailability:()=>ts,WithDescription:()=>pn,WithEncoding:()=>qw,WithInline:()=>pf,WithName:()=>bu,WithNamespace:()=>Va,WithSdkGroupName:()=>sc,WithSdkMethodName:()=>J9,WithSource:()=>Lo,WithStatusCode:()=>nM,WithTitle:()=>ac,commons:()=>FHn,example:()=>kHn,finalIr:()=>QHn,parseIr:()=>NHn});var FHn={};Y(FHn,{BasicSecurityScheme:()=>K$t,BearerSecurityScheme:()=>J$t,Encoding:()=>X$t,HeaderSecurityScheme:()=>Z$t,Namespace:()=>eHt,NamespaceId:()=>tHt,OauthSecurityScheme:()=>uHt,OpenApiSource:()=>iHt,ProtobufEncoding:()=>Y$t,ProtobufSource:()=>oHt,QuerySecurityScheme:()=>cHt,SchemaId:()=>JO,SdkGroup:()=>nHt,SdkGroupName:()=>cpe,SecurityScheme:()=>lHt,SecuritySchemeId:()=>ppe,Server:()=>Rmt,ServerVariable:()=>pHt,Source:()=>sHt,StatusCode:()=>K9,Tag:()=>fHt,TagId:()=>YO,WithAvailability:()=>ts,WithDescription:()=>pn,WithEncoding:()=>qw,WithInline:()=>pf,WithName:()=>bu,WithNamespace:()=>Va,WithSdkGroupName:()=>sc,WithSdkMethodName:()=>J9,WithSource:()=>Lo,WithStatusCode:()=>nM,WithTitle:()=>ac});var G={};Y(G,{JsonError:()=>QLe,ParseError:()=>NLe,any:()=>EHo,bigint:()=>uHo,boolean:()=>vHo,booleanLiteral:()=>yHo,date:()=>cHo,discriminant:()=>THo,enum_:()=>W$t,getObjectLikeUtils:()=>e8,getObjectUtils:()=>u_e,getSchemaUtils:()=>md,isProperty:()=>ene,lazy:()=>lHo,lazyObject:()=>gHo,list:()=>H$t,never:()=>IHo,number:()=>wHo,object:()=>$$t,objectWithoutOptionalProperties:()=>hHo,optional:()=>OHn,property:()=>fHo,record:()=>SHo,set:()=>BHo,string:()=>CHo,stringLiteral:()=>bHo,transform:()=>PHn,undiscriminatedUnion:()=>PHo,union:()=>RHo,unknown:()=>xHo,withParsedProperties:()=>RHn});var oc={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};function Nf(e,t){return`Expected ${t}. Received ${HRc(e)}.`}function HRc(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}function zw(e){return{...e,json:aHo(e.json),parse:aHo(e.parse)}}function aHo(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(o=>" - "+(o.path.length>0?`${o.path.join(".")}: ${o.message}`:o.message))].join(`
|
|
1461
1461
|
`)),{ok:!0,value:t}):n}}function G$t(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var QLe=class e extends Error{errors;constructor(t){super(t.map(G$t).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var NLe=class e extends Error{errors;constructor(t){super(t.map(G$t).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function md(e){return{nullable:()=>KRc(e),optional:()=>OHn(e),optionalNullable:()=>JRc(e),transform:t=>PHn(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new NLe(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new QLe(n.errors)}}}function KRc(e){let t={parse:(r,n)=>r==null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>oc.NULLABLE};return{...t,...md(t)}}function OHn(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>oc.OPTIONAL};return{...t,...md(t)}}function JRc(e){let t={parse:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,n),json:(r,n)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,n),getType:()=>oc.OPTIONAL_NULLABLE};return{...t,...md(t)}}function PHn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);return o.ok?{ok:!0,value:t.transform(o.value)}:o},json:(n,i)=>{let o=t.untransform(n);return e.json(o,i)},getType:()=>e.getType()};return{...r,...md(r)}}function uHo(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:Nf(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:Nf(t,"bigint")}]}:{ok:!0,value:t},getType:()=>oc.BIGINT};return{...zw(e),...md(e)}}var YRc=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function cHo(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:Nf(t,"string")}]}:YRc.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:Nf(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:Nf(t,"Date object")}]},getType:()=>oc.DATE};return{...zw(e),...md(e)}}function Vw(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...zw(r),...md(r)}}}function W$t(e){let t=new Set(e);return Vw(oc.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:o=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:o,message:Nf(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:o,message:Nf(n,"enum")}]}:{ok:!0,value:n})()}function lHo(e){let t=THn(e);return{...t,...md(t)}}function THn(e){return{parse:(t,r)=>jLe(e).parse(t,r),json:(t,r)=>jLe(e).json(t,r),getType:()=>jLe(e).getType()}}function jLe(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function DHn(e){return Object.entries(e)}function Tmt(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,o])=>(r.has(i)&&(n[i]=o),n),{})}function Zre(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}function Dmt(e){return Object.keys(e)}function pHo(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}var XRc=Object.prototype.hasOwnProperty;function e8(e){return{withParsedProperties:t=>RHn(e,t)}}function RHn(e,t){let r={parse:(n,i)=>{let o=e.parse(n,i);if(!o.ok)return o;let s={};for(let a in t)if(XRc.call(t,a)){let u=t[a];s[a]=typeof u=="function"?u(o.value):u}return{ok:!0,value:{...o.value,...s}}},json:(n,i)=>{if(!Zre(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Nf(n,"object")}]};let o=new Set(Object.keys(t)),s=Tmt(n,Object.keys(n).filter(a=>!o.has(a)));return e.json(s,i)},getType:()=>e.getType()};return{...r,...md(r),...e8(r)}}function fHo(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function ene(e){return e.isProperty}var ZRc=Object.prototype.hasOwnProperty;function $$t(e){let t;function r(){if(t==null){t={};for(let[d,f]of DHn(e)){let m=ene(f)?f.rawKey:d,h=ene(f)?f.valueSchema:f;t[m]={rawKey:m,parsedKey:d,valueSchema:h}}}return t}let n,i,o,s;function a(){if(n==null){n=[],i=[];for(let[d,f]of DHn(e)){let m=ene(f)?f.rawKey:d,h=ene(f)?f.valueSchema:f;eFc(h)&&(n.push(m),i.push(d))}o=new Set(n),s=new Set(i)}return n}function u(){return i==null&&a(),i}function c(){return o==null&&a(),o}function l(){return s==null&&a(),s}let p={_getRawProperties:()=>Object.entries(e).map(([d,f])=>ene(f)?f.rawKey:d),_getParsedProperties:()=>Dmt(e),parse:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return dHo({value:d,requiredKeys:a(),requiredKeysSet:c(),getProperty:h=>{let g=r()[h];if(g!=null)return{transformedKey:g.parsedKey,transform:A=>{let E=[...m,h];return g.valueSchema.parse(A,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},json:(d,f)=>{let m=f?.breadcrumbsPrefix??[];return dHo({value:d,requiredKeys:u(),requiredKeysSet:l(),getProperty:h=>{let g=e[h];if(g!=null)return ene(g)?{transformedKey:g.rawKey,transform:A=>{let E=[...m,h];return g.valueSchema.json(A,{...f,breadcrumbsPrefix:E})}}:{transformedKey:h,transform:A=>{let E=[...m,h];return g.json(A,{...f,breadcrumbsPrefix:E})}}},unrecognizedObjectKeys:f?.unrecognizedObjectKeys,skipValidation:f?.skipValidation,breadcrumbsPrefix:m,omitUndefined:f?.omitUndefined})},getType:()=>oc.OBJECT};return{...zw(p),...md(p),...e8(p),...u_e(p)}}function dHo({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:n,unrecognizedObjectKeys:i="fail",skipValidation:o=!1,breadcrumbsPrefix:s=[]}){if(!Zre(e))return{ok:!1,errors:[{path:s,message:Nf(e,"object")}]};let a=t.length,u=[],c={};for(let l in e){if(!ZRc.call(e,l))continue;let p=e[l],d=n(l);if(d!=null){a>0&&r.has(l)&&a--;let f=d.transform(p);f.ok?c[d.transformedKey]=f.value:(c[l]=p,u.push(...f.errors))}else switch(i){case"fail":u.push({path:[...s,l],message:`Unexpected key "${l}"`});break;case"strip":break;case"passthrough":c[l]=p;break}}if(a>0)for(let l of t)l in e||u.push({path:s,message:`Missing required key "${l}"`});return u.length===0||o?{ok:!0,value:c}:{ok:!1,errors:u}}function u_e(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>mHo({extensionKeys:t._getRawProperties(),value:n,transformBase:o=>e.parse(o,i),transformExtension:o=>t.parse(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>mHo({extensionKeys:t._getParsedProperties(),value:n,transformBase:o=>e.json(o,i),transformExtension:o=>t.json(o,i),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>oc.OBJECT};return{...r,...md(r),...e8(r),...u_e(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),n={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(i,o)=>{let s=e.parse(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))t.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},json:(i,o)=>{let s=e.json(i,{...o,unrecognizedObjectKeys:"passthrough"});if(!s.ok)return s;let a={};if(typeof i=="object"&&i!=null)for(let[u,c]of Object.entries(i))r.has(u)||(a[u]=c);return{ok:!0,value:{...a,...s.value}}},getType:()=>oc.OBJECT};return{...n,...md(n),...e8(n),...u_e(n)}}}}function mHo({extensionKeys:e,value:t,transformBase:r,transformExtension:n,breadcrumbsPrefix:i=[]}){if(!Zre(t))return{ok:!1,errors:[{path:i,message:Nf(t,"object")}]};let o=new Set(e),[s,a]=pHo(Dmt(t),l=>o.has(l)),u=r(Tmt(t,a)),c=n(Tmt(t,s));return u.ok&&c.ok?{ok:!0,value:{...u.value,...c.value}}:{ok:!1,errors:[...u.ok?[]:u.errors,...c.ok?[]:c.errors]}}function eFc(e){return!tFc(e)}function tFc(e){switch(e.getType()){case oc.ANY:case oc.UNKNOWN:case oc.OPTIONAL:case oc.OPTIONAL_NULLABLE:return!0;default:return!1}}function hHo(e){return $$t(e)}function gHo(e){let t={...THn(e),_getRawProperties:()=>jLe(e)._getRawProperties(),_getParsedProperties:()=>jLe(e)._getParsedProperties()};return{...t,...md(t),...e8(t),...u_e(t)}}function H$t(e){let t={parse:(r,n)=>AHo(r,(i,o)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),json:(r,n)=>AHo(r,(i,o)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${o}]`]})),getType:()=>oc.LIST};return{...zw(t),...md(t)}}function AHo(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:Nf(e,"list"),path:[]}]};let r=[],n=[];for(let i=0;i<e.length;i++){let o=t(e[i],i);o.ok?r.push(o.value):n.push(...o.errors)}return n.length===0?{ok:!0,value:r}:{ok:!1,errors:n}}function yHo(e){return Vw(oc.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Nf(r,`${e.toString()}`)}]})()}function bHo(e){return Vw(oc.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:Nf(r,`"${e}"`)}]})()}var EHo=Vw(oc.ANY,e=>({ok:!0,value:e}));var vHo=Vw(oc.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Nf(e,"boolean")}]});var IHo=Vw(oc.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));var wHo=Vw(oc.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Nf(e,"number")}]});var CHo=Vw(oc.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:Nf(e,"string")}]});var xHo=Vw(oc.UNKNOWN,e=>({ok:!0,value:e}));var rFc=Object.prototype.hasOwnProperty;function SHo(e,t){let r={parse:(n,i)=>_Ho({value:n,isKeyNumeric:e.getType()===oc.NUMBER,transformKey:o=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>_Ho({value:n,isKeyNumeric:e.getType()===oc.NUMBER,transformKey:o=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o} (key)`]}),transformValue:(o,s)=>t.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${s}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>oc.RECORD};return{...zw(r),...md(r)}}function _Ho({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){if(!Zre(e))return{ok:!1,errors:[{path:i,message:Nf(e,"object")}]};let o={},s=[];for(let a in e){if(!rFc.call(e,a))continue;let u=e[a];if(u===void 0)continue;let c=a;if(t){let d=a.length>0?Number(a):NaN;Number.isNaN(d)||(c=d)}let l=r(c),p=n(u,c);l.ok&&p.ok?o[l.value]=p.value:(l.ok||s.push(...l.errors),p.ok||s.push(...p.errors))}return s.length===0?{ok:!0,value:o}:{ok:!1,errors:s}}function BHo(e){let t=H$t(e),r={parse:(n,i)=>{let o=t.parse(n,i);return o.ok?{ok:!0,value:new Set(o.value)}:o},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:Nf(n,"Set")}]},getType:()=>oc.SET};return{...zw(r),...md(r)}}function PHo(e){let t={parse:(r,n)=>OHo((i,o)=>i.parse(r,o),e,n),json:(r,n)=>OHo((i,o)=>i.json(r,o),e,n),getType:()=>oc.UNDISCRIMINATED_UNION};return{...zw(t),...md(t)}}function OHo(e,t,r){let n=[];for(let[i,o]of t.entries()){let s=e(o,{...r,skipValidation:!1});if(s.ok)return s;for(let a of s.errors)n.push({path:a.path,message:`[Variant ${i}] ${a.message}`})}return{ok:!1,errors:n}}function THo(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}var nFc=Object.prototype.hasOwnProperty;function RHo(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=W$t(Dmt(t)),o={parse:(s,a)=>DHo({value:s,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:u=>i.parse(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.parse(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(s,a)=>DHo({value:s,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:u=>i.json(u,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...a?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:u=>t[u],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(u,c)=>c.json(u,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>oc.UNION};return{...zw(o),...md(o),...e8(o)}}function DHo({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:o=!1,transformAdditionalProperties:s,breadcrumbsPrefix:a=[]}){if(!Zre(e))return{ok:!1,errors:[{path:a,message:Nf(e,"object")}]};let u=e[t],c={};for(let f in e)nFc.call(e,f)&&f!==t&&(c[f]=e[f]);if(u==null)return{ok:!1,errors:[{path:a,message:`Missing discriminant ("${t}")`}]};let l=n(u);if(!l.ok)return{ok:!1,errors:l.errors};let p=i(l.value);if(p==null)return o?{ok:!0,value:{[r]:l.value,...c}}:{ok:!1,errors:[{path:[...a,t],message:"Unexpected discriminant value"}]};let d=s(c,p);return d.ok?{ok:!0,value:{[r]:u,...d.value}}:d}var K$t=G.objectWithoutOptionalProperties({usernameVariableName:G.string().optional(),usernameEnvVar:G.string().optional(),passwordVariableName:G.string().optional(),passwordEnvVar:G.string().optional()});var J$t=G.objectWithoutOptionalProperties({tokenVariableName:G.string().optional(),tokenEnvVar:G.string().optional()});var Y$t=G.objectWithoutOptionalProperties({typeName:G.string()});var X$t=G.union("type",{protobuf:Y$t}).transform({transform:e=>e.type==="protobuf"?kLe.protobuf(e):e,untransform:({_visit:e,...t})=>t});var Z$t=G.objectWithoutOptionalProperties({headerName:G.string(),prefix:G.string().optional(),headerVariableName:G.string().optional(),headerEnvVar:G.string().optional()});var eHt=G.objectWithoutOptionalProperties({type:G.stringLiteral("namespace"),name:G.string()});var tHt=G.string();var rHt=G.enum_(["GenerallyAvailable","Beta","Deprecated"]);var ts=G.objectWithoutOptionalProperties({availability:rHt.optional()});var pn=G.objectWithoutOptionalProperties({description:G.string().optional()});var pf=G.objectWithoutOptionalProperties({inline:G.boolean().optional()});var bu=G.objectWithoutOptionalProperties({nameOverride:G.string().optional(),generatedName:G.string()});var Va=G.objectWithoutOptionalProperties({namespace:G.string().optional()});var nHt=G.undiscriminatedUnion([G.string(),eHt]);var cpe=G.list(nHt);var sc=G.objectWithoutOptionalProperties({groupName:cpe.optional()});var iHt=G.objectWithoutOptionalProperties({file:G.string()});var oHt=G.objectWithoutOptionalProperties({file:G.string()});var sHt=G.union("type",{openapi:iHt,protobuf:oHt}).transform({transform:e=>{switch(e.type){case"openapi":return mS.openapi(e);case"protobuf":return mS.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Lo=G.objectWithoutOptionalProperties({source:sHt.optional()});var ac=G.objectWithoutOptionalProperties({title:G.string().optional()});var aHt=G.objectWithoutOptionalProperties({snake:G.string().optional(),camel:G.string().optional(),screamingSnake:G.string().optional(),pascal:G.string().optional()});var lpe=G.objectWithoutOptionalProperties({nameOverride:G.string().optional(),generatedName:G.string(),value:G.string(),casing:aHt.optional()}).extend(pn).extend(ts);var MLe=G.objectWithoutOptionalProperties({default:lpe.optional(),values:G.list(lpe)}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(Lo).extend(ac).extend(pf);var uHt=G.objectWithoutOptionalProperties({scopesEnum:MLe.optional()});var cHt=G.objectWithoutOptionalProperties({queryParameterName:G.string()});var JO=G.string();var lHt=G.union("type",{basic:K$t,bearer:J$t,header:Z$t,query:cHt,oauth:uHt}).transform({transform:e=>{switch(e.type){case"basic":return jw.basic(e);case"bearer":return jw.bearer(e);case"header":return jw.header(e);case"query":return jw.query(e);case"oauth":return jw.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var ppe=G.string();var pHt=G.objectWithoutOptionalProperties({id:G.string(),default:G.string().optional(),values:G.list(G.string()).optional()});var Rmt=G.objectWithoutOptionalProperties({name:G.string().optional(),url:G.string(),audiences:G.list(G.string()).optional(),defaultUrl:G.string().optional(),urlTemplate:G.string().optional(),variables:G.list(pHt).optional()}).extend(pn);var K9=G.number();var YO=G.string();var fHt=G.objectWithoutOptionalProperties({id:YO}).extend(pn);var qw=G.objectWithoutOptionalProperties({encoding:X$t.optional()});var J9=G.objectWithoutOptionalProperties({sdkMethodName:G.string().optional()});var nM=G.objectWithoutOptionalProperties({statusCode:K9.optional()});var kHn={};Y(kHn,{FullExample:()=>lm,FullObjectExample:()=>hHt,FullOneOfExample:()=>gHt,KeyValuePair:()=>AHt,LiteralExample:()=>dHt,NullExample:()=>mHt,PrimitiveExample:()=>LLe,PropertyKey:()=>ULe});var dHt=G.union("type",{boolean:G.object({value:G.boolean()}),string:G.object({value:G.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return ape.boolean(e.value);case"string":return ape.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var mHt=G.objectWithoutOptionalProperties({});var LLe=G.union("type",{int:G.object({value:G.number()}),int64:G.object({value:G.number()}),uint:G.object({value:G.number()}),uint64:G.object({value:G.number()}),float:G.object({value:G.number()}),double:G.object({value:G.number()}),string:G.object({value:G.string()}),datetime:G.object({value:G.string()}),datetimeRfc2822:G.object({value:G.string()}),date:G.object({value:G.string()}),base64:G.object({value:G.string()}),boolean:G.object({value:G.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return as.int(e.value);case"int64":return as.int64(e.value);case"uint":return as.uint(e.value);case"uint64":return as.uint64(e.value);case"float":return as.float(e.value);case"double":return as.double(e.value);case"string":return as.string(e.value);case"datetime":return as.datetime(e.value);case"datetimeRfc2822":return as.datetimeRfc2822(e.value);case"date":return as.date(e.value);case"base64":return as.base64(e.value);case"boolean":return as.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var lm=G.union("type",{primitive:G.object({value:LLe}),object:G.lazyObject(()=>hHt),array:G.object({value:G.list(G.lazy(()=>lm))}),map:G.object({value:G.list(G.lazyObject(()=>AHt))}),enum:G.object({value:G.string()}),literal:G.object({value:dHt}),oneOf:G.object({value:G.lazy(()=>gHt)}),null:mHt,unknown:G.object({value:G.lazy(()=>lm)})}).transform({transform:e=>{switch(e.type){case"primitive":return Ha.primitive(e.value);case"object":return Ha.object(e);case"array":return Ha.array(e.value);case"map":return Ha.map(e.value);case"enum":return Ha.enum(e.value);case"literal":return Ha.literal(e.value);case"oneOf":return Ha.oneOf(e.value);case"null":return Ha.null(e);case"unknown":return Ha.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var ULe=G.string();var hHt=G.objectWithoutOptionalProperties({properties:G.record(ULe,G.lazy(()=>lm))});var gHt=G.union("type",{discriminated:G.object({value:G.record(ULe,G.lazy(()=>lm))}),undiscriminated:G.object({value:G.lazy(()=>lm)})}).transform({transform:e=>{switch(e.type){case"discriminated":return spe.discriminated(e.value);case"undiscriminated":return spe.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var AHt=G.objectWithoutOptionalProperties({key:LLe,value:G.lazy(()=>lm)});var QHn={};Y(QHn,{AllOfPropertyConflict:()=>zLe,ArraySchema:()=>yHt,AsymmetricAlgorithm:()=>bHt,AsymmetricWebhookSignatureVerification:()=>vHt,Availability:()=>rHt,BooleanSchema:()=>IHt,BytesResponse:()=>GLe,CasingOverrides:()=>aHt,CommonProperty:()=>wHt,CursorPagination:()=>CHt,CustomCodeSample:()=>BHt,CustomCodeSampleLanguage:()=>xHt,CustomCodeSampleSdk:()=>SHt,CustomPagination:()=>OHt,DiscriminatedOneOfSchema:()=>PHt,DiscriminatorContext:()=>WLe,DoubleSchema:()=>THt,Endpoint:()=>HHt,EndpointExample:()=>KLe,EndpointResponseExample:()=>FHt,EndpointSdkName:()=>Y9,EndpointSecurity:()=>JLe,EnumSchema:()=>MLe,EnumValue:()=>lpe,ErrorExample:()=>NHt,FernExample:()=>DHt,FileResponse:()=>iUe,FileSchema:()=>GHt,FormUrlEncodedRequest:()=>zHt,FullEndpointExample:()=>QHt,GlobalHeader:()=>KHt,GlobalSecurity:()=>JHt,Header:()=>fpe,HeaderExample:()=>$Le,HmacWebhookSignatureVerification:()=>eKt,HttpEndpointServer:()=>YLe,HttpError:()=>jHt,HttpMethod:()=>XLe,IdempotencyHeader:()=>tKt,IntSchema:()=>rKt,JsonRequest:()=>VHt,JsonResponse:()=>oUe,LiteralSchema:()=>uUe,LiteralSchemaValue:()=>nKt,LongSchema:()=>iKt,MapSchema:()=>aKt,MultipartFormDataWebhookPayload:()=>uKt,MultipartRequest:()=>rUe,MultipartRequestProperty:()=>dpe,MultipartRequestPropertyEncoding:()=>qHt,MultipartSchema:()=>WHt,NullableSchema:()=>cKt,ObjectProperty:()=>lKt,ObjectPropertyConflictInfo:()=>cUe,ObjectSchema:()=>pKt,OctetStreamRequest:()=>nUe,OffsetPagination:()=>MHt,OneOfSchema:()=>fKt,OpenApiIntermediateRepresentation:()=>FHo,OptionalSchema:()=>xKt,Pagination:()=>ZLe,PathPagination:()=>LHt,PathParameter:()=>eUe,PathParameterExample:()=>kHt,PrimitiveSchema:()=>hpe,PrimitiveSchemaValue:()=>sKt,QueryParameter:()=>tUe,QueryParameterExample:()=>HLe,ReferencedSchema:()=>X9,Request:()=>$Ht,Response:()=>sUe,RetriesConfiguration:()=>aUe,Schema:()=>Sc,Schemas:()=>mKt,SdkGroupInfo:()=>hKt,StreamingResponseExample:()=>RHt,StringSchema:()=>oKt,SupportedSdkLanguage:()=>_Ht,Tags:()=>gKt,TextResponse:()=>mpe,UnDiscriminatedOneOfSchema:()=>dKt,UnknownSchema:()=>_Kt,UriPagination:()=>UHt,Webhook:()=>AKt,WebhookExampleCall:()=>lUe,WebhookHttpMethod:()=>pUe,WebhookPayloadComponent:()=>YHt,WebhookPayloadFormat:()=>XHt,WebhookSignatureAlgorithm:()=>ZHt,WebhookSignatureEncoding:()=>VLe,WebhookSignatureVerification:()=>fUe,WebhookTimestamp:()=>qLe,WebhookTimestampFormat:()=>EHt,WebsocketChannel:()=>CKt,WebsocketHandshake:()=>yKt,WebsocketMessageExample:()=>IKt,WebsocketMessageOrigin:()=>bKt,WebsocketMessageSchema:()=>EKt,WebsocketServer:()=>vKt,WebsocketSessionExample:()=>wKt});var zLe=G.objectWithoutOptionalProperties({propertyKey:G.string(),allOfSchemaIds:G.list(JO),conflictingTypeSignatures:G.boolean()});var yHt=G.objectWithoutOptionalProperties({value:G.lazy(()=>Sc),minItems:G.number().optional(),maxItems:G.number().optional()}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(ac).extend(pf);var bHt=G.enum_(["rsa-sha256","rsa-sha384","rsa-sha512","ecdsa-sha256","ecdsa-sha384","ecdsa-sha512","ed25519"]);var VLe=G.enum_(["base64","hex"]);var EHt=G.enum_(["unix-seconds","unix-millis","iso8601"]);var qLe=G.objectWithoutOptionalProperties({header:G.string(),format:EHt.optional(),tolerance:G.number().optional()});var vHt=G.objectWithoutOptionalProperties({header:G.string(),asymmetricAlgorithm:bHt,encoding:VLe.optional(),signaturePrefix:G.string().optional(),jwksUrl:G.string().optional(),keyIdHeader:G.string().optional(),timestamp:qLe.optional()});var IHt=G.objectWithoutOptionalProperties({default:G.boolean().optional()});var GLe=G.objectWithoutOptionalProperties({}).extend(pn).extend(Lo).extend(nM);var wHt=G.objectWithoutOptionalProperties({key:G.string(),schema:G.lazy(()=>Sc)});var CHt=G.objectWithoutOptionalProperties({cursor:G.string(),nextCursor:G.property("next_cursor",G.string()),results:G.string()});var xHt=G.objectWithoutOptionalProperties({name:G.string().optional(),language:G.string(),code:G.string(),install:G.string().optional()}).extend(pn);var _Ht=G.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var SHt=G.objectWithoutOptionalProperties({name:G.string().optional(),sdk:_Ht,code:G.string()}).extend(pn);var BHt=G.union("type",{language:xHt,sdk:SHt}).transform({transform:e=>{switch(e.type){case"language":return W9.language(e);case"sdk":return W9.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var OHt=G.objectWithoutOptionalProperties({results:G.string()});var WLe=G.enum_(["data","protocol"]);var PHt=G.objectWithoutOptionalProperties({discriminantProperty:G.string(),discriminantPropertyNameOverride:G.string().optional(),discriminatorContext:WLe.optional(),commonProperties:G.list(G.lazyObject(()=>wHt)),schemas:G.record(G.string(),G.lazy(()=>Sc))}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(qw).extend(Lo).extend(ac).extend(pf);var THt=G.objectWithoutOptionalProperties({default:G.number().optional(),minimum:G.number().optional(),maximum:G.number().optional(),exclusiveMinimum:G.boolean().optional(),exclusiveMaximum:G.boolean().optional(),multipleOf:G.number().optional()});var DHt=G.unknown();var RHt=G.objectWithoutOptionalProperties({sse:G.boolean(),events:G.list(G.lazy(()=>lm))});var FHt=G.union("type",{withStreaming:RHt,withoutStreaming:G.object({value:G.lazy(()=>lm)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return rM.withStreaming(e);case"withoutStreaming":return rM.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var $Le=G.objectWithoutOptionalProperties({name:G.string(),value:G.lazy(()=>lm)});var kHt=G.objectWithoutOptionalProperties({name:G.string(),parameterNameOverride:G.string().optional(),value:G.lazy(()=>lm)});var HLe=G.objectWithoutOptionalProperties({name:G.string(),value:G.lazy(()=>lm)});var QHt=G.objectWithoutOptionalProperties({name:G.string().optional(),pathParameters:G.list(kHt).optional(),queryParameters:G.list(HLe).optional(),headers:G.list($Le).optional(),request:G.lazy(()=>lm).optional(),response:FHt.optional(),codeSamples:G.list(BHt)}).extend(pn);var KLe=G.union("type",{unknown:G.object({value:DHt}),full:QHt}).transform({transform:e=>{switch(e.type){case"unknown":return tM.unknown(e.value);case"full":return tM.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var Y9=G.objectWithoutOptionalProperties({groupName:cpe,methodName:G.string()});var JLe=G.list(G.record(ppe,G.list(G.string())));var fpe=G.objectWithoutOptionalProperties({name:G.string(),schema:G.lazy(()=>Sc),env:G.string().optional(),parameterNameOverride:G.string().optional()}).extend(pn).extend(ts).extend(Lo);var YLe=G.objectWithoutOptionalProperties({name:G.string().optional(),url:G.string().optional(),audiences:G.list(G.string()).optional()});var NHt=G.objectWithoutOptionalProperties({name:G.string().optional(),description:G.string().optional(),example:G.lazy(()=>lm)});var jHt=G.objectWithoutOptionalProperties({schema:G.lazy(()=>Sc).optional(),examples:G.list(NHt).optional()}).extend(pn).extend(bu).extend(Lo);var XLe=G.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var MHt=G.objectWithoutOptionalProperties({offset:G.string(),results:G.string(),step:G.string().optional(),hasNextPage:G.string().optional()});var LHt=G.objectWithoutOptionalProperties({nextPath:G.string(),results:G.string()});var UHt=G.objectWithoutOptionalProperties({nextUri:G.string(),results:G.string()});var ZLe=G.union("type",{cursor:CHt,offset:MHt,custom:OHt,uri:UHt,path:LHt}).transform({transform:e=>{switch(e.type){case"cursor":return bI.cursor(e);case"offset":return bI.offset(e);case"custom":return bI.custom(e);case"uri":return bI.uri(e);case"path":return bI.path(e);default:return e}},untransform:({_visit:e,...t})=>t});var eUe=G.objectWithoutOptionalProperties({name:G.string(),schema:G.lazy(()=>Sc),variableReference:G.string().optional(),parameterNameOverride:G.string().optional()}).extend(pn).extend(ts).extend(Lo);var tUe=G.objectWithoutOptionalProperties({name:G.string(),schema:G.lazy(()=>Sc),parameterNameOverride:G.string().optional(),explode:G.boolean().optional()}).extend(pn).extend(ts).extend(Lo);var zHt=G.objectWithoutOptionalProperties({schema:G.lazy(()=>Sc),contentType:G.string().optional(),additionalProperties:G.boolean()}).extend(pn).extend(Lo);var VHt=G.objectWithoutOptionalProperties({schema:G.lazy(()=>Sc),contentType:G.string().optional(),additionalProperties:G.boolean()}).extend(pn).extend(Lo);var qHt=G.enum_(["json","form"]);var GHt=G.objectWithoutOptionalProperties({isOptional:G.boolean(),isArray:G.boolean()}).extend(pn);var WHt=G.union("type",{file:GHt,json:G.object({value:G.lazy(()=>Sc)})}).transform({transform:e=>{switch(e.type){case"file":return $9.file(e);case"json":return $9.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var dpe=G.objectWithoutOptionalProperties({key:G.string(),schema:WHt,contentType:G.string().optional(),exploded:G.boolean().optional(),encoding:qHt.optional()}).extend(pn);var rUe=G.objectWithoutOptionalProperties({name:G.string().optional(),properties:G.list(dpe)}).extend(pn).extend(Lo);var nUe=G.objectWithoutOptionalProperties({contentType:G.string().optional()}).extend(pn).extend(Lo);var $Ht=G.union("type",{octetStream:nUe,multipart:rUe,json:VHt,formUrlEncoded:zHt}).transform({transform:e=>{switch(e.type){case"octetStream":return Z5.octetStream(e);case"multipart":return Z5.multipart(e);case"json":return Z5.json(e);case"formUrlEncoded":return Z5.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var iUe=G.objectWithoutOptionalProperties({}).extend(pn).extend(Lo).extend(nM);var oUe=G.objectWithoutOptionalProperties({schema:G.lazy(()=>Sc),responseProperty:G.string().optional(),terminator:G.string().optional()}).extend(pn).extend(Lo).extend(nM);var mpe=G.objectWithoutOptionalProperties({}).extend(pn).extend(Lo).extend(nM);var sUe=G.union("type",{file:iUe,json:oUe,text:mpe,bytes:GLe,streamingSse:oUe,streamingText:mpe,streamingJson:oUe}).transform({transform:e=>{switch(e.type){case"file":return a_.file(e);case"json":return a_.json(e);case"text":return a_.text(e);case"bytes":return a_.bytes(e);case"streamingSse":return a_.streamingSse(e);case"streamingText":return a_.streamingText(e);case"streamingJson":return a_.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var aUe=G.union("type",{disabled:G.object({value:G.boolean().optional()})}).transform({transform:e=>e.type==="disabled"?Bmt.disabled(e.value):e,untransform:({_visit:e,...t})=>t});var HHt=G.objectWithoutOptionalProperties({authed:G.boolean(),security:JLe.optional(),internal:G.boolean().optional(),idempotent:G.boolean().optional(),method:XLe,audiences:G.list(G.string()),path:G.string(),summary:G.string().optional(),operationId:G.string().optional(),tags:G.list(YO),pathParameters:G.list(eUe),queryParameters:G.list(tUe),headers:G.list(fpe),sdkName:Y9.optional(),generatedRequestName:G.string(),requestNameOverride:G.string().optional(),request:$Ht.optional(),response:sUe.optional(),errors:G.record(K9,jHt),servers:G.list(YLe),examples:G.list(KLe),pagination:ZLe.optional(),retries:aUe.optional()}).extend(pn).extend(ts).extend(Lo).extend(Va);var KHt=G.objectWithoutOptionalProperties({header:G.string(),name:G.string().optional(),optional:G.boolean().optional(),env:G.string().optional(),schema:G.lazy(()=>Sc).optional()});var JHt=G.list(G.record(ppe,G.list(G.string())));var YHt=G.enum_(["body","timestamp","notification-url","message-id"]);var XHt=G.objectWithoutOptionalProperties({components:G.list(YHt),delimiter:G.string().optional()});var ZHt=G.enum_(["sha256","sha1","sha384","sha512"]);var eKt=G.objectWithoutOptionalProperties({header:G.string(),algorithm:ZHt.optional(),encoding:VLe.optional(),signaturePrefix:G.string().optional(),payloadFormat:XHt.optional(),timestamp:qLe.optional()});var tKt=G.objectWithoutOptionalProperties({header:G.string(),name:G.string().optional(),env:G.string().optional(),schema:G.lazy(()=>Sc).optional()});var rKt=G.objectWithoutOptionalProperties({default:G.number().optional(),minimum:G.number().optional(),maximum:G.number().optional(),exclusiveMinimum:G.boolean().optional(),exclusiveMaximum:G.boolean().optional(),multipleOf:G.number().optional()});var nKt=G.union("type",{boolean:G.object({value:G.boolean()}),string:G.object({value:G.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return wg.boolean(e.value);case"string":return wg.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var uUe=G.objectWithoutOptionalProperties({value:nKt}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(ac);var iKt=G.objectWithoutOptionalProperties({default:G.number().optional()});var oKt=G.objectWithoutOptionalProperties({default:G.string().optional(),pattern:G.string().optional(),format:G.string().optional(),minLength:G.number().optional(),maxLength:G.number().optional()});var sKt=G.union("type",{int:rKt,int64:iKt,uint:G.object({}),uint64:G.object({}),float:G.object({}),double:THt,string:oKt,datetime:G.object({}),datetimeRfc2822:G.object({}),date:G.object({}),base64:G.object({}),boolean:IHt}).transform({transform:e=>{switch(e.type){case"int":return Mc.int(e);case"int64":return Mc.int64(e);case"uint":return Mc.uint();case"uint64":return Mc.uint64();case"float":return Mc.float();case"double":return Mc.double(e);case"string":return Mc.string(e);case"datetime":return Mc.datetime();case"datetimeRfc2822":return Mc.datetimeRfc2822();case"date":return Mc.date();case"base64":return Mc.base64();case"boolean":return Mc.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var hpe=G.objectWithoutOptionalProperties({schema:sKt}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(ac);var aKt=G.objectWithoutOptionalProperties({key:hpe,value:G.lazy(()=>Sc),minProperties:G.number().optional(),maxProperties:G.number().optional()}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(qw).extend(ac).extend(pf);var uKt=G.objectWithoutOptionalProperties({name:G.string().optional(),properties:G.list(dpe)}).extend(pn).extend(Lo);var cKt=G.objectWithoutOptionalProperties({value:G.lazy(()=>Sc)}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(ac).extend(pf);var cUe=G.objectWithoutOptionalProperties({differentSchema:G.boolean()});var lKt=G.objectWithoutOptionalProperties({key:G.string(),schema:G.lazy(()=>Sc),readonly:G.boolean().optional(),writeonly:G.boolean().optional(),conflict:G.record(JO,cUe),generatedName:G.string(),nameOverride:G.string().optional(),audiences:G.list(G.string())}).extend(ts);var X9=G.objectWithoutOptionalProperties({schema:JO}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(Lo).extend(ac);var pKt=G.objectWithoutOptionalProperties({allOf:G.list(X9),properties:G.list(G.lazyObject(()=>lKt)),allOfPropertyConflicts:G.list(zLe),additionalProperties:G.boolean(),minProperties:G.number().optional(),maxProperties:G.number().optional()}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(qw).extend(Lo).extend(ac).extend(pf);var fKt=G.union("type",{discriminated:G.lazyObject(()=>PHt),undiscriminated:G.lazyObject(()=>dKt)}).transform({transform:e=>{switch(e.type){case"discriminated":return H9.discriminated(e);case"undiscriminated":return H9.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var mKt=G.objectWithoutOptionalProperties({rootSchemas:G.record(JO,G.lazy(()=>Sc)),namespacedSchemas:G.record(tHt,G.record(JO,G.lazy(()=>Sc)))});var hKt=G.objectWithoutOptionalProperties({summary:G.string().optional(),description:G.string().optional()});var gKt=G.objectWithoutOptionalProperties({tagsById:G.record(YO,fHt),orderedTagIds:G.list(YO).optional()});var lUe=G.objectWithoutOptionalProperties({name:G.string().optional(),payload:G.lazy(()=>lm)}).extend(pn);var pUe=G.enum_(["GET","POST"]);var fUe=G.union("type",{hmac:eKt,asymmetric:vHt}).transform({transform:e=>{switch(e.type){case"hmac":return a_e.hmac(e);case"asymmetric":return a_e.asymmetric(e);default:return e}},untransform:({_visit:e,...t})=>t});var AKt=G.objectWithoutOptionalProperties({audiences:G.list(G.string()),sdkName:Y9.optional(),method:pUe,summary:G.string().optional(),operationId:G.string(),tags:G.list(YO),headers:G.list(fpe),generatedPayloadName:G.string(),payload:G.lazy(()=>Sc),multipartFormData:uKt.optional(),response:sUe.optional(),signatureVerification:fUe.optional(),examples:G.list(lUe)}).extend(pn).extend(Lo).extend(Va);var yKt=G.objectWithoutOptionalProperties({queryParameters:G.list(tUe),headers:G.list(fpe),pathParameters:G.list(eUe)});var bKt=G.enum_(["client","server"]);var EKt=G.objectWithoutOptionalProperties({name:G.string(),origin:bKt,body:G.lazy(()=>Sc),methodName:G.string().optional()});var vKt=G.objectWithoutOptionalProperties({name:G.string(),url:G.string()});var IKt=G.objectWithoutOptionalProperties({messageType:G.string(),payload:G.lazy(()=>lm)}).extend(pn);var wKt=G.objectWithoutOptionalProperties({name:G.string().optional(),queryParameters:G.list(HLe).optional(),headers:G.list($Le).optional(),messages:G.list(IKt)}).extend(pn);var CKt=G.objectWithoutOptionalProperties({audiences:G.list(G.string()),path:G.string(),groupName:cpe,summary:G.string().optional(),connectMethodName:G.string().optional(),handshake:yKt,messages:G.list(EKt),servers:G.list(vKt),examples:G.list(wKt)}).extend(pn).extend(Lo);var FHo=G.objectWithoutOptionalProperties({apiVersion:G.unknown().optional(),title:G.string().optional(),description:G.string().optional(),basePath:G.string().optional(),servers:G.list(Rmt),websocketServers:G.list(Rmt),groups:G.record(G.string(),hKt),tags:gKt,hasEndpointsMarkedInternal:G.boolean(),endpoints:G.list(HHt),webhooks:G.list(AKt),channels:G.record(G.string(),CKt),groupedSchemas:mKt,variables:G.record(G.string(),hpe),nonRequestReferencedSchemas:G.set(JO),securitySchemes:G.record(ppe,lHt),security:JHt.optional(),globalHeaders:G.list(KHt).optional(),idempotencyHeaders:G.list(tKt).optional()});var xKt=G.objectWithoutOptionalProperties({value:G.lazy(()=>Sc)}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(ac).extend(pf);var _Kt=G.objectWithoutOptionalProperties({}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(ac);var Sc=G.union("type",{primitive:hpe,object:G.lazyObject(()=>pKt),array:G.lazyObject(()=>yHt),map:G.lazyObject(()=>aKt),optional:G.lazyObject(()=>xKt),enum:MLe,reference:X9,literal:uUe,oneOf:G.object({value:G.lazy(()=>fKt)}),nullable:G.lazyObject(()=>cKt),unknown:_Kt}).transform({transform:e=>{switch(e.type){case"primitive":return aa.primitive(e);case"object":return aa.object(e);case"array":return aa.array(e);case"map":return aa.map(e);case"optional":return aa.optional(e);case"enum":return aa.enum(e);case"reference":return aa.reference(e);case"literal":return aa.literal(e);case"oneOf":return aa.oneOf(e.value);case"nullable":return aa.nullable(e);case"unknown":return aa.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var dKt=G.objectWithoutOptionalProperties({schemas:G.list(G.lazy(()=>Sc))}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(qw).extend(Lo).extend(ac).extend(pf);var NHn={};Y(NHn,{ArraySchemaWithExample:()=>SKt,Base64WithExample:()=>BKt,BooleanWithExample:()=>OKt,CommonPropertyWithExample:()=>PKt,DateWithExample:()=>TKt,DatetimeWithExample:()=>Fmt,DiscriminatedOneOfSchemaWithExample:()=>DKt,DoubleWithExample:()=>RKt,EndpointWithExample:()=>kHo,EnumSchemaWithExample:()=>UKt,FloatWithExample:()=>zKt,HeaderWithExample:()=>gpe,HttpErrorWithExample:()=>FKt,Int64WithExample:()=>VKt,IntWithExample:()=>qKt,JsonRequestWithExample:()=>QKt,JsonResponseWithExample:()=>mUe,MapSchemaWithExample:()=>KKt,MultipartFormDataWebhookPayloadWithExample:()=>JKt,NamedFullExample:()=>GD,NullableSchemaWithExample:()=>YKt,ObjectPropertyWithExample:()=>XKt,ObjectSchemaWithExample:()=>ZKt,OneOfSchemaWithExample:()=>eJt,OptionalSchemaWithExample:()=>rJt,ParseFormUrlEncodedRequest:()=>NKt,ParseMultipartRequest:()=>jKt,ParseOctetStreamRequest:()=>MKt,PathParameterWithExample:()=>kKt,PrimitiveSchemaValueWithExample:()=>HKt,PrimitiveSchemaWithExample:()=>gUe,QueryParameterWithExample:()=>dUe,RequestWithExample:()=>LKt,ResponseWithExample:()=>hUe,SchemaWithExample:()=>ff,StringSchemaWithExample:()=>GKt,Uint64WithExample:()=>WKt,UintWithExample:()=>$Kt,UnDiscriminatedOneOfSchemaWithExample:()=>tJt,UnknownSchemaWithExample:()=>nJt,WebhookWithExample:()=>QHo,WebsocketHandshakeWithExample:()=>NHo});var SKt=G.objectWithoutOptionalProperties({value:G.lazy(()=>ff),minItems:G.number().optional(),maxItems:G.number().optional(),example:G.list(G.unknown()).optional()}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(ac).extend(pf);var BKt=G.objectWithoutOptionalProperties({example:G.string().optional()});var OKt=G.objectWithoutOptionalProperties({default:G.boolean().optional(),example:G.boolean().optional()});var PKt=G.objectWithoutOptionalProperties({key:G.string(),schema:G.lazy(()=>ff)});var Fmt=G.objectWithoutOptionalProperties({example:G.string().optional()});var TKt=G.objectWithoutOptionalProperties({example:G.string().optional()});var DKt=G.objectWithoutOptionalProperties({discriminantProperty:G.string(),discriminantPropertyNameOverride:G.string().optional(),discriminatorContext:WLe.optional(),commonProperties:G.list(G.lazyObject(()=>PKt)),schemas:G.record(G.string(),G.lazy(()=>ff))}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(qw).extend(Lo).extend(ac).extend(pf);var RKt=G.objectWithoutOptionalProperties({default:G.number().optional(),minimum:G.number().optional(),maximum:G.number().optional(),exclusiveMinimum:G.boolean().optional(),exclusiveMaximum:G.boolean().optional(),multipleOf:G.number().optional(),example:G.number().optional()});var gpe=G.objectWithoutOptionalProperties({name:G.string(),schema:G.lazy(()=>ff),env:G.string().optional(),parameterNameOverride:G.string().optional()}).extend(pn).extend(ts).extend(Lo);var GD=G.objectWithoutOptionalProperties({name:G.string().optional(),value:G.unknown()}).extend(pn);var FKt=G.objectWithoutOptionalProperties({statusCode:K9,schema:G.lazy(()=>ff),fullExamples:G.list(GD).optional()}).extend(pn).extend(bu).extend(Lo);var kKt=G.objectWithoutOptionalProperties({name:G.string(),schema:G.lazy(()=>ff),variableReference:G.string().optional(),parameterNameOverride:G.string().optional(),explode:G.boolean().optional()}).extend(pn).extend(ts).extend(Lo);var dUe=G.objectWithoutOptionalProperties({name:G.string(),schema:G.lazy(()=>ff),parameterNameOverride:G.string().optional(),explode:G.boolean().optional()}).extend(pn).extend(ts).extend(Lo);var QKt=G.objectWithoutOptionalProperties({schema:G.lazy(()=>ff),contentType:G.string().optional(),fullExamples:G.list(GD).optional(),additionalProperties:G.boolean()}).extend(pn).extend(Lo).extend(J9);var NKt=G.objectWithoutOptionalProperties({schema:G.lazy(()=>ff),contentType:G.string().optional(),fullExamples:G.list(GD).optional(),additionalProperties:G.boolean()}).extend(pn).extend(Lo).extend(J9);var jKt=G.objectWithoutOptionalProperties({fullExamples:G.list(GD).optional()}).extend(rUe).extend(J9);var MKt=G.objectWithoutOptionalProperties({}).extend(nUe).extend(J9);var LKt=G.union("type",{octetStream:MKt,multipart:jKt,json:QKt,formUrlEncoded:NKt}).transform({transform:e=>{switch(e.type){case"octetStream":return KO.octetStream(e);case"multipart":return KO.multipart(e);case"json":return KO.json(e);case"formUrlEncoded":return KO.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var mUe=G.objectWithoutOptionalProperties({schema:G.lazy(()=>ff),responseProperty:G.string().optional(),terminator:G.string().optional(),fullExamples:G.list(GD).optional()}).extend(pn).extend(Lo).extend(nM);var hUe=G.union("type",{file:iUe,json:mUe,text:mpe,bytes:GLe,streamingSse:mUe,streamingText:mpe,streamingJson:mUe}).transform({transform:e=>{switch(e.type){case"file":return wh.file(e);case"json":return wh.json(e);case"text":return wh.text(e);case"bytes":return wh.bytes(e);case"streamingSse":return wh.streamingSse(e);case"streamingText":return wh.streamingText(e);case"streamingJson":return wh.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var kHo=G.objectWithoutOptionalProperties({authed:G.boolean(),security:JLe.optional(),internal:G.boolean().optional(),idempotent:G.boolean().optional(),method:XLe,audiences:G.list(G.string()),path:G.string(),summary:G.string().optional(),operationId:G.string().optional(),tags:G.list(YO),pathParameters:G.list(kKt),queryParameters:G.list(dUe),headers:G.list(gpe),sdkName:Y9.optional(),generatedRequestName:G.string(),requestNameOverride:G.string().optional(),request:LKt.optional(),response:hUe.optional(),errors:G.record(K9,FKt),servers:G.list(YLe),examples:G.list(KLe),pagination:ZLe.optional(),retries:aUe.optional()}).extend(pn).extend(ts).extend(Lo).extend(Va);var UKt=G.objectWithoutOptionalProperties({default:lpe.optional(),values:G.list(lpe),example:G.string().optional()}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(Lo).extend(ac).extend(pf);var zKt=G.objectWithoutOptionalProperties({example:G.number().optional()});var VKt=G.objectWithoutOptionalProperties({default:G.number().optional(),example:G.number().optional()});var qKt=G.objectWithoutOptionalProperties({default:G.number().optional(),minimum:G.number().optional(),maximum:G.number().optional(),exclusiveMinimum:G.boolean().optional(),exclusiveMaximum:G.boolean().optional(),multipleOf:G.number().optional(),example:G.number().optional()});var GKt=G.objectWithoutOptionalProperties({default:G.string().optional(),pattern:G.string().optional(),format:G.string().optional(),minLength:G.number().optional(),maxLength:G.number().optional(),example:G.string().optional()});var WKt=G.objectWithoutOptionalProperties({default:G.number().optional(),example:G.number().optional()});var $Kt=G.objectWithoutOptionalProperties({default:G.number().optional(),example:G.number().optional()});var HKt=G.union("type",{int:qKt,int64:VKt,uint:$Kt,uint64:WKt,float:zKt,double:RKt,string:GKt,datetime:Fmt,datetimeRfc2822:Fmt,date:TKt,base64:BKt,boolean:OKt}).transform({transform:e=>{switch(e.type){case"int":return Ii.int(e);case"int64":return Ii.int64(e);case"uint":return Ii.uint(e);case"uint64":return Ii.uint64(e);case"float":return Ii.float(e);case"double":return Ii.double(e);case"string":return Ii.string(e);case"datetime":return Ii.datetime(e);case"datetimeRfc2822":return Ii.datetimeRfc2822(e);case"date":return Ii.date(e);case"base64":return Ii.base64(e);case"boolean":return Ii.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var gUe=G.objectWithoutOptionalProperties({schema:HKt}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(ac);var KKt=G.objectWithoutOptionalProperties({key:gUe,value:G.lazy(()=>ff),minProperties:G.number().optional(),maxProperties:G.number().optional(),example:G.unknown().optional()}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(qw).extend(ac).extend(pf);var JKt=G.objectWithoutOptionalProperties({name:G.string().optional(),properties:G.list(dpe)}).extend(pn).extend(Lo);var YKt=G.objectWithoutOptionalProperties({value:G.lazy(()=>ff)}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(ac).extend(pf);var XKt=G.objectWithoutOptionalProperties({key:G.string(),schema:G.lazy(()=>ff),readonly:G.boolean().optional(),writeonly:G.boolean().optional(),audiences:G.list(G.string()),conflict:G.record(JO,cUe),nameOverride:G.string().optional(),generatedName:G.string()}).extend(ts);var ZKt=G.objectWithoutOptionalProperties({allOf:G.list(X9),properties:G.list(G.lazyObject(()=>XKt)),allOfPropertyConflicts:G.list(zLe),fullExamples:G.list(GD).optional(),additionalProperties:G.boolean(),minProperties:G.number().optional(),maxProperties:G.number().optional()}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(qw).extend(Lo).extend(ac).extend(pf);var eJt=G.union("type",{discriminated:G.lazyObject(()=>DKt),undiscriminated:G.lazyObject(()=>tJt)}).transform({transform:e=>{switch(e.type){case"discriminated":return Z2.discriminated(e);case"undiscriminated":return Z2.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var rJt=G.objectWithoutOptionalProperties({value:G.lazy(()=>ff)}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(ac).extend(pf);var nJt=G.objectWithoutOptionalProperties({example:G.unknown()}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(ac);var ff=G.union("type",{primitive:gUe,object:G.lazyObject(()=>ZKt),array:G.lazyObject(()=>SKt),map:G.lazyObject(()=>KKt),optional:G.lazyObject(()=>rJt),enum:UKt,reference:X9,literal:uUe,oneOf:G.object({value:G.lazy(()=>eJt)}),nullable:G.lazyObject(()=>YKt),unknown:nJt}).transform({transform:e=>{switch(e.type){case"primitive":return Fr.primitive(e);case"object":return Fr.object(e);case"array":return Fr.array(e);case"map":return Fr.map(e);case"optional":return Fr.optional(e);case"enum":return Fr.enum(e);case"reference":return Fr.reference(e);case"literal":return Fr.literal(e);case"oneOf":return Fr.oneOf(e.value);case"nullable":return Fr.nullable(e);case"unknown":return Fr.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var tJt=G.objectWithoutOptionalProperties({schemas:G.list(G.lazy(()=>ff))}).extend(sc).extend(Va).extend(bu).extend(pn).extend(ts).extend(qw).extend(Lo).extend(ac).extend(pf);var QHo=G.objectWithoutOptionalProperties({audiences:G.list(G.string()),sdkName:Y9.optional(),method:pUe,summary:G.string().optional(),operationId:G.string(),tags:G.list(YO),headers:G.list(gpe),generatedPayloadName:G.string(),payload:G.lazy(()=>ff),multipartFormData:JKt.optional(),response:hUe.optional(),signatureVerification:fUe.optional(),examples:G.list(lUe)}).extend(pn).extend(Lo).extend(Va);var NHo=G.objectWithoutOptionalProperties({queryParameters:G.list(dUe),headers:G.list(gpe)});var jHo=/^(\d+)/,AUe=/^[a-zA-Z][a-zA-Z0-9_]*$/,MHo={"<":"LESS_THAN",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL_TO","<=":"LESS_THAN_OR_EQUAL_TO","!=":"NOT_EQUALS","=":"EQUAL_TO","==":"EQUAL_TO","*":"ALL","":"EMPTY",'""':"EMPTY_STRING","-":"HYPHEN","|":"PIPE",".":"DOT","/":"SLASH"};function c_e(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],n=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let s=Math.floor(e/10),a=e%10;return a===0?n[s]:`${n[s]}_${t[a]}`}if(e<1e3){let s=Math.floor(e/100),a=e%100;return a===0?`${t[s]}_hundred`:`${t[s]}_hundred_${c_e(a)}`}let i=Math.floor(e/1e3),o=e%1e3;return o===0?`${t[i]}_thousand`:`${t[i]}_thousand_${c_e(o)}`}Ci();function kmt(e){let t=e.match(jHo);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let o=c_e(i);return n.length>0?`${o}_${n}`:o}}}function yUe(e){let t=kmt(e),r=MHo[e];return t!=null?Nc(Ln(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":Nc(Ln(e)))}Ci();function WD(e,t){return e.type==="primitive"&&t.type==="primitive"?LHo(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?iFc(e.values,t.values):e.type==="array"&&t.type==="array"?WD(e.value,t.value):e.type==="unknown"&&t.type==="unknown"?!0:e.type==="reference"&&t.type==="reference"?e.schema===t.schema:e.type==="optional"&&t.type==="optional"?WD(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?oFc(e.value,t.value):e.type==="object"&&t.type==="object"?sFc(e,t):e.type==="map"&&t.type==="map"?LHo(e.key.schema,t.key.schema)&&WD(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function LHo(e,t){return e.type===t.type}function iFc(e,t){let r=new Set(e.map(i=>i.value)),n=new Set(t.map(i=>i.value));return Nb(r,n)}function oFc(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,n])=>{let i=t.schemas[r];return i==null?!1:WD(n,i)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,n)=>{let i=t.schemas[n];return i==null?!1:WD(r,i)}):!1}function sFc(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(n=>[n.key,n.schema]));return Object.entries(t.properties).every(([n,i])=>{let o=r[n];return o==null?!1:WD(o,i.schema)})}Rt();function ly(e){switch(e){case Mw.Deprecated:return"deprecated";case Mw.Beta:return"pre-release";case Mw.GenerallyAvailable:return"generally-available";default:return}}Rt();function Qmt(e){if(e.type==="protobuf")return{proto:{type:e.typeName}};xe(e.type)}Rt();Rt();gg();Ci();function UHo(e){let t=e.match(/^(_+)/),r=e.match(/(_+)$/),n=t?.[1]??"",i=r?.[1]??"";if(n===""&&i==="")return Ln(e);if(n.length+i.length>=e.length)return e;let o=e.slice(n.length,e.length-i.length||void 0);return`${n}${Ln(o)}${i}`}function aFc(e){let t=e.find(n=>typeof n=="object"&&n.type==="namespace"),r=e.filter(n=>typeof n=="string"||n.type!=="namespace");return t?[t,...r]:r}function zHo(e){let t=e?aFc(e):void 0;if(t==null||t.length===0)return Wxe;let r=[];for(let[n,i]of t.entries())typeof i=="string"?r.push(UHo(i)):typeof i=="object"?i.type==="namespace"?n<t.length-1?r.push(UHo(i.name)):r.push(i.name,Wxe):xe(i.type):xe(i);return r.join("/")}function tne(e){return Ss.of(`${zHo(e)}.yml`)}function jHn({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?Wxe:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,zHo(r))}function VHo({sdkName:e,namespaceOverride:t}){return Ss.of(`${jHn({sdkName:e,namespaceOverride:t})}.yml`)}function qHo({location:e,namespaceOverride:t}){return t!=null?jb(Ss.of(t),e):e}function GHo(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"unknown":return iJt({namespace:e.namespace,groupName:e.groupName});case"oneOf":return iJt({namespace:e.value.namespace,groupName:e.value.groupName});default:xe(e)}}function iJt({namespace:e,groupName:t}){return e!=null&&t!=null?tne([{type:"namespace",name:e},...t]):e!=null?tne([{type:"namespace",name:e}]):tne(t)}Rt();function rne(e){switch(e.type){case"object":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"primitive":case"unknown":return e.groupName??void 0;case"oneOf":return e.value.groupName??void 0;default:xe(e)}}function Kl(e){return typeof e=="string"?e:e.type}function bUe(e){if(typeof e!="string")return e.docs}function Nmt(e){if(typeof e!="string")return e.default}function MHn(e){if(typeof e!="string")return e.validation}function EUe(e){let t=e.match(/^optional<\s*nullable<\s*(.+)\s*>\s*>$/);if(t!=null&&t[1]!=null)return t[1].trim();let r=e.match(/^nullable<\s*(.+)\s*>$/);return r!=null&&r[1]!=null?r[1].trim():e}function $Ho(e){let t=Kl(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?WHo(e):{...e,type:WHo(e.type)}}function WHo(e){return e.startsWith("nullable<")||e.startsWith("optional<nullable<")?e:e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function l_e(e){return Kl(e).startsWith("optional<")?e:typeof e=="string"?HHo(e):{...e,type:HHo(e.type)}}function HHo(e){return e.startsWith("optional<")?e:`optional<${e}>`}var uFc=-2147483648,cFc=2147483647,lFc=-17976931348623157e292,pFc=17976931348623157e292;function Ka({schema:e,fileContainingReference:t,declarationFile:r=t,context:n,namespace:i,declarationDepth:o,variant:s}){switch(n.shouldMarkSchemaAsReferenced()&&n.markSchemaAsReferenced(e,i),e.type){case"primitive":return oJt(e);case"array":return zHn({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"map":return VHn({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"reference":return UHn({schema:e,fileContainingReference:t,context:n,namespace:i,variant:s});case"unknown":return GHn();case"optional":return sJt({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"nullable":return qHn({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"enum":return EFc({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:o});case"literal":return e.value,WHn(e);case"object":return vFc({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});case"oneOf":return IFc({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});default:xe(e)}}function oJt(e){switch(e.schema.type){case"string":return mFc({description:e.description,schema:e.schema});case"int":return hFc({description:e.description,schema:e.schema});case"float":return gFc({description:e.description,schema:e.schema});case"double":return AFc({description:e.description,schema:e.schema});case"boolean":return fFc({description:e.description,schema:e.schema});case"int64":return dFc({description:e.description,schema:e.schema})}let t=e.schema._visit({int:()=>"integer",int64:()=>"long",uint:()=>"uint",uint64:()=>"uint64",float:()=>"double",double:()=>"double",string:()=>"string",datetime:()=>"datetime",datetimeRfc2822:()=>"datetime-rfc-2822",date:()=>"date",base64:()=>"base64",boolean:()=>"boolean",_other:()=>"unknown"});return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ly(e.availability)}:{}}}function fFc({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function dFc({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function mFc({description:e,schema:t}){let r="string",n=yFc(t);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function hFc({description:e,schema:t}){let r="integer",n=KHo(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function gFc({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function AFc({description:e,schema:t}){let r="double",n=KHo(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function yFc(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,o=bFc(t);if(!(o==null&&r==null&&n==null&&i==null))return{format:o,pattern:r,minLength:n,maxLength:i}}function bFc(e){switch(e){case"date":case"date-time":case"password":case"byte":case"bytes":case"binary":case"email":case"uuid":case"uri":case"hostname":case"ipv4":case"ipv6":return e;default:return}}function KHo(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:o,exclusiveMaximum:s}=e;if(r=LHn(r,t),n=LHn(n,t),i=LHn(i,t),!(r==null&&n==null&&o==null&&s==null&&i==null))return{min:r,max:n,exclusiveMin:o,exclusiveMax:s,multipleOf:i}}function LHn(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[uFc,cFc]:[lFc,pFc];return e<r||e>n?void 0:e}function UHn({schema:e,fileContainingReference:t,context:r,variant:n}){let i=r.getSchema(e.schema,e.namespace);if(i==null)return"unknown";let o=wFc(i)??e.schema,s=r.options.respectReadonlySchemas&&n!=null?r.getSchemaFinalName(o,n):o,a=rne(i),u=CFc(i),l=aJt({context:r,fileContainingReference:t,declarationFile:iJt({namespace:e.namespace,groupName:a}),type:s});return i.type==="nullable"&&(l=r.options.wrapReferencesToNullableInOptional?`optional<${l}>`:`nullable<${l}>`),i.type==="optional"&&!l.startsWith("optional<")&&(l=`optional<${l}>`),e.description==null&&u==null?l:{type:l,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ly(e.availability)}:{}}}function zHn({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=Ka({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=`list<${Kl(a)}>`;return e.description==null&&e.title==null?u:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ly(e.availability)}:{},type:u}}function VHn({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=oJt(e.key),u=Ka({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),c=e.encoding!=null?Qmt(e.encoding):void 0,l=`map<${Kl(a)}, ${Kl(u)}>`;if(e.description==null&&c==null&&e.title==null)return l;let p={type:l};return e.description!=null&&(p.docs=e.description),e.encoding!=null&&(p.encoding=c),e.availability!=null&&(p.availability=ly(e.availability)),p}function qHn({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){if(!n.options.respectNullableSchemas)return sJt({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:o,variant:s});let a=Ka({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=Kl(a),c=bUe(a),l=Nmt(a),p=MHn(a),d=$Ho(u);if(n.options.wrapReferencesToNullableInOptional&&(d=l_e(d)),e.availability==null&&e.description==null&&c==null&&l==null&&p==null&&e.title==null)return d;let f=typeof d=="string"?{type:d}:d;return(e.description!=null||c!=null)&&(f.docs=e.description??c),l!=null&&(f.default=l),p!=null&&(f.validation=p),e.availability!=null&&(f.availability=ly(e.availability)),f}function sJt({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=Ka({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=Kl(a),c=bUe(a),l=Nmt(a),p=MHn(a),d=l_e(u);if(e.availability==null&&e.description==null&&c==null&&l==null&&p==null&&e.title==null)return d;let f=typeof d=="string"?{type:d}:d;return(e.description!=null||c!=null)&&(f.docs=e.description??c),l!=null&&(f.default=l),p!=null&&(f.validation=p),e.availability!=null&&(f.availability=ly(e.availability)),f}function GHn(){return"unknown"}function WHn(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:xe(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ly(e.availability)}:{}}}function EFc({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let o=jmt(e,i),s=e.nameOverride??e.generatedName;n.builder.addType(r,{name:s,schema:o.schema});let a=aJt({type:s,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return a;let u={type:a};return e.description!=null&&(u.docs=e.description),e.default!=null&&(u.default=e.default.value),e.availability!=null&&(u.availability=ly(e.availability)),u}function vFc({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=p_e({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=e.nameOverride??e.generatedName;n.builder.addType(r,{name:u,schema:a.schema});let c=aJt({type:u,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?c:{type:c,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ly(e.availability)}:{}}}function IFc({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}){let a=$Hn({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:o,variant:s}),u=e.nameOverride??e.generatedName;n.builder.addType(r,{name:u,schema:a.schema});let c=aJt({type:u,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?c:{...e.title!=null?{"display-name":e.title}:{},type:c,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:ly(e.availability)}:{}}}function aJt({type:e,fileContainingReference:t,declarationFile:r,context:n}){if(r===t)return e;let i=n.builder.addImport({file:t,fileToImport:r});return i!=null?`${i}.${e}`:e}function wFc(e){return aa._visit(e,{primitive:t=>t.nameOverride??t.generatedName,object:t=>t.nameOverride??t.generatedName,array:t=>t.nameOverride??t.generatedName,map:t=>t.nameOverride??t.generatedName,enum:t=>t.nameOverride??t.generatedName,reference:t=>t.nameOverride??t.generatedName,literal:t=>t.nameOverride??t.generatedName,oneOf:t=>t.nameOverride??t.generatedName,optional:t=>t.nameOverride??t.generatedName,nullable:t=>t.nameOverride??t.generatedName,unknown:t=>t.nameOverride??t.generatedName,_other:()=>{}})}function CFc(e){return aa._visit(e,{primitive:t=>t.title,object:t=>t.title,array:t=>t.title,map:t=>t.title,enum:t=>t.title,reference:t=>t.title,literal:t=>t.title,oneOf:t=>t.title,optional:t=>t.title,nullable:t=>t.title,unknown:t=>{},_other:()=>{}})}Rt();function nne(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:xe(e)}}function YHo({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o}){let s;switch(e.type){case"primitive":s=SFc(e);break;case"array":s=xFc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":s=_Fc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":s=BFc({schema:e,context:t,declarationFile:r,namespace:n,variant:o});break;case"unknown":s=PFc(e.nameOverride,e.generatedName,e.description);break;case"optional":s=ZHo({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":s=OFc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":s=jmt(e,i);break;case"literal":s=TFc(e,e.nameOverride,e.generatedName);break;case"object":s=p_e({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o});break;case"oneOf":s=$Hn({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o});break;default:xe(e)}return s}function p_e({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,skipReadonlyProperties:o,variant:s}){let a=o===!0||s==="write",u=!1,c={},l=new Set;for(let g of e.properties){if(g.readonly&&(u=!0),a&&g.readonly)continue;if(Object.keys(g.conflict).length>0){if(Object.entries(g.conflict).every(([x,C])=>!C.differentSchema))continue;Object.entries(g.conflict).forEach(([x])=>{HHn({property:g.key,schemaId:x,context:t,namespace:n}).forEach(_=>{l.add(_)})})}let A=Ka({schema:g.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s}),E=g.audiences,v=g.nameOverride,b=ly(g.availability),I=kFc(g);c[g.key]=FFc({typeReference:A,audiences:E,name:v,availability:b,propertyAccess:I})}let p=new Set;for(let g of e.allOfPropertyConflicts)g.allOfSchemaIds.forEach(A=>l.add(A)),g.conflictingTypeSignatures&&p.add(g.propertyKey);let d=[];for(let g of e.allOf){let A=uJt({schema:g.schema,context:t,namespace:n});if(A==null||l.has(g.schema)||l.has(A))continue;let E=Ka({schema:aa.reference(g),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s});d.push(EUe(Kl(E)))}for(let g of l){let A=vUe(t,g,n);for(let E of A.properties)c[E.key]==null&&(p.has(E.key)&&(c[E.key]="unknown"),c[E.key]=Ka({schema:E.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s}));for(let E of A.allOf){if(l.has(E.schema))continue;let v=Ka({schema:aa.reference(E),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:s});d.push(EUe(Kl(v)))}}let f={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([g,A])=>RFc(g)?[g,typeof A=="string"?{type:A,name:`_${g}`}:{...A,name:`_${g}`}]:[g,A]))};d.length>0&&(f.extends=d),e.additionalProperties&&(f["extra-properties"]=!0),e.availability!=null&&(f.availability=ly(e.availability)),e.source!=null&&(f.source=nne(e.source)),e.encoding!=null&&(f.encoding=Qmt(e.encoding)),f.inline=KHn(e,i);let m=e.nameOverride??e.generatedName;return{name:s==="read"&&u&&t.options.respectReadonlySchemas&&t.hasReadVariant(m)?`${m}Read`:m,schema:f}}function HHn({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return HHn({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:o,allOf:s}=vUe(r,t,n),a=o.some(c=>c.key===e),u=[...s.flatMap(c=>HHn({property:e,context:r,schemaId:c.schema,namespace:n}))];if(a||u.length>0)return[t,...u]}return[]}function XHo(e,t,r){return t.type==="object"?{properties:t.properties,allOf:t.allOf}:t.type==="reference"?vUe(e,t.schema,r):t.type==="nullable"?XHo(e,t.value,r):{properties:[],allOf:[]}}function vUe(e,t,r){let n=e.getSchema(t,r);return n==null?{properties:[],allOf:[]}:XHo(e,n,r)}function xFc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:zHn({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function _Fc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:VHn({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function SFc(e){let t=oJt(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...n}=t;return{name:e.nameOverride??e.generatedName,schema:{...n}}}function JHo(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function jmt(e,t){let r={enum:e.values.map(o=>{let s=o.nameOverride??o.generatedName,a=o.value;if(s===a&&o.description==null&&(o.casing==null||JHo(o.casing)))return s;let u={value:o.value};if(s!==a&&(u.name=s),o.description!=null&&(u.docs=o.description),o.casing!=null&&!JHo(o.casing)){let c={},l=!1;o.casing.camel!=null&&(c.camel=o.casing.camel,l=!0),o.casing.screamingSnake!=null&&(c["screaming-snake"]=o.casing.screamingSnake,l=!0),o.casing.snake!=null&&(c.snake=o.casing.snake,l=!0),o.casing.pascal!=null&&(c.pascal=o.casing.pascal,l=!0),l&&(u.casing=c)}return u})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=KHn(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?nne(e.source):void 0};for(let o of r.enum){let s=typeof o=="string"?o:o.name??o.value;n.has(s.toLowerCase())||(i.enum.push(o),n.add(s.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:i}}function BFc({schema:e,context:t,declarationFile:r,namespace:n,variant:i}){return{name:e.nameOverride??e.generatedName,schema:UHn({schema:e,context:t,fileContainingReference:r,namespace:n,variant:i})}}function OFc({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.options.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:qHn({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:ZHo({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function ZHo({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:sJt({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function PFc(e,t,r){return r!=null?{name:e??t,schema:{type:"unknown",docs:r}}:{name:e??t,schema:GHn()}}function TFc(e,t,r){return{name:t??r,schema:WHn(e)}}function $Hn({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i,variant:o}){let s=e.encoding!=null?Qmt(e.encoding):void 0;if(e.type==="discriminated"){let u={};for(let l of e.commonProperties)u[l.key]=Ka({schema:l.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1,variant:o});let c={};for(let[l,p]of Object.entries(e.schemas))c[l]=Ka({schema:p,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1,variant:o});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantPropertyNameOverride!=null?{name:e.discriminantPropertyNameOverride,value:e.discriminantProperty}:e.discriminantProperty,"base-properties":u,docs:e.description??void 0,availability:e.availability!=null?ly(e.availability):void 0,union:c,encoding:s,source:e.source!=null?nne(e.source):void 0,...e.discriminatorContext&&{context:e.discriminatorContext}}}}let a=[];for(let u of e.schemas)a.push(Ka({schema:u,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1,variant:o}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:a,encoding:s,source:e.source!=null?nne(e.source):void 0,inline:KHn(e,i)}}}var DFc=/^[0-9]/;function RFc(e){return DFc.test(e)}function uJt({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?uJt({context:t,schema:n.schema,namespace:r}):e}function FFc({typeReference:e,audiences:t,name:r,availability:n,propertyAccess:i}){return t.length===0&&r==null&&n==null&&i==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...n!=null?{availability:n}:{},...i!=null?{access:i}:{}}}function KHn(e,t){return e.inline===!0||t>0?!0:void 0}function kFc(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return $d.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return $d.ObjectPropertyAccess.WriteOnly}}Ci();function eKo(e){let t=e.replace(/^x-|^X-/,"");return Ln(t)}function tKo(e){if(e.authOverrides!=null){for(let[r,n]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:n});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,n]of Object.entries(e.ir.securitySchemes))if(n.type==="basic"){let i={scheme:"basic"};n.usernameVariableName!=null&&(i.username===void 0?i.username={name:n.usernameVariableName}:i.username.name=n.usernameVariableName),n.usernameEnvVar!=null&&(i.username===void 0?i.username={env:n.usernameEnvVar}:i.username.env=n.usernameEnvVar),n.passwordVariableName!=null&&(i.password===void 0?i.password={name:n.passwordVariableName}:i.password.name=n.passwordVariableName),n.passwordEnvVar!=null&&(i.password===void 0?i.password={env:n.passwordEnvVar}:i.password.env=n.passwordEnvVar),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="bearer"){let i={scheme:"bearer"};n.tokenVariableName!=null&&(i.token===void 0?i.token={name:n.tokenVariableName}:i.token.name=n.tokenVariableName),n.tokenEnvVar!=null&&(i.token===void 0?i.token={env:n.tokenEnvVar}:i.token.env=n.tokenEnvVar),e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??eKo(n.headerName),env:n.headerEnvVar}});else{let i={header:n.headerName,name:n.headerVariableName??"apiKey",type:"string"};n.headerEnvVar!=null&&(i.env=n.headerEnvVar),n.prefix!=null&&(i.prefix=n.prefix),e.builder.addAuthScheme({name:r,schema:i}),e.builder.setAuth(r),t=!0}else if(n.type==="oauth"){let i={scheme:"bearer"};e.builder.addAuthScheme({name:r,schema:i}),t||(e.builder.setAuth(r),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(Ss.of("__package__.yml"),{name:"OauthScope",schema:jmt(n.scopesEnum,0).schema})}}Ci();function Z9({header:e,context:t,fileContainingReference:r,namespace:n}){let i=Ka({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),o=Kl(i),s=e.name.replace(/^x-|^X-/,""),a=e.parameterNameOverride!=null?e.parameterNameOverride:Ln(s);if(e.description==null&&e.name===a&&e.env==null&&e.availability==null)return o;let u={type:o};return a!==e.name&&(u.name=a),e.description!=null&&(u.docs=e.description),e.env!=null&&(u.env=e.env),e.availability!=null&&(u.availability=ly(e.availability)),u}function cJt({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=Ka({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return Kl(i);let o=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:Kl(i)};return e.description!=null&&(o.docs=e.description),e.availability!=null&&(o.availability=ly(e.availability)),o}gg();function pJt({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=JHn({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let o=Kl(i.value),s=Nmt(i.value);o==="unknown"?o="string":o==="optional<unknown>"&&(o="optional<string>");let a={type:o};return s!=null&&(a.default=s),i.allowMultiple&&(a["allow-multiple"]=!0),e.explode!=null&&(a.explode=e.explode),e.description!=null&&(a.docs=e.description),e.parameterNameOverride!=null&&(a.name=e.parameterNameOverride),e.availability!=null&&(a.availability=ly(e.availability)),QFc(i.value)&&i.value.validation!==void 0&&(a.validation=i.value.validation),a.default==null&&a["allow-multiple"]==null&&a.docs==null&&a.name==null&&a.availability==null&&a.validation==null&&a.explode==null?o:a}function JHn({schema:e,context:t,fileContainingReference:r,namespace:n}){if(e.type==="reference"){let i=t.getSchema(e.schema,n);if(i==null)return;if(i.type==="array")return{value:Ka({schema:aa.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,declarationFile:Ss.of(Op),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let o=[],s=!1;for(let[a,u]of Object.entries(i.value.schemas))u.type==="primitive"&&u.schema.type==="string"&&(s=!0),u.type==="literal"&&u.value.type==="string"&&(AUe.test(u.value.value)?o.push(u.value.value):o.push({value:u.value.value,name:yUe(u.value.value)}));if(o.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:o}}),s&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:e.generatedName}]}}),{value:`${e.generatedName}OrString`,allowMultiple:!1}):{value:e.generatedName,allowMultiple:!1};if(i.value.schemas.length===2){let[a,u]=i.value.schemas;if(a!=null&&u!=null&&lJt({array:a,primitive:u}))return{value:Ka({schema:aa.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(a!=null&&u!=null&&lJt({array:u,primitive:a}))return{value:Ka({schema:aa.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}for(let[a,u]of Object.entries(i.value.schemas))return JHn({schema:u,context:t,fileContainingReference:r,namespace:n})}else if(t.options.objectQueryParameters)return{value:Ka({schema:e,context:t,fileContainingReference:r,declarationFile:Ss.of(Op),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let i=e.type==="optional"?aa.optional:aa.nullable;if(e.value.type==="reference"){let o=t.getSchema(e.value.schema,n);if(o==null)return;if(o.type==="array")return{value:Ka({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:o.value,description:e.description??o.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:Ss.of(Op),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.options.objectQueryParameters)return{value:Ka({schema:e,context:t,fileContainingReference:r,declarationFile:Ss.of(Op),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:Ka({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let o=[],s=!1;for(let[a,u]of Object.entries(e.value.value.schemas))u.type==="primitive"&&u.schema.type==="string"&&(s=!0),u.type==="literal"&&u.value.type==="string"&&(AUe.test(u.value.value)?o.push(u.value.value):o.push({value:u.value.value,name:yUe(u.value.value)}));if(o.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:o}}),s&&t.options.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[a,u]=e.value.value.schemas;if(a!=null&&u!=null&&lJt({array:a,primitive:u}))return{value:Ka({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(a!=null&&u!=null&&lJt({array:u,primitive:a}))return{value:Ka({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}if(t.options.objectQueryParameters)return{value:Ka({schema:e,context:t,fileContainingReference:r,declarationFile:Ss.of(Op),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[a,u]of Object.entries(e.value.value.schemas))return JHn({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return t.options.objectQueryParameters?{value:Ka({schema:e,context:t,fileContainingReference:r,declarationFile:Ss.of(Op),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:Ka({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:Ka({schema:aa.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}:{value:Ka({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function lJt({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function QFc(e){return typeof e=="object"&&e!==null&&"type"in e}Rt();function rKo({websocketExample:e,context:t}){let r={messages:[]};e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=NFc(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=jFc({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=Ape(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function NFc(e){let t={};return e.forEach(r=>{let n=Ape(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function jFc({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let o=Ape(i.value);r.has(i.name)||o!=null&&(n[i.name]=o)}),n}function Ape(e){switch(e.type){case"primitive":return nKo(e.value);case"object":return iKo(e.properties);case"array":return MFc(e.value);case"map":return LFc(e.value);case"oneOf":return UFc(e.value);case"enum":return e.value;case"literal":return zFc(e.value);case"unknown":return Ape(e.value);case"null":return null;default:xe(e)}}function nKo(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`${e.value.slice(1)}`:e.value;case"datetime":try{return new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"datetimeRfc2822":return e.value;case"date":return e.value;case"base64":case"boolean":return e.value;default:xe(e)}}function iKo(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Ape(r)]))}function MFc(e){return e.map(t=>Ape(t))}function LFc(e){return Object.fromEntries(e.map(t=>[nKo(t.key),Ape(t.value)]))}function UFc(e){return e.type==="discriminated"?iKo(e.value):Ape(e.value)}function zFc(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:xe(e)}}function Mmt(e){try{let r=new URL(e).pathname.split("/").filter(n=>n.length>0);if(r.length>0)return r[r.length-1]}catch{}}function fJt(e){try{return new URL(e).protocol.replace(":","")}catch{return}}function dJt(e,t,r=!1){let n=Mmt(t);return r&&n!=null?n:e!=null&&n!=null?`${e}_${n}`:n??e??"websocket"}function ine(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function mJt(e,t){return t??(e?.groupName!=null?ine(e.groupName):void 0)}function oKo({channel:e,context:t,declarationFile:r}){let n=e.servers[0],i=t.ir.servers.length===0&&t.ir.websocketServers.length<=1,o=n!=null&&!i?t.options.groupEnvironmentsByHost?t.getUrlId(n.url)??dJt(n.name,n.url,!0):n.name:void 0;t.logger.debug(`[buildChannel] Channel path="${e.path}", server name="${n?.name}", server url="${n?.url}", resolved urlId="${o}" (from collision map: ${t.getUrlId(n?.url??"")!=null})`);let s=e.path;for(let f of e.handshake.pathParameters)f.parameterNameOverride!=null&&(s=s.replace(`{${f.name}}`,`{${f.parameterNameOverride}}`));let a=t.authOverrides?.auth!=null,u={path:s,url:o,auth:a};e.audiences!=null&&e.audiences.length>0&&(u.audiences=e.audiences),e.summary!=null&&(u["display-name"]=e.summary),e.connectMethodName!=null&&(u["connect-method-name"]=e.connectMethodName),e.description!=null&&(u.docs=e.description);let c=ine(e.groupName),l={};if(e.handshake.pathParameters.length>0)for(let f of e.handshake.pathParameters){let m=f.parameterNameOverride??f.name;l[m]=cJt({pathParameter:f,context:t,fileContainingReference:r,namespace:c})}Object.keys(l).length>0&&(u["path-parameters"]=l);let p={};if(e.handshake.queryParameters.length>0)for(let f of e.handshake.queryParameters){let m=pJt({queryParameter:f,context:t,fileContainingReference:r,namespace:c});m!=null&&(p[f.name]=m)}Object.keys(p).length>0&&(u["query-parameters"]=p);let d={};if(e.handshake.headers.length>0)for(let f of e.handshake.headers){let m=Z9({header:f,context:t,fileContainingReference:r,namespace:c});d[f.name]=m}Object.keys(d).length>0&&(u.headers=d),t.builder.addChannel(r,{channel:u});for(let f of e.messages){let m={origin:f.origin,body:Ka({schema:f.body,context:t,fileContainingReference:r,namespace:c,declarationDepth:0})};f.methodName!=null&&(m["method-name"]=f.methodName),t.builder.addChannelMessage(r,{messageId:f.name,message:m})}for(let f of e.examples){let m=rKo({context:t,websocketExample:f});t.builder.addChannelExample(r,{example:m})}}function YHn(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var nv="Base",uKo="Default";function sKo(e){try{return new URL(e).hostname}catch{return}}function aKo(e){return e??uKo}function VFc(e,t){let r=new Map;for(let n of e){if(YHn(n)||!("url"in n)||!n.url)continue;let i=sKo(n.url)??n.url;r.has(i)||r.set(i,{environmentName:aKo(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.httpServers.push({name:n.name,url:n.url,audiences:n.audiences})}for(let n of t){let i=sKo(n.url)??n.url;r.has(i)||r.set(i,{environmentName:aKo(n.name),httpServers:[],websocketServers:[]}),r.get(i)?.websocketServers.push(n)}return r}function f_e(e){return Object.entries(e).reduce((t,[r,n])=>(FD(n)?Object.entries(n.urls).forEach(([i,o])=>{t[i]=o}):t[r]=typeof n=="string"?n:n.url,t),{})}function cKo(e){if(e.environmentOverrides!=null){for(let[b,I]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:b,schema:I});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let t={},r=[],n=e.ir.servers.some(b=>YHn(b)),i=e.ir.servers;for(let b of i)if(YHn(b)){let I={urls:{}},w={},x={},C={};for(let[R,U]of Object.entries(b.urls))I.urls[R]=U.defaultUrl??U.url,U.urlTemplate&&(w[R]=U.urlTemplate),U.defaultUrl&&(x[R]=U.defaultUrl),U.variables&&U.variables.length>0&&(C[R]=U.variables);(Object.keys(w).length>0||Object.keys(C).length>0)&&(I["url-templates"]=w,I["default-urls"]=x,I.variables=C),b.name&&(t[b.name]=I)}else if("url"in b&&b.url){let w=b.urlTemplate!=null&&b.variables!=null&&b.variables.length>0?{url:b.url,audiences:b.audiences,"default-url":b.defaultUrl,"url-template":b.urlTemplate,variables:b.variables?.map(x=>({id:x.id,default:x.default,values:x.values}))}:b.audiences?{url:b.url,audiences:b.audiences}:b.url;if(b.name==null){r.push(w);continue}t[b.name]=w}let o={},s={},a=[],u={},c={},l={};for(let b of e.ir.endpoints)for(let I of b.servers){if(I.url==null&&I.name!=null){o[I.name]||(o[I.name]=[]);continue}if(I.url==null)continue;let w=I,x="defaultUrl"in I&&typeof w.defaultUrl=="string"?w.defaultUrl:void 0,C="urlTemplate"in I&&typeof w.urlTemplate=="string"?w.urlTemplate:void 0,_="variables"in I&&Array.isArray(w.variables)?w.variables:void 0,R=x??I.url,U=I.audiences?{url:R,audiences:I.audiences}:R;if(I.name==null){a.push(U);continue}o[I.name]||(o[I.name]=[]),o[I.name]?.push({url:R,audiences:I.audiences}),s[I.name]=U,C&&I.name&&(u[I.name]=C),x&&I.name&&(c[I.name]=x),_&&_.length>0&&I.name&&(l[I.name]=_)}let p={},d=[];for(let b of e.ir.websocketServers){e.logger.debug(`[buildEnvironments] Processing WebSocket server: name="${b.name}", url="${b.url}"`);let I=b.audiences?{url:b.url,audiences:b.audiences}:b.url;if(b.name==null){d.push(I);continue}p[b.name]=I}let f=Object.keys(t).length,m=f>0,h=Object.keys(s).length>0,g=Object.keys(o).some(b=>o[b]?.length===0),A=Object.keys(p).length>0;if(e.options.groupEnvironmentsByHost&&A&&(m||e.ir.servers.length>0)){let b=Object.entries(p).map(([w,x])=>({name:w,url:typeof x=="string"?x:x.url,audiences:typeof x=="string"?void 0:x.audiences})),I=VFc(i,b);if(I.size>0){let w=!0;for(let[x,C]of I.entries()){let _={},R=[...C.httpServers.map(q=>({...q,isHttp:!0})),...C.websocketServers.map(q=>({...q,isHttp:!1}))],U=new Map;for(let q of R){let z=Mmt(q.url),Z=fJt(q.url);z&&Z&&(U.has(z)||U.set(z,new Set),U.get(z)?.add(Z))}if(C.httpServers.length>0){let q=C.httpServers[0];q!=null&&(_[nv]=q.url,e.setUrlId(q.url,nv));for(let z=1;z<C.httpServers.length;z++){let Z=C.httpServers[z];if(Z!=null){let oe=Mmt(Z.url),V=fJt(Z.url),K=oe?U.get(oe):void 0,Ee=K&&K.size>1,J=Ee&&V!=="https"?`${oe}_${V}`:oe||`Http${z+1}`;e.logger.debug(`[buildEnvironments] HTTP server: url="${Z.url}", pathSegment="${oe}", protocol="${V}", hasCollision=${Ee}, urlId="${J}"`),_[J]=Z.url,e.setUrlId(Z.url,J)}}}for(let q of C.websocketServers){let z=Mmt(q.url),Z=fJt(q.url),oe=z?U.get(z):void 0,V=oe&&oe.size>1,K=V?`${z}_${Z}`:dJt(q.name,q.url,!0);e.logger.debug(`[buildEnvironments] WebSocket server: name="${q.name}", url="${q.url}", pathSegment="${z}", protocol="${Z}", hasCollision=${V}, urlId="${K}"`),_[K]=q.url,e.setUrlId(q.url,K)}if(Object.keys(_).length>1)e.builder.addEnvironment({name:C.environmentName,schema:{urls:_}});else if(Object.keys(_).length===1){let q=Object.values(_)[0];q!=null&&e.builder.addEnvironment({name:C.environmentName,schema:q})}w&&(e.builder.setDefaultEnvironment(C.environmentName),Object.keys(_).length>1&&e.builder.setDefaultUrl(nv),w=!1)}return}}if(!m&&!h&&A&&e.ir.servers.length===0){for(let[b,I]of Object.entries(p))e.builder.addEnvironment({name:b,schema:I});e.builder.setDefaultEnvironment(Object.keys(p)[0]),e.builder.setDefaultUrl(nv);return}if(a.length>0&&e.logger.debug(`Skipping endpoint level servers ${a.map(b=>typeof b=="string"?b:b.url).join(", ")} because x-fern-server-name was not provided.`),!m){let b=e.ir.servers[0],I=b?.url,w=b?.audiences,x=b?.defaultUrl,C=b?.urlTemplate,_=b?.variables;if(I!=null){let U=C!=null&&_!=null&&_.length>0?{url:I,audiences:w,"default-url":x,"url-template":C,variables:_?.map(q=>({id:q.id,default:q.default,values:q.values}))}:w?{url:I,audiences:w}:I;t[uKo]=U}}let E=Object.values(t).map(b=>typeof b=="string"?b:FD(b)?Object.values(b.urls)[0]:b.url),v=r.filter(b=>{let I=typeof b=="string"?b:b.url;return!E.includes(I)});if(v.length>0&&e.logger.debug(`Skipping top level servers ${v.map(b=>typeof b=="string"?b:b.url).join(", ")} because x-fern-server-name was not provided.`),n){let b=!0;for(let[I,w]of Object.entries(t))if(e.builder.addEnvironment({name:I,schema:w}),b){if(e.builder.setDefaultEnvironment(I),FD(w)){let x=Object.keys(w.urls)[0];x&&e.builder.setDefaultUrl(x)}b=!1}return}if(!h&&!g){let b=!0;for(let[I,w]of Object.entries(t))if(b){if(A){let x=typeof w=="string"?w:FD(w)?Object.values(w.urls)[0]:w["default-url"]??w.url;x!=null&&e.setUrlId(x,nv),e.builder.addEnvironment({name:I,schema:{urls:{[nv]:x??"",...f_e(p)}}})}else e.builder.addEnvironment({name:I,schema:w});e.builder.setDefaultEnvironment(I),b=!1}else if(A){let x=typeof w=="string"?w:FD(w)?Object.values(w.urls)[0]:w["default-url"]??w.url;x!=null&&e.setUrlId(x,nv),e.builder.addEnvironment({name:I,schema:{urls:{[nv]:x??"",...f_e(p)}}})}else e.builder.addEnvironment({name:I,schema:w});A&&e.builder.setDefaultUrl(nv)}else if(f===1){let b=Object.keys(t)[0],I=Object.values(t)[0],w=typeof I=="string"?I:FD(I)?Object.values(I.urls)[0]:I["default-url"]??I.url,x={},C={},_={};typeof I!="string"&&!FD(I)&&(I["url-template"]&&(x[nv]=I["url-template"]),I["default-url"]&&(C[nv]=I["default-url"]),I.variables&&I.variables.length>0&&(_[nv]=I.variables)),Object.assign(x,u),Object.assign(C,c),Object.assign(_,l);let R=Object.keys(x).length>0||Object.keys(_).length>0;w!=null&&e.setUrlId(w,nv);let U={urls:{[nv]:w??"",...f_e(s),...f_e(p)},...R?{"url-templates":x,"default-urls":C,variables:_}:{}};e.builder.addEnvironment({name:b,schema:U}),e.builder.setDefaultEnvironment(b),e.builder.setDefaultUrl(nv)}else{let b=new Map;for(let I of e.ir.endpoints)for(let w of I.servers)if(w.url!=null&&w.name!=null){b.has(w.name)||b.set(w.name,new Map);let x=w.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",C=b.get(w.name);C&&C.set(x,w.url)}if(b.size>0){let I=!0;for(let[w,x]of Object.entries(t)){let C=typeof x=="string"?x:FD(x)?Object.values(x.urls)[0]:x["default-url"]??x.url;if(!C)continue;e.setUrlId(C,nv);let _=C.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",R={[nv]:C};for(let[U,q]of b.entries()){let z=q.get(_)||q.get("production")||q.values().next().value;z&&(R[U]=z)}A&&Object.assign(R,f_e(p)),Object.keys(R).length>1?e.builder.addEnvironment({name:w,schema:{urls:R}}):e.builder.addEnvironment({name:w,schema:C}),I&&(e.builder.setDefaultEnvironment(w),I=!1)}b.size>0&&e.builder.setDefaultUrl(nv)}else{let I=!0;for(let[w,x]of Object.entries(t)){if(A||Object.keys(s).length>0){let C=typeof x=="string"?x:FD(x)?Object.values(x.urls)[0]:x["default-url"]??x.url;C!=null&&e.setUrlId(C,nv),e.builder.addEnvironment({name:w,schema:{urls:{[nv]:C??"",...f_e(s),...f_e(p)}}})}else e.builder.addEnvironment({name:w,schema:x});I&&(e.builder.setDefaultEnvironment(w),I=!1)}}}}gg();Ci();var XHn=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},qFc=.75,GFc=new Set(["authorization"]);function lKo(e){if(e.globalHeaderOverrides!=null){for(let[r,n]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:n});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,n]of Object.entries(t)){let o=n.optional===!0?"optional<string>":"string",s=o;if(n.name==null&&n.env==null&&typeof n.schema=="string")s=n.schema;else if(n!=null){let a=n.schema?rne(n.schema):void 0,u=a!=null?ine(a):void 0,c=Ss.of("api.yml");s={name:n.name,env:n.env,type:n.schema!=null?Kl(Ka({schema:n.schema,context:e,fileContainingReference:u?jb(Ss.of(Ln(u)),c):c,namespace:u,declarationDepth:0}))??o:o}}e.builder.addGlobalHeader({name:r,schema:s})}if(e.options.detectGlobalHeaders){let r={};for(let i of e.ir.endpoints)for(let o of i.headers){if(GFc.has(o.name.toLowerCase()))continue;let s=r[o.name];if(s==null){let a=t[o.name],u=Z9({header:{...o,schema:a?.schema??o.schema,name:a?.name??o.name},fileContainingReference:Ss.of(Ub),context:e,namespace:void 0});s=new XHn(u),r[o.name]=s}s.increment()}let n=e.ir.endpoints.length*qFc;for(let[i,o]of Object.entries(r)){let s=t[i],a=o.count===e.ir.endpoints.length,u=o.count>=n;s==null&&(a?e.builder.addGlobalHeader({name:i,schema:o.schema}):u&&e.builder.addGlobalHeader({name:i,schema:l_e(o.schema)}))}}}gg();function pKo(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?rne(t.schema):void 0,n=r!=null?ine(r):void 0,i=Z9({header:{...t,schema:t.schema??aa.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:Mc.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0})}),name:t.name??t.header,parameterNameOverride:void 0,description:void 0,availability:void 0,source:void 0},fileContainingReference:Ss.of(Ub),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:l_e(i)})}}Rt();gg();Rt();Rt();function hS(e){switch(e.type){case"primitive":return dKo(e.value);case"object":return mKo(e.properties);case"array":return hKo(e.value);case"map":return $Fc(e.value);case"oneOf":return HFc(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return KFc(e.value);case"unknown":return hS(e.value);case"null":return null;default:xe(e)}}function fKo(e){switch(e.type){case"withStreaming":return e.sse?{stream:WFc(e.events)}:{stream:hKo(e.events)};case"withoutStreaming":return{body:hS(e.value)};default:xe(e)}}function dKo(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"datetime":try{return!e.value.endsWith("Z")&&!e.value.includes("+")&&(e.value+="Z"),new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"datetimeRfc2822":return e.value;case"date":return e.value;case"base64":case"boolean":return e.value;default:xe(e)}}function mKo(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,hS(r)]))}function WFc(e){return e.map(t=>({event:"",data:hS(t)}))}function hKo(e){return e.map(t=>hS(t))}function $Fc(e){return Object.fromEntries(e.map(t=>[dKo(t.key),hS(t.value)]))}function HFc(e){return e.type==="discriminated"?mKo(e.value):hS(e.value)}function KFc(e){switch(e.type){case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"boolean":return e.value;default:xe(e)}}function gKo({endpointExample:e,context:t}){let r={};if(e.type!=="full")return e.value;e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.pathParameters!=null&&e.pathParameters.length>0&&(r["path-parameters"]=JFc(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=YFc(e.queryParameters));let n=e.headers!=null&&e.headers.length>0,i=t.builder.getGlobalHeaders(),o=Object.keys(i).length>0,s=new Set(e.headers?.map(a=>a.name)??[]);if(n||o){let a=[];if(e.headers!=null)for(let u of e.headers)u.name!==t.builder.getAuthHeaderName()&&a.push(u);for(let[u,c]of Object.entries(i)){if(c!=null&&typeof c=="object"&&c.type!=null){let l=R0({type:c.type,_default:void 0,validation:void 0,visitor:{primitive:ft,map:ft,list:ft,optional:p=>p,nullable:p=>p,set:ft,named:ft,literal:p=>{if(p.type==="string")return p.string;if(p.type==="boolean")return p.boolean.toString()},unknown:ft}});if(l!=null){let p=a.findIndex(f=>f.name===u),d={name:u,value:Ha.literal(ape.string(l))};p>=0?a[p]=d:a.push(d);continue}}s.has(u)||a.push({name:u,value:Ha.primitive(as.string(u))})}r.headers=XFc({context:t,namedFullExamples:a})}return e.request!=null&&(r.request=hS(e.request)),e.response!=null&&(r.response=fKo(e.response)),e.codeSamples!=null&&e.codeSamples.length>0&&(r["code-samples"]=e.codeSamples.map(a=>a.type==="language"?{name:a.name??void 0,docs:a.description??void 0,language:a.language,code:a.code,install:a.install??void 0}:{name:a.name??void 0,docs:a.description??void 0,sdk:a.sdk,code:a.code}).filter(ma)),r}function JFc(e){let t={};return e.forEach(r=>{let n=hS(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function YFc(e){let t={};return e.forEach(r=>{let n=hS(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function XFc({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=hS(n.value);i!=null&&(r[n.name]=i)}),r}var u_;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(u_||(u_={}));function AKo(e){return Lw._visit(e,{get:()=>$d.HttpMethodSchema.Get,post:()=>$d.HttpMethodSchema.Post,put:()=>$d.HttpMethodSchema.Put,patch:()=>$d.HttpMethodSchema.Patch,delete:()=>$d.HttpMethodSchema.Delete,head:()=>$d.HttpMethodSchema.Head,options:()=>{throw new Error("OPTIONS is unsupported")},trace:()=>{throw new Error("TRACE is unsupported")},_other:()=>{throw new Error("Unknown http method is unsupported")}})}function ZHn(e){return e==="POST"||e==="PUT"||e==="PATCH"}function yKo({endpoint:e,declarationFile:t,context:r}){let n=[],i=new Set,o=e.path,s=mJt(e.sdkName,e.namespace),a={};for(let h of e.pathParameters)h.parameterNameOverride&&(o=o.replace(h.name,h.parameterNameOverride)),a[h.parameterNameOverride??h.name]=cJt({pathParameter:h,context:r,fileContainingReference:t,namespace:s}),i.add(h.name);let u={};for(let h of e.queryParameters){let g=pJt({queryParameter:h,context:r,fileContainingReference:t,namespace:s});g!=null&&(u[h.name]=g,i.add(h.name))}let c;if(e.pagination!=null)switch(e.pagination.type){case"cursor":c={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":c={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":c={type:"custom",results:e.pagination.results};break;case"uri":c={next_uri:e.pagination.nextUri,results:e.pagination.results};break;case"path":c={next_path:e.pagination.nextPath,results:e.pagination.results};break;default:xe(e.pagination)}let l={path:o,method:AKo(e.method),auth:ZFc({endpoint:e,context:r}),docs:e.description??void 0,pagination:c,source:e.source!=null?nne(e.source):void 0};!nkc({context:r,request:e.request})&&Object.keys(a).length>0&&(l["path-parameters"]=a),e.summary!=null&&(l["display-name"]=e.summary);let p={},d=r.builder.getGlobalHeaderNames(),f=r.builder.getAuthHeaderName();f!=null&&d.add(f);let m=e.headers.filter(h=>!d.has(h.name));for(let h of m){let g=Z9({header:h,context:r,fileContainingReference:t,namespace:s});p[h.name]=g,i.add(typeof g=="string"?h.name:g.name??h.name)}if(e.request!=null){r.setInState(u_.Request);let h=rkc({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.options.inlinePathParameters&&Object.keys(a).length>0?a:void 0,queryParameters:Object.keys(u).length>0?u:void 0,headers:Object.keys(p).length>0?p:void 0,usedNames:i,namespace:s});l.request=h.value,n=[...n,...h.schemaIdsToExclude??[]],r.unsetInState(u_.Request)}else{let h=r.options.inlinePathParameters&&Object.keys(a).length>0,g=Object.keys(u).length>0,A=Object.keys(p).length>0,E={};(h||g||A)&&(E.name=e.requestNameOverride??e.generatedRequestName),h&&(E["path-parameters"]=a),g&&(E["query-parameters"]=u),A&&(E.headers=p),Object.keys(E).length>0&&(l.request=E)}if(e.response!=null&&e.response._visit({json:h=>{let g=Ka({schema:h.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0});l.response={docs:h.description??void 0,type:Kl(g)},h.statusCode!=null&&(l.response["status-code"]=h.statusCode),h.responseProperty!=null&&(l.response.property=h.responseProperty)},streamingJson:h=>{let g=Ka({schema:h.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0});l["response-stream"]={docs:h.description??void 0,type:Kl(g),format:"json",terminator:h.terminator??void 0}},streamingSse:h=>{let g=Ka({schema:h.schema,context:r,fileContainingReference:t,namespace:s,declarationDepth:0});l["response-stream"]={docs:h.description??void 0,type:Kl(g),format:"sse",terminator:h.terminator??void 0}},file:h=>{l.response={docs:h.description??void 0,type:"file","status-code":h.statusCode}},bytes:h=>{l.response={docs:h.description??void 0,type:"bytes","status-code":h.statusCode}},streamingText:h=>{l["response-stream"]={docs:h.description??void 0,type:"text"}},text:h=>{l.response={docs:h.description??void 0,type:"text","status-code":h.statusCode}},_other:()=>{throw new Error("Unrecognized Response type: "+e.response?.type)}}),r.builder.getEnvironmentType()==="multi"){let h=r.getDefaultServerName(),g=e.servers[0];if(g==null)h!=null&&(l.url=h);else{let A=g.url!=null?r.getUrlId(g.url):void 0;l.url=A??g.name??void 0}}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=ly(e.availability)),Object.entries(e.errors).forEach(([h,g])=>{let A=g.generatedName,E=Ss.of(Op);r.builder.enableUniqueErrorsPerEndpoint&&(A=`${e.generatedRequestName}${g.generatedName}`,g.schema!=null&&(g.schema.type!=="reference"&&g.schema.type!=="oneOf"?g.schema.generatedName=`${e.generatedRequestName}${g.schema.generatedName}`:g.schema.type==="oneOf"&&(g.schema.value.generatedName=`${e.generatedRequestName}${g.schema.value.generatedName}`)));let v={"status-code":parseInt(h)},b=qHo({location:bKo,namespaceOverride:s});if(g.schema!=null){let x=Ka({schema:g.schema,context:r,fileContainingReference:b,declarationFile:b,namespace:s,declarationDepth:0});v.type=Kl(x),v.docs=g.description}r.builder.addError(b,{name:A,schema:r.isErrorUnknownSchema(parseInt(h))?{...v,type:"unknown"}:v}),l.errors==null&&(l.errors=[]);let I=r.builder.addImport({file:t,fileToImport:b});l.errors.push(I!=null?`${I}.${A}`:A),v.type!=null&&g.examples?.forEach(x=>{let C={value:hS(x.example),name:x.name,docs:x.description};r.builder.addErrorExample(b,{name:A,example:C})})}),e.examples.length>0&&(l.examples=ekc({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=tkc({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[eKn,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:n}}function ZFc({endpoint:e,context:t}){if(e.security==null)return t.authOverrides?.auth!=null?!0:t.ir.security==null?void 0:t.ir.security.length>0?!0:void 0;if(e.security.length!==0)return JSON.stringify(e.security)===JSON.stringify(t.ir.security)?!0:e.security}function ekc({endpointExamples:e,context:t}){return e.map(r=>{try{return gKo({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function tkc({retries:e}){if(e!=null){if(e.type==="disabled")return{disabled:e.value??void 0};xe(e)}}function rkc({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:o,pathParameters:s,queryParameters:a,headers:u,usedNames:c,namespace:l}){if(n.type==="json"||n.type==="formUrlEncoded"){let p=n.schema.type==="reference"?n.schema.schema:void 0,d=n.schema.type==="reference"?r.getSchema(n.schema.schema,l):n.schema;if(d?.type!=="object"||p!=null&&r.isResponseReachable(p)){let I=r.options.respectReadonlySchemas&&ZHn(e.method)?"write":void 0,w=Ka({schema:n.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0,variant:I}),x={schemaIdsToExclude:[],value:{body:w}},C=Object.keys(s??{}).length>0,_=Object.keys(a??{}).length>0,R=Object.keys(u??{}).length>0;return C&&(x.value["path-parameters"]=s),_&&(x.value["query-parameters"]=a),R&&(x.value.headers=u),(C||_||R)&&(x.value.name=i??o),n.contentType!=null&&(x.value["content-type"]=n.contentType),n.description!=null&&(x.value.docs=n.description),x}let f=new Map;for(let b of d.allOf){let I=r.getSchema(b.schema,l);if(I==null)continue;let w=rne(I),x=tne(w),{properties:C}=vUe(r,b.schema,l);for(let _ of C)f.set(_.key,x)}let m=Object.fromEntries(d.properties.filter(b=>b.readonly==null?!0:!(ZHn(e.method)&&b.readonly)).map(b=>{let I=f.get(b.key)??t,w=Ka({schema:b.schema,fileContainingReference:t,declarationFile:I,context:r,namespace:l,declarationDepth:1}),x=b.nameOverride??b.key,C=ly(b.availability);if(!c.has(x)&&b.audiences.length<=0)return c.add(x),b.nameOverride!=null?[b.key,{type:Kl(w),docs:bUe(w),name:b.nameOverride,availability:C}]:[b.key,C?{...typeof w=="string"?{type:w}:w,availability:C}:w];let _={type:Kl(w),docs:bUe(w)};return c.has(x)&&(_.name=b.generatedName),b.audiences.length>0&&(_.audiences=b.audiences),C!=null&&(_.availability=C),c.add(x),[b.key,_]})),h=new Set,g=new Set;for(let b of d.allOfPropertyConflicts)b.allOfSchemaIds.forEach(I=>h.add(I)),b.conflictingTypeSignatures&&g.add(b.propertyKey);let A=[];for(let b of d.allOf){let I=uJt({schema:b.schema,context:r,namespace:l});if(I==null||h.has(b.schema)||h.has(I))continue;let w=Ka({schema:aa.reference(b),fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),x=EUe(Kl(w));x!=="unknown"&&A.push(x)}for(let b of h){let I=vUe(r,b,l),w=r.getSchema(b,l),x=w!=null?tne(rne(w)):t;for(let C of I.properties)m[C.key]==null&&(g.has(C.key)?m[C.key]="unknown":m[C.key]=Ka({schema:C.schema,fileContainingReference:t,declarationFile:x,context:r,namespace:l,declarationDepth:1}));for(let C of I.allOf){if(h.has(C.schema))continue;let _=Ka({schema:aa.reference(C),fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),R=EUe(Kl(_));R!=="unknown"&&!A.includes(R)&&A.push(R)}}let E={properties:m};A.length>0&&(E.extends=A),n.additionalProperties&&(E["extra-properties"]=!0);let v={name:i??d.nameOverride??d.generatedName,"path-parameters":s,"query-parameters":a,headers:u,body:E};return n.contentType!=null&&(v["content-type"]=n.contentType),n.description!=null&&(v.docs=n.description),{schemaIdsToExclude:p!=null?[p]:[],value:v}}else if(n.type==="octetStream"){let p={body:"bytes","content-type":n.contentType??uf.APPLICATION_OCTET_STREAM,"query-parameters":a};return a!=null&&(p.name=i??o),n.description!=null&&(p.docs=n.description),{schemaIdsToExclude:[],value:p}}else if(n.type==="multipart"){let p=Object.fromEntries(n.properties.map(d=>{if(d.schema.type==="file"){let f=d.schema.isArray?"list<file>":"file";if(f=d.schema.isOptional?`optional<${f}>`:f,d.description!=null||d.contentType!=null){let m={type:f};if(d.description!=null&&(m.docs=d.description),d.contentType!=null){let h=d.contentType.split(",")[0];m["content-type"]=h}return[d.key,m]}return[d.key,f]}else{let f=Ka({schema:d.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(d.contentType||d.exploded||d.encoding){let m=typeof f=="string"?{type:f}:f;d.contentType!=null&&(m["content-type"]=d.contentType),d.encoding==="form"?m.style="form":d.encoding==="json"?m.style="json":d.exploded&&(m.style="exploded"),f=m}return[d.key,f]}}));return{schemaIdsToExclude:n.name==null?[]:[n.name],value:{name:i??n.name??o,"path-parameters":s,"query-parameters":a,headers:u,body:{properties:p},"content-type":uf.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else xe(n)}function nkc({context:e,request:t}){if(!e.options.inlinePathParameters)return!1;if(t==null)return!0;switch(t.type){case"octetStream":return!1;case"multipart":return!0;case"json":return!0;case"formUrlEncoded":return!0;default:xe(t)}}gg();Ci();function ikc({location:e,namespaceOverride:t}){return t!=null?{...e,file:jb(Ss.of(t),e.file)}:e}function okc(e){let t=e.namespace,r=e.tags.filter(u=>u!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:Ss.of(`${Ln(r)}.yml`),endpointId:e.summary!=null?Ln(e.summary):Ln(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:Ss.of(Op),endpointId:Ln(e.summary)}:{file:Ss.of(Op),endpointId:Ln(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:Ss.of(Op),endpointId:n};let i=Lmt(r),o=Lmt(n);if(Nb(i,o))return{file:Ss.of("__package__.yml"),endpointId:r};let s=ukc({operationId:n,tag:r,path:e.path,method:e.method});if(s!=null)return s;let a=[];for(let u=0;u<i.length;++u){let c=i[u];if(c!=null&&c===o[u])a.push(c);else{let l=Ln(r);return{file:Ss.of(`${l}.yml`),endpointId:n,tag:r}}}if(a.length>=o.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:Ss.of(Ln(a.join("_"))+".yml"),endpointId:Ln(o.slice(a.length).join("_")),tag:r}}function Umt(e){let t=e.tags[0];if(e.sdkName!=null){let r=jHn({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:Ss.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return ikc({namespaceOverride:e.namespace,location:okc(e)})}function Lmt(e){let t;return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)?t=e.split(/(?=[A-Z])/):t=e.split(/[^a-zA-Z0-9]+/),t=t.map(r=>r.toLowerCase()),t=dj(t),t}var skc=new RegExp("[^a-zA-Z0-9{}]+"),akc=new RegExp("[{}]","g");function ukc({operationId:e,tag:t,path:r,method:n}){let o=`${r.split(skc).join("_").replaceAll(akc,"_")}_${n.toLowerCase()}`;if(e.endsWith(o))return{file:Ss.of(Ln(t)+".yml"),endpointId:Ln(e.slice(0,-1*o.length)),tag:t}}function EKo(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let o of r){let{endpointId:s,file:a,tag:u}=Umt(o),c=a.split(".")[0];c!=null&&t.add(c);let l;if(o.sdkName!=null){let f=e.ir.groups;for(let m of o.sdkName.groupName){let h=typeof m=="string"?m:m.name,g=f[h];if(g==null)break;if(g.summary!=null||g.description!=null){l=f[h];break}}}let p=u==null?void 0:n.tagsById[u];e.setInState(u_.Endpoint),e.setEndpointMethod(o.method);let d=yKo({context:e,endpoint:o,declarationFile:a});e.unsetEndpointMethod(),e.unsetInState(u_.Endpoint),i=[...i,...d.schemaIdsToExclude],e.builder.addEndpoint(a,{name:s,schema:d.value,source:o.source!=null?nne(o.source):void 0}),(p?.id!=null||p?.description!=null)&&e.builder.setServiceInfo(a,{"display-name":l?.summary??p?.id,docs:l?.description??p?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}gg();function vKo(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?ine(r.groupName):void 0,i=Ka({schema:aa.primitive(r),context:e,fileContainingReference:Ss.of(Op),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:Kl(i),docs:r.description??void 0}})}}gg();Ci();function CKo(e){for(let t of e.ir.webhooks){let r=pkc({webhook:t,context:e});if(r==null)continue;let n=mJt(t.sdkName,t.namespace),i={};for(let s of t.headers)i[s.name]=Z9({header:s,context:e,fileContainingReference:r.file,namespace:n});let o={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:i,payload:Ka({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0}),signature:fkc(t.signatureVerification),examples:t.examples!=null?t.examples.map(s=>({docs:s.description,name:s.name,payload:hS(s.payload)})):void 0};t.response!=null&&t.response._visit({json:s=>{let a=Ka({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o.response={docs:s.description??void 0,type:Kl(a)},s.statusCode!=null&&(o.response["status-code"]=s.statusCode)},file:s=>{o.response={docs:s.description??void 0,type:"file","status-code":s.statusCode}},bytes:s=>{o.response={docs:s.description??void 0,type:"bytes","status-code":s.statusCode}},text:s=>{o.response={docs:s.description??void 0,type:"text","status-code":s.statusCode}},streamingJson:s=>{let a=Ka({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o["response-stream"]={docs:s.description??void 0,type:Kl(a),format:"json"}},streamingSse:s=>{let a=Ka({schema:s.schema,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0});o["response-stream"]={docs:s.description??void 0,type:Kl(a),format:"sse"}},streamingText:s=>{o["response-stream"]={docs:s.description??void 0,type:"text"}},_other:()=>{throw new Error("Unrecognized Response type: "+t.response?.type)}}),e.builder.addWebhook(r.file,{name:r.endpointId,schema:o}),t.description!=null&&(o.docs=t.description)}}function ckc({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:jb(Ss.of(t),e.file)}:e}function lkc({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:Ss.of(Op),endpointId:n};let i=Lmt(r),o=Lmt(n);if(Nb(i,o))return{file:Ss.of("__package__.yml"),endpointId:r};let s=[];for(let a=0;a<i.length;++a){let u=i[a];if(u!=null&&u===o[a])s.push(u);else{let c=Ln(r);return{file:Ss.of(`${c}.yml`),endpointId:n,tag:r}}}if(s.length>=o.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:Ss.of(Ln(s.join("_"))+".yml"),endpointId:Ln(o.slice(s.length).join("_")),tag:r}}function pkc({webhook:e,context:t}){return e.sdkName!=null?{file:VHo({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:ckc({namespaceOverride:e.namespace,location:lkc({webhook:e,context:t})})}function fkc(e){if(e!=null)switch(e.type){case"hmac":return{type:"hmac",header:e.header,algorithm:dkc(e.algorithm),encoding:IKo(e.encoding),"signature-prefix":e.signaturePrefix,"payload-format":hkc(e.payloadFormat),timestamp:wKo(e.timestamp)};case"asymmetric":return{type:"asymmetric",header:e.header,"asymmetric-algorithm":mkc(e.asymmetricAlgorithm),encoding:IKo(e.encoding),"signature-prefix":e.signaturePrefix,"jwks-url":e.jwksUrl,"key-id-header":e.keyIdHeader,timestamp:wKo(e.timestamp)};default:return}}function dkc(e){if(e!=null)switch(e){case"sha256":return"sha256";case"sha1":return"sha1";case"sha384":return"sha384";case"sha512":return"sha512";default:return}}function IKo(e){if(e!=null)switch(e){case"base64":return"base64";case"hex":return"hex";default:return}}function mkc(e){switch(e){case"rsa-sha256":return"rsa-sha256";case"rsa-sha384":return"rsa-sha384";case"rsa-sha512":return"rsa-sha512";case"ecdsa-sha256":return"ecdsa-sha256";case"ecdsa-sha384":return"ecdsa-sha384";case"ecdsa-sha512":return"ecdsa-sha512";case"ed25519":return"ed25519";default:return"rsa-sha256"}}function hkc(e){if(e!=null)return{components:e.components.map(gkc),delimiter:e.delimiter}}function gkc(e){switch(e){case"body":return"body";case"timestamp":return"timestamp";case"notification-url":return"notification-url";case"message-id":return"message-id";default:return"body"}}function Akc(e){switch(e){case"unix-seconds":return"unix-seconds";case"unix-millis":return"unix-millis";case"iso8601":return"iso8601";default:return}}function wKo(e){if(e!=null)return{header:e.header,format:e.format!=null?Akc(e.format):void 0,tolerance:e.tolerance}}Rt();function ype(e,t,r){switch(e.type){case"primitive":case"enum":case"literal":case"unknown":return;case"reference":{let n=e.schema;if(r.has(n))return;r.add(n);let i=xKo(n,e.namespace,t);i!=null&&ype(i,t,r);return}case"object":for(let n of e.allOf)if(!r.has(n.schema)){r.add(n.schema);let i=xKo(n.schema,n.namespace,t);i!=null&&ype(i,t,r)}for(let n of e.properties)ype(n.schema,t,r);return;case"array":case"map":case"optional":case"nullable":ype(e.value,t,r);return;case"oneOf":ykc(e.value,t,r);return;default:xe(e)}}function ykc(e,t,r){switch(e.type){case"discriminated":for(let n of Object.values(e.schemas))ype(n,t,r);for(let n of e.commonProperties)ype(n.schema,t,r);return;case"undiscriminated":for(let n of e.schemas)ype(n,t,r);return;default:xe(e)}}function xKo(e,t,r){return t==null?r.rootSchemas[e]:r.namespacedSchemas[t]?.[e]}function iM(e,t,r){ype(e,t,r)}function _Ko(e){let t=new Set,r=new Set,{groupedSchemas:n}=e;for(let i of e.endpoints){if(i.request!=null)switch(i.request.type){case"json":case"formUrlEncoded":iM(i.request.schema,n,t);break;case"multipart":for(let o of i.request.properties)o.schema.type==="json"&&iM(o.schema.value,n,t);break;case"octetStream":break;default:xe(i.request)}if(i.response!=null)switch(i.response.type){case"json":case"streamingJson":case"streamingSse":iM(i.response.schema,n,r);break;case"file":case"text":case"bytes":case"streamingText":break;default:xe(i.response)}for(let o of Object.values(i.errors))o.schema!=null&&iM(o.schema,n,r);for(let o of i.pathParameters)iM(o.schema,n,r);for(let o of i.queryParameters)iM(o.schema,n,r);for(let o of i.headers)iM(o.schema,n,r)}for(let i of e.webhooks)iM(i.payload,n,r);for(let i of Object.values(e.channels)){for(let o of i.messages)iM(o.body,n,r);for(let o of i.handshake.queryParameters)iM(o.schema,n,r);for(let o of i.handshake.headers)iM(o.schema,n,r);for(let o of i.handshake.pathParameters)iM(o.schema,n,r)}return{requestReachable:t,responseReachable:r}}function bkc(e){return e.type!=="object"?!1:e.properties.some(t=>t.readonly===!0)}function SKo(e,t){let r=new Set,n=new Set,i=new Set;function o(s){for(let[a,u]of Object.entries(s)){if(!bkc(u))continue;let c=t.requestReachable.has(a),l=t.responseReachable.has(a);c&&l?r.add(a):c&&!l?n.add(a):!c&&l&&i.add(a)}}o(e.groupedSchemas.rootSchemas);for(let s of Object.values(e.groupedSchemas.namespacedSchemas))o(s);return{needsBothVariants:r,requestOnlyWithReadonly:n,responseOnlyWithReadonly:i}}var eKn="external",bKo=Ss.of(Op);function BKo({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,o]of Object.entries(e)){if(t.has(i))continue;let s=GHo(o);if(n.options.respectReadonlySchemas&&n.needsBothVariants(i)&&o.type==="object"){let c=p_e({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,variant:"read"});n.builder.addType(s,{name:c.name??i,schema:c.schema});let l=p_e({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,skipReadonlyProperties:!0,variant:"write"});n.builder.addType(s,{name:l.name??i,schema:l.schema});continue}if(n.options.respectReadonlySchemas&&n.isRequestOnlyWithReadonly(i)&&o.type==="object"){let c=p_e({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,skipReadonlyProperties:!0,variant:"write"});n.builder.addType(s,{name:c.name??i,schema:c.schema});continue}let a;n.options.respectReadonlySchemas&&(a=n.isRequestOnly(i)?"write":"read");let u=YHo({schema:o,context:n,declarationFile:s,namespace:r,declarationDepth:0,variant:a});if(Tle(u.schema)){let c=Kl(u.schema);if(c===(u.name??i)||c===`optional<${u.name??i}>`||c===`nullable<${u.name??i}>`||c===`optional<nullable<${u.name??i}>>`)continue}n.builder.addType(s,{name:u.name??i,schema:u.schema})}}function OKo(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),cKo(e),lKo(e),pKo(e),tKo(e),vKo(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(eKn);let t=EKo(e),r=t.sdkGroups;e.setInState(u_.Webhook),CKo(e),e.unsetInState(u_.Webhook),e.setInState(u_.Channel);for(let i of Object.values(e.ir.channels)){let o=tne(i.groupName);oKo({channel:i,context:e,declarationFile:o})}e.unsetInState(u_.Channel);let n=Ekc({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});if(e.options.respectReadonlySchemas){let i=_Ko(e.ir),o=SKo(e.ir,i);e.setVariantPlan(o,i)}BKo({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,o]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))BKo({schemas:o,schemaIdsToExclude:n,namespace:i,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(o=>r.has(o))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.optimizeServiceAuth(),e.builder.build()}function Ekc({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return new Set(t);let n=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(o=>Object.keys(o))]),i=new Set(t);for(let o of n)r.includes(o)||i.add(o);return i}Rt();var zmt=class{context;constructor(t){this.context=t}};gg();Ci();gg();var hJt=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[s,a]of Object.entries(n.files)){let u=i!=null?Ss.of(`${i}${"/"}${s}`):Ss.of(s);t[u]=a}let o=Object.keys(n.directories).sort();for(let s of o){let a=i!=null?`${i}${"/"}${s}`:s,u=n.directories[s];r(u,a)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Ss.of(t[0])]??={};let[r,...n]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(n)}};var d_e=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new hJt,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":n,"display-name":i,docs:o}){let s=this.getOrCreateFile(t);s.service==null&&(s.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(s.service.auth=r),n!=null&&(s.service["base-path"]=n),i!=null&&(s.service["display-name"]=i),o!=null&&(s.docs=o)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return D9(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let n of Object.values(this.rootApiFile["auth-schemes"]))PKo(n)&&t.push(n.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}getAuthHeaderName(){if(this.rootApiFile["auth-schemes"]!=null){for(let t of Object.values(this.rootApiFile["auth-schemes"]))if(PKo(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let n=this.getVersionHeader();n!=null&&n===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}getGlobalHeaders(){return this.rootApiFile.headers??{}}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r,alias:n}){if(t===r)return;let i=n??Ln((Ij(r)+"/"+K1(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Ss.of(Ub))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=lje(Ij(cje.of(`/${t}`)),cje.of(`/${r}`)),i;let o=this.getOrCreateFile(t);return o.imports==null&&(o.imports={}),o.imports[i]=lje(Ij(cje.of(`/${t}`)),cje.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===Ss.of(Ub))return;let i=this.getOrCreateFile(t);i.types==null&&(i.types={}),i.types[r]=n}addTypeExample(t,r,n){let i=this.getOrCreateFile(t);i.types==null&&(i.types={});let o=i.types[r];o!=null&&(typeof o=="string"?i.types[r]={type:o,examples:[n]}:(o.examples==null&&(o.examples=[]),o.examples.push(n)))}addError(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.errors==null&&(i.errors={}),i.errors[r]==null?i.errors[r]=n:i.errors[r]?.type!==n.type&&(i.errors[r]={"status-code":n["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:n}){let i=this.getOrCreateFile(t);if(i.errors==null)return;let o=i.errors[r];if(o==null)return;o.examples==null&&(o.examples=[]),(o.examples.some(a=>Nb(a,n))??!1)||o.examples?.push(n)}addEndpoint(t,{name:r,schema:n,source:i}){let o=this.getOrCreateFile(t);o.service==null&&(o.service={auth:!1,"base-path":"",endpoints:{}}),i!=null&&(o.service.source=i),o.service.endpoints[r]=n}addWebhook(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.webhooks==null&&(i.webhooks={}),i.webhooks[r]=n}addChannel(t,{channel:r}){let n=this.getOrCreateFile(t);n.channel=r;let i=this.basePath;i!=null&&(n.channel.path=jb(i,r.path))}addChannelExample(t,{example:r}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.examples==null&&(n.channel.examples=[]),n.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:n}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.messages[r]=n}optimizeServiceAuth(){let t=[this.packageMarkerFile,...Object.values(this.root.getAllFiles())];for(let r of t){if(r.service==null)continue;let n=Object.values(r.service.endpoints);if(n.length===0)continue;if(n.every(o=>o.auth===!0)){r.service.auth=!0;for(let o of Object.values(r.service.endpoints))delete o.auth}}}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([i,o])=>[i,{...o,path:jb(r,o.path)}]))});for(let i of Object.values(t))i.service!=null&&(i.service={...i.service,endpoints:Object.fromEntries(Object.entries(i.service.endpoints).map(([o,s])=>[o,{...s,path:jb(r,s.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===Op?this.packageMarkerFile:this.root.getOrCreateFile(t)}getVersionHeader(){if(this.rootApiFile.version!=null)return typeof this.rootApiFile.version.header=="string"?this.rootApiFile.version.header:this.rootApiFile.version.header.value}};function PKo(e){return e?.header!=null}var gJt=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;options;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;urlIdMap=new Map;endpointMethod;state=new Set;schemaNameMapping=new Map;variantPlan;reachability;constructor({taskContext:t,ir:r,options:n,environmentOverrides:i,globalHeaderOverrides:o,authOverrides:s}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=i,this.authOverrides=s,this.globalHeaderOverrides=o,this.options=s_e({options:n}),this.enableUniqueErrorsPerEndpoint=this.options.enableUniqueErrorsPerEndpoint,this.referencedSchemaIds=this.options.onlyIncludeReferencedSchemas?new Set:void 0,this.builder=new d_e(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let a={};if(!this.enableUniqueErrorsPerEndpoint)for(let u of r.endpoints)for(let[c,l]of Object.entries(u.errors)){let p=parseInt(c),d=a[p];d==null&&l.schema!=null?a[p]=l.schema:d!=null&&l.schema!=null&&WD(d,l.schema)||this.unknownSchema.add(p)}}getReferencedSchemaIds(){if(this.referencedSchemaIds!=null)return Array.from(this.referencedSchemaIds)}getSchema(t,r){return r==null?this.ir.groupedSchemas.rootSchemas[t]:this.ir.groupedSchemas.namespacedSchemas[r]?.[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}setUrlId(t,r){this.urlIdMap.set(t,r)}getUrlId(t){return this.urlIdMap.get(t)}isErrorUnknownSchema(t){return this.unknownSchema.has(t)}getEndpointMethod(){return this.endpointMethod}setEndpointMethod(t){this.endpointMethod=t}unsetEndpointMethod(){this.endpointMethod=void 0}isInState(t){return this.state.has(t)}setInState(t){this.state.add(t)}unsetInState(t){this.state.delete(t)}shouldMarkSchemaAsReferenced(){return this.options.onlyIncludeReferencedSchemas&&this.isInAnyState(u_.Channel,u_.Endpoint,u_.Webhook)}markSchemaAsReferenced(t,r){switch(t.type){case"primitive":return;case"object":this.markObjectSchemaAsReferenced(t,r);return;case"array":this.markSchemaAsReferenced(t.value,r);return;case"map":this.markSchemaAsReferenced(t.value,r);return;case"optional":this.markSchemaAsReferenced(t.value,r);return;case"reference":this.markSchemaIdAsReferenced(t.schema,r);return;case"oneOf":this.markOneofSchemaAsReferenced(t.value,r);return;case"nullable":this.markSchemaAsReferenced(t.value,r);return;case"enum":return;case"literal":return;case"unknown":return;default:xe(t)}}markObjectSchemaAsReferenced(t,r){for(let n of t.allOf)this.markSchemaIdAsReferenced(n.schema,r);for(let n of t.properties)this.markSchemaAsReferenced(n.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let n of Object.values(t.schemas))this.markSchemaAsReferenced(n,r);return;case"undiscriminated":for(let n of t.schemas)this.markSchemaAsReferenced(n,r);return;default:xe(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let n=this.getSchema(t,r);n!=null&&this.markSchemaAsReferenced(n,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}setSchemaFinalName(t,r){this.schemaNameMapping.set(t,r)}hasReadVariant(t){return this.schemaNameMapping.has(t)}setVariantPlan(t,r){this.variantPlan=t,this.reachability=r;let n=[this.ir.groupedSchemas.rootSchemas,...Object.values(this.ir.groupedSchemas.namespacedSchemas)];for(let i of n)for(let[o,s]of Object.entries(i))if(t.needsBothVariants.has(o)&&s.type==="object"){let a=s.nameOverride??s.generatedName;this.schemaNameMapping.set(a,`${a}Read`)}}needsBothVariants(t){return this.variantPlan?.needsBothVariants.has(t)??!1}isRequestOnlyWithReadonly(t){return this.variantPlan?.requestOnlyWithReadonly.has(t)??!1}isResponseReachable(t){return this.reachability==null?this.ir.nonRequestReferencedSchemas.has(t):this.reachability.responseReachable.has(t)}isRequestOnly(t){return this.reachability==null?!this.ir.nonRequestReferencedSchemas.has(t):this.reachability.requestReachable.has(t)&&!this.reachability.responseReachable.has(t)}getSchemaFinalName(t,r){return!this.options.respectReadonlySchemas||r==="write"?t:this.schemaNameMapping.get(t)??t}};function tKn(e){let t=new gJt(e);return OKo(t)}gg();function WKo(e){return typeof e>"u"||e===null}function vkc(e){return typeof e=="object"&&e!==null}function Ikc(e){return Array.isArray(e)?e:WKo(e)?[]:[e]}function wkc(e,t){var r,n,i,o;if(t)for(o=Object.keys(t),r=0,n=o.length;r<n;r+=1)i=o[r],e[i]=t[i];return e}function Ckc(e,t){var r="",n;for(n=0;n<t;n+=1)r+=e;return r}function xkc(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var _kc=WKo,Skc=vkc,Bkc=Ikc,Okc=Ckc,Pkc=xkc,Tkc=wkc,EI={isNothing:_kc,isObject:Skc,toArray:Bkc,repeat:Okc,isNegativeZero:Pkc,extend:Tkc};function $Ko(e,t){var r="",n=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(r+=`
|
|
1462
1462
|
|
|
1463
1463
|
`+e.mark.snippet),n+" "+r):n}function qmt(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=$Ko(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}qmt.prototype=Object.create(Error.prototype);qmt.prototype.constructor=qmt;qmt.prototype.toString=function(t){return this.name+": "+$Ko(this,t)};var XO=qmt;function rKn(e,t,r,n,i){var o="",s="",a=Math.floor(i/2)-1;return n-t>a&&(o=" ... ",t=n-a+o.length),r-n>a&&(s=" ...",r=n+a-s.length),{str:o+e.slice(t,r).replace(/\t/g,"\u2192")+s,pos:n-t+o.length}}function nKn(e,t){return EI.repeat(" ",t-e.length)+e}function Dkc(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),typeof t.indent!="number"&&(t.indent=1),typeof t.linesBefore!="number"&&(t.linesBefore=3),typeof t.linesAfter!="number"&&(t.linesAfter=2);for(var r=/\r?\n|\r|\0/g,n=[0],i=[],o,s=-1;o=r.exec(e.buffer);)i.push(o.index),n.push(o.index+o[0].length),e.position<=o.index&&s<0&&(s=n.length-2);s<0&&(s=n.length-1);var a="",u,c,l=Math.min(e.line+t.linesAfter,i.length).toString().length,p=t.maxLength-(t.indent+l+3);for(u=1;u<=t.linesBefore&&!(s-u<0);u++)c=rKn(e.buffer,n[s-u],i[s-u],e.position-(n[s]-n[s-u]),p),a=EI.repeat(" ",t.indent)+nKn((e.line-u+1).toString(),l)+" | "+c.str+`
|
|
@@ -1489,7 +1489,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
1489
1489
|
`+e.slice(i,o),i=o+1),s=a;return u+=`
|
|
1490
1490
|
`,e.length-i>t&&s>i?u+=e.slice(i,s)+`
|
|
1491
1491
|
`+e.slice(s+1):u+=e.slice(i),u.slice(1)}function yQc(e){for(var t="",r=0,n,i=0;i<e.length;r>=65536?i+=2:i++)r=Vmt(e,i),n=gS[r],!n&&$mt(r)?(t+=e[i],r>=65536&&(t+=e[i+1])):t+=n||cQc(r);return t}function bQc(e,t,r){var n="",i=e.tag,o,s,a;for(o=0,s=r.length;o<s;o+=1)a=r[o],e.replacer&&(a=e.replacer.call(r,String(o),a)),(one(e,t,a,!1,!1)||typeof a>"u"&&one(e,t,null,!1,!1))&&(n!==""&&(n+=","+(e.condenseFlow?"":" ")),n+=e.dump);e.tag=i,e.dump="["+n+"]"}function qKo(e,t,r,n){var i="",o=e.tag,s,a,u;for(s=0,a=r.length;s<a;s+=1)u=r[s],e.replacer&&(u=e.replacer.call(r,String(s),u)),(one(e,t+1,u,!0,!0,!1,!0)||typeof u>"u"&&one(e,t+1,null,!0,!0,!1,!0))&&((!n||i!=="")&&(i+=aKn(e,t)),e.dump&&Gmt===e.dump.charCodeAt(0)?i+="-":i+="- ",i+=e.dump);e.tag=o,e.dump=i||"[]"}function EQc(e,t,r){var n="",i=e.tag,o=Object.keys(r),s,a,u,c,l;for(s=0,a=o.length;s<a;s+=1)l="",n!==""&&(l+=", "),e.condenseFlow&&(l+='"'),u=o[s],c=r[u],e.replacer&&(c=e.replacer.call(r,u,c)),one(e,t,u,!1,!1)&&(e.dump.length>1024&&(l+="? "),l+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),one(e,t,c,!1,!1)&&(l+=e.dump,n+=l));e.tag=i,e.dump="{"+n+"}"}function vQc(e,t,r,n){var i="",o=e.tag,s=Object.keys(r),a,u,c,l,p,d;if(e.sortKeys===!0)s.sort();else if(typeof e.sortKeys=="function")s.sort(e.sortKeys);else if(e.sortKeys)throw new XO("sortKeys must be a boolean or a function");for(a=0,u=s.length;a<u;a+=1)d="",(!n||i!=="")&&(d+=aKn(e,t)),c=s[a],l=r[c],e.replacer&&(l=e.replacer.call(r,c,l)),one(e,t+1,c,!0,!0,!0)&&(p=e.tag!==null&&e.tag!=="?"||e.dump&&e.dump.length>1024,p&&(e.dump&&Gmt===e.dump.charCodeAt(0)?d+="?":d+="? "),d+=e.dump,p&&(d+=aKn(e,t)),one(e,t+1,l,!0,p)&&(e.dump&&Gmt===e.dump.charCodeAt(0)?d+=":":d+=": ",d+=e.dump,i+=d));e.tag=o,e.dump=i||"{}"}function GKo(e,t,r){var n,i,o,s,a,u;for(i=r?e.explicitTypes:e.implicitTypes,o=0,s=i.length;o<s;o+=1)if(a=i[o],(a.instanceOf||a.predicate)&&(!a.instanceOf||typeof t=="object"&&t instanceof a.instanceOf)&&(!a.predicate||a.predicate(t))){if(r?a.multi&&a.representName?e.tag=a.representName(t):e.tag=a.tag:e.tag="?",a.represent){if(u=e.styleMap[a.tag]||a.defaultStyle,wJo.call(a.represent)==="[object Function]")n=a.represent(t,u);else if(CJo.call(a.represent,u))n=a.represent[u](t,u);else throw new XO("!<"+a.tag+'> tag resolver accepts not "'+u+'" style');e.dump=n}return!0}return!1}function one(e,t,r,n,i,o,s){e.tag=null,e.dump=r,GKo(e,r,!1)||GKo(e,r,!0);var a=wJo.call(e.dump),u=n,c;n&&(n=e.flowLevel<0||e.flowLevel>t);var l=a==="[object Object]"||a==="[object Array]",p,d;if(l&&(p=e.duplicates.indexOf(r),d=p!==-1),(e.tag!==null&&e.tag!=="?"||d||e.indent!==2&&t>0)&&(i=!1),d&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(l&&d&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),a==="[object Object]")n&&Object.keys(e.dump).length!==0?(vQc(e,t,e.dump,i),d&&(e.dump="&ref_"+p+e.dump)):(EQc(e,t,e.dump),d&&(e.dump="&ref_"+p+" "+e.dump));else if(a==="[object Array]")n&&e.dump.length!==0?(e.noArrayIndent&&!s&&t>0?qKo(e,t-1,e.dump,i):qKo(e,t,e.dump,i),d&&(e.dump="&ref_"+p+e.dump)):(bQc(e,t,e.dump),d&&(e.dump="&ref_"+p+" "+e.dump));else if(a==="[object String]")e.tag!=="?"&&gQc(e,e.dump,t,o,u);else{if(a==="[object Undefined]")return!1;if(e.skipInvalid)return!1;throw new XO("unacceptable kind of an object to dump "+a)}e.tag!==null&&e.tag!=="?"&&(c=encodeURI(e.tag[0]==="!"?e.tag.slice(1):e.tag).replace(/!/g,"%21"),e.tag[0]==="!"?c="!"+c:c.slice(0,18)==="tag:yaml.org,2002:"?c="!!"+c.slice(18):c="!<"+c+">",e.dump=c+" "+e.dump)}return!0}function IQc(e,t){var r=[],n=[],i,o;for(cKn(e,r,n),i=0,o=n.length;i<o;i+=1)t.duplicates.push(r[n[i]]);t.usedDuplicates=new Array(o)}function cKn(e,t,r){var n,i,o;if(e!==null&&typeof e=="object")if(i=t.indexOf(e),i!==-1)r.indexOf(i)===-1&&r.push(i);else if(t.push(e),Array.isArray(e))for(i=0,o=e.length;i<o;i+=1)cKn(e[i],t,r);else for(n=Object.keys(e),i=0,o=n.length;i<o;i+=1)cKn(e[n[i]],t,r)}function wQc(e,t){t=t||{};var r=new pQc(t);r.noRefs||IQc(e,r);var n=e;return r.replacer&&(n=r.replacer.call({"":n},"",n)),one(r,0,n,!0,!0)?r.dump+`
|
|
1492
|
-
`:""}var CQc=wQc,xQc={dump:CQc};function hKn(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var _Qc=c_,SQc=HKo,BQc=XKo,OQc=nJo,PQc=iJo,TQc=pKn,sne=IJo.load,DQc=IJo.loadAll,vpe=xQc.dump,Hmt=XO,RQc={binary:cJo,float:rJo,map:YKo,null:ZKo,pairs:pJo,set:fJo,timestamp:aJo,bool:eJo,int:tJo,merge:uJo,omap:lJo,seq:JKo,str:KKo},FQc=hKn("safeLoad","load"),kQc=hKn("safeLoadAll","loadAll"),QQc=hKn("safeDump","dump"),Ir={Type:_Qc,Schema:SQc,FAILSAFE_SCHEMA:BQc,JSON_SCHEMA:OQc,CORE_SCHEMA:PQc,DEFAULT_SCHEMA:TQc,load:sne,loadAll:DQc,dump:vpe,YAMLException:Hmt,types:RQc,safeLoad:FQc,safeLoadAll:kQc,safeDump:QQc};Ci();function NQc(e,t){return wxe(e,{single:r=>[typeof r=="string"?r:r.scheme],any:r=>r.any.map(n=>typeof n=="string"?n:n.scheme),endpointSecurity:()=>t!=null?Object.keys(t):[]})}function jQc(e,t){if(e==null)return;let r=NQc(t,e),n={};for(let i of r)e[i]!=null&&(n[i]=e[i]);return Object.keys(n).length>0?n:void 0}var wJt=class{args;constructor(t){this.args=t}buildHeaderOverrides(t){let r=this.args.generatorsConfiguration?.api?.headers,n=t!=null||r!=null?{...r,...t}:void 0;if(n!=null)return{headers:n}}buildAuthOverrides(t,r){let n=this.args.generatorsConfiguration?.api?.["auth-schemes"],i=this.args.generatorsConfiguration?.api?.auth,o=t??i;if(o==null)return;let s=r!=null||n!=null?{...n,...r}:void 0,a=jQc(s,o);return{auth:o,"auth-schemes":a}}convert({context:t,ir:r,settings:n,absoluteFilePath:i}){let o=tKn({taskContext:t,ir:r,options:s_e({options:n,overrides:this.args}),authOverrides:this.buildAuthOverrides(n?.auth,n?.authSchemes),environmentOverrides:this.args.generatorsConfiguration?.api?.environments!=null?{...this.args.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.buildHeaderOverrides(n?.headers)});return{absoluteFilePath:i??this.args.absoluteFilePath,rootApiFile:{defaultUrl:o.rootApiFile["default-url"],contents:o.rootApiFile,rawContents:Ir.dump(o.rootApiFile)},namedDefinitionFiles:{...fl(o.definitionFiles,s=>({absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Ir.dump(s),contents:s})),[Ss.of(Op)]:{absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Ir.dump(o.packageMarkerFile),contents:o.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var Kmt=class extends V5{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;coerceEnumsToLiterals;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;resolveAliases;groupEnvironmentsByHost;removeDiscriminantsFromSchemas;defaultIntegerFormat;pathParameterOrder;coerceConstsTo;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.wrapReferencesToNullableInOptional=t.wrapReferencesToNullableInOptional,this.coerceOptionalSchemasToNullable=t.coerceOptionalSchemasToNullable,this.coerceEnumsToLiterals=t.coerceEnumsToLiterals,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.resolveAliases=t.resolveAliases,this.groupEnvironmentsByHost=t.groupEnvironmentsByHost,this.removeDiscriminantsFromSchemas=t.removeDiscriminantsFromSchemas,this.defaultIntegerFormat=t.defaultIntegerFormat,this.pathParameterOrder=t.pathParameterOrder,this.coerceConstsTo=t.coerceConstsTo,this.converter=new wJt(t)}async getDefinition({context:t,absoluteFilePath:r,relativePathToDependency:n},i){let o=await this.getOpenAPIIr({context:t,relativePathToDependency:n},i);return this.converter.convert({context:t,ir:o,settings:i,absoluteFilePath:r})}async toFernWorkspace({context:t},r,n){let i=await this.getDefinition({context:t},r);return new LD({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion})}};var l_={BEARER_FORMAT:"x-bearer-format",ENUM_VAR_NAMES:"x-enum-varnames",INTERNAL:"x-internal",EXAMPLES:"x-examples",TAGS:"x-tags",REDOCLY_CODE_SAMPLES_KEBAB:"x-code-samples",REDOCLY_CODE_SAMPLES_CAMEL:"x-codeSamples"};var _Ue={of(e){return e}};var kJo={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},gKn={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:kJo,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},En={SOURCE:_Ue.of("source"),SDK_NAMESPACE:_Ue.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:_Ue.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:_Ue.of("x-fern-sdk-group-name"),REQUEST_NAME_V1:"x-request-name",REQUEST_NAME_V2:"x-fern-request-name",TYPE_NAME:"x-fern-type-name",BOOLEAN_LITERAL:"x-fern-boolean-literal",SERVER_NAME_V1:"x-name",SERVER_NAME_V2:"x-fern-server-name",BASE_PATH:"x-fern-base-path",GROUPS:_Ue.of("x-fern-groups"),OPENAPI_OVERIDES_FILEPATH:"x-fern-overrides-filepath",TYPE_DEFINITION:"x-fern-type",WEBHOOK_SIGNATURE:"x-fern-webhook-signature",STREAMING:"x-fern-streaming",PAGINATION:"x-fern-pagination",WEBHOOK:"x-fern-webhook",ASYNC_CONFIG:"x-fern-async-config",RETRIES:"x-fern-retries",SDK_VARIABLES:"x-fern-sdk-variables",SDK_VARIABLE:"x-fern-sdk-variable",PARAMETER_NAME:"x-fern-parameter-name",BASIC_AUTH_USERNAME_VARIABLE_NAME:"x-fern-username-variable-name",BASIC_AUTH_PASSWORD_VARIABLE_NAME:"x-fern-password-variable-name",BEARER_TOKEN_VARIABLE_NAME:"x-fern-token-variable-name",HEADER_VARIABLE_NAME:"x-fern-header-variable-name",FERN_ENUM:"x-fern-enum",AUDIENCES:"x-fern-audiences",IGNORE:"x-fern-ignore",AVAILABILITY:"x-fern-availability",RESPONSE_PROPERTY:"x-fern-sdk-return-value",RESOLUTIONS:"x-fern-resolutions",EXAMPLES:"x-fern-examples",FERN_BEARER_TOKEN:"x-fern-bearer",FERN_HEADER_AUTH:"x-fern-header",FERN_BASIC_AUTH:"x-fern-basic",FERN_GLOBAL_HEADERS:"x-fern-global-headers",FERN_IDEMPOTENCY_HEADERS:"x-fern-idempotency-headers",IDEMPOTENT:"x-fern-idempotent",FERN_PROPERTY_NAME:"x-fern-property-name",IS_UNDISCRIMINATED:"x-fern-undiscriminated",FERN_VERSION:"x-fern-version",ENCODING:"x-fern-encoding",TRANSPORT:"x-fern-transport",IS_DISCRIMINATED:"x-fern-discriminated",EXPLORER_ENABLED:"x-fern-explorer-enabled",DISCRIMINATOR_CONTEXT:"x-fern-discriminator-context"};var MQc={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!1,audiences:void 0,optionalAdditionalProperties:!0,coerceEnumsToLiterals:!1,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,preserveSchemaIds:!1,objectQueryParameters:!0,shouldUseUndiscriminatedUnionsWithLiterals:!1,shouldUseIdiomaticRequestNames:!0,filter:void 0,asyncApiNaming:"v1",exampleGeneration:void 0,defaultFormParameterEncoding:"json",useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,additionalPropertiesDefaultsTo:!1,typeDatesAsStrings:!1,preserveSingleSchemaOneOf:!1,inlineAllOfSchemas:!1,resolveAliases:!1,groupMultiApiEnvironments:!1,groupEnvironmentsByHost:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,removeDiscriminantsFromSchemas:bn.RemoveDiscriminantsFromSchemas.Always,defaultIntegerFormat:bn.DefaultIntegerFormat.Int32,pathParameterOrder:bn.PathParameterOrder.UrlOrder,resolveSchemaCollisions:!1,inferForwardCompatible:!1,coerceConstsTo:"enums",respectByteFormat:!1};function LQc(e){let{defaults:t,options:r,overrides:n,overrideOnly:i=new Set,undefinedIfAbsent:o=new Set}=e,s={};for(let a of Object.keys(t))i.has(a)?s[a]=n?.[a]!==void 0?n[a]:t[a]:o.has(a)?s[a]=n?.[a]!==void 0?n[a]:r?.[a]!==void 0?r[a]:void 0:s[a]=n?.[a]??r?.[a]??t[a];return s}function oM({options:e,overrides:t}){return LQc({defaults:MQc,options:e,overrides:t,overrideOnly:new Set(["disableExamples","preserveSchemaIds"]),undefinedIfAbsent:new Set(["exampleGeneration","defaultFormParameterEncoding"])})}Rt();var QJo={naming:"v1"};Ci();Ci();function Nr(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function Jmt(e,t,r,n,i=[]){try{let o=Nr(e,t);if(o!=null)return r.parse(o)}catch{let s=dj(i).join(" -> ");n.error(`${s.length>0?`${s}: `:""}Failed to parse ${t}`)}}function g_e(e){let t=Nr(e,"examples");if(t!=null){if(Array.isArray(t))return t;if(typeof t=="object"&&t!==null)return Object.values(t).map(r=>typeof r=="object"&&r!==null&&"value"in r?r.value:r)}return[]}function NJo({schema:e,logger:t}){return Nr(e,En.ENCODING)??void 0}function jJo(e){return Nr(e,En.FERN_ENUM)}Rt();function MJo({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:o}){let s=Nr(n,En.SDK_NAMESPACE),a=Nr(n,En.SDK_GROUP_NAME),u=Nr(n,En.TYPE_DEFINITION);if(u!=null)return Ymt({fernType:u,nameOverride:e,generatedName:t,title:r,description:i,availability:o,namespace:s,groupName:typeof a=="string"?[a]:a})}function Ymt({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a}){return R0({type:e,_default:void 0,validation:void 0,visitor:{primitive:u=>{switch(u.v1){case"BASE_64":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.base64({example:void 0})});case"BOOLEAN":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.boolean({default:void 0,example:void 0})});case"DATE":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.date({example:void 0})});case"DATE_TIME":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.datetime({example:void 0})});case"FLOAT":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.float({example:void 0})});case"DOUBLE":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.double({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.uint({default:void 0,example:void 0})});case"INTEGER":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.int({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT_64":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.uint64({default:void 0,example:void 0})});case"LONG":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});case"DATE_TIME_RFC_2822":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.datetimeRfc2822({example:void 0})});default:xe(u.v1)}},unknown:()=>Fr.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:o,namespace:s,groupName:a}),map:({keyType:u,valueType:c})=>u?.type==="primitive"&&c!=null?Fr.map({nameOverride:t,generatedName:r,title:n,key:u,value:c,description:i,availability:o,namespace:s,groupName:a,encoding:void 0,example:void 0,inline:void 0,minProperties:void 0,maxProperties:void 0}):void 0,list:u=>u!=null?Fr.array({nameOverride:t,generatedName:r,title:n,value:u,description:i,availability:o,namespace:s,groupName:a,example:void 0,inline:void 0,minItems:void 0,maxItems:void 0}):void 0,optional:u=>u!=null?Fr.optional({nameOverride:t,generatedName:r,title:n,value:u,description:i,availability:o,namespace:s,groupName:a,inline:void 0}):void 0,nullable:u=>u!=null?Fr.nullable({nameOverride:t,generatedName:r,title:n,value:u,description:i,availability:o,namespace:s,groupName:a,inline:void 0}):void 0,set:u=>u!=null?Fr.array({nameOverride:t,generatedName:r,title:n,value:u,description:i,availability:o,namespace:s,groupName:a,example:void 0,inline:void 0,minItems:void 0,maxItems:void 0}):void 0,literal:u=>Fr.literal({nameOverride:t,generatedName:r,title:n,value:u._visit({string:c=>wg.string(c),boolean:c=>wg.boolean(c),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:o,namespace:s,groupName:a}),named:u=>Fr.reference({schema:u,nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,source:mS.openapi({file:"<memory>"})})}})}function LJo(e){let t=Nr(e,En.SOURCE);if(t!=null)return t.endsWith(".proto")?mS.protobuf({file:t}):mS.openapi({file:t})}function A_e(e){if(e!=null&&typeof e=="boolean")return e}function tG(){let e=new Map,t=new Map;return{getUniqueSchemaId(r,n,i=!1){let o=e.get(r)||0;if(e.set(r,o+1),o>0&&i){let s=`${r}${o+1}`;return n?.warn?.(`Schema name collision detected: '${r}' already exists. Renaming to '${s}' to avoid conflicts.`),s}return r},getUniqueTitleName(r,n,i,o=!1){let s=t.get(r)||0;if(t.set(r,s+1),s>0&&o){let a=`${r}${s+1}`;return i?.warn(`Schema title collision detected: Multiple schemas use title '${r}'. Schema '${n}' retitled to '${a}' to avoid conflicts.`),a}return r},reset(){e.clear(),t.clear()}}}Rt();function ei(e){return e?.$ref!=null}function UJo({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:o,availability:s,wrapAsOptional:a,wrapAsNullable:u,context:c,namespace:l,groupName:p,example:d,encoding:f,source:m,minProperties:h,maxProperties:g}){return i===void 0&&(i=c.options.additionalPropertiesDefaultsTo),AKn({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:u,description:o,availability:s,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Ii.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),namespace:void 0,groupName:void 0},valueSchema:typeof i=="boolean"||Xmt(i,c.options)?Fr.unknown({...UQc(i),generatedName:`${t}Value`}):zJo(qa(i,!1,c.options.optionalAdditionalProperties?u:!1,c,[...n,"Value"],m,l,void 0,void 0,void 0)),namespace:l,groupName:p,example:d,encoding:f,minProperties:h,maxProperties:g})}function zJo(e){switch(e.type){case"array":case"enum":case"map":case"object":e.inline=!0;break;case"literal":case"primitive":case"reference":case"unknown":break;case"nullable":case"optional":e.inline=!0,e.value=zJo(e.value);break;case"oneOf":e.value.inline=!0;break;default:xe(e)}return e}function AKn({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsOptional:o,wrapAsNullable:s,description:a,availability:u,namespace:c,groupName:l,example:p,encoding:d,minProperties:f,maxProperties:m}){let h=Fr.map({nameOverride:e,generatedName:t,title:r,description:a,availability:u,key:n,value:i,namespace:c,groupName:l,encoding:d,example:p,inline:void 0,minProperties:f,maxProperties:m});return s&&(h=Fr.nullable({nameOverride:e,generatedName:t,title:r,value:h,description:a,availability:u,namespace:c,groupName:l,inline:void 0})),o&&(h=Fr.optional({nameOverride:e,generatedName:t,title:r,value:h,description:a,availability:u,namespace:c,groupName:l,inline:void 0})),h}function Xmt(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:ei(e)||"type"in e&&e.type!=null||"oneOf"in e&&e.oneOf!=null||"anyOf"in e&&e.anyOf!=null?!1:"allOf"in e&&e.allOf!=null?!e.allOf.some(n=>ei(n)?!0:n.type!=null||n.properties!=null||n.allOf!=null||n.oneOf!=null||n.anyOf!=null||n.enum!=null||"items"in n||n.additionalProperties!=null):!("enum"in e&&e.enum!=null)}function UQc(e){let t={nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0};return e==null||typeof e=="boolean"||ei(e)||typeof e!="object"||(e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description)),t}function VJo({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:o,availability:s,wrapAsOptional:a,wrapAsNullable:u,context:c,namespace:l,groupName:p,example:d,source:f,minItems:m,maxItems:h}){let g=i==null?Fr.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:l,groupName:p}):qa(i,!1,!1,c,[...n,"Item"],f,l);return zQc({nameOverride:e,generatedName:t,title:r,namespace:l,groupName:p,itemSchema:g,wrapAsOptional:a,wrapAsNullable:u,description:o,availability:s,example:d,minItems:m,maxItems:h})}function zQc({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsOptional:i,wrapAsNullable:o,description:s,availability:a,namespace:u,groupName:c,example:l,minItems:p,maxItems:d}){let f=Fr.array({nameOverride:e,generatedName:t,title:r,value:n,description:s,availability:a,namespace:u,groupName:c,example:l,inline:void 0,minItems:p,maxItems:d});return o&&(f=Fr.nullable({nameOverride:e,generatedName:t,title:r,value:f,description:s,availability:a,namespace:u,groupName:c,inline:void 0})),i&&(f=Fr.optional({nameOverride:e,generatedName:t,title:r,value:f,description:s,availability:a,namespace:u,groupName:c,inline:void 0})),f}function AS(e){switch(Nr(e,En.AVAILABILITY)){case"deprecated":return Mw.Deprecated;case"beta":return Mw.Beta;case"generally-available":return Mw.GenerallyAvailable;default:break}if(!ei(e)&&e.deprecated)return Mw.Deprecated}function CJt({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:o,availability:s,required:a,wrapAsOptional:u,wrapAsNullable:c,discriminator:l,context:p,namespace:d,groupName:f,encoding:m,source:h}){let g=l.propertyName,A=Nr(l,En.FERN_PROPERTY_NAME),E=Nr(l,En.DISCRIMINATOR_CONTEXT)??"data",v=Object.fromEntries(Object.entries(l.mapping??{}).map(([I,w])=>{let x=t8({$ref:w},!1,!1,p,[w],m,h,d);return p.markReferencedByDiscriminatedUnion({$ref:w},g,1),[I,x]})),b=Object.entries(i).filter(([I])=>I!==g).map(([I,w])=>{let x=a!=null&&a.includes(I),[C,_]=p.options.coerceOptionalSchemasToNullable?[!1,!x]:[!x,!1],R=qa(w,C,_,p,[...n,I],h,d);return{key:I,schema:R}});return qJo({nameOverride:e,generatedName:t,title:r,wrapAsOptional:u,wrapAsNullable:c,properties:b,description:o,availability:s,discriminant:g,discriminantNameOverride:A,discriminatorContext:E,subtypes:v,namespace:d,groupName:f,source:h})}function yKn({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:o,availability:s,required:a,wrapAsOptional:u,wrapAsNullable:c,discriminant:l,variants:p,context:d,namespace:f,groupName:m,encoding:h,source:g}){let A=Object.fromEntries(Object.entries(p).map(([v,b])=>{if(ei(b)){let I=t8(b,!1,!1,d,[b.$ref],h,g,f);return d.markReferencedByDiscriminatedUnion(b,l,1),[v,I]}else{let I=SUe(b,!1,!1,d,[...n,v],h,g,f,new Set([l]));return[v,I]}})),E=Object.entries(i).filter(([v])=>v!==l).map(([v,b])=>{let I=a!=null&&a.includes(v),[w,x]=d.options.coerceOptionalSchemasToNullable?[!1,!I]:[!I,!1],C=qa(b,w,x,d,[...n,v],g,f);return{key:v,schema:C}});return qJo({nameOverride:e,generatedName:t,title:r,wrapAsOptional:u,wrapAsNullable:c,properties:E,description:o,availability:s,discriminant:l,discriminantNameOverride:void 0,discriminatorContext:"data",subtypes:A,namespace:f,groupName:m,source:g})}function qJo({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:o,description:s,availability:a,discriminant:u,discriminantNameOverride:c,discriminatorContext:l,subtypes:p,namespace:d,groupName:f,source:m}){let h=Fr.oneOf(Z2.discriminated({description:s,availability:a,discriminantProperty:u,discriminantPropertyNameOverride:c,discriminatorContext:l,nameOverride:e,generatedName:t,title:r,schemas:p,commonProperties:o,namespace:d,groupName:f,encoding:void 0,source:m,inline:void 0}));return i&&(h=Fr.nullable({nameOverride:e,generatedName:t,title:r,value:h,namespace:d,groupName:f,description:s,availability:a,inline:void 0})),n&&(h=Fr.optional({nameOverride:e,generatedName:t,title:r,value:h,namespace:d,groupName:f,description:s,availability:a,inline:void 0})),h}function GJo(e){if(e.proto!=null)return kLe.protobuf({typeName:e.proto.type})}function Ipe({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:o,_default:s,description:a,availability:u,wrapAsOptional:c,wrapAsNullable:l,namespace:p,groupName:d,context:f,source:m,inline:h}){let g=qQc(i??[]),A=new Set(o),E=Array.from(A).map((b,I)=>{let w=n?.[b],x=g[I],C=AUe.test(b),_=w?.name??x,R=C?b:yUe(b);return _!=null&&!AUe.test(_)&&(f?.logger.warn(`Enum name override ${_} is not a valid name. Falling back on ${R}.`),_=void 0),{nameOverride:_,generatedName:R,value:b,description:w?.description,availability:u,casing:{snake:w?.casing?.snake??void 0,pascal:w?.casing?.pascal??void 0,screamingSnake:w?.casing?.screamingSnake??void 0,camel:w?.casing?.camel??void 0}}}),v=s!=null?E.find(b=>b.value===s):void 0;return VQc({wrapAsOptional:c,wrapAsNullable:l,nameOverride:e,generatedName:t,title:r,values:E,_default:v,description:a,availability:u,namespace:p,groupName:d,source:m,inline:h})}function VQc({wrapAsOptional:e,wrapAsNullable:t,nameOverride:r,generatedName:n,title:i,values:o,_default:s,description:a,availability:u,namespace:c,groupName:l,source:p,inline:d}){let f=Fr.enum({nameOverride:r,generatedName:n,title:i,values:o,description:a,availability:u,default:s,example:void 0,namespace:c,groupName:l,source:p,inline:d});return t&&(f=Fr.nullable({nameOverride:r,generatedName:n,title:i,value:f,description:a,availability:u,namespace:c,groupName:l,inline:d})),e&&(f=Fr.optional({nameOverride:r,generatedName:n,title:i,value:f,description:a,availability:u,namespace:c,groupName:l,inline:d})),f}function qQc(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(n=>n[r]===t[r]);)r++;return e.map(n=>n.substring(r))}function WJo({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:o,maximum:s,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:c,description:l,availability:p,wrapAsOptional:d,wrapAsNullable:f,example:m,namespace:h,groupName:g,defaultIntegerFormat:A=bn.DefaultIntegerFormat.Int32}){let E=n??A,v=(()=>{switch(E){case bn.DefaultIntegerFormat.Int64:return Ii.int64({default:i,example:m});case bn.DefaultIntegerFormat.Uint32:return Ii.uint({default:i,example:m});case bn.DefaultIntegerFormat.Uint64:return Ii.uint64({default:i,example:m});default:return Ii.int({default:i,minimum:o,maximum:s,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:c,example:m})}})();return Gw({nameOverride:e,generatedName:t,title:r,primitive:v,wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g})}function GQc(e){return typeof e=="string"?wg.string(e):typeof e=="boolean"?wg.boolean(e):wg.string(`${e}`)}function bKn({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,value:o,description:s,availability:a,namespace:u,groupName:c}){let l=Fr.literal({nameOverride:e,generatedName:t,title:r,value:GQc(o),description:s,availability:a,namespace:u,groupName:c});return i&&(l=Fr.nullable({nameOverride:e,generatedName:t,title:r,value:l,description:s,availability:a,namespace:u,groupName:c,inline:void 0})),n&&(l=Fr.optional({nameOverride:e,generatedName:t,title:r,value:l,description:s,availability:a,namespace:u,groupName:c,inline:void 0})),l}function EKn({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:o,maximum:s,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:c,description:l,availability:p,wrapAsOptional:d,wrapAsNullable:f,example:m,namespace:h,groupName:g}){return n==null||n==="double"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.double({default:i,minimum:o,maximum:s,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:c,example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):n==="float"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.float({example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):n==="int32"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.int({default:i,minimum:o,maximum:s,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:c,example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):n==="int64"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.int64({default:i,example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):n==="uint32"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.uint({default:i,example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):n==="uint64"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.uint64({default:i,example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):n==="time-delta"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.float({example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.float({example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g})}var WQc={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},$Qc={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="responses",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},HQc={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="parameters",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),e[0]==="schema"&&(e=e.slice(1)),{refUnderProcessing:e,newBreadcrumbs:t}}},KQc={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},JQc={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},YQc={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},XQc={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},ZQc={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function Zmt(e){let t=e.split("/").map(o=>o.replace(/~1/g,"/")),r=[],n=[WQc,$Qc,HQc,KQc,JQc,YQc,XQc,ZQc],i;do{i=t;for(let o of n)if(o.isApplicable(t)){let{refUnderProcessing:s,newBreadcrumbs:a}=o.applyStrategy(t);t=s,r=[...r,...a]}}while(t.join("")!==i.join(""));return r}Ci();function py(e,t){let n=e.map(i=>/^[^a-zA-Z0-9]+$/.test(i)?i:Nc(Ln(i))).join("");return/^\d/.test(n)?kmt(n)??n:n}function $Jo(e){let t=e.join("_");return Ln(t)}Rt();function df(e){switch(e.type){case"object":return aa.object({allOf:e.allOf,properties:e.properties.map(t=>tNc(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,additionalProperties:e.additionalProperties,availability:e.availability,encoding:e.encoding,source:e.source,inline:e.inline,minProperties:e.minProperties,maxProperties:e.maxProperties});case"array":return aa.array({description:e.description,availability:e.availability,value:df(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline,minItems:e.minItems,maxItems:e.maxItems});case"enum":return aa.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,values:e.values,default:e.default,namespace:e.namespace,groupName:e.groupName,source:e.source,inline:e.inline});case"literal":return aa.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"nullable":return aa.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:df(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return aa.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:df(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return aa.primitive({description:e.description,availability:e.availability,schema:HJo(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return aa.map({description:e.description,availability:e.availability,key:aa.primitive({description:e.key.description,availability:e.key.availability,schema:HJo(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:df(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,inline:e.inline,minProperties:e.minProperties,maxProperties:e.maxProperties});case"reference":return aa.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schema:e.schema,namespace:e.namespace,groupName:e.groupName,source:e.source});case"oneOf":return aa.oneOf(eNc(e.value));case"unknown":return aa.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,description:e.description,availability:e.availability,namespace:e.namespace,groupName:e.groupName});default:xe(e)}}function eNc(e){switch(e.type){case"discriminated":return H9.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:df(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,discriminantPropertyNameOverride:e.discriminantPropertyNameOverride,discriminatorContext:e.discriminatorContext,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,df(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return H9.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>df(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:xe(e)}}function HJo(e){switch(e.type){case"string":return Mc.string(e);case"base64":return Mc.base64();case"boolean":return Mc.boolean(e);case"date":return Mc.date();case"datetime":return Mc.datetime();case"datetimeRfc2822":return Mc.datetimeRfc2822();case"double":return Mc.double(e);case"float":return Mc.float();case"int":return Mc.int(e);case"int64":return Mc.int64(e);case"uint":return Mc.uint();case"uint64":return Mc.uint64();default:xe(e)}}function tNc(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:df(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function xJt(e,t){return WD(df(e),df(t))}function KJo({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:o,required:s,wrapAsOptional:a,wrapAsNullable:u,allOf:c,context:l,propertiesToExclude:p,namespace:d,groupName:f,fullExamples:m,additionalProperties:h,availability:g,encoding:A,source:E,minProperties:v,maxProperties:b}){let I=[...s??[]],w={...JJo({properties:i,breadcrumbs:n,context:l})},x=[],C=[];for(let z of c)if(!l.options.inlineAllOfSchemas&&ei(z)){let Z=l.resolveSchemaReference(z);if(Z.discriminator!=null&&Z.discriminator.mapping!=null)continue;if(Z.oneOf!=null||Z.anyOf!=null){let V=Z.oneOf??Z.anyOf;if(V!=null){for(let K of V){let Ee=ei(K)?l.resolveSchemaReference(K):K,Ce=qa(Ee,!1,!1,l.DUMMY,n,E,d);Ce.type==="object"&&x.push(...Ce.properties.map(J=>J.schema.type!=="optional"&&J.schema.type!=="nullable"?{...J,schema:Fr.optional({nameOverride:void 0,generatedName:"",title:void 0,value:J.schema,description:void 0,availability:J.availability,namespace:void 0,groupName:void 0,inline:void 0})}:J))}continue}}let oe=ane(z);if(oe==null)continue;C.push({schemaId:oe,convertedSchema:vKn(z,[oe],E,l.options.preserveSchemaIds,l),properties:YJo({schema:z,context:l,breadcrumbs:n,source:E,namespace:d})}),l.markSchemaAsReferencedByNonRequest(oe)}else if(ei(z)){let Z=l.resolveSchemaReference(z),oe=qa(Z,!1,!1,l,n,E,d);oe.type==="object"&&x.push(...oe.properties)}else{let Z=z.required??[];x=x.map(V=>(V.schema.type==="optional"||V.schema.type==="nullable")&&Z.includes(V.key)?{...V,schema:V.schema.value}:V);let oe=z.oneOf??z.anyOf;if(oe!=null&&z.type==null&&z.properties==null){let V=new Set(x.map(K=>K.key));for(let K of oe){let Ee=ei(K)?l.resolveSchemaReference(K):K,Ce=nNc(Ee),J=qa(Ce,!1,!1,l,n,E,d);if(J.type==="object")for(let H of J.properties)V.has(H.key)||(V.add(H.key),H.schema.type!=="optional"&&H.schema.type!=="nullable"?x.push({...H,schema:Fr.optional({nameOverride:void 0,generatedName:"",title:void 0,value:H.schema,description:void 0,availability:H.availability,namespace:void 0,groupName:void 0,inline:void 0})}):x.push(H))}}else{let V=qa(z,!1,!1,l,n,E,d);V.type==="object"&&x.push(...V.properties)}}let _={};for(let z of C)for(let[Z,oe]of Object.entries(z.properties)){let V=_[Z];V!=null?(V.schemaIds.push(z.schemaId),V.schemas.some(Ee=>xJt(Ee,oe))||V.schemas.push(oe)):_[Z]={schemaIds:[z.schemaId],schemas:[oe]}}let R=[];for(let[z,Z]of Object.entries(_))Z.schemaIds.length>1&&R.push({propertyKey:z,allOfSchemaIds:Z.schemaIds,conflictingTypeSignatures:Z.schemas.length>1});let U=Object.fromEntries(Object.entries(w).filter(([z,Z])=>!(!ei(Z)&&Z.type==="null"))),q=Object.entries(U).map(([z,Z])=>{let oe=Nr(Z,En.AUDIENCES)??[],V=AS(Z),K=ei(Z)?l.resolveSchemaReference(Z):Z,Ee="readOnly"in Z&&Z.readOnly===!0||K.readOnly,Ce="writeOnly"in Z&&Z.writeOnly===!0||K.writeOnly,H=!(I.includes(z)&&(!Ee||l.options.respectReadonlySchemas)),ge=Nr(Z,En.FERN_PROPERTY_NAME),me=[...n,z],we=$Jo(me),Be=qa(Z,H,!1,l,me,E,d),le={};for(let ue of C){let Fe=ue.properties[z];Fe!=null&&!xJt(Be,Fe)?le[ue.schemaId]={differentSchema:!0}:Fe!=null&&(le[ue.schemaId]={differentSchema:!1})}return{key:z,schema:Be,nameOverride:ge,audiences:oe,conflict:le,generatedName:we,availability:V,readonly:Ee,writeonly:Ce}});return q.push(...x.map(z=>{let Z=z.conflict;for(let oe of C){let V=oe.properties[z.key];V!=null&&!xJt(z.schema,V)?Z[oe.schemaId]={differentSchema:!0}:V!=null&&(Z[oe.schemaId]={differentSchema:!1})}return I.includes(z.key)&&(z.schema.type==="optional"||z.schema.type==="nullable")&&(!z.readonly||l.options.respectReadonlySchemas)?{...z,schema:z.schema.value,conflict:Z}:{...z,conflict:Z}})),rNc({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:u,properties:q.filter(z=>!p.has(z.key)),description:o,allOf:C.map(z=>z.convertedSchema),allOfPropertyConflicts:R,namespace:d,groupName:f,fullExamples:m,additionalProperties:h,availability:g,encoding:A,source:E,context:l,minProperties:v,maxProperties:b})}function rNc({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:o,description:s,allOf:a,allOfPropertyConflicts:u,namespace:c,groupName:l,fullExamples:p,additionalProperties:d,availability:f,encoding:m,source:h,context:g,minProperties:A,maxProperties:E}){let v=Fr.object({description:s,properties:o,nameOverride:e,generatedName:t,title:r,allOf:a,allOfPropertyConflicts:u,namespace:c,groupName:l,fullExamples:p,additionalProperties:Xmt(d,g.options),availability:f,encoding:m,source:h,inline:void 0,minProperties:A,maxProperties:E});return i&&(v=Fr.nullable({nameOverride:e,generatedName:t,title:r,value:v,description:s,availability:f,namespace:c,groupName:l,inline:void 0})),n&&(v=Fr.optional({nameOverride:e,generatedName:t,title:r,value:v,description:s,availability:f,namespace:c,groupName:l,inline:void 0})),v}function JJo({properties:e,breadcrumbs:t,context:r}){return Object.fromEntries(Object.entries(e).filter(([n,i])=>{let o=Nr(i,En.IGNORE);return o&&r.logger.debug(`Property ${t.join(".")}.${n} is marked with x-fern-ignore. Skipping.`),!o}))}function nNc(e){if(e.properties==null)return e;let t={};for(let[r,n]of Object.entries(e.properties))!ei(n)&&"not"in n||(t[r]=n);return{...e,properties:t}}function YJo({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let o={},[s,a]=ei(e)?[t.resolveSchemaReference(e),Zmt(e.$ref)]:[e,r];for(let u of s.allOf??[])o={...o,...YJo({schema:u,context:t,breadcrumbs:a,source:n,namespace:i})};for(let[u,c]of Object.entries(JJo({properties:s.properties??{},breadcrumbs:r,context:t}))){let l=qa(c,!1,!1,t,[...a,u],n,i);o[u]=l}return o}Ci();function wpe({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:o,wrapAsOptional:s,wrapAsNullable:a,context:u,subtypes:c,namespace:l,groupName:p,encoding:d,source:f,subtypeSuffixOverrides:m}){let h=sNc({schemas:c}),g=c.flatMap((E,v)=>{if(!ei(E)&&E.enum!=null&&u.options.coerceEnumsToLiterals&&E.type==="string")return E.enum.map(I=>Fr.literal({nameOverride:void 0,generatedName:py([t,I],u.options.preserveSchemaIds),title:void 0,value:wg.string(String(I)),namespace:l,groupName:void 0,description:void 0,availability:I.availability}));let b=h[v];if(m!=null){let I=m[v];I!=null&&"name"in I&&(b=I.name)}return[qa(E,!1,!1,u,[...n,b??`${v}`],f,l)]}),A=iNc(g);return oNc({uniqueSubtypes:A,nameOverride:e,generatedName:t,title:r,wrapAsOptional:s,wrapAsNullable:a,description:i,availability:o,namespace:l,groupName:p,context:u,encoding:d,source:f})}function iNc(e){let t=[];for(let r=0;r<e.length;++r){let n=e[r],i=!1;for(let o=r+1;o<e.length;++o){let s=e[o];if(n!=null&&s!=null&&WD(n,s)){i=!0;break}}n!=null&&!i&&t.push(n)}return t}function oNc({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:o,description:s,availability:a,namespace:u,groupName:c,context:l,encoding:p,source:d}){if(Object.entries(e).every(([m,h])=>h.type==="literal")){let m={},h=[];return Object.entries(e).forEach(([g,A])=>{A.type==="literal"&&A.value.type==="string"&&(h.push(A.value.value),A.description!=null&&(m[A.value.value]={description:A.description}))}),Ipe({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:o,description:s,availability:a,fernEnum:m,enumVarNames:void 0,enumValues:h,_default:void 0,namespace:u,groupName:c,context:l,source:d,inline:void 0})}if(e.length===1&&e[0]!=null&&!l.options.preserveSingleSchemaOneOf){let m=e[0];return o&&(m=Fr.nullable({nameOverride:t,generatedName:r,title:n,value:m,description:s,availability:a,namespace:u,groupName:c,inline:void 0})),i&&(m=Fr.optional({nameOverride:t,generatedName:r,title:n,value:m,description:s,availability:a,namespace:u,groupName:c,inline:void 0})),m}return XJo({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:o,description:s,availability:a,subtypes:e,namespace:u,groupName:c,encoding:p,source:d})}function IKn({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsOptional:o,wrapAsNullable:s,context:a,namespace:u,groupName:c,discriminator:l,encoding:p,source:d}){let f=Object.entries(l.mapping??{}).map(([g,A],E)=>{let v={$ref:A},b=t8(v,!1,!1,a,[A],p,d,u);return a.markSchemaWithDiscriminantValue(v,l.propertyName,g),b.type==="object"&&(b.properties={[l.propertyName]:Fr.literal({nameOverride:void 0,generatedName:py([t,g],a.options.preserveSchemaIds),title:void 0,value:wg.string(g),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...b.properties.filter(I=>I.key!==l.propertyName)}),b}),m=[];for(let g=0;g<f.length;++g){let A=f[g],E=!1;for(let v=g+1;v<f.length;++v){let b=f[v];if(A!=null&&b!=null&&WD(A,b)){E=!0;break}}A!=null&&!E&&m.push(A)}if(Object.entries(m).every(([g,A])=>A.type==="literal")){let g={},A=[];return Object.entries(m).forEach(([E,v])=>{v.type==="literal"&&v.value.type==="string"&&(A.push(v.value.value),v.description!=null&&(g[v.value.value]={description:v.description}))}),Ipe({nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:s,description:n,availability:i,fernEnum:g,enumVarNames:void 0,enumValues:A,_default:void 0,namespace:u,groupName:c,context:a,source:d,inline:void 0})}return m.length===1&&m[0]!=null&&!a.options.preserveSingleSchemaOneOf?m[0]:XJo({nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:s,description:n,availability:i,subtypes:m,namespace:u,groupName:c,encoding:p,source:d})}function sNc({schemas:e}){let t={},r=0;for(let i of e){if(!ei(i)){if(i.properties!=null&&Object.entries(i.properties).length>0){let o=Object.keys(i.properties),s={},a=o;for(let[u,c]of Object.entries(t)){let l=mNt(c,o);a=mNt(a,c),s[u]=l}s[r]=a,t=s}}r++}return e.map((i,o)=>{let s=t[o];if(s!=null&&s.length>0){let a=s.sort();if(a[0]!=null)return a[0]}return c_e(o)??`${o}`})}function XJo({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,description:o,availability:s,subtypes:a,namespace:u,groupName:c,encoding:l,source:p}){let d=Fr.oneOf(Z2.undiscriminated({description:o,availability:s,nameOverride:e,generatedName:t,title:r,schemas:a,namespace:u,groupName:c,encoding:l,source:p,inline:void 0}));return i&&(d=Fr.nullable({nameOverride:e,generatedName:t,title:r,value:d,description:o,availability:s,namespace:u,groupName:c,inline:void 0})),n&&(d=Fr.optional({nameOverride:e,generatedName:t,title:r,value:d,description:o,availability:s,namespace:u,groupName:c,inline:void 0})),d}function BUe(e){if(e.default!=null&&typeof e.default=="string")return e.default}function _Jt({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let n=g_e(e);for(let i of n??[])if(typeof i=="number")return i;if(r&&typeof r=="number")return r}function ZJo({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let n=g_e(e);for(let i of n??[])if(typeof i=="boolean")return i;if(r&&typeof r=="boolean")return r}function sM({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let n=g_e(e);for(let i of n??[])if(typeof i=="string")return i;if(r&&typeof r=="string")return r}function eYo({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let n=g_e(e);for(let i of n??[])if(Array.isArray(i))return i;if(r&&Array.isArray(r))return r}var y_e="#/components/schemas/";var iYo=tG();function PJt(){iYo.reset()}function aNc(e,t,r){let n=Nr(e,En.TYPE_NAME),i=t.options.useTitlesAsName?lNc(e.title):void 0,o=n??i;if(!o)return;let s=r.split(".");return n!=null||s.length===1?iYo.getUniqueTitleName(o,r,t.logger,t.options.resolveSchemaCollisions):o}function oYo(e,t){let r=ei(e)?t.resolveSchemaReference(e):e;switch(r.type){case"boolean":case"number":case"integer":return!0;case"string":return r.enum==null;case"array":return oYo(r.items,t);case"object":return!1;case void 0:return!1;default:return t.logger.warn("Unhandled schema type. Will not inline this schema",JSON.stringify(r)),!1}}function uNc(e,t,r){return r.options.resolveAliases?typeof r.options.resolveAliases=="object"&&r.options.resolveAliases.except?.includes(e)?!1:oYo(t,r):!1}function qa(e,t,r,n,i,o,s,a=!1,u=new Set,c){let l=LJo(e)??o,p=gNc({schema:e,logger:n.logger}),d=c;if(ei(e)){let f=cNc(e);f!==void 0&&(d=f)}if(ei(e)){let f=ane(e);return f!=null?uNc(f,e,n)?SUe(n.resolveSchemaReference(e),t,r,n,Zmt(e.$ref),p,l,s,u,a,d):(a?n.markSchemaAsReferencedByRequest(f):n.markSchemaAsReferencedByNonRequest(f),t8(e,t,r,n,i,p,l,s)):SUe(n.resolveSchemaReference(e),t,r,n,Zmt(e.$ref),p,l,s,u,a,d)}return SUe(e,t,r,n,i,p,l,s,u,a,c)}function cNc(e){if("example"in e&&e.example!==void 0){let t=e.example;if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"||Array.isArray(t))return t}if("examples"in e){let t=e.examples;if(Array.isArray(t)&&t.length>0){let r=t[0];if(typeof r=="string"||typeof r=="number"||typeof r=="boolean"||Array.isArray(r))return r}}}function t8(e,t,r,n,i,o,s,a){let u=e.$ref.includes("properties")?SUe(n.resolveSchemaReference(e),t,r,n,i,o,s,a,new Set):Fr.reference(vKn(e,i,s,n.options.preserveSchemaIds,n));if(r===!1){let c=n.resolveSchemaReference(e);(c.nullable===!0||Array.isArray(c.type)&&c.type.length>=2&&c.type.includes("null"))&&(r=!0)}return r&&(u=Fr.nullable({title:void 0,nameOverride:void 0,generatedName:py(i,n.options.preserveSchemaIds),value:u,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),t&&(u=Fr.optional({title:void 0,nameOverride:void 0,generatedName:py(i,n.options.preserveSchemaIds),value:u,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),u}function lNc(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function SUe(e,t,r,n,i,o,s,a,u=new Set,c=!1,l){typeof e=="string"&&(e={type:e});let p=aNc(e,n,i.join(".")),d=Nr(e,En.SDK_GROUP_NAME)??Nr(e,l_.TAGS)?.[0],f=(typeof d=="string"?[d]:d)??[];f=n.resolveGroupName(f);let m=py(i,n.options.preserveSchemaIds),h=e.title,g=e.description,A=AS(e),E=[];e.example!=null&&E.push({name:void 0,value:e.example,description:void 0});let v=Nr(e,l_.EXAMPLES);v!=null&&Object.keys(v).length>0&&E.push(...Object.entries(v).map(([w,x])=>({name:x?.summary??w,value:x.value,description:x.description})));let b=g_e(e);b!=null&&Object.keys(b).length>0&&E.push(...b.map(w=>({name:void 0,value:w,description:void 0})));let I=MJo({schema:e,description:g,title:h,nameOverride:p,generatedName:m,availability:A});if(I!=null){let w=I;return r&&(w=Fr.nullable({availability:A,namespace:a,groupName:f,description:g,generatedName:m,inline:void 0,nameOverride:p,title:h,value:w})),t&&(w=Fr.optional({availability:A,namespace:a,groupName:f,description:g,generatedName:m,inline:void 0,nameOverride:p,title:h,value:w})),w}try{if(Array.isArray(e.type)){let _=e.type.indexOf("null"),R=_!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&R)e.type.splice(_,1),e.type=e.type[0],e.nullable=!0;else if(R&&(e.type.splice(_,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let U=new Set([...e.oneOf,...e.type]);e.oneOf=[...U]}}r=r||e.nullable===!0;let w="const"in e;if(w){let _=e.const;if(n.options.coerceConstsTo==="literals"&&(typeof _=="string"||typeof _=="boolean"))return bKn({nameOverride:p,generatedName:m,title:h,wrapAsOptional:t,wrapAsNullable:r,value:_,description:g,availability:A,namespace:a,groupName:f});e.enum=[_]}if(e.enum!=null&&(e.type==="string"||e.type==null||e.type==="enum")){if(e.enum=e.enum.filter(R=>R!==null),!OJt(e.enum))return Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.string({default:BUe(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:sM({schema:e,logger:n.logger,fallback:l})}),namespace:a,groupName:f,wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A});let _=jJo(e);return n.options.coerceEnumsToLiterals&&!w&&e.enum.length===1&&e.enum[0]!=null&&_==null?bKn({nameOverride:p,generatedName:m,title:h,wrapAsOptional:t,wrapAsNullable:r,value:e.enum[0],description:g,availability:A,namespace:a,groupName:f}):Ipe({nameOverride:p,generatedName:m,title:h,fernEnum:_,enumVarNames:Nr(e,[l_.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,namespace:a,groupName:f,context:n,source:s,inline:void 0})}if(OJt(e.type)&&e.type.length>1){let _=e.type.includes("null"),R=e.type.filter(U=>U!=="null").map(U=>({type:U,nullable:_}));return wpe({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:R,namespace:a,groupName:f,encoding:o,source:s})}if(e.type==="boolean"){let _=Nr(e,En.BOOLEAN_LITERAL);return _!=null?rYo({nameOverride:p,generatedName:m,title:h,literal:wg.boolean(_),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f}):Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.boolean({default:pNc(e.default),example:ZJo({schema:e,logger:n.logger,fallback:l})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f})}if(e.type==="number")return EKn({nameOverride:p,generatedName:m,title:h,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:A_e(e.exclusiveMinimum),exclusiveMaximum:A_e(e.exclusiveMaximum),multipleOf:e.multipleOf,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,example:_Jt({schema:e,logger:n.logger,fallback:l}),namespace:a,groupName:f});if(e.type==="integer")return WJo({nameOverride:p,generatedName:m,title:h,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:A_e(e.exclusiveMinimum),exclusiveMaximum:A_e(e.exclusiveMaximum),multipleOf:e.multipleOf,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,example:_Jt({schema:e,logger:n.logger,fallback:l}),namespace:a,groupName:f,defaultIntegerFormat:n.options.defaultIntegerFormat});if(e.type==="float")return EKn({nameOverride:p,generatedName:m,title:h,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:A_e(e.exclusiveMinimum),exclusiveMaximum:A_e(e.exclusiveMaximum),multipleOf:e.multipleOf,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,example:_Jt({schema:e,logger:n.logger,fallback:l}),namespace:a,groupName:f});if(e.type==="string"){if(e.format==null&&e.contentMediaType==="application/octet-stream"&&(e={...e,format:"binary"}),e.format==="date-time")return Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.datetime({example:sM({schema:e,logger:n.logger,fallback:l})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f});if(e.format==="date-time-rfc-2822")return Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.datetimeRfc2822({example:sM({schema:e,logger:n.logger,fallback:l})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f});if(e.format==="date"&&n.options.typeDatesAsStrings===!1)return Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.date({example:sM({schema:e,logger:n.logger,fallback:l})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f});if(e.format==="json-string"){let R=Fr.unknown({nameOverride:p,generatedName:m,title:h,description:g,availability:A,namespace:a,groupName:f,example:void 0});return r&&(R=Fr.nullable({availability:A,namespace:a,groupName:f,description:g,generatedName:m,inline:void 0,nameOverride:p,title:h,value:R})),t&&(R=Fr.optional({availability:A,namespace:a,groupName:f,description:g,generatedName:m,inline:void 0,nameOverride:p,title:h,value:R})),R}if(e.format==="byte"&&n.options.respectByteFormat)return Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.base64({example:sM({schema:e,logger:n.logger,fallback:l})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f});let _=aYo(e,"const");return _!=null?rYo({nameOverride:p,generatedName:m,title:h,literal:wg.string(_),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f}):Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.string({default:BUe(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:sM({schema:e,logger:n.logger,fallback:l})}),namespace:a,groupName:f,wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A})}if(e.type==="array")return VJo({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,item:e.items,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,example:eYo({schema:e,logger:n.logger,fallback:l}),source:s,minItems:e.minItems,maxItems:e.maxItems});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&SJt(e)&&tYo(e))return UJo({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,additionalProperties:e.additionalProperties,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,encoding:o,example:e.example,source:s,minProperties:e.minProperties,maxProperties:e.maxProperties});if(e.oneOf!=null&&e.oneOf.length>0&&Nr(e,En.IS_DISCRIMINATED)===!1)return wpe({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf,namespace:a,groupName:f,encoding:o,source:s});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return n.options.discriminatedUnionV2?IKn({nameOverride:p,generatedName:m,title:h,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,discriminator:e.discriminator,encoding:o,source:s}):CJt({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,encoding:o,source:s});if(e.oneOf!=null&&e.oneOf.length>0){let _=Nr(e,En.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return n.options.discriminatedUnionV2||_?IKn({nameOverride:p,generatedName:m,title:h,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,discriminator:e.discriminator,encoding:o,source:s}):CJt({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,encoding:o,source:s});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(n.options.preserveSingleSchemaOneOf)return wpe({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf.filter(U=>ei(U)||U.type!=="null"),encoding:o,namespace:a,groupName:f,source:s});let R=qa(e.oneOf[0],t,r,n,i,s,a,c);return rG(R,g,a,f)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let z=e.oneOf[0],Z=e.oneOf[1];if(!ei(z)&&z.type==="null"){let oe=qa(Z,t,!0,n,i,s,a);return rG(oe,g,a,f)}else if(!ei(Z)&&Z.type==="null"){let oe=qa(z,t,!0,n,i,s,a);return rG(oe,g,a,f)}}let R=dNc({schemas:e.oneOf});if(R!=null)return Ipe({nameOverride:p,generatedName:m,title:h,fernEnum:void 0,enumVarNames:void 0,enumValues:R,_default:e.default,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,namespace:a,groupName:f,context:n,source:s,inline:void 0});let U=nYo({schemas:e.oneOf,context:n});if(U!=null&&!n.options.discriminatedUnionV2&&!_)return yKn({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,properties:e.properties??{},required:e.required,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,discriminant:U.discriminant,variants:U.schemas,context:n,namespace:a,groupName:f,encoding:o,source:s});let q=e.oneOf.filter(z=>!ei(z)&&z.type==="null").length>0;return wpe({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r||q,context:n,subtypes:e.oneOf.filter(z=>ei(z)||z.type!=="null"),encoding:o,namespace:a,groupName:f,source:s})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let U=qa(e.anyOf[0],t,r,n,i,s,a,c);return rG(U,g,a,f)}if(e.anyOf.length===2){let[U,q]=e.anyOf;if(U!=null&&q!=null){if(!ei(U)&&U.type==="null"){let z=qa(q,t,!0,n,i,s,a);return rG(z,g,a,f)}else if(!ei(q)&&q.type==="null"){let z=qa(U,t,!0,n,i,s,a);return rG(z,g,a,f)}}}let _=nYo({schemas:e.anyOf,context:n});if(_!=null&&!n.options.discriminatedUnionV2)return yKn({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,properties:e.properties??{},required:e.required,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,discriminant:_.discriminant,variants:_.schemas,context:n,namespace:a,groupName:f,encoding:o,source:s});let R=e.anyOf.filter(U=>!ei(U)&&U.type==="null").length>0;return wpe({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r||R,context:n,subtypes:e.anyOf.filter(U=>ei(U)||U.type!=="null"),encoding:o,namespace:a,groupName:f,source:s})}if(e.discriminator?.mapping!=null&&Object.keys(e.discriminator.mapping).length>0&&e.oneOf==null&&e.anyOf==null)return CJt({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,encoding:o,source:s});if(e.allOf!=null||e.properties!=null){let _=[];for(let U of e.allOf??[])(ei(U)||Object.keys(U).length>0)&&_.push(U);if((e.properties==null||SJt(e))&&_.length===1&&_[0]!=null&&(e.additionalProperties==null||e.additionalProperties===!1)){let U=qa(_[0],t,r,n,i,s,a,c);return rG(U,g,a,f)}let R=_.filter(U=>{let q=BJt(U);return q||n.logger.debug(`Skipping non-object allOf element: ${JSON.stringify(U)}`),q});if((e.properties==null||SJt(e))&&R.length===1&&R[0]!=null&&(e.additionalProperties==null||e.additionalProperties===!1)){let U=qa(R[0],t,r,n,i,s,a,c);return rG(U,g,a,f)}return KJo({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,properties:e.properties??{},description:g,required:e.required,wrapAsOptional:t,wrapAsNullable:r,allOf:R,context:n,propertiesToExclude:u,namespace:a,groupName:f,fullExamples:E,additionalProperties:e.additionalProperties,availability:A,encoding:o,source:s,minProperties:e.minProperties,maxProperties:e.maxProperties})}if(e.type==="object"&&fNc(e)&&tYo(e)&&SJt(e))return AKn({nameOverride:p,generatedName:m,title:h,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,keySchema:{nameOverride:void 0,generatedName:`${m}Key`,title:void 0,description:void 0,availability:void 0,schema:Ii.string({default:BUe(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:sM({schema:e,logger:n.logger,fallback:l})}),namespace:a,groupName:f},valueSchema:Fr.unknown({nameOverride:void 0,generatedName:`${m}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:a,groupName:f}),namespace:a,groupName:f,encoding:o,example:e.example,minProperties:e.minProperties,maxProperties:e.maxProperties});e.type!=null&&n.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${i.join("->")}. Coercing to unknown.`);let x=e.example??e.default,C=Fr.unknown({nameOverride:p,generatedName:m,title:h,description:g,availability:A,namespace:a,groupName:f,example:x});return r&&(C=Fr.nullable({availability:A,namespace:a,groupName:f,description:g,generatedName:m,inline:void 0,nameOverride:p,title:h,value:C})),t&&(C=Fr.optional({availability:A,namespace:a,groupName:f,description:g,generatedName:m,inline:void 0,nameOverride:p,title:h,value:C})),C}catch(w){return n.logger.debug(`Error converting schema: ${w.message}
|
|
1492
|
+
`:""}var CQc=wQc,xQc={dump:CQc};function hKn(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var _Qc=c_,SQc=HKo,BQc=XKo,OQc=nJo,PQc=iJo,TQc=pKn,sne=IJo.load,DQc=IJo.loadAll,vpe=xQc.dump,Hmt=XO,RQc={binary:cJo,float:rJo,map:YKo,null:ZKo,pairs:pJo,set:fJo,timestamp:aJo,bool:eJo,int:tJo,merge:uJo,omap:lJo,seq:JKo,str:KKo},FQc=hKn("safeLoad","load"),kQc=hKn("safeLoadAll","loadAll"),QQc=hKn("safeDump","dump"),Ir={Type:_Qc,Schema:SQc,FAILSAFE_SCHEMA:BQc,JSON_SCHEMA:OQc,CORE_SCHEMA:PQc,DEFAULT_SCHEMA:TQc,load:sne,loadAll:DQc,dump:vpe,YAMLException:Hmt,types:RQc,safeLoad:FQc,safeLoadAll:kQc,safeDump:QQc};Ci();function NQc(e,t){return wxe(e,{single:r=>[typeof r=="string"?r:r.scheme],any:r=>r.any.map(n=>typeof n=="string"?n:n.scheme),endpointSecurity:()=>t!=null?Object.keys(t):[]})}function jQc(e,t){if(e==null)return;let r=NQc(t,e),n={};for(let i of r)e[i]!=null&&(n[i]=e[i]);return Object.keys(n).length>0?n:void 0}var wJt=class{args;constructor(t){this.args=t}buildHeaderOverrides(t){let r=this.args.generatorsConfiguration?.api?.headers,n=t!=null||r!=null?{...r,...t}:void 0;if(n!=null)return{headers:n}}buildAuthOverrides(t,r){let n=this.args.generatorsConfiguration?.api?.["auth-schemes"],i=this.args.generatorsConfiguration?.api?.auth,o=t??i;if(o==null)return;let s=r!=null||n!=null?{...n,...r}:void 0,a=jQc(s,o);return{auth:o,"auth-schemes":a}}convert({context:t,ir:r,settings:n,absoluteFilePath:i}){let o=tKn({taskContext:t,ir:r,options:s_e({options:n,overrides:this.args}),authOverrides:this.buildAuthOverrides(n?.auth,n?.authSchemes),environmentOverrides:this.args.generatorsConfiguration?.api?.environments!=null?{...this.args.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.buildHeaderOverrides(n?.headers)});return{absoluteFilePath:i??this.args.absoluteFilePath,rootApiFile:{defaultUrl:o.rootApiFile["default-url"],contents:o.rootApiFile,rawContents:Ir.dump(o.rootApiFile)},namedDefinitionFiles:{...fl(o.definitionFiles,s=>({absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Ir.dump(s),contents:s})),[Ss.of(Op)]:{absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Ir.dump(o.packageMarkerFile),contents:o.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var Kmt=class extends V5{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;coerceEnumsToLiterals;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;resolveAliases;groupEnvironmentsByHost;removeDiscriminantsFromSchemas;defaultIntegerFormat;pathParameterOrder;coerceConstsTo;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.wrapReferencesToNullableInOptional=t.wrapReferencesToNullableInOptional,this.coerceOptionalSchemasToNullable=t.coerceOptionalSchemasToNullable,this.coerceEnumsToLiterals=t.coerceEnumsToLiterals,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.resolveAliases=t.resolveAliases,this.groupEnvironmentsByHost=t.groupEnvironmentsByHost,this.removeDiscriminantsFromSchemas=t.removeDiscriminantsFromSchemas,this.defaultIntegerFormat=t.defaultIntegerFormat,this.pathParameterOrder=t.pathParameterOrder,this.coerceConstsTo=t.coerceConstsTo,this.converter=new wJt(t)}async getDefinition({context:t,absoluteFilePath:r,relativePathToDependency:n},i){let o=await this.getOpenAPIIr({context:t,relativePathToDependency:n},i);return this.converter.convert({context:t,ir:o,settings:i,absoluteFilePath:r})}async toFernWorkspace({context:t},r,n){let i=await this.getDefinition({context:t},r);return new LD({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion})}};var l_={BEARER_FORMAT:"x-bearer-format",ENUM_VAR_NAMES:"x-enum-varnames",INTERNAL:"x-internal",EXAMPLES:"x-examples",TAGS:"x-tags",REDOCLY_CODE_SAMPLES_KEBAB:"x-code-samples",REDOCLY_CODE_SAMPLES_CAMEL:"x-codeSamples"};var _Ue={of(e){return e}};var kJo={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},gKn={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:kJo,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},En={SOURCE:_Ue.of("source"),SDK_NAMESPACE:_Ue.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:_Ue.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:_Ue.of("x-fern-sdk-group-name"),REQUEST_NAME_V1:"x-request-name",REQUEST_NAME_V2:"x-fern-request-name",TYPE_NAME:"x-fern-type-name",BOOLEAN_LITERAL:"x-fern-boolean-literal",SERVER_NAME_V1:"x-name",SERVER_NAME_V2:"x-fern-server-name",BASE_PATH:"x-fern-base-path",GROUPS:_Ue.of("x-fern-groups"),OPENAPI_OVERIDES_FILEPATH:"x-fern-overrides-filepath",TYPE_DEFINITION:"x-fern-type",WEBHOOK_SIGNATURE:"x-fern-webhook-signature",STREAMING:"x-fern-streaming",PAGINATION:"x-fern-pagination",WEBHOOK:"x-fern-webhook",ASYNC_CONFIG:"x-fern-async-config",RETRIES:"x-fern-retries",SDK_VARIABLES:"x-fern-sdk-variables",SDK_VARIABLE:"x-fern-sdk-variable",PARAMETER_NAME:"x-fern-parameter-name",BASIC_AUTH_USERNAME_VARIABLE_NAME:"x-fern-username-variable-name",BASIC_AUTH_PASSWORD_VARIABLE_NAME:"x-fern-password-variable-name",BEARER_TOKEN_VARIABLE_NAME:"x-fern-token-variable-name",HEADER_VARIABLE_NAME:"x-fern-header-variable-name",FERN_ENUM:"x-fern-enum",AUDIENCES:"x-fern-audiences",IGNORE:"x-fern-ignore",AVAILABILITY:"x-fern-availability",RESPONSE_PROPERTY:"x-fern-sdk-return-value",RESOLUTIONS:"x-fern-resolutions",EXAMPLES:"x-fern-examples",FERN_BEARER_TOKEN:"x-fern-bearer",FERN_HEADER_AUTH:"x-fern-header",FERN_BASIC_AUTH:"x-fern-basic",FERN_GLOBAL_HEADERS:"x-fern-global-headers",FERN_IDEMPOTENCY_HEADERS:"x-fern-idempotency-headers",IDEMPOTENT:"x-fern-idempotent",FERN_PROPERTY_NAME:"x-fern-property-name",IS_UNDISCRIMINATED:"x-fern-undiscriminated",FERN_VERSION:"x-fern-version",ENCODING:"x-fern-encoding",TRANSPORT:"x-fern-transport",IS_DISCRIMINATED:"x-fern-discriminated",EXPLORER_ENABLED:"x-fern-explorer-enabled",DISCRIMINATOR_CONTEXT:"x-fern-discriminator-context"};var MQc={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!1,audiences:void 0,optionalAdditionalProperties:!0,coerceEnumsToLiterals:!1,respectReadonlySchemas:!1,respectNullableSchemas:!0,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!0,preserveSchemaIds:!1,objectQueryParameters:!0,shouldUseUndiscriminatedUnionsWithLiterals:!1,shouldUseIdiomaticRequestNames:!0,filter:void 0,asyncApiNaming:"v1",exampleGeneration:void 0,defaultFormParameterEncoding:"json",useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,additionalPropertiesDefaultsTo:!1,typeDatesAsStrings:!1,preserveSingleSchemaOneOf:!1,inlineAllOfSchemas:!1,resolveAliases:!1,groupMultiApiEnvironments:!1,groupEnvironmentsByHost:!1,wrapReferencesToNullableInOptional:!1,coerceOptionalSchemasToNullable:!1,removeDiscriminantsFromSchemas:bn.RemoveDiscriminantsFromSchemas.Always,defaultIntegerFormat:bn.DefaultIntegerFormat.Int32,pathParameterOrder:bn.PathParameterOrder.UrlOrder,resolveSchemaCollisions:!1,inferForwardCompatible:!1,coerceConstsTo:"enums-coerceable-to-literals",respectByteFormat:!1};function LQc(e){let{defaults:t,options:r,overrides:n,overrideOnly:i=new Set,undefinedIfAbsent:o=new Set}=e,s={};for(let a of Object.keys(t))i.has(a)?s[a]=n?.[a]!==void 0?n[a]:t[a]:o.has(a)?s[a]=n?.[a]!==void 0?n[a]:r?.[a]!==void 0?r[a]:void 0:s[a]=n?.[a]??r?.[a]??t[a];return s}function oM({options:e,overrides:t}){return LQc({defaults:MQc,options:e,overrides:t,overrideOnly:new Set(["disableExamples","preserveSchemaIds"]),undefinedIfAbsent:new Set(["exampleGeneration","defaultFormParameterEncoding"])})}Rt();var QJo={naming:"v1"};Ci();Ci();function Nr(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function Jmt(e,t,r,n,i=[]){try{let o=Nr(e,t);if(o!=null)return r.parse(o)}catch{let s=dj(i).join(" -> ");n.error(`${s.length>0?`${s}: `:""}Failed to parse ${t}`)}}function g_e(e){let t=Nr(e,"examples");if(t!=null){if(Array.isArray(t))return t;if(typeof t=="object"&&t!==null)return Object.values(t).map(r=>typeof r=="object"&&r!==null&&"value"in r?r.value:r)}return[]}function NJo({schema:e,logger:t}){return Nr(e,En.ENCODING)??void 0}function jJo(e){return Nr(e,En.FERN_ENUM)}Rt();function MJo({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:o}){let s=Nr(n,En.SDK_NAMESPACE),a=Nr(n,En.SDK_GROUP_NAME),u=Nr(n,En.TYPE_DEFINITION);if(u!=null)return Ymt({fernType:u,nameOverride:e,generatedName:t,title:r,description:i,availability:o,namespace:s,groupName:typeof a=="string"?[a]:a})}function Ymt({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a}){return R0({type:e,_default:void 0,validation:void 0,visitor:{primitive:u=>{switch(u.v1){case"BASE_64":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.base64({example:void 0})});case"BOOLEAN":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.boolean({default:void 0,example:void 0})});case"DATE":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.date({example:void 0})});case"DATE_TIME":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.datetime({example:void 0})});case"FLOAT":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.float({example:void 0})});case"DOUBLE":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.double({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.uint({default:void 0,example:void 0})});case"INTEGER":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.int({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT_64":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.uint64({default:void 0,example:void 0})});case"LONG":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});case"DATE_TIME_RFC_2822":return Fr.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,schema:Ii.datetimeRfc2822({example:void 0})});default:xe(u.v1)}},unknown:()=>Fr.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:o,namespace:s,groupName:a}),map:({keyType:u,valueType:c})=>u?.type==="primitive"&&c!=null?Fr.map({nameOverride:t,generatedName:r,title:n,key:u,value:c,description:i,availability:o,namespace:s,groupName:a,encoding:void 0,example:void 0,inline:void 0,minProperties:void 0,maxProperties:void 0}):void 0,list:u=>u!=null?Fr.array({nameOverride:t,generatedName:r,title:n,value:u,description:i,availability:o,namespace:s,groupName:a,example:void 0,inline:void 0,minItems:void 0,maxItems:void 0}):void 0,optional:u=>u!=null?Fr.optional({nameOverride:t,generatedName:r,title:n,value:u,description:i,availability:o,namespace:s,groupName:a,inline:void 0}):void 0,nullable:u=>u!=null?Fr.nullable({nameOverride:t,generatedName:r,title:n,value:u,description:i,availability:o,namespace:s,groupName:a,inline:void 0}):void 0,set:u=>u!=null?Fr.array({nameOverride:t,generatedName:r,title:n,value:u,description:i,availability:o,namespace:s,groupName:a,example:void 0,inline:void 0,minItems:void 0,maxItems:void 0}):void 0,literal:u=>Fr.literal({nameOverride:t,generatedName:r,title:n,value:u._visit({string:c=>wg.string(c),boolean:c=>wg.boolean(c),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:o,namespace:s,groupName:a}),named:u=>Fr.reference({schema:u,nameOverride:t,generatedName:r,title:n,description:i,availability:o,namespace:s,groupName:a,source:mS.openapi({file:"<memory>"})})}})}function LJo(e){let t=Nr(e,En.SOURCE);if(t!=null)return t.endsWith(".proto")?mS.protobuf({file:t}):mS.openapi({file:t})}function A_e(e){if(e!=null&&typeof e=="boolean")return e}function tG(){let e=new Map,t=new Map;return{getUniqueSchemaId(r,n,i=!1){let o=e.get(r)||0;if(e.set(r,o+1),o>0&&i){let s=`${r}${o+1}`;return n?.warn?.(`Schema name collision detected: '${r}' already exists. Renaming to '${s}' to avoid conflicts.`),s}return r},getUniqueTitleName(r,n,i,o=!1){let s=t.get(r)||0;if(t.set(r,s+1),s>0&&o){let a=`${r}${s+1}`;return i?.warn(`Schema title collision detected: Multiple schemas use title '${r}'. Schema '${n}' retitled to '${a}' to avoid conflicts.`),a}return r},reset(){e.clear(),t.clear()}}}Rt();function ei(e){return e?.$ref!=null}function UJo({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:o,availability:s,wrapAsOptional:a,wrapAsNullable:u,context:c,namespace:l,groupName:p,example:d,encoding:f,source:m,minProperties:h,maxProperties:g}){return i===void 0&&(i=c.options.additionalPropertiesDefaultsTo),AKn({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:u,description:o,availability:s,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:Ii.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),namespace:void 0,groupName:void 0},valueSchema:typeof i=="boolean"||Xmt(i,c.options)?Fr.unknown({...UQc(i),generatedName:`${t}Value`}):zJo(qa(i,!1,c.options.optionalAdditionalProperties?u:!1,c,[...n,"Value"],m,l,void 0,void 0,void 0)),namespace:l,groupName:p,example:d,encoding:f,minProperties:h,maxProperties:g})}function zJo(e){switch(e.type){case"array":case"enum":case"map":case"object":e.inline=!0;break;case"literal":case"primitive":case"reference":case"unknown":break;case"nullable":case"optional":e.inline=!0,e.value=zJo(e.value);break;case"oneOf":e.value.inline=!0;break;default:xe(e)}return e}function AKn({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsOptional:o,wrapAsNullable:s,description:a,availability:u,namespace:c,groupName:l,example:p,encoding:d,minProperties:f,maxProperties:m}){let h=Fr.map({nameOverride:e,generatedName:t,title:r,description:a,availability:u,key:n,value:i,namespace:c,groupName:l,encoding:d,example:p,inline:void 0,minProperties:f,maxProperties:m});return s&&(h=Fr.nullable({nameOverride:e,generatedName:t,title:r,value:h,description:a,availability:u,namespace:c,groupName:l,inline:void 0})),o&&(h=Fr.optional({nameOverride:e,generatedName:t,title:r,value:h,description:a,availability:u,namespace:c,groupName:l,inline:void 0})),h}function Xmt(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:ei(e)||"type"in e&&e.type!=null||"oneOf"in e&&e.oneOf!=null||"anyOf"in e&&e.anyOf!=null?!1:"allOf"in e&&e.allOf!=null?!e.allOf.some(n=>ei(n)?!0:n.type!=null||n.properties!=null||n.allOf!=null||n.oneOf!=null||n.anyOf!=null||n.enum!=null||"items"in n||n.additionalProperties!=null):!("enum"in e&&e.enum!=null)}function UQc(e){let t={nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0};return e==null||typeof e=="boolean"||ei(e)||typeof e!="object"||(e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description)),t}function VJo({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:o,availability:s,wrapAsOptional:a,wrapAsNullable:u,context:c,namespace:l,groupName:p,example:d,source:f,minItems:m,maxItems:h}){let g=i==null?Fr.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:l,groupName:p}):qa(i,!1,!1,c,[...n,"Item"],f,l);return zQc({nameOverride:e,generatedName:t,title:r,namespace:l,groupName:p,itemSchema:g,wrapAsOptional:a,wrapAsNullable:u,description:o,availability:s,example:d,minItems:m,maxItems:h})}function zQc({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsOptional:i,wrapAsNullable:o,description:s,availability:a,namespace:u,groupName:c,example:l,minItems:p,maxItems:d}){let f=Fr.array({nameOverride:e,generatedName:t,title:r,value:n,description:s,availability:a,namespace:u,groupName:c,example:l,inline:void 0,minItems:p,maxItems:d});return o&&(f=Fr.nullable({nameOverride:e,generatedName:t,title:r,value:f,description:s,availability:a,namespace:u,groupName:c,inline:void 0})),i&&(f=Fr.optional({nameOverride:e,generatedName:t,title:r,value:f,description:s,availability:a,namespace:u,groupName:c,inline:void 0})),f}function AS(e){switch(Nr(e,En.AVAILABILITY)){case"deprecated":return Mw.Deprecated;case"beta":return Mw.Beta;case"generally-available":return Mw.GenerallyAvailable;default:break}if(!ei(e)&&e.deprecated)return Mw.Deprecated}function CJt({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:o,availability:s,required:a,wrapAsOptional:u,wrapAsNullable:c,discriminator:l,context:p,namespace:d,groupName:f,encoding:m,source:h}){let g=l.propertyName,A=Nr(l,En.FERN_PROPERTY_NAME),E=Nr(l,En.DISCRIMINATOR_CONTEXT)??"data",v=Object.fromEntries(Object.entries(l.mapping??{}).map(([I,w])=>{let x=t8({$ref:w},!1,!1,p,[w],m,h,d);return p.markReferencedByDiscriminatedUnion({$ref:w},g,1),[I,x]})),b=Object.entries(i).filter(([I])=>I!==g).map(([I,w])=>{let x=a!=null&&a.includes(I),[C,_]=p.options.coerceOptionalSchemasToNullable?[!1,!x]:[!x,!1],R=qa(w,C,_,p,[...n,I],h,d);return{key:I,schema:R}});return qJo({nameOverride:e,generatedName:t,title:r,wrapAsOptional:u,wrapAsNullable:c,properties:b,description:o,availability:s,discriminant:g,discriminantNameOverride:A,discriminatorContext:E,subtypes:v,namespace:d,groupName:f,source:h})}function yKn({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:o,availability:s,required:a,wrapAsOptional:u,wrapAsNullable:c,discriminant:l,variants:p,context:d,namespace:f,groupName:m,encoding:h,source:g}){let A=Object.fromEntries(Object.entries(p).map(([v,b])=>{if(ei(b)){let I=t8(b,!1,!1,d,[b.$ref],h,g,f);return d.markReferencedByDiscriminatedUnion(b,l,1),[v,I]}else{let I=SUe(b,!1,!1,d,[...n,v],h,g,f,new Set([l]));return[v,I]}})),E=Object.entries(i).filter(([v])=>v!==l).map(([v,b])=>{let I=a!=null&&a.includes(v),[w,x]=d.options.coerceOptionalSchemasToNullable?[!1,!I]:[!I,!1],C=qa(b,w,x,d,[...n,v],g,f);return{key:v,schema:C}});return qJo({nameOverride:e,generatedName:t,title:r,wrapAsOptional:u,wrapAsNullable:c,properties:E,description:o,availability:s,discriminant:l,discriminantNameOverride:void 0,discriminatorContext:"data",subtypes:A,namespace:f,groupName:m,source:g})}function qJo({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:o,description:s,availability:a,discriminant:u,discriminantNameOverride:c,discriminatorContext:l,subtypes:p,namespace:d,groupName:f,source:m}){let h=Fr.oneOf(Z2.discriminated({description:s,availability:a,discriminantProperty:u,discriminantPropertyNameOverride:c,discriminatorContext:l,nameOverride:e,generatedName:t,title:r,schemas:p,commonProperties:o,namespace:d,groupName:f,encoding:void 0,source:m,inline:void 0}));return i&&(h=Fr.nullable({nameOverride:e,generatedName:t,title:r,value:h,namespace:d,groupName:f,description:s,availability:a,inline:void 0})),n&&(h=Fr.optional({nameOverride:e,generatedName:t,title:r,value:h,namespace:d,groupName:f,description:s,availability:a,inline:void 0})),h}function GJo(e){if(e.proto!=null)return kLe.protobuf({typeName:e.proto.type})}function Ipe({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:o,_default:s,description:a,availability:u,wrapAsOptional:c,wrapAsNullable:l,namespace:p,groupName:d,context:f,source:m,inline:h}){let g=qQc(i??[]),A=new Set(o),E=Array.from(A).map((b,I)=>{let w=n?.[b],x=g[I],C=AUe.test(b),_=w?.name??x,R=C?b:yUe(b);return _!=null&&!AUe.test(_)&&(f?.logger.warn(`Enum name override ${_} is not a valid name. Falling back on ${R}.`),_=void 0),{nameOverride:_,generatedName:R,value:b,description:w?.description,availability:u,casing:{snake:w?.casing?.snake??void 0,pascal:w?.casing?.pascal??void 0,screamingSnake:w?.casing?.screamingSnake??void 0,camel:w?.casing?.camel??void 0}}}),v=s!=null?E.find(b=>b.value===s):void 0;return VQc({wrapAsOptional:c,wrapAsNullable:l,nameOverride:e,generatedName:t,title:r,values:E,_default:v,description:a,availability:u,namespace:p,groupName:d,source:m,inline:h})}function VQc({wrapAsOptional:e,wrapAsNullable:t,nameOverride:r,generatedName:n,title:i,values:o,_default:s,description:a,availability:u,namespace:c,groupName:l,source:p,inline:d}){let f=Fr.enum({nameOverride:r,generatedName:n,title:i,values:o,description:a,availability:u,default:s,example:void 0,namespace:c,groupName:l,source:p,inline:d});return t&&(f=Fr.nullable({nameOverride:r,generatedName:n,title:i,value:f,description:a,availability:u,namespace:c,groupName:l,inline:d})),e&&(f=Fr.optional({nameOverride:r,generatedName:n,title:i,value:f,description:a,availability:u,namespace:c,groupName:l,inline:d})),f}function qQc(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(n=>n[r]===t[r]);)r++;return e.map(n=>n.substring(r))}function WJo({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:o,maximum:s,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:c,description:l,availability:p,wrapAsOptional:d,wrapAsNullable:f,example:m,namespace:h,groupName:g,defaultIntegerFormat:A=bn.DefaultIntegerFormat.Int32}){let E=n??A,v=(()=>{switch(E){case bn.DefaultIntegerFormat.Int64:return Ii.int64({default:i,example:m});case bn.DefaultIntegerFormat.Uint32:return Ii.uint({default:i,example:m});case bn.DefaultIntegerFormat.Uint64:return Ii.uint64({default:i,example:m});default:return Ii.int({default:i,minimum:o,maximum:s,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:c,example:m})}})();return Gw({nameOverride:e,generatedName:t,title:r,primitive:v,wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g})}function GQc(e){return typeof e=="string"?wg.string(e):typeof e=="boolean"?wg.boolean(e):wg.string(`${e}`)}function bKn({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,value:o,description:s,availability:a,namespace:u,groupName:c}){let l=Fr.literal({nameOverride:e,generatedName:t,title:r,value:GQc(o),description:s,availability:a,namespace:u,groupName:c});return i&&(l=Fr.nullable({nameOverride:e,generatedName:t,title:r,value:l,description:s,availability:a,namespace:u,groupName:c,inline:void 0})),n&&(l=Fr.optional({nameOverride:e,generatedName:t,title:r,value:l,description:s,availability:a,namespace:u,groupName:c,inline:void 0})),l}function EKn({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:o,maximum:s,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:c,description:l,availability:p,wrapAsOptional:d,wrapAsNullable:f,example:m,namespace:h,groupName:g}){return n==null||n==="double"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.double({default:i,minimum:o,maximum:s,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:c,example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):n==="float"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.float({example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):n==="int32"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.int({default:i,minimum:o,maximum:s,exclusiveMinimum:a,exclusiveMaximum:u,multipleOf:c,example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):n==="int64"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.int64({default:i,example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):n==="uint32"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.uint({default:i,example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):n==="uint64"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.uint64({default:i,example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):n==="time-delta"?Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.float({example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g}):Gw({nameOverride:e,generatedName:t,title:r,primitive:Ii.float({example:m}),wrapAsOptional:d,wrapAsNullable:f,description:l,availability:p,namespace:h,groupName:g})}var WQc={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},$Qc={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="responses",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},HQc={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="parameters",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),e[0]==="schema"&&(e=e.slice(1)),{refUnderProcessing:e,newBreadcrumbs:t}}},KQc={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},JQc={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},YQc={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},XQc={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},ZQc={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function Zmt(e){let t=e.split("/").map(o=>o.replace(/~1/g,"/")),r=[],n=[WQc,$Qc,HQc,KQc,JQc,YQc,XQc,ZQc],i;do{i=t;for(let o of n)if(o.isApplicable(t)){let{refUnderProcessing:s,newBreadcrumbs:a}=o.applyStrategy(t);t=s,r=[...r,...a]}}while(t.join("")!==i.join(""));return r}Ci();function py(e,t){let n=e.map(i=>/^[^a-zA-Z0-9]+$/.test(i)?i:Nc(Ln(i))).join("");return/^\d/.test(n)?kmt(n)??n:n}function $Jo(e){let t=e.join("_");return Ln(t)}Rt();function df(e){switch(e.type){case"object":return aa.object({allOf:e.allOf,properties:e.properties.map(t=>tNc(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,additionalProperties:e.additionalProperties,availability:e.availability,encoding:e.encoding,source:e.source,inline:e.inline,minProperties:e.minProperties,maxProperties:e.maxProperties});case"array":return aa.array({description:e.description,availability:e.availability,value:df(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline,minItems:e.minItems,maxItems:e.maxItems});case"enum":return aa.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,values:e.values,default:e.default,namespace:e.namespace,groupName:e.groupName,source:e.source,inline:e.inline});case"literal":return aa.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"nullable":return aa.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:df(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return aa.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:df(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return aa.primitive({description:e.description,availability:e.availability,schema:HJo(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return aa.map({description:e.description,availability:e.availability,key:aa.primitive({description:e.key.description,availability:e.key.availability,schema:HJo(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:df(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,inline:e.inline,minProperties:e.minProperties,maxProperties:e.maxProperties});case"reference":return aa.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schema:e.schema,namespace:e.namespace,groupName:e.groupName,source:e.source});case"oneOf":return aa.oneOf(eNc(e.value));case"unknown":return aa.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,description:e.description,availability:e.availability,namespace:e.namespace,groupName:e.groupName});default:xe(e)}}function eNc(e){switch(e.type){case"discriminated":return H9.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:df(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,discriminantPropertyNameOverride:e.discriminantPropertyNameOverride,discriminatorContext:e.discriminatorContext,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,df(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return H9.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>df(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:xe(e)}}function HJo(e){switch(e.type){case"string":return Mc.string(e);case"base64":return Mc.base64();case"boolean":return Mc.boolean(e);case"date":return Mc.date();case"datetime":return Mc.datetime();case"datetimeRfc2822":return Mc.datetimeRfc2822();case"double":return Mc.double(e);case"float":return Mc.float();case"int":return Mc.int(e);case"int64":return Mc.int64(e);case"uint":return Mc.uint();case"uint64":return Mc.uint64();default:xe(e)}}function tNc(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:df(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function xJt(e,t){return WD(df(e),df(t))}function KJo({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:o,required:s,wrapAsOptional:a,wrapAsNullable:u,allOf:c,context:l,propertiesToExclude:p,namespace:d,groupName:f,fullExamples:m,additionalProperties:h,availability:g,encoding:A,source:E,minProperties:v,maxProperties:b}){let I=[...s??[]],w={...JJo({properties:i,breadcrumbs:n,context:l})},x=[],C=[];for(let z of c)if(!l.options.inlineAllOfSchemas&&ei(z)){let Z=l.resolveSchemaReference(z);if(Z.discriminator!=null&&Z.discriminator.mapping!=null)continue;if(Z.oneOf!=null||Z.anyOf!=null){let V=Z.oneOf??Z.anyOf;if(V!=null){for(let K of V){let Ee=ei(K)?l.resolveSchemaReference(K):K,Ce=qa(Ee,!1,!1,l.DUMMY,n,E,d);Ce.type==="object"&&x.push(...Ce.properties.map(J=>J.schema.type!=="optional"&&J.schema.type!=="nullable"?{...J,schema:Fr.optional({nameOverride:void 0,generatedName:"",title:void 0,value:J.schema,description:void 0,availability:J.availability,namespace:void 0,groupName:void 0,inline:void 0})}:J))}continue}}let oe=ane(z);if(oe==null)continue;C.push({schemaId:oe,convertedSchema:vKn(z,[oe],E,l.options.preserveSchemaIds,l),properties:YJo({schema:z,context:l,breadcrumbs:n,source:E,namespace:d})}),l.markSchemaAsReferencedByNonRequest(oe)}else if(ei(z)){let Z=l.resolveSchemaReference(z),oe=qa(Z,!1,!1,l,n,E,d);oe.type==="object"&&x.push(...oe.properties)}else{let Z=z.required??[];x=x.map(V=>(V.schema.type==="optional"||V.schema.type==="nullable")&&Z.includes(V.key)?{...V,schema:V.schema.value}:V);let oe=z.oneOf??z.anyOf;if(oe!=null&&z.type==null&&z.properties==null){let V=new Set(x.map(K=>K.key));for(let K of oe){let Ee=ei(K)?l.resolveSchemaReference(K):K,Ce=nNc(Ee),J=qa(Ce,!1,!1,l,n,E,d);if(J.type==="object")for(let H of J.properties)V.has(H.key)||(V.add(H.key),H.schema.type!=="optional"&&H.schema.type!=="nullable"?x.push({...H,schema:Fr.optional({nameOverride:void 0,generatedName:"",title:void 0,value:H.schema,description:void 0,availability:H.availability,namespace:void 0,groupName:void 0,inline:void 0})}):x.push(H))}}else{let V=qa(z,!1,!1,l,n,E,d);V.type==="object"&&x.push(...V.properties)}}let _={};for(let z of C)for(let[Z,oe]of Object.entries(z.properties)){let V=_[Z];V!=null?(V.schemaIds.push(z.schemaId),V.schemas.some(Ee=>xJt(Ee,oe))||V.schemas.push(oe)):_[Z]={schemaIds:[z.schemaId],schemas:[oe]}}let R=[];for(let[z,Z]of Object.entries(_))Z.schemaIds.length>1&&R.push({propertyKey:z,allOfSchemaIds:Z.schemaIds,conflictingTypeSignatures:Z.schemas.length>1});let U=Object.fromEntries(Object.entries(w).filter(([z,Z])=>!(!ei(Z)&&Z.type==="null"))),q=Object.entries(U).map(([z,Z])=>{let oe=Nr(Z,En.AUDIENCES)??[],V=AS(Z),K=ei(Z)?l.resolveSchemaReference(Z):Z,Ee="readOnly"in Z&&Z.readOnly===!0||K.readOnly,Ce="writeOnly"in Z&&Z.writeOnly===!0||K.writeOnly,H=!(I.includes(z)&&(!Ee||l.options.respectReadonlySchemas)),ge=Nr(Z,En.FERN_PROPERTY_NAME),me=[...n,z],we=$Jo(me),Be=qa(Z,H,!1,l,me,E,d),le={};for(let ue of C){let Fe=ue.properties[z];Fe!=null&&!xJt(Be,Fe)?le[ue.schemaId]={differentSchema:!0}:Fe!=null&&(le[ue.schemaId]={differentSchema:!1})}return{key:z,schema:Be,nameOverride:ge,audiences:oe,conflict:le,generatedName:we,availability:V,readonly:Ee,writeonly:Ce}});return q.push(...x.map(z=>{let Z=z.conflict;for(let oe of C){let V=oe.properties[z.key];V!=null&&!xJt(z.schema,V)?Z[oe.schemaId]={differentSchema:!0}:V!=null&&(Z[oe.schemaId]={differentSchema:!1})}return I.includes(z.key)&&(z.schema.type==="optional"||z.schema.type==="nullable")&&(!z.readonly||l.options.respectReadonlySchemas)?{...z,schema:z.schema.value,conflict:Z}:{...z,conflict:Z}})),rNc({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:u,properties:q.filter(z=>!p.has(z.key)),description:o,allOf:C.map(z=>z.convertedSchema),allOfPropertyConflicts:R,namespace:d,groupName:f,fullExamples:m,additionalProperties:h,availability:g,encoding:A,source:E,context:l,minProperties:v,maxProperties:b})}function rNc({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:o,description:s,allOf:a,allOfPropertyConflicts:u,namespace:c,groupName:l,fullExamples:p,additionalProperties:d,availability:f,encoding:m,source:h,context:g,minProperties:A,maxProperties:E}){let v=Fr.object({description:s,properties:o,nameOverride:e,generatedName:t,title:r,allOf:a,allOfPropertyConflicts:u,namespace:c,groupName:l,fullExamples:p,additionalProperties:Xmt(d,g.options),availability:f,encoding:m,source:h,inline:void 0,minProperties:A,maxProperties:E});return i&&(v=Fr.nullable({nameOverride:e,generatedName:t,title:r,value:v,description:s,availability:f,namespace:c,groupName:l,inline:void 0})),n&&(v=Fr.optional({nameOverride:e,generatedName:t,title:r,value:v,description:s,availability:f,namespace:c,groupName:l,inline:void 0})),v}function JJo({properties:e,breadcrumbs:t,context:r}){return Object.fromEntries(Object.entries(e).filter(([n,i])=>{let o=Nr(i,En.IGNORE);return o&&r.logger.debug(`Property ${t.join(".")}.${n} is marked with x-fern-ignore. Skipping.`),!o}))}function nNc(e){if(e.properties==null)return e;let t={};for(let[r,n]of Object.entries(e.properties))!ei(n)&&"not"in n||(t[r]=n);return{...e,properties:t}}function YJo({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let o={},[s,a]=ei(e)?[t.resolveSchemaReference(e),Zmt(e.$ref)]:[e,r];for(let u of s.allOf??[])o={...o,...YJo({schema:u,context:t,breadcrumbs:a,source:n,namespace:i})};for(let[u,c]of Object.entries(JJo({properties:s.properties??{},breadcrumbs:r,context:t}))){let l=qa(c,!1,!1,t,[...a,u],n,i);o[u]=l}return o}Ci();function wpe({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:o,wrapAsOptional:s,wrapAsNullable:a,context:u,subtypes:c,namespace:l,groupName:p,encoding:d,source:f,subtypeSuffixOverrides:m}){let h=sNc({schemas:c}),g=c.flatMap((E,v)=>{if(!ei(E)&&E.enum!=null&&u.options.coerceEnumsToLiterals&&E.type==="string")return E.enum.map(I=>Fr.literal({nameOverride:void 0,generatedName:py([t,I],u.options.preserveSchemaIds),title:void 0,value:wg.string(String(I)),namespace:l,groupName:void 0,description:void 0,availability:I.availability}));let b=h[v];if(m!=null){let I=m[v];I!=null&&"name"in I&&(b=I.name)}return[qa(E,!1,!1,u,[...n,b??`${v}`],f,l)]}),A=iNc(g);return oNc({uniqueSubtypes:A,nameOverride:e,generatedName:t,title:r,wrapAsOptional:s,wrapAsNullable:a,description:i,availability:o,namespace:l,groupName:p,context:u,encoding:d,source:f})}function iNc(e){let t=[];for(let r=0;r<e.length;++r){let n=e[r],i=!1;for(let o=r+1;o<e.length;++o){let s=e[o];if(n!=null&&s!=null&&WD(n,s)){i=!0;break}}n!=null&&!i&&t.push(n)}return t}function oNc({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:o,description:s,availability:a,namespace:u,groupName:c,context:l,encoding:p,source:d}){if(Object.entries(e).every(([m,h])=>h.type==="literal")){let m={},h=[];return Object.entries(e).forEach(([g,A])=>{A.type==="literal"&&A.value.type==="string"&&(h.push(A.value.value),A.description!=null&&(m[A.value.value]={description:A.description}))}),Ipe({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:o,description:s,availability:a,fernEnum:m,enumVarNames:void 0,enumValues:h,_default:void 0,namespace:u,groupName:c,context:l,source:d,inline:void 0})}if(e.length===1&&e[0]!=null&&!l.options.preserveSingleSchemaOneOf){let m=e[0];return o&&(m=Fr.nullable({nameOverride:t,generatedName:r,title:n,value:m,description:s,availability:a,namespace:u,groupName:c,inline:void 0})),i&&(m=Fr.optional({nameOverride:t,generatedName:r,title:n,value:m,description:s,availability:a,namespace:u,groupName:c,inline:void 0})),m}return XJo({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:o,description:s,availability:a,subtypes:e,namespace:u,groupName:c,encoding:p,source:d})}function IKn({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsOptional:o,wrapAsNullable:s,context:a,namespace:u,groupName:c,discriminator:l,encoding:p,source:d}){let f=Object.entries(l.mapping??{}).map(([g,A],E)=>{let v={$ref:A},b=t8(v,!1,!1,a,[A],p,d,u);return a.markSchemaWithDiscriminantValue(v,l.propertyName,g),b.type==="object"&&(b.properties={[l.propertyName]:Fr.literal({nameOverride:void 0,generatedName:py([t,g],a.options.preserveSchemaIds),title:void 0,value:wg.string(g),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...b.properties.filter(I=>I.key!==l.propertyName)}),b}),m=[];for(let g=0;g<f.length;++g){let A=f[g],E=!1;for(let v=g+1;v<f.length;++v){let b=f[v];if(A!=null&&b!=null&&WD(A,b)){E=!0;break}}A!=null&&!E&&m.push(A)}if(Object.entries(m).every(([g,A])=>A.type==="literal")){let g={},A=[];return Object.entries(m).forEach(([E,v])=>{v.type==="literal"&&v.value.type==="string"&&(A.push(v.value.value),v.description!=null&&(g[v.value.value]={description:v.description}))}),Ipe({nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:s,description:n,availability:i,fernEnum:g,enumVarNames:void 0,enumValues:A,_default:void 0,namespace:u,groupName:c,context:a,source:d,inline:void 0})}return m.length===1&&m[0]!=null&&!a.options.preserveSingleSchemaOneOf?m[0]:XJo({nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:s,description:n,availability:i,subtypes:m,namespace:u,groupName:c,encoding:p,source:d})}function sNc({schemas:e}){let t={},r=0;for(let i of e){if(!ei(i)){if(i.properties!=null&&Object.entries(i.properties).length>0){let o=Object.keys(i.properties),s={},a=o;for(let[u,c]of Object.entries(t)){let l=mNt(c,o);a=mNt(a,c),s[u]=l}s[r]=a,t=s}}r++}return e.map((i,o)=>{let s=t[o];if(s!=null&&s.length>0){let a=s.sort();if(a[0]!=null)return a[0]}return c_e(o)??`${o}`})}function XJo({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,description:o,availability:s,subtypes:a,namespace:u,groupName:c,encoding:l,source:p}){let d=Fr.oneOf(Z2.undiscriminated({description:o,availability:s,nameOverride:e,generatedName:t,title:r,schemas:a,namespace:u,groupName:c,encoding:l,source:p,inline:void 0}));return i&&(d=Fr.nullable({nameOverride:e,generatedName:t,title:r,value:d,description:o,availability:s,namespace:u,groupName:c,inline:void 0})),n&&(d=Fr.optional({nameOverride:e,generatedName:t,title:r,value:d,description:o,availability:s,namespace:u,groupName:c,inline:void 0})),d}function BUe(e){if(e.default!=null&&typeof e.default=="string")return e.default}function _Jt({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let n=g_e(e);for(let i of n??[])if(typeof i=="number")return i;if(r&&typeof r=="number")return r}function ZJo({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let n=g_e(e);for(let i of n??[])if(typeof i=="boolean")return i;if(r&&typeof r=="boolean")return r}function sM({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let n=g_e(e);for(let i of n??[])if(typeof i=="string")return i;if(r&&typeof r=="string")return r}function eYo({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let n=g_e(e);for(let i of n??[])if(Array.isArray(i))return i;if(r&&Array.isArray(r))return r}var y_e="#/components/schemas/";var iYo=tG();function PJt(){iYo.reset()}function aNc(e,t,r){let n=Nr(e,En.TYPE_NAME),i=t.options.useTitlesAsName?lNc(e.title):void 0,o=n??i;if(!o)return;let s=r.split(".");return n!=null||s.length===1?iYo.getUniqueTitleName(o,r,t.logger,t.options.resolveSchemaCollisions):o}function oYo(e,t){let r=ei(e)?t.resolveSchemaReference(e):e;switch(r.type){case"boolean":case"number":case"integer":return!0;case"string":return r.enum==null;case"array":return oYo(r.items,t);case"object":return!1;case void 0:return!1;default:return t.logger.warn("Unhandled schema type. Will not inline this schema",JSON.stringify(r)),!1}}function uNc(e,t,r){return r.options.resolveAliases?typeof r.options.resolveAliases=="object"&&r.options.resolveAliases.except?.includes(e)?!1:oYo(t,r):!1}function qa(e,t,r,n,i,o,s,a=!1,u=new Set,c){let l=LJo(e)??o,p=gNc({schema:e,logger:n.logger}),d=c;if(ei(e)){let f=cNc(e);f!==void 0&&(d=f)}if(ei(e)){let f=ane(e);return f!=null?uNc(f,e,n)?SUe(n.resolveSchemaReference(e),t,r,n,Zmt(e.$ref),p,l,s,u,a,d):(a?n.markSchemaAsReferencedByRequest(f):n.markSchemaAsReferencedByNonRequest(f),t8(e,t,r,n,i,p,l,s)):SUe(n.resolveSchemaReference(e),t,r,n,Zmt(e.$ref),p,l,s,u,a,d)}return SUe(e,t,r,n,i,p,l,s,u,a,c)}function cNc(e){if("example"in e&&e.example!==void 0){let t=e.example;if(typeof t=="string"||typeof t=="number"||typeof t=="boolean"||Array.isArray(t))return t}if("examples"in e){let t=e.examples;if(Array.isArray(t)&&t.length>0){let r=t[0];if(typeof r=="string"||typeof r=="number"||typeof r=="boolean"||Array.isArray(r))return r}}}function t8(e,t,r,n,i,o,s,a){let u=e.$ref.includes("properties")?SUe(n.resolveSchemaReference(e),t,r,n,i,o,s,a,new Set):Fr.reference(vKn(e,i,s,n.options.preserveSchemaIds,n));if(r===!1){let c=n.resolveSchemaReference(e);(c.nullable===!0||Array.isArray(c.type)&&c.type.length>=2&&c.type.includes("null"))&&(r=!0)}return r&&(u=Fr.nullable({title:void 0,nameOverride:void 0,generatedName:py(i,n.options.preserveSchemaIds),value:u,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),t&&(u=Fr.optional({title:void 0,nameOverride:void 0,generatedName:py(i,n.options.preserveSchemaIds),value:u,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),u}function lNc(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function SUe(e,t,r,n,i,o,s,a,u=new Set,c=!1,l){typeof e=="string"&&(e={type:e});let p=aNc(e,n,i.join(".")),d=Nr(e,En.SDK_GROUP_NAME)??Nr(e,l_.TAGS)?.[0],f=(typeof d=="string"?[d]:d)??[];f=n.resolveGroupName(f);let m=py(i,n.options.preserveSchemaIds),h=e.title,g=e.description,A=AS(e),E=[];e.example!=null&&E.push({name:void 0,value:e.example,description:void 0});let v=Nr(e,l_.EXAMPLES);v!=null&&Object.keys(v).length>0&&E.push(...Object.entries(v).map(([w,x])=>({name:x?.summary??w,value:x.value,description:x.description})));let b=g_e(e);b!=null&&Object.keys(b).length>0&&E.push(...b.map(w=>({name:void 0,value:w,description:void 0})));let I=MJo({schema:e,description:g,title:h,nameOverride:p,generatedName:m,availability:A});if(I!=null){let w=I;return r&&(w=Fr.nullable({availability:A,namespace:a,groupName:f,description:g,generatedName:m,inline:void 0,nameOverride:p,title:h,value:w})),t&&(w=Fr.optional({availability:A,namespace:a,groupName:f,description:g,generatedName:m,inline:void 0,nameOverride:p,title:h,value:w})),w}try{if(Array.isArray(e.type)){let R=e.type.indexOf("null"),U=R!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&U)e.type.splice(R,1),e.type=e.type[0],e.nullable=!0;else if(U&&(e.type.splice(R,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let q=new Set([...e.oneOf,...e.type]);e.oneOf=[...q]}}r=r||e.nullable===!0;let w="const"in e,x=w&&n.options.coerceConstsTo==="enums";if(w){let R=e.const;if(n.options.coerceConstsTo==="literals"&&(typeof R=="string"||typeof R=="boolean"))return bKn({nameOverride:p,generatedName:m,title:h,wrapAsOptional:t,wrapAsNullable:r,value:R,description:g,availability:A,namespace:a,groupName:f});e.enum=[R]}if(e.enum!=null&&(e.type==="string"||e.type==null||e.type==="enum")){if(e.enum=e.enum.filter(U=>U!==null),!OJt(e.enum))return Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.string({default:BUe(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:sM({schema:e,logger:n.logger,fallback:l})}),namespace:a,groupName:f,wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A});let R=jJo(e);return n.options.coerceEnumsToLiterals&&!x&&e.enum.length===1&&e.enum[0]!=null&&R==null?bKn({nameOverride:p,generatedName:m,title:h,wrapAsOptional:t,wrapAsNullable:r,value:e.enum[0],description:g,availability:A,namespace:a,groupName:f}):Ipe({nameOverride:p,generatedName:m,title:h,fernEnum:R,enumVarNames:Nr(e,[l_.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,namespace:a,groupName:f,context:n,source:s,inline:void 0})}if(OJt(e.type)&&e.type.length>1){let R=e.type.includes("null"),U=e.type.filter(q=>q!=="null").map(q=>({type:q,nullable:R}));return wpe({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:U,namespace:a,groupName:f,encoding:o,source:s})}if(e.type==="boolean"){let R=Nr(e,En.BOOLEAN_LITERAL);return R!=null?rYo({nameOverride:p,generatedName:m,title:h,literal:wg.boolean(R),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f}):Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.boolean({default:pNc(e.default),example:ZJo({schema:e,logger:n.logger,fallback:l})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f})}if(e.type==="number")return EKn({nameOverride:p,generatedName:m,title:h,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:A_e(e.exclusiveMinimum),exclusiveMaximum:A_e(e.exclusiveMaximum),multipleOf:e.multipleOf,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,example:_Jt({schema:e,logger:n.logger,fallback:l}),namespace:a,groupName:f});if(e.type==="integer")return WJo({nameOverride:p,generatedName:m,title:h,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:A_e(e.exclusiveMinimum),exclusiveMaximum:A_e(e.exclusiveMaximum),multipleOf:e.multipleOf,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,example:_Jt({schema:e,logger:n.logger,fallback:l}),namespace:a,groupName:f,defaultIntegerFormat:n.options.defaultIntegerFormat});if(e.type==="float")return EKn({nameOverride:p,generatedName:m,title:h,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:A_e(e.exclusiveMinimum),exclusiveMaximum:A_e(e.exclusiveMaximum),multipleOf:e.multipleOf,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,example:_Jt({schema:e,logger:n.logger,fallback:l}),namespace:a,groupName:f});if(e.type==="string"){if(e.format==null&&e.contentMediaType==="application/octet-stream"&&(e={...e,format:"binary"}),e.format==="date-time")return Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.datetime({example:sM({schema:e,logger:n.logger,fallback:l})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f});if(e.format==="date-time-rfc-2822")return Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.datetimeRfc2822({example:sM({schema:e,logger:n.logger,fallback:l})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f});if(e.format==="date"&&n.options.typeDatesAsStrings===!1)return Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.date({example:sM({schema:e,logger:n.logger,fallback:l})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f});if(e.format==="json-string"){let U=Fr.unknown({nameOverride:p,generatedName:m,title:h,description:g,availability:A,namespace:a,groupName:f,example:void 0});return r&&(U=Fr.nullable({availability:A,namespace:a,groupName:f,description:g,generatedName:m,inline:void 0,nameOverride:p,title:h,value:U})),t&&(U=Fr.optional({availability:A,namespace:a,groupName:f,description:g,generatedName:m,inline:void 0,nameOverride:p,title:h,value:U})),U}if(e.format==="byte"&&n.options.respectByteFormat)return Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.base64({example:sM({schema:e,logger:n.logger,fallback:l})}),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f});let R=aYo(e,"const");return R!=null?rYo({nameOverride:p,generatedName:m,title:h,literal:wg.string(R),wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A,namespace:a,groupName:f}):Gw({nameOverride:p,generatedName:m,title:h,primitive:Ii.string({default:BUe(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:sM({schema:e,logger:n.logger,fallback:l})}),namespace:a,groupName:f,wrapAsOptional:t,wrapAsNullable:r,description:g,availability:A})}if(e.type==="array")return VJo({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,item:e.items,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,example:eYo({schema:e,logger:n.logger,fallback:l}),source:s,minItems:e.minItems,maxItems:e.maxItems});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&SJt(e)&&tYo(e))return UJo({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,additionalProperties:e.additionalProperties,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,encoding:o,example:e.example,source:s,minProperties:e.minProperties,maxProperties:e.maxProperties});if(e.oneOf!=null&&e.oneOf.length>0&&Nr(e,En.IS_DISCRIMINATED)===!1)return wpe({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf,namespace:a,groupName:f,encoding:o,source:s});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return n.options.discriminatedUnionV2?IKn({nameOverride:p,generatedName:m,title:h,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,discriminator:e.discriminator,encoding:o,source:s}):CJt({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,encoding:o,source:s});if(e.oneOf!=null&&e.oneOf.length>0){let R=Nr(e,En.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return n.options.discriminatedUnionV2||R?IKn({nameOverride:p,generatedName:m,title:h,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,discriminator:e.discriminator,encoding:o,source:s}):CJt({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,encoding:o,source:s});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(n.options.preserveSingleSchemaOneOf)return wpe({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf.filter(q=>ei(q)||q.type!=="null"),encoding:o,namespace:a,groupName:f,source:s});let U=qa(e.oneOf[0],t,r,n,i,s,a,c);return rG(U,g,a,f)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let Z=e.oneOf[0],oe=e.oneOf[1];if(!ei(Z)&&Z.type==="null"){let V=qa(oe,t,!0,n,i,s,a);return rG(V,g,a,f)}else if(!ei(oe)&&oe.type==="null"){let V=qa(Z,t,!0,n,i,s,a);return rG(V,g,a,f)}}let U=dNc({schemas:e.oneOf});if(U!=null)return Ipe({nameOverride:p,generatedName:m,title:h,fernEnum:void 0,enumVarNames:void 0,enumValues:U,_default:e.default,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,namespace:a,groupName:f,context:n,source:s,inline:void 0});let q=nYo({schemas:e.oneOf,context:n});if(q!=null&&!n.options.discriminatedUnionV2&&!R)return yKn({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,properties:e.properties??{},required:e.required,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,discriminant:q.discriminant,variants:q.schemas,context:n,namespace:a,groupName:f,encoding:o,source:s});let z=e.oneOf.filter(Z=>!ei(Z)&&Z.type==="null").length>0;return wpe({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r||z,context:n,subtypes:e.oneOf.filter(Z=>ei(Z)||Z.type!=="null"),encoding:o,namespace:a,groupName:f,source:s})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let q=qa(e.anyOf[0],t,r,n,i,s,a,c);return rG(q,g,a,f)}if(e.anyOf.length===2){let[q,z]=e.anyOf;if(q!=null&&z!=null){if(!ei(q)&&q.type==="null"){let Z=qa(z,t,!0,n,i,s,a);return rG(Z,g,a,f)}else if(!ei(z)&&z.type==="null"){let Z=qa(q,t,!0,n,i,s,a);return rG(Z,g,a,f)}}}let R=nYo({schemas:e.anyOf,context:n});if(R!=null&&!n.options.discriminatedUnionV2)return yKn({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,properties:e.properties??{},required:e.required,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,discriminant:R.discriminant,variants:R.schemas,context:n,namespace:a,groupName:f,encoding:o,source:s});let U=e.anyOf.filter(q=>!ei(q)&&q.type==="null").length>0;return wpe({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r||U,context:n,subtypes:e.anyOf.filter(q=>ei(q)||q.type!=="null"),encoding:o,namespace:a,groupName:f,source:s})}if(e.discriminator?.mapping!=null&&Object.keys(e.discriminator.mapping).length>0&&e.oneOf==null&&e.anyOf==null)return CJt({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,description:g,availability:A,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:a,groupName:f,encoding:o,source:s});if(e.allOf!=null||e.properties!=null){let R=[];for(let q of e.allOf??[])(ei(q)||Object.keys(q).length>0)&&R.push(q);if((e.properties==null||SJt(e))&&R.length===1&&R[0]!=null&&(e.additionalProperties==null||e.additionalProperties===!1)){let q=qa(R[0],t,r,n,i,s,a,c);return rG(q,g,a,f)}let U=R.filter(q=>{let z=BJt(q);return z||n.logger.debug(`Skipping non-object allOf element: ${JSON.stringify(q)}`),z});if((e.properties==null||SJt(e))&&U.length===1&&U[0]!=null&&(e.additionalProperties==null||e.additionalProperties===!1)){let q=qa(U[0],t,r,n,i,s,a,c);return rG(q,g,a,f)}return KJo({nameOverride:p,generatedName:m,title:h,breadcrumbs:i,properties:e.properties??{},description:g,required:e.required,wrapAsOptional:t,wrapAsNullable:r,allOf:U,context:n,propertiesToExclude:u,namespace:a,groupName:f,fullExamples:E,additionalProperties:e.additionalProperties,availability:A,encoding:o,source:s,minProperties:e.minProperties,maxProperties:e.maxProperties})}if(e.type==="object"&&fNc(e)&&tYo(e)&&SJt(e))return AKn({nameOverride:p,generatedName:m,title:h,description:g,availability:A,wrapAsOptional:t,wrapAsNullable:r,keySchema:{nameOverride:void 0,generatedName:`${m}Key`,title:void 0,description:void 0,availability:void 0,schema:Ii.string({default:BUe(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:sM({schema:e,logger:n.logger,fallback:l})}),namespace:a,groupName:f},valueSchema:Fr.unknown({nameOverride:void 0,generatedName:`${m}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:a,groupName:f}),namespace:a,groupName:f,encoding:o,example:e.example,minProperties:e.minProperties,maxProperties:e.maxProperties});e.type!=null&&n.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${i.join("->")}. Coercing to unknown.`);let C=e.example??e.default,_=Fr.unknown({nameOverride:p,generatedName:m,title:h,description:g,availability:A,namespace:a,groupName:f,example:C});return r&&(_=Fr.nullable({availability:A,namespace:a,groupName:f,description:g,generatedName:m,inline:void 0,nameOverride:p,title:h,value:_})),t&&(_=Fr.optional({availability:A,namespace:a,groupName:f,description:g,generatedName:m,inline:void 0,nameOverride:p,title:h,value:_})),_}catch(w){return n.logger.debug(`Error converting schema: ${w.message}
|
|
1493
1493
|
Location: ${i.join("-> ")}`),Fr.unknown({nameOverride:p,generatedName:m,title:h,description:g,availability:A,namespace:a,groupName:f,example:void 0})}}function pNc(e){if(e!=null){if(typeof e=="boolean")return e;if(typeof e=="string"){let t=e.toLowerCase();if(t==="true")return!0;if(t==="false")return!1}}}function ane(e){if(e.$ref.startsWith(y_e))return e.$ref.replace(y_e,"")}function vKn(e,t,r,n,i){let o=Nr(e,En.TYPE_NAME),s=py(t,n),a=e.description,u=AS(e),c=ane(e);if(c==null)throw new Error(`Invalid schema reference ${JSON.stringify(e)}`);return aa.reference({generatedName:s,nameOverride:o,title:void 0,schema:c,description:a??void 0,availability:u,namespace:i.getNamespace(c),groupName:void 0,source:r})}function fNc(e){return e.oneOf==null||e.oneOf.length===0}function tYo(e){return e.allOf==null||e.allOf.length===0}function SJt(e){return e.properties==null||Wd(e.properties)===0}function OJt(e){return Array.isArray(e)&&e.every(t=>typeof t=="string")}function rG(e,t,r,n){if(e.type==="reference")return Fr.reference({...e,description:t,availability:e.availability,namespace:r,groupName:n});if(e.type==="optional"){let i=rG(e.value,t,r,n);return Fr.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i,description:t,availability:e.availability,namespace:r,groupName:n,inline:void 0})}else if(e.type==="nullable"){let i=rG(e.value,t,r,n);return Fr.nullable({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i,description:t,availability:e.availability,namespace:r,groupName:n,inline:void 0})}else if(e.type==="primitive"&&t!=null&&e.description==null)return Fr.primitive({...e,description:t});return e}function BJt(e){return ei(e)||e.type==="object"||e.properties!=null?!0:e.allOf!=null?e.allOf.every(t=>BJt(t)):e.oneOf!=null?e.oneOf.every(t=>BJt(t)):e.anyOf!=null?e.anyOf.every(t=>BJt(t)):!1}function rYo({literal:e,wrapAsOptional:t,wrapAsNullable:r,namespace:n,groupName:i,description:o,availability:s,nameOverride:a,generatedName:u,title:c}){let l=Fr.literal({nameOverride:a,generatedName:u,title:c,value:e,namespace:n,groupName:i,description:o,availability:s});return r&&(l=Fr.nullable({nameOverride:a,generatedName:u,title:c,value:l,namespace:n,groupName:i,description:o,availability:s,inline:void 0})),t&&(l=Fr.optional({nameOverride:a,generatedName:u,title:c,value:l,namespace:n,groupName:i,description:o,availability:s,inline:void 0})),l}function Gw({primitive:e,wrapAsOptional:t,wrapAsNullable:r,namespace:n,groupName:i,description:o,availability:s,generatedName:a,nameOverride:u,title:c}){i=typeof i=="string"?[i]:i;let l=Fr.primitive({nameOverride:u,generatedName:a,title:c,schema:e,description:o,availability:s,namespace:n,groupName:i});return r&&(l=Fr.nullable({nameOverride:u,generatedName:a,title:c,value:l,namespace:n,groupName:i,description:o,availability:s,inline:void 0})),t&&(l=Fr.optional({nameOverride:u,generatedName:a,title:c,value:l,namespace:n,groupName:i,description:o,availability:s,inline:void 0})),l}function dNc({schemas:e}){let t=new Set;for(let r of e){if(ei(r))return;if(r.enum!=null&&OJt(r.enum))r.enum.forEach(n=>t.add(n));else return}return Array.from(t)}function nYo({schemas:e,context:t}){let r={};for(let n of e){let i=sYo({schema:n,context:t});for(let[o,s]of Object.entries(i)){let a=r[o];a!=null?a[s]=n:r[o]={[s]:n}}}for(let[n,i]of Object.entries(r))if(Object.keys(i).length===e.length)return{discriminant:n,schemas:i}}function sYo({schema:e,context:t}){let r=ei(e)?t.resolveSchemaReference(e):e;return mNc({schema:r,context:t})}function mNc({schema:e,context:t}){let r={};if(e.anyOf!=null){for(let n of e.anyOf){let i=sYo({schema:n,context:t});for(let[o,s]of Object.entries(i??{}))r[o]=s}return r}for(let[n,i]of Object.entries(e.properties??{})){let o=ei(i)?t.resolveSchemaReference(i):i;o.type==="string"&&o.enum!=null&&OJt(o.enum)&&hNc(o.enum).length===1&&o.enum[0]!=null&&(r[n]=o.enum[0]);let s=aYo(o,"const");o.type==="string"&&s!=null&&(r[n]=s),n==="type"&&o.example!=null&&(r[n]=o.example)}return r}function hNc(e){if(!e)return[];let t=new Set;return e.forEach(r=>{typeof r=="string"?t.add(r.toLowerCase()):t.add(r)}),Array.from(t)}function aYo(e,t){let r=e[t];if(r!=null)return r}function gNc({schema:e,logger:t}){let r=NJo({schema:e,logger:t});if(r!=null)return GJo(r)}var OUe=class{document;taskContext;logger;DUMMY;options;namespace;static MESSAGE_REFERENCE_PREFIX="#/components/messages/";constructor({document:t,taskContext:r,options:n,namespace:i}){this.document=t,this.taskContext=r,this.logger=r.logger,this.DUMMY=this,this.options=n,this.namespace=i}resolveGroupName(t){return this.namespace!=null?[{type:"namespace",name:this.namespace},...t]:t}resolveTags(t,r){if(this.namespace==null&&t==null&&r!=null)return[r];let n=[];if(this.namespace!=null){let i={type:"namespace",name:this.namespace};n.push(i)}return n.concat(t??[])}resolveSchemaReference(t){if(!t.$ref.startsWith(y_e))throw new Error(`Failed to resolve schema reference: ${t.$ref}`);let n=t.$ref.substring(y_e.length).split("/"),i=this.document.components;if(i==null||i.schemas==null)throw new Error("Document does not have components.schemas.");let[o,s,a]=n;if(o==null||o==="")throw new Error(`${t.$ref} cannot be resolved. No schema key provided.`);let u=i.schemas[o];if(u==null)throw new Error(`Schema "${o}" is undefined in document.components.schemas.`);if(ei(u)&&(u=this.resolveSchemaReference(u)),s==="properties"&&a!=null){let c=u.properties?.[a];if(c==null)throw new Error(`Property "${a}" not found on "${o}". Full ref: ${t.$ref}`);ei(c)?u=this.resolveSchemaReference(c):u=c}return u}referenceExists(t){let r=t.substring(2).split("/").map(i=>i.replace(/~1/g,"/")),n=this.document;for(let i of r){if(typeof n!="object"||n==null)return!1;n=n[i]}return!0}markSchemaAsReferencedByNonRequest(t){}markSchemaAsReferencedByRequest(t){}markReferencedByDiscriminatedUnion(t,r,n){}markSchemaWithDiscriminantValue(t,r,n){}getNamespace(t){return this.namespace}};var TJt=class extends OUe{getExampleMessageReference(t){return`#/components/messages/${t.messageId}`}resolveMessageReference(t){let r="#/components/messages/",n=this.document.components;if(n==null||n.messages==null||!t.$ref.startsWith(r))throw new Error(`Failed to resolve message reference: ${t.$ref} in v2 components`);let i=t.$ref.substring(r.length),o=n.messages[i];if(o==null)throw new Error(`${t.$ref} is undefined`);return o}};Rt();function PUe(e,t){let r={};if(e!=null)return{rootSchemas:r,namespacedSchemas:{[e]:t}};let n={};for(let[i,o]of Object.entries(t))switch(o.type){case"object":case"array":case"map":case"optional":case"enum":case"literal":case"reference":case"nullable":case"primitive":{if(o.namespace==null){r[i]=o;continue}let s=o.namespace;n[s]??={},n[s][i]=o;continue}case"oneOf":case"unknown":r[i]=o;continue;default:xe(o)}return{rootSchemas:r,namespacedSchemas:n}}Rt();var TUe=_e(require("fs"),1),b_e=_e(require("path"),1);Rt();function Cpe(e){if(typeof e=="string")return Ha.primitive(as.string(e));if(typeof e=="number")return Number.isInteger(e)?Ha.primitive(as.int(e)):Ha.primitive(as.double(e));if(typeof e=="boolean")return Ha.primitive(as.boolean(e));if(Array.isArray(e)){let t=e.map(r=>Cpe(r));return t.length===0?void 0:Ha.array(t.filter(r=>r!=null))}else if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string")){let t=[];for(let[r,n]of Object.entries(e)){let i=Cpe(n);i!=null&&t.push({key:as.string(r),value:i})}return Ha.map(t)}}function eht(e){if(e!=null&&typeof e=="object"&&Object.keys(e).every(t=>typeof t=="string"))return e}function uYo(e){if(e!=null&&Array.isArray(e))return e}var xpe=class e{schemas;nonRequestReferencedSchemas;context;constructor(t,r,n){this.schemas=t,this.nonRequestReferencedSchemas=r,this.context=n}buildExample({schema:t,exampleId:r,example:n,options:i,skipReadonly:o}){return this.buildExampleHelper({schema:t,visitedSchemaIds:new Set,exampleId:r,example:n,options:{...i,maxCheckerDepth:i.maxCheckerDepth??5},depth:0,skipReadonly:o??!1})}buildExampleHelper({exampleId:t,example:r,schema:n,depth:i,visitedSchemaIds:o,options:s,skipReadonly:a}){switch(n.type){case"enum":if(typeof r=="string"&&cYo({schema:n,value:r}))return Ha.enum(r);if(r!=null){let u=n.values.map(l=>l.value),c=e.truncateExample(r);this.context.logger.warn(`Example value ${c} is not a valid enum value${s.name!=null?` for '${s.name}'`:""}. Allowed values: [${u.join(", ")}]. Using fallback value instead.`)}return n.values[0]!=null?Ha.enum(n.values[0]?.value):void 0;case"literal":return Ha.literal(n.value);case"nullable":{if(r===null)return Ha.null({});if(r==null&&!this.hasExample(n.value,0,o,s)&&this.exceedsMaxDepth(i,s))return Ha.null({});let u=this.buildExampleHelper({schema:n.value,visitedSchemaIds:o,exampleId:t,example:r,depth:i,options:s,skipReadonly:a});return u??Ha.null({})}case"optional":{if(r==null&&!this.hasExample(n.value,0,o,s)&&(s.ignoreOptionals||this.exceedsMaxDepth(i,s))||Object.is(r,null))return;let u=this.buildExampleHelper({schema:n.value,visitedSchemaIds:o,exampleId:t,example:r,depth:i,options:s,skipReadonly:a});return u!=null&&u.type==="array"&&u.value.length===0||u!=null&&u.type==="map"&&u.value.length===0||u!=null&&u.type==="object"&&Object.keys(u.properties).length===0?void 0:u}case"primitive":{let u=this.buildExampleFromPrimitive({schema:n.schema,example:r,options:s});return Ha.primitive(u)}case"reference":{let u=this.schemas[n.schema];if(u!=null&&!o.has(n.schema)){o.add(n.schema);let c=u?.type==="object"&&!this.nonRequestReferencedSchemas.has(n.schema),l=this.buildExampleHelper({example:r,schema:u,exampleId:t,visitedSchemaIds:o,depth:i,options:s,skipReadonly:c||this.context.options.respectReadonlySchemas?a:!1});return o.delete(n.schema),l}return}case"oneOf":switch(n.value.type){case"discriminated":{let u={},c={},l={},p=eht(r),d=p?.[n.value.discriminantProperty],f=n.value.schemas[d],m=[],h=this.getDiscriminatedUnionVariantSchema(n.value,p);h!=null&&m.push(h),m.push(...Object.entries(n.value.schemas));for(let g of m)if(d!=null&&f!=null&&f.type==="object"){c=this.getAllProperties(f),l=this.getAllRequiredProperties(f),u[n.value.discriminantProperty]=Ha.primitive(as.string(d));break}else{let A=this.buildExampleHelper({exampleId:t,schema:g[1],example:void 0,visitedSchemaIds:o,depth:i,options:s,skipReadonly:a});if(A!=null){this.mergeExampleWith(A,u),u[n.value.discriminantProperty]=Ha.primitive(as.string(g[0]));break}}for(let g of n.value.commonProperties){c[g.key]={schema:g.schema,readonly:!1};let A=this.getResolvedSchema(g.schema);A.type!=="optional"&&A.type!=="nullable"&&(l[g.key]=g.schema)}for(let[g,A]of Object.entries(c)){let E=g in l;if(E&&p?.[g]!=null){let v=this.buildExampleHelper({schema:A.schema,exampleId:t,example:p[g],visitedSchemaIds:o,depth:i+1,options:s,skipReadonly:a});if(v!=null)u[g]=v;else return}else{let v=this.buildExampleHelper({exampleId:t,schema:A.schema,example:p?.[g],visitedSchemaIds:o,depth:i+1,options:s,skipReadonly:a});if(v!=null)u[g]=v;else if(E)return}}return Ha.oneOf(spe.discriminated(u))}case"undiscriminated":{let u=this.getUnDiscriminatedUnionVariantSchema(n.value,r);if(u!=null)return this.buildExampleHelper({exampleId:t,example:r,schema:u,visitedSchemaIds:o,depth:i,options:s,skipReadonly:a});break}}return;case"unknown":if(r!=null){let u=Cpe(r);if(u!=null)return Ha.unknown(u)}return s.ignoreOptionals||this.exceedsMaxDepth(i,s)?void 0:s.isParameter?Ha.primitive(as.string(s.name??"string")):Ha.map([{key:as.string("key"),value:Ha.primitive(as.string("value"))}]);case"array":{let u=uYo(r),c=[];if(u!=null&&u.length>0)for(let l of u){let p=this.buildExampleHelper({exampleId:t,example:l,schema:n.value,depth:i+1,visitedSchemaIds:o,options:s,skipReadonly:a});p!=null&&c.push(p)}else if(n.example!=null&&n.example.length>0)for(let l of n.example){let p=this.buildExampleHelper({exampleId:t,example:l,schema:n.value,depth:i+1,visitedSchemaIds:o,options:s,skipReadonly:a});p!=null&&c.push(p)}else{let l=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,depth:i+1,visitedSchemaIds:o,options:s,skipReadonly:a});l!=null&&c.push(l)}return Ha.array(c)}case"map":{let u=eht(r??n.example);if(u!=null&&Object.entries(u).length>0){let p=[];for(let[d,f]of Object.entries(u)){let m=this.buildExampleFromPrimitive({schema:n.key.schema,example:d,options:s}),h=this.buildExampleHelper({exampleId:t,example:f,schema:n.value,visitedSchemaIds:o,depth:i+1,options:s,skipReadonly:a});h!=null&&p.push({key:m,value:h})}return Ha.map(p)}if(n.key.schema.type==="string"&&n.value.type==="unknown")return Ha.map([{key:as.string("key"),value:Ha.unknown(Ha.primitive(as.string("value")))}]);let c=this.buildExampleFromPrimitive({schema:n.key.schema,example:void 0,options:{...s,name:"key"}}),l=this.buildExampleHelper({exampleId:t,example:void 0,schema:n.value,visitedSchemaIds:o,depth:i+1,options:{...s,name:"value"},skipReadonly:a});return l!=null&&l.type!=="null"?Ha.map([{key:c,value:l}]):Ha.map([])}case"object":{let u={},c=n.fullExamples?.find(f=>f.name===t)??n.fullExamples?.find(f=>f.name==null)??n.fullExamples?.[0],l=eht(r)??(c!=null?eht(c.value):{})??{},p=this.getAllProperties(n),d=this.getAllRequiredProperties(n);for(let[f,m]of Object.entries(p)){if(a&&m.readonly||m.schema._visit({optional:I=>typeof I.availability=="string"&&I.availability==="Deprecated",primitive:()=>!1,object:()=>!1,array:()=>!1,map:()=>!1,enum:()=>!1,reference:()=>!1,literal:()=>!1,oneOf:()=>!1,nullable:()=>!1,unknown:()=>!1,_other:()=>!1}))continue;let h=f in d,g=Object.keys(l).includes(f),A=l[f],E=this.getSchemaExample(m.schema),v=g?A:E,b=this.buildExampleHelper({schema:m.schema,exampleId:t,example:v,visitedSchemaIds:o,depth:i+1,options:{...s,name:f},skipReadonly:a});if(h&&b!=null)u[f]=b;else{if(h)return;(g&&b!=null||!s.ignoreOptionals&&b!=null)&&(u[f]=b)}}if(n.additionalProperties){for(let[f,m]of Object.entries(l))if(!(f in u)){let h=this.buildExampleHelper({schema:Fr.unknown({example:m,title:void 0,availability:void 0,description:void 0,generatedName:"",nameOverride:void 0,namespace:void 0,groupName:void 0}),exampleId:t,example:m,visitedSchemaIds:o,depth:i+1,options:{...s,name:f},skipReadonly:a});h!=null&&(u[f]=h)}}return Ha.object({properties:u})}default:xe(n)}}mergeExampleWith(t,r){t._visit({array:ft,enum:ft,literal:ft,map:n=>{for(let i of n){let o=i.key;o.type==="string"&&(r[o.value]=i.value)}},object:n=>{for(let[i,o]of Object.entries(n.properties))r[i]=o},oneOf:n=>{if(n.type==="discriminated")for(let[i,o]of Object.entries(n.value))r[i]=o;else this.mergeExampleWith(n.value,r)},primitive:ft,unknown:ft,null:ft,_other:ft})}getObjectSchema(t){if(t.type==="object")return t;if(t.type==="reference"){let r=this.schemas[t.schema];if(r!=null)return this.getObjectSchema(r)}}getDiscriminatedUnionVariantSchema(t,r){let n=r?.[t.discriminantProperty];if(n==null||typeof n!="string")return Object.entries(t.schemas)[0];let i=t.schemas[n];return i==null?Object.entries(t.schemas)[0]:[n,i]}getUnDiscriminatedUnionVariantSchema(t,r){if(r==null){let o=t.schemas.find(a=>this.hasExample(a,0,new Set,{ignoreOptionals:!1,isParameter:!1}));if(o!=null)return o;let s=t.schemas.find(a=>this.hasInherentExample(a));return s??t.schemas[0]}return t.schemas.map(o=>({schema:o,heuristic:this.calcExampleHeuristic(o,r)})).sort((o,s)=>s.heuristic-o.heuristic)[0]?.schema}calcExampleHeuristic(t,r){switch(t.type){case"literal":return t.value.value===r?5:0;case"enum":return cYo({schema:t,value:r})?5:0;case"object":{if(!ba(r))return 0;let n=this.getAllProperties(t),i=0;for(let[o,s]of Object.entries(n))r[o]!=null?(i++,i+=this.calcExampleHeuristic(s.schema,r[o])):i--;return i}case"array":{if(!Array.isArray(r))return 0;let n=0;for(let i of r)n+=this.calcExampleHeuristic(t.value,i);return n}case"map":{if(!ba(r))return 0;let n=0;for(let[,i]of Object.entries(r))n+=this.calcExampleHeuristic(t.value,i);return n}case"nullable":case"optional":return this.calcExampleHeuristic(t.value,r);case"reference":{let n=this.getResolvedSchema(t);return n==null?0:this.calcExampleHeuristic(n,r)}case"oneOf":return Object.values(t.value.schemas).map(i=>this.calcExampleHeuristic(i,r)).sort((i,o)=>o-i)[0]??0;case"primitive":return r==null?0:t.schema._visit({int:()=>typeof r=="number",int64:()=>typeof r=="number",uint:()=>typeof r=="number",uint64:()=>typeof r=="number",float:()=>typeof r=="number",double:()=>typeof r=="number",string:()=>typeof r=="string",datetime:()=>typeof r=="string",datetimeRfc2822:()=>typeof r=="string",date:()=>typeof r=="string",base64:()=>typeof r=="string",boolean:()=>typeof r=="boolean",_other:()=>!0})?1:-1;default:return 0}}hasExample(t,r,n=new Set,i){if(this.exceedsMaxCheckerDepth(r,i))return!1;switch(t.type){case"array":return this.hasExample(t.value,r+1,n,i);case"enum":return t.example!=null;case"literal":return!1;case"map":return t.example!=null||t.key.schema.example!=null&&this.hasExample(t.value,r+1,n,i);case"object":{if(t.fullExamples!=null&&t.fullExamples.length>0)return!0;for(let s of t.properties)if(this.hasExample(s.schema,r+1,n,i))return!0;return!1}case"primitive":return t.schema.example!=null;case"reference":{let o=this.schemas[t.schema];if(o!=null&&!n.has(t.schema)){n.add(t.schema);let s=this.hasExample(o,r,n,i);return n.delete(t.schema),s}return!1}case"unknown":return t.example!=null;case"nullable":case"optional":return this.hasExample(t.value,r,n,i);case"oneOf":return Object.values(t.value.schemas).some(o=>this.hasExample(o,r,n,i));default:return!1}}hasInherentExample(t){switch(t.type){case"literal":return!0;case"enum":return t.values.length>0;case"optional":case"nullable":return this.hasInherentExample(t.value);case"reference":{let r=this.schemas[t.schema];return r!=null?this.hasInherentExample(r):!1}default:return!1}}exceedsMaxCheckerDepth(t,r){return t>(r.maxCheckerDepth??0)}exceedsMaxDepth(t,r){return t>(r.maxDepth??0)}getAllProperties(t){let r={};for(let n of t.properties)r[n.key]={schema:n.schema,readonly:n.readonly??!1};for(let n of t.allOf){let i=this.schemas[n.schema];if(i==null)continue;let o=this.getResolvedSchema(i);o.type==="object"&&(r={...this.getAllProperties(o),...r})}return r}getAllRequiredProperties(t){let r={};for(let n of t.properties){let i=this.getResolvedSchema(n.schema);i.type!=="optional"&&i.type!=="nullable"&&(r[n.key]=n.schema)}for(let n of t.allOf){let i=this.schemas[n.schema];if(i==null)continue;let o=this.getResolvedSchema(i);o.type==="object"&&(r={...this.getAllRequiredProperties(o),...r})}return r}getResolvedSchema(t){for(;t.type==="reference";){let r=this.schemas[t.schema];if(r==null)throw new Error(`Unexpected error: Failed to resolve schema reference: ${t.schema}`);t=r}return t}getSchemaExample(t){return t._visit({primitive:r=>r.schema.example,object:r=>r.fullExamples?.[0]?.value,array:r=>r.example,map:r=>r.example,optional:r=>this.getSchemaExample(r.value),enum:r=>r.example,reference:r=>{let n=this.schemas[r.schema];return n!=null?this.getSchemaExample(n):void 0},literal:()=>{},oneOf:()=>{},nullable:r=>this.getSchemaExample(r.value),unknown:r=>r.example,_other:()=>{}})}buildExampleFromPrimitive({example:t,schema:r,options:n}){switch(r.type){case"string":return t!=null&&typeof t=="string"?as.string(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"string",schemaType:r.type,options:n}),as.string(r.example??n.name??Ai.STRING));case"base64":return t!=null&&typeof t=="string"?as.base64(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"string (base64)",schemaType:r.type,options:n}),as.base64(r.example??Ai.BASE64));case"boolean":return t!=null&&typeof t=="boolean"?as.boolean(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"boolean",schemaType:r.type,options:n}),as.boolean(r.example??Ai.BOOLEAN));case"date":return t!=null&&typeof t=="string"?as.date(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"string (date)",schemaType:r.type,options:n}),as.date(r.example??Ai.DATE));case"datetime":return t!=null&&typeof t=="string"?as.datetime(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"string (datetime)",schemaType:r.type,options:n}),as.datetime(r.example??Ai.DATE_TIME));case"datetimeRfc2822":return t!=null&&typeof t=="string"?as.datetimeRfc2822(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"string (datetime RFC 2822)",schemaType:r.type,options:n}),as.datetimeRfc2822(r.example??Ai.DATE_TIME_RFC_2822));case"double":return t!=null&&typeof t=="number"?as.double(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"number (double)",schemaType:r.type,options:n}),as.double(r.example??Ai.DOUBLE));case"float":return t!=null&&typeof t=="number"?as.float(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"number (float)",schemaType:r.type,options:n}),as.float(r.example??Ai.FLOAT));case"int":return t!=null&&typeof t=="number"?as.int(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"number (int)",schemaType:r.type,options:n}),as.int(r.example??Ai.INT));case"int64":return t!=null&&typeof t=="number"?as.int64(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"number (int64)",schemaType:r.type,options:n}),as.int64(r.example??Ai.INT64));case"uint":return t!=null&&typeof t=="number"?as.uint(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"number (uint)",schemaType:r.type,options:n}),as.uint(r.example??Ai.UINT));case"uint64":return t!=null&&typeof t=="number"?as.uint64(t):(t!=null&&this.warnTypeMismatch({example:t,expected:"number (uint64)",schemaType:r.type,options:n}),as.uint64(r.example??Ai.UINT64));default:xe(r)}}warnTypeMismatch({example:t,expected:r,schemaType:n,options:i}){let o=i.name!=null?` for '${i.name}'`:"",s=typeof t,a=e.truncateExample(t);this.context.logger.warn(`Invalid example${o}: expected ${r} but got ${s} (${a}). The provided example does not match the '${n}' schema and will be replaced with a generated value.`)}static truncateExample(t,r=100){let n=JSON.stringify(t);return n.length<=r?n:n.slice(0,r)+"..."}};function cYo({schema:e,value:t}){return e.values.map(r=>r.value).includes(t)}Rt();function r8(e){switch(e.type){case"object":return Fr.object({allOf:e.allOf,properties:e.properties.map(t=>yNc(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,namespace:e.namespace,groupName:e.groupName,fullExamples:void 0,additionalProperties:e.additionalProperties,availability:e.availability,encoding:e.encoding,source:e.source,inline:void 0,minProperties:e.minProperties,maxProperties:e.maxProperties});case"array":return Fr.array({description:e.description,availability:e.availability,value:r8(e.value),generatedName:e.generatedName,title:e.title,namespace:e.namespace,nameOverride:e.nameOverride,groupName:e.groupName,example:void 0,inline:void 0,minItems:e.minItems,maxItems:e.maxItems});case"enum":return Fr.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,values:e.values,default:e.default,namespace:e.namespace,groupName:e.groupName,example:void 0,source:e.source,inline:void 0});case"literal":return Fr.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,namespace:e.namespace,groupName:e.groupName});case"nullable":return Fr.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:r8(e.value),namespace:e.namespace,groupName:e.groupName,inline:void 0});case"optional":return Fr.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:r8(e.value),namespace:e.namespace,groupName:e.groupName,inline:void 0});case"primitive":return Fr.primitive({description:e.description,availability:e.availability,schema:lYo(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return Fr.map({description:e.description,availability:e.availability,key:Fr.primitive({description:e.key.description,availability:e.key.availability,schema:lYo(e.key.schema),generatedName:e.key.generatedName,nameOverride:e.key.nameOverride,title:e.key.title,namespace:e.namespace,groupName:e.groupName}),value:r8(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,example:void 0,inline:void 0,minProperties:e.minProperties,maxProperties:e.maxProperties});case"reference":return Fr.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schema:e.schema,namespace:e.namespace,groupName:e.groupName,source:e.source});case"oneOf":return Fr.oneOf(ANc(e.value));case"unknown":return Fr.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,example:void 0,namespace:e.namespace,groupName:e.groupName,description:e.description,availability:e.availability});default:xe(e)}}function ANc(e){switch(e.type){case"discriminated":return Z2.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:r8(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,discriminantPropertyNameOverride:e.discriminantPropertyNameOverride,discriminatorContext:e.discriminatorContext,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,r8(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});case"undiscriminated":return Z2.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schemas:e.schemas.map(t=>r8(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:void 0});default:xe(e)}}function lYo(e){switch(e.type){case"string":return Ii.string({default:e.default,pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:void 0});case"base64":return Ii.base64({example:void 0});case"boolean":return Ii.boolean({default:e.default,example:void 0});case"date":return Ii.date({example:void 0});case"datetime":return Ii.datetime({example:void 0});case"datetimeRfc2822":return Ii.datetimeRfc2822({example:void 0});case"double":return Ii.double({default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:e.exclusiveMinimum,exclusiveMaximum:e.exclusiveMaximum,multipleOf:e.multipleOf,example:void 0});case"float":return Ii.float({example:void 0});case"int":return Ii.int({default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:e.exclusiveMinimum,exclusiveMaximum:e.exclusiveMaximum,multipleOf:e.multipleOf,example:void 0});case"int64":return Ii.int64({default:e.default,example:void 0});case"uint":return Ii.uint({default:void 0,example:void 0});case"uint64":return Ii.uint64({default:void 0,example:void 0});default:xe(e)}}function yNc(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:r8(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function DJt(e){return e.type!=="optional"&&e.type!=="nullable"}function wKn(e){return e==="POST"||e==="PUT"||e==="PATCH"}function tht(e){if(e.type==="full")return e.request==null&&e.response==null&&e.queryParameters==null&&e.pathParameters==null&&e.headers==null;{let t=e.value;return t.request==null&&t.response==null&&t["query-parameters"]==null&&t["path-parameters"]==null&&t.headers==null}}var RJt=class{schemas;context;globalHeaders;exampleTypeFactory;logger;missingExamples=[];constructor(t,r,n){this.schemas=t,this.context=r,this.globalHeaders=n,this.schemas=t,this.exampleTypeFactory=new xpe(t,r.nonRequestReferencedSchemas,r),this.logger=r.logger}addMissingExampleRecord(t,r,n,i,o={}){this.missingExamples.push({endpoint:t.path,method:t.method.toUpperCase(),type:r,schemaType:n,reason:i,operationSummary:t.summary,operationDescription:t.description,schemaDescription:o.schemaDescription,autoGeneratedExample:o.autoGeneratedExample})}writeMissingExamplesLog(){if(this.missingExamples.length===0)return;let t;if(this.context.source.type==="openapi"){let o=this.context.source.file,s=b_e.dirname(o),a=s;for(;a!==b_e.dirname(a);){let u=b_e.join(a,"fern");if(TUe.existsSync(u)&&TUe.statSync(u).isDirectory()){t=u;break}a=b_e.dirname(a)}t||(t=s)}else t=process.cwd();let r=t??process.cwd(),n=b_e.join(r,"schemas_missing_examples.txt"),i=["# Schemas Missing Examples Report",`# Generated on: ${new Date().toISOString()}`,`# Total missing examples: ${this.missingExamples.length}`,"",...this.missingExamples.flatMap(o=>{let s=[];if(s.push(`${o.method} ${o.endpoint} - ${o.type.toUpperCase()} (${o.schemaType}): ${o.reason}`),o.operationSummary&&s.push(` Operation: ${o.operationSummary}`),o.operationDescription&&o.operationDescription!==o.operationSummary&&s.push(` Description: ${o.operationDescription}`),o.schemaDescription&&s.push(` ${o.type==="request"?"Request":"Response"} Schema: ${o.schemaDescription}`),o.autoGeneratedExample){s.push(" Auto-generated example:");let u=JSON.stringify(o.autoGeneratedExample,null,4).split(`
|
|
1494
1494
|
`).map(c=>` ${c}`).join(`
|
|
1495
1495
|
`);s.push(u)}return s.push(""),s}),""].join(`
|
|
@@ -1622,7 +1622,7 @@ Fern requires the system keyring to securely store access tokens.
|
|
|
1622
1622
|
If running in a headless environment, use FERN_TOKEN instead:
|
|
1623
1623
|
export FERN_TOKEN=<your-token>`}}var W4=class extends Error{issues;constructor(t){super(t.map(r=>r.toString()).join(`
|
|
1624
1624
|
`)),this.issues=t}};var cPe=class extends Error{violations;constructor(t){super(t.map(r=>`${r.relativeFilepath}: ${r.message}`).join(`
|
|
1625
|
-
`)),this.violations=t}};async function uwt({organization:e,token:t}){let r=FA({token:t.value}),n=await r.organization.isMember(Oc.OrganizationId(e));if(n.ok&&n.body)return{type:"member"};let i=await r.organization.get(Oc.OrganizationId(e));if(i.ok)return{type:"no-access"};let o={type:"unknown-error"};return i.error._visit({unauthorizedError:()=>{o={type:"no-access"}},_other:()=>{o={type:"not-found"}}}),o}function lPe(e){if(e.length===0)return"Organization name cannot be empty";if(!/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/.test(e))return"Organization name must contain only lowercase letters, numbers, and hyphens, and cannot start or end with a hyphen"}async function K_({organization:e,token:t,context:r}){let n=FA({token:t.value});if((await n.organization.get(Oc.OrganizationId(e))).ok)return!1;let o=lPe(e);o!=null&&r.failAndThrow(o);let s=await n.organization.create({organizationId:Oc.OrganizationId(e)});return s.ok||r.failAndThrow(`Failed to create organization: ${e}`,s.error),!0}Vt();var bha=require("os"),KVp="token",JVp=".fern";function Goe(){return We(Ut.of((0,bha.homedir)()),Se.of(JVp),Se.of(KVp))}Vt();var Eha=require("fs/promises");var YVp="FERN_TOKEN";async function pPe(){return await VH()??await Dhr()}async function VH(){let e=process.env[YVp];if(!(e==null||e.trim().length===0))return{type:"organization",value:e}}async function Dhr(){let e=Goe();if(!await Xt(e))return;let n=(await(0,Eha.readFile)(e)).toString().trim();if(n.length!==0)return{type:"user",value:n}}var vha=require("fs/promises");async function Wwi(){let e=Goe();try{await(0,vha.unlink)(e)}catch(t){if(t.code!=="ENOENT")throw t}}var Rhr=require("fs/promises"),Iha=_e(require("path"),1);async function $wi(e){let t=Goe();await(0,Rhr.mkdir)(Iha.default.dirname(t),{recursive:!0}),await(0,Rhr.writeFile)(t,e)}async function Hwi({token:e,context:t}){let r=await FA({token:e.value}).user.getMyself();return r.ok?r.body:t.failAndThrow("Failed to fetch user info")}var sAa=_e(Khr(),1);function ACi(e){let t=sAa.default.decode(e.value,{complete:!0});if(t==null)return;let r=t.payload;return typeof r=="string"?void 0:r.sub}Rt();async function aAa(e){return(await FA({token:e.value}).organization.getMyOrganizationFromScopedToken()).ok}var jwt=_e(Khr(),1),X0a=_e(Y0a(),1),Z0a="fern-prod.us.auth0.com",VZp=Z0a.startsWith("localhost")?"http":"https",eEa=(0,X0a.default)({jwksUri:`${VZp}://${Z0a}/.well-known/jwks.json`});async function c1i(e){let t=jwt.default.decode(e.value,{complete:!0});if(t==null)return!1;try{let r=await eEa.getSigningKey(t.header.kid);return jwt.default.verify(e.value,r.getPublicKey(),{algorithms:["RS256"]}),!0}catch{return!1}}async function $me(e){let t=jwt.default.decode(e,{complete:!0});if(t!=null)try{let r=await eEa.getSigningKey(t.header.kid),n=jwt.default.verify(e,r.getPublicKey(),{algorithms:["RS256"]});return typeof n=="string"?void 0:n}catch{return}}async function Mwt(){let e=await pPe();if(e==null)return!1;switch(e.type){case"organization":return aAa(e);case"user":return c1i(e);default:xe(e)}}var oE={};Y(oE,{AiChatConfigSchema:()=>wef,AiConfigSchema:()=>dAr,AiExamplesConfigSchema:()=>Cef,AiProviderSchema:()=>fAr,AnalyticsConfigSchema:()=>Eef,AnnouncementConfigSchema:()=>xef,ApiDefinitionSchema:()=>Fqe,ApiReferenceConfigurationSchema:()=>XZp,ApiSpecSchema:()=>bAr,ApisSchema:()=>_Ar,AsyncApiSettingsSchema:()=>Vwt,AsyncApiSpecSchema:()=>qwt,AuthSchemesSchema:()=>EAr,AuthorSchema:()=>f1i,AvailabilitySchema:()=>Qef,BackgroundImageConfigurationSchema:()=>pef,BaseApiSettingsSchema:()=>CPe,ChangelogConfigurationSchema:()=>eef,CliSchema:()=>SAr,ColorsConfigurationSchema:()=>fef,ConjureSettingsSchema:()=>mAr,ConjureSpecSchema:()=>Gwt,CratesPublishSchema:()=>BAr,CssConfigSchema:()=>Tef,DefaultIntegerFormatSchema:()=>$wt,DocsInstanceSchema:()=>qZp,DocsSchema:()=>OAr,DocsSettingsConfigSchema:()=>hef,EditThisPageConfigSchema:()=>GZp,EnvironmentSchema:()=>wAr,ExampleGenerationSchema:()=>Rqe,ExampleStyleSchema:()=>p1i,ExperimentalConfigSchema:()=>Ref,FeatureFlagConfigurationSchema:()=>kef,FeatureFlagSchema:()=>Fef,FernRcAccountSchema:()=>nCt,FernRcAuthSchema:()=>iCt,FernRcCacheSchema:()=>oCt,FernRcSchema:()=>Hme,FernSettingsSchema:()=>hAr,FernSpecSchema:()=>Wwt,FernYmlSchema:()=>rCt,FolderConfigurationSchema:()=>ref,FooterLinksConfigSchema:()=>yef,FormParameterEncodingSchema:()=>Hwt,GitHubOutputModeSchema:()=>oEa,GitHubRepositoryOutputModeSchema:()=>DAr,GitHubRepositoryOutputSchema:()=>FAr,GitOutputSchema:()=>NAr,GitSelfHostedOutputModeSchema:()=>kAr,GitSelfHostedOutputSchema:()=>QAr,HeaderConfigSchema:()=>CAr,HeaderSchema:()=>xAr,IntegrationsConfigSchema:()=>_ef,IntercomConfigSchema:()=>Sef,JsConfigSchema:()=>Def,LayoutConfigSchema:()=>mef,LibraryConfigurationSchema:()=>Bef,LibraryInputConfigurationSchema:()=>Oef,LibraryOutputConfigurationSchema:()=>Pef,LibraryReferenceConfigurationSchema:()=>tef,LicenseSchema:()=>Nqe,LinkConfigurationSchema:()=>ZZp,LogoConfigurationSchema:()=>lef,MavenPublishSchema:()=>LAr,MavenSignatureSchema:()=>d1i,MessageNamingVersionSchema:()=>zwt,MetadataConfigSchema:()=>vef,MetadataSchema:()=>TAr,MultipleBaseUrlsEnvironmentSchema:()=>vAr,NavbarLinkSchema:()=>Aef,NavigationConfigSchema:()=>WZp,NavigationItem:()=>KZp,NpmPublishSchema:()=>UAr,NugetPublishSchema:()=>zAr,OpenApiExampleGenerationSchema:()=>Kwt,OpenApiFilterSchema:()=>Jwt,OpenApiSettingsSchema:()=>Xwt,OpenApiSpecSchema:()=>Zwt,OpenRpcSettingsSchema:()=>gAr,OpenRpcSpecSchema:()=>eCt,OutputObjectSchema:()=>jAr,OutputSchema:()=>MAr,PageActionsConfigSchema:()=>bef,PageConfigurationSchema:()=>JZp,PathParameterOrderSchema:()=>Lwt,PlaygroundSettingsSchema:()=>cef,ProductConfigSchema:()=>aef,ProtobufDefinitionSchema:()=>yAr,ProtobufSettingsSchema:()=>AAr,ProtobufSpecSchema:()=>tCt,PublishSchema:()=>GAr,PypiMetadataSchema:()=>m1i,PypiPublishSchema:()=>VAr,ReadmeCustomSectionSchema:()=>l1i,ReadmeEndpointSchema:()=>PAr,ReadmeSchema:()=>Qqe,RedirectConfigSchema:()=>Ief,RemoveDiscriminantsFromSchemasSchema:()=>Uwt,ResolveAliasesSchema:()=>Ywt,ReviewersSchema:()=>RAr,RoleSchema:()=>Nef,RubygemsPublishSchema:()=>qAr,SdkTargetLanguageSchema:()=>kqe,SdkTargetSchema:()=>WAr,SdksSchema:()=>$Ar,SectionConfigurationSchema:()=>YZp,SingleBaseUrlEnvironmentSchema:()=>IAr,SnippetsConfigurationSchema:()=>uef,TabConfigSchema:()=>oef,TabVariantSchema:()=>ief,TabbedNavigationConfigSchema:()=>$Zp,TabbedNavigationItemSchema:()=>nef,ThemeConfigSchema:()=>gef,TypographyConfigSchema:()=>def,UntabbedNavigationConfigSchema:()=>HZp,VersionConfigSchema:()=>sef,createEmptyFernRcSchema:()=>Kme,isGitOutputGitHubRepository:()=>nEa,isGitOutputSelfHosted:()=>rEa,isWellKnownLicense:()=>tEa,resolveOutputObjectSchema:()=>sEa});var fAr=ne.enum(["openai","anthropic","bedrock"]);var dAr=ne.object({provider:fAr,model:ne.string()});var Lwt=ne.enum(["urlOrder","specOrder"]);var Uwt=ne.enum(["always","never"]);var CPe=ne.object({respectNullableSchemas:ne.boolean().optional(),wrapReferencesToNullableInOptional:ne.boolean().optional(),coerceOptionalSchemasToNullable:ne.boolean().optional(),titleAsSchemaName:ne.boolean().optional(),coerceEnumsToLiterals:ne.boolean().optional(),optionalAdditionalProperties:ne.boolean().optional(),idiomaticRequestNames:ne.boolean().optional(),groupEnvironmentsByHost:ne.boolean().optional(),removeDiscriminantsFromSchemas:Uwt.optional(),pathParameterOrder:Lwt.optional(),coerceConstsTo:ne.enum(["literals","enums"]).optional()});var zwt=ne.enum(["v1","v2"]);var Vwt=CPe.extend({messageNaming:zwt.optional()});var qwt=ne.object({asyncapi:ne.string(),origin:ne.string().optional(),overrides:ne.union([ne.string(),ne.array(ne.string()).nonempty()]).optional(),namespace:ne.string().optional(),settings:Vwt.optional()});var mAr=ne.object({}),Gwt=ne.object({conjure:ne.string(),settings:mAr.optional()});var hAr=ne.object({}),Wwt=ne.object({fern:ne.string(),settings:hAr.optional()});var $wt=ne.enum(["int32","int64","uint32","uint64"]);var Hwt=ne.enum(["form","json"]);var Rqe=ne.object({maxDepth:ne.number().optional()});var Kwt=ne.object({request:Rqe.optional(),response:Rqe.optional()});var Jwt=ne.object({endpoints:ne.array(ne.string()).optional()});var Ywt=ne.union([ne.boolean(),ne.object({except:ne.array(ne.string()).optional()})]);var Xwt=CPe.extend({onlyIncludeReferencedSchemas:ne.boolean().optional(),inlinePathParameters:ne.boolean().optional(),preferUndiscriminatedUnionsWithLiterals:ne.boolean().optional(),objectQueryParameters:ne.boolean().optional(),respectReadonlySchemas:ne.boolean().optional(),respectForwardCompatibleEnums:ne.boolean().optional(),useBytesForBinaryResponse:ne.boolean().optional(),defaultFormParameterEncoding:Hwt.optional(),filter:Jwt.optional(),exampleGeneration:Kwt.optional(),additionalPropertiesDefaultsTo:ne.boolean().optional(),typeDatesAsStrings:ne.boolean().optional(),preserveSingleSchemaOneof:ne.boolean().optional(),inlineAllOfSchemas:ne.boolean().optional(),resolveAliases:Ywt.optional(),groupMultiApiEnvironments:ne.boolean().optional(),defaultIntegerFormat:$wt.optional()});var Zwt=ne.object({openapi:ne.string(),origin:ne.string().optional(),overrides:ne.union([ne.string(),ne.array(ne.string()).nonempty()]).optional(),overlays:ne.string().optional(),namespace:ne.string().optional(),settings:Xwt.optional()});var gAr=ne.object({}),eCt=ne.object({openrpc:ne.string(),overrides:ne.union([ne.string(),ne.array(ne.string()).nonempty()]).optional(),settings:gAr.optional()});var AAr=ne.object({}),yAr=ne.object({root:ne.string(),target:ne.string().optional(),overrides:ne.union([ne.string(),ne.array(ne.string()).nonempty()]).optional(),localGeneration:ne.boolean().optional(),fromOpenapi:ne.boolean().optional(),dependencies:ne.array(ne.string()).optional()}),tCt=ne.object({proto:yAr,settings:AAr.optional()});var bAr=ne.union([Zwt,qwt,tCt,Wwt,Gwt,eCt]);var EAr=ne.record(ne.string(),ne.unknown());var vAr=ne.object({urls:ne.record(ne.string(),ne.string()),docs:ne.string().optional()});var IAr=ne.object({url:ne.string(),docs:ne.string().optional()});var wAr=ne.union([ne.string(),IAr,vAr]);var CAr=ne.object({name:ne.string().optional(),env:ne.string().optional(),docs:ne.string().optional()});var xAr=ne.union([ne.string(),CAr]);var Fqe=ne.object({specs:ne.array(bAr),auth:ne.string().optional(),defaultUrl:ne.string().optional(),defaultEnvironment:ne.string().optional(),environments:ne.record(ne.string(),wAr).optional(),headers:ne.record(ne.string(),xAr).optional(),authSchemes:EAr.optional()});var _Ar=ne.record(ne.string(),Fqe);var SAr=ne.object({version:ne.string().optional()});var BAr=ne.object({packageName:ne.string(),url:ne.string().optional(),token:ne.string().optional()});var OAr=kw.DocsYmlSchemas.DocsConfiguration;var Uu=kw.DocsYmlSchemas,qZp=Uu.DocsInstance,GZp=Uu.EditThisPageConfig,WZp=Uu.NavigationConfig,$Zp=Uu.TabbedNavigationConfig,HZp=Uu.UntabbedNavigationConfig,KZp=Uu.NavigationItem,JZp=Uu.PageConfiguration,YZp=Uu.SectionConfiguration,XZp=Uu.ApiReferenceConfiguration,ZZp=Uu.LinkConfiguration,eef=Uu.ChangelogConfiguration,tef=Uu.LibraryReferenceConfiguration,ref=Uu.FolderConfiguration,nef=Uu.TabbedNavigationItem,ief=Uu.TabVariant,oef=Uu.TabConfig,sef=Uu.VersionConfig,aef=Uu.ProductConfig,uef=Uu.SnippetsConfiguration,cef=Uu.PlaygroundSettings,lef=Uu.LogoConfiguration,pef=Uu.BackgroundImageConfiguration,fef=Uu.ColorsConfiguration,def=Uu.DocsTypographyConfig,mef=Uu.LayoutConfig,hef=Uu.DocsSettingsConfig,gef=Uu.ThemeConfig,Aef=Uu.NavbarLink,yef=Uu.FooterLinksConfig,bef=Uu.PageActionsConfig,Eef=Uu.AnalyticsConfig,vef=Uu.MetadataConfig,Ief=Uu.RedirectConfig,wef=Uu.AIChatConfig,Cef=Uu.AiExamplesConfig,xef=Uu.AnnouncementConfig,_ef=Uu.IntegrationsConfig,Sef=Uu.IntercomConfig,Bef=Uu.LibraryConfiguration,Oef=Uu.LibraryInputConfiguration,Pef=Uu.LibraryOutputConfiguration,Tef=Uu.CssConfig,Def=Uu.JsConfig,Ref=Uu.ExperimentalConfig,Fef=Uu.FeatureFlag,kef=Uu.FeatureFlagConfiguration,Qef=Uu.Availability,Nef=Uu.Role;var kqe=ne.enum(["csharp","go","java","php","python","ruby","rust","swift","typescript"]);var PAr=ne.union([ne.string(),ne.object({method:ne.string(),path:ne.string(),stream:ne.boolean().optional()})]),l1i=ne.object({title:ne.string(),language:kqe.optional(),content:ne.string()}),p1i=ne.enum(["minimal","comprehensive"]),Qqe=ne.object({bannerLink:ne.string().optional(),introduction:ne.string().optional(),apiReferenceLink:ne.string().optional(),apiName:ne.string().optional(),disabledSections:ne.array(ne.string()).optional(),defaultEndpoint:PAr.optional(),features:ne.record(ne.string(),ne.array(PAr)).optional(),customSections:ne.array(l1i).optional(),exampleStyle:p1i.optional()});var f1i=ne.object({name:ne.string(),email:ne.string()}),TAr=ne.object({description:ne.string().optional(),authors:ne.array(f1i).optional()});var DAr=ne.enum(["pr","release","push"]);var jef=["MIT","Apache-2.0"];function tEa(e){return jef.includes(e)}var Nqe=ne.string();var RAr=ne.object({teams:ne.array(ne.string()).optional(),users:ne.array(ne.string()).optional()});var FAr=ne.object({repository:ne.string(),mode:DAr.optional(),branch:ne.string().optional(),license:Nqe.optional(),reviewers:RAr.optional()}).strict();var kAr=ne.enum(["pr","push"]);var QAr=ne.object({uri:ne.string(),token:ne.string(),mode:kAr.optional(),branch:ne.string().optional(),license:Nqe.optional()}).strict();var NAr=ne.union([QAr,FAr]);function rEa(e){return"uri"in e}function nEa(e){return"repository"in e}var jAr=ne.object({path:ne.string().optional(),git:NAr.optional()});var MAr=ne.union([ne.string(),jAr]);var d1i=ne.object({keyId:ne.string(),password:ne.string(),secretKey:ne.string()}),LAr=ne.object({coordinate:ne.string(),url:ne.string().optional(),username:ne.string().optional(),password:ne.string().optional(),signature:d1i.optional()});var UAr=ne.object({packageName:ne.string(),url:ne.string().optional(),token:ne.string().optional()});var zAr=ne.object({packageName:ne.string(),url:ne.string().optional(),apiKey:ne.string().optional()});var m1i=ne.object({keywords:ne.array(ne.string()).optional(),documentationLink:ne.string().optional(),homepageLink:ne.string().optional()}),VAr=ne.object({packageName:ne.string(),url:ne.string().optional(),token:ne.string().optional(),username:ne.string().optional(),password:ne.string().optional(),metadata:m1i.optional()});var qAr=ne.object({packageName:ne.string(),url:ne.string().optional(),apiKey:ne.string().optional()});var GAr=ne.object({npm:UAr.optional(),pypi:VAr.optional(),maven:LAr.optional(),nuget:zAr.optional(),rubygems:qAr.optional(),crates:BAr.optional()});var WAr=ne.object({api:ne.string().optional(),lang:kqe.optional(),image:ne.string().optional(),version:ne.string().optional(),config:ne.record(ne.string(),ne.unknown()).optional(),publish:GAr.optional(),output:MAr,group:ne.array(ne.string()).optional(),metadata:TAr.optional(),readme:Qqe.optional()});var $Ar=ne.object({autorelease:ne.boolean().optional(),defaultGroup:ne.string().optional(),readme:Qqe.optional(),targets:ne.record(ne.string(),WAr)});var rCt=ne.object({edition:ne.string().optional(),org:ne.string(),ai:dAr.optional(),cli:SAr.optional(),docs:OAr.optional(),sdks:$Ar.optional(),api:Fqe.optional(),apis:_Ar.optional()});var nCt=ne.object({user:ne.string()});var iCt=ne.object({active:ne.string().optional(),accounts:ne.array(nCt).default([])});var oCt=ne.object({path:ne.string().optional()});var iEa=ne.object({enabled:ne.boolean().optional()});var Hme=ne.object({version:ne.literal("v1").default("v1"),auth:iCt.default({accounts:[]}),cache:oCt.optional(),telemetry:iEa.optional()});function Kme(){return{version:"v1",auth:{active:void 0,accounts:[]}}}var oEa=ne.enum(["pr","release","push"]);function sEa(e){return typeof e=="string"?{path:e}:e}Vt();var a_a=_e(aCt(),1),bEr=_e(MI(),1);var Z6=_e(require("process"),1);function Uef(){return Z6.default.platform!=="win32"?Z6.default.env.TERM!=="linux":!!Z6.default.env.WT_SESSION||!!Z6.default.env.TERMINUS_SUBLIME||Z6.default.env.ConEmuTask==="{cmd::Cmder}"||Z6.default.env.TERM_PROGRAM==="Terminus-Sublime"||Z6.default.env.TERM_PROGRAM==="vscode"||Z6.default.env.TERM==="xterm-256color"||Z6.default.env.TERM==="alacritty"||Z6.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var cEa={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},lEa={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},zef={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Vef={...cEa,...lEa},qef={...cEa,...zef},Gef=Uef(),Wef=Gef?Vef:qef,Tv=Wef,HTy=Object.entries(lEa);var u_a=_e(uCt(),1),rK=_e(LQ(),1);var ab=_e(LQ(),1);function nyf(e,t){return{value:e,key:t||{}}}function r1(e){let t=(0,ab.fromEvent)(e.input,"keypress",nyf).pipe((0,ab.takeUntil)((0,ab.fromEvent)(e,"close"))).pipe((0,ab.filter)(({key:r})=>r.name!=="enter"&&r.name!=="return"));return{line:(0,ab.fromEvent)(e,"line"),keypress:t,normalizedUpKey:t.pipe((0,ab.filter)(({key:r})=>r.name==="up"||r.name==="k"||r.name==="p"&&r.ctrl),(0,ab.share)()),normalizedDownKey:t.pipe((0,ab.filter)(({key:r})=>r.name==="down"||r.name==="j"||r.name==="n"&&r.ctrl),(0,ab.share)()),numberKey:t.pipe((0,ab.filter)(r=>r.value&&"123456789".includes(r.value)),(0,ab.map)(r=>Number(r.value)),(0,ab.share)()),spaceKey:t.pipe((0,ab.filter)(({key:r})=>r&&r.name==="space"),(0,ab.share)()),aKey:t.pipe((0,ab.filter)(({key:r})=>r&&r.name==="a"),(0,ab.share)()),iKey:t.pipe((0,ab.filter)(({key:r})=>r&&r.name==="i"),(0,ab.share)())}}var LCa=_e(MI(),1),nV=class{constructor(t,r={}){let{isInfinite:n=!0}=r;this.lastIndex=0,this.screen=t,this.isInfinite=n}paginate(t,r,n){n||=7;let i=t.split(`
|
|
1625
|
+
`)),this.violations=t}};async function uwt({organization:e,token:t}){let r=FA({token:t.value}),n=await r.organization.isMember(Oc.OrganizationId(e));if(n.ok&&n.body)return{type:"member"};let i=await r.organization.get(Oc.OrganizationId(e));if(i.ok)return{type:"no-access"};let o={type:"unknown-error"};return i.error._visit({unauthorizedError:()=>{o={type:"no-access"}},_other:()=>{o={type:"not-found"}}}),o}function lPe(e){if(e.length===0)return"Organization name cannot be empty";if(!/^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$/.test(e))return"Organization name must contain only lowercase letters, numbers, and hyphens, and cannot start or end with a hyphen"}async function K_({organization:e,token:t,context:r}){let n=FA({token:t.value});if((await n.organization.get(Oc.OrganizationId(e))).ok)return!1;let o=lPe(e);o!=null&&r.failAndThrow(o);let s=await n.organization.create({organizationId:Oc.OrganizationId(e)});return s.ok||r.failAndThrow(`Failed to create organization: ${e}`,s.error),!0}Vt();var bha=require("os"),KVp="token",JVp=".fern";function Goe(){return We(Ut.of((0,bha.homedir)()),Se.of(JVp),Se.of(KVp))}Vt();var Eha=require("fs/promises");var YVp="FERN_TOKEN";async function pPe(){return await VH()??await Dhr()}async function VH(){let e=process.env[YVp];if(!(e==null||e.trim().length===0))return{type:"organization",value:e}}async function Dhr(){let e=Goe();if(!await Xt(e))return;let n=(await(0,Eha.readFile)(e)).toString().trim();if(n.length!==0)return{type:"user",value:n}}var vha=require("fs/promises");async function Wwi(){let e=Goe();try{await(0,vha.unlink)(e)}catch(t){if(t.code!=="ENOENT")throw t}}var Rhr=require("fs/promises"),Iha=_e(require("path"),1);async function $wi(e){let t=Goe();await(0,Rhr.mkdir)(Iha.default.dirname(t),{recursive:!0}),await(0,Rhr.writeFile)(t,e)}async function Hwi({token:e,context:t}){let r=await FA({token:e.value}).user.getMyself();return r.ok?r.body:t.failAndThrow("Failed to fetch user info")}var sAa=_e(Khr(),1);function ACi(e){let t=sAa.default.decode(e.value,{complete:!0});if(t==null)return;let r=t.payload;return typeof r=="string"?void 0:r.sub}Rt();async function aAa(e){return(await FA({token:e.value}).organization.getMyOrganizationFromScopedToken()).ok}var jwt=_e(Khr(),1),X0a=_e(Y0a(),1),Z0a="fern-prod.us.auth0.com",VZp=Z0a.startsWith("localhost")?"http":"https",eEa=(0,X0a.default)({jwksUri:`${VZp}://${Z0a}/.well-known/jwks.json`});async function c1i(e){let t=jwt.default.decode(e.value,{complete:!0});if(t==null)return!1;try{let r=await eEa.getSigningKey(t.header.kid);return jwt.default.verify(e.value,r.getPublicKey(),{algorithms:["RS256"]}),!0}catch{return!1}}async function $me(e){let t=jwt.default.decode(e,{complete:!0});if(t!=null)try{let r=await eEa.getSigningKey(t.header.kid),n=jwt.default.verify(e,r.getPublicKey(),{algorithms:["RS256"]});return typeof n=="string"?void 0:n}catch{return}}async function Mwt(){let e=await pPe();if(e==null)return!1;switch(e.type){case"organization":return aAa(e);case"user":return c1i(e);default:xe(e)}}var oE={};Y(oE,{AiChatConfigSchema:()=>wef,AiConfigSchema:()=>dAr,AiExamplesConfigSchema:()=>Cef,AiProviderSchema:()=>fAr,AnalyticsConfigSchema:()=>Eef,AnnouncementConfigSchema:()=>xef,ApiDefinitionSchema:()=>Fqe,ApiReferenceConfigurationSchema:()=>XZp,ApiSpecSchema:()=>bAr,ApisSchema:()=>_Ar,AsyncApiSettingsSchema:()=>Vwt,AsyncApiSpecSchema:()=>qwt,AuthSchemesSchema:()=>EAr,AuthorSchema:()=>f1i,AvailabilitySchema:()=>Qef,BackgroundImageConfigurationSchema:()=>pef,BaseApiSettingsSchema:()=>CPe,ChangelogConfigurationSchema:()=>eef,CliSchema:()=>SAr,ColorsConfigurationSchema:()=>fef,ConjureSettingsSchema:()=>mAr,ConjureSpecSchema:()=>Gwt,CratesPublishSchema:()=>BAr,CssConfigSchema:()=>Tef,DefaultIntegerFormatSchema:()=>$wt,DocsInstanceSchema:()=>qZp,DocsSchema:()=>OAr,DocsSettingsConfigSchema:()=>hef,EditThisPageConfigSchema:()=>GZp,EnvironmentSchema:()=>wAr,ExampleGenerationSchema:()=>Rqe,ExampleStyleSchema:()=>p1i,ExperimentalConfigSchema:()=>Ref,FeatureFlagConfigurationSchema:()=>kef,FeatureFlagSchema:()=>Fef,FernRcAccountSchema:()=>nCt,FernRcAuthSchema:()=>iCt,FernRcCacheSchema:()=>oCt,FernRcSchema:()=>Hme,FernSettingsSchema:()=>hAr,FernSpecSchema:()=>Wwt,FernYmlSchema:()=>rCt,FolderConfigurationSchema:()=>ref,FooterLinksConfigSchema:()=>yef,FormParameterEncodingSchema:()=>Hwt,GitHubOutputModeSchema:()=>oEa,GitHubRepositoryOutputModeSchema:()=>DAr,GitHubRepositoryOutputSchema:()=>FAr,GitOutputSchema:()=>NAr,GitSelfHostedOutputModeSchema:()=>kAr,GitSelfHostedOutputSchema:()=>QAr,HeaderConfigSchema:()=>CAr,HeaderSchema:()=>xAr,IntegrationsConfigSchema:()=>_ef,IntercomConfigSchema:()=>Sef,JsConfigSchema:()=>Def,LayoutConfigSchema:()=>mef,LibraryConfigurationSchema:()=>Bef,LibraryInputConfigurationSchema:()=>Oef,LibraryOutputConfigurationSchema:()=>Pef,LibraryReferenceConfigurationSchema:()=>tef,LicenseSchema:()=>Nqe,LinkConfigurationSchema:()=>ZZp,LogoConfigurationSchema:()=>lef,MavenPublishSchema:()=>LAr,MavenSignatureSchema:()=>d1i,MessageNamingVersionSchema:()=>zwt,MetadataConfigSchema:()=>vef,MetadataSchema:()=>TAr,MultipleBaseUrlsEnvironmentSchema:()=>vAr,NavbarLinkSchema:()=>Aef,NavigationConfigSchema:()=>WZp,NavigationItem:()=>KZp,NpmPublishSchema:()=>UAr,NugetPublishSchema:()=>zAr,OpenApiExampleGenerationSchema:()=>Kwt,OpenApiFilterSchema:()=>Jwt,OpenApiSettingsSchema:()=>Xwt,OpenApiSpecSchema:()=>Zwt,OpenRpcSettingsSchema:()=>gAr,OpenRpcSpecSchema:()=>eCt,OutputObjectSchema:()=>jAr,OutputSchema:()=>MAr,PageActionsConfigSchema:()=>bef,PageConfigurationSchema:()=>JZp,PathParameterOrderSchema:()=>Lwt,PlaygroundSettingsSchema:()=>cef,ProductConfigSchema:()=>aef,ProtobufDefinitionSchema:()=>yAr,ProtobufSettingsSchema:()=>AAr,ProtobufSpecSchema:()=>tCt,PublishSchema:()=>GAr,PypiMetadataSchema:()=>m1i,PypiPublishSchema:()=>VAr,ReadmeCustomSectionSchema:()=>l1i,ReadmeEndpointSchema:()=>PAr,ReadmeSchema:()=>Qqe,RedirectConfigSchema:()=>Ief,RemoveDiscriminantsFromSchemasSchema:()=>Uwt,ResolveAliasesSchema:()=>Ywt,ReviewersSchema:()=>RAr,RoleSchema:()=>Nef,RubygemsPublishSchema:()=>qAr,SdkTargetLanguageSchema:()=>kqe,SdkTargetSchema:()=>WAr,SdksSchema:()=>$Ar,SectionConfigurationSchema:()=>YZp,SingleBaseUrlEnvironmentSchema:()=>IAr,SnippetsConfigurationSchema:()=>uef,TabConfigSchema:()=>oef,TabVariantSchema:()=>ief,TabbedNavigationConfigSchema:()=>$Zp,TabbedNavigationItemSchema:()=>nef,ThemeConfigSchema:()=>gef,TypographyConfigSchema:()=>def,UntabbedNavigationConfigSchema:()=>HZp,VersionConfigSchema:()=>sef,createEmptyFernRcSchema:()=>Kme,isGitOutputGitHubRepository:()=>nEa,isGitOutputSelfHosted:()=>rEa,isWellKnownLicense:()=>tEa,resolveOutputObjectSchema:()=>sEa});var fAr=ne.enum(["openai","anthropic","bedrock"]);var dAr=ne.object({provider:fAr,model:ne.string()});var Lwt=ne.enum(["urlOrder","specOrder"]);var Uwt=ne.enum(["always","never"]);var CPe=ne.object({respectNullableSchemas:ne.boolean().optional(),wrapReferencesToNullableInOptional:ne.boolean().optional(),coerceOptionalSchemasToNullable:ne.boolean().optional(),titleAsSchemaName:ne.boolean().optional(),coerceEnumsToLiterals:ne.boolean().optional(),optionalAdditionalProperties:ne.boolean().optional(),idiomaticRequestNames:ne.boolean().optional(),groupEnvironmentsByHost:ne.boolean().optional(),removeDiscriminantsFromSchemas:Uwt.optional(),pathParameterOrder:Lwt.optional(),coerceConstsTo:ne.enum(["literals","enums","enums-coerceable-to-literals"]).optional()});var zwt=ne.enum(["v1","v2"]);var Vwt=CPe.extend({messageNaming:zwt.optional()});var qwt=ne.object({asyncapi:ne.string(),origin:ne.string().optional(),overrides:ne.union([ne.string(),ne.array(ne.string()).nonempty()]).optional(),namespace:ne.string().optional(),settings:Vwt.optional()});var mAr=ne.object({}),Gwt=ne.object({conjure:ne.string(),settings:mAr.optional()});var hAr=ne.object({}),Wwt=ne.object({fern:ne.string(),settings:hAr.optional()});var $wt=ne.enum(["int32","int64","uint32","uint64"]);var Hwt=ne.enum(["form","json"]);var Rqe=ne.object({maxDepth:ne.number().optional()});var Kwt=ne.object({request:Rqe.optional(),response:Rqe.optional()});var Jwt=ne.object({endpoints:ne.array(ne.string()).optional()});var Ywt=ne.union([ne.boolean(),ne.object({except:ne.array(ne.string()).optional()})]);var Xwt=CPe.extend({onlyIncludeReferencedSchemas:ne.boolean().optional(),inlinePathParameters:ne.boolean().optional(),preferUndiscriminatedUnionsWithLiterals:ne.boolean().optional(),objectQueryParameters:ne.boolean().optional(),respectReadonlySchemas:ne.boolean().optional(),respectForwardCompatibleEnums:ne.boolean().optional(),useBytesForBinaryResponse:ne.boolean().optional(),defaultFormParameterEncoding:Hwt.optional(),filter:Jwt.optional(),exampleGeneration:Kwt.optional(),additionalPropertiesDefaultsTo:ne.boolean().optional(),typeDatesAsStrings:ne.boolean().optional(),preserveSingleSchemaOneof:ne.boolean().optional(),inlineAllOfSchemas:ne.boolean().optional(),resolveAliases:Ywt.optional(),groupMultiApiEnvironments:ne.boolean().optional(),defaultIntegerFormat:$wt.optional()});var Zwt=ne.object({openapi:ne.string(),origin:ne.string().optional(),overrides:ne.union([ne.string(),ne.array(ne.string()).nonempty()]).optional(),overlays:ne.string().optional(),namespace:ne.string().optional(),settings:Xwt.optional()});var gAr=ne.object({}),eCt=ne.object({openrpc:ne.string(),overrides:ne.union([ne.string(),ne.array(ne.string()).nonempty()]).optional(),settings:gAr.optional()});var AAr=ne.object({}),yAr=ne.object({root:ne.string(),target:ne.string().optional(),overrides:ne.union([ne.string(),ne.array(ne.string()).nonempty()]).optional(),localGeneration:ne.boolean().optional(),fromOpenapi:ne.boolean().optional(),dependencies:ne.array(ne.string()).optional()}),tCt=ne.object({proto:yAr,settings:AAr.optional()});var bAr=ne.union([Zwt,qwt,tCt,Wwt,Gwt,eCt]);var EAr=ne.record(ne.string(),ne.unknown());var vAr=ne.object({urls:ne.record(ne.string(),ne.string()),docs:ne.string().optional()});var IAr=ne.object({url:ne.string(),docs:ne.string().optional()});var wAr=ne.union([ne.string(),IAr,vAr]);var CAr=ne.object({name:ne.string().optional(),env:ne.string().optional(),docs:ne.string().optional()});var xAr=ne.union([ne.string(),CAr]);var Fqe=ne.object({specs:ne.array(bAr),auth:ne.string().optional(),defaultUrl:ne.string().optional(),defaultEnvironment:ne.string().optional(),environments:ne.record(ne.string(),wAr).optional(),headers:ne.record(ne.string(),xAr).optional(),authSchemes:EAr.optional()});var _Ar=ne.record(ne.string(),Fqe);var SAr=ne.object({version:ne.string().optional()});var BAr=ne.object({packageName:ne.string(),url:ne.string().optional(),token:ne.string().optional()});var OAr=kw.DocsYmlSchemas.DocsConfiguration;var Uu=kw.DocsYmlSchemas,qZp=Uu.DocsInstance,GZp=Uu.EditThisPageConfig,WZp=Uu.NavigationConfig,$Zp=Uu.TabbedNavigationConfig,HZp=Uu.UntabbedNavigationConfig,KZp=Uu.NavigationItem,JZp=Uu.PageConfiguration,YZp=Uu.SectionConfiguration,XZp=Uu.ApiReferenceConfiguration,ZZp=Uu.LinkConfiguration,eef=Uu.ChangelogConfiguration,tef=Uu.LibraryReferenceConfiguration,ref=Uu.FolderConfiguration,nef=Uu.TabbedNavigationItem,ief=Uu.TabVariant,oef=Uu.TabConfig,sef=Uu.VersionConfig,aef=Uu.ProductConfig,uef=Uu.SnippetsConfiguration,cef=Uu.PlaygroundSettings,lef=Uu.LogoConfiguration,pef=Uu.BackgroundImageConfiguration,fef=Uu.ColorsConfiguration,def=Uu.DocsTypographyConfig,mef=Uu.LayoutConfig,hef=Uu.DocsSettingsConfig,gef=Uu.ThemeConfig,Aef=Uu.NavbarLink,yef=Uu.FooterLinksConfig,bef=Uu.PageActionsConfig,Eef=Uu.AnalyticsConfig,vef=Uu.MetadataConfig,Ief=Uu.RedirectConfig,wef=Uu.AIChatConfig,Cef=Uu.AiExamplesConfig,xef=Uu.AnnouncementConfig,_ef=Uu.IntegrationsConfig,Sef=Uu.IntercomConfig,Bef=Uu.LibraryConfiguration,Oef=Uu.LibraryInputConfiguration,Pef=Uu.LibraryOutputConfiguration,Tef=Uu.CssConfig,Def=Uu.JsConfig,Ref=Uu.ExperimentalConfig,Fef=Uu.FeatureFlag,kef=Uu.FeatureFlagConfiguration,Qef=Uu.Availability,Nef=Uu.Role;var kqe=ne.enum(["csharp","go","java","php","python","ruby","rust","swift","typescript"]);var PAr=ne.union([ne.string(),ne.object({method:ne.string(),path:ne.string(),stream:ne.boolean().optional()})]),l1i=ne.object({title:ne.string(),language:kqe.optional(),content:ne.string()}),p1i=ne.enum(["minimal","comprehensive"]),Qqe=ne.object({bannerLink:ne.string().optional(),introduction:ne.string().optional(),apiReferenceLink:ne.string().optional(),apiName:ne.string().optional(),disabledSections:ne.array(ne.string()).optional(),defaultEndpoint:PAr.optional(),features:ne.record(ne.string(),ne.array(PAr)).optional(),customSections:ne.array(l1i).optional(),exampleStyle:p1i.optional()});var f1i=ne.object({name:ne.string(),email:ne.string()}),TAr=ne.object({description:ne.string().optional(),authors:ne.array(f1i).optional()});var DAr=ne.enum(["pr","release","push"]);var jef=["MIT","Apache-2.0"];function tEa(e){return jef.includes(e)}var Nqe=ne.string();var RAr=ne.object({teams:ne.array(ne.string()).optional(),users:ne.array(ne.string()).optional()});var FAr=ne.object({repository:ne.string(),mode:DAr.optional(),branch:ne.string().optional(),license:Nqe.optional(),reviewers:RAr.optional()}).strict();var kAr=ne.enum(["pr","push"]);var QAr=ne.object({uri:ne.string(),token:ne.string(),mode:kAr.optional(),branch:ne.string().optional(),license:Nqe.optional()}).strict();var NAr=ne.union([QAr,FAr]);function rEa(e){return"uri"in e}function nEa(e){return"repository"in e}var jAr=ne.object({path:ne.string().optional(),git:NAr.optional()});var MAr=ne.union([ne.string(),jAr]);var d1i=ne.object({keyId:ne.string(),password:ne.string(),secretKey:ne.string()}),LAr=ne.object({coordinate:ne.string(),url:ne.string().optional(),username:ne.string().optional(),password:ne.string().optional(),signature:d1i.optional()});var UAr=ne.object({packageName:ne.string(),url:ne.string().optional(),token:ne.string().optional()});var zAr=ne.object({packageName:ne.string(),url:ne.string().optional(),apiKey:ne.string().optional()});var m1i=ne.object({keywords:ne.array(ne.string()).optional(),documentationLink:ne.string().optional(),homepageLink:ne.string().optional()}),VAr=ne.object({packageName:ne.string(),url:ne.string().optional(),token:ne.string().optional(),username:ne.string().optional(),password:ne.string().optional(),metadata:m1i.optional()});var qAr=ne.object({packageName:ne.string(),url:ne.string().optional(),apiKey:ne.string().optional()});var GAr=ne.object({npm:UAr.optional(),pypi:VAr.optional(),maven:LAr.optional(),nuget:zAr.optional(),rubygems:qAr.optional(),crates:BAr.optional()});var WAr=ne.object({api:ne.string().optional(),lang:kqe.optional(),image:ne.string().optional(),version:ne.string().optional(),config:ne.record(ne.string(),ne.unknown()).optional(),publish:GAr.optional(),output:MAr,group:ne.array(ne.string()).optional(),metadata:TAr.optional(),readme:Qqe.optional()});var $Ar=ne.object({autorelease:ne.boolean().optional(),defaultGroup:ne.string().optional(),readme:Qqe.optional(),targets:ne.record(ne.string(),WAr)});var rCt=ne.object({edition:ne.string().optional(),org:ne.string(),ai:dAr.optional(),cli:SAr.optional(),docs:OAr.optional(),sdks:$Ar.optional(),api:Fqe.optional(),apis:_Ar.optional()});var nCt=ne.object({user:ne.string()});var iCt=ne.object({active:ne.string().optional(),accounts:ne.array(nCt).default([])});var oCt=ne.object({path:ne.string().optional()});var iEa=ne.object({enabled:ne.boolean().optional()});var Hme=ne.object({version:ne.literal("v1").default("v1"),auth:iCt.default({accounts:[]}),cache:oCt.optional(),telemetry:iEa.optional()});function Kme(){return{version:"v1",auth:{active:void 0,accounts:[]}}}var oEa=ne.enum(["pr","release","push"]);function sEa(e){return typeof e=="string"?{path:e}:e}Vt();var a_a=_e(aCt(),1),bEr=_e(MI(),1);var Z6=_e(require("process"),1);function Uef(){return Z6.default.platform!=="win32"?Z6.default.env.TERM!=="linux":!!Z6.default.env.WT_SESSION||!!Z6.default.env.TERMINUS_SUBLIME||Z6.default.env.ConEmuTask==="{cmd::Cmder}"||Z6.default.env.TERM_PROGRAM==="Terminus-Sublime"||Z6.default.env.TERM_PROGRAM==="vscode"||Z6.default.env.TERM==="xterm-256color"||Z6.default.env.TERM==="alacritty"||Z6.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var cEa={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},lEa={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},zef={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},Vef={...cEa,...lEa},qef={...cEa,...zef},Gef=Uef(),Wef=Gef?Vef:qef,Tv=Wef,HTy=Object.entries(lEa);var u_a=_e(uCt(),1),rK=_e(LQ(),1);var ab=_e(LQ(),1);function nyf(e,t){return{value:e,key:t||{}}}function r1(e){let t=(0,ab.fromEvent)(e.input,"keypress",nyf).pipe((0,ab.takeUntil)((0,ab.fromEvent)(e,"close"))).pipe((0,ab.filter)(({key:r})=>r.name!=="enter"&&r.name!=="return"));return{line:(0,ab.fromEvent)(e,"line"),keypress:t,normalizedUpKey:t.pipe((0,ab.filter)(({key:r})=>r.name==="up"||r.name==="k"||r.name==="p"&&r.ctrl),(0,ab.share)()),normalizedDownKey:t.pipe((0,ab.filter)(({key:r})=>r.name==="down"||r.name==="j"||r.name==="n"&&r.ctrl),(0,ab.share)()),numberKey:t.pipe((0,ab.filter)(r=>r.value&&"123456789".includes(r.value)),(0,ab.map)(r=>Number(r.value)),(0,ab.share)()),spaceKey:t.pipe((0,ab.filter)(({key:r})=>r&&r.name==="space"),(0,ab.share)()),aKey:t.pipe((0,ab.filter)(({key:r})=>r&&r.name==="a"),(0,ab.share)()),iKey:t.pipe((0,ab.filter)(({key:r})=>r&&r.name==="i"),(0,ab.share)())}}var LCa=_e(MI(),1),nV=class{constructor(t,r={}){let{isInfinite:n=!0}=r;this.lastIndex=0,this.screen=t,this.isInfinite=n}paginate(t,r,n){n||=7;let i=t.split(`
|
|
1626
1626
|
`);if(this.screen&&(i=this.screen.breakLines(i),r=i.map(s=>s.length).splice(0,r).reduce((s,a)=>s+a,0),i=i.flat()),i.length<=n)return t;let o=this.isInfinite?this.getInfiniteLines(i,r,n):this.getFiniteLines(i,r,n);return this.lastIndex=r,o.join(`
|
|
1627
1627
|
`)+`
|
|
1628
1628
|
`+LCa.default.dim("(Move up and down to reveal more choices)")}getInfiniteLines(t,r,n){this.pointer===void 0&&(this.pointer=0);let i=Math.floor(n/2);this.pointer<i&&this.lastIndex<r&&r-this.lastIndex<n&&(this.pointer=Math.min(i,this.pointer+r-this.lastIndex));let o=[t,t,t].flat(),s=Math.max(0,r+t.length-this.pointer);return o.splice(s,n)}getFiniteLines(t,r,n){let i=r-n/2;return i<0?i=0:i+n>t.length&&(i=t.length-n),t.splice(i,n)}};function rse(e,t,r){let n=r.choices.realLength,i="loop"in r?!!r.loop:!0;if(t==="up")return e>0?e-1:i?n-1:e;if(t==="down")return e<n-1?e+1:i?0:e;throw new Error("dir must be up or down")}var QPe=_e(MI(),1),oBi=_e(uCt(),1),oV=_e(LQ(),1);var PSi=_e(require("assert"),1);var UCa=_e(MI(),1);var gF=class{constructor(t){this.type="separator",this.line=UCa.default.dim(t||Array.from({length:15}).join(Tv.line))}static exclude(t){return t.type!=="separator"}toString(){return this.line}};var w9e=class e{constructor(t,r){if(t instanceof e||t.type==="separator")return t;typeof t=="string"||typeof t=="number"?(this.name=String(t),this.value=t,this.short=String(t)):Object.assign(this,t,{name:t.name||t.value,value:"value"in t?t.value:t.name,short:t.short||t.name||t.value}),this.disabled=typeof t.disabled=="function"?t.disabled(r):t.disabled}};var xCt=class{constructor(t,r){this.choices=t.map(n=>n.type==="separator"?(n instanceof gF||(n=new gF(n.line)),n):new w9e(n,r)),this.realChoices=this.choices.filter(gF.exclude).filter(n=>!n.disabled),Object.defineProperty(this,"length",{get(){return this.choices.length},set(n){this.choices.length=n}}),Object.defineProperty(this,"realLength",{get(){return this.realChoices.length},set(){throw new Error("Cannot set `realLength` of a Choices collection")}})}[Symbol.iterator](){let t=this.choices,r=-1;return{next:()=>({value:t[++r],done:!(r in t)})}}getChoice(t){return(0,PSi.default)(typeof t=="number"),this.realChoices[t]}get(t){return(0,PSi.default)(typeof t=="number"),this.choices[t]}where(t){let r;if(typeof t=="function")r=t;else{let[n,i]=Object.entries(t)[0];r=o=>o[n]===i}return this.realChoices.filter(r)}pluck(t){return this.realChoices.map(r=>r[t])}indexOf(...t){return this.choices.indexOf(...t)}forEach(...t){return this.choices.forEach(...t)}filter(...t){return this.choices.filter(...t)}reduce(...t){return this.choices.reduce(...t)}find(t){return this.choices.find(t)}some(t){return this.choices.some(t)}push(...t){let r=t.map(n=>new w9e(n));return this.choices.push(...r),this.realChoices=this.choices.filter(gF.exclude).filter(n=>!n.disabled),this.choices}};var r_a=_e(aCt(),1),n_a=_e(TSi(),1),i_a=_e(MSi(),1),o_a=_e(kPe(),1),s_a=_e(bhe(),1),iBi=_e(Jxa(),1);var O9e=_e(aCt(),1),yEr=function(e,t){e.output.write(O9e.default.cursorBackward(t))},Yxa=function(e,t){e.output.write(O9e.default.cursorForward(t))},Xxa=function(e,t){e.output.write(O9e.default.cursorUp(t))},nBi=function(e,t){e.output.write(O9e.default.cursorDown(t))},TCt=function(e,t){e.output.write(O9e.default.eraseLines(t))};function e_a(e){return e.split(`
|
|
@@ -1653,7 +1653,7 @@ ${r_a.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&nBi(th
|
|
|
1653
1653
|
`+jPe.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?jPe.default.cyan(p_a(t,this.opt.mask)):jPe.default.italic(jPe.default.dim("[hidden]")):this.opt.mask?p_a(t,this.opt.mask):jPe.default.italic(jPe.default.dim("[input is hidden] "))}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var JEr=_e(MI(),1);var l1a=_e(jBi(),1),HEr=require("child_process"),k9e=require("fs"),$Er=_e(require("path"),1),p1a=_e(require("os"),1),f1a=require("crypto"),IOi=_e(u1a(),1);var qEr=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var WCt=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var GEr=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var WEr=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function KEr(e="",t,r){let n=new wOi(e,r);n.runAsync((i,o)=>{if(i)setImmediate(t,i,void 0);else try{n.cleanup(),setImmediate(t,void 0,o)}catch(s){setImmediate(t,s,void 0)}})}function c1a(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function Jbf(e){let t=[],r="";for(let n=0;n<e.length;n++){let i=e.charAt(n);n>0&&i===" "&&e[n-1]!=="\\"&&r.length>0?(t.push(r),r=""):r=`${r}${i}`}return r.length>0&&t.push(r),t}var wOi=class{text="";tempFile;editor;lastExitStatus=0;fileOptions={};get temp_file(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile}get last_exit_status(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus}constructor(t="",r){this.text=t,r&&(this.fileOptions=r),this.determineEditor(),this.createTemporaryFile()}run(){return this.launchEditor(),this.readTemporaryFile(),this.text}runAsync(t){try{this.launchEditorAsync(()=>{try{this.readTemporaryFile(),setImmediate(t,void 0,this.text)}catch(r){setImmediate(t,r,void 0)}})}catch(r){setImmediate(t,r,void 0)}}cleanup(){this.removeTemporaryFile()}determineEditor(){let t=process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:process.platform.startsWith("win")?"notepad":"vim",r=Jbf(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??p1a.default.tmpdir(),r=(0,f1a.randomUUID)(),n=c1a(this.fileOptions.prefix),i=c1a(this.fileOptions.postfix),o=`${n}${r}${i}`,s=$Er.default.resolve(t,o),a=$Er.default.resolve(t)+$Er.default.sep;if(!s.startsWith(a))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=s;let u={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(u.mode=this.fileOptions.mode),(0,k9e.writeFileSync)(this.tempFile,this.text,u)}catch(t){throw new qEr(t)}}readTemporaryFile(){try{let t=(0,k9e.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,l1a.detect)(t)??"utf8";IOi.default.encodingExists(r)||(r="utf8"),this.text=IOi.default.decode(t,r)}}catch(t){throw new GEr(t)}}removeTemporaryFile(){try{(0,k9e.unlinkSync)(this.tempFile)}catch(t){throw new WEr(t)}}launchEditor(){try{let t=(0,HEr.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new WCt(t)}}launchEditorAsync(t){try{(0,HEr.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new WCt(r)}}};var d1a=_e(LQ(),1);var $Ct=class extends LI{_run(t){this.done=t,this.editorResult=new d1a.Subject;let r=r1(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let n=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,i=this.handleSubmitEvents(this.editorResult);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,n?this.render():this.startExternalEditor(),this}render(t){let r="",n=this.getQuestion();n+=this.status==="answered"?JEr.default.dim("Received"):JEr.default.dim("Press <enter> to launch your preferred editor."),t&&(r=JEr.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),KEr(this.currentText,this.endExternalEditor.bind(this),{postfix:this.opt.postfix??".txt"})}endExternalEditor(t,r){this.rl.resume(),t?this.editorResult.error(t):this.editorResult.next(r)}onEnd(t){this.editorResult.unsubscribe(),this.lineSubscription.unsubscribe(),this.answer=t.value,this.status="answered",this.render(),this.screen.done(),this.done(this.answer)}onError(t){this.render(t.isValid)}};var y1a=require("stream");var g1a=_e(require("readline"),1),A1a=_e(h1a(),1),zPe=class{constructor(t){this.rl||=g1a.default.createInterface(Xbf(t)),this.rl.resume(),this.onForceClose=this.onForceClose.bind(this),process.on("exit",this.onForceClose),this.rl.on("SIGINT",this.onForceClose)}onForceClose(){this.close(),process.kill(process.pid,"SIGINT"),console.log("")}close(){this.rl.removeListener("SIGINT",this.onForceClose),process.removeListener("exit",this.onForceClose),this.rl.output.unmute(),this.activePrompt&&typeof this.activePrompt.close=="function"&&this.activePrompt.close(),this.rl.output.end(),this.rl.pause(),this.rl.close()}};function Xbf(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let i=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw i.isTtyError=!0,i}let r=new A1a.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var HCt=class extends zPe{constructor(t={}){super(t),this.log=new y1a.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return TCt(this.rl,this.bottomBar.split(`
|
|
1654
1654
|
`).length),this}updateBottomBar(t){return TCt(this.rl,1),this.rl.output.unmute(),this.clean(),this.bottomBar=t,this.render(),this.rl.output.mute(),this}writeLog(t){return this.rl.output.unmute(),this.clean(),this.rl.output.write(this.enforceLF(t.toString())),this.render(),this.rl.output.mute(),this}enforceLF(t){return/[\n\r]$/.test(t)?t:t+`
|
|
1655
1655
|
`}write(t){let r=t.split(/\n/);this.height=r.length,this.rl.setPrompt(r.at(-1)),this.rl.output.rows===0&&this.rl.output.columns===0&&yEr(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var Ef=_e(LQ(),1),v1a=_e(uCt(),1);var YEr=_e(LQ(),1),b1a=_e(uCt(),1),XEr=function(e,t,r){return typeof e[t]!="function"?(0,YEr.of)(e):(0,YEr.from)((0,b1a.default)(e[t])(r).then(n=>(e[t]=n,e)))};var E1a={set:(e,t="",r)=>{let n=e;t.split(".").forEach((i,o,s)=>{i==="__proto__"||i==="constructor"||(o===s.length-1?n[i]=r:(!(i in n)||typeof n[i]!="object")&&(n[i]={}),n=n[i])})},get:(e,t="",r)=>{let n=o=>String.prototype.split.call(t,o).filter(Boolean).reduce((s,a)=>s!=null?s[a]:s,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?r:i}},Q9e=class extends zPe{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let n;return Array.isArray(t)?n=(0,Ef.from)(t):(0,Ef.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,Ef.from)(Object.entries(t).map(([i,o])=>({name:i,...o}))):n=(0,Ef.from)([t]),this.process=n.pipe((0,Ef.concatMap)(this.processQuestion.bind(this)),(0,Ef.publish)()),this.process.connect(),this.process.pipe((0,Ef.reduce)((i,o)=>(E1a.set(i,o.name,o.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,Ef.defer)(()=>(0,Ef.of)(t).pipe((0,Ef.concatMap)(this.setDefaultType.bind(this)),(0,Ef.concatMap)(this.filterIfRunnable.bind(this)),(0,Ef.concatMap)(()=>XEr(t,"message",this.answers)),(0,Ef.concatMap)(()=>XEr(t,"default",this.answers)),(0,Ef.concatMap)(()=>XEr(t,"choices",this.answers)),(0,Ef.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,Ef.defer)(()=>(0,Ef.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,Ef.defer)(()=>(0,Ef.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&E1a.get(this.answers,t.name)!==void 0)return Ef.EMPTY;if(t.when===!1)return Ef.EMPTY;if(typeof t.when!="function")return(0,Ef.of)(t);let{answers:r}=this;return(0,Ef.defer)(()=>(0,Ef.from)((0,v1a.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,Ef.filter)(n=>n!=null)))}};function I1a(e){let t=function(r,n){let i;try{i=new Q9e(t.prompts,e)}catch(s){return Promise.reject(s)}let o=i.run(r,n);return o.ui=i,o};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",RCt),this.registerPrompt("input",NPe),this.registerPrompt("number",FCt),this.registerPrompt("confirm",kCt),this.registerPrompt("rawlist",QCt),this.registerPrompt("expand",NCt),this.registerPrompt("checkbox",jCt),this.registerPrompt("password",MCt),this.registerPrompt("editor",$Ct)},t.restoreDefaultPrompts(),t}var xOi=I1a();function e0f(e,t){xOi.registerPrompt(e,t)}function t0f(){xOi.restoreDefaultPrompts()}var r0f={prompt:xOi,ui:{BottomBar:HCt,Prompt:Q9e},createPromptModule:I1a,registerPrompt:e0f,restoreDefaultPrompts:t0f,Separator:gF},lp=r0f;var N9e=require("path");function C1a(){let e=n0f();return async t=>{for(let r of t)r.module=e(r.filename);return t}}function n0f(e=process.argv[1]?(0,N9e.dirname)(process.argv[1]):process.cwd(),t=N9e.sep==="\\"){let r=t?w1a(e):e;return n=>{if(!n)return;let i=t?w1a(n):n,{dir:o,base:s,ext:a}=N9e.posix.parse(i);(a===".js"||a===".mjs"||a===".cjs")&&(s=s.slice(0,-1*a.length));let u=decodeURIComponent(s);o||(o=".");let c=o.lastIndexOf("/node_modules");if(c>-1)return`${o.slice(c+14).replace(/\//g,".")}:${u}`;if(o.startsWith(r)){let l=o.slice(r.length+1).replace(/\//g,".");return l?`${l}:${u}`:u}return u}}function w1a(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var _Oi=e=>{if("flags"in e){let t=x1a(e.flags),r=_1a(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,o])=>[i,SOi(o)])),n=Object.fromEntries(Object.entries(t).map(([i,o])=>[i,i0f(i,o,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function i0f(e,t,r){return{key:e,enabled:typeof t=="string"?!0:t,variant:typeof t=="string"?t:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:r?JSON.stringify(r):void 0,description:void 0}}}var x1a=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,KCt(r)]).filter(([,t])=>t!==void 0)),_1a=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let n=t[r];return n.enabled&&n.metadata&&n.metadata.payload!==void 0}).map(r=>{let n=t[r].metadata?.payload;return[r,n?SOi(n):void 0]}))};var KCt=e=>e===void 0?void 0:e.variant??e.enabled,SOi=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};var ZEr="0123456789abcdef",evr=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length===16)return new e(t);throw new TypeError("not 128-bit length")}static fromFieldsV7(t,r,n,i){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||t<0||r<0||n<0||i<0||t>0xffffffffffff||r>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");let o=new Uint8Array(16);return o[0]=t/2**40,o[1]=t/2**32,o[2]=t/2**24,o[3]=t/2**16,o[4]=t/256,o[5]=t,o[6]=112|r>>>8,o[7]=r,o[8]=128|n>>>24,o[9]=n>>>16,o[10]=n>>>8,o[11]=n,o[12]=i>>>24,o[13]=i>>>16,o[14]=i>>>8,o[15]=i,new e(o)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;default:break}if(r){let n=new Uint8Array(16);for(let i=0;i<16;i+=4){let o=parseInt(r.substring(2*i,2*i+8),16);n[i+0]=o>>>24,n[i+1]=o>>>16,n[i+2]=o>>>8,n[i+3]=o}return new e(n)}throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=ZEr.charAt(this.bytes[r]>>>4),t+=ZEr.charAt(15&this.bytes[r]),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=ZEr.charAt(this.bytes[r]>>>4),t+=ZEr.charAt(15&this.bytes[r]);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let n=this.bytes[r]-t.bytes[r];if(n!==0)return Math.sign(n)}return 0}},BOi=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??o0f()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let n=this.generateOrAbortCore(t,r);return n===void 0&&(this.timestamp=0,n=this.generateOrAbortCore(t,r)),n}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else{if(!(t+r>=this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return evr.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}generateV4(){let t=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return t[6]=64|t[6]>>>4,t[8]=128|t[8]>>>2,evr.ofInner(t)}},o0f=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),S1a,sK=()=>s0f().toString(),s0f=()=>(S1a||(S1a=new BOi)).generate();var yF=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e})({});var a0f=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],B1a=function(e,t=[]){if(!e)return!1;let r=e.toLowerCase();return a0f.concat(t).some(n=>{let i=n.toLowerCase();return r.indexOf(i)!==-1})};var c0f=Array.isArray,O1a=Object.prototype,$Ny=O1a.hasOwnProperty,OOi=O1a.toString,POi=c0f||function(e){return OOi.call(e)==="[object Array]"};var TOi=e=>e===Object(e)&&!POi(e);var j9e=e=>e===void 0,JCt=e=>OOi.call(e)=="[object String]",P1a=e=>JCt(e)&&e.trim().length===0;var T1a=e=>OOi.call(e)=="[object Number]"&&e===e;var DOi=e=>e instanceof Error;function YCt(e){return e===null||typeof e!="object"}function VPe(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function D1a(e){return VPe(e,"ErrorEvent")}function tvr(e){return!j9e(Event)&&l0f(e,Event)}function R1a(e){return VPe(e,"Object")}function l0f(e,t){try{return e instanceof t}catch{return!1}}function XCt(e,t,r,n,i){return t>r&&(n.warn("min cannot be greater than max."),t=r),T1a(e)?e>r?(n.warn(" cannot be greater than max: "+r+". Using max value instead."),r):e<t?(n.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+i),XCt(i||r,t,r,n))}var p0f=864e5,rvr=class{constructor(t){this._buckets={},this._onBucketRateLimited=t._onBucketRateLimited,this._bucketSize=XCt(t.bucketSize,0,100,t._logger),this._refillRate=XCt(t.refillRate,0,this._bucketSize,t._logger),this._refillInterval=XCt(t.refillInterval,0,p0f,t._logger)}_applyRefill(t,r){let n=r-t.lastAccess,i=Math.floor(n/this._refillInterval);if(i>0){let o=i*this._refillRate;t.tokens=Math.min(t.tokens+o,this._bucketSize),t.lastAccess=t.lastAccess+i*this._refillInterval}}consumeRateLimit(t){let r=Date.now(),n=String(t),i=this._buckets[n];return i?this._applyRefill(i,r):(i={tokens:this._bucketSize,lastAccess:r},this._buckets[n]=i),i.tokens===0?!0:(i.tokens--,i.tokens===0&&this._onBucketRateLimited?.(t),i.tokens===0)}stop(){this._buckets={}}};var nvr=class{add(t){let r=sK();return this.promiseByIds[r]=t,t.catch(()=>{}).finally(()=>{delete this.promiseByIds[r]}),t}async join(){let t=Object.values(this.promiseByIds),r=t.length;for(;r>0;)await Promise.all(t),t=Object.values(this.promiseByIds),r=t.length}get length(){return Object.keys(this.promiseByIds).length}constructor(){this.promiseByIds={}}};function f0f(e=console){return{log:e.log.bind(e),warn:e.warn.bind(e),error:e.error.bind(e),debug:e.debug.bind(e)}}var F1a=(e,t,r)=>{function n(o,...s){t(()=>{let a=r[o];a(e,...s)})}return{info:(...o)=>{n("log",...o)},warn:(...o)=>{n("warn",...o)},error:(...o)=>{n("error",...o)},critical:(...o)=>{r.error(e,...o)},createLogger:o=>F1a(`${e} ${o}`,t,r)}},d0f=e=>e();function k1a(e,t=d0f){return F1a(e,t,f0f())}var L9e="Mobile",ovr="iOS",M9e="Android",Q1a="Tablet",ojy=M9e+" "+Q1a;var m0f="Apple",sjy=m0f+" Watch",N1a="Safari",svr="BlackBerry",j1a="Samsung",h0f=j1a+"Browser",g0f=j1a+" Internet",avr="Chrome",A0f=avr+" OS",y0f=avr+" "+ovr,M1a="Internet Explorer",b0f=M1a+" "+L9e,FOi="Opera",ajy=FOi+" Mini",L1a="Edge",E0f="Microsoft "+L1a,kOi="Firefox",v0f=kOi+" "+ovr,QOi="Nintendo",NOi="PlayStation",ivr="Xbox",I0f=M9e+" "+L9e,w0f=L9e+" "+N1a,ZCt="Windows",C0f=ZCt+" Phone";var U1a="Generic",ujy=U1a+" "+L9e.toLowerCase(),cjy=U1a+" "+Q1a.toLowerCase(),x0f="Konqueror",TP="(\\d+(\\.\\d+)?)",ROi=new RegExp("Version/"+TP),ljy=new RegExp(ivr,"i"),pjy=new RegExp(NOi+" \\w+","i"),fjy=new RegExp(QOi+" \\w+","i"),_0f=new RegExp(svr+"|PlayBook|BB10","i"),S0f={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000","5.1":"XP","5.2":"XP","6.0":"Vista","6.1":"7","6.2":"8","6.3":"8.1","6.4":"10","10.0":"10"};var djy={[b0f]:[new RegExp("rv:"+TP)],[E0f]:[new RegExp(L1a+"?\\/"+TP)],[avr]:[new RegExp("("+avr+"|CrMo)\\/"+TP)],[y0f]:[new RegExp("CriOS\\/"+TP)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+TP)],[N1a]:[ROi],[w0f]:[ROi],[FOi]:[new RegExp("("+FOi+"|OPR)\\/"+TP)],[kOi]:[new RegExp(kOi+"\\/"+TP)],[v0f]:[new RegExp("FxiOS\\/"+TP)],[x0f]:[new RegExp("Konqueror[:/]?"+TP,"i")],[svr]:[new RegExp(svr+" "+TP),ROi],[I0f]:[new RegExp("android\\s"+TP,"i")],[g0f]:[new RegExp(h0f+"\\/"+TP)],[M1a]:[new RegExp("(rv:|MSIE )"+TP)],Mozilla:[new RegExp("rv:"+TP)]};var mjy=[[new RegExp(ivr+"; "+ivr+" (.*?)[);]","i"),e=>[ivr,e&&e[1]||""]],[new RegExp(QOi,"i"),[QOi,""]],[new RegExp(NOi,"i"),[NOi,""]],[_0f,[svr,""]],[new RegExp(ZCt,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[C0f,""];if(new RegExp(L9e).test(t)&&!/IEMobile\b/.test(t))return[ZCt+" "+L9e,""];let r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){let n=r[1],i=S0f[n]||"";return/arm/i.test(t)&&(i="RT"),[ZCt,i]}return[ZCt,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){let t=[e[3],e[4],e[5]||"0"];return[ovr,t.join(".")]}return[ovr,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=j9e(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+M9e+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+M9e+")","i"),e=>{if(e&&e[2]){let t=[e[2],e[3],e[4]||"0"];return[M9e,t.join(".")]}return[M9e,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=["Mac OS X",""];if(e&&e[1]){let r=[e[1],e[2],e[3]||"0"];t[1]=r.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[A0f,""]],[/Linux|debian/i,["Linux",""]]];var z1a="utf8";function V1a(e,t){if(!e||typeof e!="string"||B0f(e))throw new Error(t)}function B0f(e){return e.trim().length===0}function q1a(e){return e?.replace(/\/+$/,"")}async function G1a(e,t){let r=null;for(let n=0;n<t.retryCount+1;n++){n>0&&await new Promise(i=>setTimeout(i,t.retryDelay));try{return await e()}catch(i){if(r=i,!t.retryCheck(i))throw i}}throw r}function uvr(){return new Date().toISOString()}function qPe(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var W1a=e=>e instanceof Error;function jOi(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var cvr=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(n=>n!==r)}}emit(t,r){for(let n of this.events[t]||[])n(r);for(let n of this.events["*"]||[])n(t,r)}};function $1a(){return"CompressionStream"in globalThis}async function MOi(e,t=!0){try{let n=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return await new Response(n).blob()}catch(r){return t&&console.error("Failed to gzip compress data",r),null}}var GPe=class extends Error{constructor(t,r){super("HTTP error while fetching PostHog: status="+t.status+", reqByteLength="+r),this.response=t,this.reqByteLength=r,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}},U9e=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function H1a(e){if(e instanceof GPe){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function LOi(e){return typeof e=="object"&&(e instanceof GPe||e instanceof U9e)}function K1a(e){return typeof e=="object"&&e instanceof GPe&&e.status===413}var ext=class{constructor(t,r={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new nvr,this._events=new cvr,this._isInitialized=!1,V1a(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=q1a(r.host||"https://us.i.posthog.com"),this.flushAt=r.flushAt?Math.max(r.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,r.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,r.maxQueueSize??1e3),this.flushInterval=r.flushInterval??1e4,this.preloadFeatureFlags=r.preloadFeatureFlags??!0,this.defaultOptIn=r.defaultOptIn??!0,this.disableSurveys=r.disableSurveys??!1,this._retryOptions={retryCount:r.fetchRetryCount??3,retryDelay:r.fetchRetryDelay??3e3,retryCheck:LOi},this.requestTimeout=r.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=r.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=r.disableGeoip??!0,this.disabled=r.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0,this._logger=k1a("[PostHog]",this.logMsgIfDebug.bind(this)),this.evaluationContexts=r?.evaluationContexts??r?.evaluationEnvironments,r?.evaluationEnvironments&&!r?.evaluationContexts&&this._logger.warn("evaluationEnvironments is deprecated. Use evaluationContexts instead. This property will be removed in a future version."),this.disableCompression=!$1a()||(r?.disableCompression??!1)}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(yF.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(yF.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(yF.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(n,i)=>this._logger.info(n,i));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){return this.promiseQueue.add(t)}identifyStateless(t,r,n){this.wrap(()=>{let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",i,n)})}async identifyStatelessImmediate(t,r,n){let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",i,n)}captureStateless(t,r,n,i){this.wrap(()=>{let o=this.buildPayload({distinct_id:t,event:r,properties:n});this.enqueue("capture",o,i)})}async captureStatelessImmediate(t,r,n,i){let o=this.buildPayload({distinct_id:t,event:r,properties:n});await this.sendImmediate("capture",o,i)}aliasStateless(t,r,n,i){this.wrap(()=>{let o=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});this.enqueue("alias",o,i)})}async aliasStatelessImmediate(t,r,n,i){let o=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",o,i)}groupIdentifyStateless(t,r,n,i,o,s){this.wrap(()=>{let a=this.buildPayload({distinct_id:o||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:n||{},...s||{}}});this.enqueue("capture",a,i)})}async getRemoteConfig(){await this._initPromise;let t=this.host;t==="https://us.i.posthog.com"?t="https://us-assets.i.posthog.com":t==="https://eu.i.posthog.com"&&(t="https://eu-assets.i.posthog.com");let r=`${t}/array/${this.apiKey}/config`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,n,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(i=>i.json()).catch(i=>{this._logger.error("Remote config could not be loaded",i),this._events.emit("error",i)})}async getFlags(t,r={},n={},i={},o={},s=!0){await this._initPromise;let a=s?"&config=true":"",u=`${this.host}/flags/?v=2${a}`,c={token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i,...o};this.evaluationContexts&&this.evaluationContexts.length>0&&(c.evaluation_contexts=this.evaluationContexts);let l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(c)};return this._logger.info("Flags URL",u),this.fetchWithRetry(u,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(p=>p.json()).then(p=>({success:!0,response:_Oi(p)})).catch(p=>(this._events.emit("error",p),{success:!1,error:this.categorizeRequestError(p)}))}categorizeRequestError(t){if(t instanceof GPe)return{type:"api_error",statusCode:t.status};if(t instanceof U9e){let r=t.error;return r instanceof Error&&(r.name==="AbortError"||r.name==="TimeoutError")?{type:"timeout"}:{type:"connection_error"}}return{type:"unknown_error"}}async getFeatureFlagStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagDetailStateless(t,r,n,i,o,s);if(a===void 0)return{response:void 0,requestId:void 0};let u=KCt(a.response);return u===void 0&&(u=!1),{response:u,requestId:a.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagDetailsStateless(r,n,i,o,s,[t]);return a===void 0?void 0:{response:a.flags[t],requestId:a.requestId,evaluatedAt:a.evaluatedAt}}async getFeatureFlagPayloadStateless(t,r,n={},i={},o={},s){await this._initPromise;let a=await this.getFeatureFlagPayloadsStateless(r,n,i,o,s,[t]);if(!a)return;let u=a[t];return u===void 0?null:u}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},o,s){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,o,s)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},o,s){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,o,s)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},o,s){await this._initPromise;let a=await this.getFeatureFlagDetailsStateless(t,r,n,i,o,s);return a?{flags:a.featureFlags,payloads:a.featureFlagPayloads,requestId:a.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},n={},i={},o,s){await this._initPromise;let a={};(o??this.disableGeoip)&&(a.geoip_disable=!0),s&&(a.flag_keys_to_evaluate=s);let u=await this.getFlags(t,r,n,i,a);if(!u.success)return;let c=u.response;return c.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),c.quotaLimited?.includes("feature_flags")?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:c?.requestId,quotaLimited:c.quotaLimited}):c}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this._logger.info("Loading surveys is disabled."),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},i=(await this.fetchWithRetry(t,r).then(o=>{if(o.status!==200||!o.json){let s=`Surveys API could not be loaded: ${o.status}`,a=new Error(s);this._logger.error(a),this._events.emit("error",new Error(s));return}return o.json()}).catch(o=>{this._logger.error("Surveys API could not be loaded",o),this._events.emit("error",o)}))?.surveys;return i&&this._logger.info("Surveys fetched from API: ",JSON.stringify(i)),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(yF.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(yF.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(yF.Props,this.props)})}processBeforeEnqueue(t){return t}async flushStorage(){}enqueue(t,r,n){this.wrap(()=>{if(this.optedOut)return void this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(t,r,n);if(i=this.processBeforeEnqueue(i),i===null)return;let o=this.getPersistedProperty(yF.Queue)||[];o.length>=this.maxQueueSize&&(o.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),o.push({message:i}),this.setPersistedProperty(yF.Queue,o),this._events.emit(t,i),o.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=qPe(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,n){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized||await this._initPromise,this.optedOut)return void this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(t,r,n);if(i=this.processBeforeEnqueue(i),i===null)return;let o={api_key:this.apiKey,batch:[i],sent_at:uvr()};this.historicalMigration&&(o.historical_migration=!0);let s=JSON.stringify(o),a=`${this.host}/batch/`,u=this.disableCompression?null:await MOi(s,this.isDebug),c={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...u!==null&&{"Content-Encoding":"gzip"}},body:u||s};try{await this.fetchWithRetry(a,c)}catch(l){this._events.emit("error",l)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:uvr(),uuid:n?.uuid?n.uuid:sK()};return(n?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await H1a(t)})}async flush(){let t=jOi([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),jOi([t]).then(()=>{this.flushPromise===t&&(this.flushPromise=null)}),t}getCustomHeaders(){let t=this.getCustomUserAgent(),r={};return t&&t!==""&&(r["User-Agent"]=t),r}async _flush(){this.clearFlushTimer(),await this._initPromise;let t=this.getPersistedProperty(yF.Queue)||[];if(!t.length)return;let r=[],n=t.length;for(;t.length>0&&r.length<n;){let i=t.slice(0,this.maxBatchSize),o=i.map(f=>f.message),s=async()=>{let m=(this.getPersistedProperty(yF.Queue)||[]).slice(i.length);this.setPersistedProperty(yF.Queue,m),t=m,await this.flushStorage()},a={api_key:this.apiKey,batch:o,sent_at:uvr()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),c=`${this.host}/batch/`,l=this.disableCompression?null:await MOi(u,this.isDebug),p={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...l!==null&&{"Content-Encoding":"gzip"}},body:l||u},d={retryCheck:f=>K1a(f)?!1:LOi(f)};try{await this.fetchWithRetry(c,p,d)}catch(f){if(K1a(f)&&o.length>1){this.maxBatchSize=Math.max(1,Math.floor(o.length/2)),this._logger.warn(`Received 413 when sending batch of size ${o.length}, reducing batch size to ${this.maxBatchSize}`);continue}throw f instanceof U9e||await s(),this._events.emit("error",f),f}await s(),r.push(...o)}this._events.emit("flush",r)}async fetchWithRetry(t,r,n,i){AbortSignal.timeout??=function(a){let u=new AbortController;return setTimeout(()=>u.abort(),a),u.signal};let o=r.body?r.body:"",s=-1;try{s=o instanceof Blob?o.size:Buffer.byteLength(o,z1a)}catch{o instanceof Blob?s=o.size:s=new TextEncoder().encode(o).length}return await G1a(async()=>{let a=null;try{a=await this.fetch(t,{signal:AbortSignal.timeout(i??this.requestTimeout),...r})}catch(c){throw new U9e(c)}if(!(r.mode==="no-cors")&&(a.status<200||a.status>=400))throw new GPe(a,s);return a},{...this._retryOptions,...n})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let n=async()=>{try{for(await this.promiseQueue.join();!((this.getPersistedProperty(yF.Queue)||[]).length===0||(await this.flush(),r)););}catch(i){if(!LOi(i))throw i;await H1a(i)}};return Promise.race([new Promise((i,o)=>{qPe(()=>{this._logger.error("Timed out while shutting down PostHog"),r=!0,o("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),n()])}async shutdown(t=3e4){return this.shutdownPromise?this._logger.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup"):this.shutdownPromise=this._shutdown(t).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}};var bF={};Y(bF,{DOMExceptionCoercer:()=>qOi,ErrorCoercer:()=>GOi,ErrorEventCoercer:()=>WOi,ErrorPropertiesBuilder:()=>UOi,EventCoercer:()=>KOi,ObjectCoercer:()=>HOi,PrimitiveCoercer:()=>JOi,PromiseRejectionEventCoercer:()=>YOi,ReduceableCache:()=>XOi,StringCoercer:()=>$Oi,chromeStackLineParser:()=>zOi,createDefaultStackParser:()=>V0f,createStackParser:()=>sSa,geckoStackLineParser:()=>VOi,nodeStackLineParser:()=>rSa,opera10StackLineParser:()=>Z1a,opera11StackLineParser:()=>eSa,reverseAndStripFrames:()=>oSa,winjsStackLineParser:()=>X1a});var lvr,J1a,pvr;function Y1a(e){let t=globalThis._posthogChunkIds;if(!t)return;let r=Object.keys(t);return pvr&&r.length===J1a||(J1a=r.length,pvr=r.reduce((n,i)=>{lvr||(lvr={});let o=lvr[i];if(o)n[o[0]]=o[1];else{let s=e(i);for(let a=s.length-1;a>=0;a--){let c=s[a]?.filename,l=t[i];if(c&&l){n[c]=l,lvr[i]=[c,l];break}}}return n},{})),pvr}var P0f=4,UOi=class{constructor(t,r,n=[]){this.coercers=t,this.stackParser=r,this.modifiers=n}buildFromUnknown(t,r={}){let i=r&&r.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,r,0).apply(t),a=this.buildParsingContext(r),u=this.parseStacktrace(s,a);return{$exception_list:this.convertToExceptionList(u,i),$exception_level:"error"}}async modifyFrames(t){for(let r of t)r.stacktrace&&r.stacktrace.frames&&POi(r.stacktrace.frames)&&(r.stacktrace.frames=await this.applyModifiers(r.stacktrace.frames));return t}coerceFallback(t){return{type:"Error",value:"Unknown error",stack:t.syntheticException?.stack,synthetic:!0}}parseStacktrace(t,r){let n;t.cause!=null&&(n=this.parseStacktrace(t.cause,r));let i;return t.stack!=""&&t.stack!=null&&(i=this.applyChunkIds(this.stackParser(t.stack,t.synthetic?r.skipFirstLines:0),r.chunkIdMap)),{...t,cause:n,stack:i}}applyChunkIds(t,r){return t.map(n=>(n.filename&&r&&(n.chunk_id=r[n.filename]),n))}applyCoercers(t,r){for(let n of this.coercers)if(n.match(t))return n.coerce(t,r);return this.coerceFallback(r)}async applyModifiers(t){let r=t;for(let n of this.modifiers)r=await n(r);return r}convertToExceptionList(t,r){let n={type:t.type,value:t.value,mechanism:{type:r.type??"generic",handled:r.handled??!0,synthetic:t.synthetic??!1}};t.stack&&(n.stacktrace={type:"raw",frames:t.stack});let i=[n];return t.cause!=null&&i.push(...this.convertToExceptionList(t.cause,{...r,handled:!0})),i}buildParsingContext(t){return{chunkIdMap:Y1a(this.stackParser),skipFirstLines:t.skipFirstLines??1}}buildCoercingContext(t,r,n=0){let i=(s,a)=>{if(a<=P0f){let u=this.buildCoercingContext(t,r,a);return this.applyCoercers(s,u)}};return{...r,syntheticException:n==0?r.syntheticException:void 0,mechanism:t,apply:s=>i(s,n),next:s=>i(s,n+1)}}};var i1="?";function aK(e,t,r,n,i){let o={platform:e,filename:t,function:r==="<anonymous>"?i1:r,in_app:!0};return j9e(n)||(o.lineno=n),j9e(i)||(o.colno=i),o}var fvr=(e,t)=>{let r=e.indexOf("safari-extension")!==-1,n=e.indexOf("safari-web-extension")!==-1;return r||n?[e.indexOf("@")!==-1?e.split("@")[0]:i1,r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]};var T0f=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,D0f=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,R0f=/\((\S*)(?::(\d+))(?::(\d+))\)/,zOi=(e,t)=>{let r=T0f.exec(e);if(r){let[,i,o,s]=r;return aK(t,i,i1,+o,+s)}let n=D0f.exec(e);if(n){if(n[2]&&n[2].indexOf("eval")===0){let a=R0f.exec(n[2]);a&&(n[2]=a[1],n[3]=a[2],n[4]=a[3])}let[o,s]=fvr(n[1]||i1,n[2]);return aK(t,s,o,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}};var F0f=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,k0f=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,VOi=(e,t)=>{let r=F0f.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){let s=k0f.exec(r[3]);s&&(r[1]=r[1]||"eval",r[3]=s[1],r[4]=s[2],r[5]="")}let i=r[3],o=r[1]||i1;return[o,i]=fvr(o,i),aK(t,i,o,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}};var Q0f=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,X1a=(e,t)=>{let r=Q0f.exec(e);return r?aK(t,r[2],r[1]||i1,+r[3],r[4]?+r[4]:void 0):void 0};var N0f=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,Z1a=(e,t)=>{let r=N0f.exec(e);return r?aK(t,r[2],r[3]||i1,+r[1]):void 0},j0f=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,eSa=(e,t)=>{let r=j0f.exec(e);return r?aK(t,r[5],r[3]||r[4]||i1,+r[1],+r[2]):void 0};var M0f=/^\s*[-]{4,}$/,L0f=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,rSa=(e,t)=>{let r=e.match(L0f);if(r){let n,i,o,s,a;if(r[1]){o=r[1];let l=o.lastIndexOf(".");if(o[l-1]==="."&&l--,l>0){n=o.slice(0,l),i=o.slice(l+1);let p=n.indexOf(".Module");p>0&&(o=o.slice(p+1),n=n.slice(0,p))}s=void 0}i&&(s=n,a=i),i==="<anonymous>"&&(a=void 0,o=void 0),o===void 0&&(a=a||i1,o=s?`${s}.${a}`:a);let u=r[2]?.startsWith("file://")?r[2].slice(7):r[2],c=r[5]==="native";return u?.match(/\/[A-Z]:/)&&(u=u.slice(1)),!u&&r[5]&&!c&&(u=r[5]),{filename:u?decodeURI(u):void 0,module:void 0,function:o,lineno:tSa(r[3]),colno:tSa(r[4]),in_app:U0f(u||"",c),platform:t}}if(e.match(M0f))return{filename:e,platform:t}};function U0f(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function tSa(e){return parseInt(e||"",10)||void 0}var nSa=/\(error: (.*)\)/,iSa=50;function oSa(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,iSa).map(r=>({...r,filename:r.filename||z0f(t).filename,function:r.function||i1}))}function z0f(e){return e[e.length-1]||{}}function V0f(){return sSa("web:javascript",zOi,VOi)}function sSa(e,...t){return(r,n=0)=>{let i=[],o=r.split(`
|
|
1656
|
-
`);for(let s=n;s<o.length;s++){let a=o[s];if(a.length>1024)continue;let u=nSa.test(a)?a.replace(nSa,"$1"):a;if(!u.match(/\S*Error: /)){for(let c of t){let l=c(u,e);if(l){i.push(l);break}}if(i.length>=iSa)break}}return oSa(i)}}var qOi=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let n=JCt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:n?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){let r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${r}: ${t.message}`:r}isDOMException(t){return VPe(t,"DOMException")}isDOMError(t){return VPe(t,"DOMError")}};var GOi=class{match(t){return DOi(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){let n=t.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(t){return t.stacktrace||t.stack||void 0}};var WOi=class{constructor(){}match(t){return D1a(t)&&t.error!=null}coerce(t,r){let n=r.apply(t.error);return n||{type:"ErrorEvent",value:t.message,stack:r.syntheticException?.stack,synthetic:!0}}};var q0f=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,$Oi=class{match(t){return typeof t=="string"}coerce(t,r){let[n,i]=this.getInfos(t);return{type:n??"Error",value:i??t,stack:r.syntheticException?.stack,synthetic:!0}}getInfos(t){let r="Error",n=t,i=t.match(q0f);return i&&(r=i[1],n=i[2]),[r,n]}};var aSa=["fatal","error","warning","log","info","debug"];function dvr(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let n=r.length;n>0;n--){let i=r.slice(0,n).join(", ");if(!(i.length>t))return n===r.length||i.length<=t?i:`${i.slice(0,t)}...`}return""}var HOi=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){let n=this.getErrorPropertyFromObject(t);return n?r.apply(n):{type:this.getType(t),value:this.getValue(t),stack:r.syntheticException?.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return tvr(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let i=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(i+=` with message: '${t.message}'`),i}if("message"in t&&typeof t.message=="string")return t.message;let r=this.getObjectClassName(t),n=dvr(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${n}`}isSeverityLevel(t){return JCt(t)&&!P1a(t)&&aSa.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];if(W1a(n))return n}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var KOi=class{match(t){return tvr(t)}coerce(t,r){let n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${dvr(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var JOi=class{match(t){return YCt(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var YOi=class{match(t){return VPe(t,"PromiseRejectionEvent")}coerce(t,r){let n=this.getUnhandledRejectionReason(t);return YCt(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(t){if(YCt(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var XOi=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}};var lSa=require("fs"),pSa=require("readline"),mvr=new bF.ReduceableCache(25),fSa=new bF.ReduceableCache(20),ZOi=7,G0f=1e3,W0f=1e4;async function dSa(e){let t={};for(let i=e.length-1;i>=0;i--){let o=e[i],s=o?.filename;if(!o||typeof s!="string"||typeof o.lineno!="number"||J0f(s)||Y0f(o))continue;t[s]||(t[s]=[]),t[s].push(o.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(fSa.get(i))continue;let o=t[i];if(!o)continue;o.sort((u,c)=>u-c);let s=Z0f(o);if(s.every(u=>X0f(i,u)))continue;let a=eEf(mvr,i,{});n.push($0f(i,s,a))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&H0f(e,mvr),mvr.reduce(),e}function $0f(e,t,r){return new Promise(n=>{let i=(0,lSa.createReadStream)(e),o=(0,pSa.createInterface)({input:i});function s(){i.destroy(),n()}let a=0,u=0,c=t[u];if(c===void 0)return void s();let l=c[0],p=c[1];function d(){fSa.set(e,1),o.close(),o.removeAllListeners(),s()}i.on("error",d),o.on("error",d),o.on("close",s),o.on("line",f=>{if(a++,!(a<l)&&(r[a]=tEf(f,0),a>=p)){if(u===t.length-1){o.close(),o.removeAllListeners();return}u++;let m=t[u];if(m===void 0){o.close(),o.removeAllListeners();return}l=m[0],p=m[1]}})})}function H0f(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;K0f(r.lineno,r,n)}}function K0f(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=mSa(e);i<e;i++){let o=r[i];if(o===void 0)return void uSa(t);t.pre_context.push(o)}if(r[e]===void 0)return void uSa(t);t.context_line=r[e];let n=hSa(e);t.post_context=[];for(let i=e+1;i<=n;i++){let o=r[i];if(o===void 0)break;t.post_context.push(o)}}function uSa(e){delete e.pre_context,delete e.context_line,delete e.post_context}function J0f(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function Y0f(e){return e.lineno!==void 0&&e.lineno>W0f||e.colno!==void 0&&e.colno>G0f}function X0f(e,t){let r=mvr.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function Z0f(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=cSa(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let o=e[t+1];if(typeof o!="number")break;o<=n[1]?n[1]=o+ZOi:(i.push(n),n=cSa(o)),t++}return i}function cSa(e){return[mSa(e),hSa(e)]}function mSa(e){return Math.max(1,e-ZOi)}function hSa(e){return e+ZOi}function eEf(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function tEf(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let o=Math.min(i+140,n);return o>n-5&&(o=n),o===n&&(i=Math.max(o-140,0)),r=r.slice(i,o),i>0&&(r=`...${r}`),o<n&&(r+="..."),r}function rEf(e,t){let r=!1;return Object.assign(n=>{let o=global.process.listeners("uncaughtException").filter(s=>s.name!=="domainUncaughtExceptionClear"&&s._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&o&&(r=!0,t(n))},{_posthogErrorHandler:!0})}function gSa(e,t){globalThis.process?.on("uncaughtException",rEf(e,t))}function ASa(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var nEf=2e3,sV=class e{constructor(t,r,n){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=n,this._rateLimiter=new rvr({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(t){return TOi(t)&&"__posthog_previously_captured_error"in t&&t.__posthog_previously_captured_error===!0}static async buildEventMessage(t,r,n,i){let o={...i};n||(o.$process_person_profile=!1);let s=this.errorPropertiesBuilder.buildFromUnknown(t,r);return s.$exception_list=await this.errorPropertiesBuilder.modifyFrames(s.$exception_list),{event:"$exception",distinctId:n||sK(),properties:{...s,...o},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){this.isEnabled()&&(gSa(this.onException.bind(this),this.onFatalError.bind(this)),ASa(this.onException.bind(this)))}onException(t,r){this.client.addPendingPromise((async()=>{if(!e.isPreviouslyCapturedError(t)){let n=await e.buildEventMessage(t,r),o=n.properties?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(o)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:o}):this.client.capture(n)}})())}async onFatalError(t){console.error(t),await this.client.shutdown(nEf),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var ySa="5.26.2";var txt={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function bSa(e){let t=globalThis.crypto?.subtle;if(!t)throw new Error("SubtleCrypto API not available");let r=await t.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}var iEf=6e4,oEf=1152921504606847e3,sEf=["is_not"],z9e=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},ah=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},uK=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},hvr=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:o,customHeaders:s,...a}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=o,this.poller=void 0,this.fetch=a.fetch||fetch,this.onError=a.onError,this.customHeaders=s,this.onLoad=a.onLoad,this.cacheProvider=a.cacheProvider,this.strictLocalEvaluation=a.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}createEvaluationContext(t,r={},n={},i={},o={}){return{distinctId:t,groups:r,personProperties:n,groupProperties:i,evaluationCache:o}}async getFeatureFlag(t,r,n={},i={},o={}){await this.loadFeatureFlags();let s,a;if(!this.loadedSuccessfullyOnce)return s;if(a=this.featureFlagsByKey[t],a!==void 0){let u=this.createEvaluationContext(r,n,i,o);try{s=(await this.computeFlagAndPayloadLocally(a,u)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${s}`))}catch(c){c instanceof uK||c instanceof ah?this.logMsgIfDebug(()=>console.debug(`${c.name} when computing flag locally: ${t}: ${c.message}`)):c instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${c}`))}}return s}async getAllFlagsAndPayloads(t,r){await this.loadFeatureFlags();let n={},i={},o=this.featureFlags.length==0,s=r?r.map(u=>this.featureFlagsByKey[u]).filter(Boolean):this.featureFlags,a={...t,evaluationCache:t.evaluationCache??{}};return await Promise.all(s.map(async u=>{try{let{value:c,payload:l}=await this.computeFlagAndPayloadLocally(u,a);n[u.key]=c,l&&(i[u.key]=l)}catch(c){c instanceof uK||c instanceof ah?this.logMsgIfDebug(()=>console.debug(`${c.name} when computing flag locally: ${u.key}: ${c.message}`)):c instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${u.key}: ${c}`)),o=!0}})),{response:n,payloads:i,fallbackToFlags:o}}async computeFlagAndPayloadLocally(t,r,n={}){let{matchValue:i,skipLoadCheck:o=!1}=n;if(o||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let s;s=i!==void 0?i:await this.computeFlagValueLocally(t,r);let a=this.getFeatureFlagPayload(t.key,s);return{value:s,payload:a}}async computeFlagValueLocally(t,r){let{distinctId:n,groups:i,personProperties:o,groupProperties:s}=r;if(t.ensure_experience_continuity)throw new ah("Flag has experience continuity enabled");if(!t.active)return!1;let u=(t.filters||{}).aggregation_group_type_index;if(u!=null){let c=this.groupTypeMapping[String(u)];if(!c)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${u} for feature flag ${t.key}`)),new ah("Flag has unknown group type index");if(!(c in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;t.bucketing_identifier==="device_id"&&(o?.$device_id===void 0||o?.$device_id===null||o?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${t.key}`));let l=s[c];return await this.matchFeatureFlagProperties(t,i[c],l,r)}{let c=this.getBucketingValueForFlag(t,n,o);if(c===void 0)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${t.key} without $device_id, falling back to server evaluation`)),new ah(`Can't compute feature flag: ${t.key} without $device_id`);return await this.matchFeatureFlagProperties(t,c,o,r)}}getBucketingValueForFlag(t,r,n){if(t.filters?.aggregation_group_type_index!=null)return r;if(t.bucketing_identifier==="device_id"){let i=n?.$device_id;return i==null||i===""?void 0:i}return r}getFeatureFlagPayload(t,r){let n=null;if(r!==!1&&r!=null&&(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]||null:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]||null),n!=null)){if(typeof n=="object")return n;if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}return null}async evaluateFlagDependency(t,r,n){let{evaluationCache:i}=n,o=t.key;if(!this.featureFlagsByKey)throw new ah("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new ah(`Flag dependency property for '${o}' is missing required 'dependency_chain' field`);let s=t.dependency_chain;if(!Array.isArray(s))throw new ah(`Flag dependency property for '${o}' has an invalid 'dependency_chain' (expected array, got ${typeof s})`);if(s.length===0)throw new ah(`Circular dependency detected for flag '${o}' (empty dependency chain)`);for(let u of s){if(!(u in i)){let l=this.featureFlagsByKey[u];if(l)if(l.active)try{let p=await this.computeFlagValueLocally(l,n);i[u]=p}catch(p){throw new ah(`Error evaluating flag dependency '${u}' for flag '${o}': ${p}`)}else i[u]=!1;else throw new ah(`Missing flag dependency '${u}' for flag '${o}'`)}if(i[u]==null)throw new ah(`Dependency '${u}' could not be evaluated`)}let a=i[o];return this.flagEvaluatesToExpectedValue(t.value,a)}flagEvaluatesToExpectedValue(t,r){return typeof t=="boolean"?t===r||typeof r=="string"&&r!==""&&t===!0:typeof t=="string"?r===t:!1}async matchFeatureFlagProperties(t,r,n,i){let o=t.filters||{},s=o.groups||[],a=!1,u;for(let c of s)try{if(await this.isConditionMatch(t,r,c,n,i)){let l=c.variant,p=o.multivariate?.variants||[];u=l&&p.some(d=>d.key===l)?l:await this.getMatchingVariant(t,r)||!0;break}}catch(l){if(l instanceof uK)throw l;if(l instanceof ah)a=!0;else throw l}if(u!==void 0)return u;if(a)throw new ah("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i,o){let s=n.rollout_percentage,a=u=>{this.logMsgIfDebug(()=>console.warn(u))};if((n.properties||[]).length>0){for(let u of n.properties){let c=u.type,l=!1;if(l=c==="cohort"?CSa(u,i,this.cohorts,this.debugMode):c==="flag"?await this.evaluateFlagDependency(u,i,o):wSa(u,i,a),!l)return!1}if(s==null)return!0}return!(s!=null&&await ESa(t.key,r)>s/100)}async getMatchingVariant(t,r){let n=await ESa(t.key,r,"variant"),i=this.variantLookupTable(t).find(o=>n>=o.valueMin&&n<o.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(a=>{i=n+a.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:a.key}),n=i}),r}updateFlagState(t){this.featureFlags=t.flags,this.featureFlagsByKey=t.flags.reduce((r,n)=>(r[n.key]=n,r),{}),this.groupTypeMapping=t.groupTypeMapping,this.cohorts=t.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(t){if(this.strictLocalEvaluation)return;let r=t.filter(n=>n.ensure_experience_continuity);r.length>0&&console.warn(`[PostHog] You are using local evaluation but ${r.length} flag(s) have experience continuity enabled: ${r.map(n=>n.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(t){if(!this.cacheProvider)return!1;try{let r=await this.cacheProvider.getFlagDefinitions();return r?(this.updateFlagState(r),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${t} (${r.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(r.flags),!0):!1}catch(r){return this.onError?.(new Error(`Failed to load from cache: ${r}`)),!1}}async loadFeatureFlags(t=!1){if(!(this.loadedSuccessfullyOnce&&!t))return!t&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(r=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${r}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(iEf,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let t=!0;if(this.cacheProvider)try{t=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(n){this.onError?.(new Error(`Error in shouldFetchFlagDefinitions: ${n}`))}if(!t&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let r=await this._requestFeatureFlagDefinitions();if(!r)return;switch(r.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=r.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new z9e(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.beginBackoff(),new z9e(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.beginBackoff(),new z9e(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let n=await r.json()??{};if(!("flags"in n))return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(n)}`));this.flagsEtag=r.headers?.get("ETag")??void 0;let i={flags:n.flags??[],groupTypeMapping:n.group_type_mapping||{},cohorts:n.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&t)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(o){this.onError?.(new Error(`Failed to store in cache: ${o}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(t){t instanceof z9e&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET",r){let n={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return r&&(n["If-None-Match"]=r),{method:t,headers:n}}_requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=qPe(()=>{i.abort()},this.timeout),r.signal=i.signal}try{let i=this.fetch;return i(t,r)}finally{clearTimeout(n)}}async stopPoller(t=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let r=this.cacheProvider.shutdown();r instanceof Promise&&await Promise.race([r,new Promise((n,i)=>setTimeout(()=>i(new Error(`Cache shutdown timeout after ${t}ms`)),t))])}catch(r){this.onError?.(new Error(`Error during cache shutdown: ${r}`))}}};async function ESa(e,t,r=""){let n=await bSa(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/oEf}function wSa(e,t,r){let n=e.key,i=e.value,o=e.operator||"exact";if(n in t){if(o==="is_not_set")throw new ah("Operator is_not_set is not supported")}else throw new ah(`Property ${n} not found in propertyValues`);let s=t[n];if(s==null&&!sEf.includes(o))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${o} operator`),!1;function a(c,l){return Array.isArray(c)?c.map(p=>String(p).toLowerCase()).includes(String(l).toLowerCase()):String(c).toLowerCase()===String(l).toLowerCase()}function u(c,l,p){if(p==="gt")return c>l;if(p==="gte")return c>=l;if(p==="lt")return c<l;if(p==="lte")return c<=l;throw new Error(`Invalid operator: ${p}`)}switch(o){case"exact":return a(i,s);case"is_not":return!a(i,s);case"is_set":return n in t;case"icontains":return String(s).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(s).toLowerCase().includes(String(i).toLowerCase());case"regex":return vSa(String(i))&&String(s).match(String(i))!==null;case"not_regex":return vSa(String(i))&&String(s).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let c=typeof i=="number"?i:null;if(typeof i=="string")try{c=parseFloat(i)}catch{}return c==null||s==null?u(String(s),String(i),o):typeof s=="string"?u(s,String(i),o):u(s,c,o)}case"is_date_after":case"is_date_before":{if(typeof i=="boolean")throw new ah("Date operations cannot be performed on boolean values");let c=uEf(String(i));if(c==null&&(c=ISa(i)),c==null)throw new ah(`Invalid date: ${i}`);let l=ISa(s);return["is_date_before"].includes(o)?l<c:l>c}default:throw new ah(`Unknown operator: ${o}`)}}function aEf(e,t){if(!(e in t))throw new uK(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}function CSa(e,t,r,n=!1){let i=String(e.value);aEf(i,r);let o=r[i];return xSa(o,t,r,n)}function xSa(e,t,r,n=!1){if(!e)return!0;let i=e.type,o=e.values;if(!o||o.length===0)return!0;let s=!1;if("values"in o[0]){for(let a of o)try{let u=xSa(a,t,r,n);if(i==="AND"){if(!u)return!1}else if(u)return!0}catch(u){if(u instanceof uK)throw u;if(u instanceof ah)n&&console.debug(`Failed to compute property ${a} locally: ${u}`),s=!0;else throw u}if(s)throw new ah("Can't match cohort without a given cohort property value");return i==="AND"}for(let a of o)try{let u;if(a.type==="cohort")u=CSa(a,t,r,n);else if(a.type==="flag"){n&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${a.key||"unknown"}'`);continue}else u=wSa(a,t);let c=a.negation||!1;if(i==="AND"){if(!u&&!c||u&&c)return!1}else if(u&&!c||!u&&c)return!0}catch(u){if(u instanceof uK)throw u;if(u instanceof ah)n&&console.debug(`Failed to compute property ${a} locally: ${u}`),s=!0;else throw u}if(s)throw new ah("can't match cohort without a given cohort property value");return i==="AND"}function vSa(e){try{return new RegExp(e),!0}catch{return!1}}function ISa(e){if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new ah(`${e} is in an invalid date format`)}throw new ah(`The date provided ${e} must be a string, number, or date object`)}function uEf(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(!r)return null;{if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let o=r.groups.interval;if(o=="h")n.setUTCHours(n.getUTCHours()-i);else if(o=="d")n.setUTCDate(n.getUTCDate()-i);else if(o=="w")n.setUTCDate(n.getUTCDate()-7*i);else if(o=="m")n.setUTCMonth(n.getUTCMonth()-i);else{if(o!="y")return null;n.setUTCFullYear(n.getUTCFullYear()-i)}return n}}var gvr=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var cEf=100,_Sa=3e4,lEf=5e4,Avr=class extends ext{constructor(t,r={}){if(super(t,r),this._memoryStorage=new gvr,this.options=r,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,cEf):_Sa,r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');r.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new hvr({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders(),cacheProvider:r.flagDefinitionCacheProvider,strictLocalEvaluation:r.strictLocalEvaluation}))}this.errorTracking=new sV(this,r,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||lEf}getPersistedProperty(t){return this._memoryStorage.getProperty(t)}setPersistedProperty(t,r){return this._memoryStorage.setProperty(t,r)}fetch(t,r){return this.options.fetch?this.options.fetch(t,r):fetch(t,r)}getLibraryVersion(){return ySa}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStateless(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}async captureImmediate(t){return typeof t=="string"&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStatelessImmediate(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}identify({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStateless(t,l,{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStatelessImmediate(t,l,{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=_Sa){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",o=>{clearTimeout(n),i(),r(o>0)})})}_resolveDistinctId(t,r){return typeof t=="string"?{distinctId:t,options:r}:{distinctId:this.context?.get()?.distinctId,options:t}}async _getFeatureFlagResult(t,r,n={},i){let o=n.sendFeatureFlagEvents??!0;if(this._flagOverrides!==void 0&&t in this._flagOverrides){let w=this._flagOverrides[t];if(w===void 0)return;let x=this._payloadOverrides?.[t];return{key:t,enabled:w!==!1,variant:typeof w=="string"?w:void 0,payload:x}}let{groups:s,disableGeoip:a}=n,{onlyEvaluateLocally:u,personProperties:c,groupProperties:l}=n,p=this.addLocalPersonAndGroupProperties(r,s,c,l);c=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(r,s,c,l);u==null&&(u=this.options.strictLocalEvaluation??!1);let f,m=!1,h,g,A,E,v,b;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let w=this.featureFlagsPoller?.featureFlagsByKey[t];if(w)try{let x=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(w,d,{matchValue:i});if(x){m=!0;let C=x.value;E=w.id,b="Evaluated locally",f={key:t,enabled:C!==!1,variant:typeof C=="string"?C:void 0,payload:x.payload??void 0}}}catch(x){if(x instanceof uK||x instanceof ah)this._logger?.info(`${x.name} when computing flag locally: ${t}: ${x.message}`);else throw x}}if(!m&&!u){let w=await super.getFeatureFlagDetailsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,a,[t]);if(w===void 0)A=txt.UNKNOWN_ERROR;else{h=w.requestId,g=w.evaluatedAt;let x=[];w.errorsWhileComputingFlags&&x.push(txt.ERRORS_WHILE_COMPUTING),w.quotaLimited?.includes("feature_flags")&&x.push(txt.QUOTA_LIMITED);let C=w.flags[t];if(C===void 0)x.push(txt.FLAG_MISSING);else{E=C.metadata?.id,v=C.metadata?.version,b=C.reason?.description??C.reason?.code;let _;if(C.metadata?.payload!==void 0)try{_=JSON.parse(C.metadata.payload)}catch{_=C.metadata.payload}f={key:t,enabled:C.enabled,variant:C.variant,payload:_}}x.length>0&&(A=x.join(","))}}if(o){let w=f===void 0?void 0:f.enabled===!1?!1:f.variant??!0,x=`${t}_${w}`;if(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(x)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(x):this.distinctIdHasSentFlagCalls[r]=[x];let C={$feature_flag:t,$feature_flag_response:w,$feature_flag_id:E,$feature_flag_version:v,$feature_flag_reason:b,locally_evaluated:m,[`$feature/${t}`]:w,$feature_flag_request_id:h,$feature_flag_evaluated_at:m?Date.now():g};if(m&&this.featureFlagsPoller){let _=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();_!==void 0&&(C.$feature_flag_definitions_loaded_at=_)}A&&(C.$feature_flag_error=A),this.capture({distinctId:r,event:"$feature_flag_called",properties:C,groups:s,disableGeoip:a})}}return f!==void 0&&this._payloadOverrides!==void 0&&t in this._payloadOverrides&&(f={...f,payload:this._payloadOverrides[t]}),f}async getFeatureFlag(t,r,n){let i=await this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(i!==void 0)return i.enabled===!1?!1:i.variant??!0}async getFeatureFlagPayload(t,r,n,i){if(this._payloadOverrides!==void 0&&t in this._payloadOverrides)return this._payloadOverrides[t];let o=await this._getFeatureFlagResult(t,r,{...i,sendFeatureFlagEvents:!1},n);if(o!==void 0)return o.payload??null}async getFeatureFlagResult(t,r,n){let{distinctId:i,options:o}=this._resolveDistinctId(r,n);return i?this._getFeatureFlagResult(t,i,{...o,sendFeatureFlagEvents:o?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()")}async getRemoteConfigPayload(t){if(!this.options.personalApiKey)throw new Error("Personal API key is required for remote config payload decryption");let r=await this._requestRemoteConfigPayload(t);if(!r)return;let n=await r.json();if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);return n?(await this.getAllFlagsAndPayloads(n,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);if(!n)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:o,disableGeoip:s,flagKeys:a}=i||{},{onlyEvaluateLocally:u,personProperties:c,groupProperties:l}=i||{},p=this.addLocalPersonAndGroupProperties(n,o,c,l);c=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(n,o,c,l);u==null&&(u=this.options.strictLocalEvaluation??!1);let f=await this.featureFlagsPoller?.getAllFlagsAndPayloads(d,a),m={},h={},g=!0;if(f&&(m=f.response,h=f.payloads,g=f.fallbackToFlags),g&&!u){let A=await super.getFeatureFlagsAndPayloadsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,s,a);m={...m,...A.flags||{}},h={...h,...A.payloads||{}}}return this._flagOverrides!==void 0&&(m={...m,...this._flagOverrides}),this._payloadOverrides!==void 0&&(h={...h,...this._payloadOverrides}),{featureFlags:m,featureFlagPayloads:h}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:o}){super.groupIdentifyStateless(t,r,n,{disableGeoip:o},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(t){let r=n=>Object.fromEntries(n.map(i=>[i,!0]));if(t===!1){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(t)){this._flagOverrides=r(t);return}if(this._isFeatureFlagOverrideOptions(t)){"flags"in t&&(t.flags===!1?this._flagOverrides=void 0:Array.isArray(t.flags)?this._flagOverrides=r(t.flags):t.flags!==void 0&&(this._flagOverrides={...t.flags})),"payloads"in t&&(t.payloads===!1?this._payloadOverrides=void 0:t.payloads!==void 0&&(this._payloadOverrides={...t.payloads}));return}this._flagOverrides={...t}}_isFeatureFlagOverrideOptions(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let r=t;if("flags"in r){let n=r.flags;if(n===!1||Array.isArray(n)||typeof n=="object"&&n!==null)return!0}if("payloads"in r){let n=r.payloads;if(n===!1||typeof n=="object"&&n!==null)return!0}return!1}withContext(t,r,n){return this.context?this.context.run(t,r,n):r()}getContext(){return this.context?.get()}enterContext(t,r){this.context?.enter(t,r)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown(),super._shutdown(t)}async _requestRemoteConfigPayload(t){if(!this.options.personalApiKey)return;let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config?token=${encodeURIComponent(this.apiKey)}`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&typeof this.options.requestTimeout=="number"){let o=new AbortController;i=qPe(()=>{o.abort()},this.options.requestTimeout),n.signal=o.signal}try{return await this.fetch(r,n)}catch(o){this._events.emit("error",o);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(t,r){if(!t)return{personProperties:{},groupProperties:{}};let n={},i={};for(let[o,s]of Object.entries(t))if(R1a(s)&&r&&o in r){let a={};for(let[u,c]of Object.entries(s))a[String(u)]=String(c);i[String(o)]=a}else n[String(o)]=String(s);return{personProperties:n,groupProperties:i}}async getFeatureFlagsForEvent(t,r,n,i){let o=i?.personProperties||{},s=i?.groupProperties||{},a=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let c={};for(let[l,p]of Object.entries(r||{}))c[l]=String(p);return await this.getAllFlags(t,{groups:c,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let c={};for(let[l,p]of Object.entries(r||{}))c[l]=String(p);return await this.getAllFlags(t,{groups:c,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}return(await super.getFeatureFlagsStateless(t,r,o,s,n)).flags}addLocalPersonAndGroupProperties(t,r,n,i){let o={distinct_id:t,...n||{}},s={};if(r)for(let a of Object.keys(r))s[a]={$group_key:r[a],...i?.[a]||{}};return{allPersonProperties:o,allGroupProperties:s}}createFeatureFlagEvaluationContext(t,r,n,i){return{distinctId:t,groups:r||{},personProperties:n||{},groupProperties:i||{},evaluationCache:{}}}captureException(t,r,n,i){if(!sV.isPreviouslyCapturedError(t)){let o=new Error("PostHog syntheticException");this.addPendingPromise(sV.buildEventMessage(t,{syntheticException:o},r,n).then(s=>this.capture({...s,uuid:i})))}}async captureExceptionImmediate(t,r,n){if(!sV.isPreviouslyCapturedError(t)){let i=new Error("PostHog syntheticException");this.addPendingPromise(sV.buildEventMessage(t,{syntheticException:i},r,n).then(o=>this.captureImmediate(o)))}}async prepareEventMessage(t){let{distinctId:r,event:n,properties:i,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:u,uuid:c}=t,l=this.context?.get(),p=r||l?.distinctId,d={...this.props,...l?.properties||{},...i||{}};p||(p=sK(),d.$process_person_profile=!1),l?.sessionId&&!d.$session_id&&(d.$session_id=l.sessionId);let f=this._runBeforeSend({distinctId:p,event:n,properties:d,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:u,uuid:c});if(!f)return Promise.reject(null);let m=await Promise.resolve().then(async()=>{if(s){let h=typeof s=="object"?s:void 0;return await this.getFeatureFlagsForEvent(f.distinctId,o,u,h)}return f.event,{}}).then(h=>{let g={};if(h)for(let[E,v]of Object.entries(h))g[`$feature/${E}`]=v;let A=Object.keys(h||{}).filter(E=>h?.[E]!==!1).sort();return A.length>0&&(g.$active_feature_flags=A),g}).catch(()=>({})).then(h=>({...h,...f.properties||{},$groups:f.groups||o}));return f.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof m.$raw_user_agent=="string"&&B1a(m.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(f.event="$bot_pageview",m.$browser_type="bot"),{distinctId:f.distinctId,event:f.event,properties:m,options:{timestamp:f.timestamp,disableGeoip:f.disableGeoip,uuid:f.uuid}}}_runBeforeSend(t){let r=this.options.before_send;if(!r)return t;let n=Array.isArray(r)?r:[r],i=t;for(let o of n){if(i=o(i),!i)return this._logger.info(`Event '${t.event}' was rejected in beforeSend function`),null;if(!i.properties||Object.keys(i.properties).length===0){let s=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(s)}}return i}};var SSa=require("async_hooks"),yvr=class{constructor(){this.storage=new SSa.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,n){return this.storage.run(this.resolve(t,n),r)}enter(t,r){this.storage.enterWith(this.resolve(t,r))}resolve(t,r){if(r?.fresh===!0)return t;let n=this.get()||{};return{distinctId:t.distinctId??n.distinctId,sessionId:t.sessionId??n.sessionId,properties:{...n.properties||{},...t.properties||{}}}}};var BSa="posthog-node";function pEf(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}={}){return s=>{if(!(i==="*"||i.includes(s.level)))return s;s.tags||(s.tags={});let u=s.tags[ePi.POSTHOG_ID_TAG];if(u===void 0)return s;let c=e.options.host??"https://us.i.posthog.com",l=new URL(`/project/${e.apiKey}/person/${u}`,c).toString();s.tags["PostHog Person URL"]=l;let p=s.exception?.values||[],d=p.map(m=>({...m,stacktrace:m.stacktrace?{...m.stacktrace,type:"raw",frames:(m.stacktrace.frames||[]).map(h=>({...h,platform:"node:javascript"}))}:void 0})),f={$exception_message:p[0]?.value||s.message,$exception_type:p[0]?.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:p[0]?.value||s.message,$sentry_exception_type:p[0]?.type,$sentry_tags:s.tags};return t&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+s.event_id),o&&e.capture({event:"$exception",distinctId:u,properties:f}),s}}var ePi=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,n,i,o){this.name=BSa,this.name=BSa,this.setupOnce=function(s,a){let u=a()?.getClient()?.getDsn()?.projectId;s(pEf(t,{organization:r,projectId:u,prefix:n,severityAllowList:i,sendExceptionsToPostHog:o??!0}))}}};sV.errorPropertiesBuilder=new bF.ErrorPropertiesBuilder([new bF.EventCoercer,new bF.ErrorCoercer,new bF.ObjectCoercer,new bF.StringCoercer,new bF.PrimitiveCoercer],bF.createStackParser("node:javascript",bF.nodeStackLineParser),[C1a(),dSa]);var V9e=class extends Avr{getLibraryId(){return"posthog-node"}initializeContext(){return new yvr}};var bvr=class{posthog;constructor({posthogApiKey:t}){this.posthog=new V9e(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"4.32.1",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var rxt=class{async sendEvent(){}async identify(){}async flush(){}};Vt();var q9e=require("fs/promises"),OSa=require("os"),PSa=require("path");var fEf="id",dEf=".fern",nxt=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new V9e(r),this.userId=t==null?void 0:ACi(t),this.token=t}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){let r=await this.getUserEmail();this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"4.32.1",...t,...t.properties,usingAccessToken:!1,...r!=null?{userEmail:r}:{}}})}async flush(){await this.posthog.flush()}userEmail;async getUserEmail(){if(this.userEmail!==null){if(this.userEmail!=null)return this.userEmail;if(this.token==null){this.userEmail=null;return}try{let t=await FA({token:this.token.value}).user.getMyself();if(t.ok&&t.body.email!=null)return this.userEmail=t.body.email,this.userEmail}catch{}this.userEmail=null}}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=We(Ut.of((0,OSa.homedir)()),Se.of(dEf),Se.of(fEf));await Xt(t)||(await(0,q9e.mkdir)((0,PSa.dirname)(t),{recursive:!0}),await(0,q9e.writeFile)(t,hC())),this.persistedDistinctId=(await(0,q9e.readFile)(t)).toString()}return this.persistedDistinctId}};var tPi;async function G9e(){return tPi==null&&(tPi=await mEf()),tPi}async function mEf(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new rxt;let r=await Dhr();return r!=null?new nxt({token:r,posthogApiKey:e}):await VH()!=null?new bvr({posthogApiKey:e}):new nxt({token:void 0,posthogApiKey:e})}catch{return new rxt}}Rt();var ixt=_e(require("process"),1);pNe();var RSa=_e(wAi(),1),FSa=_e(DSa(),1);function DC(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=A5(e),e.length===0))return 0;e=e.replace((0,FSa.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let o=i.codePointAt(0);if(o<=31||o>=127&&o<=159||o>=768&&o<=879)continue;switch(RSa.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function Evr(e){let t=0;for(let r of e.split(`
|
|
1656
|
+
`);for(let s=n;s<o.length;s++){let a=o[s];if(a.length>1024)continue;let u=nSa.test(a)?a.replace(nSa,"$1"):a;if(!u.match(/\S*Error: /)){for(let c of t){let l=c(u,e);if(l){i.push(l);break}}if(i.length>=iSa)break}}return oSa(i)}}var qOi=class{match(t){return this.isDOMException(t)||this.isDOMError(t)}coerce(t,r){let n=JCt(t.stack);return{type:this.getType(t),value:this.getValue(t),stack:n?t.stack:void 0,cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return this.isDOMError(t)?"DOMError":"DOMException"}getValue(t){let r=t.name||(this.isDOMError(t)?"DOMError":"DOMException");return t.message?`${r}: ${t.message}`:r}isDOMException(t){return VPe(t,"DOMException")}isDOMError(t){return VPe(t,"DOMError")}};var GOi=class{match(t){return DOi(t)}coerce(t,r){return{type:this.getType(t),value:this.getMessage(t,r),stack:this.getStack(t),cause:t.cause?r.next(t.cause):void 0,synthetic:!1}}getType(t){return t.name||t.constructor.name}getMessage(t,r){let n=t.message;return n.error&&typeof n.error.message=="string"?String(n.error.message):String(n)}getStack(t){return t.stacktrace||t.stack||void 0}};var WOi=class{constructor(){}match(t){return D1a(t)&&t.error!=null}coerce(t,r){let n=r.apply(t.error);return n||{type:"ErrorEvent",value:t.message,stack:r.syntheticException?.stack,synthetic:!0}}};var q0f=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,$Oi=class{match(t){return typeof t=="string"}coerce(t,r){let[n,i]=this.getInfos(t);return{type:n??"Error",value:i??t,stack:r.syntheticException?.stack,synthetic:!0}}getInfos(t){let r="Error",n=t,i=t.match(q0f);return i&&(r=i[1],n=i[2]),[r,n]}};var aSa=["fatal","error","warning","log","info","debug"];function dvr(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let n=r.length;n>0;n--){let i=r.slice(0,n).join(", ");if(!(i.length>t))return n===r.length||i.length<=t?i:`${i.slice(0,t)}...`}return""}var HOi=class{match(t){return typeof t=="object"&&t!==null}coerce(t,r){let n=this.getErrorPropertyFromObject(t);return n?r.apply(n):{type:this.getType(t),value:this.getValue(t),stack:r.syntheticException?.stack,level:this.isSeverityLevel(t.level)?t.level:"error",synthetic:!0}}getType(t){return tvr(t)?t.constructor.name:"Error"}getValue(t){if("name"in t&&typeof t.name=="string"){let i=`'${t.name}' captured as exception`;return"message"in t&&typeof t.message=="string"&&(i+=` with message: '${t.message}'`),i}if("message"in t&&typeof t.message=="string")return t.message;let r=this.getObjectClassName(t),n=dvr(t);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${n}`}isSeverityLevel(t){return JCt(t)&&!P1a(t)&&aSa.indexOf(t)>=0}getErrorPropertyFromObject(t){for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)){let n=t[r];if(W1a(n))return n}}getObjectClassName(t){try{let r=Object.getPrototypeOf(t);return r?r.constructor.name:void 0}catch{return}}};var KOi=class{match(t){return tvr(t)}coerce(t,r){let n=t.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${dvr(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var JOi=class{match(t){return YCt(t)}coerce(t,r){return{type:"Error",value:`Primitive value captured as exception: ${String(t)}`,stack:r.syntheticException?.stack,synthetic:!0}}};var YOi=class{match(t){return VPe(t,"PromiseRejectionEvent")}coerce(t,r){let n=this.getUnhandledRejectionReason(t);return YCt(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:r.syntheticException?.stack,synthetic:!0}:r.apply(n)}getUnhandledRejectionReason(t){if(YCt(t))return t;try{if("reason"in t)return t.reason;if("detail"in t&&"reason"in t.detail)return t.detail.reason}catch{}return t}};var XOi=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}};var lSa=require("fs"),pSa=require("readline"),mvr=new bF.ReduceableCache(25),fSa=new bF.ReduceableCache(20),ZOi=7,G0f=1e3,W0f=1e4;async function dSa(e){let t={};for(let i=e.length-1;i>=0;i--){let o=e[i],s=o?.filename;if(!o||typeof s!="string"||typeof o.lineno!="number"||J0f(s)||Y0f(o))continue;t[s]||(t[s]=[]),t[s].push(o.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(fSa.get(i))continue;let o=t[i];if(!o)continue;o.sort((u,c)=>u-c);let s=Z0f(o);if(s.every(u=>X0f(i,u)))continue;let a=eEf(mvr,i,{});n.push($0f(i,s,a))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&H0f(e,mvr),mvr.reduce(),e}function $0f(e,t,r){return new Promise(n=>{let i=(0,lSa.createReadStream)(e),o=(0,pSa.createInterface)({input:i});function s(){i.destroy(),n()}let a=0,u=0,c=t[u];if(c===void 0)return void s();let l=c[0],p=c[1];function d(){fSa.set(e,1),o.close(),o.removeAllListeners(),s()}i.on("error",d),o.on("error",d),o.on("close",s),o.on("line",f=>{if(a++,!(a<l)&&(r[a]=tEf(f,0),a>=p)){if(u===t.length-1){o.close(),o.removeAllListeners();return}u++;let m=t[u];if(m===void 0){o.close(),o.removeAllListeners();return}l=m[0],p=m[1]}})})}function H0f(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;K0f(r.lineno,r,n)}}function K0f(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=mSa(e);i<e;i++){let o=r[i];if(o===void 0)return void uSa(t);t.pre_context.push(o)}if(r[e]===void 0)return void uSa(t);t.context_line=r[e];let n=hSa(e);t.post_context=[];for(let i=e+1;i<=n;i++){let o=r[i];if(o===void 0)break;t.post_context.push(o)}}function uSa(e){delete e.pre_context,delete e.context_line,delete e.post_context}function J0f(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function Y0f(e){return e.lineno!==void 0&&e.lineno>W0f||e.colno!==void 0&&e.colno>G0f}function X0f(e,t){let r=mvr.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function Z0f(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=cSa(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let o=e[t+1];if(typeof o!="number")break;o<=n[1]?n[1]=o+ZOi:(i.push(n),n=cSa(o)),t++}return i}function cSa(e){return[mSa(e),hSa(e)]}function mSa(e){return Math.max(1,e-ZOi)}function hSa(e){return e+ZOi}function eEf(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function tEf(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let o=Math.min(i+140,n);return o>n-5&&(o=n),o===n&&(i=Math.max(o-140,0)),r=r.slice(i,o),i>0&&(r=`...${r}`),o<n&&(r+="..."),r}function rEf(e,t){let r=!1;return Object.assign(n=>{let o=global.process.listeners("uncaughtException").filter(s=>s.name!=="domainUncaughtExceptionClear"&&s._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&o&&(r=!0,t(n))},{_posthogErrorHandler:!0})}function gSa(e,t){globalThis.process?.on("uncaughtException",rEf(e,t))}function ASa(e){globalThis.process?.on("unhandledRejection",t=>e(t,{mechanism:{type:"onunhandledrejection",handled:!1}}))}var nEf=2e3,sV=class e{constructor(t,r,n){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this._logger=n,this._rateLimiter=new rvr({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(t){return TOi(t)&&"__posthog_previously_captured_error"in t&&t.__posthog_previously_captured_error===!0}static async buildEventMessage(t,r,n,i){let o={...i};n||(o.$process_person_profile=!1);let s=this.errorPropertiesBuilder.buildFromUnknown(t,r);return s.$exception_list=await this.errorPropertiesBuilder.modifyFrames(s.$exception_list),{event:"$exception",distinctId:n||sK(),properties:{...s,...o},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){this.isEnabled()&&(gSa(this.onException.bind(this),this.onFatalError.bind(this)),ASa(this.onException.bind(this)))}onException(t,r){this.client.addPendingPromise((async()=>{if(!e.isPreviouslyCapturedError(t)){let n=await e.buildEventMessage(t,r),o=n.properties?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(o)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:o}):this.client.capture(n)}})())}async onFatalError(t){console.error(t),await this.client.shutdown(nEf),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}};var ySa="5.26.2";var txt={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function bSa(e){let t=globalThis.crypto?.subtle;if(!t)throw new Error("SubtleCrypto API not available");let r=await t.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(r)).map(i=>i.toString(16).padStart(2,"0")).join("")}var iEf=6e4,oEf=1152921504606847e3,sEf=["is_not"],z9e=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},ah=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},uK=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},hvr=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:o,customHeaders:s,...a}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=o,this.poller=void 0,this.fetch=a.fetch||fetch,this.onError=a.onError,this.customHeaders=s,this.onLoad=a.onLoad,this.cacheProvider=a.cacheProvider,this.strictLocalEvaluation=a.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}createEvaluationContext(t,r={},n={},i={},o={}){return{distinctId:t,groups:r,personProperties:n,groupProperties:i,evaluationCache:o}}async getFeatureFlag(t,r,n={},i={},o={}){await this.loadFeatureFlags();let s,a;if(!this.loadedSuccessfullyOnce)return s;if(a=this.featureFlagsByKey[t],a!==void 0){let u=this.createEvaluationContext(r,n,i,o);try{s=(await this.computeFlagAndPayloadLocally(a,u)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${s}`))}catch(c){c instanceof uK||c instanceof ah?this.logMsgIfDebug(()=>console.debug(`${c.name} when computing flag locally: ${t}: ${c.message}`)):c instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${c}`))}}return s}async getAllFlagsAndPayloads(t,r){await this.loadFeatureFlags();let n={},i={},o=this.featureFlags.length==0,s=r?r.map(u=>this.featureFlagsByKey[u]).filter(Boolean):this.featureFlags,a={...t,evaluationCache:t.evaluationCache??{}};return await Promise.all(s.map(async u=>{try{let{value:c,payload:l}=await this.computeFlagAndPayloadLocally(u,a);n[u.key]=c,l&&(i[u.key]=l)}catch(c){c instanceof uK||c instanceof ah?this.logMsgIfDebug(()=>console.debug(`${c.name} when computing flag locally: ${u.key}: ${c.message}`)):c instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${u.key}: ${c}`)),o=!0}})),{response:n,payloads:i,fallbackToFlags:o}}async computeFlagAndPayloadLocally(t,r,n={}){let{matchValue:i,skipLoadCheck:o=!1}=n;if(o||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};let s;s=i!==void 0?i:await this.computeFlagValueLocally(t,r);let a=this.getFeatureFlagPayload(t.key,s);return{value:s,payload:a}}async computeFlagValueLocally(t,r){let{distinctId:n,groups:i,personProperties:o,groupProperties:s}=r;if(t.ensure_experience_continuity)throw new ah("Flag has experience continuity enabled");if(!t.active)return!1;let u=(t.filters||{}).aggregation_group_type_index;if(u!=null){let c=this.groupTypeMapping[String(u)];if(!c)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${u} for feature flag ${t.key}`)),new ah("Flag has unknown group type index");if(!(c in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;t.bucketing_identifier==="device_id"&&(o?.$device_id===void 0||o?.$device_id===null||o?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${t.key}`));let l=s[c];return await this.matchFeatureFlagProperties(t,i[c],l,r)}{let c=this.getBucketingValueForFlag(t,n,o);if(c===void 0)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${t.key} without $device_id, falling back to server evaluation`)),new ah(`Can't compute feature flag: ${t.key} without $device_id`);return await this.matchFeatureFlagProperties(t,c,o,r)}}getBucketingValueForFlag(t,r,n){if(t.filters?.aggregation_group_type_index!=null)return r;if(t.bucketing_identifier==="device_id"){let i=n?.$device_id;return i==null||i===""?void 0:i}return r}getFeatureFlagPayload(t,r){let n=null;if(r!==!1&&r!=null&&(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]||null:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]||null),n!=null)){if(typeof n=="object")return n;if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}return null}async evaluateFlagDependency(t,r,n){let{evaluationCache:i}=n,o=t.key;if(!this.featureFlagsByKey)throw new ah("Feature flags not available for dependency evaluation");if(!("dependency_chain"in t))throw new ah(`Flag dependency property for '${o}' is missing required 'dependency_chain' field`);let s=t.dependency_chain;if(!Array.isArray(s))throw new ah(`Flag dependency property for '${o}' has an invalid 'dependency_chain' (expected array, got ${typeof s})`);if(s.length===0)throw new ah(`Circular dependency detected for flag '${o}' (empty dependency chain)`);for(let u of s){if(!(u in i)){let l=this.featureFlagsByKey[u];if(l)if(l.active)try{let p=await this.computeFlagValueLocally(l,n);i[u]=p}catch(p){throw new ah(`Error evaluating flag dependency '${u}' for flag '${o}': ${p}`)}else i[u]=!1;else throw new ah(`Missing flag dependency '${u}' for flag '${o}'`)}if(i[u]==null)throw new ah(`Dependency '${u}' could not be evaluated`)}let a=i[o];return this.flagEvaluatesToExpectedValue(t.value,a)}flagEvaluatesToExpectedValue(t,r){return typeof t=="boolean"?t===r||typeof r=="string"&&r!==""&&t===!0:typeof t=="string"?r===t:!1}async matchFeatureFlagProperties(t,r,n,i){let o=t.filters||{},s=o.groups||[],a=!1,u;for(let c of s)try{if(await this.isConditionMatch(t,r,c,n,i)){let l=c.variant,p=o.multivariate?.variants||[];u=l&&p.some(d=>d.key===l)?l:await this.getMatchingVariant(t,r)||!0;break}}catch(l){if(l instanceof uK)throw l;if(l instanceof ah)a=!0;else throw l}if(u!==void 0)return u;if(a)throw new ah("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i,o){let s=n.rollout_percentage,a=u=>{this.logMsgIfDebug(()=>console.warn(u))};if((n.properties||[]).length>0){for(let u of n.properties){let c=u.type,l=!1;if(l=c==="cohort"?CSa(u,i,this.cohorts,this.debugMode):c==="flag"?await this.evaluateFlagDependency(u,i,o):wSa(u,i,a),!l)return!1}if(s==null)return!0}return!(s!=null&&await ESa(t.key,r)>s/100)}async getMatchingVariant(t,r){let n=await ESa(t.key,r,"variant"),i=this.variantLookupTable(t).find(o=>n>=o.valueMin&&n<o.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(a=>{i=n+a.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:a.key}),n=i}),r}updateFlagState(t){this.featureFlags=t.flags,this.featureFlagsByKey=t.flags.reduce((r,n)=>(r[n.key]=n,r),{}),this.groupTypeMapping=t.groupTypeMapping,this.cohorts=t.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(t){if(this.strictLocalEvaluation)return;let r=t.filter(n=>n.ensure_experience_continuity);r.length>0&&console.warn(`[PostHog] You are using local evaluation but ${r.length} flag(s) have experience continuity enabled: ${r.map(n=>n.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(t){if(!this.cacheProvider)return!1;try{let r=await this.cacheProvider.getFlagDefinitions();return r?(this.updateFlagState(r),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${t} (${r.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(r.flags),!0):!1}catch(r){return this.onError?.(new Error(`Failed to load from cache: ${r}`)),!1}}async loadFeatureFlags(t=!1){if(!(this.loadedSuccessfullyOnce&&!t))return!t&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(r=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${r}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(iEf,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let t=!0;if(this.cacheProvider)try{t=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(n){this.onError?.(new Error(`Error in shouldFetchFlagDefinitions: ${n}`))}if(!t&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let r=await this._requestFeatureFlagDefinitions();if(!r)return;switch(r.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=r.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new z9e(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.beginBackoff(),new z9e(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.beginBackoff(),new z9e(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let n=await r.json()??{};if(!("flags"in n))return void this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(n)}`));this.flagsEtag=r.headers?.get("ETag")??void 0;let i={flags:n.flags??[],groupTypeMapping:n.group_type_mapping||{},cohorts:n.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&t)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(o){this.onError?.(new Error(`Failed to store in cache: ${o}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(t){t instanceof z9e&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET",r){let n={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return r&&(n["If-None-Match"]=r),{method:t,headers:n}}_requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=qPe(()=>{i.abort()},this.timeout),r.signal=i.signal}try{let i=this.fetch;return i(t,r)}finally{clearTimeout(n)}}async stopPoller(t=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let r=this.cacheProvider.shutdown();r instanceof Promise&&await Promise.race([r,new Promise((n,i)=>setTimeout(()=>i(new Error(`Cache shutdown timeout after ${t}ms`)),t))])}catch(r){this.onError?.(new Error(`Error during cache shutdown: ${r}`))}}};async function ESa(e,t,r=""){let n=await bSa(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/oEf}function wSa(e,t,r){let n=e.key,i=e.value,o=e.operator||"exact";if(n in t){if(o==="is_not_set")throw new ah("Operator is_not_set is not supported")}else throw new ah(`Property ${n} not found in propertyValues`);let s=t[n];if(s==null&&!sEf.includes(o))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${o} operator`),!1;function a(c,l){return Array.isArray(c)?c.map(p=>String(p).toLowerCase()).includes(String(l).toLowerCase()):String(c).toLowerCase()===String(l).toLowerCase()}function u(c,l,p){if(p==="gt")return c>l;if(p==="gte")return c>=l;if(p==="lt")return c<l;if(p==="lte")return c<=l;throw new Error(`Invalid operator: ${p}`)}switch(o){case"exact":return a(i,s);case"is_not":return!a(i,s);case"is_set":return n in t;case"icontains":return String(s).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(s).toLowerCase().includes(String(i).toLowerCase());case"regex":return vSa(String(i))&&String(s).match(String(i))!==null;case"not_regex":return vSa(String(i))&&String(s).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let c=typeof i=="number"?i:null;if(typeof i=="string")try{c=parseFloat(i)}catch{}return c==null||s==null?u(String(s),String(i),o):typeof s=="string"?u(s,String(i),o):u(s,c,o)}case"is_date_after":case"is_date_before":{if(typeof i=="boolean")throw new ah("Date operations cannot be performed on boolean values");let c=uEf(String(i));if(c==null&&(c=ISa(i)),c==null)throw new ah(`Invalid date: ${i}`);let l=ISa(s);return["is_date_before"].includes(o)?l<c:l>c}default:throw new ah(`Unknown operator: ${o}`)}}function aEf(e,t){if(!(e in t))throw new uK(`cohort ${e} not found in local cohorts - likely a static cohort that requires server evaluation`)}function CSa(e,t,r,n=!1){let i=String(e.value);aEf(i,r);let o=r[i];return xSa(o,t,r,n)}function xSa(e,t,r,n=!1){if(!e)return!0;let i=e.type,o=e.values;if(!o||o.length===0)return!0;let s=!1;if("values"in o[0]){for(let a of o)try{let u=xSa(a,t,r,n);if(i==="AND"){if(!u)return!1}else if(u)return!0}catch(u){if(u instanceof uK)throw u;if(u instanceof ah)n&&console.debug(`Failed to compute property ${a} locally: ${u}`),s=!0;else throw u}if(s)throw new ah("Can't match cohort without a given cohort property value");return i==="AND"}for(let a of o)try{let u;if(a.type==="cohort")u=CSa(a,t,r,n);else if(a.type==="flag"){n&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${a.key||"unknown"}'`);continue}else u=wSa(a,t);let c=a.negation||!1;if(i==="AND"){if(!u&&!c||u&&c)return!1}else if(u&&!c||!u&&c)return!0}catch(u){if(u instanceof uK)throw u;if(u instanceof ah)n&&console.debug(`Failed to compute property ${a} locally: ${u}`),s=!0;else throw u}if(s)throw new ah("can't match cohort without a given cohort property value");return i==="AND"}function vSa(e){try{return new RegExp(e),!0}catch{return!1}}function ISa(e){if(e instanceof Date)return e;if(typeof e=="string"||typeof e=="number"){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new ah(`${e} is in an invalid date format`)}throw new ah(`The date provided ${e} must be a string, number, or date object`)}function uEf(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(!r)return null;{if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let o=r.groups.interval;if(o=="h")n.setUTCHours(n.getUTCHours()-i);else if(o=="d")n.setUTCDate(n.getUTCDate()-i);else if(o=="w")n.setUTCDate(n.getUTCDate()-7*i);else if(o=="m")n.setUTCMonth(n.getUTCMonth()-i);else{if(o!="y")return null;n.setUTCFullYear(n.getUTCFullYear()-i)}return n}}var gvr=class{getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}constructor(){this._memoryStorage={}}};var cEf=100,_Sa=3e4,lEf=5e4,Avr=class extends ext{constructor(t,r={}){if(super(t,r),this._memoryStorage=new gvr,this.options=r,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,cEf):_Sa,r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');r.enableLocalEvaluation!==!1&&(this.featureFlagsPoller=new hvr({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders(),cacheProvider:r.flagDefinitionCacheProvider,strictLocalEvaluation:r.strictLocalEvaluation}))}this.errorTracking=new sV(this,r,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||lEf}getPersistedProperty(t){return this._memoryStorage.getProperty(t)}setPersistedProperty(t,r){return this._memoryStorage.setProperty(t,r)}fetch(t,r){return this.options.fetch?this.options.fetch(t,r):fetch(t,r)}getLibraryVersion(){return ySa}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStateless(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}async captureImmediate(t){return typeof t=="string"&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),t.event==="$exception"&&!t._originatedFromCaptureException&&this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(t).then(({distinctId:r,event:n,properties:i,options:o})=>super.captureStatelessImmediate(r,n,i,{timestamp:o.timestamp,disableGeoip:o.disableGeoip,uuid:o.uuid})).catch(r=>{r&&console.error(r)}))}identify({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStateless(t,l,{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r={},disableGeoip:n}){let{$set:i,$set_once:o,$anon_distinct_id:s,...a}=r,l={$set:i||a,$set_once:o||{},$anon_distinct_id:s??void 0};super.identifyStatelessImmediate(t,l,{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=_Sa){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",o=>{clearTimeout(n),i(),r(o>0)})})}_resolveDistinctId(t,r){return typeof t=="string"?{distinctId:t,options:r}:{distinctId:this.context?.get()?.distinctId,options:t}}async _getFeatureFlagResult(t,r,n={},i){let o=n.sendFeatureFlagEvents??!0;if(this._flagOverrides!==void 0&&t in this._flagOverrides){let w=this._flagOverrides[t];if(w===void 0)return;let x=this._payloadOverrides?.[t];return{key:t,enabled:w!==!1,variant:typeof w=="string"?w:void 0,payload:x}}let{groups:s,disableGeoip:a}=n,{onlyEvaluateLocally:u,personProperties:c,groupProperties:l}=n,p=this.addLocalPersonAndGroupProperties(r,s,c,l);c=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(r,s,c,l);u==null&&(u=this.options.strictLocalEvaluation??!1);let f,m=!1,h,g,A,E,v,b;if(this.featureFlagsPoller!==void 0){await this.featureFlagsPoller?.loadFeatureFlags();let w=this.featureFlagsPoller?.featureFlagsByKey[t];if(w)try{let x=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(w,d,{matchValue:i});if(x){m=!0;let C=x.value;E=w.id,b="Evaluated locally",f={key:t,enabled:C!==!1,variant:typeof C=="string"?C:void 0,payload:x.payload??void 0}}}catch(x){if(x instanceof uK||x instanceof ah)this._logger?.info(`${x.name} when computing flag locally: ${t}: ${x.message}`);else throw x}}if(!m&&!u){let w=await super.getFeatureFlagDetailsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,a,[t]);if(w===void 0)A=txt.UNKNOWN_ERROR;else{h=w.requestId,g=w.evaluatedAt;let x=[];w.errorsWhileComputingFlags&&x.push(txt.ERRORS_WHILE_COMPUTING),w.quotaLimited?.includes("feature_flags")&&x.push(txt.QUOTA_LIMITED);let C=w.flags[t];if(C===void 0)x.push(txt.FLAG_MISSING);else{E=C.metadata?.id,v=C.metadata?.version,b=C.reason?.description??C.reason?.code;let _;if(C.metadata?.payload!==void 0)try{_=JSON.parse(C.metadata.payload)}catch{_=C.metadata.payload}f={key:t,enabled:C.enabled,variant:C.variant,payload:_}}x.length>0&&(A=x.join(","))}}if(o){let w=f===void 0?void 0:f.enabled===!1?!1:f.variant??!0,x=`${t}_${w}`;if(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(x)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(x):this.distinctIdHasSentFlagCalls[r]=[x];let C={$feature_flag:t,$feature_flag_response:w,$feature_flag_id:E,$feature_flag_version:v,$feature_flag_reason:b,locally_evaluated:m,[`$feature/${t}`]:w,$feature_flag_request_id:h,$feature_flag_evaluated_at:m?Date.now():g};if(m&&this.featureFlagsPoller){let _=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();_!==void 0&&(C.$feature_flag_definitions_loaded_at=_)}A&&(C.$feature_flag_error=A),this.capture({distinctId:r,event:"$feature_flag_called",properties:C,groups:s,disableGeoip:a})}}return f!==void 0&&this._payloadOverrides!==void 0&&t in this._payloadOverrides&&(f={...f,payload:this._payloadOverrides[t]}),f}async getFeatureFlag(t,r,n){let i=await this._getFeatureFlagResult(t,r,{...n,sendFeatureFlagEvents:n?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(i!==void 0)return i.enabled===!1?!1:i.variant??!0}async getFeatureFlagPayload(t,r,n,i){if(this._payloadOverrides!==void 0&&t in this._payloadOverrides)return this._payloadOverrides[t];let o=await this._getFeatureFlagResult(t,r,{...i,sendFeatureFlagEvents:!1},n);if(o!==void 0)return o.payload??null}async getFeatureFlagResult(t,r,n){let{distinctId:i,options:o}=this._resolveDistinctId(r,n);return i?this._getFeatureFlagResult(t,i,{...o,sendFeatureFlagEvents:o?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required \u2014 pass it explicitly or use withContext()")}async getRemoteConfigPayload(t){if(!this.options.personalApiKey)throw new Error("Personal API key is required for remote config payload decryption");let r=await this._requestRemoteConfigPayload(t);if(!r)return;let n=await r.json();if(typeof n=="string")try{return JSON.parse(n)}catch{}return n}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);return n?(await this.getAllFlagsAndPayloads(n,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags \u2014 pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(t,r){let{distinctId:n,options:i}=this._resolveDistinctId(t,r);if(!n)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads \u2014 pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:o,disableGeoip:s,flagKeys:a}=i||{},{onlyEvaluateLocally:u,personProperties:c,groupProperties:l}=i||{},p=this.addLocalPersonAndGroupProperties(n,o,c,l);c=p.allPersonProperties,l=p.allGroupProperties;let d=this.createFeatureFlagEvaluationContext(n,o,c,l);u==null&&(u=this.options.strictLocalEvaluation??!1);let f=await this.featureFlagsPoller?.getAllFlagsAndPayloads(d,a),m={},h={},g=!0;if(f&&(m=f.response,h=f.payloads,g=f.fallbackToFlags),g&&!u){let A=await super.getFeatureFlagsAndPayloadsStateless(d.distinctId,d.groups,d.personProperties,d.groupProperties,s,a);m={...m,...A.flags||{}},h={...h,...A.payloads||{}}}return this._flagOverrides!==void 0&&(m={...m,...this._flagOverrides}),this._payloadOverrides!==void 0&&(h={...h,...this._payloadOverrides}),{featureFlags:m,featureFlagPayloads:h}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:o}){super.groupIdentifyStateless(t,r,n,{disableGeoip:o},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(t){let r=n=>Object.fromEntries(n.map(i=>[i,!0]));if(t===!1){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(t)){this._flagOverrides=r(t);return}if(this._isFeatureFlagOverrideOptions(t)){"flags"in t&&(t.flags===!1?this._flagOverrides=void 0:Array.isArray(t.flags)?this._flagOverrides=r(t.flags):t.flags!==void 0&&(this._flagOverrides={...t.flags})),"payloads"in t&&(t.payloads===!1?this._payloadOverrides=void 0:t.payloads!==void 0&&(this._payloadOverrides={...t.payloads}));return}this._flagOverrides={...t}}_isFeatureFlagOverrideOptions(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let r=t;if("flags"in r){let n=r.flags;if(n===!1||Array.isArray(n)||typeof n=="object"&&n!==null)return!0}if("payloads"in r){let n=r.payloads;if(n===!1||typeof n=="object"&&n!==null)return!0}return!1}withContext(t,r,n){return this.context?this.context.run(t,r,n):r()}getContext(){return this.context?.get()}enterContext(t,r){this.context?.enter(t,r)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(t),this.errorTracking.shutdown(),super._shutdown(t)}async _requestRemoteConfigPayload(t){if(!this.options.personalApiKey)return;let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config?token=${encodeURIComponent(this.apiKey)}`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&typeof this.options.requestTimeout=="number"){let o=new AbortController;i=qPe(()=>{o.abort()},this.options.requestTimeout),n.signal=o.signal}try{return await this.fetch(r,n)}catch(o){this._events.emit("error",o);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(t,r){if(!t)return{personProperties:{},groupProperties:{}};let n={},i={};for(let[o,s]of Object.entries(t))if(R1a(s)&&r&&o in r){let a={};for(let[u,c]of Object.entries(s))a[String(u)]=String(c);i[String(o)]=a}else n[String(o)]=String(s);return{personProperties:n,groupProperties:i}}async getFeatureFlagsForEvent(t,r,n,i){let o=i?.personProperties||{},s=i?.groupProperties||{},a=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation??!1)if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let c={};for(let[l,p]of Object.entries(r||{}))c[l]=String(p);return await this.getAllFlags(t,{groups:c,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}else return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let c={};for(let[l,p]of Object.entries(r||{}))c[l]=String(p);return await this.getAllFlags(t,{groups:c,personProperties:o,groupProperties:s,disableGeoip:n,onlyEvaluateLocally:!0,flagKeys:a})}return(await super.getFeatureFlagsStateless(t,r,o,s,n)).flags}addLocalPersonAndGroupProperties(t,r,n,i){let o={distinct_id:t,...n||{}},s={};if(r)for(let a of Object.keys(r))s[a]={$group_key:r[a],...i?.[a]||{}};return{allPersonProperties:o,allGroupProperties:s}}createFeatureFlagEvaluationContext(t,r,n,i){return{distinctId:t,groups:r||{},personProperties:n||{},groupProperties:i||{},evaluationCache:{}}}captureException(t,r,n,i){if(!sV.isPreviouslyCapturedError(t)){let o=new Error("PostHog syntheticException");this.addPendingPromise(sV.buildEventMessage(t,{syntheticException:o},r,n).then(s=>this.capture({...s,uuid:i})))}}async captureExceptionImmediate(t,r,n){if(!sV.isPreviouslyCapturedError(t)){let i=new Error("PostHog syntheticException");this.addPendingPromise(sV.buildEventMessage(t,{syntheticException:i},r,n).then(o=>this.captureImmediate(o)))}}async prepareEventMessage(t){let{distinctId:r,event:n,properties:i,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:u,uuid:c}=t,l=this.context?.get(),p=r||l?.distinctId,d={...this.props,...l?.properties||{},...i||{}};p||(p=sK(),d.$process_person_profile=!1),l?.sessionId&&!d.$session_id&&(d.$session_id=l.sessionId);let f=this._runBeforeSend({distinctId:p,event:n,properties:d,groups:o,sendFeatureFlags:s,timestamp:a,disableGeoip:u,uuid:c});if(!f)return Promise.reject(null);let m=await Promise.resolve().then(async()=>{if(s){let h=typeof s=="object"?s:void 0;return await this.getFeatureFlagsForEvent(f.distinctId,o,u,h)}return f.event,{}}).then(h=>{let g={};if(h)for(let[E,v]of Object.entries(h))g[`$feature/${E}`]=v;let A=Object.keys(h||{}).filter(E=>h?.[E]!==!1).sort();return A.length>0&&(g.$active_feature_flags=A),g}).catch(()=>({})).then(h=>({...h,...f.properties||{},$groups:f.groups||o}));return f.event==="$pageview"&&this.options.__preview_capture_bot_pageviews&&typeof m.$raw_user_agent=="string"&&B1a(m.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(f.event="$bot_pageview",m.$browser_type="bot"),{distinctId:f.distinctId,event:f.event,properties:m,options:{timestamp:f.timestamp,disableGeoip:f.disableGeoip,uuid:f.uuid}}}_runBeforeSend(t){let r=this.options.before_send;if(!r)return t;let n=Array.isArray(r)?r:[r],i=t;for(let o of n){if(i=o(i),!i)return this._logger.info(`Event '${t.event}' was rejected in beforeSend function`),null;if(!i.properties||Object.keys(i.properties).length===0){let s=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(s)}}return i}};var SSa=require("async_hooks"),yvr=class{constructor(){this.storage=new SSa.AsyncLocalStorage}get(){return this.storage.getStore()}run(t,r,n){return this.storage.run(this.resolve(t,n),r)}enter(t,r){this.storage.enterWith(this.resolve(t,r))}resolve(t,r){if(r?.fresh===!0)return t;let n=this.get()||{};return{distinctId:t.distinctId??n.distinctId,sessionId:t.sessionId??n.sessionId,properties:{...n.properties||{},...t.properties||{}}}}};var BSa="posthog-node";function pEf(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:o=!0}={}){return s=>{if(!(i==="*"||i.includes(s.level)))return s;s.tags||(s.tags={});let u=s.tags[ePi.POSTHOG_ID_TAG];if(u===void 0)return s;let c=e.options.host??"https://us.i.posthog.com",l=new URL(`/project/${e.apiKey}/person/${u}`,c).toString();s.tags["PostHog Person URL"]=l;let p=s.exception?.values||[],d=p.map(m=>({...m,stacktrace:m.stacktrace?{...m.stacktrace,type:"raw",frames:(m.stacktrace.frames||[]).map(h=>({...h,platform:"node:javascript"}))}:void 0})),f={$exception_message:p[0]?.value||s.message,$exception_type:p[0]?.type,$exception_level:s.level,$exception_list:d,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:p[0]?.value||s.message,$sentry_exception_type:p[0]?.type,$sentry_tags:s.tags};return t&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+s.event_id),o&&e.capture({event:"$exception",distinctId:u,properties:f}),s}}var ePi=class{static#e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(t,r,n,i,o){this.name=BSa,this.name=BSa,this.setupOnce=function(s,a){let u=a()?.getClient()?.getDsn()?.projectId;s(pEf(t,{organization:r,projectId:u,prefix:n,severityAllowList:i,sendExceptionsToPostHog:o??!0}))}}};sV.errorPropertiesBuilder=new bF.ErrorPropertiesBuilder([new bF.EventCoercer,new bF.ErrorCoercer,new bF.ObjectCoercer,new bF.StringCoercer,new bF.PrimitiveCoercer],bF.createStackParser("node:javascript",bF.nodeStackLineParser),[C1a(),dSa]);var V9e=class extends Avr{getLibraryId(){return"posthog-node"}initializeContext(){return new yvr}};var bvr=class{posthog;constructor({posthogApiKey:t}){this.posthog=new V9e(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"4.33.0",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var rxt=class{async sendEvent(){}async identify(){}async flush(){}};Vt();var q9e=require("fs/promises"),OSa=require("os"),PSa=require("path");var fEf="id",dEf=".fern",nxt=class{posthog;userId;token;constructor({token:t,posthogApiKey:r}){this.posthog=new V9e(r),this.userId=t==null?void 0:ACi(t),this.token=t}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){let r=await this.getUserEmail();this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"4.33.0",...t,...t.properties,usingAccessToken:!1,...r!=null?{userEmail:r}:{}}})}async flush(){await this.posthog.flush()}userEmail;async getUserEmail(){if(this.userEmail!==null){if(this.userEmail!=null)return this.userEmail;if(this.token==null){this.userEmail=null;return}try{let t=await FA({token:this.token.value}).user.getMyself();if(t.ok&&t.body.email!=null)return this.userEmail=t.body.email,this.userEmail}catch{}this.userEmail=null}}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=We(Ut.of((0,OSa.homedir)()),Se.of(dEf),Se.of(fEf));await Xt(t)||(await(0,q9e.mkdir)((0,PSa.dirname)(t),{recursive:!0}),await(0,q9e.writeFile)(t,hC())),this.persistedDistinctId=(await(0,q9e.readFile)(t)).toString()}return this.persistedDistinctId}};var tPi;async function G9e(){return tPi==null&&(tPi=await mEf()),tPi}async function mEf(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new rxt;let r=await Dhr();return r!=null?new nxt({token:r,posthogApiKey:e}):await VH()!=null?new bvr({posthogApiKey:e}):new nxt({token:void 0,posthogApiKey:e})}catch{return new rxt}}Rt();var ixt=_e(require("process"),1);pNe();var RSa=_e(wAi(),1),FSa=_e(DSa(),1);function DC(e,t={}){if(typeof e!="string"||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=A5(e),e.length===0))return 0;e=e.replace((0,FSa.default)()," ");let r=t.ambiguousIsNarrow?1:2,n=0;for(let i of e){let o=i.codePointAt(0);if(o<=31||o>=127&&o<=159||o>=768&&o<=879)continue;switch(RSa.default.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}function Evr(e){let t=0;for(let r of e.split(`
|
|
1657
1657
|
`))t=Math.max(t,DC(r));return t}var eBa=_e(nPi(),1);var gEf=/[\p{Lu}]/u,AEf=/[\p{Ll}]/u,NSa=/^[\p{Lu}](?![\p{Lu}])/gu,LSa=/([\p{Alpha}\p{N}_]|$)/u,iPi=/[_.\- ]+/,yEf=new RegExp("^"+iPi.source),jSa=new RegExp(iPi.source+LSa.source,"gu"),MSa=new RegExp("\\d+"+LSa.source,"gu"),bEf=(e,t,r,n)=>{let i=!1,o=!1,s=!1,a=!1;for(let u=0;u<e.length;u++){let c=e[u];a=u>2?e[u-3]==="-":!0,i&&gEf.test(c)?(e=e.slice(0,u)+"-"+e.slice(u),i=!1,s=o,o=!0,u++):o&&s&&AEf.test(c)&&(!a||n)?(e=e.slice(0,u-1)+"-"+e.slice(u-1),s=o,o=!1,i=!0):(i=t(c)===c&&r(c)!==c,s=o,o=r(c)===c&&t(c)!==c)}return e},EEf=(e,t)=>(NSa.lastIndex=0,e.replace(NSa,r=>t(r))),vEf=(e,t)=>(jSa.lastIndex=0,MSa.lastIndex=0,e.replace(jSa,(r,n)=>t(n)).replace(MSa,r=>t(r)));function oPi(e,t){if(!(typeof e=="string"||Array.isArray(e)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(e)?e=e.map(o=>o.trim()).filter(o=>o.length).join("-"):e=e.trim(),e.length===0)return"";let r=t.locale===!1?o=>o.toLowerCase():o=>o.toLocaleLowerCase(t.locale),n=t.locale===!1?o=>o.toUpperCase():o=>o.toLocaleUpperCase(t.locale);return e.length===1?iPi.test(e)?"":t.pascalCase?n(e):r(e):(e!==r(e)&&(e=bEf(e,r,n,t.preserveConsecutiveUppercase)),e=e.replace(yEf,""),e=t.preserveConsecutiveUppercase?EEf(e,r):r(e),t.pascalCase&&(e=n(e.charAt(0))+e.slice(1)),vEf(e,n))}var cPi=_e(zSa(),1);pNe();var VSa=(e=0)=>t=>`\x1B[${t+e}m`,qSa=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,GSa=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,Iy={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},ILy=Object.keys(Iy.modifier),xEf=Object.keys(Iy.color),_Ef=Object.keys(Iy.bgColor),wLy=[...xEf,..._Ef];function SEf(){let e=new Map;for(let[t,r]of Object.entries(Iy)){for(let[n,i]of Object.entries(r))Iy[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=Iy[n],e.set(i[0],i[1]);Object.defineProperty(Iy,t,{value:r,enumerable:!1})}return Object.defineProperty(Iy,"codes",{value:e,enumerable:!1}),Iy.color.close="\x1B[39m",Iy.bgColor.close="\x1B[49m",Iy.color.ansi=VSa(),Iy.color.ansi256=qSa(),Iy.color.ansi16m=GSa(),Iy.bgColor.ansi=VSa(10),Iy.bgColor.ansi256=qSa(10),Iy.bgColor.ansi16m=GSa(10),Object.defineProperties(Iy,{rgbToAnsi256:{value(t,r,n){return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(o=>o+o).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:t=>Iy.rgbToAnsi256(...Iy.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,i;if(t>=232)r=((t-232)*10+8)/255,n=r,i=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let o=Math.max(r,n,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>Iy.ansi256ToAnsi(Iy.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:t=>Iy.ansi256ToAnsi(Iy.hexToAnsi256(t)),enumerable:!1}}),Iy}var BEf=SEf(),WSa=BEf;var vvr=new Set(["\x1B","\x9B"]),OEf=39,aPi="\x07",KSa="[",PEf="]",JSa="m",uPi=`${PEf}8;;`,$Sa=e=>`${vvr.values().next().value}${KSa}${e}${JSa}`,HSa=e=>`${vvr.values().next().value}${uPi}${e}${aPi}`,TEf=e=>e.split(" ").map(t=>DC(t)),sPi=(e,t,r)=>{let n=[...t],i=!1,o=!1,s=DC(A5(e[e.length-1]));for(let[a,u]of n.entries()){let c=DC(u);if(s+c<=r?e[e.length-1]+=u:(e.push(u),s=0),vvr.has(u)&&(i=!0,o=n.slice(a+1).join("").startsWith(uPi)),i){o?u===aPi&&(i=!1,o=!1):u===JSa&&(i=!1);continue}s+=c,s===r&&a<n.length-1&&(e.push(""),s=0)}!s&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},DEf=e=>{let t=e.split(" "),r=t.length;for(;r>0&&!(DC(t[r-1])>0);)r--;return r===t.length?e:t.slice(0,r).join(" ")+t.slice(r).join("")},REf=(e,t,r={})=>{if(r.trim!==!1&&e.trim()==="")return"";let n="",i,o,s=TEf(e),a=[""];for(let[c,l]of e.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let p=DC(a[a.length-1]);if(c!==0&&(p>=t&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),p=0),(p>0||r.trim===!1)&&(a[a.length-1]+=" ",p++)),r.hard&&s[c]>t){let d=t-p,f=1+Math.floor((s[c]-d-1)/t);Math.floor((s[c]-1)/t)<f&&a.push(""),sPi(a,l,t);continue}if(p+s[c]>t&&p>0&&s[c]>0){if(r.wordWrap===!1&&p<t){sPi(a,l,t);continue}a.push("")}if(p+s[c]>t&&r.wordWrap===!1){sPi(a,l,t);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>DEf(c)));let u=[...a.join(`
|
|
1658
1658
|
`)];for(let[c,l]of u.entries()){if(n+=l,vvr.has(l)){let{groups:d}=new RegExp(`(?:\\${KSa}(?<code>\\d+)m|\\${uPi}(?<uri>.*)${aPi})`).exec(u.slice(c).join(""))||{groups:{}};if(d.code!==void 0){let f=Number.parseFloat(d.code);i=f===OEf?void 0:f}else d.uri!==void 0&&(o=d.uri.length===0?void 0:d.uri)}let p=WSa.codes.get(Number(i));u[c+1]===`
|
|
1659
1659
|
`?(o&&(n+=HSa("")),i&&p&&(n+=$Sa(p))):l===`
|
|
@@ -2163,7 +2163,7 @@ Hint: Values starting with "@" (such as scoped npm packages) must be wrapped in
|
|
|
2163
2163
|
Example: package-name: "@scope/package"`)}return{success:!1,warnings:[{type:"conflict",message:`Failed to parse generators.yml: ${o}`}]}}}checkDeprecatedFields(t,r){t.openapi!=null&&r.push({type:"deprecated",message:"The 'openapi' field is deprecated",suggestion:"Use 'api.specs' instead"}),t["openapi-overrides"]!=null&&r.push({type:"deprecated",message:"The 'openapi-overrides' field is deprecated",suggestion:"Use 'api.specs.[].overrides' instead"}),t["spec-origin"]!=null&&r.push({type:"deprecated",message:"The 'spec-origin' field is deprecated",suggestion:"Use 'api.specs.[].origin' instead"}),t["async-api"]!=null&&r.push({type:"deprecated",message:"The 'async-api' field is deprecated",suggestion:"Use 'api.specs' with asyncapi instead"}),t["api-settings"]!=null&&r.push({type:"deprecated",message:"The 'api-settings' field is deprecated",suggestion:"Use 'api.specs.[].settings' instead"}),t.whitelabel!=null&&r.push({type:"unsupported",message:"Whitelabel configuration is not yet supported in fern.yml"}),t.metadata!=null&&r.push({type:"unsupported",message:"Metadata configuration is not yet supported in fern.yml"}),t.reviewers!=null&&r.push({type:"unsupported",message:"Reviewers configuration is not yet supported in fern.yml"}),t.aliases!=null&&r.push({type:"unsupported",message:"Group aliases are not yet supported in fern.yml",suggestion:"Use multiple group names in target.group array instead"}),t["auth-schemes"]!=null&&r.push({type:"info",message:"Auth schemes configuration detected but not yet migrated",suggestion:"Auth schemes will be supported in a future version"})}async getAbsoluteFilePath(){let t=We(this.cwd,Se.of(Hd)),r=We(this.cwd,Se.of(y4e));if(await Xt(t,"file"))return t;if(await Xt(r,"file"))return r}};var QSt=class{cwd;logger;deleteOriginals;constructor(t){this.cwd=t.cwd,this.logger=t.logger,this.deleteOriginals=t.deleteOriginals??!0}async migrate(){let t=[],r=[],n=await this.findFernDirectory();if(n==null)return{success:!1,warnings:[{type:"conflict",message:"Could not find fern directory",suggestion:"Run this command from a directory containing a 'fern' folder"}],migratedFiles:r};let o=await new kSt({cwd:n}).migrate();if(t.push(...o.warnings),!o.success||o.org==null)return{success:!1,warnings:[...t,{type:"conflict",message:"Failed to migrate fern.config.json - organization is required"}],migratedFiles:r};o.absoluteFilePath!=null&&r.push(o.absoluteFilePath);let s=We(n,Se.of(GO)),a=await Xt(s,"directory"),u;if(a){let p=await this.migrateMultiApi({fernDir:n,apisDir:s,org:o.org,warnings:t,migratedFiles:r});if(!p.success)return{success:!1,warnings:t,migratedFiles:r};u=p.fernYml}else{let p=await this.migrateSingleApi({fernDir:n,org:o.org,warnings:t,migratedFiles:r});if(!p.success)return{success:!1,warnings:t,migratedFiles:r};u=p.fernYml}let c=We(this.cwd,Se.of(AE)),l=this.serializeFernYml(u);if(await(0,wrt.writeFile)(c,l,"utf-8"),this.deleteOriginals)for(let p of r)try{await(0,wrt.rm)(p),this.logger.debug(`Deleted ${p}`)}catch{t.push({type:"info",message:`Could not delete ${p}`})}return this.logger.info(`Created ${c}`),{success:!0,warnings:t,migratedFiles:r,outputPath:c}}async migrateSingleApi(t){let{fernDir:r,org:n,warnings:i,migratedFiles:o}=t,a=await new RDe({cwd:r}).migrate();i.push(...a.warnings),a.absoluteFilePath!=null&&o.push(a.absoluteFilePath);let u=await X5i({fernDir:r,generatorsYmlApi:a.rawApi});i.push(...u.warnings);let c={org:n};return u.api!=null&&(c.api=u.api),a.sdks!=null&&(c.sdks=a.sdks),{success:!0,fernYml:c}}async migrateMultiApi(t){let{fernDir:r,apisDir:n,org:i,warnings:o,migratedFiles:s}=t,u=(await(0,wrt.readdir)(n,{withFileTypes:!0})).filter(A=>A.isDirectory()).map(A=>A.name);if(u.length===0)return o.push({type:"conflict",message:"No API directories found in fern/apis/"}),{success:!1,fernYml:{org:i}};let c={},l={targets:{}},p,d;for(let A of u){let E=We(n,Se.of(A)),b=await new RDe({cwd:E,apiName:A}).migrate();if(o.push(...b.warnings),b.absoluteFilePath!=null&&s.push(b.absoluteFilePath),c[A]=b.rawApi,b.sdks!=null){for(let[I,w]of Object.entries(b.sdks.targets))l.targets[I]=w;b.sdks.defaultGroup!=null&&p==null&&(p=b.sdks.defaultGroup),b.sdks.autorelease!=null&&d==null&&(d=b.sdks.autorelease)}}let f=await Z5i({fernDir:r,apisDir:n,generatorsYmlApis:c});o.push(...f.warnings);let m={org:i,apis:f.apis};Object.keys(l.targets).length>0&&(p!=null&&(l.defaultGroup=p),d!=null&&(l.autorelease=d),m.sdks=l);let g=await new RDe({cwd:r}).detect();return g.found&&g.absoluteFilePath!=null&&(o.push({type:"info",message:"Found generators.yml in fern root alongside apis/ directory",suggestion:"Review the migrated configuration to ensure it's correct"}),s.push(g.absoluteFilePath)),{success:!0,fernYml:m}}async findFernDirectory(){if(this.cwd.split("/").pop()===$h)return this.cwd;let r=We(this.cwd,Se.of($h));if(await Xt(r,"directory"))return r}serializeFernYml(t){let r={edition:t.edition,org:t.org};return t.api!=null&&(r.api=t.api),t.apis!=null&&(r.apis=t.apis),t.ai!=null&&(r.ai=t.ai),t.cli!=null&&(r.cli=t.cli),t.sdks!=null&&(r.sdks=this.simplifySdks(t.sdks)),Ir.dump(r,{indent:2,lineWidth:120,noRefs:!0,sortKeys:!1,quotingType:'"',forceQuotes:!1})}simplifySdks(t){let r={...t},n={};for(let[i,o]of Object.entries(t.targets)){let s=o.output;if(typeof s=="string"){n[i]=o;continue}if(s.git==null&&s.path!=null){n[i]={...o,output:s.path};continue}n[i]=o}return r.targets=n,r}};var e8i=class{async handle(t,r){let i=await new QSt({cwd:t.cwd,logger:t.stdout,deleteOriginals:r.delete}).migrate();for(let o of i.warnings){switch(o.type){case"deprecated":t.stdout.warn(`Deprecated: ${o.message}`);break;case"unsupported":t.stdout.warn(`Unsupported: ${o.message}`);break;case"conflict":t.stderr.error(`Error: ${o.message}`);break;case"info":t.stdout.info(o.message);break}o.suggestion!=null&&t.stdout.info(` Suggestion: ${o.suggestion}`)}if(i.success){i.outputPath!=null&&t.stdout.debug(`Created: ${i.outputPath}`);return}throw new Kr({message:"Migration failed"})}};function t8i(e){let t=new e8i;va(e,"migrate","Migrate legacy configuration files to fern.yml",(r,n)=>t.handle(r,n),r=>r.option("delete",{type:"boolean",description:"Keep original files after migration",default:!0}))}function r8i(e){U1(e,"config","Configure, edit, and inspect your settings",[t8i])}var n8i=class{async handle(t,r){let n=await t.loadWorkspaceOrThrow();if(n.docs==null)throw new Kr({message:`No docs configuration found in fern.yml.
|
|
2164
2164
|
|
|
2165
2165
|
Add a 'docs:' section to your fern.yml to get started.`});let o=await new bve({context:t}).check({workspace:n,strict:r.strict}),s=o.hasErrors||r.strict&&o.hasWarnings;if(r.json){let a=this.buildJsonResponse({result:o,hasErrors:s});if(t.stdout.info(JSON.stringify(a,null,2)),s)throw Kr.exit();return}if(o.violations.length>0)for(let a of o.violations){let u=a.severity==="warning"?be.yellow:be.red;process.stderr.write(`${u(`${a.displayRelativeFilepath}:${a.line}:${a.column}: ${a.message}`)}
|
|
2166
|
-
`)}if(s)throw Kr.exit();if(o.warningCount>0){t.stderr.info(`${po.warning} ${be.yellow(`Found ${o.warningCount} warnings`)}`),t.stderr.info(be.dim(" Run 'fern docs check --strict' to treat warnings as errors"));return}t.stderr.info(`${po.success} ${be.green("All checks passed")}`)}buildJsonResponse({result:t,hasErrors:r}){let n={};return t.violations.length>0&&(n.docs=t.violations.map(i=>mK(i))),{success:!r,results:n}}};function i8i(e){let t=new n8i;va(e,"check","Validate docs configuration",(r,n)=>t.handle(r,n),r=>r.option("strict",{type:"boolean",description:"Treat warnings as errors",default:!1}).option("json",{type:"boolean",description:"Output results as JSON to stdout",default:!1}))}var f$a=_e(require("net"),1),d$a=_e(require("os"),1),z0n=class extends Error{constructor(t){super(`${t} is locked`)}},Crt={old:new Set,young:new Set},DJf=1e3*15;var NSt,RJf=()=>{let e=d$a.default.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let n of r)t.add(n.address);return t},l$a=e=>new Promise((t,r)=>{let n=f$a.default.createServer();n.unref(),n.on("error",r),n.listen(e,()=>{let{port:i}=n.address();n.close(()=>{t(i)})})}),p$a=async(e,t)=>{if(e.host||e.port===0)return l$a(e);for(let r of t)try{await l$a({port:e.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return e.port},FJf=function*(e){e&&(yield*e),yield 0};async function Eve(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let i=e.exclude;if(typeof i[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let o of i){if(typeof o!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(o))throw new TypeError(`Number ${o} in the exclude option is not a safe integer and can't be used`)}r=new Set(i)}NSt===void 0&&(NSt=setTimeout(()=>{NSt=void 0,Crt.old=Crt.young,Crt.young=new Set},DJf),NSt.unref&&NSt.unref());let n=RJf();for(let i of FJf(t))try{if(r.has(i))continue;let o=await p$a({...e,port:i},n);for(;Crt.old.has(o)||Crt.young.has(o);){if(i!==0)throw new z0n(i);o=await p$a({...e,port:i},n)}return Crt.young.add(o),o}catch(o){if(!["EADDRINUSE","EACCES"].includes(o.code)&&!(o instanceof z0n))throw o}throw new Error("No available ports found")}_g();Vt();var Pou=_e(a8i(),1),Tou=_e(BEn(),1),fIn=require("fs/promises"),Dou=_e(require("http"),1),Rou=_e(require("path"),1);var pXa=require("events"),REn=_e(require("fs"),1),VDe=_e(require("path"),1);var $Ya=_e(require("os"),1),HYa=300,Sve=20,uBt=1e7,KYa=$Ya.default.platform();var Knd=KYa==="darwin",_6i=KYa==="win32",Bve=Knd||_6i,JYa=3e3,YYa=2e4,S6i=1250;var NX;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(NX||(NX={}));var zDe;(function(e){e.CHANGE="change",e.RENAME="rename"})(zDe||(zDe={}));var cBt;(function(e){e.CHANGE="change",e.ERROR="error"})(cBt||(cBt={}));var Za;(function(e){e.ADD="add",e.ADD_DIR="addDir",e.CHANGE="change",e.RENAME="rename",e.RENAME_DIR="renameDir",e.UNLINK="unlink",e.UNLINK_DIR="unlinkDir"})(Za||(Za={}));var kT;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(kT||(kT={}));var Jnd=(e,t=1,r)=>{t=Math.max(1,t);let n=r?.leading??!1,i=r?.trailing??!0,o=Math.max(r?.maxWait??1/0,t),s,a,u=0,c=0,l=()=>{let b=Date.now(),I=b-u,w=b-c,x=I>=t||w>=o;return[b,x]},p=b=>{if(c=b,!s)return;let I=s;s=void 0,e.apply(void 0,I)},d=()=>{E(0)},f=()=>{a&&(d(),p(Date.now()))},m=b=>{if(c=b,n)return p(b)},h=b=>{if(i&&s)return p(b);s=void 0},g=()=>{a=void 0;let[b,I]=l();return I?h(b):A(b)},A=b=>{let I=b-u,w=b-c,x=t-I,C=o-w,_=Math.min(x,C);return E(_)},E=b=>{a&&clearTimeout(a),!(b<=0)&&(a=setTimeout(g,b))},v=(...b)=>{let[I,w]=l(),x=!!a;if(s=b,u=I,(w||!a)&&E(t),w)return x?p(I):m(I)};return v.cancel=d,v.flush=f,v},OEn=Jnd;var T6i=_e(require("fs"),1),TEn=_e(require("path"),1);var If=_e(require("fs"),1),y1=require("util");var hae=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},jX=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var B6i=_e(require("process"),1),XYa=B6i.default.getuid?!B6i.default.getuid():!1,ZYa=1e4,Bk=()=>{};var lBt={isChangeErrorOk:e=>{if(!lBt.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!XYa&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!lBt.isNodeError(e))return!1;let{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!lBt.isNodeError(e))throw e;if(!lBt.isChangeErrorOk(e))throw e}},xE=lBt;var O6i=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=ZYa,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=t=>{this.queueWaiting.add(t),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=t=>{this.queueWaiting.delete(t),this.queueActive.delete(t)},this.schedule=()=>new Promise(t=>{let r=()=>this.remove(n),n=()=>t(r);this.add(n)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t),this.queueActive.add(t),t()}}}}},eXa=new O6i;var gae=(e,t)=>function(n){return function i(...o){return eXa.schedule().then(s=>{let a=c=>(s(),c),u=c=>{if(s(),Date.now()>=n)throw c;if(t(c)){let l=Math.round(100*Math.random());return new Promise(d=>setTimeout(d,l)).then(()=>i.apply(void 0,o))}throw c};return e.apply(void 0,o).then(a,u)})}},Aae=(e,t)=>function(n){return function i(...o){try{return e.apply(void 0,o)}catch(s){if(Date.now()>n)throw s;if(t(s))return i.apply(void 0,o);throw s}}};var Ynd={attempt:{chmod:hae((0,y1.promisify)(If.default.chmod),xE.onChangeError),chown:hae((0,y1.promisify)(If.default.chown),xE.onChangeError),close:hae((0,y1.promisify)(If.default.close),Bk),fsync:hae((0,y1.promisify)(If.default.fsync),Bk),mkdir:hae((0,y1.promisify)(If.default.mkdir),Bk),realpath:hae((0,y1.promisify)(If.default.realpath),Bk),stat:hae((0,y1.promisify)(If.default.stat),Bk),unlink:hae((0,y1.promisify)(If.default.unlink),Bk),chmodSync:jX(If.default.chmodSync,xE.onChangeError),chownSync:jX(If.default.chownSync,xE.onChangeError),closeSync:jX(If.default.closeSync,Bk),existsSync:jX(If.default.existsSync,Bk),fsyncSync:jX(If.default.fsync,Bk),mkdirSync:jX(If.default.mkdirSync,Bk),realpathSync:jX(If.default.realpathSync,Bk),statSync:jX(If.default.statSync,Bk),unlinkSync:jX(If.default.unlinkSync,Bk)},retry:{close:gae((0,y1.promisify)(If.default.close),xE.isRetriableError),fsync:gae((0,y1.promisify)(If.default.fsync),xE.isRetriableError),open:gae((0,y1.promisify)(If.default.open),xE.isRetriableError),readFile:gae((0,y1.promisify)(If.default.readFile),xE.isRetriableError),rename:gae((0,y1.promisify)(If.default.rename),xE.isRetriableError),stat:gae((0,y1.promisify)(If.default.stat),xE.isRetriableError),write:gae((0,y1.promisify)(If.default.write),xE.isRetriableError),writeFile:gae((0,y1.promisify)(If.default.writeFile),xE.isRetriableError),closeSync:Aae(If.default.closeSync,xE.isRetriableError),fsyncSync:Aae(If.default.fsyncSync,xE.isRetriableError),openSync:Aae(If.default.openSync,xE.isRetriableError),readFileSync:Aae(If.default.readFileSync,xE.isRetriableError),renameSync:Aae(If.default.renameSync,xE.isRetriableError),statSync:Aae(If.default.statSync,xE.isRetriableError),writeSync:Aae(If.default.writeSync,xE.isRetriableError),writeFileSync:Aae(If.default.writeFileSync,xE.isRetriableError)}},tXa=Ynd;var PEn=_e(require("fs"),1),pBt=_e(require("path"),1);var P6i=()=>{};var Xnd=()=>{let e=P6i,t=P6i,r=!1,n=!1;return{promise:new Promise((u,c)=>{e=l=>(r=!0,u(l)),t=l=>(n=!0,c(l))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},rXa=Xnd;var Znd=()=>{let{promise:e,resolve:t,isPending:r}=rXa(),n=0,i=()=>{n+=1},o=()=>{n-=1,!n&&t()};return i(),queueMicrotask(o),{promise:e,isPending:r,increment:i,decrement:o}},nXa=Znd;var iXa={then:e=>{e()}};var oXa=e=>Array.isArray(e)?e:[e],sXa=e=>typeof e=="function";var eid=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,o=t?.ignore??[],s=oXa(o).map(J=>sXa(J)?J:H=>J.test(H)),a=J=>s.some(H=>H(J)),u=t?.signal??{aborted:!1},c=t?.onDirents||(()=>{}),l=[],p=new Set,d={},f=[],m=new Set,h={},g=[],A=new Set,E={},v={},b=new Set,I={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},w={directories:l,directoriesNames:p,directoriesNamesToPaths:d,files:f,filesNames:m,filesNamesToPaths:h,symlinks:g,symlinksNames:A,symlinksNamesToPaths:E,map:v},{promise:x,increment:C,decrement:_}=nXa(),R=0,U=(J,H,ge,me)=>{b.has(H)||R>=i||(R+=1,J.directories.push(H),J.directoriesNames.add(ge),l.push(H),p.add(ge),d.propertyIsEnumerable(ge)||(d[ge]=[]),d[ge].push(H),b.add(H),!(me>=n)&&(R>=i||K(H,me+1)))},q=(J,H,ge)=>{b.has(H)||R>=i||(R+=1,J.files.push(H),J.filesNames.add(ge),f.push(H),m.add(ge),h.propertyIsEnumerable(ge)||(h[ge]=[]),h[ge].push(H),b.add(H))},z=(J,H,ge,me)=>{b.has(H)||R>=i||(R+=1,J.symlinks.push(H),J.symlinksNames.add(ge),g.push(H),A.add(ge),E.propertyIsEnumerable(ge)||(E[ge]=[]),E[ge].push(H),b.add(H),r&&(me>=n||R>=i||Ee(H,me+1)))},Z=(J,H,ge,me,we)=>{u.aborted||a(H)||(me.isDirectory()?U(J,H,ge,we):me.isFile()?q(J,H,ge):me.isSymbolicLink()&&z(J,H,ge,we))},oe=(J,H,ge,me)=>{if(u.aborted)return;let we=H===pBt.default.sep?"":pBt.default.sep,Be=ge.name,le=`${H}${we}${Be}`;a(le)||(ge.isDirectory()?U(J,le,Be,me):ge.isFile()?q(J,le,Be):ge.isSymbolicLink()&&z(J,le,Be,me))},V=(J,H,ge,me)=>{for(let we=0,Be=ge.length;we<Be;we++)oe(J,H,ge[we],me)},K=(J,H)=>{u.aborted||H>n||R>=i||(C(),PEn.default.readdir(J,{withFileTypes:!0},(ge,me)=>{if(ge||u.aborted||!me.length)return _();(c(me)||iXa).then(()=>{let Be=v[J]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};V(Be,J,me,H),_()})}))},Ee=(J,H)=>{C(),PEn.default.realpath(J,(ge,me)=>{if(ge||u.aborted)return _();PEn.default.stat(me,(we,Be)=>{if(we||u.aborted)return _();let le=pBt.default.basename(me),ue=v[J]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};Z(ue,me,le,Be,H),_()})})};return(async(J,H=1)=>(J=pBt.default.normalize(J),b.add(J),K(J,H),await x,u.aborted?I:w))(e)},aXa=eid;var MX={lang:{debounce:OEn,attempt:e=>{try{return e()}catch(t){return MX.lang.castError(t)}},castArray:e=>MX.lang.isArray(e)?e:[e],castError:e=>MX.lang.isError(e)?e:MX.lang.isString(e)?new Error(e):new Error("Unknown error"),defer:e=>setTimeout(e,0),isArray:e=>Array.isArray(e),isError:e=>e instanceof Error,isFunction:e=>typeof e=="function",isNaN:e=>Number.isNaN(e),isNumber:e=>typeof e=="number",isPrimitive:e=>{if(e===null)return!0;let t=typeof e;return t!=="object"&&t!=="function"},isShallowEqual:(e,t)=>{if(e===t)return!0;if(MX.lang.isNaN(e))return MX.lang.isNaN(t);if(MX.lang.isPrimitive(e)||MX.lang.isPrimitive(t))return e===t;for(let r in e)if(!(r in t))return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0},isSet:e=>e instanceof Set,isString:e=>typeof e=="string",isUndefined:e=>e===void 0,noop:()=>{},uniq:e=>e.length<2?e:Array.from(new Set(e))},fs:{getDepth:e=>Math.max(0,e.split(TEn.default.sep).length-1),getRealPath:(e,t)=>{try{return t?T6i.default.realpathSync.native(e):T6i.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===TEn.default.sep&&t.length-e.length>TEn.default.sep.length,poll:(e,t=YYa)=>tXa.retry.stat(t)(e,{bigint:!0}).catch(MX.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,o)=>{if(o&&r===1&&e in o){let s=o[e];return[s.directories,s.files]}else{let s=await aXa(e,{depth:r,limit:n,ignore:t,signal:i});return[s.directories,s.files]}}}},cl=MX;var DEn=_e(require("path"),1);var D6i=class{constructor(t,r,n){this.base=n,this.watcher=t,this.handler=r.handler,this.fswatcher=r.watcher,this.options=r.options,this.folderPath=r.folderPath,this.filePath=r.filePath,this.handlerBatched=this.base?this.base.onWatcherEvent.bind(this.base):this._makeHandlerBatched(this.options.debounce)}_isSubRoot(t){return this.filePath?t===this.filePath:t===this.folderPath||cl.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=HYa){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,o=async(a,u)=>{let c=this.options.ignoreInitial?[]:a,l=await this.eventsPopulate([...u]),p=this.eventsDeduplicate([...c,...l]);this.onTargetEvents(p)},s=cl.lang.debounce(()=>{this.watcher.isClosed()||(r=o(n,i),n=[],i=new Set)},t);return async(a,u="",c=!1)=>{c?await this.eventsPopulate([u],n,!0):i.add(u),r.then(s)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[o,s]=i,a=r[s];return o===a||o===Za.CHANGE&&a===Za.ADD||(r[s]=o,n.push(i)),n},[])}async eventsPopulate(t,r=[],n=!1){return await Promise.all(t.map(async i=>{let o=await this.watcher._poller.update(i,this.options.pollingTimeout);await Promise.all(o.map(async s=>{r.push([s,i]),s===Za.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):s===Za.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,i,r,n)}))})),r}async eventsPopulateAddDir(t,r,n=[],i=!1){if(i)return n;let o=this.options.recursive?this.options.depth??Sve:Math.min(1,this.options.depth??Sve),s=this.options.limit??uBt,[a,u]=await cl.fs.readdir(r,this.options.ignore,o,s,this.watcher._closeSignal),c=[...a,...u];return await Promise.all(c.map(l=>{if(!this.watcher.isIgnored(l,this.options.ignore)&&!t.includes(l))return this.eventsPopulate([l],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let o of this.watcher._poller.stats.keys())cl.fs.isSubPath(r,o)&&(t.includes(o)||await this.eventsPopulate([o],n,!0));return n}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(Za.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!Bve&&this.options.native!==!1&&this.watcher.watchDirectory(t,this.options,this.handler,void 0,this.base||this),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAddDir(t,this.options.renameTimeout):this.watcher.event(Za.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(Za.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(DEn.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(Za.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(DEn.default.dirname(t),t,!1),this.watcher.watchersClose(t),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlinkDir(t,this.options.renameTimeout):this.watcher.event(Za.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===Za.ADD?this.onTargetAdd(n):r===Za.ADD_DIR?this.onTargetAddDir(n):r===Za.CHANGE?this.onTargetChange(n):r===Za.UNLINK?this.onTargetUnlink(n):r===Za.UNLINK_DIR&&this.onTargetUnlinkDir(n)}onTargetEvents(t){for(let r of t)this.onTargetEvent(r)}onWatcherEvent(t,r,n=!1){return this.handlerBatched(t,r,n)}onWatcherChange(t=zDe.CHANGE,r){if(this.watcher.isClosed())return;let n=DEn.default.resolve(this.folderPath,r||"");this.filePath&&n!==this.folderPath&&n!==this.filePath||this.watcher.isIgnored(n,this.options.ignore)||this.onWatcherEvent(t,n)}onWatcherError(t){_6i&&t.code==="EPERM"?this.onWatcherChange(zDe.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(cBt.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(cBt.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(zDe.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&Bve&&this.options.native!==!1?this.options.depth??Sve:Math.min(1,this.options.depth??Sve),n=this.options.limit??uBt,[i,o]=await cl.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),s=[this.folderPath,...i,...o];await Promise.all(s.map(a=>{if(!this.watcher._poller.stats.has(a)&&!this.watcher.isIgnored(a,this.options.ignore))return this.onWatcherEvent(zDe.CHANGE,a,t)}))}}},uXa=D6i;var QT={interval:100,intervalId:void 0,fns:new Map,init:()=>{QT.intervalId||(QT.intervalId=setInterval(QT.resolve,QT.interval))},reset:()=>{QT.intervalId&&(clearInterval(QT.intervalId),delete QT.intervalId)},add:(e,t)=>{QT.fns.set(e,Date.now()+t),QT.init()},remove:e=>{QT.fns.delete(e)},resolve:()=>{if(!QT.fns.size)return QT.reset();let e=Date.now();for(let[t,r]of QT.fns)r>=e||(QT.remove(t),t())}},fBt=QT;var dBt=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=S6i){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{let p=this._watcher._poller.paths.find(n||-1,d=>d!==i);if(p&&p!==i){if(cl.fs.getRealPath(i,!0)===p)return;this._watcher.event(o.rename,p,i)}else this._watcher.event(o.add,i)};if(!n)return a();let u=()=>{s.add.delete(n),fBt.remove(c)},c=()=>{u(),a()};fBt.add(c,r);let l=()=>{let p=s.unlink.get(n);if(!p)return;u();let d=p();i===d?o.change&&this._watcher._poller.stats.has(i)&&this._watcher.event(o.change,i):this._watcher.event(o.rename,d,i)};s.add.set(n,l),l()}getLockUnlink(t,r=S6i){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{this._watcher.event(o.unlink,i)};if(!n)return a();let u=()=>{s.unlink.delete(n),fBt.remove(c)},c=()=>{u(),a()};fBt.add(c,r);let l=()=>(u(),i);s.unlink.set(n,l),s.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,Za.ADD,NX.FILE);return this.getLockAdd({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetAddDir(t,r){let n=this._watcher._poller.getIno(t,Za.ADD_DIR,NX.DIR);return this.getLockAdd({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}getLockTargetUnlink(t,r){let n=this._watcher._poller.getIno(t,Za.UNLINK,NX.FILE);return this.getLockUnlink({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetUnlinkDir(t,r){let n=this._watcher._poller.getIno(t,Za.UNLINK_DIR,NX.DIR);return this.getLockUnlink({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}reset(){this._locksAdd=new Map,this._locksAddDir=new Map,this._locksUnlink=new Map,this._locksUnlinkDir=new Map,this._locksDir={add:this._locksAddDir,unlink:this._locksUnlinkDir},this._locksFile={add:this._locksAdd,unlink:this._locksUnlink}}};dBt.DIR_EVENTS={add:Za.ADD_DIR,rename:Za.RENAME_DIR,unlink:Za.UNLINK_DIR};dBt.FILE_EVENTS={add:Za.ADD,change:Za.CHANGE,rename:Za.RENAME,unlink:Za.UNLINK};var cXa=dBt;var R6i=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(cl.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(cl.lang.isSet(n)){let i=n.delete(r);return n.size||this.map.delete(t),i}else if(n===r)return this.map.delete(t),!0}return!1}find(t,r){if(this.map.has(t)){let n=this.map.get(t);if(cl.lang.isSet(n))return Array.from(n).find(r);if(r(n))return n}}get(t){return this.map.get(t)}has(t,r){if(cl.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return cl.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);cl.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},F6i=R6i;var k6i=class{constructor(t){this.ino=t.ino<=Number.MAX_SAFE_INTEGER?Number(t.ino):t.ino,this.size=Number(t.size),this.atimeMs=Number(t.atimeMs),this.mtimeMs=Number(t.mtimeMs),this.ctimeMs=Number(t.ctimeMs),this.birthtimeMs=Number(t.birthtimeMs),this._isFile=t.isFile(),this._isDirectory=t.isDirectory(),this._isSymbolicLink=t.isSymbolicLink()}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isSymbolicLink(){return this._isSymbolicLink}},lXa=k6i;var Q6i=class{constructor(){this.inos={},this.paths=new F6i,this.stats=new Map}getIno(t,r,n){let i=this.inos[r];if(!i)return;let o=i[t];if(o&&!(n&&o[1]!==n))return o[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let n=await cl.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new lXa(n)}reset(){this.inos={},this.paths=new F6i,this.stats=new Map}async update(t,r){let n=this.getStats(t),i=await this.poll(t,r);if(this.updateStats(t,i),!n&&i){if(i.isFile())return this.updateIno(t,Za.ADD,i),[Za.ADD];if(i.isDirectory())return this.updateIno(t,Za.ADD_DIR,i),[Za.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,Za.UNLINK,n),[Za.UNLINK];if(n.isDirectory())return this.updateIno(t,Za.UNLINK_DIR,n),[Za.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,Za.CHANGE,i),[Za.CHANGE]);if(i.isDirectory())return this.updateIno(t,Za.UNLINK,n),this.updateIno(t,Za.ADD_DIR,i),[Za.UNLINK,Za.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,Za.UNLINK_DIR,n),this.updateIno(t,Za.ADD,i),[Za.UNLINK_DIR,Za.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,Za.UNLINK_DIR,n),this.updateIno(t,Za.ADD_DIR,i),[Za.UNLINK_DIR,Za.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),o=n.isFile()?NX.FILE:NX.DIR;i[t]=[n.ino,o]}updateStats(t,r){if(r)this.paths.set(r.ino,t),this.stats.set(t,r);else{let n=this.stats.get(t)?.ino||-1;this.paths.delete(n,t),this.stats.delete(t)}}},N6i=Q6i;var j6i=class e extends pXa.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(kT.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on(kT.CLOSE,i)),this._readyWait=new Promise(i=>this.on(kT.READY,i)),this._locker=new cXa(this),this._roots=new Set,this._poller=new N6i,this._pollers=new Set,this._subwatchers=new Set,this._watchers={},this._watchersLock=Promise.resolve(),this._watchersRestorable={},this.watch(t,r,n)}isClosed(){return this._closed}isIgnored(t,r){return!!r&&(cl.lang.isFunction(r)?!!r(t):r.test(t))}isReady(){return this._ready}close(){return this._locker.reset(),this._poller.reset(),this._roots.clear(),this.watchersClose(),this.isClosed()?!1:(this._closed=!0,this.emit(kT.CLOSE))}error(t){if(this.isClosed())return!1;let r=cl.lang.castError(t);return this.emit(kT.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit(kT.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(kT.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&cl.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&cl.lang.isShallowEqual(n.options,r))return!0;return!1}watchersClose(t,r,n=!0){if(t){let i=this._watchers[t];if(i)for(let o of[...i])r&&o.filePath!==r||this.watcherClose(o);if(n)for(let o in this._watchers)cl.fs.isSubPath(t,o)&&this.watchersClose(o,r,!1)}else for(let i in this._watchers)this.watchersClose(i,r,!1)}watchersLock(t){return this._watchersLock.then(()=>this._watchersLock=new Promise(async r=>{await t(),r()}))}watchersRestore(){delete this._watchersRestoreTimeout;let t=Object.entries(this._watchersRestorable);this._watchersRestorable={};for(let[r,n]of t)this.watchPath(r,n.options,n.handler)}async watcherAdd(t,r){let{folderPath:n}=t;(this._watchers[n]=this._watchers[n]||[]).push(t);let o=new uXa(this,t,r);return await o.init(),o}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let o=r.indexOf(t);r.splice(o,1),r.length||delete this._watchers[t.folderPath]}let n=t.filePath||t.folderPath;this._roots.has(n)&&(this._watchersRestorable[n]=t,this._watchersRestoreTimeout||(this._watchersRestoreTimeout=cl.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(a=>a.handler===n&&(!a.filePath||a.filePath===i)&&a.options.ignore===r.ignore&&!!a.options.native==!!r.native&&(!r.recursive||a.options.recursive)))return!0;let s=VDe.default.dirname(t);for(let a=1;a<1/0;a++){if(this._watchers[s]?.find(l=>(a===1||l.options.recursive&&a<=(l.options.depth??Sve))&&l.handler===n&&(!l.filePath||l.filePath===i)&&l.options.ignore===r.ignore&&!!l.options.native==!!r.native&&(!r.recursive||l.options.recursive&&Bve&&l.options.native!==!1)))return!0;if(!Bve)break;let c=VDe.default.dirname(t);if(s===c)break;s=c}return!1}async watchDirectories(t,r,n,i,o){if(this.isClosed())return;t=cl.lang.uniq(t).sort();let s;for(let a of t)if(!this.isIgnored(a,r.ignore)&&!this.watcherExists(a,r,n,i))try{let u=!r.recursive||Bve&&r.native!==!1?r:{...r,recursive:!1},l={watcher:REn.default.watch(a,u),handler:n,options:r,folderPath:a,filePath:i},p=s=await this.watcherAdd(l,o);if(this._roots.has(i||a)){let f={...r,ignoreInitial:!0,recursive:!1},m=VDe.default.dirname(a),h=a;await this.watchDirectories([m],f,n,h,p)}}catch(u){this.error(u)}return s}async watchDirectory(t,r,n,i,o){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||Bve&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,o));{r={...r,recursive:!0};let s=r.depth??Sve,a=r.limit??uBt,[u]=await cl.fs.readdir(t,r.ignore,s,a,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let c=await this.watchDirectories([t],r,n,i,o);if(u.length){let l=cl.fs.getDepth(t);for(let p of u){let d=cl.fs.getDepth(p),f=Math.max(0,s-(d-l)),m={...r,depth:f};await this.watchDirectories([p],m,n,i,o||c)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},o=(c,l)=>{l===t&&(u(),n())},s=new e(o),a=()=>{this._subwatchers.add(i),this.on(kT.CLOSE,u),s.watchFile(t,r,o)},u=()=>{this._subwatchers.delete(i),this.removeListener(kT.CLOSE,u),s.close()};return a()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=VDe.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,o=new N6i,s=await this.watchPolling(t,r,async()=>{i||!(await o.update(t,r.pollingTimeout)).length||i||(i=!0,s(),n())})}async watchPolling(t,r,n){if(this.isClosed())return cl.lang.noop;if(this.pollerExists(t,r))return cl.lang.noop;let i={...r,interval:r.pollingInterval??JYa},o={targetPath:t,options:r},s=()=>{this._pollers.add(o),this.on(kT.CLOSE,a),REn.default.watchFile(t,i,n)},a=()=>{this._pollers.delete(o),this.removeListener(kT.CLOSE,a),REn.default.unwatchFile(t,n)};return cl.lang.attempt(s),()=>cl.lang.attempt(a)}async watchUnknownChild(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchFileOnce(t,r,i)}async watchUnknownTarget(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchPollingOnce(t,r,i)}async watchPaths(t,r,n){if(this.isClosed())return;if(t=cl.lang.uniq(t).sort(),t.every((o,s)=>t.every((a,u)=>u===s||!cl.fs.isSubPath(o,a))))await Promise.all(t.map(o=>this.watchPath(o,r,n)));else for(let o of t)await this.watchPath(o,r,n)}async watchPath(t,r,n){if(this.isClosed()||(t=VDe.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await cl.fs.poll(t,r.pollingTimeout);if(i){if(i.isFile())return this.watchFile(t,r,n);if(i.isDirectory())return this.watchDirectory(t,r,n);this.error(`"${t}" is not supported`)}else{let o=VDe.default.dirname(t);return(await cl.fs.poll(o,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=cl.lang.noop){if(cl.lang.isFunction(t))return this.watch([],{},t);if(cl.lang.isUndefined(t))return this.watch([],r,n);if(cl.lang.isFunction(r))return this.watch(t,{},r);if(cl.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=cl.lang.castArray(t);i.forEach(o=>this._roots.add(o)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==cl.lang.noop&&this.on(kT.ALL,n),r.readdirMap=void 0,this.ready())}},FEn=j6i;HEn();Vt();var Hrt=require("fs/promises"),AZa=require("os"),yZa=_e(require("path"),1),wod=".fern",Cod="logs";function xod(){return"cli@4.32.1"}var KDe=class{logFilePath=null;initialized=!1;sessionStartTime;constructor(){this.sessionStartTime=Date.now()}async initialize(){if(this.initialized)return;let t=We(Ut.of((0,AZa.homedir)()),Se.of(wod)),r=We(t,Se.of(Cod));await Xt(r)||await(0,Hrt.mkdir)(r,{recursive:!0});let i=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=We(r,Se.of(i));let o=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${yZa.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
|
|
2166
|
+
`)}if(s)throw Kr.exit();if(o.warningCount>0){t.stderr.info(`${po.warning} ${be.yellow(`Found ${o.warningCount} warnings`)}`),t.stderr.info(be.dim(" Run 'fern docs check --strict' to treat warnings as errors"));return}t.stderr.info(`${po.success} ${be.green("All checks passed")}`)}buildJsonResponse({result:t,hasErrors:r}){let n={};return t.violations.length>0&&(n.docs=t.violations.map(i=>mK(i))),{success:!r,results:n}}};function i8i(e){let t=new n8i;va(e,"check","Validate docs configuration",(r,n)=>t.handle(r,n),r=>r.option("strict",{type:"boolean",description:"Treat warnings as errors",default:!1}).option("json",{type:"boolean",description:"Output results as JSON to stdout",default:!1}))}var f$a=_e(require("net"),1),d$a=_e(require("os"),1),z0n=class extends Error{constructor(t){super(`${t} is locked`)}},Crt={old:new Set,young:new Set},DJf=1e3*15;var NSt,RJf=()=>{let e=d$a.default.networkInterfaces(),t=new Set([void 0,"0.0.0.0"]);for(let r of Object.values(e))for(let n of r)t.add(n.address);return t},l$a=e=>new Promise((t,r)=>{let n=f$a.default.createServer();n.unref(),n.on("error",r),n.listen(e,()=>{let{port:i}=n.address();n.close(()=>{t(i)})})}),p$a=async(e,t)=>{if(e.host||e.port===0)return l$a(e);for(let r of t)try{await l$a({port:e.port,host:r})}catch(n){if(!["EADDRNOTAVAIL","EINVAL"].includes(n.code))throw n}return e.port},FJf=function*(e){e&&(yield*e),yield 0};async function Eve(e){let t,r=new Set;if(e&&(e.port&&(t=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let i=e.exclude;if(typeof i[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let o of i){if(typeof o!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(o))throw new TypeError(`Number ${o} in the exclude option is not a safe integer and can't be used`)}r=new Set(i)}NSt===void 0&&(NSt=setTimeout(()=>{NSt=void 0,Crt.old=Crt.young,Crt.young=new Set},DJf),NSt.unref&&NSt.unref());let n=RJf();for(let i of FJf(t))try{if(r.has(i))continue;let o=await p$a({...e,port:i},n);for(;Crt.old.has(o)||Crt.young.has(o);){if(i!==0)throw new z0n(i);o=await p$a({...e,port:i},n)}return Crt.young.add(o),o}catch(o){if(!["EADDRINUSE","EACCES"].includes(o.code)&&!(o instanceof z0n))throw o}throw new Error("No available ports found")}_g();Vt();var Pou=_e(a8i(),1),Tou=_e(BEn(),1),fIn=require("fs/promises"),Dou=_e(require("http"),1),Rou=_e(require("path"),1);var pXa=require("events"),REn=_e(require("fs"),1),VDe=_e(require("path"),1);var $Ya=_e(require("os"),1),HYa=300,Sve=20,uBt=1e7,KYa=$Ya.default.platform();var Knd=KYa==="darwin",_6i=KYa==="win32",Bve=Knd||_6i,JYa=3e3,YYa=2e4,S6i=1250;var NX;(function(e){e[e.DIR=1]="DIR",e[e.FILE=2]="FILE"})(NX||(NX={}));var zDe;(function(e){e.CHANGE="change",e.RENAME="rename"})(zDe||(zDe={}));var cBt;(function(e){e.CHANGE="change",e.ERROR="error"})(cBt||(cBt={}));var Za;(function(e){e.ADD="add",e.ADD_DIR="addDir",e.CHANGE="change",e.RENAME="rename",e.RENAME_DIR="renameDir",e.UNLINK="unlink",e.UNLINK_DIR="unlinkDir"})(Za||(Za={}));var kT;(function(e){e.ALL="all",e.CLOSE="close",e.ERROR="error",e.READY="ready"})(kT||(kT={}));var Jnd=(e,t=1,r)=>{t=Math.max(1,t);let n=r?.leading??!1,i=r?.trailing??!0,o=Math.max(r?.maxWait??1/0,t),s,a,u=0,c=0,l=()=>{let b=Date.now(),I=b-u,w=b-c,x=I>=t||w>=o;return[b,x]},p=b=>{if(c=b,!s)return;let I=s;s=void 0,e.apply(void 0,I)},d=()=>{E(0)},f=()=>{a&&(d(),p(Date.now()))},m=b=>{if(c=b,n)return p(b)},h=b=>{if(i&&s)return p(b);s=void 0},g=()=>{a=void 0;let[b,I]=l();return I?h(b):A(b)},A=b=>{let I=b-u,w=b-c,x=t-I,C=o-w,_=Math.min(x,C);return E(_)},E=b=>{a&&clearTimeout(a),!(b<=0)&&(a=setTimeout(g,b))},v=(...b)=>{let[I,w]=l(),x=!!a;if(s=b,u=I,(w||!a)&&E(t),w)return x?p(I):m(I)};return v.cancel=d,v.flush=f,v},OEn=Jnd;var T6i=_e(require("fs"),1),TEn=_e(require("path"),1);var If=_e(require("fs"),1),y1=require("util");var hae=(e,t)=>function(...n){return e.apply(void 0,n).catch(t)},jX=(e,t)=>function(...n){try{return e.apply(void 0,n)}catch(i){return t(i)}};var B6i=_e(require("process"),1),XYa=B6i.default.getuid?!B6i.default.getuid():!1,ZYa=1e4,Bk=()=>{};var lBt={isChangeErrorOk:e=>{if(!lBt.isNodeError(e))return!1;let{code:t}=e;return t==="ENOSYS"||!XYa&&(t==="EINVAL"||t==="EPERM")},isNodeError:e=>e instanceof Error,isRetriableError:e=>{if(!lBt.isNodeError(e))return!1;let{code:t}=e;return t==="EMFILE"||t==="ENFILE"||t==="EAGAIN"||t==="EBUSY"||t==="EACCESS"||t==="EACCES"||t==="EACCS"||t==="EPERM"},onChangeError:e=>{if(!lBt.isNodeError(e))throw e;if(!lBt.isChangeErrorOk(e))throw e}},xE=lBt;var O6i=class{constructor(){this.interval=25,this.intervalId=void 0,this.limit=ZYa,this.queueActive=new Set,this.queueWaiting=new Set,this.init=()=>{this.intervalId||(this.intervalId=setInterval(this.tick,this.interval))},this.reset=()=>{this.intervalId&&(clearInterval(this.intervalId),delete this.intervalId)},this.add=t=>{this.queueWaiting.add(t),this.queueActive.size<this.limit/2?this.tick():this.init()},this.remove=t=>{this.queueWaiting.delete(t),this.queueActive.delete(t)},this.schedule=()=>new Promise(t=>{let r=()=>this.remove(n),n=()=>t(r);this.add(n)}),this.tick=()=>{if(!(this.queueActive.size>=this.limit)){if(!this.queueWaiting.size)return this.reset();for(let t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t),this.queueActive.add(t),t()}}}}},eXa=new O6i;var gae=(e,t)=>function(n){return function i(...o){return eXa.schedule().then(s=>{let a=c=>(s(),c),u=c=>{if(s(),Date.now()>=n)throw c;if(t(c)){let l=Math.round(100*Math.random());return new Promise(d=>setTimeout(d,l)).then(()=>i.apply(void 0,o))}throw c};return e.apply(void 0,o).then(a,u)})}},Aae=(e,t)=>function(n){return function i(...o){try{return e.apply(void 0,o)}catch(s){if(Date.now()>n)throw s;if(t(s))return i.apply(void 0,o);throw s}}};var Ynd={attempt:{chmod:hae((0,y1.promisify)(If.default.chmod),xE.onChangeError),chown:hae((0,y1.promisify)(If.default.chown),xE.onChangeError),close:hae((0,y1.promisify)(If.default.close),Bk),fsync:hae((0,y1.promisify)(If.default.fsync),Bk),mkdir:hae((0,y1.promisify)(If.default.mkdir),Bk),realpath:hae((0,y1.promisify)(If.default.realpath),Bk),stat:hae((0,y1.promisify)(If.default.stat),Bk),unlink:hae((0,y1.promisify)(If.default.unlink),Bk),chmodSync:jX(If.default.chmodSync,xE.onChangeError),chownSync:jX(If.default.chownSync,xE.onChangeError),closeSync:jX(If.default.closeSync,Bk),existsSync:jX(If.default.existsSync,Bk),fsyncSync:jX(If.default.fsync,Bk),mkdirSync:jX(If.default.mkdirSync,Bk),realpathSync:jX(If.default.realpathSync,Bk),statSync:jX(If.default.statSync,Bk),unlinkSync:jX(If.default.unlinkSync,Bk)},retry:{close:gae((0,y1.promisify)(If.default.close),xE.isRetriableError),fsync:gae((0,y1.promisify)(If.default.fsync),xE.isRetriableError),open:gae((0,y1.promisify)(If.default.open),xE.isRetriableError),readFile:gae((0,y1.promisify)(If.default.readFile),xE.isRetriableError),rename:gae((0,y1.promisify)(If.default.rename),xE.isRetriableError),stat:gae((0,y1.promisify)(If.default.stat),xE.isRetriableError),write:gae((0,y1.promisify)(If.default.write),xE.isRetriableError),writeFile:gae((0,y1.promisify)(If.default.writeFile),xE.isRetriableError),closeSync:Aae(If.default.closeSync,xE.isRetriableError),fsyncSync:Aae(If.default.fsyncSync,xE.isRetriableError),openSync:Aae(If.default.openSync,xE.isRetriableError),readFileSync:Aae(If.default.readFileSync,xE.isRetriableError),renameSync:Aae(If.default.renameSync,xE.isRetriableError),statSync:Aae(If.default.statSync,xE.isRetriableError),writeSync:Aae(If.default.writeSync,xE.isRetriableError),writeFileSync:Aae(If.default.writeFileSync,xE.isRetriableError)}},tXa=Ynd;var PEn=_e(require("fs"),1),pBt=_e(require("path"),1);var P6i=()=>{};var Xnd=()=>{let e=P6i,t=P6i,r=!1,n=!1;return{promise:new Promise((u,c)=>{e=l=>(r=!0,u(l)),t=l=>(n=!0,c(l))}),resolve:e,reject:t,isPending:()=>!r&&!n,isResolved:()=>r,isRejected:()=>n}},rXa=Xnd;var Znd=()=>{let{promise:e,resolve:t,isPending:r}=rXa(),n=0,i=()=>{n+=1},o=()=>{n-=1,!n&&t()};return i(),queueMicrotask(o),{promise:e,isPending:r,increment:i,decrement:o}},nXa=Znd;var iXa={then:e=>{e()}};var oXa=e=>Array.isArray(e)?e:[e],sXa=e=>typeof e=="function";var eid=(e,t)=>{let r=t?.followSymlinks??!1,n=t?.depth??1/0,i=t?.limit??1/0,o=t?.ignore??[],s=oXa(o).map(J=>sXa(J)?J:H=>J.test(H)),a=J=>s.some(H=>H(J)),u=t?.signal??{aborted:!1},c=t?.onDirents||(()=>{}),l=[],p=new Set,d={},f=[],m=new Set,h={},g=[],A=new Set,E={},v={},b=new Set,I={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{},map:{}},w={directories:l,directoriesNames:p,directoriesNamesToPaths:d,files:f,filesNames:m,filesNamesToPaths:h,symlinks:g,symlinksNames:A,symlinksNamesToPaths:E,map:v},{promise:x,increment:C,decrement:_}=nXa(),R=0,U=(J,H,ge,me)=>{b.has(H)||R>=i||(R+=1,J.directories.push(H),J.directoriesNames.add(ge),l.push(H),p.add(ge),d.propertyIsEnumerable(ge)||(d[ge]=[]),d[ge].push(H),b.add(H),!(me>=n)&&(R>=i||K(H,me+1)))},q=(J,H,ge)=>{b.has(H)||R>=i||(R+=1,J.files.push(H),J.filesNames.add(ge),f.push(H),m.add(ge),h.propertyIsEnumerable(ge)||(h[ge]=[]),h[ge].push(H),b.add(H))},z=(J,H,ge,me)=>{b.has(H)||R>=i||(R+=1,J.symlinks.push(H),J.symlinksNames.add(ge),g.push(H),A.add(ge),E.propertyIsEnumerable(ge)||(E[ge]=[]),E[ge].push(H),b.add(H),r&&(me>=n||R>=i||Ee(H,me+1)))},Z=(J,H,ge,me,we)=>{u.aborted||a(H)||(me.isDirectory()?U(J,H,ge,we):me.isFile()?q(J,H,ge):me.isSymbolicLink()&&z(J,H,ge,we))},oe=(J,H,ge,me)=>{if(u.aborted)return;let we=H===pBt.default.sep?"":pBt.default.sep,Be=ge.name,le=`${H}${we}${Be}`;a(le)||(ge.isDirectory()?U(J,le,Be,me):ge.isFile()?q(J,le,Be):ge.isSymbolicLink()&&z(J,le,Be,me))},V=(J,H,ge,me)=>{for(let we=0,Be=ge.length;we<Be;we++)oe(J,H,ge[we],me)},K=(J,H)=>{u.aborted||H>n||R>=i||(C(),PEn.default.readdir(J,{withFileTypes:!0},(ge,me)=>{if(ge||u.aborted||!me.length)return _();(c(me)||iXa).then(()=>{let Be=v[J]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};V(Be,J,me,H),_()})}))},Ee=(J,H)=>{C(),PEn.default.realpath(J,(ge,me)=>{if(ge||u.aborted)return _();PEn.default.stat(me,(we,Be)=>{if(we||u.aborted)return _();let le=pBt.default.basename(me),ue=v[J]={directories:[],directoriesNames:new Set,directoriesNamesToPaths:{},files:[],filesNames:new Set,filesNamesToPaths:{},symlinks:[],symlinksNames:new Set,symlinksNamesToPaths:{}};Z(ue,me,le,Be,H),_()})})};return(async(J,H=1)=>(J=pBt.default.normalize(J),b.add(J),K(J,H),await x,u.aborted?I:w))(e)},aXa=eid;var MX={lang:{debounce:OEn,attempt:e=>{try{return e()}catch(t){return MX.lang.castError(t)}},castArray:e=>MX.lang.isArray(e)?e:[e],castError:e=>MX.lang.isError(e)?e:MX.lang.isString(e)?new Error(e):new Error("Unknown error"),defer:e=>setTimeout(e,0),isArray:e=>Array.isArray(e),isError:e=>e instanceof Error,isFunction:e=>typeof e=="function",isNaN:e=>Number.isNaN(e),isNumber:e=>typeof e=="number",isPrimitive:e=>{if(e===null)return!0;let t=typeof e;return t!=="object"&&t!=="function"},isShallowEqual:(e,t)=>{if(e===t)return!0;if(MX.lang.isNaN(e))return MX.lang.isNaN(t);if(MX.lang.isPrimitive(e)||MX.lang.isPrimitive(t))return e===t;for(let r in e)if(!(r in t))return!1;for(let r in t)if(e[r]!==t[r])return!1;return!0},isSet:e=>e instanceof Set,isString:e=>typeof e=="string",isUndefined:e=>e===void 0,noop:()=>{},uniq:e=>e.length<2?e:Array.from(new Set(e))},fs:{getDepth:e=>Math.max(0,e.split(TEn.default.sep).length-1),getRealPath:(e,t)=>{try{return t?T6i.default.realpathSync.native(e):T6i.default.realpathSync(e)}catch{return}},isSubPath:(e,t)=>t.startsWith(e)&&t[e.length]===TEn.default.sep&&t.length-e.length>TEn.default.sep.length,poll:(e,t=YYa)=>tXa.retry.stat(t)(e,{bigint:!0}).catch(MX.lang.noop),readdir:async(e,t,r=1/0,n=1/0,i,o)=>{if(o&&r===1&&e in o){let s=o[e];return[s.directories,s.files]}else{let s=await aXa(e,{depth:r,limit:n,ignore:t,signal:i});return[s.directories,s.files]}}}},cl=MX;var DEn=_e(require("path"),1);var D6i=class{constructor(t,r,n){this.base=n,this.watcher=t,this.handler=r.handler,this.fswatcher=r.watcher,this.options=r.options,this.folderPath=r.folderPath,this.filePath=r.filePath,this.handlerBatched=this.base?this.base.onWatcherEvent.bind(this.base):this._makeHandlerBatched(this.options.debounce)}_isSubRoot(t){return this.filePath?t===this.filePath:t===this.folderPath||cl.fs.isSubPath(this.folderPath,t)}_makeHandlerBatched(t=HYa){return(()=>{let r=this.watcher._readyWait,n=[],i=new Set,o=async(a,u)=>{let c=this.options.ignoreInitial?[]:a,l=await this.eventsPopulate([...u]),p=this.eventsDeduplicate([...c,...l]);this.onTargetEvents(p)},s=cl.lang.debounce(()=>{this.watcher.isClosed()||(r=o(n,i),n=[],i=new Set)},t);return async(a,u="",c=!1)=>{c?await this.eventsPopulate([u],n,!0):i.add(u),r.then(s)}})()}eventsDeduplicate(t){if(t.length<2)return t;let r={};return t.reduce((n,i)=>{let[o,s]=i,a=r[s];return o===a||o===Za.CHANGE&&a===Za.ADD||(r[s]=o,n.push(i)),n},[])}async eventsPopulate(t,r=[],n=!1){return await Promise.all(t.map(async i=>{let o=await this.watcher._poller.update(i,this.options.pollingTimeout);await Promise.all(o.map(async s=>{r.push([s,i]),s===Za.ADD_DIR?await this.eventsPopulateAddDir(t,i,r,n):s===Za.UNLINK_DIR&&await this.eventsPopulateUnlinkDir(t,i,r,n)}))})),r}async eventsPopulateAddDir(t,r,n=[],i=!1){if(i)return n;let o=this.options.recursive?this.options.depth??Sve:Math.min(1,this.options.depth??Sve),s=this.options.limit??uBt,[a,u]=await cl.fs.readdir(r,this.options.ignore,o,s,this.watcher._closeSignal),c=[...a,...u];return await Promise.all(c.map(l=>{if(!this.watcher.isIgnored(l,this.options.ignore)&&!t.includes(l))return this.eventsPopulate([l],n,!0)})),n}async eventsPopulateUnlinkDir(t,r,n=[],i=!1){if(i)return n;for(let o of this.watcher._poller.stats.keys())cl.fs.isSubPath(r,o)&&(t.includes(o)||await this.eventsPopulate([o],n,!0));return n}onTargetAdd(t){this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAdd(t,this.options.renameTimeout):this.watcher.event(Za.ADD,t))}onTargetAddDir(t){t!==this.folderPath&&this.options.recursive&&!Bve&&this.options.native!==!1&&this.watcher.watchDirectory(t,this.options,this.handler,void 0,this.base||this),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetAddDir(t,this.options.renameTimeout):this.watcher.event(Za.ADD_DIR,t))}onTargetChange(t){this._isSubRoot(t)&&this.watcher.event(Za.CHANGE,t)}onTargetUnlink(t){this.watcher.watchersClose(DEn.default.dirname(t),t,!1),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlink(t,this.options.renameTimeout):this.watcher.event(Za.UNLINK,t))}onTargetUnlinkDir(t){this.watcher.watchersClose(DEn.default.dirname(t),t,!1),this.watcher.watchersClose(t),this._isSubRoot(t)&&(this.options.renameDetection?this.watcher._locker.getLockTargetUnlinkDir(t,this.options.renameTimeout):this.watcher.event(Za.UNLINK_DIR,t))}onTargetEvent(t){let[r,n]=t;r===Za.ADD?this.onTargetAdd(n):r===Za.ADD_DIR?this.onTargetAddDir(n):r===Za.CHANGE?this.onTargetChange(n):r===Za.UNLINK?this.onTargetUnlink(n):r===Za.UNLINK_DIR&&this.onTargetUnlinkDir(n)}onTargetEvents(t){for(let r of t)this.onTargetEvent(r)}onWatcherEvent(t,r,n=!1){return this.handlerBatched(t,r,n)}onWatcherChange(t=zDe.CHANGE,r){if(this.watcher.isClosed())return;let n=DEn.default.resolve(this.folderPath,r||"");this.filePath&&n!==this.folderPath&&n!==this.filePath||this.watcher.isIgnored(n,this.options.ignore)||this.onWatcherEvent(t,n)}onWatcherError(t){_6i&&t.code==="EPERM"?this.onWatcherChange(zDe.CHANGE,""):this.watcher.error(t)}async init(){await this.initWatcherEvents(),await this.initInitialEvents()}async initWatcherEvents(){let t=this.onWatcherChange.bind(this);this.fswatcher.on(cBt.CHANGE,t);let r=this.onWatcherError.bind(this);this.fswatcher.on(cBt.ERROR,r)}async initInitialEvents(){let t=!this.watcher.isReady();if(this.filePath){if(this.watcher._poller.stats.has(this.filePath))return;await this.onWatcherEvent(zDe.CHANGE,this.filePath,t)}else{let r=this.options.recursive&&Bve&&this.options.native!==!1?this.options.depth??Sve:Math.min(1,this.options.depth??Sve),n=this.options.limit??uBt,[i,o]=await cl.fs.readdir(this.folderPath,this.options.ignore,r,n,this.watcher._closeSignal,this.options.readdirMap),s=[this.folderPath,...i,...o];await Promise.all(s.map(a=>{if(!this.watcher._poller.stats.has(a)&&!this.watcher.isIgnored(a,this.options.ignore))return this.onWatcherEvent(zDe.CHANGE,a,t)}))}}},uXa=D6i;var QT={interval:100,intervalId:void 0,fns:new Map,init:()=>{QT.intervalId||(QT.intervalId=setInterval(QT.resolve,QT.interval))},reset:()=>{QT.intervalId&&(clearInterval(QT.intervalId),delete QT.intervalId)},add:(e,t)=>{QT.fns.set(e,Date.now()+t),QT.init()},remove:e=>{QT.fns.delete(e)},resolve:()=>{if(!QT.fns.size)return QT.reset();let e=Date.now();for(let[t,r]of QT.fns)r>=e||(QT.remove(t),t())}},fBt=QT;var dBt=class e{constructor(t){this._watcher=t,this.reset()}getLockAdd(t,r=S6i){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{let p=this._watcher._poller.paths.find(n||-1,d=>d!==i);if(p&&p!==i){if(cl.fs.getRealPath(i,!0)===p)return;this._watcher.event(o.rename,p,i)}else this._watcher.event(o.add,i)};if(!n)return a();let u=()=>{s.add.delete(n),fBt.remove(c)},c=()=>{u(),a()};fBt.add(c,r);let l=()=>{let p=s.unlink.get(n);if(!p)return;u();let d=p();i===d?o.change&&this._watcher._poller.stats.has(i)&&this._watcher.event(o.change,i):this._watcher.event(o.rename,d,i)};s.add.set(n,l),l()}getLockUnlink(t,r=S6i){let{ino:n,targetPath:i,events:o,locks:s}=t,a=()=>{this._watcher.event(o.unlink,i)};if(!n)return a();let u=()=>{s.unlink.delete(n),fBt.remove(c)},c=()=>{u(),a()};fBt.add(c,r);let l=()=>(u(),i);s.unlink.set(n,l),s.add.get(n)?.()}getLockTargetAdd(t,r){let n=this._watcher._poller.getIno(t,Za.ADD,NX.FILE);return this.getLockAdd({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetAddDir(t,r){let n=this._watcher._poller.getIno(t,Za.ADD_DIR,NX.DIR);return this.getLockAdd({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}getLockTargetUnlink(t,r){let n=this._watcher._poller.getIno(t,Za.UNLINK,NX.FILE);return this.getLockUnlink({ino:n,targetPath:t,events:e.FILE_EVENTS,locks:this._locksFile},r)}getLockTargetUnlinkDir(t,r){let n=this._watcher._poller.getIno(t,Za.UNLINK_DIR,NX.DIR);return this.getLockUnlink({ino:n,targetPath:t,events:e.DIR_EVENTS,locks:this._locksDir},r)}reset(){this._locksAdd=new Map,this._locksAddDir=new Map,this._locksUnlink=new Map,this._locksUnlinkDir=new Map,this._locksDir={add:this._locksAddDir,unlink:this._locksUnlinkDir},this._locksFile={add:this._locksAdd,unlink:this._locksUnlink}}};dBt.DIR_EVENTS={add:Za.ADD_DIR,rename:Za.RENAME_DIR,unlink:Za.UNLINK_DIR};dBt.FILE_EVENTS={add:Za.ADD,change:Za.CHANGE,rename:Za.RENAME,unlink:Za.UNLINK};var cXa=dBt;var R6i=class{constructor(){this.map=new Map}clear(){this.map.clear()}delete(t,r){if(cl.lang.isUndefined(r))return this.map.delete(t);if(this.map.has(t)){let n=this.map.get(t);if(cl.lang.isSet(n)){let i=n.delete(r);return n.size||this.map.delete(t),i}else if(n===r)return this.map.delete(t),!0}return!1}find(t,r){if(this.map.has(t)){let n=this.map.get(t);if(cl.lang.isSet(n))return Array.from(n).find(r);if(r(n))return n}}get(t){return this.map.get(t)}has(t,r){if(cl.lang.isUndefined(r))return this.map.has(t);if(this.map.has(t)){let n=this.map.get(t);return cl.lang.isSet(n)?n.has(r):n===r}return!1}set(t,r){if(this.map.has(t)){let n=this.map.get(t);cl.lang.isSet(n)?n.add(r):n!==r&&this.map.set(t,new Set([n,r]))}else this.map.set(t,r);return this}},F6i=R6i;var k6i=class{constructor(t){this.ino=t.ino<=Number.MAX_SAFE_INTEGER?Number(t.ino):t.ino,this.size=Number(t.size),this.atimeMs=Number(t.atimeMs),this.mtimeMs=Number(t.mtimeMs),this.ctimeMs=Number(t.ctimeMs),this.birthtimeMs=Number(t.birthtimeMs),this._isFile=t.isFile(),this._isDirectory=t.isDirectory(),this._isSymbolicLink=t.isSymbolicLink()}isFile(){return this._isFile}isDirectory(){return this._isDirectory}isSymbolicLink(){return this._isSymbolicLink}},lXa=k6i;var Q6i=class{constructor(){this.inos={},this.paths=new F6i,this.stats=new Map}getIno(t,r,n){let i=this.inos[r];if(!i)return;let o=i[t];if(o&&!(n&&o[1]!==n))return o[0]}getStats(t){return this.stats.get(t)}async poll(t,r){let n=await cl.fs.poll(t,r);if(!(!n||!(n.isFile()||n.isDirectory())))return new lXa(n)}reset(){this.inos={},this.paths=new F6i,this.stats=new Map}async update(t,r){let n=this.getStats(t),i=await this.poll(t,r);if(this.updateStats(t,i),!n&&i){if(i.isFile())return this.updateIno(t,Za.ADD,i),[Za.ADD];if(i.isDirectory())return this.updateIno(t,Za.ADD_DIR,i),[Za.ADD_DIR]}else if(n&&!i){if(n.isFile())return this.updateIno(t,Za.UNLINK,n),[Za.UNLINK];if(n.isDirectory())return this.updateIno(t,Za.UNLINK_DIR,n),[Za.UNLINK_DIR]}else if(n&&i){if(n.isFile()){if(i.isFile())return n.ino===i.ino&&!n.size&&!i.size?[]:(this.updateIno(t,Za.CHANGE,i),[Za.CHANGE]);if(i.isDirectory())return this.updateIno(t,Za.UNLINK,n),this.updateIno(t,Za.ADD_DIR,i),[Za.UNLINK,Za.ADD_DIR]}else if(n.isDirectory()){if(i.isFile())return this.updateIno(t,Za.UNLINK_DIR,n),this.updateIno(t,Za.ADD,i),[Za.UNLINK_DIR,Za.ADD];if(i.isDirectory())return n.ino===i.ino?[]:(this.updateIno(t,Za.UNLINK_DIR,n),this.updateIno(t,Za.ADD_DIR,i),[Za.UNLINK_DIR,Za.ADD_DIR])}}return[]}updateIno(t,r,n){let i=this.inos[r]=this.inos[r]||(this.inos[r]={}),o=n.isFile()?NX.FILE:NX.DIR;i[t]=[n.ino,o]}updateStats(t,r){if(r)this.paths.set(r.ino,t),this.stats.set(t,r);else{let n=this.stats.get(t)?.ino||-1;this.paths.delete(n,t),this.stats.delete(t)}}},N6i=Q6i;var j6i=class e extends pXa.EventEmitter{constructor(t,r,n){super(),this._closed=!1,this._ready=!1,this._closeAborter=new AbortController,this._closeSignal=this._closeAborter.signal,this.on(kT.CLOSE,()=>this._closeAborter.abort()),this._closeWait=new Promise(i=>this.on(kT.CLOSE,i)),this._readyWait=new Promise(i=>this.on(kT.READY,i)),this._locker=new cXa(this),this._roots=new Set,this._poller=new N6i,this._pollers=new Set,this._subwatchers=new Set,this._watchers={},this._watchersLock=Promise.resolve(),this._watchersRestorable={},this.watch(t,r,n)}isClosed(){return this._closed}isIgnored(t,r){return!!r&&(cl.lang.isFunction(r)?!!r(t):r.test(t))}isReady(){return this._ready}close(){return this._locker.reset(),this._poller.reset(),this._roots.clear(),this.watchersClose(),this.isClosed()?!1:(this._closed=!0,this.emit(kT.CLOSE))}error(t){if(this.isClosed())return!1;let r=cl.lang.castError(t);return this.emit(kT.ERROR,r)}event(t,r,n){return this.isClosed()?!1:(this.emit(kT.ALL,t,r,n),this.emit(t,r,n))}ready(){return this.isClosed()||this.isReady()?!1:(this._ready=!0,this.emit(kT.READY))}pollerExists(t,r){for(let n of this._pollers)if(n.targetPath===t&&cl.lang.isShallowEqual(n.options,r))return!0;return!1}subwatcherExists(t,r){for(let n of this._subwatchers)if(n.targetPath===t&&cl.lang.isShallowEqual(n.options,r))return!0;return!1}watchersClose(t,r,n=!0){if(t){let i=this._watchers[t];if(i)for(let o of[...i])r&&o.filePath!==r||this.watcherClose(o);if(n)for(let o in this._watchers)cl.fs.isSubPath(t,o)&&this.watchersClose(o,r,!1)}else for(let i in this._watchers)this.watchersClose(i,r,!1)}watchersLock(t){return this._watchersLock.then(()=>this._watchersLock=new Promise(async r=>{await t(),r()}))}watchersRestore(){delete this._watchersRestoreTimeout;let t=Object.entries(this._watchersRestorable);this._watchersRestorable={};for(let[r,n]of t)this.watchPath(r,n.options,n.handler)}async watcherAdd(t,r){let{folderPath:n}=t;(this._watchers[n]=this._watchers[n]||[]).push(t);let o=new uXa(this,t,r);return await o.init(),o}watcherClose(t){t.watcher.close();let r=this._watchers[t.folderPath];if(r){let o=r.indexOf(t);r.splice(o,1),r.length||delete this._watchers[t.folderPath]}let n=t.filePath||t.folderPath;this._roots.has(n)&&(this._watchersRestorable[n]=t,this._watchersRestoreTimeout||(this._watchersRestoreTimeout=cl.lang.defer(()=>this.watchersRestore())))}watcherExists(t,r,n,i){if(this._watchers[t]?.find(a=>a.handler===n&&(!a.filePath||a.filePath===i)&&a.options.ignore===r.ignore&&!!a.options.native==!!r.native&&(!r.recursive||a.options.recursive)))return!0;let s=VDe.default.dirname(t);for(let a=1;a<1/0;a++){if(this._watchers[s]?.find(l=>(a===1||l.options.recursive&&a<=(l.options.depth??Sve))&&l.handler===n&&(!l.filePath||l.filePath===i)&&l.options.ignore===r.ignore&&!!l.options.native==!!r.native&&(!r.recursive||l.options.recursive&&Bve&&l.options.native!==!1)))return!0;if(!Bve)break;let c=VDe.default.dirname(t);if(s===c)break;s=c}return!1}async watchDirectories(t,r,n,i,o){if(this.isClosed())return;t=cl.lang.uniq(t).sort();let s;for(let a of t)if(!this.isIgnored(a,r.ignore)&&!this.watcherExists(a,r,n,i))try{let u=!r.recursive||Bve&&r.native!==!1?r:{...r,recursive:!1},l={watcher:REn.default.watch(a,u),handler:n,options:r,folderPath:a,filePath:i},p=s=await this.watcherAdd(l,o);if(this._roots.has(i||a)){let f={...r,ignoreInitial:!0,recursive:!1},m=VDe.default.dirname(a),h=a;await this.watchDirectories([m],f,n,h,p)}}catch(u){this.error(u)}return s}async watchDirectory(t,r,n,i,o){if(!this.isClosed()&&!this.isIgnored(t,r.ignore)){if(!r.recursive||Bve&&r.native!==!1)return this.watchersLock(()=>this.watchDirectories([t],r,n,i,o));{r={...r,recursive:!0};let s=r.depth??Sve,a=r.limit??uBt,[u]=await cl.fs.readdir(t,r.ignore,s,a,this._closeSignal,r.readdirMap);return this.watchersLock(async()=>{let c=await this.watchDirectories([t],r,n,i,o);if(u.length){let l=cl.fs.getDepth(t);for(let p of u){let d=cl.fs.getDepth(p),f=Math.max(0,s-(d-l)),m={...r,depth:f};await this.watchDirectories([p],m,n,i,o||c)}}})}}}async watchFileOnce(t,r,n){if(this.isClosed()||(r={...r,ignoreInitial:!1},this.subwatcherExists(t,r)))return;let i={targetPath:t,options:r},o=(c,l)=>{l===t&&(u(),n())},s=new e(o),a=()=>{this._subwatchers.add(i),this.on(kT.CLOSE,u),s.watchFile(t,r,o)},u=()=>{this._subwatchers.delete(i),this.removeListener(kT.CLOSE,u),s.close()};return a()}async watchFile(t,r,n){if(this.isClosed()||this.isIgnored(t,r.ignore))return;r={...r,recursive:!1};let i=VDe.default.dirname(t);return this.watchDirectory(i,r,n,t)}async watchPollingOnce(t,r,n){if(this.isClosed())return;let i=!1,o=new N6i,s=await this.watchPolling(t,r,async()=>{i||!(await o.update(t,r.pollingTimeout)).length||i||(i=!0,s(),n())})}async watchPolling(t,r,n){if(this.isClosed())return cl.lang.noop;if(this.pollerExists(t,r))return cl.lang.noop;let i={...r,interval:r.pollingInterval??JYa},o={targetPath:t,options:r},s=()=>{this._pollers.add(o),this.on(kT.CLOSE,a),REn.default.watchFile(t,i,n)},a=()=>{this._pollers.delete(o),this.removeListener(kT.CLOSE,a),REn.default.unwatchFile(t,n)};return cl.lang.attempt(s),()=>cl.lang.attempt(a)}async watchUnknownChild(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchFileOnce(t,r,i)}async watchUnknownTarget(t,r,n){if(this.isClosed())return;let i=()=>this.watchPath(t,r,n);return this.watchPollingOnce(t,r,i)}async watchPaths(t,r,n){if(this.isClosed())return;if(t=cl.lang.uniq(t).sort(),t.every((o,s)=>t.every((a,u)=>u===s||!cl.fs.isSubPath(o,a))))await Promise.all(t.map(o=>this.watchPath(o,r,n)));else for(let o of t)await this.watchPath(o,r,n)}async watchPath(t,r,n){if(this.isClosed()||(t=VDe.default.resolve(t),this.isIgnored(t,r.ignore)))return;let i=await cl.fs.poll(t,r.pollingTimeout);if(i){if(i.isFile())return this.watchFile(t,r,n);if(i.isDirectory())return this.watchDirectory(t,r,n);this.error(`"${t}" is not supported`)}else{let o=VDe.default.dirname(t);return(await cl.fs.poll(o,r.pollingTimeout))?.isDirectory()?this.watchUnknownChild(t,r,n):this.watchUnknownTarget(t,r,n)}}async watch(t,r,n=cl.lang.noop){if(cl.lang.isFunction(t))return this.watch([],{},t);if(cl.lang.isUndefined(t))return this.watch([],r,n);if(cl.lang.isFunction(r))return this.watch(t,{},r);if(cl.lang.isUndefined(r))return this.watch(t,{},n);if(this.isClosed())return;this.isReady()&&(r.readdirMap=void 0);let i=cl.lang.castArray(t);i.forEach(o=>this._roots.add(o)),await this.watchPaths(i,r,n),!this.isClosed()&&(n!==cl.lang.noop&&this.on(kT.ALL,n),r.readdirMap=void 0,this.ready())}},FEn=j6i;HEn();Vt();var Hrt=require("fs/promises"),AZa=require("os"),yZa=_e(require("path"),1),wod=".fern",Cod="logs";function xod(){return"cli@4.33.0"}var KDe=class{logFilePath=null;initialized=!1;sessionStartTime;constructor(){this.sessionStartTime=Date.now()}async initialize(){if(this.initialized)return;let t=We(Ut.of((0,AZa.homedir)()),Se.of(wod)),r=We(t,Se.of(Cod));await Xt(r)||await(0,Hrt.mkdir)(r,{recursive:!0});let i=`${new Date().toISOString().replace(/[:.]/g,"-")}.debug.log`;this.logFilePath=We(r,Se.of(i));let o=["================================================================================","Fern Docs Dev Debug Log",`Session started: ${new Date().toISOString()}`,`Log file: ${yZa.default.basename(this.logFilePath)}`,"================================================================================",""].join(`
|
|
2167
2167
|
`);await(0,Hrt.writeFile)(this.logFilePath,o,"utf-8"),this.initialized=!0}getLogFilePath(){return this.logFilePath}async writeEntry(t){if(!this.initialized||!this.logFilePath)return;let r=JSON.stringify(t)+`
|
|
2168
2168
|
`;try{await(0,Hrt.appendFile)(this.logFilePath,r,"utf-8")}catch{}}async logFrontendMetrics(t){let r={timestamp:t.timestamp,source:t.source,level:t.level,eventType:this.getEventType(t.payload,t.isAggregate),isAggregate:t.isAggregate,data:t.payload};await this.writeEntry(r)}async logCliMetric(t,r="info"){let n={timestamp:t.timestamp,source:xod(),level:r,eventType:t.type,data:{durationMs:t.durationMs,metadata:t.metadata}};await this.writeEntry(n)}async logCliMemory(){let t=process.memoryUsage(),r={type:"cli_memory",timestamp:new Date().toISOString(),metadata:{heapUsed:t.heapUsed,heapTotal:t.heapTotal,external:t.external,rss:t.rss,heapUsedMB:Math.round(t.heapUsed/1024/1024*100)/100,heapTotalMB:Math.round(t.heapTotal/1024/1024*100)/100,rssMB:Math.round(t.rss/1024/1024*100)/100}};await this.logCliMetric(r)}async logCliReloadStart(){let t={type:"cli_reload_start",timestamp:new Date().toISOString()};await this.logCliMetric(t)}async logCliReloadFinish(t,r){let n={type:"cli_reload_finish",timestamp:new Date().toISOString(),durationMs:t,metadata:r};await this.logCliMetric(n)}async logCliDocsGeneration(t,r){let n={type:"cli_docs_generation",timestamp:new Date().toISOString(),durationMs:t,metadata:r};await this.logCliMetric(n)}async logCliValidation(t,r){let n={type:"cli_validation",timestamp:new Date().toISOString(),durationMs:t,metadata:{success:r}};await this.logCliMetric(n)}getEventType(t,r){return r?"aggregate_summary":"type"in t&&typeof t.type=="string"?t.type:"unknown"}static isMetricsMessage(t){if(typeof t!="object"||t===null)return!1;let r=t;return r.type==="metrics"&&typeof r.timestamp=="string"&&typeof r.source=="string"}};var sVi={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type"};function bZa(e){let t=_od();if(t==null)return;let{port:r,debugLogger:n,getDocsLoadResponse:i}=e,o=new Map;function s(u){let c=JSON.stringify(u),l=[];for(let[p]of o)try{p.send(c)}catch{l.push(p)}for(let p of l){let d=o.get(p);d&&(clearInterval(d.pingInterval),o.delete(p))}}let a=t.serve({port:r,fetch(u,c){if(u.method==="OPTIONS")return new Response(null,{status:204,headers:sVi});let l=new URL(u.url);if(u.headers.get("upgrade")?.toLowerCase()==="websocket"){c.upgrade(u,{data:{connectionId:`${Date.now()}`}});return}if(u.method==="POST"&&l.pathname==="/v2/registry/docs/load-with-url")return new Response(JSON.stringify(i()),{headers:{"Content-Type":"application/json",...sVi}});let p=/^\/_local\/(.*)/.exec(l.pathname);return u.method==="GET"&&p!=null?new Response(t.file(`/${p[1]}`),{headers:sVi}):new Response("Not Found",{status:404})},websocket:{open(u){let{connectionId:c}=u.data,l=setInterval(()=>{let p=o.get(u);if(!p)return;let d=Date.now();if(d-p.lastPong>9e4){u.close();return}try{u.send(JSON.stringify({type:"ping",timestamp:d}))}catch{u.close()}},3e4);o.set(u,{pingInterval:l,lastPong:Date.now()});try{u.send(JSON.stringify({type:"connected",connectionId:c}))}catch{}},message(u,c){try{let l=JSON.parse(c.toString());if(l.type==="pong"){let p=o.get(u);p&&(p.lastPong=Date.now())}else KDe.isMetricsMessage(l)&&n.logFrontendMetrics(l)}catch{}},close(u){let c=o.get(u);c&&(clearInterval(c.pingInterval),o.delete(u))}}});return{sendData:s,stop:u=>a.stop(u)}}function _od(){return globalThis.Bun}Vt();var Lqi=_e(hVi(),1),Iou=_e(Bqi(),1),Ok=require("fs/promises"),wou=require("os"),Cou=_e(yw(),1),xou=_e(Eou(),1),sIn=process.platform==="win32",Mqi=be.cyan("[docs]:"),rld="etag",nld=23,vou=e=>e.padEnd(nld," "),ild="preview",old="app-preview",sld="bundle",ald=".next",uld="standalone",cld=".fern",lld="packages/fern-docs/bundle/.next/server/instrumentation.js",pld=".npmrc",fld=".pnpmfile.cjs",dld="pnpm-workspace.yaml",mld='Cannot find matching keyid: {"signatures":';function hld(){return We(Ut.of((0,wou.homedir)()),Se.of(cld))}function fnt({app:e=!1}){return We(hld(),Se.of(e?old:ild))}function Mve({app:e=!1}){return We(fnt({app:e}),Se.of(e?ald:sld))}function WBt({app:e=!1}){return We(Mve({app:e}),Se.of(uld))}function gld({app:e=!1}){return We(WBt({app:e}),Se.of(lld))}function Ald({app:e=!1}){return We(WBt({app:e}),Se.of(dld))}function yld({app:e=!1}){return We(WBt({app:e}),Se.of(fld))}function bld({app:e=!1}){return We(WBt({app:e}),Se.of(pld))}function iRe(e){return new Error(`${e}. Please reach out to support@buildwithfern.com.`)}function Eld({app:e=!1}){return We(fnt({app:e}),Se.of(rld))}var vld=`module.exports = {
|
|
2169
2169
|
hooks: {
|
|
@@ -2204,7 +2204,7 @@ Please ensure you have membership at https://dashboard.buildwithfern.com, and as
|
|
|
2204
2204
|
|
|
2205
2205
|
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`);case"UnavailableError":return t.failAndThrow("Failed to publish docs. Please try again later or reach out to Fern support at support@buildwithfern.com.");default:return t.failAndThrow("Failed to publish docs.",e)}}function fdd(e,t){let n=e?.content;if(n?.reason==="status-code"){let i=n.statusCode;if(i===401||i===403)return`${`You do not have permission to publish docs to organization '${t}'. Please run 'fern login' to ensure you are logged in with the correct account.`}
|
|
2206
2206
|
|
|
2207
|
-
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`}}function ddd(e){try{return new URL(BT(e)).pathname}catch{return}}async function mdd({fdr:e,workspace:t,organization:r,context:n,snippetsConfig:i}){if(!t)return;let o=await hdd({fdr:e,workspace:t,snippetsConfig:i,context:n});if(Object.keys(o).length===0){n.logger.debug("[SDK Dynamic IR] No snippet configs found, skipping S3 check");return}try{let s=await e.api.v1.register.checkSdkDynamicIrExists({orgId:Cr.OrgId(r),snippetConfiguration:o});if(!s.ok||!s.body){n.logger.debug("[SDK Dynamic IR] API call failed or returned empty body");return}let a=s.body.existingDynamicIrs;if(Object.keys(a).length===0){n.logger.debug("[SDK Dynamic IR] No existing SDK dynamic IRs found in S3");return}let u={};for(let[c,l]of Object.entries(a))try{n.logger.debug(`Downloading existing SDK dynamic IR for ${c}...`);let p=await fetch(l.downloadUrl);if(p.ok){let d=await p.json();u[c]={dynamicIR:d},n.logger.debug(`Successfully downloaded SDK dynamic IR for ${c}`)}else n.logger.warn(`Failed to download SDK dynamic IR for ${c}: ${p.status}`)}catch(p){n.logger.warn(`Error downloading SDK dynamic IR for ${c}: ${p}`)}return Object.keys(u).length>0?u:void 0}catch(s){n.logger.debug(`Error checking for existing SDK dynamic IRs: ${s}`);return}}function pau(e){return e.replace(/^https:\/\//,"")}async function hdd({fdr:e,workspace:t,snippetsConfig:r,context:n}){let i={},o=[{language:"typescript",snippetName:r.typescriptSdk?.package,explicitVersion:r.typescriptSdk?.version},{language:"python",snippetName:r.pythonSdk?.package,explicitVersion:r.pythonSdk?.version},{language:"java",snippetName:r.javaSdk?.coordinate,explicitVersion:r.javaSdk?.version},{language:"go",snippetName:r.goSdk?.githubRepo&&pau(r.goSdk?.githubRepo),explicitVersion:r.goSdk?.version},{language:"csharp",snippetName:r.csharpSdk?.package,explicitVersion:r.csharpSdk?.version},{language:"ruby",snippetName:r.rubySdk?.gem,explicitVersion:r.rubySdk?.version},{language:"php",snippetName:r.phpSdk?.package,explicitVersion:r.phpSdk?.version},{language:"swift",snippetName:r.swiftSdk?.package,explicitVersion:r.swiftSdk?.version},{language:"rust",snippetName:r.rustSdk?.package,explicitVersion:r.rustSdk?.version}];for(let s of o){if(!s.snippetName)continue;let a=s.explicitVersion;a||(a=(await gdd({fdr:e,workspace:t,language:s.language,snippetName:s.snippetName,context:n}))?.version),i[s.language]={packageName:s.snippetName,version:a},a||n.logger.debug(`[SDK Dynamic IR] ${s.language}: no version specified, will use latest`)}return i}async function gdd({fdr:e,workspace:t,language:r,snippetName:n,context:i}){let o;switch(r){case"csharp":o="Csharp";break;case"go":o="Go";break;case"java":o="Java";break;case"python":o="Python";break;case"ruby":o="Ruby";break;case"typescript":o="TypeScript";break;case"php":o="Php";break;case"swift":o="Swift";break;default:return}let s,a,u;if(t.generatorsConfiguration?.groups){let c=[];for(let l of t.generatorsConfiguration.groups)for(let p of l.generators)if(p.language===r){let d=bn.getPackageName({generatorInvocation:p});d&&c.push(d),!a&&d&&(a=d,u=p.name,p.outputMode.type==="githubV2"&&(s=`${p.outputMode.githubV2.owner}/${p.outputMode.githubV2.repo}`))}}if(!a){i.logger.debug(`[SDK Dynamic IR] ${r}: no generator found with a package name`);return}try{let c=await e.sdks.versions.computeSemanticVersion({githubRepository:s,language:o,package:a});if(!c.ok){i.logger.debug(`[SDK Dynamic IR] ${r}: version computation failed for package "${a}"`);return}return i.logger.debug(`[SDK Dynamic IR] ${r}: computed version ${c.body.version} for package "${a}"`),{version:c.body.version,generatorPackage:a}}catch(c){i.logger.debug(`[SDK Dynamic IR] ${r}: error computing version: ${c}`);return}}async function Add({workspace:e,organization:t,context:r,snippetsConfig:n,skipLanguages:i=new Set}){let o={};if(!e)return;let s={typescript:n.typescriptSdk?.package,python:n.pythonSdk?.package,java:n.javaSdk?.coordinate,go:n.goSdk?.githubRepo&&pau(n.goSdk?.githubRepo),csharp:n.csharpSdk?.package,ruby:n.rubySdk?.gem,php:n.phpSdk?.package,swift:n.swiftSdk?.package,rust:n.rustSdk?.package};if(e.generatorsConfiguration?.groups)for(let a of e.generatorsConfiguration.groups)for(let u of a.generators){let c=oRe({apiName:e.workspaceName??"",organization:t,generatorInvocation:u}),l="";if(c?.outputConfig.type==="publish")switch(c.outputConfig.value.type){case"npm":case"nuget":case"pypi":case"rubygems":l=c.outputConfig.value.packageName;break;case"maven":l=c.outputConfig.value.coordinate;break;case"go":l=c.outputConfig.value.repoUrl;break;case"swift":l=c.outputConfig.value.repoUrl;break;case"crates":l=c.outputConfig.value.packageName;break}if(u.language==="php"&&u.config&&typeof u.config=="object"&&"packageName"in u.config&&(l=u.config.packageName??""),!!u.language){if(i.has(u.language)){r.logger.debug(`Skipping dynamic IR generation for ${u.language} (using existing SDK dynamic IR)`);continue}if(u.language&&s[u.language]===l){let p=Zm({workspace:e,generationLanguage:u.language,keywords:void 0,smartCasing:u.smartCasing,exampleGeneration:{disabled:!0,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},audiences:{type:"all"},readme:void 0,packageName:l,version:void 0,context:r,sourceResolver:new tm(r,e),dynamicGeneratorConfig:c}),d=JBe({ir:p,disableExamples:!0,smartCasing:u.smartCasing,generationLanguage:u.language,generatorConfig:c});d?o[u.language]={dynamicIR:d}:r.logger.debug(`Failed to create dynamic IR for ${u.language}`)}}}for(let[a,u]of Object.entries(s))a&&u&&!Object.keys(o).includes(a)&&!i.has(a)&&(r.logger.warn(),r.logger.warn(`Failed to upload ${a} SDK snippets because of unknown package \`${u}\`.`),r.logger.warn(`Please make sure your ${e.workspaceName?`${e.workspaceName}/`:""}generators.yml has a generator that publishes a ${u} package.`),r.logger.warn());if(Object.keys(o).length>0)return o}async function ydd({dynamicIRs:e,dynamicIRUploadUrls:t,context:r,apiId:n}){if(Object.keys(t).length>0)for(let[i,o]of Object.entries(t)){let s=e[i]?.dynamicIR;if(s){let a=JSON.stringify(s);(await fetch(o.uploadUrl,{method:"PUT",body:a,headers:{"Content-Type":"application/octet-stream","Content-Length":Buffer.byteLength(a,"utf8").toString()}})).ok?r.logger.debug(`Uploaded dynamic IR for ${n}:${i}`):r.logger.warn(`Failed to upload dynamic IR for ${n}:${i}`)}else r.logger.warn(`Could not find matching dynamic IR to upload for ${n}:${i}`)}}async function bdd({docsDefinition:e,isPreview:t,context:r}){e.config.aiChatConfig==null||t||r.logger.warn(be.yellow("Enabling Ask Fern from docs.yml is deprecated. Please enable it from the Fern dashboard instead."))}function Edd(e,t){if(e)return{enabled:!0,model:process.env.FERN_AI_MODEL||"gpt-4o-mini",maxRetries:parseInt(process.env.FERN_AI_MAX_RETRIES||"3"),requestTimeoutMs:parseInt(process.env.FERN_AI_TIMEOUT_MS||"25000"),styleInstructions:t}}function vdd(e){let t=e,r=t?.content;return{errorType:t?.error,statusCode:t?.statusCode??r?.statusCode,reason:r?.reason,errorMessage:r?.errorMessage??r?.message,body:r?.body,cause:r?.cause,rawError:e}}var eOt=[60*1e3,300*1e3,300*1e3];async function tOt({organization:e,apiWorkspaces:t,ossWorkspaces:r,docsWorkspace:n,context:i,token:o,instanceUrl:s,preview:a,disableTemplates:u,skipUpload:c,cliVersion:l}){let p=a&&!n.config.settings?.substituteEnvVars;n.config=$y(n.config,{onError:g=>i.failAndThrow(g)},{substituteAsEmpty:p});let d=n.config.instances;if(d.length===0){i.failAndThrow("No instances specified in docs.yml! Cannot register docs.");return}if(d.length>1&&s==null){i.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${d[0]?.url})`);return}let f=d.find(g=>g.url===s)??d[0];if(f==null){i.failAndThrow(`No docs instance with url ${s}. Failed to register.`);return}let m=[];f.customDomain!=null&&(typeof f.customDomain=="string"?m.push(f.customDomain):Array.isArray(f.customDomain)&&m.push(...f.customDomain)),i.logger.info(`Starting docs publishing for ${a?"preview":"production"}: ${f.url}`),i.logger.debug(`Organization: ${e}, Preview: ${a}, APIs: ${t.length}, OSS: ${r.length}`);let h;return await i.runInteractiveTask({name:f.url},async()=>{let g=performance.now(),A=()=>lau({docsWorkspace:n,customDomains:m,domain:f.url,token:o,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:a,editThisPage:f.editThisPage,isPrivate:f.private,disableTemplates:u,skipUpload:c,withAiExamples:n.config.aiExamples?.enabled??n.config.experimental?.aiExamples??!0,excludeApis:n.config.experimental?.excludeApis??!1,targetAudiences:f.audiences?Array.isArray(f.audiences)?f.audiences:[f.audiences]:void 0,docsUrl:f.url,cliVersion:l});for(let v=0;;v++)try{h=await A();break}catch(b){if(!(b instanceof gnt)||v>=eOt.length){if(b instanceof gnt)return i.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.");throw b}let I=eOt[v]??eOt[eOt.length-1]??6e4,w=I/6e4;i.logger.warn(`Another docs publish is in progress. Retrying in ${w} minute${w===1?"":"s"} (attempt ${v+1}/${eOt.length})...`),await new Promise(x=>setTimeout(x,I))}let E=performance.now()-g;i.logger.debug(`Docs publishing completed in ${E.toFixed(0)}ms`)}),h}var rwn=class{context;task;project;docsWorkspace;ossWorkspaces;token;constructor({context:t,task:r,project:n,docsWorkspace:i,ossWorkspaces:o,token:s}){this.context=t,this.task=r,this.project=n,this.docsWorkspace=i,this.ossWorkspaces=o,this.token=s}async publish({instanceUrl:t,preview:r,skipUpload:n}){let i=new ih({context:this.context,task:this.task});try{let o=await tOt({organization:this.project.config.organization,apiWorkspaces:this.project.apiWorkspaces,ossWorkspaces:this.ossWorkspaces,docsWorkspace:this.docsWorkspace,context:i,token:this.token,instanceUrl:t,preview:r,disableTemplates:void 0,skipUpload:n,cliVersion:"4.32.1"});return i.getResult()===Pp.Failure?{success:!1}:{success:!0,url:o}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}}};Rt();var Ant=class e{static MAX_DISPLAYED_LOGS_TTY=10;static URL_PATTERN=/https?:\/\/[^\s]+/;context;stream;tasks={};taskOrder=[];startTime;isRegistered=!1;constructor(t){this.context=t.context,this.stream=t.stream??process.stderr}addTask(t){let r={...t,status:t.status??"pending"};return this.tasks[t.id]=r,this.taskOrder.push(t.id),this}async start(t){return this.startTime=Date.now(),t!=null&&await this.context.ttyAwareLogger.takeOverTerminal(()=>{this.stream.write(`
|
|
2207
|
+
Please ensure you have membership at https://dashboard.buildwithfern.com, and ask a team member for an invite if not.`}}function ddd(e){try{return new URL(BT(e)).pathname}catch{return}}async function mdd({fdr:e,workspace:t,organization:r,context:n,snippetsConfig:i}){if(!t)return;let o=await hdd({fdr:e,workspace:t,snippetsConfig:i,context:n});if(Object.keys(o).length===0){n.logger.debug("[SDK Dynamic IR] No snippet configs found, skipping S3 check");return}try{let s=await e.api.v1.register.checkSdkDynamicIrExists({orgId:Cr.OrgId(r),snippetConfiguration:o});if(!s.ok||!s.body){n.logger.debug("[SDK Dynamic IR] API call failed or returned empty body");return}let a=s.body.existingDynamicIrs;if(Object.keys(a).length===0){n.logger.debug("[SDK Dynamic IR] No existing SDK dynamic IRs found in S3");return}let u={};for(let[c,l]of Object.entries(a))try{n.logger.debug(`Downloading existing SDK dynamic IR for ${c}...`);let p=await fetch(l.downloadUrl);if(p.ok){let d=await p.json();u[c]={dynamicIR:d},n.logger.debug(`Successfully downloaded SDK dynamic IR for ${c}`)}else n.logger.warn(`Failed to download SDK dynamic IR for ${c}: ${p.status}`)}catch(p){n.logger.warn(`Error downloading SDK dynamic IR for ${c}: ${p}`)}return Object.keys(u).length>0?u:void 0}catch(s){n.logger.debug(`Error checking for existing SDK dynamic IRs: ${s}`);return}}function pau(e){return e.replace(/^https:\/\//,"")}async function hdd({fdr:e,workspace:t,snippetsConfig:r,context:n}){let i={},o=[{language:"typescript",snippetName:r.typescriptSdk?.package,explicitVersion:r.typescriptSdk?.version},{language:"python",snippetName:r.pythonSdk?.package,explicitVersion:r.pythonSdk?.version},{language:"java",snippetName:r.javaSdk?.coordinate,explicitVersion:r.javaSdk?.version},{language:"go",snippetName:r.goSdk?.githubRepo&&pau(r.goSdk?.githubRepo),explicitVersion:r.goSdk?.version},{language:"csharp",snippetName:r.csharpSdk?.package,explicitVersion:r.csharpSdk?.version},{language:"ruby",snippetName:r.rubySdk?.gem,explicitVersion:r.rubySdk?.version},{language:"php",snippetName:r.phpSdk?.package,explicitVersion:r.phpSdk?.version},{language:"swift",snippetName:r.swiftSdk?.package,explicitVersion:r.swiftSdk?.version},{language:"rust",snippetName:r.rustSdk?.package,explicitVersion:r.rustSdk?.version}];for(let s of o){if(!s.snippetName)continue;let a=s.explicitVersion;a||(a=(await gdd({fdr:e,workspace:t,language:s.language,snippetName:s.snippetName,context:n}))?.version),i[s.language]={packageName:s.snippetName,version:a},a||n.logger.debug(`[SDK Dynamic IR] ${s.language}: no version specified, will use latest`)}return i}async function gdd({fdr:e,workspace:t,language:r,snippetName:n,context:i}){let o;switch(r){case"csharp":o="Csharp";break;case"go":o="Go";break;case"java":o="Java";break;case"python":o="Python";break;case"ruby":o="Ruby";break;case"typescript":o="TypeScript";break;case"php":o="Php";break;case"swift":o="Swift";break;default:return}let s,a,u;if(t.generatorsConfiguration?.groups){let c=[];for(let l of t.generatorsConfiguration.groups)for(let p of l.generators)if(p.language===r){let d=bn.getPackageName({generatorInvocation:p});d&&c.push(d),!a&&d&&(a=d,u=p.name,p.outputMode.type==="githubV2"&&(s=`${p.outputMode.githubV2.owner}/${p.outputMode.githubV2.repo}`))}}if(!a){i.logger.debug(`[SDK Dynamic IR] ${r}: no generator found with a package name`);return}try{let c=await e.sdks.versions.computeSemanticVersion({githubRepository:s,language:o,package:a});if(!c.ok){i.logger.debug(`[SDK Dynamic IR] ${r}: version computation failed for package "${a}"`);return}return i.logger.debug(`[SDK Dynamic IR] ${r}: computed version ${c.body.version} for package "${a}"`),{version:c.body.version,generatorPackage:a}}catch(c){i.logger.debug(`[SDK Dynamic IR] ${r}: error computing version: ${c}`);return}}async function Add({workspace:e,organization:t,context:r,snippetsConfig:n,skipLanguages:i=new Set}){let o={};if(!e)return;let s={typescript:n.typescriptSdk?.package,python:n.pythonSdk?.package,java:n.javaSdk?.coordinate,go:n.goSdk?.githubRepo&&pau(n.goSdk?.githubRepo),csharp:n.csharpSdk?.package,ruby:n.rubySdk?.gem,php:n.phpSdk?.package,swift:n.swiftSdk?.package,rust:n.rustSdk?.package};if(e.generatorsConfiguration?.groups)for(let a of e.generatorsConfiguration.groups)for(let u of a.generators){let c=oRe({apiName:e.workspaceName??"",organization:t,generatorInvocation:u}),l="";if(c?.outputConfig.type==="publish")switch(c.outputConfig.value.type){case"npm":case"nuget":case"pypi":case"rubygems":l=c.outputConfig.value.packageName;break;case"maven":l=c.outputConfig.value.coordinate;break;case"go":l=c.outputConfig.value.repoUrl;break;case"swift":l=c.outputConfig.value.repoUrl;break;case"crates":l=c.outputConfig.value.packageName;break}if(u.language==="php"&&u.config&&typeof u.config=="object"&&"packageName"in u.config&&(l=u.config.packageName??""),!!u.language){if(i.has(u.language)){r.logger.debug(`Skipping dynamic IR generation for ${u.language} (using existing SDK dynamic IR)`);continue}if(u.language&&s[u.language]===l){let p=Zm({workspace:e,generationLanguage:u.language,keywords:void 0,smartCasing:u.smartCasing,exampleGeneration:{disabled:!0,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},audiences:{type:"all"},readme:void 0,packageName:l,version:void 0,context:r,sourceResolver:new tm(r,e),dynamicGeneratorConfig:c}),d=JBe({ir:p,disableExamples:!0,smartCasing:u.smartCasing,generationLanguage:u.language,generatorConfig:c});d?o[u.language]={dynamicIR:d}:r.logger.debug(`Failed to create dynamic IR for ${u.language}`)}}}for(let[a,u]of Object.entries(s))a&&u&&!Object.keys(o).includes(a)&&!i.has(a)&&(r.logger.warn(),r.logger.warn(`Failed to upload ${a} SDK snippets because of unknown package \`${u}\`.`),r.logger.warn(`Please make sure your ${e.workspaceName?`${e.workspaceName}/`:""}generators.yml has a generator that publishes a ${u} package.`),r.logger.warn());if(Object.keys(o).length>0)return o}async function ydd({dynamicIRs:e,dynamicIRUploadUrls:t,context:r,apiId:n}){if(Object.keys(t).length>0)for(let[i,o]of Object.entries(t)){let s=e[i]?.dynamicIR;if(s){let a=JSON.stringify(s);(await fetch(o.uploadUrl,{method:"PUT",body:a,headers:{"Content-Type":"application/octet-stream","Content-Length":Buffer.byteLength(a,"utf8").toString()}})).ok?r.logger.debug(`Uploaded dynamic IR for ${n}:${i}`):r.logger.warn(`Failed to upload dynamic IR for ${n}:${i}`)}else r.logger.warn(`Could not find matching dynamic IR to upload for ${n}:${i}`)}}async function bdd({docsDefinition:e,isPreview:t,context:r}){e.config.aiChatConfig==null||t||r.logger.warn(be.yellow("Enabling Ask Fern from docs.yml is deprecated. Please enable it from the Fern dashboard instead."))}function Edd(e,t){if(e)return{enabled:!0,model:process.env.FERN_AI_MODEL||"gpt-4o-mini",maxRetries:parseInt(process.env.FERN_AI_MAX_RETRIES||"3"),requestTimeoutMs:parseInt(process.env.FERN_AI_TIMEOUT_MS||"25000"),styleInstructions:t}}function vdd(e){let t=e,r=t?.content;return{errorType:t?.error,statusCode:t?.statusCode??r?.statusCode,reason:r?.reason,errorMessage:r?.errorMessage??r?.message,body:r?.body,cause:r?.cause,rawError:e}}var eOt=[60*1e3,300*1e3,300*1e3];async function tOt({organization:e,apiWorkspaces:t,ossWorkspaces:r,docsWorkspace:n,context:i,token:o,instanceUrl:s,preview:a,disableTemplates:u,skipUpload:c,cliVersion:l}){let p=a&&!n.config.settings?.substituteEnvVars;n.config=$y(n.config,{onError:g=>i.failAndThrow(g)},{substituteAsEmpty:p});let d=n.config.instances;if(d.length===0){i.failAndThrow("No instances specified in docs.yml! Cannot register docs.");return}if(d.length>1&&s==null){i.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${d[0]?.url})`);return}let f=d.find(g=>g.url===s)??d[0];if(f==null){i.failAndThrow(`No docs instance with url ${s}. Failed to register.`);return}let m=[];f.customDomain!=null&&(typeof f.customDomain=="string"?m.push(f.customDomain):Array.isArray(f.customDomain)&&m.push(...f.customDomain)),i.logger.info(`Starting docs publishing for ${a?"preview":"production"}: ${f.url}`),i.logger.debug(`Organization: ${e}, Preview: ${a}, APIs: ${t.length}, OSS: ${r.length}`);let h;return await i.runInteractiveTask({name:f.url},async()=>{let g=performance.now(),A=()=>lau({docsWorkspace:n,customDomains:m,domain:f.url,token:o,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:a,editThisPage:f.editThisPage,isPrivate:f.private,disableTemplates:u,skipUpload:c,withAiExamples:n.config.aiExamples?.enabled??n.config.experimental?.aiExamples??!0,excludeApis:n.config.experimental?.excludeApis??!1,targetAudiences:f.audiences?Array.isArray(f.audiences)?f.audiences:[f.audiences]:void 0,docsUrl:f.url,cliVersion:l});for(let v=0;;v++)try{h=await A();break}catch(b){if(!(b instanceof gnt)||v>=eOt.length){if(b instanceof gnt)return i.failAndThrow("Another docs publish is currently in progress. Please try again once the other publish is complete.");throw b}let I=eOt[v]??eOt[eOt.length-1]??6e4,w=I/6e4;i.logger.warn(`Another docs publish is in progress. Retrying in ${w} minute${w===1?"":"s"} (attempt ${v+1}/${eOt.length})...`),await new Promise(x=>setTimeout(x,I))}let E=performance.now()-g;i.logger.debug(`Docs publishing completed in ${E.toFixed(0)}ms`)}),h}var rwn=class{context;task;project;docsWorkspace;ossWorkspaces;token;constructor({context:t,task:r,project:n,docsWorkspace:i,ossWorkspaces:o,token:s}){this.context=t,this.task=r,this.project=n,this.docsWorkspace=i,this.ossWorkspaces=o,this.token=s}async publish({instanceUrl:t,preview:r,skipUpload:n}){let i=new ih({context:this.context,task:this.task});try{let o=await tOt({organization:this.project.config.organization,apiWorkspaces:this.project.apiWorkspaces,ossWorkspaces:this.ossWorkspaces,docsWorkspace:this.docsWorkspace,context:i,token:this.token,instanceUrl:t,preview:r,disableTemplates:void 0,skipUpload:n,cliVersion:"4.33.0"});return i.getResult()===Pp.Failure?{success:!1}:{success:!0,url:o}}catch(o){return{success:!1,error:o instanceof Error?o.message:String(o)}}}};Rt();var Ant=class e{static MAX_DISPLAYED_LOGS_TTY=10;static URL_PATTERN=/https?:\/\/[^\s]+/;context;stream;tasks={};taskOrder=[];startTime;isRegistered=!1;constructor(t){this.context=t.context,this.stream=t.stream??process.stderr}addTask(t){let r={...t,status:t.status??"pending"};return this.tasks[t.id]=r,this.taskOrder.push(t.id),this}async start(t){return this.startTime=Date.now(),t!=null&&await this.context.ttyAwareLogger.takeOverTerminal(()=>{this.stream.write(`
|
|
2208
2208
|
`),this.stream.write(`${be.cyan("\u25C6")} ${be.bold(t.title)}
|
|
2209
2209
|
`),t.subtitle!=null&&this.stream.write(` ${be.dim(t.subtitle)}
|
|
2210
2210
|
`),this.stream.write(`
|
|
@@ -3309,7 +3309,7 @@ generators:
|
|
|
3309
3309
|
uri: your-org/your-sdk-repo
|
|
3310
3310
|
token: \${GITHUB_TOKEN}
|
|
3311
3311
|
mode: pull-request
|
|
3312
|
-
`),z!=null){await tOn.rm(q,{recursive:!0,force:!0}),await tOn.mkdir(q,{recursive:!0}),E.logger.debug(`Self-hosted GitHub mode: cloning ${z.uri} to ${q}`);try{let{execSync:H}=await import("child_process"),ge=H("which git 2>/dev/null || echo 'not found'",{encoding:"utf-8"}).trim(),me=H("git --version 2>/dev/null || echo 'unknown'",{encoding:"utf-8"}).trim();E.logger.debug(`Git environment: path=${ge}, version=${me}, PATH=${process.env.PATH??"unset"}`)}catch{E.logger.debug(`Git environment: unable to determine git info, PATH=${process.env.PATH??"unset"}`)}try{let H=await vVt({githubRepository:z.uri,installationToken:z.token,targetDirectory:q,timeoutMs:3e4}),ge=z.mode??"push";if((ge==="push"||ge==="pull-request")&&z.branch!=null){if(E.logger.debug(`Checking out branch ${z.branch} before generation`),ge==="pull-request"&&!await H.remoteBranchExists(z.branch)){let we=qO(z.uri);E.failAndThrow(`Branch ${z.branch} does not exist in repository ${we.owner}/${we.repo}`)}await H.checkoutRemoteBranch(z.branch)}}catch(H){E.failAndThrow(`Failed to clone GitHub repository ${z.uri}: ${H instanceof Error?H.message:String(H)}`)}}let Z;A.raw?.snippets?.path!=null&&(Z=Ut.of(We(r.absoluteFilePath,Se.of(A.raw.snippets.path)))),Z==null&&z!=null&&(Z=Ut.of((await ZBn()).path+"/snippet.json"));let oe=await ZBn(),{shouldCommit:V,autoVersioningCommitMessage:K,autoVersioningChangelogEntry:Ee,autoVersioningPrDescription:Ce,autoVersioningVersionBumpReason:J}=await Z_n({organization:t.organization,absolutePathToFernConfig:t._absolutePath,workspace:b,generatorInvocation:A,absolutePathToLocalOutput:q,absolutePathToLocalSnippetJSON:Z,absolutePathToLocalSnippetTemplateJSON:void 0,version:i,audiences:n.audiences,workspaceTempDir:oe,keepDocker:o,context:E,irVersionOverride:A.irVersionOverride,outputVersionOverride:i,writeUnitTests:!0,generateOauthClients:_.ok?_?.body.oauthClientEnabled??!1:!1,generatePaginatedClients:_.ok?_?.body.paginationEnabled??!1:!1,includeOptionalRequestPropertyExamples:!1,inspect:s,executionEnvironment:void 0,ir:x,whiteLabel:_.ok?_.body.isWhitelabled:!1,runner:c,ai:l,autoVersioningCache:h,absolutePathToSpecRepo:An(r.absoluteFilePath)});if(E.logger.info(be.green("Wrote files to "+q)),z!=null&&V){let H={debug:we=>E.logger.debug(we),info:we=>E.logger.info(we),warn:we=>E.logger.warn(we),error:we=>E.logger.error(we)},me=await new eOn.PostGenerationPipeline({outputDir:q,replay:{enabled:p?.enabled===!0,skipApplication:d,stageOnly:!1},github:{enabled:!0,uri:z.uri,token:z.token,mode:z.mode??"push",branch:z.branch,commitMessage:K,changelogEntry:Ee,prDescription:Ce,versionBumpReason:J,previewMode:z.previewMode,generatorName:A.name},cliVersion:r.cliVersion??"unknown",generatorVersions:{[A.name]:A.version},generatorName:A.name},H).run();me.steps.replay!=null&&(0,eOn.logReplaySummary)(me.steps.replay,{debug:we=>E.logger.debug(we),info:we=>E.logger.info(be.cyan(we)),warn:we=>E.logger.warn(be.yellow(we)),error:we=>E.logger.error(be.red(we))}),me.success||E.failAndThrow(`Post-generation pipeline failed: ${me.errors?.join(", ")}`)}})))).some(A=>!A)&&a.failAndThrow()}function Rum(e,t){if(e==null)return;let n=(t.name.split("/").pop()??"sdk").replace(/[^a-zA-Z0-9-_]/g,"_");return e?We(e,Se.of(n)):void 0}async function ZBn(){return zco.default.dir({tmpdir:Uco.default.platform()==="darwin"?U1u.default.join("/private",Uco.default.tmpdir()):void 0,prefix:"fern"})}function Fum({generatorInvocation:e,org:t,version:r,packageName:n,context:i}){if(e.raw?.github!=null&&z1u(e.raw.github)){let[o,s]=e.raw.github.uri.split("/");if(o==null||s==null)return i.failAndThrow(`Invalid GitHub repository URI: ${e.raw.github.uri}. Expected format: owner/repo`);let a=e.raw.github.mode==="pull-request"?"pull-request":void 0;return qt.PublishingConfig.github({owner:o,repo:s,uri:e.raw.github.uri,token:e.raw.github.token,mode:a,branch:e.raw.github.branch,target:kum({outputSchema:e.raw.output,version:r,packageName:n})})}if(e.raw?.output?.location==="local-file-system"){let o;if(e.language==="python")o=D0.pypi({version:r,packageName:n}),i.logger.debug(`Created PyPiPublishTarget: version ${r} package name: ${n}`);else if(e.language==="rust")o=D0.crates({version:r,packageName:n}),i.logger.debug(`Created CratesPublishTarget: version ${r} package name: ${n}`);else if(e.language==="java"){let s=e.raw?.config,a=(()=>{if(!s||typeof s!="object"||s===null)return;let c=s;if(typeof c.group=="string"&&typeof c.artifact=="string")return{groupId:c.group,artifactId:c.artifact};if(typeof c["package-prefix"]=="string"&&n)return{groupId:c["package-prefix"],artifactId:n};typeof c["package-prefix"]=="string"&&!n&&i.logger.warn("Java generator has package-prefix configured but packageName is missing")})(),u=a?`${a.groupId}:${a.artifactId}`:void 0;if(u){let c=r??"0.0.0";o=D0.maven({coordinate:u,version:c,usernameEnvironmentVariable:"MAVEN_USERNAME",passwordEnvironmentVariable:"MAVEN_PASSWORD",mavenUrlEnvironmentVariable:"MAVEN_PUBLISH_REGISTRY_URL"}),i.logger.debug(`Created MavenPublishTarget: coordinate ${u} version ${c}`)}else s&&typeof s=="object"&&i.logger.debug("Java generator config provided but could not construct Maven coordinate. Expected either 'group' and 'artifact' or 'package-prefix' with packageName.")}return qt.PublishingConfig.filesystem({generateFullProject:t?.selfHostedSdKs??!1,publishTarget:o})}return e.outputMode._visit({downloadFiles:()=>qt.PublishingConfig.filesystem({generateFullProject:t?.selfHostedSdKs??!1,publishTarget:void 0}),github:()=>{},githubV2:()=>{},publish:()=>{},publishV2:()=>{},_other:()=>{}})}function kum({outputSchema:e,version:t,packageName:r}){let n=qt.PublishTarget.postman({apiKey:"",workspaceId:"",collectionId:void 0});if(e==null)return n;if(e.location==="npm"){let i=(e.token||"${NPM_TOKEN}").trim(),o=i==="<USE_OIDC>"||i==="OIDC";return D0.npm({packageName:e["package-name"],version:t??"0.0.0",tokenEnvironmentVariable:o?"<USE_OIDC>":i.startsWith("${")&&i.endsWith("}")?i.slice(2,-1).trim():""})}else return e.location==="maven"?D0.maven({version:t??"0.0.0",coordinate:e.coordinate,usernameEnvironmentVariable:e.username||"MAVEN_USERNAME",passwordEnvironmentVariable:e.password||"MAVEN_PASSWORD",mavenUrlEnvironmentVariable:e.url||"MAVEN_PUBLISH_REGISTRY_URL"}):e.location==="pypi"?D0.pypi({version:t,packageName:r}):n}function z1u(e){return e==null?!1:"uri"in e&&"token"in e}var Qum={defaultEndpoint:void 0,bannerLink:void 0,introduction:void 0,apiReferenceLink:void 0,apiName:void 0,disabledFeatures:void 0,whiteLabel:void 0,customSections:void 0,features:void 0,exampleStyle:void 0};function Num(e,t){if(e.raw?.github!=null&&z1u(e.raw.github))return{...e.raw.github,previewMode:t}}var pDt=class{executionEnvironment;constructor(t){this.executionEnvironment=t}async run({organization:t,absolutePathToFernConfig:r,workspace:n,generatorGroup:i,context:o,irVersionOverride:s,outputVersionOverride:a,shouldGenerateDynamicSnippetTests:u,skipUnstableDynamicSnippetTests:c,inspect:l}){let p=await Promise.all(i.generators.map(async d=>o.runInteractiveTask({name:d.name},async f=>{if(d.absolutePathToLocalOutput==null){f.failWithoutThrowing("Cannot generate because output location is not local-file-system");return}try{let{ir:m,generatorConfig:h}=await this.executeGenerator({generatorGroup:i,generatorInvocation:d,context:f,workspace:n,organization:t,irVersionOverride:s,outputVersionOverride:a,absolutePathToFernConfig:r,inspect:l});f.logger.info(be.green("Wrote files to "+d.absolutePathToLocalOutput)),u&&d.language!=null?(f.logger.info(`Generating dynamic snippet tests for ${d.language}...`),await Dgu({context:f,ir:m,config:h,language:d.language,outputDir:d.absolutePathToLocalOutput,skipUnstable:c})):f.logger.info(`Skipping dynamic snippet tests; shouldGenerateDynamicSnippetTests: ${u}, language: ${d.language}`)}catch(m){m instanceof pm||(m instanceof m8?f.failWithoutThrowing(`Generation failed: ${m.log}`,m):f.failWithoutThrowing(`Generation failed: ${m instanceof Error?m.message:"Unknown error"}`,m))}})))}async executeGenerator({generatorGroup:t,generatorInvocation:r,context:n,workspace:i,organization:o,irVersionOverride:s,outputVersionOverride:a,absolutePathToFernConfig:u,inspect:c}){if(n.logger.info(`Starting generation for ${r.name}`),r.absolutePathToLocalOutput==null)throw new Error("Output path is required for generation");let l=Zm({workspace:i,audiences:t.audiences,generationLanguage:r.language,keywords:r.keywords,smartCasing:r.smartCasing,exampleGeneration:{includeOptionalRequestPropertyExamples:!0,disabled:r.disableExamples},readme:r.readme,version:a,packageName:bn.getPackageName({generatorInvocation:r}),context:n,sourceResolver:new tm(n,i),generationMetadata:{cliVersion:i.cliVersion,generatorName:r.name,generatorVersion:r.version,generatorConfig:r.config,originGitCommit:k9()}}),p=await ZBn();return Z_n({organization:o,absolutePathToFernConfig:u,workspace:i,generatorInvocation:r,absolutePathToLocalOutput:r.absolutePathToLocalOutput,absolutePathToLocalSnippetJSON:r.absolutePathToLocalOutput?Ut.of(We(r.absolutePathToLocalOutput,Se.of(pqt))):void 0,absolutePathToLocalSnippetTemplateJSON:void 0,audiences:t.audiences,workspaceTempDir:p,version:a,keepDocker:!1,context:n,irVersionOverride:s,outputVersionOverride:a,writeUnitTests:!0,generateOauthClients:!0,generatePaginatedClients:!0,includeOptionalRequestPropertyExamples:!0,inspect:c,executionEnvironment:this.executionEnvironment,ir:l,runner:void 0,ai:i.generatorsConfiguration?.ai,absolutePathToSpecRepo:void 0})}};var q1u=require("fs/promises");Rt();Vt();zre();var HA=_e(foe(),1),V1u=require("fs/promises"),bst=class{context;constructor(t){this.context=t.context}async adapt(t){return{raw:this.buildRaw(t),name:t.image,version:t.version,config:t.config,language:this.mapLanguage(t.lang),outputMode:await this.buildOutputMode(t),absolutePathToLocalOutput:this.context.resolveOutputFilePath(t.output.path),smartCasing:t.smartCasing??!0,readme:this.buildReadme(t),absolutePathToLocalSnippets:void 0,disableExamples:!1,irVersionOverride:void 0,keywords:void 0,publishMetadata:void 0,settings:void 0}}buildRaw(t){let r=t.output.git;if(!(r==null||!oE.isGitOutputSelfHosted(r)))return{name:t.image,version:t.version,github:{uri:r.uri,token:r.token,mode:this.mapSelfHostedMode(r.mode),branch:r.branch}}}mapSelfHostedMode(t){if(t==null)return bn.GithubSelfhostedMode.PullRequest;switch(t){case"pr":return bn.GithubSelfhostedMode.PullRequest;case"push":return bn.GithubSelfhostedMode.Push;default:xe(t)}}async buildOutputMode(t){if(t.output.git!=null){let r=t.output.git;return oE.isGitOutputSelfHosted(r)?await this.buildGitSelfHostedOutputMode({target:t,git:r}):await this.buildGitHubRepositoryOutputMode({target:t,git:r})}return HA.FernFiddle.remoteGen.OutputMode.downloadFiles({})}async buildGitHubRepositoryOutputMode({target:t,git:r}){let n=qO(r.repository),i=r.license!=null?await this.convertLicense(r.license):void 0,o=t.publish!=null?this.buildPublishInfo(t.publish):void 0,s=this.buildReviewers(r.reviewers),a=r.mode??"pr";switch(a){case"pr":return HA.FernFiddle.remoteGen.OutputMode.githubV2(HA.FernFiddle.GithubOutputModeV2.pullRequest({owner:n.owner,repo:n.repo,license:i,publishInfo:o,reviewers:s,downloadSnippets:void 0}));case"release":return HA.FernFiddle.remoteGen.OutputMode.githubV2(HA.FernFiddle.GithubOutputModeV2.commitAndRelease({owner:n.owner,repo:n.repo,license:i,publishInfo:o,downloadSnippets:void 0}));case"push":return HA.FernFiddle.remoteGen.OutputMode.githubV2(HA.FernFiddle.GithubOutputModeV2.push({owner:n.owner,repo:n.repo,branch:r.branch,license:i,publishInfo:o,downloadSnippets:void 0}));default:xe(a)}}async buildGitSelfHostedOutputMode({target:t,git:r}){let n=qO(r.uri),i=r.license!=null?await this.convertLicense(r.license):void 0,o=t.publish!=null?this.buildPublishInfo(t.publish):void 0,s=r.mode??"pr";switch(s){case"pr":return HA.FernFiddle.remoteGen.OutputMode.githubV2(HA.FernFiddle.GithubOutputModeV2.pullRequest({owner:n.owner,repo:n.repo,branch:r.branch,license:i,publishInfo:o}));case"push":return HA.FernFiddle.remoteGen.OutputMode.githubV2(HA.FernFiddle.GithubOutputModeV2.push({owner:n.owner,repo:n.repo,branch:r.branch,license:i,publishInfo:o}));default:xe(s)}}buildPublishInfo(t){if(t.npm!=null)return this.buildNpmPublishInfo(t.npm);if(t.pypi!=null)return this.buildPypiPublishInfo(t.pypi);if(t.maven!=null)return this.buildMavenPublishInfo(t.maven);if(t.nuget!=null)return this.buildNugetPublishInfo(t.nuget);if(t.rubygems!=null)return this.buildRubygemsPublishInfo(t.rubygems);if(t.crates!=null)return this.buildCratesPublishInfo(t.crates)}buildNpmPublishInfo(t){return HA.FernFiddle.GithubPublishInfo.npm({registryUrl:t.url??"https://registry.npmjs.org",packageName:t.packageName,token:t.token})}buildPypiPublishInfo(t){return HA.FernFiddle.GithubPublishInfo.pypi({registryUrl:t.url??"https://upload.pypi.org/legacy/",packageName:t.packageName,credentials:t.token!=null?{username:"__token__",password:t.token}:t.username!=null&&t.password!=null?{username:t.username,password:t.password}:void 0,pypiMetadata:t.metadata!=null?{keywords:t.metadata.keywords,documentationLink:t.metadata.documentationLink,homepageLink:t.metadata.homepageLink}:void 0})}buildMavenPublishInfo(t){return HA.FernFiddle.GithubPublishInfo.maven({registryUrl:t.url??"https://s01.oss.sonatype.org/content/repositories/releases/",coordinate:t.coordinate,credentials:t.username!=null&&t.password!=null?{username:t.username,password:t.password}:void 0,signature:t.signature!=null?{keyId:t.signature.keyId,password:t.signature.password,secretKey:t.signature.secretKey}:void 0})}buildNugetPublishInfo(t){return HA.FernFiddle.GithubPublishInfo.nuget({registryUrl:t.url??"https://nuget.org/",packageName:t.packageName,apiKey:t.apiKey})}buildRubygemsPublishInfo(t){return HA.FernFiddle.GithubPublishInfo.rubygems({registryUrl:t.url??"https://rubygems.org/",packageName:t.packageName,apiKey:t.apiKey})}buildCratesPublishInfo(t){return HA.FernFiddle.GithubPublishInfo.crates({registryUrl:t.url??"https://crates.io/api/v1/crates",packageName:t.packageName,token:t.token})}buildReviewers(t){if(t==null)return;let r=[];if(t.teams!=null)for(let n of t.teams)r.push(HA.FernFiddle.GithubPullRequestReviewer.team({name:n}));if(t.users!=null)for(let n of t.users)r.push(HA.FernFiddle.GithubPullRequestReviewer.user({name:n}));return r.length>0?r:void 0}async convertLicense(t){if(t==="MIT")return HA.FernFiddle.GithubLicense.basic({id:HA.FernFiddle.GithubLicenseId.Mit});if(t==="Apache-2.0")return HA.FernFiddle.GithubLicense.basic({id:HA.FernFiddle.GithubLicenseId.Apache});let r=We(this.context.cwd,Se.of(t));if(!await Xt(r,"file"))throw new Error(`Custom license file "${r}" does not exist; did you mean to use either MIT or Apache-2.0?`);let n=await(0,V1u.readFile)(r,"utf-8");return HA.FernFiddle.GithubLicense.custom({contents:n})}buildReadme(t){let r=t.readme;if(r==null)return;let n={};return r.bannerLink!=null&&(n.bannerLink=r.bannerLink),r.introduction!=null&&(n.introduction=r.introduction),r.apiReferenceLink!=null&&(n.apiReferenceLink=r.apiReferenceLink),r.apiName!=null&&(n.apiName=r.apiName),r.disabledSections!=null&&(n.disabledSections=r.disabledSections),r.defaultEndpoint!=null&&(n.defaultEndpoint=r.defaultEndpoint),r.features!=null&&(n.features=r.features),r.customSections!=null&&(n.customSections=r.customSections.map(i=>({title:i.title,language:i.language??t.lang,content:i.content}))),r.exampleStyle!=null&&(n.exampleStyle=r.exampleStyle),n}mapLanguage(t){return{typescript:bn.GenerationLanguage.TYPESCRIPT,python:bn.GenerationLanguage.PYTHON,java:bn.GenerationLanguage.JAVA,go:bn.GenerationLanguage.GO,ruby:bn.GenerationLanguage.RUBY,csharp:bn.GenerationLanguage.CSHARP,swift:bn.GenerationLanguage.SWIFT,php:bn.GenerationLanguage.PHP,rust:bn.GenerationLanguage.RUST}[t.toLowerCase()]}};Vt();var nOn=require("path");function iOn({context:e,task:t,target:r,preview:n,outputPath:i}){if(n)return[(i!=null?(0,nOn.resolve)(e.cwd,i):(0,nOn.join)(e.cwd,Se.of(".fern/preview"))).toString()];let o=jum(t);if(o!=null){if(o.pullRequestUrl!=null)return[o.pullRequestUrl];if(o.releaseUrl!=null)return[o.releaseUrl];if(o.branchUrl!=null)return[o.branchUrl]}return e.resolveTargetOutputs(r)}function jum(e){let t={};for(let r of e.logs??[]){let n=r.message.match(/Created pull request: (.+)/);n!=null&&(t.pullRequestUrl=n[1]);let i=r.message.match(/Created commit (\w+)/);i!=null&&(t.commitHash=i[1]);let o=r.message.match(/Pushed branch: (.+)/);o!=null&&(t.branchUrl=o[1]);let s=r.message.match(/Release tagged\. View here: (.+)/);s!=null&&(t.releaseUrl=s[1])}return Object.keys(t).length>0?t:void 0}var oOn=class{context;cliVersion;invocationAdapter;constructor(t){this.context=t.context,this.cliVersion=t.cliVersion,this.invocationAdapter=new bst({context:this.context})}async run(t){let r=new ih({context:this.context,task:t.task,logLevel:zn.Info});try{let n=await this.invocationAdapter.adapt(t.target),i={groupName:t.target.name,audiences:t.audiences??{type:"all"},generators:[n],reviewers:void 0},s=await new QEe({context:this.context,cliVersion:this.cliVersion,task:t.task}).adapt(t.apiDefinition);return t.target.output.git!=null&&oE.isGitOutputSelfHosted(t.target.output.git)?await this.runSelfHostedGeneration({args:t,taskContext:r,fernWorkspace:s,generatorGroup:i}):await this.runLocalGeneration({args:t,taskContext:r,fernWorkspace:s,generatorGroup:i,generatorInvocation:n})}catch(n){return r.getResult()===Pp.Failure?{success:!1}:{success:!1,error:n instanceof Error?n.message:String(n)}}}async runSelfHostedGeneration({args:t,taskContext:r,fernWorkspace:n,generatorGroup:i}){let o={_absolutePath:We(this.context.cwd,Se.of("fern.config.json")),rawConfig:{organization:t.organization,version:this.cliVersion},organization:t.organization,version:this.cliVersion};return await rOn({token:t.token,projectConfig:o,workspace:n,generatorGroup:i,version:t.version,keepDocker:t.keepContainer??!1,context:r,runner:t.containerEngine,absolutePathToPreview:void 0,inspect:!1,ai:void 0}),r.getResult()===Pp.Failure?{success:!1}:{success:!0,output:iOn({context:this.context,task:t.task,target:t.target,preview:t.preview,outputPath:t.outputPath})}}async runLocalGeneration({args:t,taskContext:r,fernWorkspace:n,generatorGroup:i,generatorInvocation:o}){let s=`${t.target.image}:${t.target.version}`,a=new pRe({containerImage:s,keepContainer:t.keepContainer??!1,runner:t.containerEngine});if(await new pDt(a).run({organization:t.organization,workspace:n,generatorGroup:i,context:r,outputVersionOverride:t.version,ai:t.ai,absolutePathToFernConfig:void 0,irVersionOverride:void 0,shouldGenerateDynamicSnippetTests:!1,skipUnstableDynamicSnippetTests:!0,inspect:!1}),t.target.output.path!=null&&o.absolutePathToLocalOutput!=null){let c=We(o.absolutePathToLocalOutput,Se.of(pqt));await(0,q1u.rm)(c,{force:!0})}return r.getResult()===Pp.Failure?{success:!1}:{success:!0,output:this.context.resolveTargetOutputs(t.target)}}};Vt();var xke=require("fs/promises"),G1u=require("os");var sOn=class{context;cliVersion;invocationAdapter;constructor(t){this.context=t.context,this.cliVersion=t.cliVersion,this.invocationAdapter=new bst({context:this.context})}async run(t){let r=new ih({context:this.context,task:t.task,logLevel:zn.Info});try{let n=await this.invocationAdapter.adapt(t.target),i={groupName:t.target.name,audiences:t.audiences??{type:"all"},generators:[n],reviewers:void 0},s=await new QEe({context:this.context,cliVersion:this.cliVersion,task:t.task}).adapt(t.apiDefinition),a=await this.getAbsolutePathToPreview(t);if(await YBt({projectConfig:this.getProjectConfig(t),organization:t.organization,workspace:s,context:r,generatorGroup:i,version:t.version,shouldLogS3Url:t.shouldLogS3Url??!1,token:t.token,mode:this.mapMode(t.target),fernignorePath:t.fernignorePath,absolutePathToPreview:a,whitelabel:void 0,dynamicIrOnly:!1,retryRateLimited:!1}),this.isLocalGitCombo(t)&&a!=null){let u=K1(n.name),c=We(a,Se.of(u)),l=n.absolutePathToLocalOutput;l!=null&&(await(0,xke.cp)(c,l,{recursive:!0}),await(0,xke.rm)(We(l,Se.of(".git")),{recursive:!0,force:!0})),await(0,xke.rm)(a,{recursive:!0,force:!0})}return r.getResult()===Pp.Failure?{success:!1}:{success:!0,output:iOn({context:this.context,task:t.task,target:t.target,preview:t.preview,outputPath:t.outputPath})}}catch(n){return r.getResult()===Pp.Failure?{success:!1}:{success:!1,error:n instanceof Error?n.message:String(n)}}}async getAbsolutePathToPreview(t){if(this.isLocalGitCombo(t)){let r=await(0,xke.mkdtemp)(We(Ut.of((0,G1u.tmpdir)()),Se.of("fern-preview-")));return Ut.of(r)}if(t.preview)return t.outputPath!=null?Yi(this.context.cwd,t.outputPath):We(this.context.cwd,Se.of(".fern/preview"))}getProjectConfig(t){return{_absolutePath:We(this.context.cwd,Se.of("fern.config.json")),rawConfig:{organization:t.organization,version:this.cliVersion},organization:t.organization,version:this.cliVersion}}mapMode(t){if(t.output.git!=null)return t.output.git.mode==="pr"?"pull-request":void 0}isLocalGitCombo(t){return t.target.output.path!=null&&t.target.output.git!=null&&!t.preview}};var aOn=class{context;cliVersion;constructor(t){this.context=t.context,this.cliVersion=t.cliVersion}async run(t){try{return this.isLocalGeneration(t)?await this.runLocalGeneration(t):await this.runRemoteGeneration(t)}catch(r){let n=r instanceof Error?r.message:String(r);return{success:!1,target:t.target,error:n}}}async runLocalGeneration(t){let n=await new oOn({context:this.context,cliVersion:this.cliVersion}).run({task:t.task,target:t.target,apiDefinition:t.apiDefinition,organization:t.organization,ai:t.ai,audiences:t.audiences,version:t.version,keepContainer:t.keepContainer,preview:t.preview,outputPath:t.outputPath,containerEngine:t.containerEngine,token:t.token});return n.success?{success:!0,target:t.target,output:n.output}:{success:!1,target:t.target,error:n.error}}async runRemoteGeneration(t){if(t.token==null)throw Kr.authRequired();let n=await new sOn({context:this.context,cliVersion:this.cliVersion}).run({target:t.target,apiDefinition:t.apiDefinition,organization:t.organization,token:t.token,task:t.task,ai:t.ai,audiences:t.audiences,version:t.version,shouldLogS3Url:t.shouldLogS3Url,preview:t.preview,outputPath:t.outputPath,fernignorePath:t.fernignorePath});return n.success?{success:!0,target:t.target,output:n.output}:{success:!1,target:t.target,error:n.error}}isLocalGeneration(t){return t.runtime==="local"||t.target.output.git!=null&&oE.isGitOutputSelfHosted(t.target.output.git)}};var uOn=class{id;taskGroup;stage;constructor({id:t,taskGroup:r}){this.id=t,this.taskGroup=r,this.stage={validation:new Fae({taskId:t,taskGroup:r,stageId:"validation"}),generator:new Fae({taskId:t,taskGroup:r,stageId:"generator"}),output:new Fae({taskId:t,taskGroup:r,stageId:"output"})}}getTask(){let t=this.taskGroup.getTask(this.id);if(t==null)throw new Error(`Internal error; task '${this.id}' does not exist`);return t}start(t){this.taskGroup.updateTask({id:this.id,update:{status:"running",currentStep:t}})}complete(t){this.taskGroup.updateTask({id:this.id,update:{status:"success",output:t}})}fail(t){this.taskGroup.updateTask({id:this.id,update:{status:"error",error:t}})}};var cOn=class{taskGroup;tasks={};defaultStages=[{id:"validation",labels:{pending:"Validate API",running:"Validating API...",success:"Validated API"}},{id:"generator",labels:{pending:"Run generator",running:"Running generator...",success:"Generator completed"}},{id:"output",labels:{pending:"Write output",running:"Writing output...",success:"Wrote output"}}];constructor({context:t}){this.tasks={},this.taskGroup=new Ant({context:t})}addTask({id:t,name:r,stageOverrides:n}){let i=r??t;this.taskGroup.addTask({id:t,name:i});let o=this.buildStages(n);this.taskGroup.setStages(t,o);let s=new uOn({taskGroup:this.taskGroup,id:t});return this.tasks[t]=s,s}getTask(t){return this.tasks[t]}async start(t){await this.taskGroup.start(t)}finish({successMessage:t,errorMessage:r}){return this.taskGroup.complete({successMessage:t,errorMessage:r})}buildStages(t){return t==null?this.defaultStages:this.defaultStages.map(r=>{let n=t[r.id];return n==null?r:{...r,labels:{...r.labels,...n}}})}};Vt();var lOn=class{context;constructor({context:t}){this.context=t}async build({org:t,lang:r,resolvedSpec:n,output:i,targetVersion:o}){let s=cIr({lang:r,version:o}),a=Se.of(ha(this.context.cwd,n.absoluteFilePath)),u=new uL({absoluteFilePath:n.absoluteFilePath,relativeFilePath:a,line:1,column:1}),c={name:r,api:sGe,image:s.image,lang:r,version:s.tag,sourceLocation:u,output:oE.resolveOutputObjectSchema(i)};return{apis:{[sGe]:{specs:[n.spec]}},cliVersion:"*",org:t,sdks:{org:t,targets:[c]}}}};var fDt=class{async handle(t,r){let n=await t.loadWorkspace();if(n==null)return this.handleWithFlags(t,r);if(!n.success)throw new W4(n.issues);return this.handleWithWorkspace(t,n.workspace,r)}async handleWithWorkspace(t,r,n){let i=r;if(n.api!=null){let a=await new oOt({context:t}).resolve({reference:n.api}),u={};for(let c of Object.keys(i.apis))u[c]={specs:[a.spec]};i={...i,apis:u}}n.org!=null&&(i={...i,org:n.org});let o=this.getTargets({workspace:i,args:n,groupName:n.target!=null?void 0:n.group??i.sdks?.defaultGroup});this.validateArgs({workspace:i,args:n,targets:o}),await this.runGeneration({context:t,workspace:i,targets:o,args:n,forceLocal:!1})}async handleWithFlags(t,r){let n=[];if(r.api==null&&n.push("--api <path|url> Path or URL to an API spec file (e.g. ./openapi.yaml)"),r.target==null&&n.push("--target <language> The SDK language to generate (e.g. typescript)"),r.org==null&&n.push("--org <name> Your organization name (e.g. acme)"),r.output==null&&n.push("--output <path|url> Output path or git URL (e.g. ./my-sdk)"),r.group!=null&&n.push("remove --group Groups are not supported without a fern.yml"),n.length>0)throw new Kr({message:`No fern.yml found, either run 'fern init' or specify all of the required flags:
|
|
3312
|
+
`),z!=null){await tOn.rm(q,{recursive:!0,force:!0}),await tOn.mkdir(q,{recursive:!0}),E.logger.debug(`Self-hosted GitHub mode: cloning ${z.uri} to ${q}`);try{let{execSync:H}=await import("child_process"),ge=H("which git 2>/dev/null || echo 'not found'",{encoding:"utf-8"}).trim(),me=H("git --version 2>/dev/null || echo 'unknown'",{encoding:"utf-8"}).trim();E.logger.debug(`Git environment: path=${ge}, version=${me}, PATH=${process.env.PATH??"unset"}`)}catch{E.logger.debug(`Git environment: unable to determine git info, PATH=${process.env.PATH??"unset"}`)}try{let H=await vVt({githubRepository:z.uri,installationToken:z.token,targetDirectory:q,timeoutMs:3e4}),ge=z.mode??"push";if((ge==="push"||ge==="pull-request")&&z.branch!=null){if(E.logger.debug(`Checking out branch ${z.branch} before generation`),ge==="pull-request"&&!await H.remoteBranchExists(z.branch)){let we=qO(z.uri);E.failAndThrow(`Branch ${z.branch} does not exist in repository ${we.owner}/${we.repo}`)}await H.checkoutRemoteBranch(z.branch)}}catch(H){E.failAndThrow(`Failed to clone GitHub repository ${z.uri}: ${H instanceof Error?H.message:String(H)}`)}}let Z;A.raw?.snippets?.path!=null&&(Z=Ut.of(We(r.absoluteFilePath,Se.of(A.raw.snippets.path)))),Z==null&&z!=null&&(Z=Ut.of((await ZBn()).path+"/snippet.json"));let oe=await ZBn(),{shouldCommit:V,autoVersioningCommitMessage:K,autoVersioningChangelogEntry:Ee,autoVersioningPrDescription:Ce,autoVersioningVersionBumpReason:J}=await Z_n({organization:t.organization,absolutePathToFernConfig:r.generatorsConfiguration?.absolutePathToConfiguration??t._absolutePath,workspace:b,generatorInvocation:A,absolutePathToLocalOutput:q,absolutePathToLocalSnippetJSON:Z,absolutePathToLocalSnippetTemplateJSON:void 0,version:i,audiences:n.audiences,workspaceTempDir:oe,keepDocker:o,context:E,irVersionOverride:A.irVersionOverride,outputVersionOverride:i,writeUnitTests:!0,generateOauthClients:_.ok?_?.body.oauthClientEnabled??!1:!1,generatePaginatedClients:_.ok?_?.body.paginationEnabled??!1:!1,includeOptionalRequestPropertyExamples:!1,inspect:s,executionEnvironment:void 0,ir:x,whiteLabel:_.ok?_.body.isWhitelabled:!1,runner:c,ai:l,autoVersioningCache:h,absolutePathToSpecRepo:An(r.absoluteFilePath)});if(E.logger.info(be.green("Wrote files to "+q)),z!=null&&V){let H={debug:we=>E.logger.debug(we),info:we=>E.logger.info(we),warn:we=>E.logger.warn(we),error:we=>E.logger.error(we)},me=await new eOn.PostGenerationPipeline({outputDir:q,replay:{enabled:p?.enabled===!0,skipApplication:d,stageOnly:!1},github:{enabled:!0,uri:z.uri,token:z.token,mode:z.mode??"push",branch:z.branch,commitMessage:K,changelogEntry:Ee,prDescription:Ce,versionBumpReason:J,previewMode:z.previewMode,generatorName:A.name},cliVersion:r.cliVersion??"unknown",generatorVersions:{[A.name]:A.version},generatorName:A.name},H).run();me.steps.replay!=null&&(0,eOn.logReplaySummary)(me.steps.replay,{debug:we=>E.logger.debug(we),info:we=>E.logger.info(be.cyan(we)),warn:we=>E.logger.warn(be.yellow(we)),error:we=>E.logger.error(be.red(we))}),me.success||E.failAndThrow(`Post-generation pipeline failed: ${me.errors?.join(", ")}`)}})))).some(A=>!A)&&a.failAndThrow()}function Rum(e,t){if(e==null)return;let n=(t.name.split("/").pop()??"sdk").replace(/[^a-zA-Z0-9-_]/g,"_");return e?We(e,Se.of(n)):void 0}async function ZBn(){return zco.default.dir({tmpdir:Uco.default.platform()==="darwin"?U1u.default.join("/private",Uco.default.tmpdir()):void 0,prefix:"fern"})}function Fum({generatorInvocation:e,org:t,version:r,packageName:n,context:i}){if(e.raw?.github!=null&&z1u(e.raw.github)){let[o,s]=e.raw.github.uri.split("/");if(o==null||s==null)return i.failAndThrow(`Invalid GitHub repository URI: ${e.raw.github.uri}. Expected format: owner/repo`);let a=e.raw.github.mode==="pull-request"?"pull-request":void 0;return qt.PublishingConfig.github({owner:o,repo:s,uri:e.raw.github.uri,token:e.raw.github.token,mode:a,branch:e.raw.github.branch,target:kum({outputSchema:e.raw.output,version:r,packageName:n})})}if(e.raw?.output?.location==="local-file-system"){let o;if(e.language==="python")o=D0.pypi({version:r,packageName:n}),i.logger.debug(`Created PyPiPublishTarget: version ${r} package name: ${n}`);else if(e.language==="rust")o=D0.crates({version:r,packageName:n}),i.logger.debug(`Created CratesPublishTarget: version ${r} package name: ${n}`);else if(e.language==="java"){let s=e.raw?.config,a=(()=>{if(!s||typeof s!="object"||s===null)return;let c=s;if(typeof c.group=="string"&&typeof c.artifact=="string")return{groupId:c.group,artifactId:c.artifact};if(typeof c["package-prefix"]=="string"&&n)return{groupId:c["package-prefix"],artifactId:n};typeof c["package-prefix"]=="string"&&!n&&i.logger.warn("Java generator has package-prefix configured but packageName is missing")})(),u=a?`${a.groupId}:${a.artifactId}`:void 0;if(u){let c=r??"0.0.0";o=D0.maven({coordinate:u,version:c,usernameEnvironmentVariable:"MAVEN_USERNAME",passwordEnvironmentVariable:"MAVEN_PASSWORD",mavenUrlEnvironmentVariable:"MAVEN_PUBLISH_REGISTRY_URL"}),i.logger.debug(`Created MavenPublishTarget: coordinate ${u} version ${c}`)}else s&&typeof s=="object"&&i.logger.debug("Java generator config provided but could not construct Maven coordinate. Expected either 'group' and 'artifact' or 'package-prefix' with packageName.")}return qt.PublishingConfig.filesystem({generateFullProject:t?.selfHostedSdKs??!1,publishTarget:o})}return e.outputMode._visit({downloadFiles:()=>qt.PublishingConfig.filesystem({generateFullProject:t?.selfHostedSdKs??!1,publishTarget:void 0}),github:()=>{},githubV2:()=>{},publish:()=>{},publishV2:()=>{},_other:()=>{}})}function kum({outputSchema:e,version:t,packageName:r}){let n=qt.PublishTarget.postman({apiKey:"",workspaceId:"",collectionId:void 0});if(e==null)return n;if(e.location==="npm"){let i=(e.token||"${NPM_TOKEN}").trim(),o=i==="<USE_OIDC>"||i==="OIDC";return D0.npm({packageName:e["package-name"],version:t??"0.0.0",tokenEnvironmentVariable:o?"<USE_OIDC>":i.startsWith("${")&&i.endsWith("}")?i.slice(2,-1).trim():""})}else return e.location==="maven"?D0.maven({version:t??"0.0.0",coordinate:e.coordinate,usernameEnvironmentVariable:e.username||"MAVEN_USERNAME",passwordEnvironmentVariable:e.password||"MAVEN_PASSWORD",mavenUrlEnvironmentVariable:e.url||"MAVEN_PUBLISH_REGISTRY_URL"}):e.location==="pypi"?D0.pypi({version:t,packageName:r}):n}function z1u(e){return e==null?!1:"uri"in e&&"token"in e}var Qum={defaultEndpoint:void 0,bannerLink:void 0,introduction:void 0,apiReferenceLink:void 0,apiName:void 0,disabledFeatures:void 0,whiteLabel:void 0,customSections:void 0,features:void 0,exampleStyle:void 0};function Num(e,t){if(e.raw?.github!=null&&z1u(e.raw.github))return{...e.raw.github,previewMode:t}}var pDt=class{executionEnvironment;constructor(t){this.executionEnvironment=t}async run({organization:t,absolutePathToFernConfig:r,workspace:n,generatorGroup:i,context:o,irVersionOverride:s,outputVersionOverride:a,shouldGenerateDynamicSnippetTests:u,skipUnstableDynamicSnippetTests:c,inspect:l}){let p=await Promise.all(i.generators.map(async d=>o.runInteractiveTask({name:d.name},async f=>{if(d.absolutePathToLocalOutput==null){f.failWithoutThrowing("Cannot generate because output location is not local-file-system");return}try{let{ir:m,generatorConfig:h}=await this.executeGenerator({generatorGroup:i,generatorInvocation:d,context:f,workspace:n,organization:t,irVersionOverride:s,outputVersionOverride:a,absolutePathToFernConfig:r,inspect:l});f.logger.info(be.green("Wrote files to "+d.absolutePathToLocalOutput)),u&&d.language!=null?(f.logger.info(`Generating dynamic snippet tests for ${d.language}...`),await Dgu({context:f,ir:m,config:h,language:d.language,outputDir:d.absolutePathToLocalOutput,skipUnstable:c})):f.logger.info(`Skipping dynamic snippet tests; shouldGenerateDynamicSnippetTests: ${u}, language: ${d.language}`)}catch(m){m instanceof pm||(m instanceof m8?f.failWithoutThrowing(`Generation failed: ${m.log}`,m):f.failWithoutThrowing(`Generation failed: ${m instanceof Error?m.message:"Unknown error"}`,m))}})))}async executeGenerator({generatorGroup:t,generatorInvocation:r,context:n,workspace:i,organization:o,irVersionOverride:s,outputVersionOverride:a,absolutePathToFernConfig:u,inspect:c}){if(n.logger.info(`Starting generation for ${r.name}`),r.absolutePathToLocalOutput==null)throw new Error("Output path is required for generation");let l=Zm({workspace:i,audiences:t.audiences,generationLanguage:r.language,keywords:r.keywords,smartCasing:r.smartCasing,exampleGeneration:{includeOptionalRequestPropertyExamples:!0,disabled:r.disableExamples},readme:r.readme,version:a,packageName:bn.getPackageName({generatorInvocation:r}),context:n,sourceResolver:new tm(n,i),generationMetadata:{cliVersion:i.cliVersion,generatorName:r.name,generatorVersion:r.version,generatorConfig:r.config,originGitCommit:k9()}}),p=await ZBn();return Z_n({organization:o,absolutePathToFernConfig:u,workspace:i,generatorInvocation:r,absolutePathToLocalOutput:r.absolutePathToLocalOutput,absolutePathToLocalSnippetJSON:r.absolutePathToLocalOutput?Ut.of(We(r.absolutePathToLocalOutput,Se.of(pqt))):void 0,absolutePathToLocalSnippetTemplateJSON:void 0,audiences:t.audiences,workspaceTempDir:p,version:a,keepDocker:!1,context:n,irVersionOverride:s,outputVersionOverride:a,writeUnitTests:!0,generateOauthClients:!0,generatePaginatedClients:!0,includeOptionalRequestPropertyExamples:!0,inspect:c,executionEnvironment:this.executionEnvironment,ir:l,runner:void 0,ai:i.generatorsConfiguration?.ai,absolutePathToSpecRepo:void 0})}};var q1u=require("fs/promises");Rt();Vt();zre();var HA=_e(foe(),1),V1u=require("fs/promises"),bst=class{context;constructor(t){this.context=t.context}async adapt(t){return{raw:this.buildRaw(t),name:t.image,version:t.version,config:t.config,language:this.mapLanguage(t.lang),outputMode:await this.buildOutputMode(t),absolutePathToLocalOutput:this.context.resolveOutputFilePath(t.output.path),smartCasing:t.smartCasing??!0,readme:this.buildReadme(t),absolutePathToLocalSnippets:void 0,disableExamples:!1,irVersionOverride:void 0,keywords:void 0,publishMetadata:void 0,settings:void 0}}buildRaw(t){let r=t.output.git;if(!(r==null||!oE.isGitOutputSelfHosted(r)))return{name:t.image,version:t.version,github:{uri:r.uri,token:r.token,mode:this.mapSelfHostedMode(r.mode),branch:r.branch}}}mapSelfHostedMode(t){if(t==null)return bn.GithubSelfhostedMode.PullRequest;switch(t){case"pr":return bn.GithubSelfhostedMode.PullRequest;case"push":return bn.GithubSelfhostedMode.Push;default:xe(t)}}async buildOutputMode(t){if(t.output.git!=null){let r=t.output.git;return oE.isGitOutputSelfHosted(r)?await this.buildGitSelfHostedOutputMode({target:t,git:r}):await this.buildGitHubRepositoryOutputMode({target:t,git:r})}return HA.FernFiddle.remoteGen.OutputMode.downloadFiles({})}async buildGitHubRepositoryOutputMode({target:t,git:r}){let n=qO(r.repository),i=r.license!=null?await this.convertLicense(r.license):void 0,o=t.publish!=null?this.buildPublishInfo(t.publish):void 0,s=this.buildReviewers(r.reviewers),a=r.mode??"pr";switch(a){case"pr":return HA.FernFiddle.remoteGen.OutputMode.githubV2(HA.FernFiddle.GithubOutputModeV2.pullRequest({owner:n.owner,repo:n.repo,license:i,publishInfo:o,reviewers:s,downloadSnippets:void 0}));case"release":return HA.FernFiddle.remoteGen.OutputMode.githubV2(HA.FernFiddle.GithubOutputModeV2.commitAndRelease({owner:n.owner,repo:n.repo,license:i,publishInfo:o,downloadSnippets:void 0}));case"push":return HA.FernFiddle.remoteGen.OutputMode.githubV2(HA.FernFiddle.GithubOutputModeV2.push({owner:n.owner,repo:n.repo,branch:r.branch,license:i,publishInfo:o,downloadSnippets:void 0}));default:xe(a)}}async buildGitSelfHostedOutputMode({target:t,git:r}){let n=qO(r.uri),i=r.license!=null?await this.convertLicense(r.license):void 0,o=t.publish!=null?this.buildPublishInfo(t.publish):void 0,s=r.mode??"pr";switch(s){case"pr":return HA.FernFiddle.remoteGen.OutputMode.githubV2(HA.FernFiddle.GithubOutputModeV2.pullRequest({owner:n.owner,repo:n.repo,branch:r.branch,license:i,publishInfo:o}));case"push":return HA.FernFiddle.remoteGen.OutputMode.githubV2(HA.FernFiddle.GithubOutputModeV2.push({owner:n.owner,repo:n.repo,branch:r.branch,license:i,publishInfo:o}));default:xe(s)}}buildPublishInfo(t){if(t.npm!=null)return this.buildNpmPublishInfo(t.npm);if(t.pypi!=null)return this.buildPypiPublishInfo(t.pypi);if(t.maven!=null)return this.buildMavenPublishInfo(t.maven);if(t.nuget!=null)return this.buildNugetPublishInfo(t.nuget);if(t.rubygems!=null)return this.buildRubygemsPublishInfo(t.rubygems);if(t.crates!=null)return this.buildCratesPublishInfo(t.crates)}buildNpmPublishInfo(t){return HA.FernFiddle.GithubPublishInfo.npm({registryUrl:t.url??"https://registry.npmjs.org",packageName:t.packageName,token:t.token})}buildPypiPublishInfo(t){return HA.FernFiddle.GithubPublishInfo.pypi({registryUrl:t.url??"https://upload.pypi.org/legacy/",packageName:t.packageName,credentials:t.token!=null?{username:"__token__",password:t.token}:t.username!=null&&t.password!=null?{username:t.username,password:t.password}:void 0,pypiMetadata:t.metadata!=null?{keywords:t.metadata.keywords,documentationLink:t.metadata.documentationLink,homepageLink:t.metadata.homepageLink}:void 0})}buildMavenPublishInfo(t){return HA.FernFiddle.GithubPublishInfo.maven({registryUrl:t.url??"https://s01.oss.sonatype.org/content/repositories/releases/",coordinate:t.coordinate,credentials:t.username!=null&&t.password!=null?{username:t.username,password:t.password}:void 0,signature:t.signature!=null?{keyId:t.signature.keyId,password:t.signature.password,secretKey:t.signature.secretKey}:void 0})}buildNugetPublishInfo(t){return HA.FernFiddle.GithubPublishInfo.nuget({registryUrl:t.url??"https://nuget.org/",packageName:t.packageName,apiKey:t.apiKey})}buildRubygemsPublishInfo(t){return HA.FernFiddle.GithubPublishInfo.rubygems({registryUrl:t.url??"https://rubygems.org/",packageName:t.packageName,apiKey:t.apiKey})}buildCratesPublishInfo(t){return HA.FernFiddle.GithubPublishInfo.crates({registryUrl:t.url??"https://crates.io/api/v1/crates",packageName:t.packageName,token:t.token})}buildReviewers(t){if(t==null)return;let r=[];if(t.teams!=null)for(let n of t.teams)r.push(HA.FernFiddle.GithubPullRequestReviewer.team({name:n}));if(t.users!=null)for(let n of t.users)r.push(HA.FernFiddle.GithubPullRequestReviewer.user({name:n}));return r.length>0?r:void 0}async convertLicense(t){if(t==="MIT")return HA.FernFiddle.GithubLicense.basic({id:HA.FernFiddle.GithubLicenseId.Mit});if(t==="Apache-2.0")return HA.FernFiddle.GithubLicense.basic({id:HA.FernFiddle.GithubLicenseId.Apache});let r=We(this.context.cwd,Se.of(t));if(!await Xt(r,"file"))throw new Error(`Custom license file "${r}" does not exist; did you mean to use either MIT or Apache-2.0?`);let n=await(0,V1u.readFile)(r,"utf-8");return HA.FernFiddle.GithubLicense.custom({contents:n})}buildReadme(t){let r=t.readme;if(r==null)return;let n={};return r.bannerLink!=null&&(n.bannerLink=r.bannerLink),r.introduction!=null&&(n.introduction=r.introduction),r.apiReferenceLink!=null&&(n.apiReferenceLink=r.apiReferenceLink),r.apiName!=null&&(n.apiName=r.apiName),r.disabledSections!=null&&(n.disabledSections=r.disabledSections),r.defaultEndpoint!=null&&(n.defaultEndpoint=r.defaultEndpoint),r.features!=null&&(n.features=r.features),r.customSections!=null&&(n.customSections=r.customSections.map(i=>({title:i.title,language:i.language??t.lang,content:i.content}))),r.exampleStyle!=null&&(n.exampleStyle=r.exampleStyle),n}mapLanguage(t){return{typescript:bn.GenerationLanguage.TYPESCRIPT,python:bn.GenerationLanguage.PYTHON,java:bn.GenerationLanguage.JAVA,go:bn.GenerationLanguage.GO,ruby:bn.GenerationLanguage.RUBY,csharp:bn.GenerationLanguage.CSHARP,swift:bn.GenerationLanguage.SWIFT,php:bn.GenerationLanguage.PHP,rust:bn.GenerationLanguage.RUST}[t.toLowerCase()]}};Vt();var nOn=require("path");function iOn({context:e,task:t,target:r,preview:n,outputPath:i}){if(n)return[(i!=null?(0,nOn.resolve)(e.cwd,i):(0,nOn.join)(e.cwd,Se.of(".fern/preview"))).toString()];let o=jum(t);if(o!=null){if(o.pullRequestUrl!=null)return[o.pullRequestUrl];if(o.releaseUrl!=null)return[o.releaseUrl];if(o.branchUrl!=null)return[o.branchUrl]}return e.resolveTargetOutputs(r)}function jum(e){let t={};for(let r of e.logs??[]){let n=r.message.match(/Created pull request: (.+)/);n!=null&&(t.pullRequestUrl=n[1]);let i=r.message.match(/Created commit (\w+)/);i!=null&&(t.commitHash=i[1]);let o=r.message.match(/Pushed branch: (.+)/);o!=null&&(t.branchUrl=o[1]);let s=r.message.match(/Release tagged\. View here: (.+)/);s!=null&&(t.releaseUrl=s[1])}return Object.keys(t).length>0?t:void 0}var oOn=class{context;cliVersion;invocationAdapter;constructor(t){this.context=t.context,this.cliVersion=t.cliVersion,this.invocationAdapter=new bst({context:this.context})}async run(t){let r=new ih({context:this.context,task:t.task,logLevel:zn.Info});try{let n=await this.invocationAdapter.adapt(t.target),i={groupName:t.target.name,audiences:t.audiences??{type:"all"},generators:[n],reviewers:void 0},s=await new QEe({context:this.context,cliVersion:this.cliVersion,task:t.task}).adapt(t.apiDefinition);return t.target.output.git!=null&&oE.isGitOutputSelfHosted(t.target.output.git)?await this.runSelfHostedGeneration({args:t,taskContext:r,fernWorkspace:s,generatorGroup:i}):await this.runLocalGeneration({args:t,taskContext:r,fernWorkspace:s,generatorGroup:i,generatorInvocation:n})}catch(n){return r.getResult()===Pp.Failure?{success:!1}:{success:!1,error:n instanceof Error?n.message:String(n)}}}async runSelfHostedGeneration({args:t,taskContext:r,fernWorkspace:n,generatorGroup:i}){let o={_absolutePath:We(this.context.cwd,Se.of("fern.config.json")),rawConfig:{organization:t.organization,version:this.cliVersion},organization:t.organization,version:this.cliVersion};return await rOn({token:t.token,projectConfig:o,workspace:n,generatorGroup:i,version:t.version,keepDocker:t.keepContainer??!1,context:r,runner:t.containerEngine,absolutePathToPreview:void 0,inspect:!1,ai:void 0}),r.getResult()===Pp.Failure?{success:!1}:{success:!0,output:iOn({context:this.context,task:t.task,target:t.target,preview:t.preview,outputPath:t.outputPath})}}async runLocalGeneration({args:t,taskContext:r,fernWorkspace:n,generatorGroup:i,generatorInvocation:o}){let s=`${t.target.image}:${t.target.version}`,a=new pRe({containerImage:s,keepContainer:t.keepContainer??!1,runner:t.containerEngine});if(await new pDt(a).run({organization:t.organization,workspace:n,generatorGroup:i,context:r,outputVersionOverride:t.version,ai:t.ai,absolutePathToFernConfig:void 0,irVersionOverride:void 0,shouldGenerateDynamicSnippetTests:!1,skipUnstableDynamicSnippetTests:!0,inspect:!1}),t.target.output.path!=null&&o.absolutePathToLocalOutput!=null){let c=We(o.absolutePathToLocalOutput,Se.of(pqt));await(0,q1u.rm)(c,{force:!0})}return r.getResult()===Pp.Failure?{success:!1}:{success:!0,output:this.context.resolveTargetOutputs(t.target)}}};Vt();var xke=require("fs/promises"),G1u=require("os");var sOn=class{context;cliVersion;invocationAdapter;constructor(t){this.context=t.context,this.cliVersion=t.cliVersion,this.invocationAdapter=new bst({context:this.context})}async run(t){let r=new ih({context:this.context,task:t.task,logLevel:zn.Info});try{let n=await this.invocationAdapter.adapt(t.target),i={groupName:t.target.name,audiences:t.audiences??{type:"all"},generators:[n],reviewers:void 0},s=await new QEe({context:this.context,cliVersion:this.cliVersion,task:t.task}).adapt(t.apiDefinition),a=await this.getAbsolutePathToPreview(t);if(await YBt({projectConfig:this.getProjectConfig(t),organization:t.organization,workspace:s,context:r,generatorGroup:i,version:t.version,shouldLogS3Url:t.shouldLogS3Url??!1,token:t.token,mode:this.mapMode(t.target),fernignorePath:t.fernignorePath,absolutePathToPreview:a,whitelabel:void 0,dynamicIrOnly:!1,retryRateLimited:!1}),this.isLocalGitCombo(t)&&a!=null){let u=K1(n.name),c=We(a,Se.of(u)),l=n.absolutePathToLocalOutput;l!=null&&(await(0,xke.cp)(c,l,{recursive:!0}),await(0,xke.rm)(We(l,Se.of(".git")),{recursive:!0,force:!0})),await(0,xke.rm)(a,{recursive:!0,force:!0})}return r.getResult()===Pp.Failure?{success:!1}:{success:!0,output:iOn({context:this.context,task:t.task,target:t.target,preview:t.preview,outputPath:t.outputPath})}}catch(n){return r.getResult()===Pp.Failure?{success:!1}:{success:!1,error:n instanceof Error?n.message:String(n)}}}async getAbsolutePathToPreview(t){if(this.isLocalGitCombo(t)){let r=await(0,xke.mkdtemp)(We(Ut.of((0,G1u.tmpdir)()),Se.of("fern-preview-")));return Ut.of(r)}if(t.preview)return t.outputPath!=null?Yi(this.context.cwd,t.outputPath):We(this.context.cwd,Se.of(".fern/preview"))}getProjectConfig(t){return{_absolutePath:We(this.context.cwd,Se.of("fern.config.json")),rawConfig:{organization:t.organization,version:this.cliVersion},organization:t.organization,version:this.cliVersion}}mapMode(t){if(t.output.git!=null)return t.output.git.mode==="pr"?"pull-request":void 0}isLocalGitCombo(t){return t.target.output.path!=null&&t.target.output.git!=null&&!t.preview}};var aOn=class{context;cliVersion;constructor(t){this.context=t.context,this.cliVersion=t.cliVersion}async run(t){try{return this.isLocalGeneration(t)?await this.runLocalGeneration(t):await this.runRemoteGeneration(t)}catch(r){let n=r instanceof Error?r.message:String(r);return{success:!1,target:t.target,error:n}}}async runLocalGeneration(t){let n=await new oOn({context:this.context,cliVersion:this.cliVersion}).run({task:t.task,target:t.target,apiDefinition:t.apiDefinition,organization:t.organization,ai:t.ai,audiences:t.audiences,version:t.version,keepContainer:t.keepContainer,preview:t.preview,outputPath:t.outputPath,containerEngine:t.containerEngine,token:t.token});return n.success?{success:!0,target:t.target,output:n.output}:{success:!1,target:t.target,error:n.error}}async runRemoteGeneration(t){if(t.token==null)throw Kr.authRequired();let n=await new sOn({context:this.context,cliVersion:this.cliVersion}).run({target:t.target,apiDefinition:t.apiDefinition,organization:t.organization,token:t.token,task:t.task,ai:t.ai,audiences:t.audiences,version:t.version,shouldLogS3Url:t.shouldLogS3Url,preview:t.preview,outputPath:t.outputPath,fernignorePath:t.fernignorePath});return n.success?{success:!0,target:t.target,output:n.output}:{success:!1,target:t.target,error:n.error}}isLocalGeneration(t){return t.runtime==="local"||t.target.output.git!=null&&oE.isGitOutputSelfHosted(t.target.output.git)}};var uOn=class{id;taskGroup;stage;constructor({id:t,taskGroup:r}){this.id=t,this.taskGroup=r,this.stage={validation:new Fae({taskId:t,taskGroup:r,stageId:"validation"}),generator:new Fae({taskId:t,taskGroup:r,stageId:"generator"}),output:new Fae({taskId:t,taskGroup:r,stageId:"output"})}}getTask(){let t=this.taskGroup.getTask(this.id);if(t==null)throw new Error(`Internal error; task '${this.id}' does not exist`);return t}start(t){this.taskGroup.updateTask({id:this.id,update:{status:"running",currentStep:t}})}complete(t){this.taskGroup.updateTask({id:this.id,update:{status:"success",output:t}})}fail(t){this.taskGroup.updateTask({id:this.id,update:{status:"error",error:t}})}};var cOn=class{taskGroup;tasks={};defaultStages=[{id:"validation",labels:{pending:"Validate API",running:"Validating API...",success:"Validated API"}},{id:"generator",labels:{pending:"Run generator",running:"Running generator...",success:"Generator completed"}},{id:"output",labels:{pending:"Write output",running:"Writing output...",success:"Wrote output"}}];constructor({context:t}){this.tasks={},this.taskGroup=new Ant({context:t})}addTask({id:t,name:r,stageOverrides:n}){let i=r??t;this.taskGroup.addTask({id:t,name:i});let o=this.buildStages(n);this.taskGroup.setStages(t,o);let s=new uOn({taskGroup:this.taskGroup,id:t});return this.tasks[t]=s,s}getTask(t){return this.tasks[t]}async start(t){await this.taskGroup.start(t)}finish({successMessage:t,errorMessage:r}){return this.taskGroup.complete({successMessage:t,errorMessage:r})}buildStages(t){return t==null?this.defaultStages:this.defaultStages.map(r=>{let n=t[r.id];return n==null?r:{...r,labels:{...r.labels,...n}}})}};Vt();var lOn=class{context;constructor({context:t}){this.context=t}async build({org:t,lang:r,resolvedSpec:n,output:i,targetVersion:o}){let s=cIr({lang:r,version:o}),a=Se.of(ha(this.context.cwd,n.absoluteFilePath)),u=new uL({absoluteFilePath:n.absoluteFilePath,relativeFilePath:a,line:1,column:1}),c={name:r,api:sGe,image:s.image,lang:r,version:s.tag,sourceLocation:u,output:oE.resolveOutputObjectSchema(i)};return{apis:{[sGe]:{specs:[n.spec]}},cliVersion:"*",org:t,sdks:{org:t,targets:[c]}}}};var fDt=class{async handle(t,r){let n=await t.loadWorkspace();if(n==null)return this.handleWithFlags(t,r);if(!n.success)throw new W4(n.issues);return this.handleWithWorkspace(t,n.workspace,r)}async handleWithWorkspace(t,r,n){let i=r;if(n.api!=null){let a=await new oOt({context:t}).resolve({reference:n.api}),u={};for(let c of Object.keys(i.apis))u[c]={specs:[a.spec]};i={...i,apis:u}}n.org!=null&&(i={...i,org:n.org});let o=this.getTargets({workspace:i,args:n,groupName:n.target!=null?void 0:n.group??i.sdks?.defaultGroup});this.validateArgs({workspace:i,args:n,targets:o}),await this.runGeneration({context:t,workspace:i,targets:o,args:n,forceLocal:!1})}async handleWithFlags(t,r){let n=[];if(r.api==null&&n.push("--api <path|url> Path or URL to an API spec file (e.g. ./openapi.yaml)"),r.target==null&&n.push("--target <language> The SDK language to generate (e.g. typescript)"),r.org==null&&n.push("--org <name> Your organization name (e.g. acme)"),r.output==null&&n.push("--output <path|url> Output path or git URL (e.g. ./my-sdk)"),r.group!=null&&n.push("remove --group Groups are not supported without a fern.yml"),n.length>0)throw new Kr({message:`No fern.yml found, either run 'fern init' or specify all of the required flags:
|
|
3313
3313
|
|
|
3314
3314
|
`+n.map(f=>` ${f}`).join(`
|
|
3315
3315
|
`)});let i=r.api,o=r.target,s=r.org,a=r.output,c=await new oOt({context:t}).resolve({reference:i}),p=await new lOn({context:t}).build({org:s,lang:this.resolveLanguage(o),resolvedSpec:c,output:this.parseTargetOutput({...r,output:a}),targetVersion:r["target-version"]}),d=p.sdks?.targets??[];await this.runGeneration({context:t,workspace:p,targets:d,args:r,forceLocal:!0})}async runGeneration({context:t,workspace:r,targets:n,args:i,forceLocal:o}){if(r.sdks==null)throw new Error("No SDKs configured");let s=[...new Set(n.map(A=>A.api))],u=await new UH({context:t,cliVersion:r.cliVersion}).check({workspace:r,apiNames:s});if(u.violations.length>0)for(let A of u.violations)process.stderr.write(`${be.red(`${A.displayRelativeFilepath}:${A.line}:${A.column}: ${A.message}`)}
|
|
@@ -3596,7 +3596,7 @@ For (2), check out our guide on configuring puppeteer at https://pptr.dev/guides
|
|
|
3596
3596
|
Run ${be.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
|
|
3597
3597
|
Run ${be.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),W9e(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function zbo({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!R3u(e))return;let i=t??"",o=e.filter(a=>a.isUpgradeAvailable);r!=null&&(o=o.slice(0,r+1));let s=o.sort((a,u)=>a.generatorName.localeCompare(u.generatorName)||a.currentVersion.localeCompare(u.currentVersion));for(let a of s)i+=`
|
|
3598
3598
|
${await oOm(a.generatorName)} (${a.apiName!=null?"API: "+a.apiName+", ":""}Group: ${a.generatorGroup}) `+be.dim(a.currentVersion)+be.reset(" \u2192 ")+be.green(a.latestVersion);return i+=`
|
|
3599
|
-
`,n?W9e(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function oOm(e){let r=await new D3u.FernRegistryClient({environment:"https://registry.buildwithfern.com"}).generators.getGeneratorByImage({dockerImage:e});if(!r.ok||r.body==null)throw new Error(`Generator ${e} not found`);return r.body.displayName}async function sOm({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){if(t.length===1){let a={type:"singleApi",versions:{}};return await k3u({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(u,c,l,p)=>{a.versions[c]==null&&(a.versions[c]={});let d=lBe(l.name);if(d==null){p.logger.debug(`Skipping unknown generator: ${l.name}`);return}let f=await jS({generatorName:d,cliVersion:e.environment.packageVersion,currentGeneratorVersion:l.version,channel:i,includeMajor:o,context:p});f!=null&&(a.versions[c][l.name]={previousVersion:l.version,latestVersion:f})},generatorFilter:r,groupFilter:n}),a}let s={type:"multiApi",versions:{}};return await k3u({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(a,u,c,l)=>{if(a==null)return;s.versions[a]==null&&(s.versions[a]={}),s.versions[a][u]==null&&(s.versions[a][u]={});let p=lBe(c.name);if(p==null){l.logger.debug(`Skipping unknown generator: ${c.name}`);return}let d=await jS({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:c.version,channel:i,includeMajor:o,context:l});d!=null&&(s.versions[a][u][c.name]={previousVersion:c.version,latestVersion:d})},generatorFilter:r,groupFilter:n}),s}async function k3u({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async o=>{await e.runTaskForWorkspace(o,async s=>{let a=await bQ({absolutePathToWorkspace:o.absoluteFilePath,context:s});if(a==null||a.groups==null)return;let u=n!=null?sC(n):void 0;for(let c of a.groups)if(!(i!=null&&c.groupName!==i))for(let l of c.generators)u!=null&&l.name!==u||await r(o.workspaceName,c.groupName,l,s)})}))}function Q3u(e,t,r){let n=[];for(let[i,o]of Object.entries(e))for(let[s,a]of Object.entries(o)){r.debug(`Checking if ${s} in group ${i} has an upgrade available...`);let u=XR(a.latestVersion,a.previousVersion);r.debug(`Latest version: ${a.latestVersion}. `+(u?"Upgrade available.":"No upgrade available.")),n.push({generatorName:s,generatorGroup:i,apiName:t,isUpgradeAvailable:u,currentVersion:a.previousVersion,latestVersion:a.latestVersion})}return n}async function o2n({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let s=[];if(e!=null){let a=await sOm({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o});if(a.type==="multiApi")for(let[u,c]of Object.entries(a.versions))s.push(...Q3u(c,u,t.logger));else s.push(...Q3u(a.versions,void 0,t.logger))}return s}async function oce({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:Sdt(e.packageName,{version:t?"prerelease":"latest"})}var N3u=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],s2n=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=zn.Info;isLocal;stdoutRedirector=new i2n;jsonMode=!1;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new pOe(t,r),this.isLocal=n??!1;let i=this.getPackageName(),o=this.getPackageVersion(),s=this.getCliName();(i==null||o==null||s==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:o,cliName:s}}getPackageName(){return"fern-api"}getPackageVersion(){return"4.
|
|
3599
|
+
`,n?W9e(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function oOm(e){let r=await new D3u.FernRegistryClient({environment:"https://registry.buildwithfern.com"}).generators.getGeneratorByImage({dockerImage:e});if(!r.ok||r.body==null)throw new Error(`Generator ${e} not found`);return r.body.displayName}async function sOm({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){if(t.length===1){let a={type:"singleApi",versions:{}};return await k3u({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(u,c,l,p)=>{a.versions[c]==null&&(a.versions[c]={});let d=lBe(l.name);if(d==null){p.logger.debug(`Skipping unknown generator: ${l.name}`);return}let f=await jS({generatorName:d,cliVersion:e.environment.packageVersion,currentGeneratorVersion:l.version,channel:i,includeMajor:o,context:p});f!=null&&(a.versions[c][l.name]={previousVersion:l.version,latestVersion:f})},generatorFilter:r,groupFilter:n}),a}let s={type:"multiApi",versions:{}};return await k3u({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(a,u,c,l)=>{if(a==null)return;s.versions[a]==null&&(s.versions[a]={}),s.versions[a][u]==null&&(s.versions[a][u]={});let p=lBe(c.name);if(p==null){l.logger.debug(`Skipping unknown generator: ${c.name}`);return}let d=await jS({generatorName:p,cliVersion:e.environment.packageVersion,currentGeneratorVersion:c.version,channel:i,includeMajor:o,context:l});d!=null&&(s.versions[a][u][c.name]={previousVersion:c.version,latestVersion:d})},generatorFilter:r,groupFilter:n}),s}async function k3u({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async o=>{await e.runTaskForWorkspace(o,async s=>{let a=await bQ({absolutePathToWorkspace:o.absoluteFilePath,context:s});if(a==null||a.groups==null)return;let u=n!=null?sC(n):void 0;for(let c of a.groups)if(!(i!=null&&c.groupName!==i))for(let l of c.generators)u!=null&&l.name!==u||await r(o.workspaceName,c.groupName,l,s)})}))}function Q3u(e,t,r){let n=[];for(let[i,o]of Object.entries(e))for(let[s,a]of Object.entries(o)){r.debug(`Checking if ${s} in group ${i} has an upgrade available...`);let u=XR(a.latestVersion,a.previousVersion);r.debug(`Latest version: ${a.latestVersion}. `+(u?"Upgrade available.":"No upgrade available.")),n.push({generatorName:s,generatorGroup:i,apiName:t,isUpgradeAvailable:u,currentVersion:a.previousVersion,latestVersion:a.latestVersion})}return n}async function o2n({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o}){let s=[];if(e!=null){let a=await sOm({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:o});if(a.type==="multiApi")for(let[u,c]of Object.entries(a.versions))s.push(...Q3u(c,u,t.logger));else s.push(...Q3u(a.versions,void 0,t.logger))}return s}async function oce({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:Sdt(e.packageName,{version:t?"prerelease":"latest"})}var N3u=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],s2n=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=zn.Info;isLocal;stdoutRedirector=new i2n;jsonMode=!1;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new pOe(t,r),this.isLocal=n??!1;let i=this.getPackageName(),o=this.getPackageVersion(),s=this.getCliName();(i==null||o==null||s==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:o,cliName:s}}getPackageName(){return"fern-api"}getPackageVersion(){return"4.33.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logFernVersionDebug(){this.logger.debug(`Running ${be.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new pm}failWithoutThrowing(t,r){this.didSucceed=!1,gEt({message:t,error:r,logger:this.logger})}enableJsonMode(){this.jsonMode||(this.jsonMode=!0,this.stdoutRedirector.redirect())}get isJsonMode(){return this.jsonMode}writeJsonToStdout(t){this.stdoutRedirector.restore(),process.stdout.write(JSON.stringify(t,null,2)+`
|
|
3600
3600
|
`),this.jsonMode&&this.stdoutRedirector.redirect()}async exit({code:t}={}){!this._suppressUpgradeMessage&&!this.isLocal&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await G9e()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await F3u({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
3601
3601
|
`)||(r+=`
|
|
3602
3602
|
`),this.stderr.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram({code:t}={}){process.exit(t??(this.didSucceed?0:1))}longestWorkspaceName;registerWorkspaces(t){let r=jLn(t.map(n=>n.type==="docs"?"docs":n.workspaceName??"api"),n=>n.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new qFt(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let n=this.addTaskWithInit(t).start(),i;try{i=await r(n)}catch(o){throw o.message.includes("globalThis")?(n.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),n.failWithoutThrowing()):n.failWithoutThrowing(void 0,o),new pm}finally{n.finish()}return i}async instrumentPostHogEvent(t){this.isLocal||(await G9e()).sendEvent(t)}logger=aP((t,...r)=>this.log(t,...r));stderr=aP((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=j3u(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?j3u(this.longestWorkspaceName):r).length,i=r.padEnd(n),o=N3u[this.numTasks++%N3u.length],s=be.hex(o)(i);return{...this.constructTaskInit(),logPrefix:s}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===Pp.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let n=t.filter(i=>E_.indexOf(i.level)>=E_.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===zn.Debug,stderr:r||this.jsonMode})}_suppressUpgradeMessage=!1;suppressUpgradeMessage(){this._suppressUpgradeMessage=!0}_isUpgradeAvailable;async isUpgradeAvailable({includePreReleases:t=!1}={}){if(this._isUpgradeAvailable==null){this.logger.debug(`Checking if ${this.environment.packageName} upgrade is available...`);let r=await oce({cliEnvironment:this.environment,includePreReleases:t}),n=XR(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},o=await o2n({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:o}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){try{return await Lbo({message:t,choices:[{name:"No",value:!1},{name:"Yes",value:!0}],default:r,theme:{prefix:be.yellow("?"),style:{answer:i=>be.cyan(i),message:i=>be.bold(i),highlight:i=>be.cyan(i)}}})}catch(n){throw n?.name==="ExitPromptError"?(this.logger.info(`
|