fern-api 0.57.14 → 0.57.15
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 +3 -3
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -1701,7 +1701,7 @@ ${c.indent}`:""}${HQf(o)}:${l.indent?" ":""}`;return u=!1,s=!0,l.objectItem=void
|
|
|
1701
1701
|
`}),r.replaceAll(/\n$/g,"")}function Q5S(e){return e?eh.green(j7.radioOn):j7.radioOff}var Pmo=di(USe(),1);function Kup(e,t){return e=String(e),t=typeof t=="string"?t:"*",e.length===0?"":Array.from({length:e.length+1}).join(t)}var Aca=class extends C2{_run(t){this.done=t;let r=_V(this.rl),i=r.line.pipe((0,Pmo.map)(this.filterInput.bind(this))),n=this.handleSubmitEvents(i);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),r.keypress.pipe((0,Pmo.takeUntil)(n.success)).forEach(this.onKeypress.bind(this)),this.render(),this}render(t){let r=this.getQuestion(),i="";r+=this.status==="answered"?this.getMaskedValue(this.answer):this.getMaskedValue(this.rl.line||""),t&&(i=`
|
|
1702
1702
|
`+eh.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?eh.cyan(Kup(t,this.opt.mask)):eh.italic.dim("[hidden]"):this.opt.mask?Kup(t,this.opt.mask):eh.italic.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 gcp=di(Fxs(),1),Ocp=di(USe(),1);var Fca=class extends C2{_run(t){this.done=t,this.editorResult=new Ocp.Subject;let r=_V(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let i=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,n=this.handleSubmitEvents(this.editorResult);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,i?this.render():this.startExternalEditor(),this}render(t){let r="",i=this.getQuestion();i+=this.status==="answered"?eh.dim("Received"):eh.dim("Press <enter> to launch your preferred editor."),t&&(r=eh.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),(0,gcp.editAsync)(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 tlp=di(Ycp(),1);var kcp=di(require("readline"),1),elp=di(Zcp(),1),ZIi=class{constructor(t){this.rl||=kcp.default.createInterface(cLS(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 cLS(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let n=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw n.isTtyError=!0,n}let r=new elp.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var Vca=class extends ZIi{constructor(t={}){super(t),this.log=(0,tlp.default)(this.writeLog.bind(this)),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return mca(this.rl,this.bottomBar.split(`
|
|
1703
1703
|
`).length),this}updateBottomBar(t){return mca(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+`
|
|
1704
|
-
`}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&&bmo(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var flp=di(nlp(),1),dlp=di(QCs(),1),plp=di(clp(),1),YA=di(USe(),1),_lp=di(qsa(),1);var Qmo=di(USe(),1),llp=di(qsa(),1),Jmo=function(e,t,r){return typeof e[t]!="function"?(0,Qmo.of)(e):(0,Qmo.from)((0,llp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var Wca={isPlainObject:flp.default,set:plp.default,get:dlp.default},Zmn=class extends ZIi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=Wca.isPlainObject(r)?{...r}:{},Wca.isPlainObject(t)&&(t=Object.values(t).every(n=>Wca.isPlainObject(n)&&n.name===void 0)?Object.entries(t).map(([n,a])=>({name:n,...a})):[t]);let i=Array.isArray(t)?(0,YA.from)(t):t;return this.process=i.pipe((0,YA.concatMap)(this.processQuestion.bind(this)),(0,YA.publish)()),this.process.connect(),this.process.pipe((0,YA.reduce)((n,a)=>(Wca.set(n,a.name,a.answer),n),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,YA.defer)(()=>(0,YA.of)(t).pipe((0,YA.concatMap)(this.setDefaultType.bind(this)),(0,YA.concatMap)(this.filterIfRunnable.bind(this)),(0,YA.concatMap)(()=>Jmo(t,"message",this.answers)),(0,YA.concatMap)(()=>Jmo(t,"default",this.answers)),(0,YA.concatMap)(()=>Jmo(t,"choices",this.answers)),(0,YA.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,YA.defer)(()=>(0,YA.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,YA.defer)(()=>(0,YA.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&Wca.get(this.answers,t.name)!==void 0)return(0,YA.empty)();if(t.when===!1)return(0,YA.empty)();if(typeof t.when!="function")return(0,YA.of)(t);let{answers:r}=this;return(0,YA.defer)(()=>(0,YA.from)((0,_lp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,YA.filter)(i=>i!=null)))}};function hlp(e){let t=function(r,i){let n;try{n=new Zmn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",jca),this.registerPrompt("input",VIi),this.registerPrompt("number",wca),this.registerPrompt("confirm",Sca),this.registerPrompt("rawlist",Dca),this.registerPrompt("expand",Eca),this.registerPrompt("checkbox",Mca),this.registerPrompt("password",Aca),this.registerPrompt("editor",Fca)},t.restoreDefaultPrompts(),t}var Kxs=hlp();function ELS(e,t){Kxs.registerPrompt(e,t)}function MLS(){Kxs.restoreDefaultPrompts()}var ALS={prompt:Kxs,ui:{BottomBar:Vca,Prompt:Zmn},createPromptModule:hlp,registerPrompt:ELS,restoreDefaultPrompts:MLS,Separator:Eie},Kmo=ALS;var Sfp=di(ylp()),rWS="4.2.1",b5t;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",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"})(b5t||(b5t={}));function iWS(e,t){if(!e)throw new Error(t)}function nWS(e){return e?.replace(/\/+$/,"")}async function aWS(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(n=>setTimeout(n,t.retryDelay));try{return await e()}catch(n){if(r=n,!t.retryCheck(n))throw n}}throw r}function oWS(){return new Date().getTime()}function vfp(){return new Date().toISOString()}function Dfp(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var ela=String.fromCharCode,bfp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",lPo={};function uWS(e,t){if(!lPo[e]){lPo[e]={};for(let r=0;r<e.length;r++)lPo[e][e.charAt(r)]=r}return lPo[e][t]}var tla={compressToBase64:function(e){if(e==null)return"";let t=tla._compress(e,6,function(r){return bfp.charAt(r)});switch(t.length%4){default:case 0:return t;case 1:return t+"===";case 2:return t+"==";case 3:return t+"="}},decompressFromBase64:function(e){return e==null?"":e==""?null:tla._decompress(e.length,32,function(t){return uWS(bfp,e.charAt(t))})},compress:function(e){return tla._compress(e,16,function(t){return ela(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,l,d="",s="",o="",c=2,b=3,g=2,O=0,m=0,P;for(P=0;P<e.length;P+=1)if(d=e.charAt(P),Object.prototype.hasOwnProperty.call(i,d)||(i[d]=b++,n[d]=!0),s=o+d,Object.prototype.hasOwnProperty.call(i,s))o=s;else{if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++),i[s]=b++,o=String(d)}if(o!==""){if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++)}for(l=2,u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;for(;;)if(O=O<<1,m==t-1){a.push(r(O));break}else m++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:tla._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let i=[],n=[],a={val:r(0),position:t,index:1},u=4,l=4,d=3,s="",o,c,b,g,O,m,P;for(o=0;o<3;o+=1)i[o]=o;for(b=0,O=Math.pow(2,2),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;P=ela(b);break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;P=ela(b);break;case 2:return""}for(i[3]=P,c=P,n.push(P);;){if(a.index>e)return"";for(b=0,O=Math.pow(2,d),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(P=b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=ela(b),P=l-1,u--;break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=ela(b),P=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,d),d++),i[P])s=i[P];else if(P===l)s=c+c.charAt(0);else return null;n.push(s),i[l++]=c+s.charAt(0),u--,c=s,u==0&&(u=Math.pow(2,d),d++)}}},BIs=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(i=>i!==r)}}emit(t,r){for(let i of this.events[t]||[])i(r);for(let i of this.events["*"]||[])i(t,r)}};var fPo="0123456789abcdef",dPo=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,i,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||t<0||r<0||i<0||n<0||t>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=n>>>24,a[13]=n>>>16,a[14]=n>>>8,a[15]=n,new e(a)}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}if(r){let i=new Uint8Array(16);for(let n=0;n<16;n+=4){let a=parseInt(r.substring(2*n,2*n+8),16);i[n+0]=a>>>24,i[n+1]=a>>>16,i[n+2]=a>>>8,i[n+3]=a}return new e(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=fPo.charAt(this.bytes[r]>>>4),t+=fPo.charAt(this.bytes[r]&15),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=fPo.charAt(this.bytes[r]>>>4),t+=fPo.charAt(this.bytes[r]&15);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 i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},xIs=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??sWS()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let i=this.generateOrAbortCore(t,r);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(t,r)),i}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)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return dPo.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}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,dPo.ofInner(t)}},sWS=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),gfp,Ofp=()=>cWS().toString(),cWS=()=>(gfp||(gfp=new xIs)).generate(),pPo=class extends Error{constructor(t){super("HTTP error while fetching PostHog: "+t.status),this.response=t,this.name="PostHogFetchHttpError"}},rla=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};function mfp(e){return typeof e=="object"&&(e instanceof pPo||e instanceof rla)}var IIs=class{constructor(t,r){this.flushPromise=null,this.disableGeoip=!0,this.historicalMigration=!1,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new BIs,this._isInitialized=!1,iWS(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=nWS(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.captureMode=r?.captureMode||"json",this.defaultOptIn=r?.defaultOptIn??!0,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:mfp},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??3e3,this.disableGeoip=r?.disableGeoip??!0,this.disabled=r?.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(b5t.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(b5t.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(b5t.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>console.log("PostHog Debug",i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=Ofp();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}groupIdentifyStateless(t,r,i,n,a,u){this.wrap(()=>{let l=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...u||{}}});this.enqueue("capture",l,n)})}async getDecide(t,r={},i={},n={},a={}){await this._initPromise;let u=`${this.host}/decide/?v=3`,l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a})};return this.fetchWithRetry(u,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(d=>d.json()).catch(d=>{this._events.emit("error",d)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0&&(d=!1),d}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).payloads}_parsePayload(t){try{return JSON.parse(t)}catch{return t}}async getFeatureFlagsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).flags}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a){await this._initPromise;let u={};(a??this.disableGeoip)&&(u.geoip_disable=!0);let l=await this.getDecide(t,r,i,n,u),d=l?.featureFlags,s=l?.featureFlagPayloads,o=s;return s&&(o=Object.fromEntries(Object.entries(s).map(([c,b])=>[c,this._parsePayload(b)]))),{flags:d,payloads:o}}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:vfp(),uuid:i?.uuid?i.uuid:Ofp()};(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId);let u=this.getPersistedProperty(b5t.Queue)||[];u.length>=this.maxQueueSize&&(u.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),u.push({message:n}),this.setPersistedProperty(b5t.Queue,u),this._events.emit(t,n),u.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Dfp(()=>this.flushBackground(),this.flushInterval))})}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(()=>{})}async flush(){return this.flushPromise||(this.flushPromise=this._flush().finally(()=>{this.flushPromise=null}),this.addPendingPromise(this.flushPromise)),this.flushPromise}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(b5t.Queue)||[];if(!t.length)return[];let r=t.slice(0,this.maxBatchSize),i=r.map(s=>s.message),n=()=>{let s=this.getPersistedProperty(b5t.Queue)||[];this.setPersistedProperty(b5t.Queue,s.slice(r.length))},a={api_key:this.apiKey,batch:i,sent_at:vfp()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),l=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${oWS()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,d=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(tla.compressToBase64(u))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:u};try{await this.fetchWithRetry(l,d)}catch(s){throw s instanceof rla||n(),this._events.emit("error",s),s}return n(),this._events.emit("flush",i),i}async fetchWithRetry(t,r,i,n){var a;return(a=AbortSignal).timeout??(a.timeout=function(l){let d=new AbortController;return setTimeout(()=>d.abort(),l),d.signal}),await aWS(async()=>{let u=null;try{u=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(d){throw new rla(d)}if(!(r.mode==="no-cors")&&(u.status<200||u.status>=400))throw new pPo(u);return u},{...this._retryOptions,...i})}async shutdown(t=3e4){await this._initPromise,this.clearFlushTimer();try{await Promise.all(Object.values(this.pendingPromises));let r=Date.now()+t;for(;(this.getPersistedProperty(b5t.Queue)||[]).length!==0;){await this.flush();let n=Date.now();if(r<n)break}}catch(r){if(!mfp(r))throw r;this.logMsgIfDebug(()=>console.error("Error while shutting down PostHog",r))}}},zIs=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},RIs=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!RIs){let e=yfp();RIs=async(t,r)=>{let i=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var Efp=RIs,lWS=1152921504606847e3,fWS=["is_not"],_Po=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},B2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},NIs=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...l}){this.debugMode=!1,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=l.fetch||Efp,this.onError=l.onError,this.customHeaders=u,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let u,l;if(!this.loadedSuccessfullyOnce)return u;for(let d of this.featureFlags)if(t===d.key){l=d;break}if(l!==void 0)try{u=this.computeFlagLocally(l,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(d){d instanceof B2?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${d}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return u}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(t,r={},i={},n={}){await this.loadFeatureFlags();let a={},u={},l=this.featureFlags.length==0;return this.featureFlags.map(async d=>{try{let s=this.computeFlagLocally(d,t,r,i,n);a[d.key]=s;let o=await this.computeFeatureFlagPayloadLocally(d.key,s);o&&(u[d.key]=o)}catch(s){s instanceof B2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),l=!0}}),{response:a,payloads:u,fallbackToDecide:l}}computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new B2("Flag has experience continuity enabled");if(!t.active)return!1;let l=(t.filters||{}).aggregation_group_type_index;if(l!=null){let d=this.groupTypeMapping[String(l)];if(!d)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${l} for feature flag ${t.key}`)),new B2("Flag has unknown group type index");if(!(d in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[d];return this.matchFeatureFlagProperties(t,i[d],s)}else return this.matchFeatureFlagProperties(t,r,n)}matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,l,d=[...a].sort((s,o)=>{let c=!!s.variant,b=!!o.variant;return c&&b?0:c?-1:b?1:0});for(let s of d)try{if(this.isConditionMatch(t,r,s,i)){let o=s.variant,c=n.multivariate?.variants||[];o&&c.some(b=>b.key===o)?l=o:l=this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof B2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new B2("Can't determine if feature flag is enabled or not with given properties");return!1}isConditionMatch(t,r,i,n){let a=i.rollout_percentage,u=l=>{this.logMsgIfDebug(()=>console.warn(l))};if((i.properties||[]).length>0){for(let l of i.properties){let d=l.type,s=!1;if(d==="cohort"?s=Afp(l,n,this.cohorts,this.debugMode):s=Mfp(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&Pfp(t.key,r)>a/100)}getMatchingVariant(t,r){let i=Pfp(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(l=>{n=i+l.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:l.key}),i=n}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.pollingInterval);try{let t=await this._requestFeatureFlagDefinitions();if(t&&t.status===401)throw new _Po("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");if(t&&t.status!==200)return;let r=await t.json();"flags"in r||this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`)),this.featureFlags=r.flags||[],this.featureFlagsByKey=this.featureFlags.reduce((i,n)=>(i[n.key]=n,i),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||[],this.loadedSuccessfullyOnce=!0}catch(t){t instanceof _Po&&this.onError?.(t)}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r={method:"GET",headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}},i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=Dfp(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function Pfp(e,t,r=""){let i=(0,Sfp.createHash)();return i.update(`${e}.${t}${r}`),parseInt(i.digest("hex").slice(0,15),16)/lWS}function Mfp(e,t,r){let i=e.key,n=e.value,a=e.operator||"exact";if(i in t){if(a==="is_not_set")throw new B2("Operator is_not_set is not supported")}else throw new B2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!fWS.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function l(s,o){return Array.isArray(s)?s.map(c=>String(c).toLowerCase()).includes(String(o).toLowerCase()):String(s).toLowerCase()===String(o).toLowerCase()}function d(s,o,c){if(c==="gt")return s>o;if(c==="gte")return s>=o;if(c==="lt")return s<o;if(c==="lte")return s<=o;throw new Error(`Invalid operator: ${c}`)}switch(a){case"exact":return l(n,u);case"is_not":return!l(n,u);case"is_set":return i in t;case"icontains":return String(u).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(u).toLowerCase().includes(String(n).toLowerCase());case"regex":return jfp(String(n))&&String(u).match(String(n))!==null;case"not_regex":return jfp(String(n))&&String(u).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s!=null&&u!=null?typeof u=="string"?d(u,String(n),a):d(u,s,a):d(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=dWS(String(n));if(s==null&&(s=wfp(n)),s==null)throw new B2(`Invalid date: ${n}`);let o=wfp(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new B2(`Unknown operator: ${a}`)}}function Afp(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new B2("can't match cohort without a given cohort property value");let a=r[n];return qfp(a,t,r,i)}function qfp(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let u=!1;if("values"in a[0]){for(let l of a)try{let d=qfp(l,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof B2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new B2("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let l of a)try{let d;l.type==="cohort"?d=Afp(l,t,r,i):d=Mfp(l,t);let s=l.negation||!1;if(n==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof B2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new B2("can't match cohort without a given cohort property value");return n==="AND"}}function jfp(e){try{return new RegExp(e),!0}catch{return!1}}function wfp(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 B2(`${e} is in an invalid date format`)}else throw new B2(`The date provided ${e} must be a string, number, or date object`)}function dWS(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let n=parseInt(r.groups.number);if(n>=1e4)return null;let a=r.groups.interval;if(a=="h")i.setUTCHours(i.getUTCHours()-n);else if(a=="d")i.setUTCDate(i.getUTCDate()-n);else if(a=="w")i.setUTCDate(i.getUTCDate()-n*7);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else if(a=="y")i.setUTCFullYear(i.getUTCFullYear()-n);else return null;return i}else return null}var pWS=30*1e3,_WS=50*1e3,aPn=class extends IIs{constructor(t,r={}){super(t,r),this._memoryStorage=new zIs,this.options=r,r.personalApiKey&&(this.featureFlagsPoller=new NIs({pollingInterval:typeof r.featureFlagsPollingInterval=="number"?r.featureFlagsPollingInterval:pWS,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},customHeaders:this.getCustomHeaders()})),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||_WS}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):Efp(t,r)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return rWS}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({distinctId:t,event:r,properties:i,groups:n,sendFeatureFlags:a,timestamp:u,disableGeoip:l,uuid:d}){let s=b=>{super.captureStateless(t,r,b,{timestamp:u,disableGeoip:l,uuid:d})},o=(b,g,O)=>super.getFeatureFlagsStateless(b,g,void 0,void 0,O),c=Promise.resolve().then(async()=>{if(a)return await o(t,n,l);if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let b={};for(let[g,O]of Object.entries(n||{}))b[g]=String(O);return await this.getAllFlags(t,{groups:b,disableGeoip:l,onlyEvaluateLocally:!0})}return{}}).then(b=>{let g={};if(b)for(let[m,P]of Object.entries(b))g[`$feature/${m}`]=P;let O=Object.keys(b||{}).filter(m=>b?.[m]!==!1);return O.length>0&&(g.$active_feature_flags=O),g}).catch(()=>({})).then(b=>{s({...b,...i,$groups:n})});this.addPendingPromise(c)}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set||r;super.identifyStateless(t,{$set:n},{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:u,sendFeatureFlagEvents:l,personProperties:d,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,d,s);d=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),l==null&&(l=!0);let c=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,d,s),b=c!==void 0;!b&&!u&&(c=await super.getFeatureFlagStateless(t,r,n,d,s,a));let g=`${t}_${c}`;return l&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(g))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(g):this.distinctIdHasSentFlagCalls[r]=[g],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:c,locally_evaluated:b,[`$feature/${t}`]:c},groups:n,disableGeoip:a})),c}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:u}=n||{},{onlyEvaluateLocally:l,sendFeatureFlagEvents:d,personProperties:s,groupProperties:o}=n||{},c=this.addLocalPersonAndGroupProperties(r,a,s,o);s=c.allPersonProperties,o=c.allGroupProperties;let b;return i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0})),i&&(b=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i)),l==null&&(l=!1),d==null&&(d=!0),l==null&&(l=!1),!(b!==void 0)&&!l&&(b=await super.getFeatureFlagPayloadStateless(t,r,a,s,o,u)),b}async isFeatureEnabled(t,r,i){let n=await this.getFeatureFlag(t,r,i);if(n!==void 0)return!!n||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags}async getAllFlagsAndPayloads(t,r){let{groups:i,disableGeoip:n}=r||{},{onlyEvaluateLocally:a,personProperties:u,groupProperties:l}=r||{},d=this.addLocalPersonAndGroupProperties(t,i,u,l);u=d.allPersonProperties,l=d.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,u,l),o={},c={},b=!0;if(s&&(o=s.response,c=s.payloads,b=s.fallbackToDecide),b&&!a){let g=await super.getFeatureFlagsAndPayloadsStateless(t,i,u,l,n);o={...o,...g.flags||{}},c={...c,...g.payloads||{}}}return{featureFlags:o,featureFlagPayloads:c}}groupIdentify({groupType:t,groupKey:r,properties:i,distinctId:n,disableGeoip:a}){super.groupIdentifyStateless(t,r,i,{disableGeoip:a},n)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async shutdown(t){return this.featureFlagsPoller?.stopPoller(),super.shutdown(t)}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},u={};if(r)for(let l of Object.keys(r))u[l]={$group_key:r[l],...n?.[l]||{}};return{allPersonProperties:a,allGroupProperties:u}}},FIs=class e{constructor(t,r,i,n){this.posthog=t,this.posthogHost=r,this.organization=i,this.prefix=n,this.name="posthog-node",this.posthogHost=t.options.host??"https://us.i.posthog.com"}setupOnce(t,r){t(i=>{if(i.exception?.values===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});let n=r(),a=i.tags[e.POSTHOG_ID_TAG];if(a===void 0)return i;i.tags["PostHog Person URL"]=new URL(`/person/${a}`,this.posthogHost).toString();let u={$exception_message:i.exception.values[0]?.value,$exception_type:i.exception.values[0]?.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:i.exception.values[0]?.value,$sentry_exception_type:i.exception.values[0]?.type,$sentry_tags:i.tags},l=n.getClient()?.getDsn()?.projectId;return this.organization!==void 0&&l!==void 0&&i.event_id!==void 0&&(u.$sentry_url=`${this.prefix??"https://sentry.io/organizations"}/${this.organization}/issues/?project=${l}&query=${i.event_id}`),this.posthog.capture({event:"$exception",distinctId:a,properties:u}),i})}};FIs.POSTHOG_ID_TAG="posthog_distinct_id";var hPo=class{posthog;constructor({posthogApiKey:t}){this.posthog=new aPn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.57.14",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var ila=class{async sendEvent(){}async identify(){}async flush(){}};var oPn=require("fs/promises"),xfp=require("os"),Ifp=require("path");var Tfp=di(require("crypto")),vPo=new Uint8Array(256),yPo=vPo.length;function LIs(){return yPo>vPo.length-16&&(Tfp.default.randomFillSync(vPo),yPo=0),vPo.slice(yPo,yPo+=16)}var vV=[];for(let e=0;e<256;++e)vV.push((e+256).toString(16).slice(1));function Cfp(e,t=0){return vV[e[t+0]]+vV[e[t+1]]+vV[e[t+2]]+vV[e[t+3]]+"-"+vV[e[t+4]]+vV[e[t+5]]+"-"+vV[e[t+6]]+vV[e[t+7]]+"-"+vV[e[t+8]]+vV[e[t+9]]+"-"+vV[e[t+10]]+vV[e[t+11]]+vV[e[t+12]]+vV[e[t+13]]+vV[e[t+14]]+vV[e[t+15]]}var Bfp=di(require("crypto")),UIs={randomUUID:Bfp.default.randomUUID};function hWS(e,t,r){if(UIs.randomUUID&&!t&&!e)return UIs.randomUUID();e=e||{};let i=e.random||(e.rng||LIs)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return Cfp(i)}var Cie=hWS;var yWS="id",vWS=".fern",nla=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new aPn(r),this.userId=t==null?void 0:YEs(t)}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"0.57.14",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=es(Wl.of((0,xfp.homedir)()),uo.of(vWS),uo.of(yWS));await Bf(t)||(await(0,oPn.mkdir)((0,Ifp.dirname)(t),{recursive:!0}),await(0,oPn.writeFile)(t,Cie())),this.persistedDistinctId=(await(0,oPn.readFile)(t)).toString()}return this.persistedDistinctId}};var VIs;async function uPn(){return VIs==null&&(VIs=await bWS()),VIs}async function bWS(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new ila;let r=await byo();return r!=null?new nla({token:r,posthogApiKey:e}):await vyo()!=null?new hPo({posthogApiKey:e}):new nla({token:void 0,posthogApiKey:e})}catch{return new ila}}function ala(e,t){return function(){return e.apply(t,arguments)}}var{toString:gWS}=Object.prototype,{getPrototypeOf:HIs}=Object,gPo=(e=>t=>{let r=gWS.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),g5t=e=>(e=e.toLowerCase(),t=>gPo(t)===e),OPo=e=>t=>typeof t===e,{isArray:sPn}=Array,ola=OPo("undefined");function OWS(e){return e!==null&&!ola(e)&&e.constructor!==null&&!ola(e.constructor)&&WSe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Rfp=g5t("ArrayBuffer");function mWS(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Rfp(e.buffer),t}var PWS=OPo("string"),WSe=OPo("function"),Nfp=OPo("number"),mPo=e=>e!==null&&typeof e=="object",jWS=e=>e===!0||e===!1,bPo=e=>{if(gPo(e)!=="object")return!1;let t=HIs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},wWS=g5t("Date"),SWS=g5t("File"),DWS=g5t("Blob"),EWS=g5t("FileList"),MWS=e=>mPo(e)&&WSe(e.pipe),AWS=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||WSe(e.append)&&((t=gPo(e))==="formdata"||t==="object"&&WSe(e.toString)&&e.toString()==="[object FormData]"))},qWS=g5t("URLSearchParams"),[TWS,CWS,BWS,xWS]=["ReadableStream","Request","Response","Headers"].map(g5t),IWS=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ula(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),sPn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,l;for(i=0;i<u;i++)l=a[i],t.call(null,e[l],l,e)}}function Ffp(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var izi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Lfp=e=>!ola(e)&&e!==izi;function WIs(){let{caseless:e}=Lfp(this)&&this||{},t={},r=(i,n)=>{let a=e&&Ffp(t,n)||n;bPo(t[a])&&bPo(i)?t[a]=WIs(t[a],i):bPo(i)?t[a]=WIs({},i):sPn(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&ula(arguments[i],r);return t}var zWS=(e,t,r,{allOwnKeys:i}={})=>(ula(t,(n,a)=>{r&&WSe(n)?e[a]=ala(n,r):e[a]=n},{allOwnKeys:i}),e),RWS=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),NWS=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},FWS=(e,t,r,i)=>{let n,a,u,l={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!l[u]&&(t[u]=e[u],l[u]=!0);e=r!==!1&&HIs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},LWS=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},UWS=e=>{if(!e)return null;if(sPn(e))return e;let t=e.length;if(!Nfp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},VWS=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&HIs(Uint8Array)),WWS=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},HWS=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},$WS=g5t("HTMLFormElement"),GWS=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),zfp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),QWS=g5t("RegExp"),Ufp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};ula(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},JWS=e=>{Ufp(e,(t,r)=>{if(WSe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(WSe(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},KWS=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return sPn(e)?i(e):i(String(e).split(t)),r},YWS=()=>{},XWS=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function ZWS(e){return!!(e&&WSe(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var kWS=e=>{let t=new Array(10),r=(i,n)=>{if(mPo(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=sPn(i)?[]:{};return ula(i,(u,l)=>{let d=r(u,n+1);!ola(d)&&(a[l]=d)}),t[n]=void 0,a}}return i};return r(e,0)},eHS=g5t("AsyncFunction"),tHS=e=>e&&(mPo(e)||WSe(e))&&WSe(e.then)&&WSe(e.catch),Vfp=((e,t)=>e?setImmediate:t?((r,i)=>(izi.addEventListener("message",({source:n,data:a})=>{n===izi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),izi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",WSe(izi.postMessage)),rHS=typeof queueMicrotask<"u"?queueMicrotask.bind(izi):typeof process<"u"&&process.nextTick||Vfp,ds={isArray:sPn,isArrayBuffer:Rfp,isBuffer:OWS,isFormData:AWS,isArrayBufferView:mWS,isString:PWS,isNumber:Nfp,isBoolean:jWS,isObject:mPo,isPlainObject:bPo,isReadableStream:TWS,isRequest:CWS,isResponse:BWS,isHeaders:xWS,isUndefined:ola,isDate:wWS,isFile:SWS,isBlob:DWS,isRegExp:QWS,isFunction:WSe,isStream:MWS,isURLSearchParams:qWS,isTypedArray:VWS,isFileList:EWS,forEach:ula,merge:WIs,extend:zWS,trim:IWS,stripBOM:RWS,inherits:NWS,toFlatObject:FWS,kindOf:gPo,kindOfTest:g5t,endsWith:LWS,toArray:UWS,forEachEntry:WWS,matchAll:HWS,isHTMLForm:$WS,hasOwnProperty:zfp,hasOwnProp:zfp,reduceDescriptors:Ufp,freezeMethods:JWS,toObjectSet:KWS,toCamelCase:GWS,noop:YWS,toFiniteNumber:XWS,findKey:Ffp,global:izi,isContextDefined:Lfp,isSpecCompliantForm:ZWS,toJSONObject:kWS,isAsyncFn:eHS,isThenable:tHS,setImmediate:Vfp,asap:rHS};function cPn(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}ds.inherits(cPn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ds.toJSONObject(this.config),code:this.code,status:this.status}}});var Wfp=cPn.prototype,Hfp={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Hfp[e]={value:e}});Object.defineProperties(cPn,Hfp);Object.defineProperty(Wfp,"isAxiosError",{value:!0});cPn.from=(e,t,r,i,n,a)=>{let u=Object.create(Wfp);return ds.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),cPn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var Dp=cPn;var $fp=di(Ria(),1),PPo=$fp.default;function $Is(e){return ds.isPlainObject(e)||ds.isArray(e)}function Qfp(e){return ds.endsWith(e,"[]")?e.slice(0,-2):e}function Gfp(e,t,r){return e?e.concat(t).map(function(n,a){return n=Qfp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function iHS(e){return ds.isArray(e)&&!e.some($Is)}var nHS=ds.toFlatObject(ds,{},null,function(t){return/^is[A-Z]/.test(t)});function aHS(e,t,r){if(!ds.isObject(e))throw new TypeError("target must be an object");t=t||new(PPo||FormData),r=ds.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,P){return!ds.isUndefined(P[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&ds.isSpecCompliantForm(t);if(!ds.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(ds.isDate(O))return O.toISOString();if(!d&&ds.isBlob(O))throw new Dp("Blob is not supported. Use a Buffer instead.");return ds.isArrayBuffer(O)||ds.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,P){let E=O;if(O&&!P&&typeof O=="object"){if(ds.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(ds.isArray(O)&&iHS(O)||(ds.isFileList(O)||ds.endsWith(m,"[]"))&&(E=ds.toArray(O)))return m=Qfp(m),E.forEach(function(q,D){!(ds.isUndefined(q)||q===null)&&t.append(u===!0?Gfp([m],D,a):u===null?m:m+"[]",s(q))}),!1}return $Is(O)?!0:(t.append(Gfp(P,m,a),s(O)),!1)}let c=[],b=Object.assign(nHS,{defaultVisitor:o,convertValue:s,isVisitable:$Is});function g(O,m){if(!ds.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),ds.forEach(O,function(E,A){(!(ds.isUndefined(E)||E===null)&&n.call(t,E,ds.isString(A)?A.trim():A,m,b))===!0&&g(E,m?m.concat(A):[A])}),c.pop()}}if(!ds.isObject(e))throw new TypeError("data must be an object");return g(e),t}var Sfi=aHS;function Jfp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function Kfp(e,t){this._pairs=[],e&&Sfi(e,this,t)}var Yfp=Kfp.prototype;Yfp.append=function(t,r){this._pairs.push([t,r])};Yfp.toString=function(t){let r=t?function(i){return t.call(this,i,Jfp)}:Jfp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var Xfp=Kfp;function oHS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function nzi(e,t,r){if(!t)return e;let i=r&&r.encode||oHS;ds.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=ds.isURLSearchParams(t)?t.toString():new Xfp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var GIs=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ds.forEach(this.handlers,function(i){i!==null&&t(i)})}},QIs=GIs;var lPn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var tdp=di(require("crypto"),1);var Zfp=di(require("url"),1),kfp=Zfp.default.URLSearchParams;var JIs="abcdefghijklmnopqrstuvwxyz",edp="0123456789",rdp={DIGIT:edp,ALPHA:JIs,ALPHA_DIGIT:JIs+JIs.toUpperCase()+edp},uHS=(e=16,t=rdp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);tdp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},idp={isNode:!0,classes:{URLSearchParams:kfp,FormData:PPo,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:rdp,generateString:uHS,protocols:["http","https","file","data"]};var XIs={};Eo(XIs,{hasBrowserEnv:()=>YIs,hasStandardBrowserEnv:()=>sHS,hasStandardBrowserWebWorkerEnv:()=>cHS,navigator:()=>KIs,origin:()=>lHS});var YIs=typeof window<"u"&&typeof document<"u",KIs=typeof navigator=="object"&&navigator||void 0,sHS=YIs&&(!KIs||["ReactNative","NativeScript","NS"].indexOf(KIs.product)<0),cHS=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",lHS=YIs&&window.location.href||"http://localhost";var SM={...XIs,...idp};function ZIs(e,t){return Sfi(e,new SM.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return SM.isNode&&ds.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function fHS(e){return ds.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function dHS(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function pHS(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),d=a>=r.length;return u=!u&&ds.isArray(n)?n.length:u,d?(ds.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!ds.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&ds.isArray(n[u])&&(n[u]=dHS(n[u])),!l)}if(ds.isFormData(e)&&ds.isFunction(e.entries)){let r={};return ds.forEachEntry(e,(i,n)=>{t(fHS(i),n,r,0)}),r}return null}var jPo=pHS;function _HS(e,t,r){if(ds.isString(e))try{return(t||JSON.parse)(e),ds.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var kIs={transitional:lPn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=ds.isObject(t);if(a&&ds.isHTMLForm(t)&&(t=new FormData(t)),ds.isFormData(t))return n?JSON.stringify(jPo(t)):t;if(ds.isArrayBuffer(t)||ds.isBuffer(t)||ds.isStream(t)||ds.isFile(t)||ds.isBlob(t)||ds.isReadableStream(t))return t;if(ds.isArrayBufferView(t))return t.buffer;if(ds.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return ZIs(t,this.formSerializer).toString();if((l=ds.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return Sfi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),_HS(t)):t}],transformResponse:[function(t){let r=this.transitional||kIs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(ds.isResponse(t)||ds.isReadableStream(t))return t;if(t&&ds.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(l){if(u)throw l.name==="SyntaxError"?Dp.from(l,Dp.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:SM.classes.FormData,Blob:SM.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ds.forEach(["delete","get","head","post","put","patch"],e=>{kIs.headers[e]={}});var fPn=kIs;var hHS=ds.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ndp=e=>{let t={},r,i,n;return e&&e.split(`
|
|
1704
|
+
`}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&&bmo(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var flp=di(nlp(),1),dlp=di(QCs(),1),plp=di(clp(),1),YA=di(USe(),1),_lp=di(qsa(),1);var Qmo=di(USe(),1),llp=di(qsa(),1),Jmo=function(e,t,r){return typeof e[t]!="function"?(0,Qmo.of)(e):(0,Qmo.from)((0,llp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var Wca={isPlainObject:flp.default,set:plp.default,get:dlp.default},Zmn=class extends ZIi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=Wca.isPlainObject(r)?{...r}:{},Wca.isPlainObject(t)&&(t=Object.values(t).every(n=>Wca.isPlainObject(n)&&n.name===void 0)?Object.entries(t).map(([n,a])=>({name:n,...a})):[t]);let i=Array.isArray(t)?(0,YA.from)(t):t;return this.process=i.pipe((0,YA.concatMap)(this.processQuestion.bind(this)),(0,YA.publish)()),this.process.connect(),this.process.pipe((0,YA.reduce)((n,a)=>(Wca.set(n,a.name,a.answer),n),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,YA.defer)(()=>(0,YA.of)(t).pipe((0,YA.concatMap)(this.setDefaultType.bind(this)),(0,YA.concatMap)(this.filterIfRunnable.bind(this)),(0,YA.concatMap)(()=>Jmo(t,"message",this.answers)),(0,YA.concatMap)(()=>Jmo(t,"default",this.answers)),(0,YA.concatMap)(()=>Jmo(t,"choices",this.answers)),(0,YA.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,YA.defer)(()=>(0,YA.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,YA.defer)(()=>(0,YA.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&Wca.get(this.answers,t.name)!==void 0)return(0,YA.empty)();if(t.when===!1)return(0,YA.empty)();if(typeof t.when!="function")return(0,YA.of)(t);let{answers:r}=this;return(0,YA.defer)(()=>(0,YA.from)((0,_lp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,YA.filter)(i=>i!=null)))}};function hlp(e){let t=function(r,i){let n;try{n=new Zmn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",jca),this.registerPrompt("input",VIi),this.registerPrompt("number",wca),this.registerPrompt("confirm",Sca),this.registerPrompt("rawlist",Dca),this.registerPrompt("expand",Eca),this.registerPrompt("checkbox",Mca),this.registerPrompt("password",Aca),this.registerPrompt("editor",Fca)},t.restoreDefaultPrompts(),t}var Kxs=hlp();function ELS(e,t){Kxs.registerPrompt(e,t)}function MLS(){Kxs.restoreDefaultPrompts()}var ALS={prompt:Kxs,ui:{BottomBar:Vca,Prompt:Zmn},createPromptModule:hlp,registerPrompt:ELS,restoreDefaultPrompts:MLS,Separator:Eie},Kmo=ALS;var Sfp=di(ylp()),rWS="4.2.1",b5t;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",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"})(b5t||(b5t={}));function iWS(e,t){if(!e)throw new Error(t)}function nWS(e){return e?.replace(/\/+$/,"")}async function aWS(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(n=>setTimeout(n,t.retryDelay));try{return await e()}catch(n){if(r=n,!t.retryCheck(n))throw n}}throw r}function oWS(){return new Date().getTime()}function vfp(){return new Date().toISOString()}function Dfp(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var ela=String.fromCharCode,bfp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",lPo={};function uWS(e,t){if(!lPo[e]){lPo[e]={};for(let r=0;r<e.length;r++)lPo[e][e.charAt(r)]=r}return lPo[e][t]}var tla={compressToBase64:function(e){if(e==null)return"";let t=tla._compress(e,6,function(r){return bfp.charAt(r)});switch(t.length%4){default:case 0:return t;case 1:return t+"===";case 2:return t+"==";case 3:return t+"="}},decompressFromBase64:function(e){return e==null?"":e==""?null:tla._decompress(e.length,32,function(t){return uWS(bfp,e.charAt(t))})},compress:function(e){return tla._compress(e,16,function(t){return ela(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,l,d="",s="",o="",c=2,b=3,g=2,O=0,m=0,P;for(P=0;P<e.length;P+=1)if(d=e.charAt(P),Object.prototype.hasOwnProperty.call(i,d)||(i[d]=b++,n[d]=!0),s=o+d,Object.prototype.hasOwnProperty.call(i,s))o=s;else{if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++),i[s]=b++,o=String(d)}if(o!==""){if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(l=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}else{for(l=1,u=0;u<g;u++)O=O<<1|l,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=0;for(l=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1}c--,c==0&&(c=Math.pow(2,g),g++),delete n[o]}else for(l=i[o],u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;c--,c==0&&(c=Math.pow(2,g),g++)}for(l=2,u=0;u<g;u++)O=O<<1|l&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,l=l>>1;for(;;)if(O=O<<1,m==t-1){a.push(r(O));break}else m++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:tla._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let i=[],n=[],a={val:r(0),position:t,index:1},u=4,l=4,d=3,s="",o,c,b,g,O,m,P;for(o=0;o<3;o+=1)i[o]=o;for(b=0,O=Math.pow(2,2),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;P=ela(b);break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;P=ela(b);break;case 2:return""}for(i[3]=P,c=P,n.push(P);;){if(a.index>e)return"";for(b=0,O=Math.pow(2,d),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;switch(P=b){case 0:for(b=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=ela(b),P=l-1,u--;break;case 1:for(b=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),b|=(g>0?1:0)*m,m<<=1;i[l++]=ela(b),P=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,d),d++),i[P])s=i[P];else if(P===l)s=c+c.charAt(0);else return null;n.push(s),i[l++]=c+s.charAt(0),u--,c=s,u==0&&(u=Math.pow(2,d),d++)}}},BIs=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(i=>i!==r)}}emit(t,r){for(let i of this.events[t]||[])i(r);for(let i of this.events["*"]||[])i(t,r)}};var fPo="0123456789abcdef",dPo=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,i,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||t<0||r<0||i<0||n<0||t>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=n>>>24,a[13]=n>>>16,a[14]=n>>>8,a[15]=n,new e(a)}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}if(r){let i=new Uint8Array(16);for(let n=0;n<16;n+=4){let a=parseInt(r.substring(2*n,2*n+8),16);i[n+0]=a>>>24,i[n+1]=a>>>16,i[n+2]=a>>>8,i[n+3]=a}return new e(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=fPo.charAt(this.bytes[r]>>>4),t+=fPo.charAt(this.bytes[r]&15),(r===3||r===5||r===7||r===9)&&(t+="-");return t}toHex(){let t="";for(let r=0;r<this.bytes.length;r++)t+=fPo.charAt(this.bytes[r]>>>4),t+=fPo.charAt(this.bytes[r]&15);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 i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},xIs=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??sWS()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let i=this.generateOrAbortCore(t,r);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(t,r)),i}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)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return dPo.fromFieldsV7(this.timestamp,Math.trunc(this.counter/2**30),this.counter&2**30-1,this.random.nextUint32())}resetCounter(){this.counter=this.random.nextUint32()*1024+(this.random.nextUint32()&1023)}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,dPo.ofInner(t)}},sWS=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),gfp,Ofp=()=>cWS().toString(),cWS=()=>(gfp||(gfp=new xIs)).generate(),pPo=class extends Error{constructor(t){super("HTTP error while fetching PostHog: "+t.status),this.response=t,this.name="PostHogFetchHttpError"}},rla=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};function mfp(e){return typeof e=="object"&&(e instanceof pPo||e instanceof rla)}var IIs=class{constructor(t,r){this.flushPromise=null,this.disableGeoip=!0,this.historicalMigration=!1,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new BIs,this._isInitialized=!1,iWS(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=nWS(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.captureMode=r?.captureMode||"json",this.defaultOptIn=r?.defaultOptIn??!0,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:mfp},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??3e3,this.disableGeoip=r?.disableGeoip??!0,this.disabled=r?.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}logMsgIfDebug(t){this.isDebug&&t()}wrap(t){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized)return t();this._initPromise.then(()=>t())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(b5t.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(b5t.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(b5t.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>console.log("PostHog Debug",i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=Ofp();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}groupIdentifyStateless(t,r,i,n,a,u){this.wrap(()=>{let l=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...u||{}}});this.enqueue("capture",l,n)})}async getDecide(t,r={},i={},n={},a={}){await this._initPromise;let u=`${this.host}/decide/?v=3`,l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:i,group_properties:n,...a})};return this.fetchWithRetry(u,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(d=>d.json()).catch(d=>{this._events.emit("error",d)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0&&(d=!1),d}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let l=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u);if(!l)return;let d=l[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).payloads}_parsePayload(t){try{return JSON.parse(t)}catch{return t}}async getFeatureFlagsStateless(t,r={},i={},n={},a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a)).flags}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a){await this._initPromise;let u={};(a??this.disableGeoip)&&(u.geoip_disable=!0);let l=await this.getDecide(t,r,i,n,u),d=l?.featureFlags,s=l?.featureFlagPayloads,o=s;return s&&(o=Object.fromEntries(Object.entries(s).map(([c,b])=>[c,this._parsePayload(b)]))),{flags:d,payloads:o}}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:vfp(),uuid:i?.uuid?i.uuid:Ofp()};(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId);let u=this.getPersistedProperty(b5t.Queue)||[];u.length>=this.maxQueueSize&&(u.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),u.push({message:n}),this.setPersistedProperty(b5t.Queue,u),this._events.emit(t,n),u.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Dfp(()=>this.flushBackground(),this.flushInterval))})}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(()=>{})}async flush(){return this.flushPromise||(this.flushPromise=this._flush().finally(()=>{this.flushPromise=null}),this.addPendingPromise(this.flushPromise)),this.flushPromise}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(b5t.Queue)||[];if(!t.length)return[];let r=t.slice(0,this.maxBatchSize),i=r.map(s=>s.message),n=()=>{let s=this.getPersistedProperty(b5t.Queue)||[];this.setPersistedProperty(b5t.Queue,s.slice(r.length))},a={api_key:this.apiKey,batch:i,sent_at:vfp()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),l=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${oWS()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,d=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(tla.compressToBase64(u))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:u};try{await this.fetchWithRetry(l,d)}catch(s){throw s instanceof rla||n(),this._events.emit("error",s),s}return n(),this._events.emit("flush",i),i}async fetchWithRetry(t,r,i,n){var a;return(a=AbortSignal).timeout??(a.timeout=function(l){let d=new AbortController;return setTimeout(()=>d.abort(),l),d.signal}),await aWS(async()=>{let u=null;try{u=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(d){throw new rla(d)}if(!(r.mode==="no-cors")&&(u.status<200||u.status>=400))throw new pPo(u);return u},{...this._retryOptions,...i})}async shutdown(t=3e4){await this._initPromise,this.clearFlushTimer();try{await Promise.all(Object.values(this.pendingPromises));let r=Date.now()+t;for(;(this.getPersistedProperty(b5t.Queue)||[]).length!==0;){await this.flush();let n=Date.now();if(r<n)break}}catch(r){if(!mfp(r))throw r;this.logMsgIfDebug(()=>console.error("Error while shutting down PostHog",r))}}},zIs=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},RIs=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!RIs){let e=yfp();RIs=async(t,r)=>{let i=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var Efp=RIs,lWS=1152921504606847e3,fWS=["is_not"],_Po=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},B2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},NIs=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...l}){this.debugMode=!1,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=l.fetch||Efp,this.onError=l.onError,this.customHeaders=u,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let u,l;if(!this.loadedSuccessfullyOnce)return u;for(let d of this.featureFlags)if(t===d.key){l=d;break}if(l!==void 0)try{u=this.computeFlagLocally(l,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(d){d instanceof B2?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${d}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return u}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(t,r={},i={},n={}){await this.loadFeatureFlags();let a={},u={},l=this.featureFlags.length==0;return this.featureFlags.map(async d=>{try{let s=this.computeFlagLocally(d,t,r,i,n);a[d.key]=s;let o=await this.computeFeatureFlagPayloadLocally(d.key,s);o&&(u[d.key]=o)}catch(s){s instanceof B2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),l=!0}}),{response:a,payloads:u,fallbackToDecide:l}}computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new B2("Flag has experience continuity enabled");if(!t.active)return!1;let l=(t.filters||{}).aggregation_group_type_index;if(l!=null){let d=this.groupTypeMapping[String(l)];if(!d)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${l} for feature flag ${t.key}`)),new B2("Flag has unknown group type index");if(!(d in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[d];return this.matchFeatureFlagProperties(t,i[d],s)}else return this.matchFeatureFlagProperties(t,r,n)}matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,l,d=[...a].sort((s,o)=>{let c=!!s.variant,b=!!o.variant;return c&&b?0:c?-1:b?1:0});for(let s of d)try{if(this.isConditionMatch(t,r,s,i)){let o=s.variant,c=n.multivariate?.variants||[];o&&c.some(b=>b.key===o)?l=o:l=this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof B2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new B2("Can't determine if feature flag is enabled or not with given properties");return!1}isConditionMatch(t,r,i,n){let a=i.rollout_percentage,u=l=>{this.logMsgIfDebug(()=>console.warn(l))};if((i.properties||[]).length>0){for(let l of i.properties){let d=l.type,s=!1;if(d==="cohort"?s=Afp(l,n,this.cohorts,this.debugMode):s=Mfp(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&Pfp(t.key,r)>a/100)}getMatchingVariant(t,r){let i=Pfp(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(l=>{n=i+l.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:l.key}),i=n}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.pollingInterval);try{let t=await this._requestFeatureFlagDefinitions();if(t&&t.status===401)throw new _Po("Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview");if(t&&t.status!==200)return;let r=await t.json();"flags"in r||this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`)),this.featureFlags=r.flags||[],this.featureFlagsByKey=this.featureFlags.reduce((i,n)=>(i[n.key]=n,i),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||[],this.loadedSuccessfullyOnce=!0}catch(t){t instanceof _Po&&this.onError?.(t)}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r={method:"GET",headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}},i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=Dfp(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function Pfp(e,t,r=""){let i=(0,Sfp.createHash)();return i.update(`${e}.${t}${r}`),parseInt(i.digest("hex").slice(0,15),16)/lWS}function Mfp(e,t,r){let i=e.key,n=e.value,a=e.operator||"exact";if(i in t){if(a==="is_not_set")throw new B2("Operator is_not_set is not supported")}else throw new B2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!fWS.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function l(s,o){return Array.isArray(s)?s.map(c=>String(c).toLowerCase()).includes(String(o).toLowerCase()):String(s).toLowerCase()===String(o).toLowerCase()}function d(s,o,c){if(c==="gt")return s>o;if(c==="gte")return s>=o;if(c==="lt")return s<o;if(c==="lte")return s<=o;throw new Error(`Invalid operator: ${c}`)}switch(a){case"exact":return l(n,u);case"is_not":return!l(n,u);case"is_set":return i in t;case"icontains":return String(u).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(u).toLowerCase().includes(String(n).toLowerCase());case"regex":return jfp(String(n))&&String(u).match(String(n))!==null;case"not_regex":return jfp(String(n))&&String(u).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s!=null&&u!=null?typeof u=="string"?d(u,String(n),a):d(u,s,a):d(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=dWS(String(n));if(s==null&&(s=wfp(n)),s==null)throw new B2(`Invalid date: ${n}`);let o=wfp(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new B2(`Unknown operator: ${a}`)}}function Afp(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new B2("can't match cohort without a given cohort property value");let a=r[n];return qfp(a,t,r,i)}function qfp(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let u=!1;if("values"in a[0]){for(let l of a)try{let d=qfp(l,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof B2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new B2("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let l of a)try{let d;l.type==="cohort"?d=Afp(l,t,r,i):d=Mfp(l,t);let s=l.negation||!1;if(n==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof B2)i&&console.debug(`Failed to compute property ${l} locally: ${d}`),u=!0;else throw d}if(u)throw new B2("can't match cohort without a given cohort property value");return n==="AND"}}function jfp(e){try{return new RegExp(e),!0}catch{return!1}}function wfp(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 B2(`${e} is in an invalid date format`)}else throw new B2(`The date provided ${e} must be a string, number, or date object`)}function dWS(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let n=parseInt(r.groups.number);if(n>=1e4)return null;let a=r.groups.interval;if(a=="h")i.setUTCHours(i.getUTCHours()-n);else if(a=="d")i.setUTCDate(i.getUTCDate()-n);else if(a=="w")i.setUTCDate(i.getUTCDate()-n*7);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else if(a=="y")i.setUTCFullYear(i.getUTCFullYear()-n);else return null;return i}else return null}var pWS=30*1e3,_WS=50*1e3,aPn=class extends IIs{constructor(t,r={}){super(t,r),this._memoryStorage=new zIs,this.options=r,r.personalApiKey&&(this.featureFlagsPoller=new NIs({pollingInterval:typeof r.featureFlagsPollingInterval=="number"?r.featureFlagsPollingInterval:pWS,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},customHeaders:this.getCustomHeaders()})),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||_WS}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):Efp(t,r)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return rWS}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({distinctId:t,event:r,properties:i,groups:n,sendFeatureFlags:a,timestamp:u,disableGeoip:l,uuid:d}){let s=b=>{super.captureStateless(t,r,b,{timestamp:u,disableGeoip:l,uuid:d})},o=(b,g,O)=>super.getFeatureFlagsStateless(b,g,void 0,void 0,O),c=Promise.resolve().then(async()=>{if(a)return await o(t,n,l);if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let b={};for(let[g,O]of Object.entries(n||{}))b[g]=String(O);return await this.getAllFlags(t,{groups:b,disableGeoip:l,onlyEvaluateLocally:!0})}return{}}).then(b=>{let g={};if(b)for(let[m,P]of Object.entries(b))g[`$feature/${m}`]=P;let O=Object.keys(b||{}).filter(m=>b?.[m]!==!1);return O.length>0&&(g.$active_feature_flags=O),g}).catch(()=>({})).then(b=>{s({...b,...i,$groups:n})});this.addPendingPromise(c)}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set||r;super.identifyStateless(t,{$set:n},{disableGeoip:i})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:u,sendFeatureFlagEvents:l,personProperties:d,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,d,s);d=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),l==null&&(l=!0);let c=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,d,s),b=c!==void 0;!b&&!u&&(c=await super.getFeatureFlagStateless(t,r,n,d,s,a));let g=`${t}_${c}`;return l&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(g))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(g):this.distinctIdHasSentFlagCalls[r]=[g],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:c,locally_evaluated:b,[`$feature/${t}`]:c},groups:n,disableGeoip:a})),c}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:u}=n||{},{onlyEvaluateLocally:l,sendFeatureFlagEvents:d,personProperties:s,groupProperties:o}=n||{},c=this.addLocalPersonAndGroupProperties(r,a,s,o);s=c.allPersonProperties,o=c.allGroupProperties;let b;return i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0})),i&&(b=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i)),l==null&&(l=!1),d==null&&(d=!0),l==null&&(l=!1),!(b!==void 0)&&!l&&(b=await super.getFeatureFlagPayloadStateless(t,r,a,s,o,u)),b}async isFeatureEnabled(t,r,i){let n=await this.getFeatureFlag(t,r,i);if(n!==void 0)return!!n||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags}async getAllFlagsAndPayloads(t,r){let{groups:i,disableGeoip:n}=r||{},{onlyEvaluateLocally:a,personProperties:u,groupProperties:l}=r||{},d=this.addLocalPersonAndGroupProperties(t,i,u,l);u=d.allPersonProperties,l=d.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,u,l),o={},c={},b=!0;if(s&&(o=s.response,c=s.payloads,b=s.fallbackToDecide),b&&!a){let g=await super.getFeatureFlagsAndPayloadsStateless(t,i,u,l,n);o={...o,...g.flags||{}},c={...c,...g.payloads||{}}}return{featureFlags:o,featureFlagPayloads:c}}groupIdentify({groupType:t,groupKey:r,properties:i,distinctId:n,disableGeoip:a}){super.groupIdentifyStateless(t,r,i,{disableGeoip:a},n)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async shutdown(t){return this.featureFlagsPoller?.stopPoller(),super.shutdown(t)}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},u={};if(r)for(let l of Object.keys(r))u[l]={$group_key:r[l],...n?.[l]||{}};return{allPersonProperties:a,allGroupProperties:u}}},FIs=class e{constructor(t,r,i,n){this.posthog=t,this.posthogHost=r,this.organization=i,this.prefix=n,this.name="posthog-node",this.posthogHost=t.options.host??"https://us.i.posthog.com"}setupOnce(t,r){t(i=>{if(i.exception?.values===void 0||i.exception.values.length===0)return i;i.tags||(i.tags={});let n=r(),a=i.tags[e.POSTHOG_ID_TAG];if(a===void 0)return i;i.tags["PostHog Person URL"]=new URL(`/person/${a}`,this.posthogHost).toString();let u={$exception_message:i.exception.values[0]?.value,$exception_type:i.exception.values[0]?.type,$exception_personURL:i.tags["PostHog Person URL"],$sentry_event_id:i.event_id,$sentry_exception:i.exception,$sentry_exception_message:i.exception.values[0]?.value,$sentry_exception_type:i.exception.values[0]?.type,$sentry_tags:i.tags},l=n.getClient()?.getDsn()?.projectId;return this.organization!==void 0&&l!==void 0&&i.event_id!==void 0&&(u.$sentry_url=`${this.prefix??"https://sentry.io/organizations"}/${this.organization}/issues/?project=${l}&query=${i.event_id}`),this.posthog.capture({event:"$exception",distinctId:a,properties:u}),i})}};FIs.POSTHOG_ID_TAG="posthog_distinct_id";var hPo=class{posthog;constructor({posthogApiKey:t}){this.posthog=new aPn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.57.15",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var ila=class{async sendEvent(){}async identify(){}async flush(){}};var oPn=require("fs/promises"),xfp=require("os"),Ifp=require("path");var Tfp=di(require("crypto")),vPo=new Uint8Array(256),yPo=vPo.length;function LIs(){return yPo>vPo.length-16&&(Tfp.default.randomFillSync(vPo),yPo=0),vPo.slice(yPo,yPo+=16)}var vV=[];for(let e=0;e<256;++e)vV.push((e+256).toString(16).slice(1));function Cfp(e,t=0){return vV[e[t+0]]+vV[e[t+1]]+vV[e[t+2]]+vV[e[t+3]]+"-"+vV[e[t+4]]+vV[e[t+5]]+"-"+vV[e[t+6]]+vV[e[t+7]]+"-"+vV[e[t+8]]+vV[e[t+9]]+"-"+vV[e[t+10]]+vV[e[t+11]]+vV[e[t+12]]+vV[e[t+13]]+vV[e[t+14]]+vV[e[t+15]]}var Bfp=di(require("crypto")),UIs={randomUUID:Bfp.default.randomUUID};function hWS(e,t,r){if(UIs.randomUUID&&!t&&!e)return UIs.randomUUID();e=e||{};let i=e.random||(e.rng||LIs)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return Cfp(i)}var Cie=hWS;var yWS="id",vWS=".fern",nla=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new aPn(r),this.userId=t==null?void 0:YEs(t)}async identify(){this.userId!=null&&this.posthog.alias({distinctId:this.userId,alias:await this.getPersistedDistinctId()})}async sendEvent(t){this.posthog.capture({distinctId:this.userId??await this.getPersistedDistinctId(),event:"CLI",properties:{version:"0.57.15",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=es(Wl.of((0,xfp.homedir)()),uo.of(vWS),uo.of(yWS));await Bf(t)||(await(0,oPn.mkdir)((0,Ifp.dirname)(t),{recursive:!0}),await(0,oPn.writeFile)(t,Cie())),this.persistedDistinctId=(await(0,oPn.readFile)(t)).toString()}return this.persistedDistinctId}};var VIs;async function uPn(){return VIs==null&&(VIs=await bWS()),VIs}async function bWS(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new ila;let r=await byo();return r!=null?new nla({token:r,posthogApiKey:e}):await vyo()!=null?new hPo({posthogApiKey:e}):new nla({token:void 0,posthogApiKey:e})}catch{return new ila}}function ala(e,t){return function(){return e.apply(t,arguments)}}var{toString:gWS}=Object.prototype,{getPrototypeOf:HIs}=Object,gPo=(e=>t=>{let r=gWS.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),g5t=e=>(e=e.toLowerCase(),t=>gPo(t)===e),OPo=e=>t=>typeof t===e,{isArray:sPn}=Array,ola=OPo("undefined");function OWS(e){return e!==null&&!ola(e)&&e.constructor!==null&&!ola(e.constructor)&&WSe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var Rfp=g5t("ArrayBuffer");function mWS(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Rfp(e.buffer),t}var PWS=OPo("string"),WSe=OPo("function"),Nfp=OPo("number"),mPo=e=>e!==null&&typeof e=="object",jWS=e=>e===!0||e===!1,bPo=e=>{if(gPo(e)!=="object")return!1;let t=HIs(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},wWS=g5t("Date"),SWS=g5t("File"),DWS=g5t("Blob"),EWS=g5t("FileList"),MWS=e=>mPo(e)&&WSe(e.pipe),AWS=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||WSe(e.append)&&((t=gPo(e))==="formdata"||t==="object"&&WSe(e.toString)&&e.toString()==="[object FormData]"))},qWS=g5t("URLSearchParams"),[TWS,CWS,BWS,xWS]=["ReadableStream","Request","Response","Headers"].map(g5t),IWS=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function ula(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),sPn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,l;for(i=0;i<u;i++)l=a[i],t.call(null,e[l],l,e)}}function Ffp(e,t){t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var izi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,Lfp=e=>!ola(e)&&e!==izi;function WIs(){let{caseless:e}=Lfp(this)&&this||{},t={},r=(i,n)=>{let a=e&&Ffp(t,n)||n;bPo(t[a])&&bPo(i)?t[a]=WIs(t[a],i):bPo(i)?t[a]=WIs({},i):sPn(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&ula(arguments[i],r);return t}var zWS=(e,t,r,{allOwnKeys:i}={})=>(ula(t,(n,a)=>{r&&WSe(n)?e[a]=ala(n,r):e[a]=n},{allOwnKeys:i}),e),RWS=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),NWS=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},FWS=(e,t,r,i)=>{let n,a,u,l={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!l[u]&&(t[u]=e[u],l[u]=!0);e=r!==!1&&HIs(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},LWS=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},UWS=e=>{if(!e)return null;if(sPn(e))return e;let t=e.length;if(!Nfp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},VWS=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&HIs(Uint8Array)),WWS=(e,t)=>{let i=(e&&e[Symbol.iterator]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},HWS=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},$WS=g5t("HTMLFormElement"),GWS=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),zfp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),QWS=g5t("RegExp"),Ufp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};ula(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},JWS=e=>{Ufp(e,(t,r)=>{if(WSe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(WSe(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},KWS=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return sPn(e)?i(e):i(String(e).split(t)),r},YWS=()=>{},XWS=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function ZWS(e){return!!(e&&WSe(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var kWS=e=>{let t=new Array(10),r=(i,n)=>{if(mPo(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=sPn(i)?[]:{};return ula(i,(u,l)=>{let d=r(u,n+1);!ola(d)&&(a[l]=d)}),t[n]=void 0,a}}return i};return r(e,0)},eHS=g5t("AsyncFunction"),tHS=e=>e&&(mPo(e)||WSe(e))&&WSe(e.then)&&WSe(e.catch),Vfp=((e,t)=>e?setImmediate:t?((r,i)=>(izi.addEventListener("message",({source:n,data:a})=>{n===izi&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),izi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",WSe(izi.postMessage)),rHS=typeof queueMicrotask<"u"?queueMicrotask.bind(izi):typeof process<"u"&&process.nextTick||Vfp,ds={isArray:sPn,isArrayBuffer:Rfp,isBuffer:OWS,isFormData:AWS,isArrayBufferView:mWS,isString:PWS,isNumber:Nfp,isBoolean:jWS,isObject:mPo,isPlainObject:bPo,isReadableStream:TWS,isRequest:CWS,isResponse:BWS,isHeaders:xWS,isUndefined:ola,isDate:wWS,isFile:SWS,isBlob:DWS,isRegExp:QWS,isFunction:WSe,isStream:MWS,isURLSearchParams:qWS,isTypedArray:VWS,isFileList:EWS,forEach:ula,merge:WIs,extend:zWS,trim:IWS,stripBOM:RWS,inherits:NWS,toFlatObject:FWS,kindOf:gPo,kindOfTest:g5t,endsWith:LWS,toArray:UWS,forEachEntry:WWS,matchAll:HWS,isHTMLForm:$WS,hasOwnProperty:zfp,hasOwnProp:zfp,reduceDescriptors:Ufp,freezeMethods:JWS,toObjectSet:KWS,toCamelCase:GWS,noop:YWS,toFiniteNumber:XWS,findKey:Ffp,global:izi,isContextDefined:Lfp,isSpecCompliantForm:ZWS,toJSONObject:kWS,isAsyncFn:eHS,isThenable:tHS,setImmediate:Vfp,asap:rHS};function cPn(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}ds.inherits(cPn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ds.toJSONObject(this.config),code:this.code,status:this.status}}});var Wfp=cPn.prototype,Hfp={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Hfp[e]={value:e}});Object.defineProperties(cPn,Hfp);Object.defineProperty(Wfp,"isAxiosError",{value:!0});cPn.from=(e,t,r,i,n,a)=>{let u=Object.create(Wfp);return ds.toFlatObject(e,u,function(d){return d!==Error.prototype},l=>l!=="isAxiosError"),cPn.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var Dp=cPn;var $fp=di(Ria(),1),PPo=$fp.default;function $Is(e){return ds.isPlainObject(e)||ds.isArray(e)}function Qfp(e){return ds.endsWith(e,"[]")?e.slice(0,-2):e}function Gfp(e,t,r){return e?e.concat(t).map(function(n,a){return n=Qfp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function iHS(e){return ds.isArray(e)&&!e.some($Is)}var nHS=ds.toFlatObject(ds,{},null,function(t){return/^is[A-Z]/.test(t)});function aHS(e,t,r){if(!ds.isObject(e))throw new TypeError("target must be an object");t=t||new(PPo||FormData),r=ds.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,P){return!ds.isUndefined(P[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&ds.isSpecCompliantForm(t);if(!ds.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(ds.isDate(O))return O.toISOString();if(!d&&ds.isBlob(O))throw new Dp("Blob is not supported. Use a Buffer instead.");return ds.isArrayBuffer(O)||ds.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,P){let E=O;if(O&&!P&&typeof O=="object"){if(ds.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(ds.isArray(O)&&iHS(O)||(ds.isFileList(O)||ds.endsWith(m,"[]"))&&(E=ds.toArray(O)))return m=Qfp(m),E.forEach(function(q,D){!(ds.isUndefined(q)||q===null)&&t.append(u===!0?Gfp([m],D,a):u===null?m:m+"[]",s(q))}),!1}return $Is(O)?!0:(t.append(Gfp(P,m,a),s(O)),!1)}let c=[],b=Object.assign(nHS,{defaultVisitor:o,convertValue:s,isVisitable:$Is});function g(O,m){if(!ds.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),ds.forEach(O,function(E,A){(!(ds.isUndefined(E)||E===null)&&n.call(t,E,ds.isString(A)?A.trim():A,m,b))===!0&&g(E,m?m.concat(A):[A])}),c.pop()}}if(!ds.isObject(e))throw new TypeError("data must be an object");return g(e),t}var Sfi=aHS;function Jfp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function Kfp(e,t){this._pairs=[],e&&Sfi(e,this,t)}var Yfp=Kfp.prototype;Yfp.append=function(t,r){this._pairs.push([t,r])};Yfp.toString=function(t){let r=t?function(i){return t.call(this,i,Jfp)}:Jfp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var Xfp=Kfp;function oHS(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function nzi(e,t,r){if(!t)return e;let i=r&&r.encode||oHS;ds.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=ds.isURLSearchParams(t)?t.toString():new Xfp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var GIs=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ds.forEach(this.handlers,function(i){i!==null&&t(i)})}},QIs=GIs;var lPn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var tdp=di(require("crypto"),1);var Zfp=di(require("url"),1),kfp=Zfp.default.URLSearchParams;var JIs="abcdefghijklmnopqrstuvwxyz",edp="0123456789",rdp={DIGIT:edp,ALPHA:JIs,ALPHA_DIGIT:JIs+JIs.toUpperCase()+edp},uHS=(e=16,t=rdp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);tdp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},idp={isNode:!0,classes:{URLSearchParams:kfp,FormData:PPo,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:rdp,generateString:uHS,protocols:["http","https","file","data"]};var XIs={};Eo(XIs,{hasBrowserEnv:()=>YIs,hasStandardBrowserEnv:()=>sHS,hasStandardBrowserWebWorkerEnv:()=>cHS,navigator:()=>KIs,origin:()=>lHS});var YIs=typeof window<"u"&&typeof document<"u",KIs=typeof navigator=="object"&&navigator||void 0,sHS=YIs&&(!KIs||["ReactNative","NativeScript","NS"].indexOf(KIs.product)<0),cHS=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",lHS=YIs&&window.location.href||"http://localhost";var SM={...XIs,...idp};function ZIs(e,t){return Sfi(e,new SM.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return SM.isNode&&ds.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function fHS(e){return ds.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function dHS(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function pHS(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),d=a>=r.length;return u=!u&&ds.isArray(n)?n.length:u,d?(ds.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!ds.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&ds.isArray(n[u])&&(n[u]=dHS(n[u])),!l)}if(ds.isFormData(e)&&ds.isFunction(e.entries)){let r={};return ds.forEachEntry(e,(i,n)=>{t(fHS(i),n,r,0)}),r}return null}var jPo=pHS;function _HS(e,t,r){if(ds.isString(e))try{return(t||JSON.parse)(e),ds.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var kIs={transitional:lPn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=ds.isObject(t);if(a&&ds.isHTMLForm(t)&&(t=new FormData(t)),ds.isFormData(t))return n?JSON.stringify(jPo(t)):t;if(ds.isArrayBuffer(t)||ds.isBuffer(t)||ds.isStream(t)||ds.isFile(t)||ds.isBlob(t)||ds.isReadableStream(t))return t;if(ds.isArrayBufferView(t))return t.buffer;if(ds.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let l;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return ZIs(t,this.formSerializer).toString();if((l=ds.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return Sfi(l?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),_HS(t)):t}],transformResponse:[function(t){let r=this.transitional||kIs.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(ds.isResponse(t)||ds.isReadableStream(t))return t;if(t&&ds.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(l){if(u)throw l.name==="SyntaxError"?Dp.from(l,Dp.ERR_BAD_RESPONSE,this,null,this.response):l}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:SM.classes.FormData,Blob:SM.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ds.forEach(["delete","get","head","post","put","patch"],e=>{kIs.headers[e]={}});var fPn=kIs;var hHS=ds.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),ndp=e=>{let t={},r,i,n;return e&&e.split(`
|
|
1705
1705
|
`).forEach(function(u){n=u.indexOf(":"),r=u.substring(0,n).trim().toLowerCase(),i=u.substring(n+1).trim(),!(!r||t[r]&&hHS[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var adp=Symbol("internals");function sla(e){return e&&String(e).trim().toLowerCase()}function wPo(e){return e===!1||e==null?e:ds.isArray(e)?e.map(wPo):String(e)}function yHS(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}var vHS=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ezs(e,t,r,i,n){if(ds.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!ds.isString(t)){if(ds.isString(i))return t.indexOf(i)!==-1;if(ds.isRegExp(i))return i.test(t)}}function bHS(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function gHS(e,t){let r=ds.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(n,a,u){return this[i].call(this,t,n,a,u)},configurable:!0})})}var dPn=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(l,d,s){let o=sla(d);if(!o)throw new Error("header name must be a non-empty string");let c=ds.findKey(n,o);(!c||n[c]===void 0||s===!0||s===void 0&&n[c]!==!1)&&(n[c||d]=wPo(l))}let u=(l,d)=>ds.forEach(l,(s,o)=>a(s,o,d));if(ds.isPlainObject(t)||t instanceof this.constructor)u(t,r);else if(ds.isString(t)&&(t=t.trim())&&!vHS(t))u(ndp(t),r);else if(ds.isHeaders(t))for(let[l,d]of t.entries())a(d,l,i);else t!=null&&a(r,t,i);return this}get(t,r){if(t=sla(t),t){let i=ds.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return yHS(n);if(ds.isFunction(r))return r.call(this,n,i);if(ds.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=sla(t),t){let i=ds.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||ezs(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(u){if(u=sla(u),u){let l=ds.findKey(i,u);l&&(!r||ezs(i,i[l],l,r))&&(delete i[l],n=!0)}}return ds.isArray(t)?t.forEach(a):a(t),n}clear(t){let r=Object.keys(this),i=r.length,n=!1;for(;i--;){let a=r[i];(!t||ezs(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return ds.forEach(this,(n,a)=>{let u=ds.findKey(i,a);if(u){r[u]=wPo(n),delete r[a];return}let l=t?bHS(a):String(a).trim();l!==a&&delete r[a],r[l]=wPo(n),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return ds.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&ds.isArray(i)?i.join(", "):i)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
1706
1706
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let i=new this(t);return r.forEach(n=>i.set(n)),i}static accessor(t){let i=(this[adp]=this[adp]={accessors:{}}).accessors,n=this.prototype;function a(u){let l=sla(u);i[l]||(gHS(n,u),i[l]=!0)}return ds.isArray(t)?t.forEach(a):a(t),this}};dPn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ds.reduceDescriptors(dPn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});ds.freezeMethods(dPn);var _z=dPn;function cla(e,t){let r=this||fPn,i=t||r,n=_z.from(i.headers),a=i.data;return ds.forEach(e,function(l){a=l.call(r,a,n.normalize(),t?t.status:void 0)}),n.normalize(),a}function lla(e){return!!(e&&e.__CANCEL__)}function odp(e,t,r){Dp.call(this,e??"canceled",Dp.ERR_CANCELED,t,r),this.name="CanceledError"}ds.inherits(odp,Dp,{__CANCEL__:!0});var HSe=odp;function $Yt(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new Dp("Request failed with status code "+r.status,[Dp.ERR_BAD_REQUEST,Dp.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function tzs(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function rzs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function azi(e,t,r){let i=!tzs(t);return e&&i||r==!1?rzs(e,t):t}var Pdp=di($ca(),1),jdp=di(require("http"),1),wdp=di(require("https"),1),Sdp=di(require("util"),1),Ddp=di(cIs(),1),IJr=di(require("zlib"),1);var ozi="1.8.2";function fla(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var OHS=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function izs(e,t,r){let i=r&&r.Blob||SM.classes.Blob,n=fla(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=OHS.exec(e);if(!a)throw new Dp("Invalid URL",Dp.ERR_INVALID_URL);let u=a[1],l=a[2],d=a[3],s=Buffer.from(decodeURIComponent(d),l?"base64":"utf8");if(t){if(!i)throw new Dp("Blob is not supported",Dp.ERR_NOT_SUPPORT);return new i([s],{type:u})}return s}throw new Dp("Unsupported protocol "+n,Dp.ERR_NOT_SUPPORT)}var uzi=di(require("stream"),1);var udp=di(require("stream"),1);var nzs=Symbol("internals"),azs=class extends udp.default.Transform{constructor(t){t=ds.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!ds.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[nzs]={timeWindow:t.timeWindow,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",i=>{i==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[nzs];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[nzs],a=n.maxRate,u=this.readableHighWaterMark,l=n.timeWindow,d=1e3/l,s=a/d,o=n.minChunkSize!==!1?Math.max(n.minChunkSize,s*.01):0,c=(g,O)=>{let m=Buffer.byteLength(g);n.bytesSeen+=m,n.bytes+=m,n.isCaptured&&this.emit("progress",n.bytesSeen),this.push(g)?process.nextTick(O):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(O)}},b=(g,O)=>{let m=Buffer.byteLength(g),P=null,E=u,A,q=0;if(a){let D=Date.now();(!n.ts||(q=D-n.ts)>=l)&&(n.ts=D,A=s-n.bytes,n.bytes=A<0?-A:0,q=0),A=s-n.bytes}if(a){if(A<=0)return setTimeout(()=>{O(null,g)},l-q);A<E&&(E=A)}E&&m>E&&m-E>o&&(P=g.subarray(E),g=g.subarray(0,E)),c(g,P?()=>{process.nextTick(O,null,P)}:O)};b(t,function g(O,m){if(O)return i(O);m?b(m,g):i(null)})}},ozs=azs;var Edp=require("events");var cdp=di(require("util"),1),ldp=require("stream");var{asyncIterator:sdp}=Symbol,mHS=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[sdp]?yield*e[sdp]():yield e},SPo=mHS;var PHS=SM.ALPHABET.ALPHA_DIGIT+"-_",dla=typeof TextEncoder=="function"?new TextEncoder:new cdp.default.TextEncoder,Dfi=`\r
|
|
1707
1707
|
`,jHS=dla.encode(Dfi),wHS=2,uzs=class{constructor(t,r){let{escapeName:i}=this.constructor,n=ds.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${Dfi}`;n?r=dla.encode(String(r).replace(/\r?\n|\r\n?/g,Dfi)):a+=`Content-Type: ${r.type||"application/octet-stream"}${Dfi}`,this.headers=dla.encode(a+Dfi),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+wHS,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;ds.isTypedArray(t)?yield t:yield*SPo(t),yield jHS}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},SHS=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+SM.generateString(n,PHS)}=r||{};if(!ds.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let u=dla.encode("--"+a+Dfi),l=dla.encode("--"+a+"--"+Dfi+Dfi),d=l.byteLength,s=Array.from(e.entries()).map(([c,b])=>{let g=new uzs(c,b);return d+=g.size,g});d+=u.byteLength*s.length,d=ds.toFiniteNumber(d);let o={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(d)&&(o["Content-Length"]=d),t&&t(o),ldp.Readable.from(async function*(){for(let c of s)yield u,yield*c.encode();yield l}())},fdp=SHS;var ddp=di(require("stream"),1),szs=class extends ddp.default.Transform{__transform(t,r,i){this.push(t),i()}_transform(t,r,i){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let n=Buffer.alloc(2);n[0]=120,n[1]=156,this.push(n,r)}this.__transform(t,r,i)}},pdp=szs;var DHS=(e,t)=>ds.isAsyncFn(e)?function(...r){let i=r.pop();e.apply(this,r).then(n=>{try{t?i(null,...t(n)):i(null,n)}catch(a){i(a)}},i)}:e,_dp=DHS;function EHS(e,t){e=e||10;let r=new Array(e),i=new Array(e),n=0,a=0,u;return t=t!==void 0?t:1e3,function(d){let s=Date.now(),o=i[a];u||(u=s),r[n]=d,i[n]=s;let c=a,b=0;for(;c!==n;)b+=r[c++],c=c%e;if(n=(n+1)%e,n===a&&(a=(a+1)%e),s-u<t)return;let g=o&&s-o;return g?Math.round(b*1e3/g):void 0}}var hdp=EHS;function MHS(e,t){let r=0,i=1e3/t,n,a,u=(s,o=Date.now())=>{r=o,n=null,a&&(clearTimeout(a),a=null),e.apply(null,s)};return[(...s)=>{let o=Date.now(),c=o-r;c>=i?u(s,o):(n=s,a||(a=setTimeout(()=>{a=null,u(n)},i-c)))},()=>n&&u(n)]}var ydp=MHS;var xJr=(e,t,r=3)=>{let i=0,n=hdp(50,250);return ydp(a=>{let u=a.loaded,l=a.lengthComputable?a.total:void 0,d=u-i,s=n(d),o=u<=l;i=u;let c={loaded:u,total:l,progress:l?u/l:void 0,bytes:d,rate:s||void 0,estimated:s&&l&&o?(l-u)/s:void 0,event:a,lengthComputable:l!=null,[t?"download":"upload"]:!0};e(c)},r)},pPn=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},_Pn=e=>(...t)=>ds.asap(()=>e(...t));var vdp={flush:IJr.default.constants.Z_SYNC_FLUSH,finishFlush:IJr.default.constants.Z_SYNC_FLUSH},AHS={flush:IJr.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:IJr.default.constants.BROTLI_OPERATION_FLUSH},bdp=ds.isFunction(IJr.default.createBrotliDecompress),{http:qHS,https:THS}=Ddp.default,CHS=/https:?/,gdp=SM.protocols.map(e=>e+":"),Odp=(e,[t,r])=>(e.on("end",r).on("error",r),t);function BHS(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function Mdp(e,t,r){let i=t;if(!i&&i!==!1){let n=Pdp.default.getProxyForUrl(r);n&&(i=new URL(n))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));let a=Buffer.from(i.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let n=i.hostname||i.host;e.hostname=n,e.host=n,e.port=i.port,e.path=r,i.protocol&&(e.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}e.beforeRedirects.proxy=function(a){Mdp(a,t,a.href)}}var xHS=typeof process<"u"&&ds.kindOf(process)==="process",IHS=e=>new Promise((t,r)=>{let i,n,a=(d,s)=>{n||(n=!0,i&&i(d,s))},u=d=>{a(d),t(d)},l=d=>{a(d,!0),r(d)};e(u,l,d=>i=d).catch(l)}),zHS=({address:e,family:t})=>{if(!ds.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},mdp=(e,t)=>zHS(ds.isObject(e)?e:{address:e,family:t}),Adp=xHS&&function(t){return IHS(async function(i,n,a){let{data:u,lookup:l,family:d}=t,{responseType:s,responseEncoding:o}=t,c=t.method.toUpperCase(),b,g=!1,O;if(l){let Se=_dp(l,Qe=>ds.isArray(Qe)?Qe:[Qe]);l=(Qe,St,Ee)=>{Se(Qe,St,(Te,xt,Pe)=>{if(Te)return Ee(Te);let Ot=ds.isArray(xt)?xt.map(at=>mdp(at)):[mdp(xt,Pe)];St.all?Ee(Te,Ot):Ee(Te,Ot[0].address,Ot[0].family)})}}let m=new Edp.EventEmitter,P=()=>{t.cancelToken&&t.cancelToken.unsubscribe(E),t.signal&&t.signal.removeEventListener("abort",E),m.removeAllListeners()};a((Se,Qe)=>{b=!0,Qe&&(g=!0,P())});function E(Se){m.emit("abort",!Se||Se.type?new HSe(null,t,O):Se)}m.once("abort",n),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(E),t.signal&&(t.signal.aborted?E():t.signal.addEventListener("abort",E)));let A=azi(t.baseURL,t.url,t.allowAbsoluteUrls),q=new URL(A,SM.hasBrowserEnv?SM.origin:void 0),D=q.protocol||gdp[0];if(D==="data:"){let Se;if(c!=="GET")return $Yt(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{Se=izs(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(Qe){throw Dp.from(Qe,Dp.ERR_BAD_REQUEST,t)}return s==="text"?(Se=Se.toString(o),(!o||o==="utf8")&&(Se=ds.stripBOM(Se))):s==="stream"&&(Se=uzi.default.Readable.from(Se)),$Yt(i,n,{data:Se,status:200,statusText:"OK",headers:new _z,config:t})}if(gdp.indexOf(D)===-1)return n(new Dp("Unsupported protocol "+D,Dp.ERR_BAD_REQUEST,t));let C=_z.from(t.headers).normalize();C.set("User-Agent","axios/"+ozi,!1);let{onUploadProgress:z,onDownloadProgress:$}=t,x=t.maxRate,L,V;if(ds.isSpecCompliantForm(u)){let Se=C.getContentType(/boundary=([-_\w\d]{10,70})/i);u=fdp(u,Qe=>{C.set(Qe)},{tag:`axios-${ozi}-boundary`,boundary:Se&&Se[1]||void 0})}else if(ds.isFormData(u)&&ds.isFunction(u.getHeaders)){if(C.set(u.getHeaders()),!C.hasContentLength())try{let Se=await Sdp.default.promisify(u.getLength).call(u);Number.isFinite(Se)&&Se>=0&&C.setContentLength(Se)}catch{}}else if(ds.isBlob(u)||ds.isFile(u))u.size&&C.setContentType(u.type||"application/octet-stream"),C.setContentLength(u.size||0),u=uzi.default.Readable.from(SPo(u));else if(u&&!ds.isStream(u)){if(!Buffer.isBuffer(u))if(ds.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(ds.isString(u))u=Buffer.from(u,"utf-8");else return n(new Dp("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Dp.ERR_BAD_REQUEST,t));if(C.setContentLength(u.length,!1),t.maxBodyLength>-1&&u.length>t.maxBodyLength)return n(new Dp("Request body larger than maxBodyLength limit",Dp.ERR_BAD_REQUEST,t))}let Z=ds.toFiniteNumber(C.getContentLength());ds.isArray(x)?(L=x[0],V=x[1]):L=V=x,u&&(z||L)&&(ds.isStream(u)||(u=uzi.default.Readable.from(u,{objectMode:!1})),u=uzi.default.pipeline([u,new ozs({maxRate:ds.toFiniteNumber(L)})],ds.noop),z&&u.on("progress",Odp(u,pPn(Z,xJr(_Pn(z),!1,3)))));let K;if(t.auth){let Se=t.auth.username||"",Qe=t.auth.password||"";K=Se+":"+Qe}if(!K&&q.username){let Se=q.username,Qe=q.password;K=Se+":"+Qe}K&&C.delete("authorization");let X;try{X=nzi(q.pathname+q.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(Se){let Qe=new Error(Se.message);return Qe.config=t,Qe.url=t.url,Qe.exists=!0,n(Qe)}C.set("Accept-Encoding","gzip, compress, deflate"+(bdp?", br":""),!1);let le={path:X,method:c,headers:C.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:K,protocol:D,family:d,beforeRedirect:BHS,beforeRedirects:{}};!ds.isUndefined(l)&&(le.lookup=l),t.socketPath?le.socketPath=t.socketPath:(le.hostname=q.hostname.startsWith("[")?q.hostname.slice(1,-1):q.hostname,le.port=q.port,Mdp(le,t.proxy,D+"//"+q.hostname+(q.port?":"+q.port:"")+le.path));let ge,_e=CHS.test(le.protocol);if(le.agent=_e?t.httpsAgent:t.httpAgent,t.transport?ge=t.transport:t.maxRedirects===0?ge=_e?wdp.default:jdp.default:(t.maxRedirects&&(le.maxRedirects=t.maxRedirects),t.beforeRedirect&&(le.beforeRedirects.config=t.beforeRedirect),ge=_e?THS:qHS),t.maxBodyLength>-1?le.maxBodyLength=t.maxBodyLength:le.maxBodyLength=1/0,t.insecureHTTPParser&&(le.insecureHTTPParser=t.insecureHTTPParser),O=ge.request(le,function(Qe){if(O.destroyed)return;let St=[Qe],Ee=+Qe.headers["content-length"];if($||V){let at=new ozs({maxRate:ds.toFiniteNumber(V)});$&&at.on("progress",Odp(at,pPn(Ee,xJr(_Pn($),!0,3)))),St.push(at)}let Te=Qe,xt=Qe.req||O;if(t.decompress!==!1&&Qe.headers["content-encoding"])switch((c==="HEAD"||Qe.statusCode===204)&&delete Qe.headers["content-encoding"],(Qe.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":St.push(IJr.default.createUnzip(vdp)),delete Qe.headers["content-encoding"];break;case"deflate":St.push(new pdp),St.push(IJr.default.createUnzip(vdp)),delete Qe.headers["content-encoding"];break;case"br":bdp&&(St.push(IJr.default.createBrotliDecompress(AHS)),delete Qe.headers["content-encoding"])}Te=St.length>1?uzi.default.pipeline(St,ds.noop):St[0];let Pe=uzi.default.finished(Te,()=>{Pe(),P()}),Ot={status:Qe.statusCode,statusText:Qe.statusMessage,headers:new _z(Qe.headers),config:t,request:xt};if(s==="stream")Ot.data=Te,$Yt(i,n,Ot);else{let at=[],he=0;Te.on("data",function(bt){at.push(bt),he+=bt.length,t.maxContentLength>-1&&he>t.maxContentLength&&(g=!0,Te.destroy(),n(new Dp("maxContentLength size of "+t.maxContentLength+" exceeded",Dp.ERR_BAD_RESPONSE,t,xt)))}),Te.on("aborted",function(){if(g)return;let bt=new Dp("stream has been aborted",Dp.ERR_BAD_RESPONSE,t,xt);Te.destroy(bt),n(bt)}),Te.on("error",function(bt){O.destroyed||n(Dp.from(bt,null,t,xt))}),Te.on("end",function(){try{let bt=at.length===1?at[0]:Buffer.concat(at);s!=="arraybuffer"&&(bt=bt.toString(o),(!o||o==="utf8")&&(bt=ds.stripBOM(bt))),Ot.data=bt}catch(bt){return n(Dp.from(bt,null,t,Ot.request,Ot))}$Yt(i,n,Ot)})}m.once("abort",at=>{Te.destroyed||(Te.emit("error",at),Te.destroy())})}),m.once("abort",Se=>{n(Se),O.destroy(Se)}),O.on("error",function(Qe){n(Dp.from(Qe,null,t,O))}),O.on("socket",function(Qe){Qe.setKeepAlive(!0,1e3*60)}),t.timeout){let Se=parseInt(t.timeout,10);if(Number.isNaN(Se)){n(new Dp("error trying to parse `config.timeout` to int",Dp.ERR_BAD_OPTION_VALUE,t,O));return}O.setTimeout(Se,function(){if(b)return;let St=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",Ee=t.transitional||lPn;t.timeoutErrorMessage&&(St=t.timeoutErrorMessage),n(new Dp(St,Ee.clarifyTimeoutError?Dp.ETIMEDOUT:Dp.ECONNABORTED,t,O)),E()})}if(ds.isStream(u)){let Se=!1,Qe=!1;u.on("end",()=>{Se=!0}),u.once("error",St=>{Qe=!0,O.destroy(St)}),u.on("close",()=>{!Se&&!Qe&&E(new HSe("Request stream has been aborted",t,O))}),u.pipe(O)}else O.end(u)})};var qdp=SM.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,SM.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(SM.origin),SM.navigator&&/(msie|trident)/i.test(SM.navigator.userAgent)):()=>!0;var Tdp=SM.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let u=[e+"="+encodeURIComponent(t)];ds.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),ds.isString(i)&&u.push("path="+i),ds.isString(n)&&u.push("domain="+n),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var Cdp=e=>e instanceof _z?{...e}:e;function O5t(e,t){t=t||{};let r={};function i(s,o,c,b){return ds.isPlainObject(s)&&ds.isPlainObject(o)?ds.merge.call({caseless:b},s,o):ds.isPlainObject(o)?ds.merge({},o):ds.isArray(o)?o.slice():o}function n(s,o,c,b){if(ds.isUndefined(o)){if(!ds.isUndefined(s))return i(void 0,s,c,b)}else return i(s,o,c,b)}function a(s,o){if(!ds.isUndefined(o))return i(void 0,o)}function u(s,o){if(ds.isUndefined(o)){if(!ds.isUndefined(s))return i(void 0,s)}else return i(void 0,o)}function l(s,o,c){if(c in t)return i(s,o);if(c in e)return i(void 0,s)}let d={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:l,headers:(s,o,c)=>n(Cdp(s),Cdp(o),c,!0)};return ds.forEach(Object.keys(Object.assign({},e,t)),function(o){let c=d[o]||n,b=c(e[o],t[o],o);ds.isUndefined(b)&&c!==l||(r[o]=b)}),r}var DPo=e=>{let t=O5t({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:u,auth:l}=t;t.headers=u=_z.from(u),t.url=nzi(azi(t.baseURL,t.url),e.params,e.paramsSerializer),l&&u.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let d;if(ds.isFormData(r)){if(SM.hasStandardBrowserEnv||SM.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((d=u.getContentType())!==!1){let[s,...o]=d?d.split(";").map(c=>c.trim()).filter(Boolean):[];u.setContentType([s||"multipart/form-data",...o].join("; "))}}if(SM.hasStandardBrowserEnv&&(i&&ds.isFunction(i)&&(i=i(t)),i||i!==!1&&qdp(t.url))){let s=n&&a&&Tdp.read(a);s&&u.set(n,s)}return t};var RHS=typeof XMLHttpRequest<"u",Bdp=RHS&&function(e){return new Promise(function(r,i){let n=DPo(e),a=n.data,u=_z.from(n.headers).normalize(),{responseType:l,onUploadProgress:d,onDownloadProgress:s}=n,o,c,b,g,O;function m(){g&&g(),O&&O(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let P=new XMLHttpRequest;P.open(n.method.toUpperCase(),n.url,!0),P.timeout=n.timeout;function E(){if(!P)return;let q=_z.from("getAllResponseHeaders"in P&&P.getAllResponseHeaders()),C={data:!l||l==="text"||l==="json"?P.responseText:P.response,status:P.status,statusText:P.statusText,headers:q,config:e,request:P};$Yt(function($){r($),m()},function($){i($),m()},C),P=null}"onloadend"in P?P.onloadend=E:P.onreadystatechange=function(){!P||P.readyState!==4||P.status===0&&!(P.responseURL&&P.responseURL.indexOf("file:")===0)||setTimeout(E)},P.onabort=function(){P&&(i(new Dp("Request aborted",Dp.ECONNABORTED,e,P)),P=null)},P.onerror=function(){i(new Dp("Network Error",Dp.ERR_NETWORK,e,P)),P=null},P.ontimeout=function(){let D=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",C=n.transitional||lPn;n.timeoutErrorMessage&&(D=n.timeoutErrorMessage),i(new Dp(D,C.clarifyTimeoutError?Dp.ETIMEDOUT:Dp.ECONNABORTED,e,P)),P=null},a===void 0&&u.setContentType(null),"setRequestHeader"in P&&ds.forEach(u.toJSON(),function(D,C){P.setRequestHeader(C,D)}),ds.isUndefined(n.withCredentials)||(P.withCredentials=!!n.withCredentials),l&&l!=="json"&&(P.responseType=n.responseType),s&&([b,O]=xJr(s,!0),P.addEventListener("progress",b)),d&&P.upload&&([c,g]=xJr(d),P.upload.addEventListener("progress",c),P.upload.addEventListener("loadend",g)),(n.cancelToken||n.signal)&&(o=q=>{P&&(i(!q||q.type?new HSe(null,e,P):q),P.abort(),P=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));let A=fla(n.url);if(A&&SM.protocols.indexOf(A)===-1){i(new Dp("Unsupported protocol "+A+":",Dp.ERR_BAD_REQUEST,e));return}P.send(a||null)})};var NHS=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let i=new AbortController,n,a=function(s){if(!n){n=!0,l();let o=s instanceof Error?s:this.reason;i.abort(o instanceof Dp?o:new HSe(o instanceof Error?o.message:o))}},u=t&&setTimeout(()=>{u=null,a(new Dp(`timeout ${t} of ms exceeded`,Dp.ETIMEDOUT))},t),l=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(s=>{s.unsubscribe?s.unsubscribe(a):s.removeEventListener("abort",a)}),e=null)};e.forEach(s=>s.addEventListener("abort",a));let{signal:d}=i;return d.unsubscribe=()=>ds.asap(l),d}},xdp=NHS;var FHS=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let i=0,n;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},LHS=async function*(e,t){for await(let r of UHS(e))yield*FHS(r,t)},UHS=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:i}=await t.read();if(r)break;yield i}}finally{await t.cancel()}},czs=(e,t,r,i)=>{let n=LHS(e,t),a=0,u,l=d=>{u||(u=!0,i&&i(d))};return new ReadableStream({async pull(d){try{let{done:s,value:o}=await n.next();if(s){l(),d.close();return}let c=o.byteLength;if(r){let b=a+=c;r(b)}d.enqueue(new Uint8Array(o))}catch(s){throw l(s),s}},cancel(d){return l(d),n.return()}},{highWaterMark:2})};var MPo=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",zdp=MPo&&typeof ReadableStream=="function",VHS=MPo&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Rdp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},WHS=zdp&&Rdp(()=>{let e=!1,t=new Request(SM.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Idp=64*1024,lzs=zdp&&Rdp(()=>ds.isReadableStream(new Response("").body)),EPo={stream:lzs&&(e=>e.body)};MPo&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!EPo[t]&&(EPo[t]=ds.isFunction(e[t])?r=>r[t]():(r,i)=>{throw new Dp(`Response type '${t}' is not supported`,Dp.ERR_NOT_SUPPORT,i)})})})(new Response);var HHS=async e=>{if(e==null)return 0;if(ds.isBlob(e))return e.size;if(ds.isSpecCompliantForm(e))return(await new Request(SM.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(ds.isArrayBufferView(e)||ds.isArrayBuffer(e))return e.byteLength;if(ds.isURLSearchParams(e)&&(e=e+""),ds.isString(e))return(await VHS(e)).byteLength},$HS=async(e,t)=>{let r=ds.toFiniteNumber(e.getContentLength());return r??HHS(t)},Ndp=MPo&&(async e=>{let{url:t,method:r,data:i,signal:n,cancelToken:a,timeout:u,onDownloadProgress:l,onUploadProgress:d,responseType:s,headers:o,withCredentials:c="same-origin",fetchOptions:b}=DPo(e);s=s?(s+"").toLowerCase():"text";let g=xdp([n,a&&a.toAbortSignal()],u),O,m=g&&g.unsubscribe&&(()=>{g.unsubscribe()}),P;try{if(d&&WHS&&r!=="get"&&r!=="head"&&(P=await $HS(o,i))!==0){let C=new Request(t,{method:"POST",body:i,duplex:"half"}),z;if(ds.isFormData(i)&&(z=C.headers.get("content-type"))&&o.setContentType(z),C.body){let[$,x]=pPn(P,xJr(_Pn(d)));i=czs(C.body,Idp,$,x)}}ds.isString(c)||(c=c?"include":"omit");let E="credentials"in Request.prototype;O=new Request(t,{...b,signal:g,method:r.toUpperCase(),headers:o.normalize().toJSON(),body:i,duplex:"half",credentials:E?c:void 0});let A=await fetch(O),q=lzs&&(s==="stream"||s==="response");if(lzs&&(l||q&&m)){let C={};["status","statusText","headers"].forEach(L=>{C[L]=A[L]});let z=ds.toFiniteNumber(A.headers.get("content-length")),[$,x]=l&&pPn(z,xJr(_Pn(l),!0))||[];A=new Response(czs(A.body,Idp,$,()=>{x&&x(),m&&m()}),C)}s=s||"text";let D=await EPo[ds.findKey(EPo,s)||"text"](A,e);return!q&&m&&m(),await new Promise((C,z)=>{$Yt(C,z,{data:D,headers:_z.from(A.headers),status:A.status,statusText:A.statusText,config:e,request:O})})}catch(E){throw m&&m(),E&&E.name==="TypeError"&&/fetch/i.test(E.message)?Object.assign(new Dp("Network Error",Dp.ERR_NETWORK,e,O),{cause:E.cause||E}):Dp.from(E,E&&E.code,e,O)}});var fzs={http:Adp,xhr:Bdp,fetch:Ndp};ds.forEach(fzs,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var Fdp=e=>`- ${e}`,GHS=e=>ds.isFunction(e)||e===null||e===!1,APo={getAdapter:e=>{e=ds.isArray(e)?e:[e];let{length:t}=e,r,i,n={};for(let a=0;a<t;a++){r=e[a];let u;if(i=r,!GHS(r)&&(i=fzs[(u=String(r)).toLowerCase()],i===void 0))throw new Dp(`Unknown adapter '${u}'`);if(i)break;n[u||"#"+a]=i}if(!i){let a=Object.entries(n).map(([l,d])=>`adapter ${l} `+(d===!1?"is not supported by the environment":"is not available in the build")),u=t?a.length>1?`since :
|
|
@@ -1940,7 +1940,7 @@ ${q}${A}${D}${v3p.default.cursorHide}`});var nha=di(cxi(),1);function rUs(e,t){i
|
|
|
1940
1940
|
Run ${Js.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
|
|
1941
1941
|
Run ${Js.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),yPn(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function pUs({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!U3p(e))return;let n=t??"",a=e.filter(l=>l.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((l,d)=>l.generatorName.localeCompare(d.generatorName)||l.currentVersion.localeCompare(d.currentVersion));for(let l of u)n+=`
|
|
1942
1942
|
${await jAD(l.generatorName)} (${l.apiName!=null?"API: "+l.apiName+", ":""}Group: ${l.generatorGroup}) `+Js.dim(l.currentVersion)+Js.reset(" \u2192 ")+Js.green(l.latestVersion);return n+=`
|
|
1943
|
-
`,i?yPn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function jAD(e){let r=await new L3p.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 wAD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await W3p({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=tci(o.name,c),g=await aJt({generatorName:b,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:c});g!=null&&(l.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),l}let u={type:"multiApi",versions:{}};return await W3p({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,d,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][d]==null&&(u.versions[l][d]={});let c=tci(s.name,o),b=await aJt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][d][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function W3p({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let l=await W8t({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let d of l.groups)if(!(n!=null&&d.groupName!==n))for(let s of d.generators)i!=null&&s.name!==i||await r(a.workspaceName,d.groupName,s,u)}})}))}function H3p(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,l]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let d=Wie(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function Mqo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await wAD({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[d,s]of Object.entries(l.versions))u.push(...H3p(s,d,t.logger));else u.push(...H3p(l.versions,void 0,t.logger))}return u}var dha=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),l=u?`status code ${u}`:"an unknown error";super(`Request failed with ${l}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var nSn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var aSn=e=>e!==null&&typeof e=="object";var pha=(...e)=>{for(let t of e)if((!aSn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return yUs({},...e)},_Us=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function Aqo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:yUs(e[r]??[],t[r]??[])}var hUs=(e={},t={})=>({beforeRequest:Aqo(e,t,"beforeRequest"),beforeRetry:Aqo(e,t,"beforeRetry"),afterResponse:Aqo(e,t,"afterResponse"),beforeError:Aqo(e,t,"beforeError")}),yUs=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(aSn(n)){for(let[a,u]of Object.entries(n))aSn(u)&&a in t&&(u=yUs(t[a],u)),t={...t,[a]:u};aSn(n.hooks)&&(i=hUs(i,n.hooks),t.hooks=i),aSn(n.headers)&&(r=_Us(r,n.headers),t.headers=r)}return t};var $3p=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),G3p=typeof globalThis.AbortController=="function",Q3p=typeof globalThis.ReadableStream=="function",J3p=typeof globalThis.FormData=="function",qqo=["get","post","put","patch","head","delete"],SAD=()=>{};SAD();var K3p={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},Tqo=2147483647,Cqo=Symbol("stop"),Y3p={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},X3p={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var k3p=e=>qqo.includes(e)?e.toUpperCase():e,DAD=["get","put","head","delete","options","trace"],EAD=[408,413,429,500,502,503,504],MAD=[413,429,503],Z3p={limit:2,methods:DAD,statusCodes:EAD,afterStatusCodes:MAD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},e7p=(e={})=>{if(typeof e=="number")return{...Z3p,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");return{...Z3p,...e}};async function vUs(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new nSn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function bUs(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var t7p=(e,t)=>{let r={};for(let i in t)!(i in X3p)&&!(i in Y3p)&&!(i in e)&&(r[i]=t[i]);return r};var _ha=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>Tqo)throw new RangeError(`The \`timeout\` option cannot be greater than ${Tqo}`);await Promise.resolve();let l=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let d=new dha(l,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Q3p)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(l.clone(),i._options.onDownloadProgress)}return l},u=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[l,d]of Object.entries(K3p))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let o=(await u).clone();if(l==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:_Us(this._input.headers,r.headers),hooks:hUs({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:k3p(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:e7p(r.retry),throwHttpErrors:r.throwHttpErrors!==!1,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(G3p){this.abortController=new globalThis.AbortController;let i=this._options.signal??this._input.signal;i?.addEventListener("abort",()=>{this.abortController.abort(i.reason)}),this._options.signal=this.abortController.signal}if($3p&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(J3p&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof nSn)throw t;if(t instanceof dha){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),Tqo);if(this._retryCount<1)throw r;await bUs(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===Cqo)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=t7p(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):vUs(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function l(){let{done:d,value:s}=await u.read();if(d){a.close();return}if(r){n+=s.byteLength;let o=i===0?0:n/i;r({percent:o,transferredBytes:n,totalBytes:i},s)}a.enqueue(s),await l()}await l()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var gUs=e=>{let t=(r,i)=>_ha.create(r,pha(e,i));for(let r of qqo)t[r]=(i,n)=>_ha.create(i,pha(e,n,{method:r}));return t.create=r=>gUs(pha(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),gUs(pha(e,r))),t.stop=Cqo,t},AAD=gUs(),r7p=AAD;var S7p=di(w7p(),1);function wUs(e){let t=(0,S7p.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var g6p=di(b6p(),1),O6p=di(cxi(),1),NUs=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},FUs=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function LUs(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??wUs(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,g6p.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,l&&(d.authorization=`${l.type} ${l.token}`);let s;try{s=await r7p(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new NUs(e):c}if(t.allVersions)return s;let o=new FUs(e,r);if(s["dist-tags"][r]){let{time:c}=s;s=s.versions[s["dist-tags"][r]],s.time=c}else if(r){let c=!!s.versions[r];if(i&&!c)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!c){let g=Object.keys(s.versions);if(r=O6p.default.maxSatisfying(g,r),!r)throw o}let{time:b}=s;if(s=s.versions[r],s.time=b,!s)throw o}return s}async function Oha(e,t){let{version:r}=await LUs(e.toLowerCase(),t);return r}async function Xdi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:Oha(e.packageName,{version:t?"prerelease":"latest"})}var m6p=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],Hqo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=W0.Info;constructor(t){this.ttyAwareLogger=new Eqo(t);let r=this.getPackageName(),i=this.getPackageVersion(),n=this.getCliName();(r==null||i==null||n==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:i,cliName:n}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.57.14"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Js.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new sre}failWithoutThrowing(t,r){this.didSucceed=!1,jqo({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await uPn()).flush(),this.exitProgram()}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await V3p({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
1943
|
+
`,i?yPn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function jAD(e){let r=await new L3p.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 wAD({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await W3p({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=tci(o.name,c),g=await aJt({generatorName:b,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:c});g!=null&&(l.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),l}let u={type:"multiApi",versions:{}};return await W3p({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,d,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][d]==null&&(u.versions[l][d]={});let c=tci(s.name,o),b=await aJt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][d][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function W3p({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let l=await W8t({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let d of l.groups)if(!(n!=null&&d.groupName!==n))for(let s of d.generators)i!=null&&s.name!==i||await r(a.workspaceName,d.groupName,s,u)}})}))}function H3p(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,l]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let d=Wie(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function Mqo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await wAD({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[d,s]of Object.entries(l.versions))u.push(...H3p(s,d,t.logger));else u.push(...H3p(l.versions,void 0,t.logger))}return u}var dha=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),l=u?`status code ${u}`:"an unknown error";super(`Request failed with ${l}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var nSn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var aSn=e=>e!==null&&typeof e=="object";var pha=(...e)=>{for(let t of e)if((!aSn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return yUs({},...e)},_Us=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function Aqo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:yUs(e[r]??[],t[r]??[])}var hUs=(e={},t={})=>({beforeRequest:Aqo(e,t,"beforeRequest"),beforeRetry:Aqo(e,t,"beforeRetry"),afterResponse:Aqo(e,t,"afterResponse"),beforeError:Aqo(e,t,"beforeError")}),yUs=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(aSn(n)){for(let[a,u]of Object.entries(n))aSn(u)&&a in t&&(u=yUs(t[a],u)),t={...t,[a]:u};aSn(n.hooks)&&(i=hUs(i,n.hooks),t.hooks=i),aSn(n.headers)&&(r=_Us(r,n.headers),t.headers=r)}return t};var $3p=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),G3p=typeof globalThis.AbortController=="function",Q3p=typeof globalThis.ReadableStream=="function",J3p=typeof globalThis.FormData=="function",qqo=["get","post","put","patch","head","delete"],SAD=()=>{};SAD();var K3p={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},Tqo=2147483647,Cqo=Symbol("stop"),Y3p={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},X3p={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var k3p=e=>qqo.includes(e)?e.toUpperCase():e,DAD=["get","put","head","delete","options","trace"],EAD=[408,413,429,500,502,503,504],MAD=[413,429,503],Z3p={limit:2,methods:DAD,statusCodes:EAD,afterStatusCodes:MAD,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},e7p=(e={})=>{if(typeof e=="number")return{...Z3p,limit:e};if(e.methods&&!Array.isArray(e.methods))throw new Error("retry.methods must be an array");if(e.statusCodes&&!Array.isArray(e.statusCodes))throw new Error("retry.statusCodes must be an array");return{...Z3p,...e}};async function vUs(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new nSn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function bUs(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var t7p=(e,t)=>{let r={};for(let i in t)!(i in X3p)&&!(i in Y3p)&&!(i in e)&&(r[i]=t[i]);return r};var _ha=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>Tqo)throw new RangeError(`The \`timeout\` option cannot be greater than ${Tqo}`);await Promise.resolve();let l=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let d=new dha(l,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!Q3p)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return i._stream(l.clone(),i._options.onDownloadProgress)}return l},u=i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n();for(let[l,d]of Object.entries(K3p))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let o=(await u).clone();if(l==="json"){if(o.status===204||(await o.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await o.text())}return o[l]()};return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:_Us(this._input.headers,r.headers),hooks:hUs({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:k3p(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:e7p(r.retry),throwHttpErrors:r.throwHttpErrors!==!1,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(G3p){this.abortController=new globalThis.AbortController;let i=this._options.signal??this._input.signal;i?.addEventListener("abort",()=>{this.abortController.abort(i.reason)}),this._options.signal=this.abortController.signal}if($3p&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(J3p&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a,{...this.request}),this._options)}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof nSn)throw t;if(t instanceof dha){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),Tqo);if(this._retryCount<1)throw r;await bUs(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===Cqo)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=t7p(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):vUs(r,t,this.abortController,this._options)}_stream(t,r){let i=Number(t.headers.get("content-length"))||0,n=0;return t.status===204?(r&&r({percent:1,totalBytes:i,transferredBytes:n},new Uint8Array),new globalThis.Response(null,{status:t.status,statusText:t.statusText,headers:t.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(a){let u=t.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:i},new Uint8Array);async function l(){let{done:d,value:s}=await u.read();if(d){a.close();return}if(r){n+=s.byteLength;let o=i===0?0:n/i;r({percent:o,transferredBytes:n,totalBytes:i},s)}a.enqueue(s),await l()}await l()}}),{status:t.status,statusText:t.statusText,headers:t.headers})}};var gUs=e=>{let t=(r,i)=>_ha.create(r,pha(e,i));for(let r of qqo)t[r]=(i,n)=>_ha.create(i,pha(e,n,{method:r}));return t.create=r=>gUs(pha(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),gUs(pha(e,r))),t.stop=Cqo,t},AAD=gUs(),r7p=AAD;var S7p=di(w7p(),1);function wUs(e){let t=(0,S7p.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var g6p=di(b6p(),1),O6p=di(cxi(),1),NUs=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},FUs=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function LUs(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??wUs(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,g6p.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,l&&(d.authorization=`${l.type} ${l.token}`);let s;try{s=await r7p(u,{headers:d,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new NUs(e):c}if(t.allVersions)return s;let o=new FUs(e,r);if(s["dist-tags"][r]){let{time:c}=s;s=s.versions[s["dist-tags"][r]],s.time=c}else if(r){let c=!!s.versions[r];if(i&&!c)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!c){let g=Object.keys(s.versions);if(r=O6p.default.maxSatisfying(g,r),!r)throw o}let{time:b}=s;if(s=s.versions[r],s.time=b,!s)throw o}return s}async function Oha(e,t){let{version:r}=await LUs(e.toLowerCase(),t);return r}async function Xdi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:Oha(e.packageName,{version:t?"prerelease":"latest"})}var m6p=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],Hqo=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=W0.Info;constructor(t){this.ttyAwareLogger=new Eqo(t);let r=this.getPackageName(),i=this.getPackageVersion(),n=this.getCliName();(r==null||i==null||n==null)&&this.exitProgram(),this.environment={packageName:r,packageVersion:i,cliName:n}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.57.15"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Js.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new sre}failWithoutThrowing(t,r){this.didSucceed=!1,jqo({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await uPn()).flush(),this.exitProgram()}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await V3p({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
1944
1944
|
`)||(r+=`
|
|
1945
1945
|
`),this.logger.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram(){process.exit(this.didSucceed?0:1)}longestWorkspaceName;registerWorkspaces(t){let r=H_s(t.map(i=>i.type==="docs"?"docs":i.workspaceName??"api"),i=>i.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 aha(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 i=this.addTaskWithInit(t).start(),n;try{n=await r(i)}catch(a){throw a.message.includes("globalThis")?(i.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),i.failWithoutThrowing()):i.failWithoutThrowing(void 0,a),new sre}finally{i.finish()}return n}async instrumentPostHogEvent(t){(await uPn()).sendEvent(t)}logger=bQr(this.log.bind(this));constructTaskInitForWorkspace(t){let r=P6p(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?P6p(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=m6p[this.numTasks++%m6p.length],u=Js.hex(a)(n);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===xC.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}])}logImmediately(t){let r=t.filter(i=>vsi.indexOf(i.level)>=vsi.indexOf(this.logLevel));this.ttyAwareLogger.log(r,{includeDebugInfo:this.logLevel===W0.Debug})}_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 Xdi({cliEnvironment:this.environment,includePreReleases:t}),i=Wie(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await Mqo({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await YLs({message:t,default:r})}async getInput(t){return await XLs({message:t.message,default:t.default})}};function P6p(e){return`[${e}]:`}var Ht_=require("fs/promises");function Hie({breadcrumbs:e=[],title:t,subtitle:r}){let i=[];return e.length>0&&i.push(Js.blue(e.join(" -> "))),i.push(t),r!=null&&i.push(Js.dim(r)),i.join(`
|
|
1946
1946
|
`)}var YKp=require("fs/promises");var k5t=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:i,absoluteFilePath:n,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=i,this.absoluteFilePath=n,this.changelog=a}};var cDe=class extends k5t{definition;sources;type="fern";constructor({definition:t,sources:r,...i}){super(i),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace(){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var mha=class{context;constructor(t){this.context=t}};var $qo=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[u,l]of Object.entries(i.files)){let d=n!=null?Xh.of(`${n}${a8t}${u}`):Xh.of(u);t[d]=l}let a=Object.keys(i.directories).sort();for(let u of a){let l=n!=null?`${n}${a8t}${u}`:u,d=i.directories[u];r(d,l)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split(a8t))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Xh.of(t[0])]??={};let[r,...i]=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(i)}};var yNi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new $qo,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":i,"display-name":n,docs:a}){let u=this.getOrCreateFile(t);u.service==null&&(u.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(u.service.auth=r),i!=null&&(u.service["base-path"]=i),n!=null&&(u.service["display-name"]=n),a!=null&&(u.docs=a)}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 VQr(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 i of Object.values(this.rootApiFile["auth-schemes"]))xqD(i)&&t.push(i.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}addGlobalHeader({name:t,schema:r}){let i=this.getVersionHeader();i!=null&&i===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}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:i}){if(t===r)return;let n=i??U0((YBe(r)+"/"+fBi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Xh.of(QN))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=Rto(YBe(svn.of(`/${t}`)),svn.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=Rto(YBe(svn.of(`/${t}`)),svn.of(`/${r}`)),n}addType(t,{name:r,schema:i}){if(t===Xh.of(QN))return;let n=this.getOrCreateFile(t);n.types==null&&(n.types={}),n.types[r]=i}addTypeExample(t,r,i){let n=this.getOrCreateFile(t);n.types==null&&(n.types={});let a=n.types[r];a!=null&&(typeof a=="string"?n.types[r]={type:a,examples:[i]}:(a.examples==null&&(a.examples=[]),a.examples.push(i)))}addError(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.errors==null&&(n.errors={}),n.errors[r]==null?n.errors[r]=i:n.errors[r]?.type!==i.type&&(n.errors[r]={"status-code":i["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:i}){let n=this.getOrCreateFile(t);if(n.errors==null)return;let a=n.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(l=>uSe(l,i))??!1)||a.examples?.push(i)}addEndpoint(t,{name:r,schema:i,source:n}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),n!=null&&(a.service.source=n),a.service.endpoints[r]=i}addWebhook(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.webhooks==null&&(n.webhooks={}),n.webhooks[r]=i}addChannel(t,{channel:r}){let i=this.getOrCreateFile(t);i.channel=r;let n=this.basePath;n!=null&&(i.channel.path=xR(n,r.path))}addChannelExample(t,{example:r}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.examples==null&&(i.channel.examples=[]),i.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:i}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.messages[r]=i}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(([n,a])=>[n,{...a,path:xR(r,a.path)}]))});for(let n of Object.values(t))n.service!=null&&(n.service={...n.service,endpoints:Object.fromEntries(Object.entries(n.service.endpoints).map(([a,u])=>[a,{...u,path:xR(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===iS?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 xqD(e){return e?.header!=null}var $ie={openapi:e=>({...e,type:"openapi",_visit:function(t){return $ie._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return $ie._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 dSn={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return dSn._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var z5={basic:e=>({...e,type:"basic",_visit:function(t){return z5._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return z5._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return z5._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return z5._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return z5._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 ig={primitive:e=>({value:e,type:"primitive",_visit:function(t){return ig._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return ig._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return ig._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return ig._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return ig._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return ig._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return ig._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return ig._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"unknown":return t.unknown(e.value);default:return t._other(e)}}};var c_={int:e=>({value:e,type:"int",_visit:function(t){return c_._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return c_._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return c_._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return c_._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return c_._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return c_._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return c_._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return c_._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return c_._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return c_._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return c_._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"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 pSn={boolean:e=>({value:e,type:"boolean",_visit:function(t){return pSn._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return pSn._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 Zdi={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return Zdi._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return Zdi._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 qV={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case qV.GenerallyAvailable:return t.generallyAvailable();case qV.Beta:return t.beta();case qV.Deprecated:return t.deprecated();default:return t._other()}}};var Ize={cursor:e=>({...e,type:"cursor",_visit:function(t){return Ize._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return Ize._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return Ize._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);default:return t._other(e)}}};var MKr={language:e=>({...e,type:"language",_visit:function(t){return MKr._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return MKr._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 TV={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",_visit:(e,t)=>{switch(e){case TV.Curl:return t.curl();case TV.Python:return t.python();case TV.Javascript:return t.javascript();case TV.Typescript:return t.typescript();case TV.Go:return t.go();case TV.Ruby:return t.ruby();case TV.Csharp:return t.csharp();case TV.Java:return t.java();case TV.Js:return t.js();case TV.Node:return t.node();case TV.Ts:return t.ts();case TV.Nodets:return t.nodets();case TV.Golang:return t.golang();case TV.Dotnet:return t.dotnet();case TV.Jvm:return t.jvm();default:return t._other()}}};var e9t={unknown:e=>({value:e,type:"unknown",_visit:function(t){return e9t._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return e9t._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 zze={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return zze._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return zze._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 qG={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case qG.Get:return t.get();case qG.Post:return t.post();case qG.Put:return t.put();case qG.Patch:return t.patch();case qG.Delete:return t.delete();case qG.Head:return t.head();case qG.Options:return t.options();case qG.Trace:return t.trace();default:return t._other()}}};var kdi={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return kdi._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return kdi._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return kdi._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);default:return t._other(e)}}};var Rze={file:e=>({...e,type:"file",_visit:function(t){return Rze._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return Rze._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 TG={file:e=>({...e,type:"file",_visit:function(t){return TG._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return TG._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return TG._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return TG._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return TG._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return TG._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return TG._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 my={primitive:e=>({...e,type:"primitive",_visit:function(t){return my._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return my._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return my._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return my._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return my._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return my._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return my._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return my._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return my._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return my._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return my._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 Pj={int:e=>({...e,type:"int",_visit:function(t){return Pj._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Pj._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Pj._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Pj._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Pj._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Pj._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Pj._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Pj._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Pj._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Pj._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Pj._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"date":return t.date();case"base64":return t.base64();case"boolean":return t.boolean(e);default:return t._other(e)}}};var wx={boolean:e=>({value:e,type:"boolean",_visit:function(t){return wx._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return wx._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 AKr={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return AKr._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return AKr._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 lDe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return lDe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return lDe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return lDe._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);default:return t._other(e)}}};var jT={file:e=>({...e,type:"file",_visit:function(t){return jT._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return jT._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return jT._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return jT._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return jT._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return jT._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return jT._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 Cl={primitive:e=>({...e,type:"primitive",_visit:function(t){return Cl._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Cl._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Cl._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Cl._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Cl._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Cl._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Cl._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Cl._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Cl._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Cl._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Cl._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 pX={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return pX._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return pX._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 op={int:e=>({...e,type:"int",_visit:function(t){return op._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return op._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return op._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return op._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return op._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return op._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return op._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return op._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return op._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return op._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return op._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"date":return t.date(e);case"base64":return t.base64(e);case"boolean":return t.boolean(e);default:return t._other(e)}}};var lv={};Eo(lv,{AllOfPropertyConflict:()=>zSn,ArraySchema:()=>uCo,ArraySchemaWithExample:()=>ICo,Availability:()=>tTo,Base64WithExample:()=>qCo,BasicSecurityScheme:()=>nTo,BearerSecurityScheme:()=>aTo,BooleanSchema:()=>tCo,BooleanWithExample:()=>TCo,BytesResponse:()=>ESn,CasingOverrides:()=>sTo,CommonProperty:()=>hCo,CommonPropertyWithExample:()=>HCo,CursorPagination:()=>NTo,CustomCodeSample:()=>zTo,CustomCodeSampleLanguage:()=>BTo,CustomCodeSampleSdk:()=>ITo,CustomPagination:()=>LTo,DateWithExample:()=>ACo,DatetimeWithExample:()=>MCo,DiscriminatedOneOfSchema:()=>pCo,DiscriminatedOneOfSchemaWithExample:()=>VCo,DoubleSchema:()=>kTo,DoubleWithExample:()=>DCo,Encoding:()=>eTo,Endpoint:()=>UTo,EndpointExample:()=>TSn,EndpointResponseExample:()=>CTo,EndpointSdkName:()=>xXt,EndpointWithExample:()=>Z6p,EnumSchema:()=>vSn,EnumSchemaWithExample:()=>BCo,EnumValue:()=>rpi,ErrorExample:()=>ETo,FernExample:()=>ATo,FileResponse:()=>SSn,FileSchema:()=>OTo,FloatWithExample:()=>SCo,FullEndpointExample:()=>RTo,FullExample:()=>kA,FullObjectExample:()=>hTo,FullOneOfExample:()=>vTo,GlobalHeader:()=>iCo,Header:()=>npi,HeaderExample:()=>qSn,HeaderSecurityScheme:()=>oTo,HeaderWithExample:()=>upi,HttpEndpointServer:()=>MSn,HttpError:()=>MTo,HttpErrorWithExample:()=>OCo,HttpMethod:()=>OSn,IdempotencyHeader:()=>nCo,Int64WithExample:()=>PCo,IntSchema:()=>XTo,IntWithExample:()=>mCo,JsonRequest:()=>wTo,JsonRequestWithExample:()=>vCo,JsonResponse:()=>DSn,JsonResponseWithExample:()=>FSn,KeyValuePair:()=>yTo,LiteralExample:()=>_To,LiteralSchema:()=>ISn,LiteralSchemaValue:()=>aCo,LongSchema:()=>ZTo,MapSchema:()=>sCo,MapSchemaWithExample:()=>zCo,MultipartRequest:()=>wSn,MultipartRequestProperty:()=>jTo,MultipartRequestPropertyEncoding:()=>PTo,MultipartSchema:()=>mTo,NamedFullExample:()=>zXt,Namespace:()=>cTo,NamespaceId:()=>pTo,NullableSchema:()=>lCo,NullableSchemaWithExample:()=>NCo,OauthSecurityScheme:()=>fTo,ObjectProperty:()=>dCo,ObjectPropertyConflictInfo:()=>RSn,ObjectPropertyWithExample:()=>UCo,ObjectSchema:()=>oCo,ObjectSchemaWithExample:()=>FCo,OctetStreamRequest:()=>jSn,OffsetPagination:()=>FTo,OneOfSchema:()=>fCo,OneOfSchemaWithExample:()=>LCo,OpenApiIntermediateRepresentation:()=>Y6p,OpenApiSource:()=>Yqo,OptionalSchema:()=>cCo,OptionalSchemaWithExample:()=>RCo,Pagination:()=>CSn,PathParameter:()=>mSn,PathParameterExample:()=>qTo,PathParameterWithExample:()=>yCo,PrimitiveExample:()=>gSn,PrimitiveSchema:()=>opi,PrimitiveSchemaValue:()=>rCo,PrimitiveSchemaValueWithExample:()=>CCo,PrimitiveSchemaWithExample:()=>LSn,PropertyKey:()=>bSn,ProtobufEncoding:()=>kqo,ProtobufSource:()=>Xqo,QueryParameter:()=>PSn,QueryParameterExample:()=>ASn,QueryParameterWithExample:()=>NSn,QuerySecurityScheme:()=>uTo,ReferencedSchema:()=>IXt,Request:()=>STo,RequestWithExample:()=>bCo,Response:()=>DTo,ResponseWithExample:()=>gCo,Schema:()=>YO,SchemaId:()=>_X,SchemaWithExample:()=>qM,Schemas:()=>YTo,SdkGroup:()=>lTo,SdkGroupInfo:()=>bTo,SdkGroupName:()=>ipi,SecurityScheme:()=>dTo,SecuritySchemeId:()=>iTo,Server:()=>Sha,Source:()=>Zqo,StatusCode:()=>CXt,StreamingResponseExample:()=>TTo,StringSchema:()=>eCo,StringSchemaWithExample:()=>ECo,SupportedSdkLanguage:()=>xTo,Tag:()=>rTo,TagId:()=>hX,Tags:()=>gTo,TextResponse:()=>api,Uint64WithExample:()=>wCo,UintWithExample:()=>jCo,UnDiscriminatedOneOfSchema:()=>_Co,UnDiscriminatedOneOfSchemaWithExample:()=>WCo,UnknownSchemaWithExample:()=>xCo,Webhook:()=>VTo,WebhookExampleCall:()=>xSn,WebhookHttpMethod:()=>BSn,WebhookWithExample:()=>k6p,WebsocketChannel:()=>KTo,WebsocketHandshake:()=>WTo,WebsocketHandshakeWithExample:()=>X6p,WebsocketMessageExample:()=>QTo,WebsocketMessageOrigin:()=>HTo,WebsocketMessageSchema:()=>$To,WebsocketServer:()=>GTo,WebsocketSessionExample:()=>JTo,WithAvailability:()=>ph,WithDescription:()=>pf,WithEncoding:()=>Gie,WithInline:()=>dE,WithName:()=>s0,WithNamespace:()=>BXt,WithSdkGroupName:()=>zO,WithSource:()=>qh,WithStatusCode:()=>Nze,WithTitle:()=>IO,commons:()=>$Us,example:()=>GUs,finalIr:()=>QUs,parseIr:()=>JUs});var $Us={};Eo($Us,{BasicSecurityScheme:()=>nTo,BearerSecurityScheme:()=>aTo,Encoding:()=>eTo,HeaderSecurityScheme:()=>oTo,Namespace:()=>cTo,NamespaceId:()=>pTo,OauthSecurityScheme:()=>fTo,OpenApiSource:()=>Yqo,ProtobufEncoding:()=>kqo,ProtobufSource:()=>Xqo,QuerySecurityScheme:()=>uTo,SchemaId:()=>_X,SdkGroup:()=>lTo,SdkGroupName:()=>ipi,SecurityScheme:()=>dTo,SecuritySchemeId:()=>iTo,Server:()=>Sha,Source:()=>Zqo,StatusCode:()=>CXt,Tag:()=>rTo,TagId:()=>hX,WithAvailability:()=>ph,WithDescription:()=>pf,WithEncoding:()=>Gie,WithInline:()=>dE,WithName:()=>s0,WithNamespace:()=>BXt,WithSdkGroupName:()=>zO,WithSource:()=>qh,WithStatusCode:()=>Nze,WithTitle:()=>IO});var qt={};Eo(qt,{JsonError:()=>_Sn,ParseError:()=>hSn,any:()=>R6p,bigint:()=>w6p,boolean:()=>N6p,booleanLiteral:()=>z6p,date:()=>S6p,discriminant:()=>Q6p,enum_:()=>Qqo,getObjectLikeUtils:()=>t9t,getObjectUtils:()=>vNi,getSchemaUtils:()=>ZA,isProperty:()=>tpi,lazy:()=>D6p,lazyObject:()=>B6p,list:()=>Kqo,number:()=>F6p,object:()=>Jqo,objectWithoutOptionalProperties:()=>C6p,optional:()=>UUs,property:()=>M6p,record:()=>W6p,set:()=>H6p,string:()=>L6p,stringLiteral:()=>I6p,transform:()=>VUs,undiscriminatedUnion:()=>G6p,union:()=>K6p,unknown:()=>U6p,withParsedProperties:()=>HUs});var kP={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",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function AM(e,t){return`Expected ${t}. Received ${IqD(e)}.`}function IqD(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 R5(e){return{...e,json:j6p(e.json),parse:j6p(e.parse)}}function j6p(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
|
|
@@ -1954,7 +1954,7 @@ plugins:
|
|
|
1954
1954
|
- enum_type=string
|
|
1955
1955
|
- default_response=false
|
|
1956
1956
|
- source_root=${e}
|
|
1957
|
-
`}async function Xze({context:e,specs:t,relativePathToDependency:r}){let i=new FRo({context:e}),n=t.filter(l=>l.type==="openapi").map(l=>({...l,relativePathToDependency:r})),a=t.filter(l=>l.type==="protobuf"),u=await Promise.all(a.map(async l=>otE({generator:i,protobufSpec:l,relativePathToDependency:r})));return[...n,...u]}async function otE({generator:e,protobufSpec:t,relativePathToDependency:r}){return{type:"openapi",absoluteFilepath:await e.generate({absoluteFilepathToProtobufRoot:t.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:t.absoluteFilepathToProtobufTarget,relativeFilepathToProtobufRoot:t.relativeFilepathToProtobufRoot,local:t.generateLocally}),absoluteFilepathToOverrides:t.absoluteFilepathToOverrides,settings:t.settings,source:{type:"protobuf",relativePathToDependency:r,root:t.absoluteFilepathToProtobufRoot,file:t.absoluteFilepathToProtobufTarget}}}var we_=require("fs"),VEn=require("fs/promises");var Se_=require("os"),De_=di(require("path"),1),Ee_=require("stream/promises"),Me_=di(QNo(),1),Ae_=di(ure(),1);var MXs=di(Jxi(),1);var cP;(function(e){e.FILE_READ="FILE_READ",e.FILE_PARSE="FILE_PARSE",e.FILE_MISSING="FILE_MISSING",e.STRUCTURE_VALIDATION="STRUCTURE_VALIDATION",e.JSONSCHEMA_VALIDATION="JSONSCHEMA_VALIDATION",e.DEPENDENCY_NOT_LISTED="DEPENDENCY_NOT_LISTED",e.FAILED_TO_LOAD_DEPENDENCY="FAILED_TO_LOAD_DEPENDENCY",e.EXPORTING_PACKAGE_MARKER_OTHER_KEYS="EXPORTING_PACKAGE_MARKER_OTHER_KEYS",e.EXPORT_PACKAGE_HAS_DEFINITIONS="EXPORT_PACKAGE_HAS_DEFINITIONS",e.MISCONFIGURED_DIRECTORY="MISCONFIGURED_DIRECTORY"})(cP||(cP={}));var ziE=sJr();async function qe_({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:i,cliVersion:n,settings:a,loadAPIWorkspace:u}){let l,d={type:cP.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},s=t.dependencies[e];return s==null?d={type:cP.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${WiE(s)}`},async o=>{switch(s.type){case"version":l=await UiE({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;case"local":l=await LiE({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;default:Fo(s)}}),l!=null?{didSucceed:!0,definition:l}:{didSucceed:!1,failure:d}}var Te_="dependencies";var RiE="metadata.json",NiE=".fern";function FiE(e){return es(Wl.of((0,Se_.homedir)()),uo.of(NiE),uo.of(Te_),uo.of(e.organization),uo.of(e.apiName),uo.of(e.version))}async function LiE({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){if(n==null){t.failWithoutThrowing("Failed to load api definition");return}t.logger.info("Parsing...");let a=await n({absolutePathToWorkspace:e.absoluteFilepath,context:t,cliVersion:r,workspaceName:void 0});if(!a.didSucceed){t.failWithoutThrowing("Failed to load api definition",a.failures);return}t.logger.info("Modifying source filepath ...");let u=await a.workspace.getDefinition({context:t,relativePathToDependency:uo.of(e.path)},i);return t.logger.info("Loaded..."),u}async function UiE({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){let a=FiE(e),u=es(a,uo.of(Te_)),l=es(a,uo.of(RiE)),d;if(!await Bf(u)||!await Bf(l)){t.logger.info("Downloading manifest...");let c=await ziE.definitionRegistry.get(MXs.FernFiddle.OrganizationId(e.organization),MXs.FernFiddle.ApiId(e.apiName),e.version);if(!c.ok){c.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist")},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist")},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist")},_other:m=>{t.failWithoutThrowing("Failed to download API manifest",m)}});return}let b=c.body.yamlSchemaVersion!=null?parseInt(c.body.yamlSchemaVersion):void 0,g=uNi(r),O=uNi(c.body.cliVersion);if(b!=null){if(b>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${c.body.cliVersion}`);return}else if(b<1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a lower version of fern. Upgrade it to ${r}`);return}}else if(g.major!==O.major||g.minor!==O.minor){t.failWithoutThrowing(`CLI version is ${c.body.cliVersion}. Expected ${g.major}.${g.minor}.x (to match current workspace).`);return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+c.body.definitionS3DownloadUrl),await(0,VEn.mkdir)(u,{recursive:!0});try{await ViE({s3PreSignedReadUrl:c.body.definitionS3DownloadUrl,absolutePathToLocalOutput:u})}catch(m){t.failWithoutThrowing("Failed to download API",m);return}d=c.body,await(0,VEn.writeFile)(l,JSON.stringify(d))}else d=JSON.parse((await(0,VEn.readFile)(l)).toString());if(t.logger.info("Parsing..."),n==null){t.failWithoutThrowing("Failed to load API");return}let s=await n({absolutePathToWorkspace:u,context:t,cliVersion:d.cliVersion,workspaceName:void 0});if(!s.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",s.failures);return}if(s.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.");return}return await s.workspace.getDefinition({context:t},i)}async function ViE({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await QR.get(e,{responseType:"stream"}),i=await Ae_.default.dir(),n=De_.default.join(i.path,"api.tgz");await(0,Ee_.pipeline)(r.data,(0,we_.createWriteStream)(n)),await(0,Me_.extract)({file:n,cwd:t})}function WiE(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:Fo(e)}}var He_=di(Re_(),1);function JNo(e,t){for(let[r,i]of $N(e))$iE({relativeFilepath:r,failure:i,logger:t})}function $iE({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case cP.MISCONFIGURED_DIRECTORY:r.error("Misconfigured fern directory: please see the docs at https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder");break;case cP.FILE_READ:r.error("Failed to open file: "+e);break;case cP.FILE_MISSING:r.error("Missing file: "+e);break;case cP.FILE_PARSE:t.error instanceof Kaa?r.error(Hie({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case cP.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of GiE(i))r.error(Hie({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case cP.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case cP.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${HZa}: `+t.dependencyName);break;case cP.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case cP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case cP.JSONSCHEMA_VALIDATION:t.error.error!=null&&r.error(Hie({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...t.error.error.instancePath.split("/").filter(i=>i!=="")]}));for(let i of t.error.allErrors)i!==t.error.error&&r.debug(Hie({title:i.message??"Unknown error",breadcrumbs:[e,...i.instancePath.split("/").filter(n=>n!=="")]}));break;default:Fo(t)}}function GiE(e){switch(e.code){case Hl.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Js.underline(e.expected)} but received ${Js.underline(e.received)}`}];case Hl.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Js.underline(t)}`}));case Hl.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Js.underline(t)).join(", ")}`}];case Hl.invalid_union:case Hl.invalid_arguments:case Hl.invalid_return_type:case Hl.invalid_date:case Hl.invalid_string:case Hl.too_small:case Hl.too_big:case Hl.invalid_intersection_types:case Hl.not_multiple_of:case Hl.custom:default:return[{title:e.message}]}}var Ne_=require("fs/promises");async function Fe_(e,t){let r=[];for(let i of await exe(e,t))r.push(await QiE({relativeFilepath:HA(e,i),absoluteFilepath:i}));return r}async function QiE({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,Ne_.readFile)(t)).toString()}}async function Le_(e){let t={},r={};function i(n){try{t[n.relativeFilepath]={defaultUrl:void 0,contents:Yd.load(n.fileContents,{schema:Yd.CORE_SCHEMA}),rawContents:n.fileContents}}catch(a){r[n.relativeFilepath]={type:cP.FILE_PARSE,error:a}}}return await Promise.all(e.map(i)),Object.keys(r).length>0?{didSucceed:!1,failures:r}:{didSucceed:!0,files:t}}async function Ue_({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:i,settings:n,loadAPIWorkspace:a}){let u={},l={},d={};return await Promise.all($N(t.packageMarkers).map(async([s,o])=>{if(o.contents.export==null)u[s]=o;else{let{export:c,...b}=o.contents;if(jY(b)>0)d[s]={type:cP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:s};else{let g=yp(s);if(Q4t(t.namedDefinitionFiles).some(m=>m!==s&&m.startsWith(g)))d[s]={type:cP.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:g};else{let m=await qe_({dependencyName:typeof o.contents.export=="string"?o.contents.export:o.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:i,settings:n,loadAPIWorkspace:a});m.didSucceed?l[yp(s)]={definition:m.definition,url:typeof o.contents.export=="object"?o.contents.export.url:void 0}:d[s]=m.failure}}}})),jY(d)>0?{didSucceed:!1,failures:d}:{didSucceed:!0,packageMarkers:u,importedDefinitions:l}}var Ve_=di(require("path"),1);var TXs={};Eo(TXs,{additionalProperties:()=>XiE,default:()=>kiE,definitions:()=>ZiE,properties:()=>KiE,required:()=>YiE,type:()=>JiE});var JiE="object",KiE={docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"default-url":{oneOf:[{type:"string"},{type:"null"}]},"default-environment":{oneOf:[{type:"string"},{type:"null"}]},environments:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/environments.EnvironmentSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/auth.ApiAuthSchema"},{type:"null"}]},"auth-schemes":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/auth.AuthSchemeDeclarationSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},name:{type:"string"},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},"error-discrimination":{oneOf:[{$ref:"#/definitions/file.ErrorDiscriminationSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},errors:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"idempotency-headers":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},variables:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/variables.VariableDeclarationSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"null"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},YiE=["name"],XiE=!1,ZiE={"environments.SingleBaseUrlEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},url:{type:"string"}},required:["url"],additionalProperties:!1},"environments.MultipleBaseUrlsEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},urls:{type:"object",additionalProperties:{type:"string"}}},required:["urls"],additionalProperties:!1},"environments.EnvironmentSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/environments.SingleBaseUrlEnvironmentSchema"},{$ref:"#/definitions/environments.MultipleBaseUrlsEnvironmentSchema"}]},"auth.AuthSchemeReferenceSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{type:"string"}},required:["scheme"],additionalProperties:!1},"auth.AnyAuthItem":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"}]},"auth.AnyAuthSchemesSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},any:{type:"array",items:{$ref:"#/definitions/auth.AnyAuthItem"}}},required:["any"],additionalProperties:!1},"auth.ApiAuthSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"},{$ref:"#/definitions/auth.AnyAuthSchemesSchema"}]},"auth.OAuthAccessTokenRequestPropertiesSchema":{type:"object",properties:{"client-id":{oneOf:[{type:"string"},{type:"null"}]},"client-secret":{oneOf:[{type:"string"},{type:"null"}]},scopes:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthAccessTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthGetTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthRefreshTokenRequestPropertiesSchema":{type:"object",properties:{"refresh-token":{type:"string"}},required:["refresh-token"],additionalProperties:!1},"auth.OAuthRefreshTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthRefreshTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"oauth"},type:{const:"client-credentials"},scopes:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"client-id-env":{oneOf:[{type:"string"},{type:"null"}]},"client-secret-env":{oneOf:[{type:"string"},{type:"null"}]},"token-prefix":{oneOf:[{type:"string"},{type:"null"}]},"token-header":{oneOf:[{type:"string"},{type:"null"}]},"get-token":{$ref:"#/definitions/auth.OAuthGetTokenEndpointSchema"},"refresh-token":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenEndpointSchema"},{type:"null"}]}},required:["scheme","type","get-token"],additionalProperties:!1},"auth.HeaderAuthSchemeSchema":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},header:{type:"string"},type:{oneOf:[{type:"string"},{type:"null"}]},prefix:{oneOf:[{type:"string"},{type:"null"}]}},required:["header"],additionalProperties:!1},"auth.AuthVariable":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.BasicAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"basic"},username:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]},password:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.BearerAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},token:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.AuthSchemeDeclarationSchema":{anyOf:[{$ref:"#/definitions/auth.OAuthSchemeSchema"},{$ref:"#/definitions/auth.HeaderAuthSchemeSchema"},{$ref:"#/definitions/auth.BasicAuthSchemeSchema"},{$ref:"#/definitions/auth.BearerAuthSchemeSchema"}]},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"file.PropertyBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"property"},"property-name":{type:"string"}},required:["strategy","property-name"],additionalProperties:!1},"file.StatusCodeBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"status-code"}},required:["strategy"],additionalProperties:!1},"file.ErrorDiscriminationSchema":{anyOf:[{$ref:"#/definitions/file.PropertyBasedErrorDiscrimination"},{$ref:"#/definitions/file.StatusCodeBasedErrorDiscrimination"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"variables.VariableDeclarationDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"variables.VariableDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/variables.VariableDeclarationDetailed"}]},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"versioning.VersionValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionValue":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionValueDetailed"}]},"versioning.VersionDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionDeclarationHeaderObjectSchema"}]},"versioning.VersionDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/versioning.VersionValue"}},header:{$ref:"#/definitions/versioning.VersionDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1}},kiE={type:JiE,properties:KiE,required:YiE,additionalProperties:XiE,definitions:ZiE};var CXs={};Eo(CXs,{additionalProperties:()=>rnE,default:()=>nnE,definitions:()=>inE,properties:()=>tnE,type:()=>enE});var enE="object",tnE={docs:{oneOf:[{type:"string"},{type:"null"}]},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]}},rnE=!1,inE={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1}},nnE={type:enE,properties:tnE,additionalProperties:rnE,definitions:inE};var BXs={};Eo(BXs,{additionalProperties:()=>unE,default:()=>cnE,definitions:()=>snE,properties:()=>onE,type:()=>anE});var anE="object",onE={imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/file.Navigation"},{type:"null"}]},export:{oneOf:[{$ref:"#/definitions/file.Export"},{type:"null"}]}},unE=!1,snE={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1},"file.Navigation":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"file.ExportDetailed":{type:"object",properties:{dependency:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]}},required:["dependency"],additionalProperties:!1},"file.Export":{anyOf:[{type:"string"},{$ref:"#/definitions/file.ExportDetailed"}]}},cnE={type:anE,properties:onE,additionalProperties:unE,definitions:snE};function We_({files:e,absolutePathToDefinition:t}){let r,i={},n={},a={};for(let[u,l]of $N(e)){let d=l.contents,s=o=>{a[u]={type:cP.JSONSCHEMA_VALIDATION,error:o}};if(u===QN){let o=aQr(d,TXs);if(o.success){let c=S2.serialization.RootApiFileSchema.parseOrThrow(d);r={defaultUrl:c["default-url"],contents:c,rawContents:l.rawContents}}else s(o)}else if(Ve_.default.basename(u)===iS){let o=aQr(d,BXs);if(o.success){let c=S2.serialization.PackageMarkerFileSchema.parseOrThrow(d);n[u]={defaultUrl:typeof c.export=="object"?c.export.url:void 0,contents:c,rawContents:l.rawContents}}else s(o)}else{let o=aQr(d,CXs);if(o.success){let c=S2.serialization.DefinitionFileSchema.parseOrThrow(d);i[u]={defaultUrl:void 0,contents:c,rawContents:l.rawContents,absoluteFilePath:es(t,u)}}else s(o)}}return r==null?{didSucceed:!1,failures:{[uo.of(QN)]:{type:cP.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:i,rootApiFile:r,packageMarkers:n}}var v_i=class extends k5t{type="fern";context;fernWorkspaces={};loadAPIWorkspace;constructor({context:t,loadAPIWorkspace:r,...i}){super(i),this.context=t,this.loadAPIWorkspace=r}async getDefinition({context:t},r){return(await this.toFernWorkspace({context:t},r)).definition}async toFernWorkspace({context:t},r){let i=(0,He_.default)(r??{}),n=this.fernWorkspaces[i];if(n==null){let a=t||this.context,u=es(this.absoluteFilePath,uo.of(e5)),l=await u0s({absolutePathToWorkspace:this.absoluteFilePath,context:a}),d=await Fe_(u,"{yml,yaml}"),s=await Le_(d);if(!s.didSucceed)return JNo(s.failures,a.logger),a.failAndThrow();let o=We_({files:s.files,absolutePathToDefinition:u});if(!o.didSucceed)return JNo(o.failures,a.logger),a.failAndThrow();let c=await Ue_({dependenciesConfiguration:l,structuralValidationResult:o,context:a,cliVersion:this.cliVersion,settings:r,loadAPIWorkspace:this.loadAPIWorkspace});if(!c.didSucceed)return JNo(c.failures,a.logger),a.failAndThrow();n=new cDe({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:l,workspaceName:this.workspaceName,definition:{absoluteFilePath:u,rootApiFile:o.rootApiFile,namedDefinitionFiles:o.namedDefinitionFiles,packageMarkers:c.packageMarkers,importedDefinitions:c.importedDefinitions},cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[i]=n}return n}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};function VV(e){let t=fnE(e),{value:r,done:i}=xXs(t,"{");return i?{head:r,parts:[]}:{head:r,parts:[...lnE(t)]}}function*lnE(e){let t;do{let{value:r}=xXs(e,"}"),i=xXs(e,"{");t=i.done,yield{pathParameter:r,tail:i.value}}while(!t)}function*fnE(e){for(let t of e)yield t}function xXs(e,t){let r="",i=e.next();for(;i.done!==!0&&i.value!==t;)r+=i.value,i=e.next();return{value:r,done:i.done??!1}}function sba(e){let t=2166136261;function r(n,a){if(typeof n=="object"&&n!=null){if(a>64){i("[MaxDepthExceeded]");return}if(Array.isArray(n)){i("[");for(let u=0;u<n.length;u++)u>0&&i(","),r(n[u],a+1);i("]")}else i("{"),Object.keys(n).sort().forEach((l,d)=>{d>0&&i(","),i(l),i(":"),r(n[l],a+1)}),i("}")}else i(String(n))}function i(n){for(let a=0;a<n.length;a++){let u=n.charCodeAt(a);t^=u,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24),t>>>=0}}return r(e,0),t.toString(16)}function $e_({fieldName:e,containerType:t,maxDepth:r,currentDepth:i,typeDeclarations:n,skipOptionalProperties:a}){if(i>=r)return lZt({containerType:t});switch(t.type){case"list":{let u=tq({fieldName:e,typeReference:t.list,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?lZt({containerType:t}):{type:"success",example:JO.list({list:[u.example,u.example],itemType:t.list}),jsonExample:[u.jsonExample,u.jsonExample]}}case"literal":return{type:"success",example:JO.literal({literal:t.literal._visit({boolean:u=>Bd.boolean(u),string:u=>Bd.string({original:u}),_other:()=>{throw new Error("Encountered unknown literal type")}})}),jsonExample:t.literal._visit({boolean:u=>u,string:u=>u,_other:()=>{throw new Error("Encountered unknown literal type")}})};case"optional":{if(a)return lZt({containerType:t});let u=tq({fieldName:e,typeReference:t.optional,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?lZt({containerType:t}):{type:"success",example:JO.optional({optional:u.example,valueType:t.optional}),jsonExample:u.jsonExample}}case"nullable":{if(a)return lZt({containerType:t});let u=tq({fieldName:e,typeReference:t.nullable,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?lZt({containerType:t}):{type:"success",example:JO.nullable({nullable:u.example,valueType:t.nullable}),jsonExample:u.jsonExample}}case"set":{let u=tq({fieldName:e,typeReference:t.set,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?lZt({containerType:t}):{type:"success",example:JO.set({set:[u.example],itemType:t.set}),jsonExample:[u.jsonExample]}}case"map":{let u=tq({fieldName:e,typeReference:t.keyType,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a}),l=tq({fieldName:e,typeReference:t.valueType,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"||l.type==="failure"?lZt({containerType:t}):{type:"success",example:JO.map({map:[{key:u.example,value:l.example}],keyType:t.keyType,valueType:t.valueType}),jsonExample:{[u.jsonExample]:l.jsonExample}}}default:Fo(t)}}function lZt({containerType:e}){switch(e.type){case"list":return{type:"success",example:JO.list({list:[],itemType:e.list}),jsonExample:[]};case"literal":return{type:"success",example:JO.literal({literal:e.literal._visit({boolean:t=>Bd.boolean(t),string:t=>Bd.string({original:t}),_other:()=>{throw new Error("Encountered unknown literal type")}})}),jsonExample:e.literal._visit({boolean:t=>t,string:t=>t,_other:()=>{throw new Error("Encountered unknown literal type")}})};case"optional":return{type:"success",example:JO.optional({optional:void 0,valueType:e.optional}),jsonExample:void 0};case"nullable":return{type:"success",example:JO.nullable({nullable:void 0,valueType:e.nullable}),jsonExample:void 0};case"set":return{type:"success",example:JO.set({set:[],itemType:e.set}),jsonExample:[]};case"map":return{type:"success",example:JO.map({map:[],keyType:e.keyType,valueType:e.valueType}),jsonExample:{}};default:Fo(e)}}function Qe_({fieldName:e,primitiveType:t}){switch(t.v1){case"STRING":return hnE({fieldName:e,validation:dnE(t.v2)});case"BASE_64":return{type:"success",example:Bd.base64(My.BASE64),jsonExample:My.BASE64};case"BOOLEAN":return{type:"success",example:Bd.boolean(My.BOOLEAN),jsonExample:My.BOOLEAN};case"DATE":return{type:"success",example:Bd.date(My.DATE),jsonExample:My.DATE};case"DATE_TIME":return{type:"success",example:Bd.datetime({datetime:new Date(My.DATE_TIME),raw:My.DATE_TIME}),jsonExample:My.DATE_TIME};case"DOUBLE":return ynE({fieldName:e,validation:pnE(t.v2)});case"FLOAT":return{type:"success",example:Bd.float(My.FLOAT),jsonExample:My.FLOAT};case"INTEGER":return vnE({fieldName:e,validation:_nE(t.v2)});case"UINT_64":return{type:"success",example:Bd.uint64(My.INT64),jsonExample:My.INT64};case"UINT":return{type:"success",example:Bd.uint(My.UINT),jsonExample:My.UINT};case"BIG_INTEGER":return{type:"success",example:Bd.bigInteger(My.INT64.toString()),jsonExample:`${My.INT64}`};case"LONG":return{type:"success",example:Bd.long(My.INT64),jsonExample:My.INT64};case"UUID":return{type:"success",example:Bd.uuid(My.UUID),jsonExample:My.UUID};default:Fo(t.v1)}}function dnE(e){if(e?.type==="string")return e.validation}function pnE(e){if(e?.type==="double")return e.validation}function _nE(e){if(e?.type==="integer")return e.validation}function Ge_(e){if(e<=My.SAMPLE_STRINGS.length){let t=My.SAMPLE_STRINGS[e-1];if(t)return t;throw new Error(`Unexpected undefined value in SAMPLE_STRINGS at index ${e-1}`)}return My.SAMPLE_STRINGS[My.SAMPLE_STRINGS.length-1]+".".repeat(e-My.SAMPLE_STRINGS.length)}function hnE({fieldName:e,validation:t}){if(t){let i=t.minLength,n=t.maxLength;if(i){let a=Ge_(i);return{type:"success",example:Bd.string({original:a}),jsonExample:a}}else if(n){let a=Ge_(n);return{type:"success",example:Bd.string({original:a}),jsonExample:a}}}let r=e??My.STRING;return{type:"success",example:Bd.string({original:r}),jsonExample:r}}function ynE({fieldName:e,validation:t}){if(t){let r=t.max,i=t.min;if(r)return{type:"success",example:Bd.double(r),jsonExample:r};if(i)return{type:"success",example:Bd.double(i),jsonExample:i}}return{type:"success",example:Bd.double(My.DOUBLE),jsonExample:My.DOUBLE}}function vnE({fieldName:e,validation:t}){if(t){let r=t.max,i=t.min;if(r)return{type:"success",example:Bd.integer(r),jsonExample:r};if(i)return{type:"success",example:Bd.integer(i),jsonExample:i}}return{type:"success",example:Bd.integer(My.INT),jsonExample:My.INT}}function mFi({typeReference:e,typeDeclarations:t}){if(e.type==="container"&&e.container.type==="optional")return!0;if(e.type==="named"){let r=t[e.typeId];if(r?.shape.type==="alias"&&r?.shape.resolvedType.type==="container"&&r?.shape.resolvedType.container.type==="optional")return!0}return!1}function $En({fieldName:e,typeDeclarations:t,typeDeclaration:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a}){switch(r.shape.type){case"alias":{let u=tq({fieldName:e,typeDeclarations:t,typeReference:r.shape.aliasOf,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(u.type==="failure")return u;let{example:l,jsonExample:d}=u;return{type:"success",example:ow.alias({value:l}),jsonExample:d}}case"enum":{let u=r.shape.values[0];return u==null?{type:"failure",message:"No enum values present"}:{type:"success",example:ow.enum({value:u.name}),jsonExample:u.name.wireValue}}case"object":{let u={},l=[];if(r.shape.extends!=null)for(let c of r.shape.extends){let b=t[c.typeId];if(b==null)continue;let g=$En({fieldName:e,typeDeclaration:b,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});g!=null&&g.type==="success"&&g.example.type==="object"&&(Object.assign(u,g.jsonExample),l.push(...g.example.properties))}let d=bnE({fieldName:e,typeDeclaration:r,objectTypeDeclaration:r.shape,typeDeclarations:t,currentDepth:n,maxDepth:i,skipOptionalProperties:a});if(d.type==="failure")return d;let{example:s,jsonExample:o}=d;return{type:"success",example:ow.object({...s,properties:[...l,...s.properties]}),jsonExample:Object.assign({},u,o)}}case"undiscriminatedUnion":{let u=0;for(let l of r.shape.members){let d=tq({fieldName:e,typeReference:l.type,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});if(d.type==="failure"){++u;continue}let{example:s,jsonExample:o}=d;return{type:"success",example:ow.undiscriminatedUnion({index:u,singleUnionType:s}),jsonExample:o}}break}case"union":{let u=r.shape.discriminant,l={};if(r.shape.baseProperties!=null)for(let d of r.shape.baseProperties){let s=tq({fieldName:d.name.wireValue,typeReference:d.valueType,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});s.type==="success"&&(l[d.name.wireValue]=s.jsonExample)}for(let d of r.shape.types){let s=d.shape._visit({noProperties:()=>({type:"success",example:ow.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:sF.noProperties()}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,...l}}),samePropertiesAsObject:o=>{let c=t[o.typeId];if(c==null)return{type:"failure",message:`Failed to find type declaration with id ${o.typeId}`};let b=$En({currentDepth:n,maxDepth:i,fieldName:e,typeDeclaration:c,typeDeclarations:t,skipOptionalProperties:a});if(b==null)return{type:"failure",message:"Failed to generate example for type reference"};if(b.type==="failure")return b;let{example:g,jsonExample:O}=b;return{type:"success",example:ow.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:sF.samePropertiesAsObject({typeId:c.name.typeId,object:g.type==="object"?g:{properties:[]}})}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,...typeof O=="object"?O:{},...l}}},singleProperty:o=>{let c=tq({currentDepth:n+1,maxDepth:i,fieldName:e,typeReference:o.type,typeDeclarations:t,skipOptionalProperties:a});if(c.type==="failure")return c;let{example:b,jsonExample:g}=c;return{type:"success",example:ow.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:sF.singleProperty(b)}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,[o.name.wireValue]:g,...l}}},_other:()=>{throw new Error("Encountered unknown union type")}});if(s.type!=="failure")return s}}}return{type:"failure",message:"Failed to generate example for type reference"}}function bnE({fieldName:e,typeDeclaration:t,objectTypeDeclaration:r,typeDeclarations:i,maxDepth:n,currentDepth:a,skipOptionalProperties:u}){let l={},d=[];for(let s of[...r.properties??[],...r.extendedProperties??[]]){let o=tq({fieldName:s.name.wireValue,typeReference:s.valueType,typeDeclarations:i,currentDepth:a+1,maxDepth:n,skipOptionalProperties:u});if(o.type==="failure"&&!mFi({typeDeclarations:i,typeReference:s.valueType}))return{type:"failure",message:`Failed to generate required property ${s.name.wireValue} b/c ${o.message}`};if(o.type==="failure")continue;let{example:c,jsonExample:b}=o;d.push({name:s.name,originalTypeDeclaration:t.name,value:c}),l[s.name.wireValue]=b}return{type:"success",example:ow.object({properties:d}),jsonExample:l}}function tq({fieldName:e,typeReference:t,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a}){if(n>i)return{type:"failure",message:"Exceeded max depth"};switch(t.type){case"named":{let u=r[t.typeId];if(u==null)return{type:"failure",message:`Failed to find type declaration with id ${t.typeId}`};let l=$En({fieldName:e,typeDeclaration:u,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(l==null)return{type:"failure",message:"Failed to generate example for type declaration"};if(l.type==="failure")return l;let{example:d,jsonExample:s}=l;return{type:"success",example:{jsonExample:s,shape:Ph.named({shape:d,typeName:u.name})},jsonExample:s}}case"container":{let u=$e_({fieldName:e,containerType:t.container,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(u.type==="failure"){let{example:s,jsonExample:o}=lZt({containerType:t.container});return{type:"success",example:{jsonExample:o,shape:Ph.container(s)},jsonExample:o}}let{example:l,jsonExample:d}=u;return{type:"success",example:{jsonExample:d,shape:Ph.container(l)},jsonExample:d}}case"primitive":{let{jsonExample:u,example:l}=Qe_({fieldName:e,primitiveType:t.primitive});return{type:"success",example:{jsonExample:u,shape:Ph.primitive(l)},jsonExample:u}}case"unknown":{let u={key:"value"};return{type:"success",example:{jsonExample:u,shape:Ph.unknown(u)},jsonExample:u}}}}function PFi(e,t){let r=[];for(let i of e){let n=tq({fieldName:i.name.originalName,currentDepth:0,maxDepth:t.maxDepth??1,typeDeclarations:t.typeDeclarations,typeReference:i.valueType,skipOptionalProperties:t.skipOptionalRequestProperties});if(n.type==="failure")return n;r.push({name:i.name,value:n.example})}return{type:"success",example:r,jsonExample:void 0}}function GEn(e,t){let r=[];for(let i of e){if(t.skipOptionalRequestProperties&&mFi({typeDeclarations:t.typeDeclarations,typeReference:i.valueType}))continue;let n=tq({fieldName:i.name.name.originalName,currentDepth:0,maxDepth:t.maxDepth??1,typeDeclarations:t.typeDeclarations,typeReference:i.valueType,skipOptionalProperties:t.skipOptionalRequestProperties});if(n.type==="failure")return n;r.push({name:i.name,value:n.example})}return{type:"success",example:r,jsonExample:void 0}}function KNo(e,t){let r=[];for(let i of e){if(t.skipOptionalRequestProperties&&mFi({typeDeclarations:t.typeDeclarations,typeReference:i.valueType}))continue;let n=tq({fieldName:i.name.name.originalName,currentDepth:0,maxDepth:t.maxDepth??10,typeDeclarations:t.typeDeclarations,typeReference:i.valueType,skipOptionalProperties:t.skipOptionalRequestProperties});if(n.type==="failure")return n;r.push({name:i.name,shape:i.allowMultiple?D2.exploded():D2.single(),value:n.example})}return{type:"success",example:r,jsonExample:void 0}}var IXs=ud.primitive({v1:g0.String,v2:o_.string({default:void 0,validation:void 0})});function cba({ir:e,endpoint:t,service:r,typeDeclarations:i,skipOptionalRequestProperties:n,generationResponse:a}){let u={name:void 0,endpointHeaders:[],endpointPathParameters:[],queryParameters:[],servicePathParameters:[],serviceHeaders:[],rootPathParameters:[],request:void 0,response:Hq.ok(aC.body(void 0)),docs:void 0},l=PFi(t.pathParameters,{typeDeclarations:i,skipOptionalRequestProperties:n,maxDepth:1});if(l.type==="failure")return l;u.endpointPathParameters=l.example;let d=PFi(r.pathParameters,{typeDeclarations:i,skipOptionalRequestProperties:n,maxDepth:1});if(d.type==="failure")return d;u.servicePathParameters=d.example;let s=PFi(e.pathParameters,{typeDeclarations:i,skipOptionalRequestProperties:n,maxDepth:1});if(s.type==="failure")return s;u.rootPathParameters=s.example;let o=KNo(t.queryParameters,{typeDeclarations:i,skipOptionalRequestProperties:n,maxDepth:10});if(o.type==="failure")return o;u.queryParameters=o.example;let c=GEn(t.headers,{typeDeclarations:i,skipOptionalRequestProperties:n,maxDepth:1});if(c.type==="failure")return c;u.endpointHeaders=c.example;let b=GEn(r.headers,{typeDeclarations:i,skipOptionalRequestProperties:n,maxDepth:1});if(b.type==="failure")return b;if(u.serviceHeaders=b.example,t.requestBody!=null)switch(t.requestBody.type){case"bytes":return{type:"failure",message:"Bytes request unsupported"};case"fileUpload":return{type:"failure",message:"File upload unsupported"};case"inlinedRequestBody":{let g={},O=[];if(t.requestBody.extends!=null)for(let m of t.requestBody.extends){let P=i[m.typeId];if(P==null)throw new Error(`Failed to find extended type declaration with id ${m.typeId}`);let E=$En({typeDeclaration:P,typeDeclarations:i,currentDepth:1,maxDepth:10,skipOptionalProperties:n});E!=null&&E.type==="success"&&Object.assign(g,E.jsonExample)}for(let m of[...t.requestBody.properties??[],...t.requestBody.extendedProperties??[]]){let P=tq({fieldName:m.name.wireValue,typeReference:m.valueType,typeDeclarations:i,currentDepth:1,maxDepth:10,skipOptionalProperties:n});if(P.type==="failure"&&!mFi({typeDeclarations:i,typeReference:m.valueType}))return{type:"failure",message:`Failed to generate required property ${m.name.wireValue} b/c ${P.message}`};if(P.type==="failure")continue;let{example:E,jsonExample:A}=P;O.push({name:m.name,originalTypeDeclaration:void 0,value:E}),g[m.name.wireValue]=A}u.request=iG.inlinedRequestBody({jsonExample:g,properties:O});break}case"reference":{let g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.requestBody.requestBodyType,skipOptionalProperties:n});if(g.type==="failure")return g;let{example:O}=g;u.request=iG.reference(O);break}default:Fo(t.requestBody)}if(a.type==="success"&&t.response?.body!=null)switch(t.response.body.type){case"fileDownload":return{type:"failure",message:"File download unsupported"};case"json":{let g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.responseBodyType,skipOptionalProperties:!1});if(g.type==="failure")return g;let{example:O,jsonExample:m}=g;u.response=Hq.ok(aC.body({...O,jsonExample:m}));break}case"streamParameter":{let g;switch(t.response.body.nonStreamResponse.type){case"bytes":return{type:"failure",message:"Bytes unsupported"};case"fileDownload":return{type:"failure",message:"File download unsupported"};case"json":g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.nonStreamResponse.value.responseBodyType,skipOptionalProperties:!1});break;case"text":g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:IXs,skipOptionalProperties:!1});break;default:Fo(t.response.body.nonStreamResponse)}if(g.type==="failure")return g;let{example:O,jsonExample:m}=g;u.response=Hq.ok(aC.body({...O,jsonExample:m}));break}case"streaming":{let g;switch(t.response.body.value.type){case"sse":{if(g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.payload,skipOptionalProperties:!1}),g.type==="failure")return g;let{example:O,jsonExample:m}=g;u.response=Hq.ok(aC.sse([{data:{...O,jsonExample:m},event:""}]));break}case"json":{if(g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.payload,skipOptionalProperties:!1}),g.type==="failure")return g;let{example:O,jsonExample:m}=g;u.response=Hq.ok(aC.stream([{...O,jsonExample:m}]));break}case"text":{if(g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:IXs,skipOptionalProperties:!1}),g.type==="failure")return g;let{example:O,jsonExample:m}=g;u.response=Hq.ok(aC.stream([{...O,jsonExample:m}]));break}default:Fo(t.response.body.value)}break}case"text":{let g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:IXs,skipOptionalProperties:!1});if(g.type==="failure")return g;let{example:O,jsonExample:m}=g;u.response=Hq.ok(aC.body({...O,jsonExample:m}));break}case"bytes":return{type:"failure",message:"Bytes unsupported"};default:Fo(t.response.body)}else if(a.type==="error")if(a.declaration.type==null)u.response=Hq.error({body:void 0,error:a.declaration.name});else{let g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:a.declaration.type,skipOptionalProperties:n});if(g.type==="failure")return g;let{example:O}=g;u.response=Hq.error({body:O,error:a.declaration.name})}try{return{type:"success",example:{id:sba(u),url:gnE(t,u),...u},jsonExample:void 0}}catch(g){return{type:"failure",message:`Parse failure with exceptions ${g}`}}}function gnE(e,t){let r={};[...t.rootPathParameters,...t.servicePathParameters,...t.endpointPathParameters].forEach(n=>{let a=n.value.jsonExample,u=typeof a=="string"?a:JSON.stringify(a);r[n.name.originalName]=u});let i=e.fullPath.head+e.fullPath.parts.map(n=>r[n.pathParameter]+n.tail).join("");return i.startsWith("/")||i===""?i:`/${i}`}function Ke_({ir:e,channel:t,typeDeclarations:r,skipOptionalRequestProperties:i}){let n={name:void 0,pathParameters:[],headers:[],queryParameters:[],messages:[],docs:void 0},a=PFi(t.pathParameters,{typeDeclarations:r,skipOptionalRequestProperties:i,maxDepth:1});if(a.type==="failure")return a;n.pathParameters.push(...a.example);let u=PFi(e.pathParameters,{typeDeclarations:r,skipOptionalRequestProperties:i,maxDepth:1});if(u.type==="failure")return u;n.pathParameters.push(...u.example);let l=KNo(t.queryParameters,{typeDeclarations:r,skipOptionalRequestProperties:i,maxDepth:10});if(l.type==="failure")return l;n.queryParameters=l.example;let d=GEn(t.headers,{typeDeclarations:r,skipOptionalRequestProperties:i,maxDepth:1});if(d.type==="failure")return d;n.headers.push(...d.example);let s=GEn(e.headers,{typeDeclarations:r,skipOptionalRequestProperties:i,maxDepth:1});if(s.type==="failure")return s;n.headers.push(...s.example);let c=t.messages.filter(O=>O.origin==="client")[0];if(c!=null){let O=Je_({message:c,typeDeclarations:r,skipOptionalRequestProperties:i});O!=null&&n.messages.push({type:c.type,body:O})}let g=t.messages.filter(O=>O.origin==="server")[0];if(g!=null){let O=Je_({message:g,typeDeclarations:r,skipOptionalRequestProperties:i});O!=null&&n.messages.push({type:g.type,body:O})}return{type:"success",example:{...n,url:OnE(t,n)},jsonExample:void 0}}function Je_({message:e,typeDeclarations:t,skipOptionalRequestProperties:r}){if(e.body.type==="inlinedBody")return;let i=tq({currentDepth:0,maxDepth:10,typeDeclarations:t,typeReference:e.body.bodyType,skipOptionalProperties:r});if(i.type==="success")return CSe.reference(i.example)}function OnE(e,t){let r={};[...t.pathParameters].forEach(n=>{let a=n.value.jsonExample,u=typeof a=="string"?a:JSON.stringify(a);r[n.name.originalName]=u});let i=e.path.head+e.path.parts.map(n=>r[n.pathParameter]+n.tail).join("");return i.startsWith("/")||i===""?i:`/${i}`}function jFi({ir:e,exampleGeneration:t}){for(let[r,i]of Object.entries(e.services))for(let n of i.endpoints){if(n.userSpecifiedExamples.length>0&&t?.skipAutogenerationIfManualExamplesExist===!0)continue;let a=cba({ir:e,service:i,endpoint:n,typeDeclarations:e.types,skipOptionalRequestProperties:!t?.includeOptionalRequestPropertyExamples,generationResponse:{type:"success"}});if(a.type==="failure")continue;let{example:u}=a;n.autogeneratedExamples=[{example:u}]}for(let[r,i]of Object.entries(e.websocketChannels??{})){if(i.examples.length>0&&t?.skipAutogenerationIfManualExamplesExist===!0)continue;let n=Ke_({ir:e,channel:i,typeDeclarations:e.types,skipOptionalRequestProperties:!t?.includeOptionalRequestPropertyExamples});if(n.type==="failure")continue;let{example:a}=n;i.examples=[...i.examples,a]}return e}function zXs(e,t,r){let{environments:i,changedBaseUrlIds1:n,changedBaseUrlIds2:a}=mnE(e.environments,t.environments,r),{services:u,websocketChannels:l}=PnE(e,t,n,a);return{apiName:e.apiName,basePath:e.basePath,apiDisplayName:e.apiDisplayName??t.apiDisplayName,apiDocs:e.apiDocs??t.apiDocs,auth:e.auth??t.auth,headers:[...e.headers??[],...t.headers??[]],environments:i,types:{...e.types??{},...t.types??{}},constants:{...e.constants??{},...t.constants??{}},errors:{...e.errors??{},...t.errors??{}},services:u,webhookGroups:{...e.webhookGroups??{},...t.webhookGroups??{}},subpackages:{...e.subpackages??{},...t.subpackages??{}},websocketChannels:l,rootPackage:{service:e.rootPackage.service??t.rootPackage.service,types:[...e.rootPackage.types??[],...t.rootPackage.types??[]],errors:[...e.rootPackage.errors??[],...t.rootPackage.errors??[]],subpackages:[...e.rootPackage.subpackages??[],...t.rootPackage.subpackages??[]],fernFilepath:e.rootPackage.fernFilepath??t.rootPackage.fernFilepath,webhooks:e.rootPackage.webhooks??t.rootPackage.webhooks,websocket:e.rootPackage.websocket??t.rootPackage.websocket,hasEndpointsInTree:e.rootPackage.hasEndpointsInTree||t.rootPackage.hasEndpointsInTree,navigationConfig:e.rootPackage.navigationConfig??t.rootPackage.navigationConfig,docs:e.rootPackage.docs??t.rootPackage.docs},fdrApiDefinitionId:e.fdrApiDefinitionId??t.fdrApiDefinitionId,apiVersion:e.apiVersion??t.apiVersion,idempotencyHeaders:[...e.idempotencyHeaders??[],...t.idempotencyHeaders??[]],pathParameters:[...e.pathParameters??[],...t.pathParameters??[]],errorDiscriminationStrategy:e.errorDiscriminationStrategy??t.errorDiscriminationStrategy,variables:[...e.variables??[],...t.variables??[]],serviceTypeReferenceInfo:e.serviceTypeReferenceInfo??t.serviceTypeReferenceInfo,readmeConfig:e.readmeConfig??t.readmeConfig,sourceConfig:e.sourceConfig??t.sourceConfig,publishConfig:e.publishConfig??t.publishConfig,dynamic:e.dynamic??t.dynamic,sdkConfig:e.sdkConfig??t.sdkConfig}}function mnE(e,t,r){if(e==null&&t==null)return{environments:void 0,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};if(t==null)return{environments:e,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};if(e==null)return{environments:t,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};if(JSON.stringify(e)===JSON.stringify(t))return{environments:e,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};let i=Ye_(e),n=Ye_(t);if(i&&n&&e.environments.type==="singleBaseUrl"&&t.environments.type==="singleBaseUrl")return{environments:{defaultEnvironment:e.defaultEnvironment??t.defaultEnvironment,environments:FC.singleBaseUrl({environments:[...e.environments.environments,...t.environments.environments]})},changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};let a=i?t.defaultEnvironment:e.defaultEnvironment,u=e.environments,l=t.environments;if(u.type==="singleBaseUrl"&&l.type==="singleBaseUrl"){let d=i?l:u,s=i?u:l,o={},{deconflictedEnvironments2:c,changedBaseUrlIds2:b}=jnE(d,s,r);if(d.environments[0]==null)return{environments:t,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};let g="Base",O=r.generateName("Base");return d.environments.forEach(m=>{o[m.id]=g}),{environments:{defaultEnvironment:a,environments:FC.multipleBaseUrls({baseUrls:[{id:g,name:O},...c.environments.map(m=>({id:m.id,name:m.name}))],environments:d.environments.map(m=>({id:m.id,name:m.name,urls:{[g]:m.url,...Object.fromEntries(c.environments.map(P=>[P.id,P.url]))},docs:void 0}))})},changedBaseUrlIds1:o,changedBaseUrlIds2:b}}if(u.type==="multipleBaseUrls"&&l.type==="singleBaseUrl"||u.type==="singleBaseUrl"&&l.type==="multipleBaseUrls"){let d=u.type==="singleBaseUrl"?u:l,s=u.type==="multipleBaseUrls"?u:l,{deconflictedEnvironments1:o,changedBaseUrlIds1:c}=wnE(d,s,r);return{environments:{defaultEnvironment:a,environments:FC.multipleBaseUrls({baseUrls:[...s.baseUrls,...o.environments.map(b=>({id:b.id,name:b.name}))],environments:s.environments.map(b=>({...b,urls:{...b.urls,...Object.fromEntries(o.environments.map(g=>[g.id,g.url]))}}))})},changedBaseUrlIds1:u.type==="singleBaseUrl"?c:void 0,changedBaseUrlIds2:u.type==="singleBaseUrl"?void 0:c}}if(u.type==="multipleBaseUrls"&&l.type==="multipleBaseUrls"){let{deconflictedEnvironments:d,changedBaseUrlIds:s}=SnE(u,l,r);return{environments:{defaultEnvironment:a,environments:FC.multipleBaseUrls({baseUrls:[...u.baseUrls,...d.baseUrls],environments:u.environments.flatMap(o=>d.environments.map(c=>({...o,urls:{...o.urls,...c.urls}})))})},changedBaseUrlIds1:void 0,changedBaseUrlIds2:s}}return{environments:e??t,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0}}function PnE(e,t,r,i){if(r!=null)for(let[u,l]of Object.entries(r)){for(let d of Object.values(e.services))for(let s of Object.values(d.endpoints))s.baseUrl==u&&(s.baseUrl=l);for(let d of Object.values(e.websocketChannels??{}))d.baseUrl==u&&(d.baseUrl=l)}if(i!=null)for(let[u,l]of Object.entries(i)){for(let d of Object.values(t.services))for(let s of Object.values(d.endpoints))s.baseUrl==u&&(s.baseUrl=l);for(let d of Object.values(t.websocketChannels??{}))d.baseUrl==u&&(d.baseUrl=l)}let n={...e.services??{},...t.services??{}},a={...e.websocketChannels??{},...t.websocketChannels??{}};return{services:n,websocketChannels:a}}function jnE(e,t,r){let i={},n=new Set(e.environments.map(s=>s.id)),a=new Set(e.environments.map(s=>s.name)),u=new Map(e.environments.map(s=>[s.url,s.id])),l=t.environments.filter(s=>{let o=u.get(s.url);return o!=null?(i[s.id]=o,!1):!0}).map(s=>{if(n.has(s.id)||a.has(s.name)){let o=RXs(s.id,n);return i[s.id]=o,{...s,id:o,name:r.generateName(o)}}return s});return{deconflictedEnvironments2:FC.singleBaseUrl({environments:l}),changedBaseUrlIds2:i}}function wnE(e,t,r){let i={},n=new Set(t.baseUrls.map(d=>d.id)),a=new Set(t.baseUrls.map(d=>d.name)),u=e.environments.map(d=>{if(n.has(d.id)||a.has(d.name)){let s=RXs(d.id,n);return i[d.id]=s,{...d,id:s,name:r.generateName(s)}}return d});return{deconflictedEnvironments1:FC.singleBaseUrl({environments:u}),changedBaseUrlIds1:i}}function SnE(e,t,r){let i={},n=new Set(e.baseUrls.map(s=>s.id)),a=new Set(e.baseUrls.map(s=>s.name)),u=t.baseUrls.map(s=>{if(n.has(s.id)||a.has(s.name)){let o=RXs(s.id,n);return i[s.id]=o,{...s,id:o,name:r.generateName(o)}}return s}),l=t.environments.map(s=>({...s,urls:Object.fromEntries(Object.entries(s.urls).map(([o,c])=>[i[o]??o,c]))}));return{deconflictedEnvironments:FC.multipleBaseUrls({baseUrls:u,environments:l}),changedBaseUrlIds:i}}function Ye_(e){return e.environments.type==="singleBaseUrl"?e.environments.environments.some(t=>t.url&&(t.url.startsWith("ws://")||t.url.startsWith("wss://"))):e.environments.type==="multipleBaseUrls"?e.environments.environments.some(t=>Object.values(t.urls).some(r=>r&&(r.startsWith("ws://")||r.startsWith("wss://")))):!1}function RXs(e,t){let r=e,i=1;for(;t.has(r);)r=`${e}-${i}`,i++;return r}var og=class{breadcrumbs=[];constructor({breadcrumbs:t=[]}={}){this.breadcrumbs=t}};var Xe_={[Ay.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,fx(e)])),[Ay.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[Ay.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[Ay.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all"]),[Ay.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[Ay.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime"]),[Ay.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[Ay.GenerationLanguage.SWIFT]:new Set([])};var DnE=["go","ruby"];function ODe({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let u=c=>({unsafeName:c,safeName:EnE({name:c,keywords:MnE({generationLanguage:e,keywords:t})})}),l=U0(n),d=fx(l),s=xCi(n),o=qCi(l);return r&&(!TnE(o)&&(e==null||DnE.includes(e))&&(l=o.map((c,b)=>{if(b>0){let g=YNo(c);if(g!=null)return g;if(XNo(c))return c.toUpperCase()}return c}).join(""),d=o.map((c,b)=>{let g=YNo(c);return g??(XNo(c)?c.toUpperCase():b===0?fx(c):c)}).join("")),s=n.split(" ").map(c=>c.split(/(\d+)/).map(xCi).join("")).join("_")),{originalName:n,camelCase:u(a?.casingOverrides?.camel??l),snakeCase:u(a?.casingOverrides?.snake??s),screamingSnakeCase:u(a?.casingOverrides?.["screaming-snake"]??s.toUpperCase()),pascalCase:u(a?.casingOverrides?.pascal??d)}},generateNameAndWireValue:({name:n,wireValue:a,opts:u})=>({name:i.generateName(n,u),wireValue:a})};return i}function EnE({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":qnE(e)?"_"+e:e}function MnE({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return Xe_[e]}var AnE=/^[0-9]/;function qnE(e){return AnE.test(e)}function TnE(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=YNo(i)!=null||XNo(i),a=YNo(t)!=null||XNo(t);return n&&a})}function YNo(e){return BnE.get(e.toUpperCase())}function XNo(e){return CnE.has(e.toUpperCase())}var CnE=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),BnE=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var wFi=class e{args;spec;settings;logger;generationLanguage;smartCasing;casingsGenerator;namespace;constructor(t){this.args=t,this.spec=t.spec,this.settings=t.settings,this.logger=t.logger,this.generationLanguage=t.generationLanguage,this.smartCasing=t.smartCasing,this.namespace=t.namespace,this.casingsGenerator=ODe({generationLanguage:t.generationLanguage,keywords:void 0,smartCasing:t.smartCasing})}static BREADCRUMBS_TO_IGNORE=["properties","allOf","anyOf"];convertBreadcrumbsToName(t){let r=t.filter((n,a)=>!(/^\d+$/.test(n)||e.BREADCRUMBS_TO_IGNORE.includes(n)||a===0&&n==="components"||a===1&&n==="schemas"||t[0]==="paths"&&(a===0||a===1&&["get","post","put","delete","patch"].includes(n)||a===2&&t[1]!=null&&["get","post","put","delete","patch"].includes(t[1])&&n==="parameters"))),i=U0(r.join("_"));return i.charAt(0).toUpperCase()+i.slice(1)}createPackage(t={}){return{fernFilepath:this.createFernFilepath(t),service:void 0,types:[],errors:[],subpackages:[],docs:void 0,webhooks:void 0,websocket:void 0,hasEndpointsInTree:!1,navigationConfig:void 0}}createFernFilepath(t={}){let r=this.namespace!=null?[this.casingsGenerator.generateName(this.namespace)]:[],i=t.name!=null?this.casingsGenerator.generateName(t.name):void 0;return{allParts:i?[...r,i]:r,packagePath:r,file:i}}async resolveReference(t){let r=this.spec,i;if(t.$ref.startsWith("http://")||t.$ref.startsWith("https://")){let a=t.$ref.split("#"),u=a[0];if(i=a[1],!u)return{resolved:!1};let l=await fetch(u);if(!l.ok)return{resolved:!1};try{let d=await l.text();try{r=JSON.parse(d)}catch{r=Yd.load(d)}if(r==null)return{resolved:!1}}catch{return{resolved:!1}}if(!i)return{resolved:!0,value:r}}let n=(i??t.$ref).replace(/^(?:(?:https?:\/\/)?|#?\/?)?/,"").split("/").map(a=>a.replace(/~1/g,"/"));for(let a of n){if(typeof r!="object"||r==null)return{resolved:!1};r=r[a]}return r==null?{resolved:!1}:{resolved:!0,value:r}}async getPropertyAccess(t){let r=t;for(;this.isReferenceObject(r);){let i=await this.resolveReference(r);if(!i.resolved)return;r=i.value}if(!(r.readOnly&&r.writeOnly)){if(r.readOnly)return fJt.ReadOnly;if(r.writeOnly)return fJt.WriteOnly}}async getAvailability({node:t,breadcrumbs:r,errorCollector:i}){for(;this.isReferenceObject(t);){let u=await this.resolveReference(t);if(!u.resolved)return;t=u.value}let a=await new G2.FernAvailabilityExtension({node:t,breadcrumbs:r}).convert({context:this,errorCollector:i});if(a!=null)return{status:a,message:void 0};if(t.deprecated===!0)return{status:h5.Deprecated,message:void 0}}getTypeIdFromSchemaReference(t){let r=t.$ref.match(/\/schemas\/(.+)$/);if(!(!r||!r[1]))return r[1]}createNamedTypeReference(t){return ud.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(t??"defaultName"),typeId:t,default:void 0,inline:!1})}typeReferenceToDeclaredTypeName(t){if(t.type!=="named")return;let r=t.typeId;return{typeId:r,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r)}}removeSchemaFromInlinedTypes({id:t,inlinedTypes:r}){return Object.fromEntries(Object.entries(r).filter(([i])=>i!==t))}maybeTrimPrefix(t,r){return t.startsWith(r)?t.slice(r.length):t}isReferenceObject(t){return typeof t=="object"&&t!==null&&"$ref"in t}isOptional(t){return t.type==="container"&&t.container.type==="optional"}isList(t){return t.type==="container"&&t.container.type==="list"}isFile(t){return t.type==="primitive"&&t.primitive.v2?.type==="string"&&t.primitive.v2.validation?.format==="binary"}getAsString(t){if(typeof t=="string")return t}getAsInteger(t){if(typeof t=="number"&&Number.isInteger(t))return t}getAsNumber(t){if(typeof t=="number")return t}getAsBoolean(t){if(typeof t=="boolean")return t}getAsArray(t){if(Array.isArray(t))return t}getAsObject(t){if(typeof t=="object"&&t!==null&&!Array.isArray(t))return t}};var sC=class extends og{getExtensionValue(t){if(!(typeof t!="object"||t==null))return t[this.key]}};var Q2={};Eo(Q2,{SchemaConverters:()=>NXs});var NXs={};Eo(NXs,{ArraySchemaConverter:()=>XEn,EnumSchemaConverter:()=>QEn,ObjectSchemaConverter:()=>JEn,OneOfSchemaConverter:()=>KEn,PrimitiveSchemaConverter:()=>YEn,SchemaConverter:()=>b_i,SchemaOrReferenceConverter:()=>nRe});var QEn=class extends og{schema;maybeFernEnum;constructor({breadcrumbs:t,schema:r,maybeFernEnum:i}){super({breadcrumbs:t}),this.schema=r,this.maybeFernEnum=i}convert({context:t,errorCollector:r}){if(!this.schema.enum)return;let n=this.schema.enum.filter(u=>typeof u=="string").map(u=>{let l=this.maybeFernEnum?.[u],d=l?.name??u.toString();return{name:t.casingsGenerator.generateNameAndWireValue({name:d,wireValue:u.toString()}),docs:l?.description,availability:void 0,casing:l?.casing}});if(n.length===0)return;let a=t.getAsString(this.schema.default);return{enum:mj.enum({default:a!=null?n.find(u=>u.name.wireValue===a):void 0,values:n})}}};var JEn=class extends og{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(!this.schema.properties&&!this.schema.allOf)return{object:mj.object({properties:[],extends:[],extendedProperties:[],extraProperties:this.schema.additionalProperties!=null})};let i=[],n={};for(let[u,l]of Object.entries(this.schema.properties??{})){let d=[...this.breadcrumbs,"properties",u],s="nullable"in l?l.nullable:!1,o=t.convertBreadcrumbsToName(d),b=await new nRe({breadcrumbs:d,schemaOrReference:l,schemaIdOverride:o,wrapAsOptional:!this.schema.required?.includes(u),wrapAsNullable:s}).convert({context:t,errorCollector:r});b!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u}),valueType:b.type,docs:l.description,availability:b.availability,propertyAccess:await t.getPropertyAccess(l)}),n={...n,...b.inlinedTypes})}let a=[];for(let[u,l]of(this.schema.allOf??[]).entries()){let d=[...this.breadcrumbs,"allOf",u.toString()];if(t.isReferenceObject(l)){let s=await t.convertReferenceToTypeReference(l);s.ok&&a.push(s.reference);continue}for(let[s,o]of Object.entries(l.properties??{})){let c=[...d,s],b=t.convertBreadcrumbsToName(c),O=await new nRe({breadcrumbs:c,schemaOrReference:o,schemaIdOverride:b,wrapAsOptional:!l.required?.includes(s),wrapAsNullable:"nullable"in o?o.nullable:!1}).convert({context:t,errorCollector:r});O!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:s,wireValue:s}),valueType:O.type,docs:o.description,availability:O.availability,propertyAccess:await t.getPropertyAccess(o)}),n={...n,...O.inlinedTypes})}}return{object:mj.object({properties:i,extends:a.map(u=>t.typeReferenceToDeclaredTypeName(u)).filter(Kb),extendedProperties:[],extraProperties:this.schema.additionalProperties!=null}),inlinedTypes:n}}};var KEn=class extends og{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){return this.schema.discriminator!=null?await this.convertAsDiscriminatedUnion({context:t,errorCollector:r}):this.convertAsUndiscriminatedUnion({context:t,errorCollector:r})}async convertAsDiscriminatedUnion({context:t,errorCollector:r}){let i=[],n={};if(this.schema.discriminator==null)return;for(let[u,l]of Object.entries(this.schema.discriminator.mapping??{})){let d=new nRe({schemaOrReference:{$ref:l},breadcrumbs:[...this.breadcrumbs,"discriminator","mapping",u]}),s=t.getTypeIdFromSchemaReference({$ref:l}),o=await d.convert({context:t,errorCollector:r});if(o?.type!=null&&s!=null){let c=t.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u});i.push({docs:void 0,discriminantValue:c,availability:o.availability,displayName:void 0,shape:nG.samePropertiesAsObject({typeId:s,name:t.casingsGenerator.generateName(s),fernFilepath:{allParts:[],packagePath:[],file:void 0}})}),n={...n,...o.inlinedTypes}}}let a=[];for(let[u,l]of Object.entries(this.schema.properties??{})){let d=[...this.breadcrumbs,"properties",u],s="nullable"in l?l.nullable:!1,o=t.convertBreadcrumbsToName(d),b=await new nRe({breadcrumbs:d,schemaOrReference:l,schemaIdOverride:o,wrapAsOptional:!this.schema.required?.includes(u),wrapAsNullable:s}).convert({context:t,errorCollector:r});b!=null&&(a.push({name:t.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u}),valueType:b.type,docs:l.description,availability:b.availability,propertyAccess:await t.getPropertyAccess(l)}),n={...n,...b.inlinedTypes})}return{union:mj.union({baseProperties:a,discriminant:t.casingsGenerator.generateNameAndWireValue({name:this.schema.discriminator.propertyName,wireValue:this.schema.discriminator.propertyName}),extends:[],types:i}),inlinedTypes:n}}async convertAsUndiscriminatedUnion({context:t,errorCollector:r}){if(!this.schema.oneOf&&!this.schema.anyOf||this.schema.anyOf?.length===0&&this.schema.oneOf?.length===0)return;let i=[],n={};for(let[a,u]of[...(this.schema.oneOf??[]).entries(),...(this.schema.anyOf??[]).entries()]){let l=[...this.breadcrumbs,"oneOf",lba(a)??""];if(t.isReferenceObject(u)){let c=await t.convertReferenceToTypeReference(u);c.ok&&i.push({type:c.reference,docs:u.description});continue}let d=t.convertBreadcrumbsToName(l),o=await new b_i({id:d,breadcrumbs:l,schema:u}).convert({context:t,errorCollector:r});o!=null&&(i.push({type:t.createNamedTypeReference(d),docs:u.description}),n={...n,...o.inlinedTypes,[d]:o.typeDeclaration})}return{union:mj.undiscriminatedUnion({members:i}),inlinedTypes:n}}};var YEn=class extends og{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){switch(this.schema.type){case"string":{let i=t.getAsString(this.schema.const);return i!=null?ud.container(Kv.literal(y5.string(i))):ud.primitive({v1:"STRING",v2:o_.string({default:t.getAsString(this.schema.default),validation:this.getStringValidation(this.schema)})})}case"number":case"integer":switch(this.schema.format){case"double":return ud.primitive({v1:"DOUBLE",v2:o_.double({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"float":return ud.primitive({v1:"FLOAT",v2:o_.float({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int32":return ud.primitive({v1:"INTEGER",v2:o_.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int64":return ud.primitive({v1:"LONG",v2:o_.long({default:t.getAsNumber(this.schema.default)})});case"uint32":return ud.primitive({v1:"UINT",v2:o_.uint({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint64":return ud.primitive({v1:"UINT_64",v2:o_.uint64({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});default:return ud.primitive({v1:"INTEGER",v2:o_.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})})}case"boolean":{let i=t.getAsBoolean(this.schema.const);return i!=null?ud.container(Kv.literal(y5.boolean(i))):ud.primitive({v1:"BOOLEAN",v2:o_.boolean({default:this.schema.default})})}default:return}}getNumberValidation(t){return{max:t.maximum,min:t.minimum,exclusiveMax:typeof t.exclusiveMaximum=="boolean"?t.exclusiveMaximum:void 0,exclusiveMin:typeof t.exclusiveMinimum=="boolean"?t.exclusiveMinimum:void 0,multipleOf:t.multipleOf}}getStringValidation(t){return{minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,format:t.format}}};var b_i=class extends og{schema;id;inlined;constructor({breadcrumbs:t,schema:r,id:i,inlined:n=!1}){super({breadcrumbs:t}),this.schema=r,this.id=i,this.inlined=n}async convert({context:t,errorCollector:r}){let n=new G2.FernTypeExtension({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r});if(n!=null){let l=await this.createTypeDeclarationFromFernType({fernType:n,context:t,errorCollector:r});if(l!=null)return{typeDeclaration:l,inlinedTypes:{}}}if(this.schema.enum?.length){let d=new G2.FernEnumExtension({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r}),o=new QEn({breadcrumbs:this.breadcrumbs,schema:this.schema,maybeFernEnum:d}).convert({context:t,errorCollector:r});if(o!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:o.enum,context:t,errorCollector:r}),inlinedTypes:{}}}let u=new YEn({schema:this.schema}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:mj.alias({aliasOf:u,resolvedType:u}),context:t,errorCollector:r}),inlinedTypes:{}};if(this.schema.type==="array"){let d=await new XEn({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r});if(d!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:mj.alias({aliasOf:d.typeReference,resolvedType:d.typeReference}),context:t,errorCollector:r}),inlinedTypes:d.inlinedTypes??{}}}if(this.schema.oneOf!=null||this.schema.anyOf!=null){let d=await new KEn({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(d!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:d.union,context:t,errorCollector:r}),inlinedTypes:d.inlinedTypes??{}}}if(this.schema.type==="object"||this.schema.properties!=null||this.schema.allOf!=null){let d=await new JEn({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(d!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:d.object,context:t,errorCollector:r}),inlinedTypes:d.inlinedTypes??{}}}}async createTypeDeclaration({shape:t,context:r,errorCollector:i}){return{name:this.convertDeclaredTypeName({context:r}),shape:t,autogeneratedExamples:[],userProvidedExamples:[],encoding:void 0,availability:await r.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs,errorCollector:i}),docs:this.schema.description,referencedTypes:new Set,source:void 0,inline:this.inlined}}convertDeclaredTypeName({context:t}){return{typeId:this.id,fernFilepath:t.createFernFilepath(),name:t.casingsGenerator.generateName(this.id)}}async createTypeDeclarationFromFernType({fernType:t,context:r,errorCollector:i}){let n=this.createTypeReferenceFromFernType(t);if(n!=null)return{name:this.convertDeclaredTypeName({context:r}),shape:mj.alias({aliasOf:n,resolvedType:n}),autogeneratedExamples:[],userProvidedExamples:[],encoding:void 0,availability:await r.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs,errorCollector:i}),docs:this.schema.description,referencedTypes:new Set,source:void 0,inline:this.inlined}}createTypeReferenceFromFernType(t){return E2({type:t,_default:void 0,validation:void 0,visitor:{primitive:r=>{switch(r.v1){case"BASE_64":return ud.primitive({v1:"BASE_64",v2:o_.base64({})});case"BOOLEAN":return ud.primitive({v1:"BOOLEAN",v2:o_.boolean({default:void 0})});case"DATE":return ud.primitive({v1:"DATE",v2:o_.date({})});case"DATE_TIME":return ud.primitive({v1:"DATE_TIME",v2:o_.dateTime({})});case"FLOAT":return ud.primitive({v1:"FLOAT",v2:o_.float({})});case"DOUBLE":return ud.primitive({v1:"DOUBLE",v2:o_.double({default:void 0,validation:void 0})});case"UINT":return ud.primitive({v1:"UINT",v2:o_.uint({})});case"UINT_64":return ud.primitive({v1:"UINT_64",v2:o_.uint64({})});case"INTEGER":return ud.primitive({v1:"INTEGER",v2:o_.integer({default:void 0,validation:void 0})});case"LONG":return ud.primitive({v1:"LONG",v2:o_.long({default:void 0})});case"STRING":return ud.primitive({v1:"STRING",v2:o_.string({default:void 0,validation:void 0})});case"UUID":return ud.primitive({v1:"UUID",v2:o_.uuid({})});case"BIG_INTEGER":return ud.primitive({v1:"BIG_INTEGER",v2:o_.bigInteger({default:void 0})});default:return}},unknown:()=>ud.unknown(),map:({keyType:r,valueType:i})=>{if(!(r==null||i==null))return ud.container(Kv.map({keyType:r,valueType:i}))},list:r=>{if(r!=null)return ud.container(Kv.list(r))},optional:r=>{if(r!=null)return ud.container(Kv.optional(r))},nullable:r=>{if(r!=null)return ud.container(Kv.nullable(r))},set:r=>{if(r!=null)return ud.container(Kv.set(r))},literal:r=>ud.container(Kv.literal(r._visit({string:i=>y5.string(i),boolean:i=>y5.boolean(i),_other:()=>{throw new Error("Unexpected literal type")}}))),named:()=>{}}})}};var nRe=class extends og{schemaOrReference;schemaIdOverride;wrapAsOptional;wrapAsNullable;constructor({breadcrumbs:t,schemaOrReference:r,schemaIdOverride:i,wrapAsOptional:n=!1,wrapAsNullable:a=!1}){super({breadcrumbs:t}),this.schemaOrReference=r,this.schemaIdOverride=i,this.wrapAsOptional=n,this.wrapAsNullable=a}async convert({context:t,errorCollector:r}){if(t.isReferenceObject(this.schemaOrReference)){let l=await t.convertReferenceToTypeReference(this.schemaOrReference);return l.ok?{type:l.reference,inlinedTypes:{}}:void 0}let i=this.schemaIdOverride??t.convertBreadcrumbsToName(this.breadcrumbs),n=new b_i({breadcrumbs:this.breadcrumbs,schema:this.schemaOrReference,id:i}),a=await t.getAvailability({node:this.schemaOrReference,breadcrumbs:this.breadcrumbs,errorCollector:r}),u=await n.convert({context:t,errorCollector:r});if(u!=null){if(u.typeDeclaration.shape.type==="alias"){let d=u.typeDeclaration.shape.aliasOf;return{type:this.wrapTypeReference(d),inlinedTypes:u.inlinedTypes,availability:a}}let l=t.createNamedTypeReference(i);return{type:this.wrapTypeReference(l),schema:u.typeDeclaration,inlinedTypes:{...u.inlinedTypes,[i]:u.typeDeclaration},availability:a}}}wrapTypeReference(t){return this.wrapAsOptional&&this.wrapAsNullable?this.wrapInOptional(this.wrapInNullable(t)):this.wrapAsOptional?this.wrapInOptional(t):this.wrapAsNullable?this.wrapInNullable(t):t}wrapInOptional(t){return ud.container(Kv.optional(t))}wrapInNullable(t){return ud.container(Kv.nullable(t))}};var XEn=class e extends og{static LIST_UNKNOWN=ud.container(Kv.list(ud.unknown()));schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(this.schema.items==null)return{typeReference:e.LIST_UNKNOWN};let n=await new nRe({breadcrumbs:[...this.breadcrumbs,"items"],schemaOrReference:this.schema.items}).convert({context:t,errorCollector:r});return n!=null?{typeReference:ud.container(Kv.list(n.type)),inlinedTypes:n.inlinedTypes}:{typeReference:e.LIST_UNKNOWN}}};var fba=class{errors=[];logger;constructor({logger:t}){this.logger=t}collect(t){this.errors.push(t)}getErrors(){return this.errors}hasErrors(){return this.errors.length>0}logErrors(){for(let t of this.errors)this.logger.log(W0.Info,Hie({title:t.message,breadcrumbs:t.path,subtitle:t.path!=null?eh.dim(t.path.join(" -> ")):void 0}))}};var G2={};Eo(G2,{FernAvailabilityExtension:()=>ZNo,FernEnumExtension:()=>kNo,FernIgnoreExtension:()=>eFo,FernOptionalExtension:()=>tFo,FernTypeExtension:()=>nFo,SdkGroupNameExtension:()=>rFo,SdkMethodNameExtension:()=>iFo});var ZNo=class extends sC{node;key="x-fern-availability";constructor({breadcrumbs:t,node:r}){super({breadcrumbs:t}),this.node=r}async convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.node);if(i==null||typeof i!="string")return;switch(i.toUpperCase().replace(/[-_\s]/g,"_")){case"IN_DEVELOPMENT":return h5.InDevelopment;case"PRE_RELEASE":return h5.PreRelease;case"GENERAL_AVAILABILITY":return h5.GeneralAvailability;case"DEPRECATED":return h5.Deprecated;default:return}}};var xnE=Yu.object({snake:Yu.string().optional(),camel:Yu.string().optional(),screamingSnake:Yu.string().optional(),pascal:Yu.string().optional()}),InE=Yu.object({description:Yu.string().optional(),name:Yu.string().optional(),casing:xnE.optional()}),Ze_=Yu.record(InE);var kNo=class extends sC{schema;key="x-fern-enum";constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.schema);if(i==null)return;let n=Ze_.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-enum extension: ${n.error.message}`,path:this.breadcrumbs});return}return n.data}};var eFo=class extends sC{operation;key="x-fern-ignore";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-ignore",path:this.breadcrumbs});return}return i}}};var tFo=class extends sC{parameter;key="x-fern-optional";constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.parameter);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-optional",path:this.breadcrumbs});return}return i}}};var rFo=class extends sC{operation;key="x-fern-sdk-group-name";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=Array.isArray(i)?i.filter(a=>typeof a=="string"):typeof i=="string"?[i]:[];if(n.length!==0)return{groups:n}}};var iFo=class extends sC{operation;key="x-fern-sdk-method-name";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null&&typeof i=="string")return{methodName:i}}};var nFo=class extends sC{schema;key="x-fern-type";constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.schema);if(i!=null&&typeof i=="string")return i}};function lba(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],i=["","","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 u=Math.floor(e/10),l=e%10;return l===0?i[u]:`${i[u]}_${t[l]}`}if(e<1e3){let u=Math.floor(e/100),l=e%100;return l===0?`${t[u]}_hundred`:`${t[u]}_hundred_${lba(l)}`}let n=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[n]}_thousand`:`${t[n]}_thousand_${lba(a)}`}var g_i=class e extends og{static STRING=ud.primitive({v1:"STRING",v2:o_.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=ud.container(Kv.optional(e.STRING));parameter;constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}async convert({context:t,errorCollector:r}){let a=new G2.FernOptionalExtension({breadcrumbs:this.breadcrumbs,parameter:this.parameter}).convert({context:t,errorCollector:r})??this.parameter.required??!1,u=this.parameter.schema;u==null&&(u={...this.parameter,type:"string",enum:this.parameter.enum,default:this.parameter.default,example:this.parameter.examples?.[0],examples:void 0,required:void 0});let l,d={},o=await new Q2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaIdOverride:this.parameter.name,schemaOrReference:u,wrapAsOptional:a}).convert({context:t,errorCollector:r});o!=null&&(l=o.type,d=o.inlinedTypes??{});let c=await t.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs,errorCollector:r});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:l??(a?e.OPTIONAL_STRING:e.STRING),allowMultiple:this.parameter.explode??!1,availability:c},inlinedTypes:d};case"header":return{type:"header",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:l??(a?e.OPTIONAL_STRING:e.STRING),env:void 0,availability:c},inlinedTypes:d};case"path":return{type:"path",parameter:{name:t.casingsGenerator.generateName(this.parameter.name),docs:this.parameter.description,valueType:l??(a?e.OPTIONAL_STRING:e.STRING),location:"ENDPOINT",variable:void 0},inlinedTypes:d};default:r.collect({message:`Unsupported parameter location: ${this.parameter.in}`,path:this.breadcrumbs});return}}};var aFo=class extends og{channel;channelPath;group;inlinedTypes={};constructor({breadcrumbs:t,channel:r,channelPath:i,group:n}){super({breadcrumbs:t}),this.channel=r,this.channelPath=i,this.group=n}async convert({context:t,errorCollector:r}){let i=[],n=[],a=[],u=this.group?this.group.join("."):this.channelPath;this.channel.parameters&&await this.convertQueryParameters({context:t,errorCollector:r,queryParameters:n}),this.channel.bindings?.ws!=null&&(await this.convertHeaders({context:t,errorCollector:r,headers:a}),await this.convertBindingQueryParameters({context:t,errorCollector:r,queryParameters:n}));let l;this.channel.subscribe!=null&&(l=await this.convertMessage({context:t,errorCollector:r,origin:"server",operation:this.channel.subscribe,defaultId:"subscribeEvent",breadcrumbName:"subscribeEvent"}));let d;this.channel.publish!=null&&(d=await this.convertMessage({context:t,errorCollector:r,origin:"client",operation:this.channel.publish,defaultId:"publishEvent",breadcrumbName:"publishEvent"}));let s=[];l!=null&&s.push(l),d!=null&&s.push(d);let o=this.channel.servers?.[0]??Object.keys(t.spec.servers??{})[0];return{channel:{name:t.casingsGenerator.generateName(u),displayName:u,baseUrl:o,path:{head:this.transformToValidPath(this.channel.address??this.channelPath),parts:[]},auth:!1,headers:a,queryParameters:n,pathParameters:i,messages:s,examples:[],availability:await t.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.channel.description},inlinedTypes:this.inlinedTypes}}async convertMessage({context:t,errorCollector:r,origin:i,operation:n,defaultId:a,breadcrumbName:u}){let l;if(t.isReferenceObject(n.message)){let d=await t.resolveReference(n.message);d.resolved&&(n.message=d.value)}if("oneOf"in n.message){let s=await new Q2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,u],schemaOrReference:n.message,schemaIdOverride:n.operationId??a}).convert({context:t,errorCollector:r});s!=null&&s.schema!=null&&(l=s.schema,this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes})}else if(t.isMessageWithPayload(n.message)){let d;if(t.isReferenceObject(n.message.payload)){let s=await t.resolveReference(n.message.payload);s.resolved&&(d=s.value)}else d=n.message.payload;if(d!=null){let o=await new Q2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,u],schemaOrReference:d,schemaIdOverride:n.operationId??a}).convert({context:t,errorCollector:r});o!=null&&o.schema!=null&&(l=o.schema,this.inlinedTypes={...this.inlinedTypes,...o.inlinedTypes})}}if(l!=null){let d=l,s=sc.TypeReference.named({fernFilepath:t.createFernFilepath(),name:d.name.name,typeId:d.name.typeId,default:void 0,inline:!1}),o=sc.WebSocketMessageBody.reference({bodyType:s,docs:n.description});return{type:d.name.typeId,displayName:d.name.name.originalName,origin:i,body:o,availability:await t.getAvailability({node:n,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:n.description}}}async convertQueryParameters({context:t,errorCollector:r,queryParameters:i}){for(let[n,a]of Object.entries(this.channel.parameters??{})){let u=a;if(t.isReferenceObject(a)){let s=await t.resolveReference(a);if(s.resolved)u=s.value;else continue}let d=await new g_i({breadcrumbs:this.breadcrumbs,parameter:{...u,name:n,in:"query",description:a.description,required:a.required??!1}}).convert({context:t,errorCollector:r});d!=null&&(this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},d.type==="query"&&i.push(d.parameter))}}async convertHeaders({context:t,errorCollector:r,headers:i}){if(this.channel.bindings?.ws?.headers!=null){let n=this.channel.bindings.ws.headers.required??[];for(let[a,u]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let l=u;if(t.isReferenceObject(u)){let o=await t.resolveReference(u);if(!o.resolved)continue;l=o.value}let s=await new g_i({breadcrumbs:[...this.breadcrumbs,a],parameter:{name:a,in:"header",required:n.includes(a),schema:l,description:"description"in l?l.description:void 0}}).convert({context:t,errorCollector:r});s!=null&&s.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes},i.push(s.parameter))}}}async convertBindingQueryParameters({context:t,errorCollector:r,queryParameters:i}){if(this.channel.bindings?.ws?.query!=null){let n=this.channel.bindings.ws.query.required??[];for(let[a,u]of Object.entries(this.channel.bindings.ws.query.properties??{})){let l=u;if(t.isReferenceObject(u)){let o=await t.resolveReference(u);if(!o.resolved)continue;l=o.value}let s=await new g_i({breadcrumbs:[...this.breadcrumbs,a],parameter:{name:a,in:"query",required:n.includes(a),schema:l,description:"description"in l?l.description:void 0}}).convert({context:t,errorCollector:r});s!=null&&s.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes},i.push(s.parameter))}}}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var oFo=class extends og{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||Object.keys(this.servers).length===0)return;let i=[],n;for(let[a,u]of Object.entries(this.servers)){let l={id:a,name:t.casingsGenerator.generateName(a),url:this.constructServerUrl(u.protocol,u.url),docs:void 0};i.push(l),n==null&&(n=l.id)}return{defaultEnvironment:n,environments:FC.singleBaseUrl({environments:i})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var FXs="$message.",ke_="#/channels/",et_="#/servers/",uFo=class extends og{channel;channelPath;operations;group;inlinedTypes={};constructor({breadcrumbs:t,channel:r,channelPath:i,operations:n,group:a}){super({breadcrumbs:t}),this.channel=r,this.channelPath=i,this.operations=n,this.group=a}async convert({context:t,errorCollector:r}){let i=[],n=[],a=[],u=this.group?this.group.join("."):this.channelPath;this.channel.parameters&&await this.convertChannelParameters({context:t,errorCollector:r,pathParameters:i,queryParameters:n,headers:a});let l=Object.entries(this.operations).reduce((o,[c,b])=>{try{this.getChannelPathFromOperation(b)===this.channelPath&&(o[c]=b)}catch{}return o},{}),d=[];for(let[o,c]of Object.entries(l))for(let b of c.messages){let g=await t.convertReferenceToTypeReference(b);if(g.ok){let O=sc.WebSocketMessageBody.reference({bodyType:g.reference,docs:c.description});d.push({type:o,displayName:o,origin:c.action==="send"?"client":"server",body:O,availability:await t.getAvailability({node:c,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:c.description})}}let s=this.resolveChannelServersFromReference(this.channel.servers??[],r)??Object.keys(t.spec.servers??{})[0];return{channel:{name:t.casingsGenerator.generateName(u),displayName:u,baseUrl:s,path:{head:this.transformToValidPath(this.channel.address??this.channelPath),parts:[]},auth:!1,headers:a,queryParameters:n,pathParameters:i,messages:d,examples:[],availability:await t.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.channel.description},inlinedTypes:this.inlinedTypes}}async convertChannelParameters({context:t,errorCollector:r,pathParameters:i,queryParameters:n,headers:a}){for(let u of Object.values(this.channel.parameters??{})){let l=u;if(t.isReferenceObject(u)){let g=await t.resolveReference(u);if(g.resolved)l=g.value;else continue}let d=this.convertChannelParameterLocation(u.location,r);if(d==null)continue;let{type:s,parameterKey:o}=d,b=await new g_i({breadcrumbs:this.breadcrumbs,parameter:{...l,name:o,in:s}}).convert({context:t,errorCollector:r});if(b!=null)switch(this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},b.type){case"path":i.push(b.parameter);break;case"query":n.push(b.parameter);break;case"header":a.push(b.parameter);break}}}convertChannelParameterLocation(t,r){try{let[i,n]=t.split("#/");if(i==null||n==null){r.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!i.startsWith(FXs)){r.collect({message:`Invalid location format: ${t}; expected ${FXs} prefix`,path:this.breadcrumbs});return}let a=i.substring(FXs.length);if(a!=="header"&&a!=="path"&&a!=="payload"){r.collect({message:`Invalid message type: ${a}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return a==="payload"?{type:"query",parameterKey:n}:{type:a,parameterKey:n}}catch{r.collect({message:`Invalid location format: ${t}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`,path:this.breadcrumbs});return}}resolveChannelServersFromReference(t,r){if(t==null||t.length===0||t[0]==null)return;let i=t[0];if(!i.$ref.startsWith(et_)){r.collect({message:`Failed to resolve server name from server ref ${i.$ref}`,path:this.breadcrumbs});return}let n=i.$ref.substring(et_.length);if(n==null){r.collect({message:`Failed to find server with name ${n}`,path:this.breadcrumbs});return}return n}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(ke_))throw new Error(`Failed to resolve channel path from operation ${t.channel.$ref}`);return t.channel.$ref.substring(ke_.length)}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var sFo=class extends og{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||Object.keys(this.servers).length===0)return;let i=[],n;for(let[a,u]of Object.entries(this.servers)){let l={id:a,name:t.casingsGenerator.generateName(a),url:this.constructServerUrl(u.protocol,u.host),docs:void 0};i.push(l),n==null&&(n=l.id)}return{defaultEnvironment:n,environments:FC.singleBaseUrl({environments:i})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var dba=class extends og{ir;constructor({breadcrumbs:t,context:r}){super({breadcrumbs:t}),this.ir={auth:{docs:void 0,requirement:sc.AuthSchemesRequirement.All,schemes:[]},types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:sc.ErrorDiscriminationStrategy.statusCode(),variables:[],serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:r.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}}}}async convert({context:t,errorCollector:r}){t.spec=this.removeXFernIgnores({document:t.spec,context:t,errorCollector:r}),this.isAsyncAPIV3(t)?await this.convertChannelMessages({context:t,errorCollector:r}):await this.convertComponentMessages({context:t,errorCollector:r}),await this.convertSchemas({context:t,errorCollector:r}),await this.convertServers({context:t,errorCollector:r}),await this.convertChannels({context:t,errorCollector:r});let i={...this.ir,apiName:t.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:t.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}};return i={...i,...jFi({ir:i,exampleGeneration:{disabled:!1}})},i}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}removeXFernIgnores({document:t,context:r,errorCollector:i,breadcrumbs:n=[]}){return Array.isArray(t)?t.filter((a,u)=>!new G2.FernIgnoreExtension({breadcrumbs:[...n,String(u)],operation:a}).convert({context:r,errorCollector:i})).map((a,u)=>this.removeXFernIgnores({document:a,context:r,errorCollector:i,breadcrumbs:[...n,String(u)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([a,u])=>!new G2.FernIgnoreExtension({breadcrumbs:[...n,a],operation:u}).convert({context:r,errorCollector:i})).map(([a,u])=>[a,this.removeXFernIgnores({document:u,context:r,errorCollector:i,breadcrumbs:[...n,a]})])):t}async convertChannelMessages({context:t,errorCollector:r}){let i=t.spec;for(let[n,a]of Object.entries(i.channels??{}))for(let[u,l]of Object.entries(a.messages??{})){if(!t.isMessageWithPayload(l)&&!t.isReferenceObject(l))continue;let d;if(t.isMessageWithPayload(l))if(t.isReferenceObject(l.payload)){let b=await t.resolveReference(l.payload);b.resolved&&(d=b.value)}else d=l.payload;else if(t.isReferenceObject(l)){let b=await t.resolveReference(l);if(b.resolved){let g=b.value.payload;if(t.isReferenceObject(g)){let O=await t.resolveReference(g);O.resolved&&(d=O.value)}else d=g}}if(d==null)continue;let s=`${n}_${u}`,c=await new Q2.SchemaConverters.SchemaConverter({id:s,breadcrumbs:["channels",n,"messages",u],schema:d}).convert({context:t,errorCollector:r});c!=null&&(this.ir.rootPackage.types.push(s),this.ir.types={...this.ir.types,...c.inlinedTypes,[s]:c.typeDeclaration})}}async convertComponentMessages({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.messages??{})){if(n.payload==null)continue;let a;if(t.isReferenceObject(n.payload)){let d=await t.resolveReference(n.payload);d.resolved&&(a=d.value)}else a=n.payload;if(a==null)continue;let l=await new Q2.SchemaConverters.SchemaConverter({id:i,breadcrumbs:["components","messages",i],schema:a}).convert({context:t,errorCollector:r});l!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...l.inlinedTypes,[i]:l.typeDeclaration})}}async convertSchemas({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.schemas??{})){let u=await new Q2.SchemaConverters.SchemaConverter({id:i,breadcrumbs:["components","schemas",i],schema:n}).convert({context:t,errorCollector:r});u!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...u.inlinedTypes,[i]:u.typeDeclaration})}}async convertServers({context:t,errorCollector:r}){if(this.isAsyncAPIV3(t)){let i=t.spec.servers,a=new sFo({breadcrumbs:["servers"],servers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a)}else{let i=t.spec.servers,a=new oFo({breadcrumbs:["servers"],servers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a)}}async convertChannels({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.channels??{})){let u=new G2.SdkGroupNameExtension({breadcrumbs:["channels",i],operation:n}).convert({context:t,errorCollector:r})?.groups;if(this.isAsyncAPIV3(t)){let d=t.spec.operations??{},o=await new uFo({breadcrumbs:["channels",i],channel:n,channelPath:i,operations:d,group:u}).convert({context:t,errorCollector:r});o!=null&&(this.ir.websocketChannels={...this.ir.websocketChannels,[u?u.join("."):i]:o.channel},this.ir.types={...this.ir.types,...o.inlinedTypes})}else{let d=await new aFo({breadcrumbs:["channels",i],channel:n,channelPath:i,group:u}).convert({context:t,errorCollector:r});d!=null&&(this.ir.websocketChannels={...this.ir.websocketChannels,[u?u.join("."):i]:d.channel},this.ir.types={...this.ir.types,...d.inlinedTypes})}}this.addWebsocketsToIr({websocketChannels:this.ir.websocketChannels,context:t})}addWebsocketsToIr({websocketChannels:t,context:r}){if(t!=null)for(let[i,n]of Object.entries(t))i!==""?(this.ir.subpackages[i]==null&&(this.ir.subpackages[i]={name:r.casingsGenerator.generateName(i),...r.createPackage({name:i})}),this.ir.subpackages[i].websocket=i,this.ir.rootPackage.subpackages.push(i)):this.ir.rootPackage.websocket=i}};var pba=class extends wFi{isReferenceObject(t){return t!=null&&"$ref"in t}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}getTypeIdFromMessageReference(t){let r=t.$ref.match(/\/messages\/(.+)$/);if(!(!r||!r[1]))return r[1]}async convertReferenceToTypeReference(t){let r,i=t.$ref.match(/^.*\/schemas\/(.+)$/),n=t.$ref.match(/^.*\/channels\/([^/]+)\/messages\/(.+)$/),a=t.$ref.match(/^.*\/messages\/(.+)$/);if(i&&i[1])r=i[1];else if(n&&n[2]){let l=n[1],d=n[2];r=`${l}_${d}`}else a&&a[1]&&(r=a[1]);return r==null?{ok:!1}:(await this.resolveReference(t)).resolved?{ok:!0,reference:ud.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(r),typeId:r,default:void 0,inline:!1})}:{ok:!1}}};var it_=di(LXs(),1);var HXs=di(LXs(),1);var tt_=["get","post","put","delete","patch"];var cFo=class extends sC{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return i}}};var NnE=Yu.object({cursor:Yu.string(),next_cursor:Yu.string(),results:Yu.string()}),FnE=Yu.object({offset:Yu.string(),results:Yu.string(),step:Yu.string().optional(),"has-next-page":Yu.string().optional()}),UXs=Yu.union([Yu.boolean(),NnE,FnE]);var VXs="$request.",lFo="$response.",fFo=class extends sC{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:i}){super({breadcrumbs:t}),this.operation=r,this.document=i}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=UXs.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-pagination extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean"){let a=this.getExtensionValue(this.document);if(a==null)return;if(typeof a=="boolean"){r.collect({message:"Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",path:this.breadcrumbs});return}let u=UXs.safeParse(a);if(!u.success){r.collect({message:`Invalid x-fern-pagination extension: ${u.error.message}`,path:this.breadcrumbs});return}if(typeof u.data=="boolean"){r.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig(u.data,t)}if(typeof n.data=="boolean"){r.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig(n.data,t)}convertPaginationConfig(t,r){let i=t;if("cursor"in i)return{type:"cursor",cursor:r.maybeTrimPrefix(i.cursor,VXs),nextCursor:r.maybeTrimPrefix(i.next_cursor,lFo),results:r.maybeTrimPrefix(i.results,lFo)};let n=t;return{type:"offset",offset:r.maybeTrimPrefix(n.offset,VXs),results:r.maybeTrimPrefix(n.results,lFo),step:n.step!=null?r.maybeTrimPrefix(n.step,VXs):void 0,hasNextPage:n["has-next-page"]!=null?r.maybeTrimPrefix(n["has-next-page"],lFo):void 0}}};var LnE="$request.",UnE=Yu.object({"stream-condition":Yu.string().optional(),format:Yu.enum(["sse","json"]).optional(),"stream-description":Yu.string().optional(),"response-stream":Yu.any(),response:Yu.any()}),VnE=Yu.union([Yu.boolean(),UnE]),ZEn=class extends sC{operation;key="x-fern-streaming";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=VnE.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-streaming extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean")return n.data?{type:"stream",format:"json"}:void 0;if(n.data["stream-condition"]==null&&n.data.format!=null)return{type:"stream",format:n.data.format};if(n.data["stream-condition"]==null){r.collect({message:"Missing required stream-condition property",path:this.breadcrumbs});return}return{type:"streamCondition",format:n.data.format??"json",streamDescription:n.data["stream-description"],streamConditionProperty:t.maybeTrimPrefix(n.data["stream-condition"],LnE),responseStream:n.data["response-stream"],response:n.data.response}}};var dFo=class extends sC{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return i}}};var pFo=class extends sC{server;key="x-fern-server-name";constructor({breadcrumbs:t,server:r}){super({breadcrumbs:t}),this.server=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.server);if(!(i==null||typeof i!="string"))return i}};var WXs="Base",kEn=class e extends og{servers;endpointLevelServers;constructor({breadcrumbs:t,servers:r,endpointLevelServers:i}){super({breadcrumbs:t}),this.servers=r,this.endpointLevelServers=i}convert({context:t,errorCollector:r}){if(this.servers==null||this.servers.length===0||this.servers[0]==null)return;if(this.endpointLevelServers!=null&&this.endpointLevelServers.length>0){let n={id:WXs,name:t.casingsGenerator.generateName(WXs)},a=this.endpointLevelServers.map(d=>{let s=e.getServerName({server:d,errorCollector:r,context:t});return{id:s,name:t.casingsGenerator.generateName(s)}}).filter((d,s,o)=>o.findIndex(c=>c.id===d.id)===s),u=[n,...a],l=this.servers.map(d=>{let s=e.getServerName({server:d,errorCollector:r,context:t}),o=this.endpointLevelServers?.map(c=>[e.getServerName({server:c,errorCollector:r,context:t}),this.getServerUrl(c)]);return{id:s,name:t.casingsGenerator.generateName(s),urls:{[WXs]:this.getServerUrl(d),...Object.fromEntries(o??[])},docs:d.description}});return{value:{defaultEnvironment:l[0]?.id,environments:FC.multipleBaseUrls({baseUrls:u,environments:l})},defaultUrl:e.getServerName({server:this.servers[0],errorCollector:r,context:t})}}let i=this.servers.map(n=>{let a=e.getServerName({server:n,context:t,errorCollector:r});return{id:a,name:t.casingsGenerator.generateName(a),url:this.getServerUrl(n),docs:n.description}}).filter(Kb);return{value:{defaultEnvironment:i[0]?.id,environments:FC.singleBaseUrl({environments:i})}}}static getServerName({server:t,context:r,errorCollector:i}){return new pFo({breadcrumbs:[],server:t}).convert({context:r,errorCollector:i})??t.description??t.url}getServerUrl(t){if(t.variables==null)return t.url;let r=t.url;for(let[i,n]of Object.entries(t.variables))n.default!=null&&(r=r.replace(`{${i}}`,n.default));return r}};var _ba=class e extends og{static STRING=ud.primitive({v1:"STRING",v2:o_.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=ud.container(Kv.optional(e.STRING));parameter;constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}async convert({context:t,errorCollector:r}){let i,n={};if(this.parameter.schema!=null){let l=await new Q2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert({context:t,errorCollector:r});l!=null&&(i=l.type,n=l.inlinedTypes??{})}let a=await t.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs,errorCollector:r});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??e.OPTIONAL_STRING,allowMultiple:this.parameter.explode??!1,availability:a},inlinedTypes:n};case"header":return{type:"header",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??e.OPTIONAL_STRING,env:void 0,availability:a},inlinedTypes:n};case"path":return{type:"path",parameter:{name:t.casingsGenerator.generateName(this.parameter.name),docs:this.parameter.description,valueType:i??e.STRING,location:"ENDPOINT",variable:void 0},inlinedTypes:n};default:return}}};var _Fo=class extends og{requestBody;group;method;constructor({breadcrumbs:t,requestBody:r,group:i,method:n}){super({breadcrumbs:t}),this.requestBody=r,this.group=i,this.method=n}async convert({context:t,errorCollector:r}){if(!this.requestBody.content)return;let i=Object.keys(this.requestBody.content).filter(u=>u.includes("json"));for(let u of i){let l=this.handleJsonOrFormContent({contentType:u,context:t,errorCollector:r});if(l!=null)return l}let n=Object.keys(this.requestBody.content).filter(u=>u.includes("multipart"));for(let u of n){let l=[...this.group,this.method,"Request"].join("_"),d=await this.convertRequestSchemaForMediaType({schemaId:l,contentType:u,context:t,errorCollector:r});if(d!=null&&d.schema?.shape.type==="object")return{requestBody:_I.fileUpload({docs:this.requestBody.description,name:t.casingsGenerator.generateName(l),properties:d.schema?.shape.properties.map(o=>this.convertRequestBodyProperty({context:t,property:o,contentType:u}))}),inlinedTypes:t.removeSchemaFromInlinedTypes({id:l,inlinedTypes:d.inlinedTypes}),examples:d.examples}}let a=Object.keys(this.requestBody.content).filter(u=>u.includes("urlencoded"));for(let u of a){let l=this.handleJsonOrFormContent({contentType:u,context:t,errorCollector:r});if(l!=null)return l}}async convertRequestSchemaForMediaType({schemaId:t,contentType:r,context:i,errorCollector:n}){let a=this.requestBody.content[r];if(a==null||a.schema==null)return;let l=await new Q2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:a.schema,schemaIdOverride:t}).convert({context:i,errorCollector:n});if(l==null)return;let d=a.examples!=null?Object.fromEntries(await Promise.all(Object.entries(a.examples).map(async([s,o])=>[s,i.isReferenceObject(o)?await i.resolveReference(o):o]))):void 0;return{...l,examples:d}}async handleJsonOrFormContent({contentType:t,context:r,errorCollector:i}){let n=[...this.group,this.method,"Request"].join("_"),a=await this.convertRequestSchemaForMediaType({schemaId:n,contentType:t,context:r,errorCollector:i});if(a!=null)return a.schema?.shape.type==="object"?{requestBody:_I.inlinedRequestBody({contentType:t,docs:this.requestBody.description,name:r.casingsGenerator.generateName(n),extendedProperties:a.schema?.shape.extendedProperties,extends:a.schema?.shape.extends,properties:a.schema?.shape.properties,extraProperties:a.schema?.shape.extraProperties}),inlinedTypes:r.removeSchemaFromInlinedTypes({id:n,inlinedTypes:a.inlinedTypes})}:{requestBody:_I.reference({contentType:t,docs:this.requestBody.description,requestBodyType:a.type}),inlinedTypes:r.removeSchemaFromInlinedTypes({id:n,inlinedTypes:a.inlinedTypes})}}convertRequestBodyProperty({context:t,property:r,contentType:i}){return t.isFile(r.valueType)?uF.file(XU.file({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isOptional(r.valueType)&&t.isFile(r.valueType.container.optional)?uF.file(XU.file({key:r.name,isOptional:!0,contentType:i,docs:r.docs})):t.isList(r.valueType)&&t.isFile(r.valueType.container.list)?uF.file(XU.fileArray({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isList(r.valueType)&&t.isOptional(r.valueType.container.list)&&t.isFile(r.valueType.container.list.container.optional)?uF.file(XU.fileArray({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isOptional(r.valueType)&&t.isList(r.valueType.container.optional)&&t.isFile(r.valueType.container.optional.container.list)?uF.file(XU.fileArray({key:r.name,isOptional:!0,contentType:i,docs:r.docs})):uF.bodyProperty({...r,contentType:i,style:void 0,name:r.name})}};var hFo=class extends og{responseBody;group;method;statusCode;streamingExtension;constructor({breadcrumbs:t,responseBody:r,group:i,method:n,statusCode:a,streamingExtension:u}){super({breadcrumbs:t}),this.responseBody=r,this.group=i,this.method=n,this.statusCode=a,this.streamingExtension=u}async convert({context:t,errorCollector:r}){if(!this.responseBody.content)return;let i=Object.keys(this.responseBody.content).filter(a=>a.includes("json"));for(let a of[...i]){let u=await this.parseMediaTypeObject({context:t,errorCollector:r,contentType:a});if(u!=null&&a.includes("json"))return{responseBody:JA.json(qSe.response({responseBodyType:u.convertedSchema.type,docs:this.responseBody.description})),inlinedTypes:u.convertedSchema.inlinedTypes,examples:u.examples}}let n=Object.keys(this.responseBody.content).filter(a=>!a.includes("json"));for(let a of n){let u=await this.parseMediaTypeObject({context:t,errorCollector:r,contentType:a});if(u!=null&&this.isBinarySchema(u.convertedSchema))return t.settings?.useBytesForBinaryResponse&&this.streamingExtension==null?{responseBody:JA.bytes({docs:this.responseBody.description}),inlinedTypes:{}}:{responseBody:JA.fileDownload({docs:this.responseBody.description}),inlinedTypes:{}}}}async parseMediaTypeObject({context:t,errorCollector:r,contentType:i}){let n=this.responseBody.content?.[i];if(n==null||n.schema==null)return;let a=[...this.group,this.method,"Response",this.statusCode].join("_"),l=await new Q2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:n.schema,schemaIdOverride:a}).convert({context:t,errorCollector:r});if(l==null)return;let d=n.examples!=null?Object.fromEntries(await Promise.all(Object.entries(n.examples).map(async([s,o])=>[s,t.isReferenceObject(o)?await t.resolveReference(o):o]))):void 0;return{convertedSchema:l,examples:d}}isBinarySchema(t){let r=t.type;switch(r.type){case"container":case"named":case"unknown":return!1;case"primitive":return r.primitive.v2==null?!1:r.primitive.v2.type==="string"&&r.primitive.v2.validation?.format==="binary";default:return!1}}};var WnE=/{([^}]+)}/g,eMn=class extends og{operation;method;path;inlinedTypes={};constructor({breadcrumbs:t,operation:r,method:i,path:n}){super({breadcrumbs:t}),this.operation=r,this.method=i,this.path=n}convertHttpMethod(){switch(this.method){case"get":return g7.Get;case"post":return g7.Post;case"put":return g7.Put;case"delete":return g7.Delete;case"patch":return g7.Patch;default:return}}async convertParameters({context:t,errorCollector:r,breadcrumbs:i}){let n=[],a=[],u=[];if(!this.operation.parameters)return{pathParameters:n,queryParameters:a,headers:u};for(let s of this.operation.parameters){if(t.isReferenceObject(s)){let b=await t.resolveReference(s);if(b.resolved)s=b.value;else continue}let c=await new _ba({breadcrumbs:i,parameter:s}).convert({context:t,errorCollector:r});if(c!=null)switch(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},c.type){case"path":n.push(c.parameter);break;case"query":a.push(c.parameter);break;case"header":u.push(c.parameter);break}}let d=[...this.path.matchAll(WnE)].map(s=>s[1]).filter(s=>!n.some(o=>o.name.originalName===s));for(let s of d)s!=null&&n.push({name:t.casingsGenerator.generateName(s),valueType:_ba.STRING,docs:void 0,location:"ENDPOINT",variable:void 0});return{pathParameters:n,queryParameters:a,headers:u}}async convertRequestBody({context:t,errorCollector:r,breadcrumbs:i,group:n,method:a}){if(this.operation.requestBody==null)return;let u;if(t.isReferenceObject(this.operation.requestBody)){let s=await t.resolveReference(this.operation.requestBody);s.resolved&&(u=s.value)}else u=this.operation.requestBody;if(u==null)return null;let d=await new _Fo({breadcrumbs:i,requestBody:u,group:n??[],method:a}).convert({context:t,errorCollector:r});if(d!=null)return this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},{value:d.requestBody,examples:d.examples}}async convertResponseBody({context:t,errorCollector:r,breadcrumbs:i,group:n,method:a,streamingExtension:u}){if(this.operation.responses!=null)for(let[l,d]of Object.entries(this.operation.responses)){let s=parseInt(l);if(isNaN(s)||s<200||s>=300)continue;let o;if(t.isReferenceObject(d)){let g=await t.resolveReference(d);g.resolved&&(o=g.value)}else o=d;if(o==null)continue;let b=await new hFo({breadcrumbs:[...i,l],responseBody:o,group:n??[],method:a,statusCode:l,streamingExtension:u}).convert({context:t,errorCollector:r});if(b!=null)return this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},{value:{statusCode:s,body:b.responseBody},examples:b.examples}}}computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r}){let n=new G2.SdkMethodNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation}).convert({context:t,errorCollector:r})?.methodName,u=new G2.SdkGroupNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation}).convert({context:t,errorCollector:r})?.groups??[];if(n!=null)return{group:u,method:n}}computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}){let i=this.operation.tags?.[0],n=this.operation.operationId;if(n==null){let l=this.operation.summary!=null?U0(this.operation.summary):U0(`${this.method}_${this.path.split("/").join("_")}`);return i!=null?{group:[i],method:l}:{method:l}}if(i==null)return{method:n};let a=rt_(i),u=rt_(n);return uSe(a,u)?{method:i}:this.computeGroupAndMethodFromTokens({tag:i,tagTokens:a,operationId:n,operationIdTokens:u})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,operationId:i,operationIdTokens:n}){if(r.some((l,d)=>l!==n[d]))return{group:[t],method:i};let u=n.slice(r.length);return{group:[t],method:U0(u.join("_"))}}};function rt_(e){let t=HnE(e)?$nE(e):GnE(e);return t=t.map(r=>r.toLowerCase()),t=UBe(t),t}function HnE(e){return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)}function $nE(e){return e.split(/(?=[A-Z])/)}function GnE(e){return e.split(/[^a-zA-Z0-9]+/)}var yFo=class extends eMn{idempotent;servers;streamingExtensionConverter;constructor({breadcrumbs:t,operation:r,method:i,path:n,idempotent:a,servers:u}){super({breadcrumbs:t,operation:r,method:i,path:n}),this.idempotent=a,this.servers=u,this.streamingExtensionConverter=new ZEn({breadcrumbs:this.breadcrumbs,operation:this.operation})}async convert({context:t,errorCollector:r}){let i=this.convertHttpMethod();if(i==null)return;let{group:n,method:a}=this.computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r})??this.computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}),u=this.streamingExtensionConverter.convert({context:t,errorCollector:r}),{headers:l,pathParameters:d,queryParameters:s}=await this.convertParameters({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"parameters"]}),o=await this.convertRequestBody({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"requestBody"],group:n,method:a}),c=o?.value,b=await this.convertResponseBody({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"responses"],group:n,method:a,streamingExtension:u}),g=this.operation.servers?.[0]??this.servers?.[0]??t.spec.servers?.[0],O=[];return t.namespace!=null&&O.push(t.namespace),O.push(...n??[]),O.push(a),{group:n,endpoint:{id:O.join("."),displayName:this.operation.summary,method:i,name:t.casingsGenerator.generateName(a),baseUrl:g!=null?kEn.getServerName({server:g,context:t,errorCollector:r}):void 0,path:VV(this.path),pathParameters:d,queryParameters:s,headers:l,requestBody:c,sdkRequest:void 0,response:b?.value,errors:[],auth:this.operation.security!=null||t.spec.security!=null,availability:await t.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.operation.description,userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:VV(this.path),allPathParameters:d,pagination:void 0,transport:void 0},inlinedTypes:this.inlinedTypes,servers:this.operation.servers}}convertExamples({requestExamples:t,responseExamples:r,context:i}){return[]}};var tMn=class extends eMn{constructor({breadcrumbs:t,operation:r,method:i,path:n}){super({breadcrumbs:t,operation:r,method:i,path:n})}async convert({context:t,errorCollector:r}){if(this.operation.operationId==null){r.collect({message:"Skipping webhook because no operation id present",path:this.breadcrumbs});return}if(this.operation.requestBody==null){r.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let i=this.convertHttpMethod();if(i==null)return;if(i!=="POST"&&i!=="GET"){r.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:n,method:a}=this.computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r})??this.computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}),u=[...this.breadcrumbs,"Payload"],{headers:l,pathParameters:d,queryParameters:s}=await this.convertParameters({context:t,errorCollector:r,breadcrumbs:u}),o=await this.convertRequestBody({context:t,errorCollector:r,breadcrumbs:u,group:n,method:a}),c;if(o?.value.type==="inlinedRequestBody")c=eV.inlinedPayload({name:o.value.name,extends:o.value.extends,properties:o.value.properties});else if(o?.value.type==="reference")c=eV.reference({payloadType:o.value.requestBodyType,docs:o.value.docs});else return;return{group:n,webhook:{id:`${n?.join(".")??""}.${a}`,name:t.casingsGenerator.generateName(a),displayName:this.operation.summary,method:i,headers:l,payload:c,examples:[],availability:await t.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.operation.description},inlinedTypes:this.inlinedTypes}}};var vFo=class extends og{pathItem;path;servers;constructor({breadcrumbs:t,pathItem:r,path:i,servers:n}){super({breadcrumbs:t}),this.pathItem=r,this.path=i,this.servers=n}async convert({context:t,errorCollector:r}){let i=[],n=[],a={};for(let u of tt_){let l=this.pathItem[u];if(l==null)continue;let d=[...this.breadcrumbs,u],s=await this.tryParseAsWebhook({operationBreadcrumbs:d,operation:l,method:u,context:t,errorCollector:r});if(s!=null){n.push(s),Object.assign(a,s.inlinedTypes);continue}new ZEn({breadcrumbs:d,operation:l}).convert({context:t,errorCollector:r})!=null;let b=await this.tryParseAsHttpEndpoint({operationBreadcrumbs:d,operation:l,method:u,context:t,errorCollector:r});b!=null&&(i.push(b),Object.assign(a,b.inlinedTypes))}return{endpoints:i,webhooks:n,inlinedTypes:a}}async tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:i,context:n,errorCollector:a}){return new dFo({breadcrumbs:i,operation:t}).convert({context:n,errorCollector:a})?await new tMn({breadcrumbs:i,operation:t,method:HXs.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path}).convert({context:n,errorCollector:a}):void 0}async tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:i,context:n,errorCollector:a}){new fFo({breadcrumbs:i,operation:t,document:n.spec}).convert({context:n,errorCollector:a})!=null;let s=new cFo({breadcrumbs:i,operation:t}).convert({context:n,errorCollector:a});return await new yFo({breadcrumbs:i,operation:t,method:HXs.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,idempotent:s}).convert({context:n,errorCollector:a})}};var bFo=class extends og{securityScheme;constructor({breadcrumbs:t,securityScheme:r}){super({breadcrumbs:t}),this.securityScheme=r}convert({context:t,errorCollector:r}){switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme==="bearer")return FR.bearer({token:t.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description});if(this.securityScheme.scheme==="basic")return FR.basic({username:t.casingsGenerator.generateName("username"),password:t.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,docs:this.securityScheme.description});break}case"apiKey":{if(this.securityScheme.in==="header")return FR.header({name:{name:t.casingsGenerator.generateName(this.securityScheme.name),wireValue:this.securityScheme.name},valueType:ud.container(Kv.optional(ud.primitive({v1:"STRING",v2:o_.string({default:void 0,validation:void 0})}))),prefix:void 0,headerEnvVar:void 0,docs:this.securityScheme.description});break}case"oauth2":return FR.bearer({token:t.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description})}}};var hba=class extends og{ir;constructor({breadcrumbs:t,context:r}){super({breadcrumbs:t}),this.ir={auth:{docs:void 0,requirement:sc.AuthSchemesRequirement.All,schemes:[]},types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:sc.ErrorDiscriminationStrategy.statusCode(),variables:[],serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:r.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}}}}async convert({context:t,errorCollector:r}){t.spec=this.removeXFernIgnores({document:t.spec,context:t,errorCollector:r}),await this.convertSecuritySchemes({context:t,errorCollector:r}),await this.convertSchemas({context:t,errorCollector:r}),await this.convertWebhooks({context:t,errorCollector:r});let{endpointLevelServers:i}=await this.convertPaths({context:t,errorCollector:r});this.convertServers({context:t,errorCollector:r,endpointLevelServers:i});let n={...this.ir,apiName:t.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:t.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}};return n={...n,...jFi({ir:n,exampleGeneration:{disabled:!1}})},n}removeXFernIgnores({document:t,context:r,errorCollector:i,breadcrumbs:n=[]}){return Array.isArray(t)?t.filter((a,u)=>!new G2.FernIgnoreExtension({breadcrumbs:[...n,String(u)],operation:a}).convert({context:r,errorCollector:i})).map((a,u)=>this.removeXFernIgnores({document:a,context:r,errorCollector:i,breadcrumbs:[...n,String(u)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([a,u])=>!new G2.FernIgnoreExtension({breadcrumbs:[...n,a],operation:u}).convert({context:r,errorCollector:i})).map(([a,u])=>[a,this.removeXFernIgnores({document:u,context:r,errorCollector:i,breadcrumbs:[...n,a]})])):t}async convertSecuritySchemes({context:t,errorCollector:r}){let i=[];for(let[n,a]of Object.entries(t.spec.components?.securitySchemes??{})){let u;if(t.isReferenceObject(a)){let s=await t.resolveReference(a);if(!s.resolved)continue;u=s.value}else u=a;let d=new bFo({breadcrumbs:["components","securitySchemes",n],securityScheme:u}).convert({context:t,errorCollector:r});d!=null&&i.push(d)}i.length>0&&(this.ir.auth={requirement:"ANY",schemes:i,docs:void 0})}convertServers({context:t,errorCollector:r,endpointLevelServers:i}){let a=new kEn({breadcrumbs:["servers"],servers:t.spec.servers,endpointLevelServers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a.value)}async convertSchemas({context:t,errorCollector:r}){let i=this.getGroup({groupParts:[],namespace:t.namespace}),n=this.getOrCreatePackage({context:t,group:i});for(let[a,u]of Object.entries(t.spec.components?.schemas??{})){let d=await new Q2.SchemaConverters.SchemaConverter({id:a,breadcrumbs:["components","schemas",a],schema:u}).convert({context:t,errorCollector:r});d!=null&&(n.types.push(a),this.ir.types={...this.ir.types,...d.inlinedTypes,[a]:d.typeDeclaration})}}async convertWebhooks({context:t,errorCollector:r}){let i={};for(let[,n]of Object.entries(t.spec.webhooks??{})){if(n==null||!("post"in n)||!n.post?.operationId)continue;let a=n.post.operationId,l=await new tMn({breadcrumbs:["webhooks",a],operation:n.post,method:it_.OpenAPIV3.HttpMethods.POST,path:a}).convert({context:t,errorCollector:r});if(l!=null){let d=l.group?.join(".")??a;i[d]==null&&(i[d]=[]),i[d].push(a),this.ir.webhookGroups[d]==null&&(this.ir.webhookGroups[d]=[]),this.ir.webhookGroups[d].push(l.webhook),this.ir.types={...this.ir.types,...l.inlinedTypes}}}}async convertPaths({context:t,errorCollector:r}){let i=[];for(let[n,a]of Object.entries(t.spec.paths??{})){if(a==null)continue;let l=await new vFo({breadcrumbs:["paths",n],pathItem:a,path:n,servers:t.spec.servers}).convert({context:t,errorCollector:r});if(l!=null){for(let d of l.endpoints){let s=this.getGroup({groupParts:d.group,namespace:t.namespace}),o=s.join("."),c=this.getOrCreatePackage({context:t,group:d.group}),b=[...s].map(O=>t.casingsGenerator.generateName(O)),g=b[b.length-1];c.service==null&&(c.service=`service_${o}`),this.ir.services[c.service]==null&&(this.ir.services[c.service]={name:{fernFilepath:{allParts:b,packagePath:b.slice(0,-1),file:g}},displayName:void 0,basePath:VV(""),headers:[],pathParameters:[],availability:void 0,endpoints:[],transport:void 0,encoding:void 0}),this.ir.services[c.service]?.endpoints.push(d.endpoint),d.servers&&d.servers[0]!=null&&i.push(d.servers[0])}for(let d of l.webhooks){let o=this.getGroup({groupParts:d.group,namespace:t.namespace}).join("."),c=this.getOrCreatePackage({context:t,group:d.group});this.ir.webhookGroups[o]??=[],this.ir.webhookGroups[o].push(d.webhook),c.webhooks=o}this.ir.types={...this.ir.types,...l.inlinedTypes}}}return{endpointLevelServers:i}}getOrCreatePackage({context:t,group:r}){let i=[];if(t.namespace!=null&&i.push(t.namespace),i.push(...r??[]),i.length==0)return this.ir.rootPackage;let n=this.ir.rootPackage;for(let a=0;a<i.length;a++){let u=i[a],l=i.slice(0,a+1).join(".");this.ir.subpackages[l]==null&&(this.ir.subpackages[l]={name:t.casingsGenerator.generateName(u),...t.createPackage({name:u})});let d=this.ir.subpackages[l];n.subpackages.includes(l)||n.subpackages.push(l),n=d}return n}getGroup({groupParts:t,namespace:r}){let i=[];return r!=null&&i.push(r),i.push(...t??[]),i}};var yba=class extends wFi{isReferenceObject(t){return t!=null&&"$ref"in t}async convertReferenceToTypeReference(t){let r=this.getTypeIdFromSchemaReference(t);return r==null?{ok:!1}:(await this.resolveReference(t)).resolved?{ok:!0,reference:ud.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r),typeId:r,default:void 0,inline:!1})}:{ok:!1}}};var nt_={[Ay.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,fx(e)])),[Ay.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[Ay.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[Ay.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all"]),[Ay.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[Ay.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime"]),[Ay.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[Ay.GenerationLanguage.SWIFT]:new Set([])};var QnE=["go","ruby"];function at_({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let u=c=>({unsafeName:c,safeName:JnE({name:c,keywords:KnE({generationLanguage:e,keywords:t})})}),l=U0(n),d=fx(l),s=xCi(n),o=qCi(l);return r&&(!ZnE(o)&&(e==null||QnE.includes(e))&&(l=o.map((c,b)=>{if(b>0){let g=gFo(c);if(g!=null)return g;if(OFo(c))return c.toUpperCase()}return c}).join(""),d=o.map((c,b)=>{let g=gFo(c);return g??(OFo(c)?c.toUpperCase():b===0?fx(c):c)}).join("")),s=n.split(" ").map(c=>c.split(/(\d+)/).map(xCi).join("")).join("_")),{originalName:n,camelCase:u(a?.casingOverrides?.camel??l),snakeCase:u(a?.casingOverrides?.snake??s),screamingSnakeCase:u(a?.casingOverrides?.["screaming-snake"]??s.toUpperCase()),pascalCase:u(a?.casingOverrides?.pascal??d)}},generateNameAndWireValue:({name:n,wireValue:a,opts:u})=>({name:i.generateName(n,u),wireValue:a})};return i}function JnE({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":XnE(e)?"_"+e:e}function KnE({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return nt_[e]}var YnE=/^[0-9]/;function XnE(e){return YnE.test(e)}function ZnE(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=gFo(i)!=null||OFo(i),a=gFo(t)!=null||OFo(t);return n&&a})}function gFo(e){return eaE.get(e.toUpperCase())}function OFo(e){return knE.has(e.toUpperCase())}var knE=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),eaE=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var G7=class extends Tha{type="oss";specs;sources;loader;constructor({specs:t,...r}){super({...r,respectReadonlySchemas:t.every(i=>i.settings?.respectReadonlySchemas),respectNullableSchemas:t.every(i=>i.settings?.respectNullableSchemas),onlyIncludeReferencedSchemas:t.every(i=>i.settings?.onlyIncludeReferencedSchemas),inlinePathParameters:t.every(i=>i.settings?.inlinePathParameters),objectQueryParameters:t.every(i=>i.settings?.objectQueryParameters),useBytesForBinaryResponse:t.filter(i=>i.type==="openapi"&&i.source.type==="openapi").some(i=>i.settings?.useBytesForBinaryResponse),respectForwardCompatibleEnums:t.filter(i=>i.type==="openapi"&&i.source.type==="openapi").some(i=>i.settings?.respectForwardCompatibleEnums),exampleGeneration:t[0]?.settings?.exampleGeneration}),this.specs=t,this.sources=this.convertSpecsToIdentifiableSources(t),this.loader=new _9t(this.absoluteFilePath)}async getOpenAPIIr({context:t,relativePathToDependency:r},i){let n=await Xze({context:t,specs:this.specs,relativePathToDependency:r});return YNi({context:t,documents:await this.loader.loadDocuments({context:t,specs:n}),options:{...i,respectReadonlySchemas:i?.respectReadonlySchemas??this.respectReadonlySchemas,respectNullableSchemas:i?.respectNullableSchemas??this.respectNullableSchemas,onlyIncludeReferencedSchemas:i?.onlyIncludeReferencedSchemas??this.onlyIncludeReferencedSchemas,inlinePathParameters:i?.inlinePathParameters??this.inlinePathParameters,objectQueryParameters:i?.objectQueryParameters??this.objectQueryParameters,exampleGeneration:i?.exampleGeneration??this.exampleGeneration,useBytesForBinaryResponse:i?.useBytesForBinaryResponse??this.useBytesForBinaryResponse}})}async getIntermediateRepresentation({context:t}){let r=await Xze({context:t,specs:this.specs}),i=await this.loader.loadDocuments({context:t,specs:r}),n;for(let a of i){let u=new fba({logger:t.logger}),l;if(a.type==="openapi"){let s=new yba({namespace:a.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:a.value});l=await new hba({context:s}).convert({context:s,errorCollector:u})}else if(a.type==="asyncapi"){let s=new pba({namespace:a.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:a.value});l=await new dba({context:s}).convert({context:s,errorCollector:u})}else u.collect({message:`Unsupported document type: ${a}`,path:[]});u.hasErrors()&&(t.logger.info(`${a.type==="openapi"?"OpenAPI":"AsyncAPI"} Importer encountered errors:`),u.logErrors());let d=at_({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});l!=null&&(n=n===void 0?l:zXs(n,l,d))}if(n===void 0)throw new Error("Failed to generate intermediate representation");return n}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new cDe({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion,sources:this.sources})}getAbsoluteFilePaths(){return[this.absoluteFilePath,...this.specs.flatMap(t=>[t.type==="protobuf"?t.absoluteFilepathToProtobufTarget:t.absoluteFilepath,t.absoluteFilepathToOverrides]).filter(Kb)]}getSources(){return this.sources}convertSpecsToIdentifiableSources(t){let r=new Set,i=[];return t.reduce((n,a)=>{let u=a.type==="protobuf"?a.absoluteFilepathToProtobufRoot:a.absoluteFilepath;return r.has(u)||(r.add(u),n.push({type:a.type,id:Cie(),absoluteFilePath:u})),n},i)}};var ot_={None:"none",Header:"header"};var WFo={};Eo(WFo,{ConjureAliasDeclaration:()=>EFo,ConjureArgument:()=>LFo,ConjureArgumentWithParamType:()=>FFo,ConjureAuthDefinition:()=>aMn,ConjureAuthDefinitionType:()=>RFo,ConjureDefinitions:()=>IFo,ConjureEndpointDefinition:()=>UFo,ConjureEnumDeclaration:()=>BFo,ConjureEnumVariant:()=>CFo,ConjureEnumWithDocs:()=>TFo,ConjureObjectDeclaration:()=>qFo,ConjureParamType:()=>NFo,ConjurePrimitive:()=>DFo,ConjureService:()=>VFo,ConjureServiceName:()=>SFo,ConjureType:()=>j_i,ConjureTypeDeclaration:()=>xFo,ConjureTypeReference:()=>w_i,ConjureTypeWithDocs:()=>MFo,ConjureTypes:()=>zFo,ConjureUnionDeclaration:()=>AFo,DefinitionFile:()=>xt_,WithDocs:()=>fZt,commons:()=>KXs,conjure:()=>YXs,services:()=>XXs,types:()=>ZXs});var KXs={};Eo(KXs,{WithDocs:()=>fZt});var ep={};Eo(ep,{JsonError:()=>rMn,ParseError:()=>iMn,any:()=>mt_,bigint:()=>st_,boolean:()=>Pt_,booleanLiteral:()=>Ot_,date:()=>ct_,discriminant:()=>Tt_,enum_:()=>PFo,getObjectLikeUtils:()=>v9t,getObjectUtils:()=>SFi,getSchemaUtils:()=>rq,isProperty:()=>P_i,lazy:()=>lt_,lazyObject:()=>vt_,list:()=>wFo,number:()=>jt_,object:()=>jFo,objectWithoutOptionalProperties:()=>yt_,optional:()=>$Xs,property:()=>dt_,record:()=>Et_,set:()=>Mt_,string:()=>wt_,stringLiteral:()=>gt_,transform:()=>GXs,undiscriminatedUnion:()=>qt_,union:()=>Bt_,unknown:()=>St_,withParsedProperties:()=>JXs});var tj={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",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function BM(e,t){return`Expected ${t}. Received ${taE(e)}.`}function taE(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 G5(e){return{...e,json:ut_(e.json),parse:ut_(e.parse)}}function ut_(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
|
|
1957
|
+
`}async function Xze({context:e,specs:t,relativePathToDependency:r}){let i=new FRo({context:e}),n=t.filter(l=>l.type==="openapi").map(l=>({...l,relativePathToDependency:r})),a=t.filter(l=>l.type==="protobuf"),u=await Promise.all(a.map(async l=>otE({generator:i,protobufSpec:l,relativePathToDependency:r})));return[...n,...u]}async function otE({generator:e,protobufSpec:t,relativePathToDependency:r}){return{type:"openapi",absoluteFilepath:await e.generate({absoluteFilepathToProtobufRoot:t.absoluteFilepathToProtobufRoot,absoluteFilepathToProtobufTarget:t.absoluteFilepathToProtobufTarget,relativeFilepathToProtobufRoot:t.relativeFilepathToProtobufRoot,local:t.generateLocally}),absoluteFilepathToOverrides:t.absoluteFilepathToOverrides,settings:t.settings,source:{type:"protobuf",relativePathToDependency:r,root:t.absoluteFilepathToProtobufRoot,file:t.absoluteFilepathToProtobufTarget}}}var we_=require("fs"),VEn=require("fs/promises");var Se_=require("os"),De_=di(require("path"),1),Ee_=require("stream/promises"),Me_=di(QNo(),1),Ae_=di(ure(),1);var MXs=di(Jxi(),1);var cP;(function(e){e.FILE_READ="FILE_READ",e.FILE_PARSE="FILE_PARSE",e.FILE_MISSING="FILE_MISSING",e.STRUCTURE_VALIDATION="STRUCTURE_VALIDATION",e.JSONSCHEMA_VALIDATION="JSONSCHEMA_VALIDATION",e.DEPENDENCY_NOT_LISTED="DEPENDENCY_NOT_LISTED",e.FAILED_TO_LOAD_DEPENDENCY="FAILED_TO_LOAD_DEPENDENCY",e.EXPORTING_PACKAGE_MARKER_OTHER_KEYS="EXPORTING_PACKAGE_MARKER_OTHER_KEYS",e.EXPORT_PACKAGE_HAS_DEFINITIONS="EXPORT_PACKAGE_HAS_DEFINITIONS",e.MISCONFIGURED_DIRECTORY="MISCONFIGURED_DIRECTORY"})(cP||(cP={}));var ziE=sJr();async function qe_({dependencyName:e,dependenciesConfiguration:t,context:r,rootApiFile:i,cliVersion:n,settings:a,loadAPIWorkspace:u}){let l,d={type:cP.FAILED_TO_LOAD_DEPENDENCY,dependencyName:e},s=t.dependencies[e];return s==null?d={type:cP.DEPENDENCY_NOT_LISTED,dependencyName:e}:await r.runInteractiveTask({name:`Download ${WiE(s)}`},async o=>{switch(s.type){case"version":l=await UiE({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;case"local":l=await LiE({context:o,dependency:s,cliVersion:n,settings:a,loadAPIWorkspace:u});return;default:Fo(s)}}),l!=null?{didSucceed:!0,definition:l}:{didSucceed:!1,failure:d}}var Te_="dependencies";var RiE="metadata.json",NiE=".fern";function FiE(e){return es(Wl.of((0,Se_.homedir)()),uo.of(NiE),uo.of(Te_),uo.of(e.organization),uo.of(e.apiName),uo.of(e.version))}async function LiE({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){if(n==null){t.failWithoutThrowing("Failed to load api definition");return}t.logger.info("Parsing...");let a=await n({absolutePathToWorkspace:e.absoluteFilepath,context:t,cliVersion:r,workspaceName:void 0});if(!a.didSucceed){t.failWithoutThrowing("Failed to load api definition",a.failures);return}t.logger.info("Modifying source filepath ...");let u=await a.workspace.getDefinition({context:t,relativePathToDependency:uo.of(e.path)},i);return t.logger.info("Loaded..."),u}async function UiE({dependency:e,context:t,cliVersion:r,settings:i,loadAPIWorkspace:n}){let a=FiE(e),u=es(a,uo.of(Te_)),l=es(a,uo.of(RiE)),d;if(!await Bf(u)||!await Bf(l)){t.logger.info("Downloading manifest...");let c=await ziE.definitionRegistry.get(MXs.FernFiddle.OrganizationId(e.organization),MXs.FernFiddle.ApiId(e.apiName),e.version);if(!c.ok){c.error._visit({orgDoesNotExistError:()=>{t.failWithoutThrowing("Organization does not exist")},apiDoesNotExistError:()=>{t.failWithoutThrowing("API does not exist")},versionDoesNotExistError:()=>{t.failWithoutThrowing("Version does not exist")},_other:m=>{t.failWithoutThrowing("Failed to download API manifest",m)}});return}let b=c.body.yamlSchemaVersion!=null?parseInt(c.body.yamlSchemaVersion):void 0,g=uNi(r),O=uNi(c.body.cliVersion);if(b!=null){if(b>1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a higher version of fern. Upgrade this workspace to ${c.body.cliVersion}`);return}else if(b<1){t.failWithoutThrowing(`${e.organization}/${e.apiName}@${e.version} on a lower version of fern. Upgrade it to ${r}`);return}}else if(g.major!==O.major||g.minor!==O.minor){t.failWithoutThrowing(`CLI version is ${c.body.cliVersion}. Expected ${g.major}.${g.minor}.x (to match current workspace).`);return}t.logger.info("Downloading..."),t.logger.debug("Remote URL: "+c.body.definitionS3DownloadUrl),await(0,VEn.mkdir)(u,{recursive:!0});try{await ViE({s3PreSignedReadUrl:c.body.definitionS3DownloadUrl,absolutePathToLocalOutput:u})}catch(m){t.failWithoutThrowing("Failed to download API",m);return}d=c.body,await(0,VEn.writeFile)(l,JSON.stringify(d))}else d=JSON.parse((await(0,VEn.readFile)(l)).toString());if(t.logger.info("Parsing..."),n==null){t.failWithoutThrowing("Failed to load API");return}let s=await n({absolutePathToWorkspace:u,context:t,cliVersion:d.cliVersion,workspaceName:void 0});if(!s.didSucceed){t.failWithoutThrowing("Failed to parse dependency after downloading",s.failures);return}if(s.workspace.type==="oss"){t.failWithoutThrowing("Dependency must be a fern workspace.");return}return await s.workspace.getDefinition({context:t},i)}async function ViE({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await QR.get(e,{responseType:"stream"}),i=await Ae_.default.dir(),n=De_.default.join(i.path,"api.tgz");await(0,Ee_.pipeline)(r.data,(0,we_.createWriteStream)(n)),await(0,Me_.extract)({file:n,cwd:t})}function WiE(e){switch(e.type){case"version":return`@${e.organization}/${e.apiName}`;case"local":return`${e.path}`;default:Fo(e)}}var He_=di(Re_(),1);function JNo(e,t){for(let[r,i]of $N(e))$iE({relativeFilepath:r,failure:i,logger:t})}function $iE({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case cP.MISCONFIGURED_DIRECTORY:r.error("Misconfigured fern directory: please see the docs at https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder");break;case cP.FILE_READ:r.error("Failed to open file: "+e);break;case cP.FILE_MISSING:r.error("Missing file: "+e);break;case cP.FILE_PARSE:t.error instanceof Kaa?r.error(Hie({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case cP.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of GiE(i))r.error(Hie({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case cP.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case cP.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${HZa}: `+t.dependencyName);break;case cP.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case cP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case cP.JSONSCHEMA_VALIDATION:t.error.error!=null&&r.error(Hie({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...t.error.error.instancePath.split("/").filter(i=>i!=="")]}));for(let i of t.error.allErrors)i!==t.error.error&&r.debug(Hie({title:i.message??"Unknown error",breadcrumbs:[e,...i.instancePath.split("/").filter(n=>n!=="")]}));break;default:Fo(t)}}function GiE(e){switch(e.code){case Hl.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Js.underline(e.expected)} but received ${Js.underline(e.received)}`}];case Hl.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Js.underline(t)}`}));case Hl.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Js.underline(t)).join(", ")}`}];case Hl.invalid_union:case Hl.invalid_arguments:case Hl.invalid_return_type:case Hl.invalid_date:case Hl.invalid_string:case Hl.too_small:case Hl.too_big:case Hl.invalid_intersection_types:case Hl.not_multiple_of:case Hl.custom:default:return[{title:e.message}]}}var Ne_=require("fs/promises");async function Fe_(e,t){let r=[];for(let i of await exe(e,t))r.push(await QiE({relativeFilepath:HA(e,i),absoluteFilepath:i}));return r}async function QiE({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,Ne_.readFile)(t)).toString()}}async function Le_(e){let t={},r={};function i(n){try{t[n.relativeFilepath]={defaultUrl:void 0,contents:Yd.load(n.fileContents,{schema:Yd.CORE_SCHEMA}),rawContents:n.fileContents}}catch(a){r[n.relativeFilepath]={type:cP.FILE_PARSE,error:a}}}return await Promise.all(e.map(i)),Object.keys(r).length>0?{didSucceed:!1,failures:r}:{didSucceed:!0,files:t}}async function Ue_({dependenciesConfiguration:e,structuralValidationResult:t,context:r,cliVersion:i,settings:n,loadAPIWorkspace:a}){let u={},l={},d={};return await Promise.all($N(t.packageMarkers).map(async([s,o])=>{if(o.contents.export==null)u[s]=o;else{let{export:c,...b}=o.contents;if(jY(b)>0)d[s]={type:cP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS,pathOfPackageMarker:s};else{let g=yp(s);if(Q4t(t.namedDefinitionFiles).some(m=>m!==s&&m.startsWith(g)))d[s]={type:cP.EXPORT_PACKAGE_HAS_DEFINITIONS,pathToPackage:g};else{let m=await qe_({dependencyName:typeof o.contents.export=="string"?o.contents.export:o.contents.export.dependency,dependenciesConfiguration:e,context:r,rootApiFile:t.rootApiFile.contents,cliVersion:i,settings:n,loadAPIWorkspace:a});m.didSucceed?l[yp(s)]={definition:m.definition,url:typeof o.contents.export=="object"?o.contents.export.url:void 0}:d[s]=m.failure}}}})),jY(d)>0?{didSucceed:!1,failures:d}:{didSucceed:!0,packageMarkers:u,importedDefinitions:l}}var Ve_=di(require("path"),1);var TXs={};Eo(TXs,{additionalProperties:()=>XiE,default:()=>kiE,definitions:()=>ZiE,properties:()=>KiE,required:()=>YiE,type:()=>JiE});var JiE="object",KiE={docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},"default-url":{oneOf:[{type:"string"},{type:"null"}]},"default-environment":{oneOf:[{type:"string"},{type:"null"}]},environments:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/environments.EnvironmentSchema"}},{type:"null"}]},auth:{oneOf:[{$ref:"#/definitions/auth.ApiAuthSchema"},{type:"null"}]},"auth-schemes":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/auth.AuthSchemeDeclarationSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},name:{type:"string"},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},"error-discrimination":{oneOf:[{$ref:"#/definitions/file.ErrorDiscriminationSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},errors:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"idempotency-headers":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},variables:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/variables.VariableDeclarationSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"null"}]},version:{oneOf:[{$ref:"#/definitions/versioning.VersionDeclarationSchema"},{type:"null"}]}},YiE=["name"],XiE=!1,ZiE={"environments.SingleBaseUrlEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},url:{type:"string"}},required:["url"],additionalProperties:!1},"environments.MultipleBaseUrlsEnvironmentSchema":{type:"object",properties:{audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},urls:{type:"object",additionalProperties:{type:"string"}}},required:["urls"],additionalProperties:!1},"environments.EnvironmentSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/environments.SingleBaseUrlEnvironmentSchema"},{$ref:"#/definitions/environments.MultipleBaseUrlsEnvironmentSchema"}]},"auth.AuthSchemeReferenceSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{type:"string"}},required:["scheme"],additionalProperties:!1},"auth.AnyAuthItem":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"}]},"auth.AnyAuthSchemesSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},any:{type:"array",items:{$ref:"#/definitions/auth.AnyAuthItem"}}},required:["any"],additionalProperties:!1},"auth.ApiAuthSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/auth.AuthSchemeReferenceSchema"},{$ref:"#/definitions/auth.AnyAuthSchemesSchema"}]},"auth.OAuthAccessTokenRequestPropertiesSchema":{type:"object",properties:{"client-id":{oneOf:[{type:"string"},{type:"null"}]},"client-secret":{oneOf:[{type:"string"},{type:"null"}]},scopes:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthAccessTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthGetTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthAccessTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthRefreshTokenRequestPropertiesSchema":{type:"object",properties:{"refresh-token":{type:"string"}},required:["refresh-token"],additionalProperties:!1},"auth.OAuthRefreshTokenResponsePropertiesSchema":{type:"object",properties:{"access-token":{oneOf:[{type:"string"},{type:"null"}]},"expires-in":{oneOf:[{type:"string"},{type:"null"}]},"refresh-token":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.OAuthRefreshTokenEndpointSchema":{type:"object",properties:{endpoint:{type:"string"},"request-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenRequestPropertiesSchema"},{type:"null"}]},"response-properties":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenResponsePropertiesSchema"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"auth.OAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"oauth"},type:{const:"client-credentials"},scopes:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"client-id-env":{oneOf:[{type:"string"},{type:"null"}]},"client-secret-env":{oneOf:[{type:"string"},{type:"null"}]},"token-prefix":{oneOf:[{type:"string"},{type:"null"}]},"token-header":{oneOf:[{type:"string"},{type:"null"}]},"get-token":{$ref:"#/definitions/auth.OAuthGetTokenEndpointSchema"},"refresh-token":{oneOf:[{$ref:"#/definitions/auth.OAuthRefreshTokenEndpointSchema"},{type:"null"}]}},required:["scheme","type","get-token"],additionalProperties:!1},"auth.HeaderAuthSchemeSchema":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},header:{type:"string"},type:{oneOf:[{type:"string"},{type:"null"}]},prefix:{oneOf:[{type:"string"},{type:"null"}]}},required:["header"],additionalProperties:!1},"auth.AuthVariable":{type:"object",properties:{env:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"auth.BasicAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"basic"},username:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]},password:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.BearerAuthSchemeSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},scheme:{const:"bearer"},token:{oneOf:[{$ref:"#/definitions/auth.AuthVariable"},{type:"null"}]}},required:["scheme"],additionalProperties:!1},"auth.AuthSchemeDeclarationSchema":{anyOf:[{$ref:"#/definitions/auth.OAuthSchemeSchema"},{$ref:"#/definitions/auth.HeaderAuthSchemeSchema"},{$ref:"#/definitions/auth.BasicAuthSchemeSchema"},{$ref:"#/definitions/auth.BearerAuthSchemeSchema"}]},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"file.PropertyBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"property"},"property-name":{type:"string"}},required:["strategy","property-name"],additionalProperties:!1},"file.StatusCodeBasedErrorDiscrimination":{type:"object",properties:{strategy:{const:"status-code"}},required:["strategy"],additionalProperties:!1},"file.ErrorDiscriminationSchema":{anyOf:[{$ref:"#/definitions/file.PropertyBasedErrorDiscrimination"},{$ref:"#/definitions/file.StatusCodeBasedErrorDiscrimination"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"variables.VariableDeclarationDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"variables.VariableDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/variables.VariableDeclarationDetailed"}]},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"versioning.VersionValueDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionValue":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionValueDetailed"}]},"versioning.VersionDeclarationHeaderObjectSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"versioning.VersionDeclarationHeaderSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/versioning.VersionDeclarationHeaderObjectSchema"}]},"versioning.VersionDeclarationSchema":{type:"object",properties:{default:{oneOf:[{type:"string"},{type:"null"}]},values:{type:"array",items:{$ref:"#/definitions/versioning.VersionValue"}},header:{$ref:"#/definitions/versioning.VersionDeclarationHeaderSchema"}},required:["values","header"],additionalProperties:!1}},kiE={type:JiE,properties:KiE,required:YiE,additionalProperties:XiE,definitions:ZiE};var CXs={};Eo(CXs,{additionalProperties:()=>rnE,default:()=>nnE,definitions:()=>inE,properties:()=>tnE,type:()=>enE});var enE="object",tnE={docs:{oneOf:[{type:"string"},{type:"null"}]},imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]}},rnE=!1,inE={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1}},nnE={type:enE,properties:tnE,additionalProperties:rnE,definitions:inE};var BXs={};Eo(BXs,{additionalProperties:()=>unE,default:()=>cnE,definitions:()=>snE,properties:()=>onE,type:()=>anE});var anE="object",onE={imports:{oneOf:[{type:"object",additionalProperties:{type:"string"}},{type:"null"}]},types:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeDeclarationSchema"}},{type:"null"}]},service:{oneOf:[{$ref:"#/definitions/service.HttpServiceSchema"},{type:"null"}]},errors:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/errors.ErrorDeclarationSchema"}},{type:"null"}]},webhooks:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/webhooks.WebhookSchema"}},{type:"null"}]},channel:{oneOf:[{$ref:"#/definitions/websocket.WebSocketChannelSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/file.Navigation"},{type:"null"}]},export:{oneOf:[{$ref:"#/definitions/file.Export"},{type:"null"}]}},unE=!1,snE={"examples.ExampleTypeValueSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleTypeSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},value:{$ref:"#/definitions/examples.ExampleTypeValueSchema"}},required:["value"],additionalProperties:!1},"encoding.ProtobufTypeSchema":{type:"object",properties:{type:{type:"string"}},required:["type"],additionalProperties:!1},"encoding.EncodingSchema":{type:"object",properties:{proto:{oneOf:[{$ref:"#/definitions/encoding.ProtobufTypeSchema"},{type:"null"}]}},additionalProperties:!1},"source.OpenAPISourceSchema":{type:"object",properties:{openapi:{type:"string"}},required:["openapi"],additionalProperties:!1},"source.ProtobufSourceSchema":{type:"object",properties:{proto:{type:"string"}},required:["proto"],additionalProperties:!1},"source.SourceSchema":{anyOf:[{$ref:"#/definitions/source.OpenAPISourceSchema"},{$ref:"#/definitions/source.ProtobufSourceSchema"}]},"availability.AvailabilityStatusSchema":{type:"string",enum:["in-development","pre-release","deprecated","generally-available"]},"availability.AvailabilitySchema":{type:"object",properties:{status:{$ref:"#/definitions/availability.AvailabilityStatusSchema"},message:{oneOf:[{type:"string"},{type:"null"}]}},required:["status"],additionalProperties:!1},"availability.AvailabilityUnionSchema":{anyOf:[{$ref:"#/definitions/availability.AvailabilityStatusSchema"},{$ref:"#/definitions/availability.AvailabilitySchema"}]},"types.ObjectExtendsSchema":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"validation.StringValidationSchema":{type:"object",properties:{minLength:{oneOf:[{type:"integer"},{type:"null"}]},maxLength:{oneOf:[{type:"integer"},{type:"null"}]},pattern:{oneOf:[{type:"string"},{type:"null"}]},format:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"validation.NumberValidationSchema":{type:"object",properties:{min:{oneOf:[{type:"number"},{type:"null"}]},max:{oneOf:[{type:"number"},{type:"null"}]},exclusiveMin:{oneOf:[{type:"boolean"},{type:"null"}]},exclusiveMax:{oneOf:[{type:"boolean"},{type:"null"}]},multipleOf:{oneOf:[{type:"number"},{type:"null"}]}},additionalProperties:!1},"validation.ValidationSchema":{anyOf:[{$ref:"#/definitions/validation.StringValidationSchema"},{$ref:"#/definitions/validation.NumberValidationSchema"}]},"types.ObjectPropertyAccess":{type:"string",enum:["read-only","write-only"]},"types.ObjectPropertyWithAccessSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},access:{oneOf:[{$ref:"#/definitions/types.ObjectPropertyAccess"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.ObjectPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectPropertyWithAccessSchema"}]},"types.ObjectSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"types.CasingOverridesSchema":{type:"object",properties:{camel:{oneOf:[{type:"string"},{type:"null"}]},snake:{oneOf:[{type:"string"},{type:"null"}]},pascal:{oneOf:[{type:"string"},{type:"null"}]},"screaming-snake":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"types.EnumValueSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"},casing:{oneOf:[{$ref:"#/definitions/types.CasingOverridesSchema"},{type:"null"}]}},required:["value"],additionalProperties:!1},"types.EnumValue":{anyOf:[{type:"string"},{$ref:"#/definitions/types.EnumValueSchema"}]},"types.EnumSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},default:{oneOf:[{type:"string"},{type:"null"}]},enum:{type:"array",items:{$ref:"#/definitions/types.EnumValue"}}},required:["enum"],additionalProperties:!1},"types.UnionDiscriminantSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.UnionDiscriminant":{anyOf:[{type:"string"},{$ref:"#/definitions/types.UnionDiscriminantSchema"}]},"types.TypeReferenceDetailedSchema":{type:"object",properties:{default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.TypeReferenceSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.TypeReferenceDetailedSchema"}]},"types.SingleUnionTypeKeySchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},value:{type:"string"}},required:["value"],additionalProperties:!1},"types.SingleUnionTypeKey":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeKeySchema"}]},"types.SingleUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},key:{oneOf:[{$ref:"#/definitions/types.SingleUnionTypeKey"},{type:"null"}]}},additionalProperties:!1},"types.SingleUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUnionTypeDetailedSchema"}]},"types.DiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminant:{oneOf:[{$ref:"#/definitions/types.UnionDiscriminant"},{type:"null"}]},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"base-properties":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},union:{type:"object",additionalProperties:{$ref:"#/definitions/types.SingleUnionTypeSchema"}}},required:["union"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeDetailedSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"types.SingleUndiscriminatedUnionTypeSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeDetailedSchema"}]},"types.UndiscriminatedUnionSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},discriminated:{const:!1},union:{type:"array",items:{$ref:"#/definitions/types.SingleUndiscriminatedUnionTypeSchema"}}},required:["discriminated","union"],additionalProperties:!1},"types.AliasSchema":{type:"object",properties:{examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},inline:{oneOf:[{type:"boolean"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},type:{type:"string"},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]}},required:["type"],additionalProperties:!1},"types.TypeDeclarationSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/types.ObjectSchema"},{$ref:"#/definitions/types.EnumSchema"},{$ref:"#/definitions/types.DiscriminatedUnionSchema"},{$ref:"#/definitions/types.UndiscriminatedUnionSchema"},{$ref:"#/definitions/types.AliasSchema"}]},"service.GrpcTransport":{type:"object",properties:{"service-name":{type:"string"}},required:["service-name"],additionalProperties:!1},"service.ServiceTransport":{type:"object",properties:{grpc:{oneOf:[{$ref:"#/definitions/service.GrpcTransport"},{type:"null"}]}},additionalProperties:!1},"service.HttpMethodSchema":{type:"string",enum:["GET","POST","PUT","PATCH","DELETE"]},"variables.VariableReferenceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},variable:{type:"string"}},required:["variable"],additionalProperties:!1},"service.HttpPathParameterSchema":{anyOf:[{$ref:"#/definitions/types.TypeReferenceSchema"},{$ref:"#/definitions/variables.VariableReferenceSchema"}]},"service.QueryParameterTypeReferenceDetailed":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"allow-multiple":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpQueryParameterSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.QueryParameterTypeReferenceDetailed"}]},"service.TypeReferenceDeclarationWithEnvOverrideSchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},env:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.TypeReferenceDeclarationWithEnvOverride":{anyOf:[{type:"string"},{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverrideSchema"}]},"service.HttpHeaderSchema":{$ref:"#/definitions/service.TypeReferenceDeclarationWithEnvOverride"},"service.HttpReferencedRequestBodySchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"service.FormDataBodyEncodingStyle":{type:"string",enum:["json","exploded","form"]},"service.HttpInlineFileRequestBodyPropertySchema":{type:"object",properties:{type:{type:"string"},default:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},encoding:{oneOf:[{$ref:"#/definitions/encoding.EncodingSchema"},{type:"null"}]},validation:{oneOf:[{$ref:"#/definitions/validation.ValidationSchema"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/service.FormDataBodyEncodingStyle"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpInlineRequestBodyPropertySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpInlineFileRequestBodyPropertySchema"}]},"service.HttpInlineRequestBodySchema":{type:"object",properties:{extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},"extra-properties":{oneOf:[{type:"boolean"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpInlineRequestBodyPropertySchema"}},{type:"null"}]}},additionalProperties:!1},"service.HttpRequestBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpReferencedRequestBodySchema"},{$ref:"#/definitions/service.HttpInlineRequestBodySchema"}]},"service.HttpRequestSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"content-type":{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/service.HttpRequestBodySchema"},{type:"null"}]}},additionalProperties:!1},"service.HttpRequest":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpRequestSchema"}]},"service.HttpResponseSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{oneOf:[{type:"string"},{type:"null"}]},property:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"service.HttpResponseSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseSchemaDetailed"}]},"service.StreamFormat":{type:"string",enum:["sse","json"]},"service.HttpResponseStreamSchemaDetailed":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"},format:{oneOf:[{$ref:"#/definitions/service.StreamFormat"},{type:"null"}]},terminator:{oneOf:[{type:"string"},{type:"null"}]}},required:["type"],additionalProperties:!1},"service.HttpResponseStreamSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/service.HttpResponseStreamSchemaDetailed"}]},"service.ResponseErrorWithDocsSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},error:{type:"string"}},required:["error"],additionalProperties:!1},"service.ResponseError":{anyOf:[{type:"string"},{$ref:"#/definitions/service.ResponseErrorWithDocsSchema"}]},"service.ResponseErrorsSchema":{type:"array",items:{$ref:"#/definitions/service.ResponseError"}},"examples.ExampleTypeReferenceSchema":{type:["string","number","boolean","object","array","null"]},"examples.ExampleBodyResponseSchema":{type:"object",properties:{error:{oneOf:[{type:"string"},{type:"null"}]},body:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},additionalProperties:!1},"examples.ExampleStreamResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleSseEventSchema":{type:"object",properties:{event:{type:"string"},data:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]}},required:["event"],additionalProperties:!1},"examples.ExampleSseResponseSchema":{type:"object",properties:{stream:{type:"array",items:{$ref:"#/definitions/examples.ExampleSseEventSchema"}}},required:["stream"],additionalProperties:!1},"examples.ExampleResponseSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleBodyResponseSchema"},{$ref:"#/definitions/examples.ExampleStreamResponseSchema",description:"JSON Streams"},{$ref:"#/definitions/examples.ExampleSseResponseSchema",description:"Server-Sent Event streams"}]},"examples.SupportedSdkLanguageSchema":{type:"string",enum:["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm","c#"]},"examples.ExampleCodeSampleSchemaSdk":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},sdk:{$ref:"#/definitions/examples.SupportedSdkLanguageSchema"},code:{type:"string"}},required:["sdk","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchemaLanguage":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},name:{oneOf:[{type:"string"},{type:"null"}]},language:{type:"string"},code:{type:"string"},install:{oneOf:[{type:"string"},{type:"null"}]}},required:["language","code"],additionalProperties:!1},"examples.ExampleCodeSampleSchema":{anyOf:[{$ref:"#/definitions/examples.ExampleCodeSampleSchemaSdk"},{$ref:"#/definitions/examples.ExampleCodeSampleSchemaLanguage"}]},"examples.ExampleEndpointCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/examples.ExampleResponseSchema"},{type:"null"}]},"code-samples":{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleCodeSampleSchema"}},{type:"null"}]}},additionalProperties:!1},"pagination.CursorPaginationSchema":{type:"object",properties:{cursor:{type:"string"},next_cursor:{type:"string"},results:{type:"string"}},required:["cursor","next_cursor","results"],additionalProperties:!1},"pagination.OffsetPaginationSchema":{type:"object",properties:{offset:{type:"string"},results:{type:"string"},step:{oneOf:[{type:"string"},{type:"null"}]},"has-next-page":{oneOf:[{type:"string"},{type:"null"}]}},required:["offset","results"],additionalProperties:!1},"pagination.CustomPaginationSchema":{type:"object",properties:{type:{const:"custom"},results:{type:"string"}},required:["type","results"],additionalProperties:!1},"pagination.PaginationSchema":{anyOf:[{$ref:"#/definitions/pagination.CursorPaginationSchema"},{$ref:"#/definitions/pagination.OffsetPaginationSchema"},{$ref:"#/definitions/pagination.CustomPaginationSchema"}]},"service.Pagination":{anyOf:[{$ref:"#/definitions/pagination.PaginationSchema"},{type:"boolean"}]},"service.HttpEndpointSchema":{type:"object",properties:{"display-name":{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},method:{oneOf:[{$ref:"#/definitions/service.HttpMethodSchema"},{type:"null"}]},"base-path":{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},auth:{oneOf:[{type:"boolean"},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},"stream-condition":{oneOf:[{type:"string"},{type:"null"}]},request:{oneOf:[{$ref:"#/definitions/service.HttpRequest"},{type:"null"}]},response:{oneOf:[{$ref:"#/definitions/service.HttpResponseSchema"},{type:"null"}]},"response-stream":{oneOf:[{$ref:"#/definitions/service.HttpResponseStreamSchema"},{type:"null"}]},errors:{oneOf:[{$ref:"#/definitions/service.ResponseErrorsSchema"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleEndpointCallSchema"}},{type:"null"}]},pagination:{oneOf:[{$ref:"#/definitions/service.Pagination"},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]}},required:["path"],additionalProperties:!1},"service.HttpServiceSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},"base-path":{type:"string"},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},idempotent:{oneOf:[{type:"boolean"},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.TypeReferenceSchema"}},{type:"null"}]},transport:{oneOf:[{$ref:"#/definitions/service.ServiceTransport"},{type:"null"}]},source:{oneOf:[{$ref:"#/definitions/source.SourceSchema"},{type:"null"}]},endpoints:{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpEndpointSchema"}}},required:["auth","base-path","endpoints"],additionalProperties:!1},"errors.ErrorDeclarationSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},"status-code":{type:"integer"},type:{oneOf:[{type:"string"},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleTypeSchema"}},{type:"null"}]}},required:["status-code"],additionalProperties:!1},"webhooks.WebhookMethodSchema":{type:"string",enum:["POST","GET"]},"webhooks.WebhookReferencedPayloadSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"webhooks.WebhookInlinedPayloadSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"webhooks.WebhookPayloadSchema":{anyOf:[{type:"string"},{$ref:"#/definitions/webhooks.WebhookReferencedPayloadSchema"},{$ref:"#/definitions/webhooks.WebhookInlinedPayloadSchema"}]},"examples.ExampleWebhookCallSchema":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},id:{oneOf:[{type:"string"},{type:"null"}]},payload:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},required:["payload"],additionalProperties:!1},"webhooks.WebhookSchema":{type:"object",properties:{availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},method:{$ref:"#/definitions/webhooks.WebhookMethodSchema"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},payload:{$ref:"#/definitions/webhooks.WebhookPayloadSchema"},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebhookCallSchema"}},{type:"null"}]}},required:["method","payload"],additionalProperties:!1},"websocket.WebSocketOrigin":{type:"string",enum:["client","server"]},"websocket.WebSocketChannelReferencedMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},type:{type:"string"}},required:["type"],additionalProperties:!1},"websocket.WebSocketChannelInlinedMessageSchema":{type:"object",properties:{name:{type:"string"},extends:{oneOf:[{$ref:"#/definitions/types.ObjectExtendsSchema"},{type:"null"}]},properties:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/types.ObjectPropertySchema"}},{type:"null"}]}},required:["name"],additionalProperties:!1},"websocket.WebSocketChannelMessageBodySchema":{anyOf:[{type:"string"},{$ref:"#/definitions/websocket.WebSocketChannelReferencedMessageSchema"},{$ref:"#/definitions/websocket.WebSocketChannelInlinedMessageSchema"}]},"websocket.WebSocketChannelMessageSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},origin:{$ref:"#/definitions/websocket.WebSocketOrigin"},body:{$ref:"#/definitions/websocket.WebSocketChannelMessageBodySchema"}},required:["origin","body"],additionalProperties:!1},"examples.ExampleWebSocketMessage":{type:"object",properties:{type:{type:"string"},body:{type:["string","number","boolean","object","array","null"]}},required:["type","body"],additionalProperties:!1},"examples.ExampleWebSocketSession":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},docs:{oneOf:[{type:"string"},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/examples.ExampleTypeReferenceSchema"}},{type:"null"}]},messages:{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketMessage"}}},required:["messages"],additionalProperties:!1},"websocket.WebSocketChannelSchema":{type:"object",properties:{docs:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/availability.AvailabilityUnionSchema"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"display-name":{oneOf:[{type:"string"},{type:"null"}]},auth:{type:"boolean"},url:{oneOf:[{type:"string"},{type:"null"}]},path:{type:"string"},headers:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpHeaderSchema"}},{type:"null"}]},"path-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpPathParameterSchema"}},{type:"null"}]},"query-parameters":{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/service.HttpQueryParameterSchema"}},{type:"null"}]},messages:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/websocket.WebSocketChannelMessageSchema"}},{type:"null"}]},examples:{oneOf:[{type:"array",items:{$ref:"#/definitions/examples.ExampleWebSocketSession"}},{type:"null"}]}},required:["auth","path"],additionalProperties:!1},"file.Navigation":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"file.ExportDetailed":{type:"object",properties:{dependency:{type:"string"},url:{oneOf:[{type:"string"},{type:"null"}]}},required:["dependency"],additionalProperties:!1},"file.Export":{anyOf:[{type:"string"},{$ref:"#/definitions/file.ExportDetailed"}]}},cnE={type:anE,properties:onE,additionalProperties:unE,definitions:snE};function We_({files:e,absolutePathToDefinition:t}){let r,i={},n={},a={};for(let[u,l]of $N(e)){let d=l.contents,s=o=>{a[u]={type:cP.JSONSCHEMA_VALIDATION,error:o}};if(u===QN){let o=aQr(d,TXs);if(o.success){let c=S2.serialization.RootApiFileSchema.parseOrThrow(d);r={defaultUrl:c["default-url"],contents:c,rawContents:l.rawContents}}else s(o)}else if(Ve_.default.basename(u)===iS){let o=aQr(d,BXs);if(o.success){let c=S2.serialization.PackageMarkerFileSchema.parseOrThrow(d);n[u]={defaultUrl:typeof c.export=="object"?c.export.url:void 0,contents:c,rawContents:l.rawContents}}else s(o)}else{let o=aQr(d,CXs);if(o.success){let c=S2.serialization.DefinitionFileSchema.parseOrThrow(d);i[u]={defaultUrl:void 0,contents:c,rawContents:l.rawContents,absoluteFilePath:es(t,u)}}else s(o)}}return r==null?{didSucceed:!1,failures:{[uo.of(QN)]:{type:cP.FILE_MISSING},...a}}:Object.keys(a).length>0?{didSucceed:!1,failures:a}:{didSucceed:!0,namedDefinitionFiles:i,rootApiFile:r,packageMarkers:n}}var v_i=class extends k5t{type="fern";context;fernWorkspaces={};loadAPIWorkspace;constructor({context:t,loadAPIWorkspace:r,...i}){super(i),this.context=t,this.loadAPIWorkspace=r}async getDefinition({context:t},r){return(await this.toFernWorkspace({context:t},r)).definition}async toFernWorkspace({context:t},r){let i=(0,He_.default)(r??{}),n=this.fernWorkspaces[i];if(n==null){let a=t||this.context,u=es(this.absoluteFilePath,uo.of(e5)),l=await u0s({absolutePathToWorkspace:this.absoluteFilePath,context:a}),d=await Fe_(u,"{yml,yaml}"),s=await Le_(d);if(!s.didSucceed)return JNo(s.failures,a.logger),a.failAndThrow();let o=We_({files:s.files,absolutePathToDefinition:u});if(!o.didSucceed)return JNo(o.failures,a.logger),a.failAndThrow();let c=await Ue_({dependenciesConfiguration:l,structuralValidationResult:o,context:a,cliVersion:this.cliVersion,settings:r,loadAPIWorkspace:this.loadAPIWorkspace});if(!c.didSucceed)return JNo(c.failures,a.logger),a.failAndThrow();n=new cDe({absoluteFilePath:this.absoluteFilePath,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:l,workspaceName:this.workspaceName,definition:{absoluteFilePath:u,rootApiFile:o.rootApiFile,namedDefinitionFiles:o.namedDefinitionFiles,packageMarkers:c.packageMarkers,importedDefinitions:c.importedDefinitions},cliVersion:this.cliVersion,sources:[]}),this.fernWorkspaces[i]=n}return n}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};function VV(e){let t=fnE(e),{value:r,done:i}=xXs(t,"{");return i?{head:r,parts:[]}:{head:r,parts:[...lnE(t)]}}function*lnE(e){let t;do{let{value:r}=xXs(e,"}"),i=xXs(e,"{");t=i.done,yield{pathParameter:r,tail:i.value}}while(!t)}function*fnE(e){for(let t of e)yield t}function xXs(e,t){let r="",i=e.next();for(;i.done!==!0&&i.value!==t;)r+=i.value,i=e.next();return{value:r,done:i.done??!1}}function sba(e){let t=2166136261;function r(n,a){if(typeof n=="object"&&n!=null){if(a>64){i("[MaxDepthExceeded]");return}if(Array.isArray(n)){i("[");for(let u=0;u<n.length;u++)u>0&&i(","),r(n[u],a+1);i("]")}else i("{"),Object.keys(n).sort().forEach((l,d)=>{d>0&&i(","),i(l),i(":"),r(n[l],a+1)}),i("}")}else i(String(n))}function i(n){for(let a=0;a<n.length;a++){let u=n.charCodeAt(a);t^=u,t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24),t>>>=0}}return r(e,0),t.toString(16)}function $e_({fieldName:e,containerType:t,maxDepth:r,currentDepth:i,typeDeclarations:n,skipOptionalProperties:a}){if(i>=r)return lZt({containerType:t});switch(t.type){case"list":{let u=tq({fieldName:e,typeReference:t.list,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?lZt({containerType:t}):{type:"success",example:JO.list({list:[u.example,u.example],itemType:t.list}),jsonExample:[u.jsonExample,u.jsonExample]}}case"literal":return{type:"success",example:JO.literal({literal:t.literal._visit({boolean:u=>Bd.boolean(u),string:u=>Bd.string({original:u}),_other:()=>{throw new Error("Encountered unknown literal type")}})}),jsonExample:t.literal._visit({boolean:u=>u,string:u=>u,_other:()=>{throw new Error("Encountered unknown literal type")}})};case"optional":{if(a)return lZt({containerType:t});let u=tq({fieldName:e,typeReference:t.optional,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?lZt({containerType:t}):{type:"success",example:JO.optional({optional:u.example,valueType:t.optional}),jsonExample:u.jsonExample}}case"nullable":{if(a)return lZt({containerType:t});let u=tq({fieldName:e,typeReference:t.nullable,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?lZt({containerType:t}):{type:"success",example:JO.nullable({nullable:u.example,valueType:t.nullable}),jsonExample:u.jsonExample}}case"set":{let u=tq({fieldName:e,typeReference:t.set,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"?lZt({containerType:t}):{type:"success",example:JO.set({set:[u.example],itemType:t.set}),jsonExample:[u.jsonExample]}}case"map":{let u=tq({fieldName:e,typeReference:t.keyType,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a}),l=tq({fieldName:e,typeReference:t.valueType,maxDepth:r,currentDepth:i+1,typeDeclarations:n,skipOptionalProperties:a});return u.type==="failure"||l.type==="failure"?lZt({containerType:t}):{type:"success",example:JO.map({map:[{key:u.example,value:l.example}],keyType:t.keyType,valueType:t.valueType}),jsonExample:{[u.jsonExample]:l.jsonExample}}}default:Fo(t)}}function lZt({containerType:e}){switch(e.type){case"list":return{type:"success",example:JO.list({list:[],itemType:e.list}),jsonExample:[]};case"literal":return{type:"success",example:JO.literal({literal:e.literal._visit({boolean:t=>Bd.boolean(t),string:t=>Bd.string({original:t}),_other:()=>{throw new Error("Encountered unknown literal type")}})}),jsonExample:e.literal._visit({boolean:t=>t,string:t=>t,_other:()=>{throw new Error("Encountered unknown literal type")}})};case"optional":return{type:"success",example:JO.optional({optional:void 0,valueType:e.optional}),jsonExample:void 0};case"nullable":return{type:"success",example:JO.nullable({nullable:void 0,valueType:e.nullable}),jsonExample:void 0};case"set":return{type:"success",example:JO.set({set:[],itemType:e.set}),jsonExample:[]};case"map":return{type:"success",example:JO.map({map:[],keyType:e.keyType,valueType:e.valueType}),jsonExample:{}};default:Fo(e)}}function Qe_({fieldName:e,primitiveType:t}){switch(t.v1){case"STRING":return hnE({fieldName:e,validation:dnE(t.v2)});case"BASE_64":return{type:"success",example:Bd.base64(My.BASE64),jsonExample:My.BASE64};case"BOOLEAN":return{type:"success",example:Bd.boolean(My.BOOLEAN),jsonExample:My.BOOLEAN};case"DATE":return{type:"success",example:Bd.date(My.DATE),jsonExample:My.DATE};case"DATE_TIME":return{type:"success",example:Bd.datetime({datetime:new Date(My.DATE_TIME),raw:My.DATE_TIME}),jsonExample:My.DATE_TIME};case"DOUBLE":return ynE({fieldName:e,validation:pnE(t.v2)});case"FLOAT":return{type:"success",example:Bd.float(My.FLOAT),jsonExample:My.FLOAT};case"INTEGER":return vnE({fieldName:e,validation:_nE(t.v2)});case"UINT_64":return{type:"success",example:Bd.uint64(My.INT64),jsonExample:My.INT64};case"UINT":return{type:"success",example:Bd.uint(My.UINT),jsonExample:My.UINT};case"BIG_INTEGER":return{type:"success",example:Bd.bigInteger(My.INT64.toString()),jsonExample:`${My.INT64}`};case"LONG":return{type:"success",example:Bd.long(My.INT64),jsonExample:My.INT64};case"UUID":return{type:"success",example:Bd.uuid(My.UUID),jsonExample:My.UUID};default:Fo(t.v1)}}function dnE(e){if(e?.type==="string")return e.validation}function pnE(e){if(e?.type==="double")return e.validation}function _nE(e){if(e?.type==="integer")return e.validation}function Ge_(e){if(e<=My.SAMPLE_STRINGS.length){let t=My.SAMPLE_STRINGS[e-1];if(t)return t;throw new Error(`Unexpected undefined value in SAMPLE_STRINGS at index ${e-1}`)}return My.SAMPLE_STRINGS[My.SAMPLE_STRINGS.length-1]+".".repeat(e-My.SAMPLE_STRINGS.length)}function hnE({fieldName:e,validation:t}){if(t){let i=t.minLength,n=t.maxLength;if(i){let a=Ge_(i);return{type:"success",example:Bd.string({original:a}),jsonExample:a}}else if(n){let a=Ge_(n);return{type:"success",example:Bd.string({original:a}),jsonExample:a}}}let r=e??My.STRING;return{type:"success",example:Bd.string({original:r}),jsonExample:r}}function ynE({fieldName:e,validation:t}){if(t){let r=t.max,i=t.min;if(r)return{type:"success",example:Bd.double(r),jsonExample:r};if(i)return{type:"success",example:Bd.double(i),jsonExample:i}}return{type:"success",example:Bd.double(My.DOUBLE),jsonExample:My.DOUBLE}}function vnE({fieldName:e,validation:t}){if(t){let r=t.max,i=t.min;if(r)return{type:"success",example:Bd.integer(r),jsonExample:r};if(i)return{type:"success",example:Bd.integer(i),jsonExample:i}}return{type:"success",example:Bd.integer(My.INT),jsonExample:My.INT}}function mFi({typeReference:e,typeDeclarations:t}){if(e.type==="container"&&e.container.type==="optional")return!0;if(e.type==="named"){let r=t[e.typeId];if(r?.shape.type==="alias"&&r?.shape.resolvedType.type==="container"&&r?.shape.resolvedType.container.type==="optional")return!0}return!1}function $En({fieldName:e,typeDeclarations:t,typeDeclaration:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a}){switch(r.shape.type){case"alias":{let u=tq({fieldName:e,typeDeclarations:t,typeReference:r.shape.aliasOf,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(u.type==="failure")return u;let{example:l,jsonExample:d}=u;return{type:"success",example:ow.alias({value:l}),jsonExample:d}}case"enum":{let u=r.shape.values[0];return u==null?{type:"failure",message:"No enum values present"}:{type:"success",example:ow.enum({value:u.name}),jsonExample:u.name.wireValue}}case"object":{let u={},l=[];if(r.shape.extends!=null)for(let c of r.shape.extends){let b=t[c.typeId];if(b==null)continue;let g=$En({fieldName:e,typeDeclaration:b,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});g!=null&&g.type==="success"&&g.example.type==="object"&&(Object.assign(u,g.jsonExample),l.push(...g.example.properties))}let d=bnE({fieldName:e,typeDeclaration:r,objectTypeDeclaration:r.shape,typeDeclarations:t,currentDepth:n,maxDepth:i,skipOptionalProperties:a});if(d.type==="failure")return d;let{example:s,jsonExample:o}=d;return{type:"success",example:ow.object({...s,properties:[...l,...s.properties]}),jsonExample:Object.assign({},u,o)}}case"undiscriminatedUnion":{let u=0;for(let l of r.shape.members){let d=tq({fieldName:e,typeReference:l.type,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});if(d.type==="failure"){++u;continue}let{example:s,jsonExample:o}=d;return{type:"success",example:ow.undiscriminatedUnion({index:u,singleUnionType:s}),jsonExample:o}}break}case"union":{let u=r.shape.discriminant,l={};if(r.shape.baseProperties!=null)for(let d of r.shape.baseProperties){let s=tq({fieldName:d.name.wireValue,typeReference:d.valueType,typeDeclarations:t,currentDepth:n+1,maxDepth:i,skipOptionalProperties:a});s.type==="success"&&(l[d.name.wireValue]=s.jsonExample)}for(let d of r.shape.types){let s=d.shape._visit({noProperties:()=>({type:"success",example:ow.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:sF.noProperties()}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,...l}}),samePropertiesAsObject:o=>{let c=t[o.typeId];if(c==null)return{type:"failure",message:`Failed to find type declaration with id ${o.typeId}`};let b=$En({currentDepth:n,maxDepth:i,fieldName:e,typeDeclaration:c,typeDeclarations:t,skipOptionalProperties:a});if(b==null)return{type:"failure",message:"Failed to generate example for type reference"};if(b.type==="failure")return b;let{example:g,jsonExample:O}=b;return{type:"success",example:ow.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:sF.samePropertiesAsObject({typeId:c.name.typeId,object:g.type==="object"?g:{properties:[]}})}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,...typeof O=="object"?O:{},...l}}},singleProperty:o=>{let c=tq({currentDepth:n+1,maxDepth:i,fieldName:e,typeReference:o.type,typeDeclarations:t,skipOptionalProperties:a});if(c.type==="failure")return c;let{example:b,jsonExample:g}=c;return{type:"success",example:ow.union({discriminant:u,singleUnionType:{wireDiscriminantValue:d.discriminantValue,shape:sF.singleProperty(b)}}),jsonExample:{[u.wireValue]:d.discriminantValue.wireValue,[o.name.wireValue]:g,...l}}},_other:()=>{throw new Error("Encountered unknown union type")}});if(s.type!=="failure")return s}}}return{type:"failure",message:"Failed to generate example for type reference"}}function bnE({fieldName:e,typeDeclaration:t,objectTypeDeclaration:r,typeDeclarations:i,maxDepth:n,currentDepth:a,skipOptionalProperties:u}){let l={},d=[];for(let s of[...r.properties??[],...r.extendedProperties??[]]){let o=tq({fieldName:s.name.wireValue,typeReference:s.valueType,typeDeclarations:i,currentDepth:a+1,maxDepth:n,skipOptionalProperties:u});if(o.type==="failure"&&!mFi({typeDeclarations:i,typeReference:s.valueType}))return{type:"failure",message:`Failed to generate required property ${s.name.wireValue} b/c ${o.message}`};if(o.type==="failure")continue;let{example:c,jsonExample:b}=o;d.push({name:s.name,originalTypeDeclaration:t.name,value:c}),l[s.name.wireValue]=b}return{type:"success",example:ow.object({properties:d}),jsonExample:l}}function tq({fieldName:e,typeReference:t,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a}){if(n>i)return{type:"failure",message:"Exceeded max depth"};switch(t.type){case"named":{let u=r[t.typeId];if(u==null)return{type:"failure",message:`Failed to find type declaration with id ${t.typeId}`};let l=$En({fieldName:e,typeDeclaration:u,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(l==null)return{type:"failure",message:"Failed to generate example for type declaration"};if(l.type==="failure")return l;let{example:d,jsonExample:s}=l;return{type:"success",example:{jsonExample:s,shape:Ph.named({shape:d,typeName:u.name})},jsonExample:s}}case"container":{let u=$e_({fieldName:e,containerType:t.container,typeDeclarations:r,maxDepth:i,currentDepth:n,skipOptionalProperties:a});if(u.type==="failure"){let{example:s,jsonExample:o}=lZt({containerType:t.container});return{type:"success",example:{jsonExample:o,shape:Ph.container(s)},jsonExample:o}}let{example:l,jsonExample:d}=u;return{type:"success",example:{jsonExample:d,shape:Ph.container(l)},jsonExample:d}}case"primitive":{let{jsonExample:u,example:l}=Qe_({fieldName:e,primitiveType:t.primitive});return{type:"success",example:{jsonExample:u,shape:Ph.primitive(l)},jsonExample:u}}case"unknown":{let u={key:"value"};return{type:"success",example:{jsonExample:u,shape:Ph.unknown(u)},jsonExample:u}}}}function PFi(e,t){let r=[];for(let i of e){let n=tq({fieldName:i.name.originalName,currentDepth:0,maxDepth:t.maxDepth??1,typeDeclarations:t.typeDeclarations,typeReference:i.valueType,skipOptionalProperties:t.skipOptionalRequestProperties});if(n.type==="failure")return n;r.push({name:i.name,value:n.example})}return{type:"success",example:r,jsonExample:void 0}}function GEn(e,t){let r=[];for(let i of e){if(t.skipOptionalRequestProperties&&mFi({typeDeclarations:t.typeDeclarations,typeReference:i.valueType}))continue;let n=tq({fieldName:i.name.name.originalName,currentDepth:0,maxDepth:t.maxDepth??1,typeDeclarations:t.typeDeclarations,typeReference:i.valueType,skipOptionalProperties:t.skipOptionalRequestProperties});if(n.type==="failure")return n;r.push({name:i.name,value:n.example})}return{type:"success",example:r,jsonExample:void 0}}function KNo(e,t){let r=[];for(let i of e){if(t.skipOptionalRequestProperties&&mFi({typeDeclarations:t.typeDeclarations,typeReference:i.valueType}))continue;let n=tq({fieldName:i.name.name.originalName,currentDepth:0,maxDepth:t.maxDepth??10,typeDeclarations:t.typeDeclarations,typeReference:i.valueType,skipOptionalProperties:t.skipOptionalRequestProperties});if(n.type==="failure")return n;r.push({name:i.name,shape:i.allowMultiple?D2.exploded():D2.single(),value:n.example})}return{type:"success",example:r,jsonExample:void 0}}var IXs=ud.primitive({v1:g0.String,v2:o_.string({default:void 0,validation:void 0})});function cba({ir:e,endpoint:t,service:r,typeDeclarations:i,skipOptionalRequestProperties:n,generationResponse:a}){let u={name:void 0,endpointHeaders:[],endpointPathParameters:[],queryParameters:[],servicePathParameters:[],serviceHeaders:[],rootPathParameters:[],request:void 0,response:Hq.ok(aC.body(void 0)),docs:void 0},l=PFi(t.pathParameters,{typeDeclarations:i,skipOptionalRequestProperties:n,maxDepth:1});if(l.type==="failure")return l;u.endpointPathParameters=l.example;let d=PFi(r.pathParameters,{typeDeclarations:i,skipOptionalRequestProperties:n,maxDepth:1});if(d.type==="failure")return d;u.servicePathParameters=d.example;let s=PFi(e.pathParameters,{typeDeclarations:i,skipOptionalRequestProperties:n,maxDepth:1});if(s.type==="failure")return s;u.rootPathParameters=s.example;let o=KNo(t.queryParameters,{typeDeclarations:i,skipOptionalRequestProperties:n,maxDepth:10});if(o.type==="failure")return o;u.queryParameters=o.example;let c=GEn(t.headers,{typeDeclarations:i,skipOptionalRequestProperties:n,maxDepth:1});if(c.type==="failure")return c;u.endpointHeaders=c.example;let b=GEn(r.headers,{typeDeclarations:i,skipOptionalRequestProperties:n,maxDepth:1});if(b.type==="failure")return b;if(u.serviceHeaders=b.example,t.requestBody!=null)switch(t.requestBody.type){case"bytes":return{type:"failure",message:"Bytes request unsupported"};case"fileUpload":return{type:"failure",message:"File upload unsupported"};case"inlinedRequestBody":{let g={},O=[];if(t.requestBody.extends!=null)for(let m of t.requestBody.extends){let P=i[m.typeId];if(P==null)throw new Error(`Failed to find extended type declaration with id ${m.typeId}`);let E=$En({typeDeclaration:P,typeDeclarations:i,currentDepth:1,maxDepth:10,skipOptionalProperties:n});E!=null&&E.type==="success"&&Object.assign(g,E.jsonExample)}for(let m of[...t.requestBody.properties??[],...t.requestBody.extendedProperties??[]]){let P=tq({fieldName:m.name.wireValue,typeReference:m.valueType,typeDeclarations:i,currentDepth:1,maxDepth:10,skipOptionalProperties:n});if(P.type==="failure"&&!mFi({typeDeclarations:i,typeReference:m.valueType}))return{type:"failure",message:`Failed to generate required property ${m.name.wireValue} b/c ${P.message}`};if(P.type==="failure")continue;let{example:E,jsonExample:A}=P;O.push({name:m.name,originalTypeDeclaration:void 0,value:E}),g[m.name.wireValue]=A}u.request=iG.inlinedRequestBody({jsonExample:g,properties:O});break}case"reference":{let g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.requestBody.requestBodyType,skipOptionalProperties:n});if(g.type==="failure")return g;let{example:O}=g;u.request=iG.reference(O);break}default:Fo(t.requestBody)}if(a.type==="success"&&t.response?.body!=null)switch(t.response.body.type){case"fileDownload":return{type:"failure",message:"File download unsupported"};case"json":{let g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.responseBodyType,skipOptionalProperties:!1});if(g.type==="failure")return g;let{example:O,jsonExample:m}=g;u.response=Hq.ok(aC.body({...O,jsonExample:m}));break}case"streamParameter":{let g;switch(t.response.body.nonStreamResponse.type){case"bytes":return{type:"failure",message:"Bytes unsupported"};case"fileDownload":return{type:"failure",message:"File download unsupported"};case"json":g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.nonStreamResponse.value.responseBodyType,skipOptionalProperties:!1});break;case"text":g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:IXs,skipOptionalProperties:!1});break;default:Fo(t.response.body.nonStreamResponse)}if(g.type==="failure")return g;let{example:O,jsonExample:m}=g;u.response=Hq.ok(aC.body({...O,jsonExample:m}));break}case"streaming":{let g;switch(t.response.body.value.type){case"sse":{if(g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.payload,skipOptionalProperties:!1}),g.type==="failure")return g;let{example:O,jsonExample:m}=g;u.response=Hq.ok(aC.sse([{data:{...O,jsonExample:m},event:""}]));break}case"json":{if(g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:t.response.body.value.payload,skipOptionalProperties:!1}),g.type==="failure")return g;let{example:O,jsonExample:m}=g;u.response=Hq.ok(aC.stream([{...O,jsonExample:m}]));break}case"text":{if(g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:IXs,skipOptionalProperties:!1}),g.type==="failure")return g;let{example:O,jsonExample:m}=g;u.response=Hq.ok(aC.stream([{...O,jsonExample:m}]));break}default:Fo(t.response.body.value)}break}case"text":{let g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:IXs,skipOptionalProperties:!1});if(g.type==="failure")return g;let{example:O,jsonExample:m}=g;u.response=Hq.ok(aC.body({...O,jsonExample:m}));break}case"bytes":return{type:"failure",message:"Bytes unsupported"};default:Fo(t.response.body)}else if(a.type==="error")if(a.declaration.type==null)u.response=Hq.error({body:void 0,error:a.declaration.name});else{let g=tq({currentDepth:0,maxDepth:10,typeDeclarations:i,typeReference:a.declaration.type,skipOptionalProperties:n});if(g.type==="failure")return g;let{example:O}=g;u.response=Hq.error({body:O,error:a.declaration.name})}try{return{type:"success",example:{id:sba(u),url:gnE(t,u),...u},jsonExample:void 0}}catch(g){return{type:"failure",message:`Parse failure with exceptions ${g}`}}}function gnE(e,t){let r={};[...t.rootPathParameters,...t.servicePathParameters,...t.endpointPathParameters].forEach(n=>{let a=n.value.jsonExample,u=typeof a=="string"?a:JSON.stringify(a);r[n.name.originalName]=u});let i=e.fullPath.head+e.fullPath.parts.map(n=>r[n.pathParameter]+n.tail).join("");return i.startsWith("/")||i===""?i:`/${i}`}function Ke_({ir:e,channel:t,typeDeclarations:r,skipOptionalRequestProperties:i}){let n={name:void 0,pathParameters:[],headers:[],queryParameters:[],messages:[],docs:void 0},a=PFi(t.pathParameters,{typeDeclarations:r,skipOptionalRequestProperties:i,maxDepth:1});if(a.type==="failure")return a;n.pathParameters.push(...a.example);let u=PFi(e.pathParameters,{typeDeclarations:r,skipOptionalRequestProperties:i,maxDepth:1});if(u.type==="failure")return u;n.pathParameters.push(...u.example);let l=KNo(t.queryParameters,{typeDeclarations:r,skipOptionalRequestProperties:i,maxDepth:10});if(l.type==="failure")return l;n.queryParameters=l.example;let d=GEn(t.headers,{typeDeclarations:r,skipOptionalRequestProperties:i,maxDepth:1});if(d.type==="failure")return d;n.headers.push(...d.example);let s=GEn(e.headers,{typeDeclarations:r,skipOptionalRequestProperties:i,maxDepth:1});if(s.type==="failure")return s;n.headers.push(...s.example);let c=t.messages.filter(O=>O.origin==="client")[0];if(c!=null){let O=Je_({message:c,typeDeclarations:r,skipOptionalRequestProperties:i});O!=null&&n.messages.push({type:c.type,body:O})}let g=t.messages.filter(O=>O.origin==="server")[0];if(g!=null){let O=Je_({message:g,typeDeclarations:r,skipOptionalRequestProperties:i});O!=null&&n.messages.push({type:g.type,body:O})}return{type:"success",example:{...n,url:OnE(t,n)},jsonExample:void 0}}function Je_({message:e,typeDeclarations:t,skipOptionalRequestProperties:r}){if(e.body.type==="inlinedBody")return;let i=tq({currentDepth:0,maxDepth:10,typeDeclarations:t,typeReference:e.body.bodyType,skipOptionalProperties:r});if(i.type==="success")return CSe.reference(i.example)}function OnE(e,t){let r={};[...t.pathParameters].forEach(n=>{let a=n.value.jsonExample,u=typeof a=="string"?a:JSON.stringify(a);r[n.name.originalName]=u});let i=e.path.head+e.path.parts.map(n=>r[n.pathParameter]+n.tail).join("");return i.startsWith("/")||i===""?i:`/${i}`}function jFi({ir:e,exampleGeneration:t}){for(let[r,i]of Object.entries(e.services))for(let n of i.endpoints){if(n.userSpecifiedExamples.length>0&&t?.skipAutogenerationIfManualExamplesExist===!0)continue;let a=cba({ir:e,service:i,endpoint:n,typeDeclarations:e.types,skipOptionalRequestProperties:!t?.includeOptionalRequestPropertyExamples,generationResponse:{type:"success"}});if(a.type==="failure")continue;let{example:u}=a;n.autogeneratedExamples=[{example:u}]}for(let[r,i]of Object.entries(e.websocketChannels??{})){if(i.examples.length>0&&t?.skipAutogenerationIfManualExamplesExist===!0)continue;let n=Ke_({ir:e,channel:i,typeDeclarations:e.types,skipOptionalRequestProperties:!t?.includeOptionalRequestPropertyExamples});if(n.type==="failure")continue;let{example:a}=n;i.examples=[...i.examples,a]}return e}function zXs(e,t,r){let{environments:i,changedBaseUrlIds1:n,changedBaseUrlIds2:a}=mnE(e.environments,t.environments,r),{services:u,websocketChannels:l}=PnE(e,t,n,a);return{apiName:e.apiName,basePath:e.basePath,apiDisplayName:e.apiDisplayName??t.apiDisplayName,apiDocs:e.apiDocs??t.apiDocs,auth:e.auth??t.auth,headers:[...e.headers??[],...t.headers??[]],environments:i,types:{...e.types??{},...t.types??{}},constants:{...e.constants??{},...t.constants??{}},errors:{...e.errors??{},...t.errors??{}},services:u,webhookGroups:{...e.webhookGroups??{},...t.webhookGroups??{}},subpackages:{...e.subpackages??{},...t.subpackages??{}},websocketChannels:l,rootPackage:{service:e.rootPackage.service??t.rootPackage.service,types:[...e.rootPackage.types??[],...t.rootPackage.types??[]],errors:[...e.rootPackage.errors??[],...t.rootPackage.errors??[]],subpackages:[...e.rootPackage.subpackages??[],...t.rootPackage.subpackages??[]],fernFilepath:e.rootPackage.fernFilepath??t.rootPackage.fernFilepath,webhooks:e.rootPackage.webhooks??t.rootPackage.webhooks,websocket:e.rootPackage.websocket??t.rootPackage.websocket,hasEndpointsInTree:e.rootPackage.hasEndpointsInTree||t.rootPackage.hasEndpointsInTree,navigationConfig:e.rootPackage.navigationConfig??t.rootPackage.navigationConfig,docs:e.rootPackage.docs??t.rootPackage.docs},fdrApiDefinitionId:e.fdrApiDefinitionId??t.fdrApiDefinitionId,apiVersion:e.apiVersion??t.apiVersion,idempotencyHeaders:[...e.idempotencyHeaders??[],...t.idempotencyHeaders??[]],pathParameters:[...e.pathParameters??[],...t.pathParameters??[]],errorDiscriminationStrategy:e.errorDiscriminationStrategy??t.errorDiscriminationStrategy,variables:[...e.variables??[],...t.variables??[]],serviceTypeReferenceInfo:e.serviceTypeReferenceInfo??t.serviceTypeReferenceInfo,readmeConfig:e.readmeConfig??t.readmeConfig,sourceConfig:e.sourceConfig??t.sourceConfig,publishConfig:e.publishConfig??t.publishConfig,dynamic:e.dynamic??t.dynamic,sdkConfig:e.sdkConfig??t.sdkConfig}}function mnE(e,t,r){if(e==null&&t==null)return{environments:void 0,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};if(t==null)return{environments:e,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};if(e==null)return{environments:t,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};if(JSON.stringify(e)===JSON.stringify(t))return{environments:e,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};let i=Ye_(e),n=Ye_(t);if(i&&n&&e.environments.type==="singleBaseUrl"&&t.environments.type==="singleBaseUrl")return{environments:{defaultEnvironment:e.defaultEnvironment??t.defaultEnvironment,environments:FC.singleBaseUrl({environments:[...e.environments.environments,...t.environments.environments]})},changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};let a=i?t.defaultEnvironment:e.defaultEnvironment,u=e.environments,l=t.environments;if(u.type==="singleBaseUrl"&&l.type==="singleBaseUrl"){let d=i?l:u,s=i?u:l,o={},{deconflictedEnvironments2:c,changedBaseUrlIds2:b}=jnE(d,s,r);if(d.environments[0]==null)return{environments:t,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0};let g="Base",O=r.generateName("Base");return d.environments.forEach(m=>{o[m.id]=g}),{environments:{defaultEnvironment:a,environments:FC.multipleBaseUrls({baseUrls:[{id:g,name:O},...c.environments.map(m=>({id:m.id,name:m.name}))],environments:d.environments.map(m=>({id:m.id,name:m.name,urls:{[g]:m.url,...Object.fromEntries(c.environments.map(P=>[P.id,P.url]))},docs:void 0}))})},changedBaseUrlIds1:o,changedBaseUrlIds2:b}}if(u.type==="multipleBaseUrls"&&l.type==="singleBaseUrl"||u.type==="singleBaseUrl"&&l.type==="multipleBaseUrls"){let d=u.type==="singleBaseUrl"?u:l,s=u.type==="multipleBaseUrls"?u:l,{deconflictedEnvironments1:o,changedBaseUrlIds1:c}=wnE(d,s,r);return{environments:{defaultEnvironment:a,environments:FC.multipleBaseUrls({baseUrls:[...s.baseUrls,...o.environments.map(b=>({id:b.id,name:b.name}))],environments:s.environments.map(b=>({...b,urls:{...b.urls,...Object.fromEntries(o.environments.map(g=>[g.id,g.url]))}}))})},changedBaseUrlIds1:u.type==="singleBaseUrl"?c:void 0,changedBaseUrlIds2:u.type==="singleBaseUrl"?void 0:c}}if(u.type==="multipleBaseUrls"&&l.type==="multipleBaseUrls"){let{deconflictedEnvironments:d,changedBaseUrlIds:s}=SnE(u,l,r);return{environments:{defaultEnvironment:a,environments:FC.multipleBaseUrls({baseUrls:[...u.baseUrls,...d.baseUrls],environments:u.environments.flatMap(o=>d.environments.map(c=>({...o,urls:{...o.urls,...c.urls}})))})},changedBaseUrlIds1:void 0,changedBaseUrlIds2:s}}return{environments:e??t,changedBaseUrlIds1:void 0,changedBaseUrlIds2:void 0}}function PnE(e,t,r,i){if(r!=null)for(let[u,l]of Object.entries(r)){for(let d of Object.values(e.services))for(let s of Object.values(d.endpoints))s.baseUrl==u&&(s.baseUrl=l);for(let d of Object.values(e.websocketChannels??{}))d.baseUrl==u&&(d.baseUrl=l)}if(i!=null)for(let[u,l]of Object.entries(i)){for(let d of Object.values(t.services))for(let s of Object.values(d.endpoints))s.baseUrl==u&&(s.baseUrl=l);for(let d of Object.values(t.websocketChannels??{}))d.baseUrl==u&&(d.baseUrl=l)}let n={...e.services??{},...t.services??{}},a={...e.websocketChannels??{},...t.websocketChannels??{}};return{services:n,websocketChannels:a}}function jnE(e,t,r){let i={},n=new Set(e.environments.map(s=>s.id)),a=new Set(e.environments.map(s=>s.name)),u=new Map(e.environments.map(s=>[s.url,s.id])),l=t.environments.filter(s=>{let o=u.get(s.url);return o!=null?(i[s.id]=o,!1):!0}).map(s=>{if(n.has(s.id)||a.has(s.name)){let o=RXs(s.id,n);return i[s.id]=o,{...s,id:o,name:r.generateName(o)}}return s});return{deconflictedEnvironments2:FC.singleBaseUrl({environments:l}),changedBaseUrlIds2:i}}function wnE(e,t,r){let i={},n=new Set(t.baseUrls.map(d=>d.id)),a=new Set(t.baseUrls.map(d=>d.name)),u=e.environments.map(d=>{if(n.has(d.id)||a.has(d.name)){let s=RXs(d.id,n);return i[d.id]=s,{...d,id:s,name:r.generateName(s)}}return d});return{deconflictedEnvironments1:FC.singleBaseUrl({environments:u}),changedBaseUrlIds1:i}}function SnE(e,t,r){let i={},n=new Set(e.baseUrls.map(s=>s.id)),a=new Set(e.baseUrls.map(s=>s.name)),u=t.baseUrls.map(s=>{if(n.has(s.id)||a.has(s.name)){let o=RXs(s.id,n);return i[s.id]=o,{...s,id:o,name:r.generateName(o)}}return s}),l=t.environments.map(s=>({...s,urls:Object.fromEntries(Object.entries(s.urls).map(([o,c])=>[i[o]??o,c]))}));return{deconflictedEnvironments:FC.multipleBaseUrls({baseUrls:u,environments:l}),changedBaseUrlIds:i}}function Ye_(e){return e.environments.type==="singleBaseUrl"?e.environments.environments.some(t=>t.url&&(t.url.startsWith("ws://")||t.url.startsWith("wss://"))):e.environments.type==="multipleBaseUrls"?e.environments.environments.some(t=>Object.values(t.urls).some(r=>r&&(r.startsWith("ws://")||r.startsWith("wss://")))):!1}function RXs(e,t){let r=e,i=1;for(;t.has(r);)r=`${e}-${i}`,i++;return r}var og=class{breadcrumbs=[];constructor({breadcrumbs:t=[]}={}){this.breadcrumbs=t}};var Xe_={[Ay.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,fx(e)])),[Ay.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[Ay.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[Ay.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all"]),[Ay.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[Ay.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime"]),[Ay.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[Ay.GenerationLanguage.SWIFT]:new Set([])};var DnE=["go","ruby"];function ODe({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let u=c=>({unsafeName:c,safeName:EnE({name:c,keywords:MnE({generationLanguage:e,keywords:t})})}),l=U0(n),d=fx(l),s=xCi(n),o=qCi(l);return r&&(!TnE(o)&&(e==null||DnE.includes(e))&&(l=o.map((c,b)=>{if(b>0){let g=YNo(c);if(g!=null)return g;if(XNo(c))return c.toUpperCase()}return c}).join(""),d=o.map((c,b)=>{let g=YNo(c);return g??(XNo(c)?c.toUpperCase():b===0?fx(c):c)}).join("")),s=n.split(" ").map(c=>c.split(/(\d+)/).map(xCi).join("")).join("_")),{originalName:n,camelCase:u(a?.casingOverrides?.camel??l),snakeCase:u(a?.casingOverrides?.snake??s),screamingSnakeCase:u(a?.casingOverrides?.["screaming-snake"]??s.toUpperCase()),pascalCase:u(a?.casingOverrides?.pascal??d)}},generateNameAndWireValue:({name:n,wireValue:a,opts:u})=>({name:i.generateName(n,u),wireValue:a})};return i}function EnE({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":qnE(e)?"_"+e:e}function MnE({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return Xe_[e]}var AnE=/^[0-9]/;function qnE(e){return AnE.test(e)}function TnE(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=YNo(i)!=null||XNo(i),a=YNo(t)!=null||XNo(t);return n&&a})}function YNo(e){return BnE.get(e.toUpperCase())}function XNo(e){return CnE.has(e.toUpperCase())}var CnE=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),BnE=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var wFi=class e{args;spec;settings;logger;generationLanguage;smartCasing;casingsGenerator;namespace;constructor(t){this.args=t,this.spec=t.spec,this.settings=t.settings,this.logger=t.logger,this.generationLanguage=t.generationLanguage,this.smartCasing=t.smartCasing,this.namespace=t.namespace,this.casingsGenerator=ODe({generationLanguage:t.generationLanguage,keywords:void 0,smartCasing:t.smartCasing})}static BREADCRUMBS_TO_IGNORE=["properties","allOf","anyOf"];convertBreadcrumbsToName(t){let r=t.filter((n,a)=>!(/^\d+$/.test(n)||e.BREADCRUMBS_TO_IGNORE.includes(n)||a===0&&n==="components"||a===1&&n==="schemas"||t[0]==="paths"&&(a===0||a===1&&["get","post","put","delete","patch"].includes(n)||a===2&&t[1]!=null&&["get","post","put","delete","patch"].includes(t[1])&&n==="parameters"))),i=U0(r.join("_"));return i.charAt(0).toUpperCase()+i.slice(1)}createPackage(t={}){return{fernFilepath:this.createFernFilepath(t),service:void 0,types:[],errors:[],subpackages:[],docs:void 0,webhooks:void 0,websocket:void 0,hasEndpointsInTree:!1,navigationConfig:void 0}}createFernFilepath(t={}){let r=this.namespace!=null?[this.casingsGenerator.generateName(this.namespace)]:[],i=t.name!=null?this.casingsGenerator.generateName(t.name):void 0;return{allParts:i?[...r,i]:r,packagePath:r,file:i}}async resolveReference(t){let r=this.spec,i;if(t.$ref.startsWith("http://")||t.$ref.startsWith("https://")){let a=t.$ref.split("#"),u=a[0];if(i=a[1],!u)return{resolved:!1};let l=await fetch(u);if(!l.ok)return{resolved:!1};try{let d=await l.text();try{r=JSON.parse(d)}catch{r=Yd.load(d)}if(r==null)return{resolved:!1}}catch{return{resolved:!1}}if(!i)return{resolved:!0,value:r}}let n=(i??t.$ref).replace(/^(?:(?:https?:\/\/)?|#?\/?)?/,"").split("/").map(a=>a.replace(/~1/g,"/"));for(let a of n){if(typeof r!="object"||r==null)return{resolved:!1};r=r[a]}return r==null?{resolved:!1}:{resolved:!0,value:r}}async getPropertyAccess(t){let r=t;for(;this.isReferenceObject(r);){let i=await this.resolveReference(r);if(!i.resolved)return;r=i.value}if(!(r.readOnly&&r.writeOnly)){if(r.readOnly)return fJt.ReadOnly;if(r.writeOnly)return fJt.WriteOnly}}async getAvailability({node:t,breadcrumbs:r,errorCollector:i}){for(;this.isReferenceObject(t);){let u=await this.resolveReference(t);if(!u.resolved)return;t=u.value}let a=await new G2.FernAvailabilityExtension({node:t,breadcrumbs:r}).convert({context:this,errorCollector:i});if(a!=null)return{status:a,message:void 0};if(t.deprecated===!0)return{status:h5.Deprecated,message:void 0}}getTypeIdFromSchemaReference(t){let r=t.$ref.match(/\/schemas\/(.+)$/);if(!(!r||!r[1]))return r[1]}createNamedTypeReference(t){return ud.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(t??"defaultName"),typeId:t,default:void 0,inline:!1})}typeReferenceToDeclaredTypeName(t){if(t.type!=="named")return;let r=t.typeId;return{typeId:r,fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r)}}removeSchemaFromInlinedTypes({id:t,inlinedTypes:r}){return Object.fromEntries(Object.entries(r).filter(([i])=>i!==t))}maybeTrimPrefix(t,r){return t.startsWith(r)?t.slice(r.length):t}isReferenceObject(t){return typeof t=="object"&&t!==null&&"$ref"in t}isOptional(t){return t.type==="container"&&t.container.type==="optional"}isList(t){return t.type==="container"&&t.container.type==="list"}isFile(t){return t.type==="primitive"&&t.primitive.v2?.type==="string"&&t.primitive.v2.validation?.format==="binary"}getAsString(t){if(typeof t=="string")return t}getAsInteger(t){if(typeof t=="number"&&Number.isInteger(t))return t}getAsNumber(t){if(typeof t=="number")return t}getAsBoolean(t){if(typeof t=="boolean")return t}getAsArray(t){if(Array.isArray(t))return t}getAsObject(t){if(typeof t=="object"&&t!==null&&!Array.isArray(t))return t}};var sC=class extends og{getExtensionValue(t){if(!(typeof t!="object"||t==null))return t[this.key]}};var Q2={};Eo(Q2,{SchemaConverters:()=>NXs});var NXs={};Eo(NXs,{ArraySchemaConverter:()=>XEn,EnumSchemaConverter:()=>QEn,ObjectSchemaConverter:()=>JEn,OneOfSchemaConverter:()=>KEn,PrimitiveSchemaConverter:()=>YEn,SchemaConverter:()=>b_i,SchemaOrReferenceConverter:()=>nRe});var QEn=class extends og{schema;maybeFernEnum;constructor({breadcrumbs:t,schema:r,maybeFernEnum:i}){super({breadcrumbs:t}),this.schema=r,this.maybeFernEnum=i}convert({context:t,errorCollector:r}){if(!this.schema.enum)return;let n=this.schema.enum.filter(u=>typeof u=="string").map(u=>{let l=this.maybeFernEnum?.[u],d=l?.name??u.toString();return{name:t.casingsGenerator.generateNameAndWireValue({name:d,wireValue:u.toString()}),docs:l?.description,availability:void 0,casing:l?.casing}});if(n.length===0)return;let a=t.getAsString(this.schema.default);return{enum:mj.enum({default:a!=null?n.find(u=>u.name.wireValue===a):void 0,values:n})}}};var JEn=class extends og{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(!this.schema.properties&&!this.schema.allOf)return{object:mj.object({properties:[],extends:[],extendedProperties:[],extraProperties:this.schema.additionalProperties!=null})};let i=[],n={};for(let[u,l]of Object.entries(this.schema.properties??{})){let d=[...this.breadcrumbs,"properties",u],s="nullable"in l?l.nullable:!1,o=t.convertBreadcrumbsToName(d),b=await new nRe({breadcrumbs:d,schemaOrReference:l,schemaIdOverride:o,wrapAsOptional:!this.schema.required?.includes(u),wrapAsNullable:s}).convert({context:t,errorCollector:r});b!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u}),valueType:b.type,docs:l.description,availability:b.availability,propertyAccess:await t.getPropertyAccess(l)}),n={...n,...b.inlinedTypes})}let a=[];for(let[u,l]of(this.schema.allOf??[]).entries()){let d=[...this.breadcrumbs,"allOf",u.toString()];if(t.isReferenceObject(l)){let s=await t.convertReferenceToTypeReference(l);s.ok&&a.push(s.reference);continue}for(let[s,o]of Object.entries(l.properties??{})){let c=[...d,s],b=t.convertBreadcrumbsToName(c),O=await new nRe({breadcrumbs:c,schemaOrReference:o,schemaIdOverride:b,wrapAsOptional:!l.required?.includes(s),wrapAsNullable:"nullable"in o?o.nullable:!1}).convert({context:t,errorCollector:r});O!=null&&(i.push({name:t.casingsGenerator.generateNameAndWireValue({name:s,wireValue:s}),valueType:O.type,docs:o.description,availability:O.availability,propertyAccess:await t.getPropertyAccess(o)}),n={...n,...O.inlinedTypes})}}return{object:mj.object({properties:i,extends:a.map(u=>t.typeReferenceToDeclaredTypeName(u)).filter(Kb),extendedProperties:[],extraProperties:this.schema.additionalProperties!=null}),inlinedTypes:n}}};var KEn=class extends og{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){return this.schema.discriminator!=null?await this.convertAsDiscriminatedUnion({context:t,errorCollector:r}):this.convertAsUndiscriminatedUnion({context:t,errorCollector:r})}async convertAsDiscriminatedUnion({context:t,errorCollector:r}){let i=[],n={};if(this.schema.discriminator==null)return;for(let[u,l]of Object.entries(this.schema.discriminator.mapping??{})){let d=new nRe({schemaOrReference:{$ref:l},breadcrumbs:[...this.breadcrumbs,"discriminator","mapping",u]}),s=t.getTypeIdFromSchemaReference({$ref:l}),o=await d.convert({context:t,errorCollector:r});if(o?.type!=null&&s!=null){let c=t.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u});i.push({docs:void 0,discriminantValue:c,availability:o.availability,displayName:void 0,shape:nG.samePropertiesAsObject({typeId:s,name:t.casingsGenerator.generateName(s),fernFilepath:{allParts:[],packagePath:[],file:void 0}})}),n={...n,...o.inlinedTypes}}}let a=[];for(let[u,l]of Object.entries(this.schema.properties??{})){let d=[...this.breadcrumbs,"properties",u],s="nullable"in l?l.nullable:!1,o=t.convertBreadcrumbsToName(d),b=await new nRe({breadcrumbs:d,schemaOrReference:l,schemaIdOverride:o,wrapAsOptional:!this.schema.required?.includes(u),wrapAsNullable:s}).convert({context:t,errorCollector:r});b!=null&&(a.push({name:t.casingsGenerator.generateNameAndWireValue({name:u,wireValue:u}),valueType:b.type,docs:l.description,availability:b.availability,propertyAccess:await t.getPropertyAccess(l)}),n={...n,...b.inlinedTypes})}return{union:mj.union({baseProperties:a,discriminant:t.casingsGenerator.generateNameAndWireValue({name:this.schema.discriminator.propertyName,wireValue:this.schema.discriminator.propertyName}),extends:[],types:i}),inlinedTypes:n}}async convertAsUndiscriminatedUnion({context:t,errorCollector:r}){if(!this.schema.oneOf&&!this.schema.anyOf||this.schema.anyOf?.length===0&&this.schema.oneOf?.length===0)return;let i=[],n={};for(let[a,u]of[...(this.schema.oneOf??[]).entries(),...(this.schema.anyOf??[]).entries()]){let l=[...this.breadcrumbs,"oneOf",lba(a)??""];if(t.isReferenceObject(u)){let c=await t.convertReferenceToTypeReference(u);c.ok&&i.push({type:c.reference,docs:u.description});continue}let d=t.convertBreadcrumbsToName(l),o=await new b_i({id:d,breadcrumbs:l,schema:u}).convert({context:t,errorCollector:r});o!=null&&(i.push({type:t.createNamedTypeReference(d),docs:u.description}),n={...n,...o.inlinedTypes,[d]:o.typeDeclaration})}return{union:mj.undiscriminatedUnion({members:i}),inlinedTypes:n}}};var YEn=class extends og{schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){switch(this.schema.type){case"string":{let i=t.getAsString(this.schema.const);return i!=null?ud.container(Kv.literal(y5.string(i))):ud.primitive({v1:"STRING",v2:o_.string({default:t.getAsString(this.schema.default),validation:this.getStringValidation(this.schema)})})}case"number":case"integer":switch(this.schema.format){case"double":return ud.primitive({v1:"DOUBLE",v2:o_.double({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"float":return ud.primitive({v1:"FLOAT",v2:o_.float({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int32":return ud.primitive({v1:"INTEGER",v2:o_.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"int64":return ud.primitive({v1:"LONG",v2:o_.long({default:t.getAsNumber(this.schema.default)})});case"uint32":return ud.primitive({v1:"UINT",v2:o_.uint({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});case"uint64":return ud.primitive({v1:"UINT_64",v2:o_.uint64({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})});default:return ud.primitive({v1:"INTEGER",v2:o_.integer({default:t.getAsNumber(this.schema.default),validation:this.getNumberValidation(this.schema)})})}case"boolean":{let i=t.getAsBoolean(this.schema.const);return i!=null?ud.container(Kv.literal(y5.boolean(i))):ud.primitive({v1:"BOOLEAN",v2:o_.boolean({default:this.schema.default})})}default:return}}getNumberValidation(t){return{max:t.maximum,min:t.minimum,exclusiveMax:typeof t.exclusiveMaximum=="boolean"?t.exclusiveMaximum:void 0,exclusiveMin:typeof t.exclusiveMinimum=="boolean"?t.exclusiveMinimum:void 0,multipleOf:t.multipleOf}}getStringValidation(t){return{minLength:t.minLength,maxLength:t.maxLength,pattern:t.pattern,format:t.format}}};var b_i=class extends og{schema;id;inlined;constructor({breadcrumbs:t,schema:r,id:i,inlined:n=!1}){super({breadcrumbs:t}),this.schema=r,this.id=i,this.inlined=n}async convert({context:t,errorCollector:r}){let n=new G2.FernTypeExtension({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r});if(n!=null){let l=await this.createTypeDeclarationFromFernType({fernType:n,context:t,errorCollector:r});if(l!=null)return{typeDeclaration:l,inlinedTypes:{}}}if(this.schema.enum?.length){let d=new G2.FernEnumExtension({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r}),o=new QEn({breadcrumbs:this.breadcrumbs,schema:this.schema,maybeFernEnum:d}).convert({context:t,errorCollector:r});if(o!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:o.enum,context:t,errorCollector:r}),inlinedTypes:{}}}let u=new YEn({schema:this.schema}).convert({context:t,errorCollector:r});if(u!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:mj.alias({aliasOf:u,resolvedType:u}),context:t,errorCollector:r}),inlinedTypes:{}};if(this.schema.type==="array"){let d=await new XEn({breadcrumbs:this.breadcrumbs,schema:this.schema}).convert({context:t,errorCollector:r});if(d!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:mj.alias({aliasOf:d.typeReference,resolvedType:d.typeReference}),context:t,errorCollector:r}),inlinedTypes:d.inlinedTypes??{}}}if(this.schema.oneOf!=null||this.schema.anyOf!=null){let d=await new KEn({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(d!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:d.union,context:t,errorCollector:r}),inlinedTypes:d.inlinedTypes??{}}}if(this.schema.type==="object"||this.schema.properties!=null||this.schema.allOf!=null){let d=await new JEn({breadcrumbs:this.breadcrumbs,schema:this.schema,inlinedTypes:{}}).convert({context:t,errorCollector:r});if(d!=null)return{typeDeclaration:await this.createTypeDeclaration({shape:d.object,context:t,errorCollector:r}),inlinedTypes:d.inlinedTypes??{}}}}async createTypeDeclaration({shape:t,context:r,errorCollector:i}){return{name:this.convertDeclaredTypeName({context:r}),shape:t,autogeneratedExamples:[],userProvidedExamples:[],encoding:void 0,availability:await r.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs,errorCollector:i}),docs:this.schema.description,referencedTypes:new Set,source:void 0,inline:this.inlined}}convertDeclaredTypeName({context:t}){return{typeId:this.id,fernFilepath:t.createFernFilepath(),name:t.casingsGenerator.generateName(this.id)}}async createTypeDeclarationFromFernType({fernType:t,context:r,errorCollector:i}){let n=this.createTypeReferenceFromFernType(t);if(n!=null)return{name:this.convertDeclaredTypeName({context:r}),shape:mj.alias({aliasOf:n,resolvedType:n}),autogeneratedExamples:[],userProvidedExamples:[],encoding:void 0,availability:await r.getAvailability({node:this.schema,breadcrumbs:this.breadcrumbs,errorCollector:i}),docs:this.schema.description,referencedTypes:new Set,source:void 0,inline:this.inlined}}createTypeReferenceFromFernType(t){return E2({type:t,_default:void 0,validation:void 0,visitor:{primitive:r=>{switch(r.v1){case"BASE_64":return ud.primitive({v1:"BASE_64",v2:o_.base64({})});case"BOOLEAN":return ud.primitive({v1:"BOOLEAN",v2:o_.boolean({default:void 0})});case"DATE":return ud.primitive({v1:"DATE",v2:o_.date({})});case"DATE_TIME":return ud.primitive({v1:"DATE_TIME",v2:o_.dateTime({})});case"FLOAT":return ud.primitive({v1:"FLOAT",v2:o_.float({})});case"DOUBLE":return ud.primitive({v1:"DOUBLE",v2:o_.double({default:void 0,validation:void 0})});case"UINT":return ud.primitive({v1:"UINT",v2:o_.uint({})});case"UINT_64":return ud.primitive({v1:"UINT_64",v2:o_.uint64({})});case"INTEGER":return ud.primitive({v1:"INTEGER",v2:o_.integer({default:void 0,validation:void 0})});case"LONG":return ud.primitive({v1:"LONG",v2:o_.long({default:void 0})});case"STRING":return ud.primitive({v1:"STRING",v2:o_.string({default:void 0,validation:void 0})});case"UUID":return ud.primitive({v1:"UUID",v2:o_.uuid({})});case"BIG_INTEGER":return ud.primitive({v1:"BIG_INTEGER",v2:o_.bigInteger({default:void 0})});default:return}},unknown:()=>ud.unknown(),map:({keyType:r,valueType:i})=>{if(!(r==null||i==null))return ud.container(Kv.map({keyType:r,valueType:i}))},list:r=>{if(r!=null)return ud.container(Kv.list(r))},optional:r=>{if(r!=null)return ud.container(Kv.optional(r))},nullable:r=>{if(r!=null)return ud.container(Kv.nullable(r))},set:r=>{if(r!=null)return ud.container(Kv.set(r))},literal:r=>ud.container(Kv.literal(r._visit({string:i=>y5.string(i),boolean:i=>y5.boolean(i),_other:()=>{throw new Error("Unexpected literal type")}}))),named:()=>{}}})}};var nRe=class extends og{schemaOrReference;schemaIdOverride;wrapAsOptional;wrapAsNullable;constructor({breadcrumbs:t,schemaOrReference:r,schemaIdOverride:i,wrapAsOptional:n=!1,wrapAsNullable:a=!1}){super({breadcrumbs:t}),this.schemaOrReference=r,this.schemaIdOverride=i,this.wrapAsOptional=n,this.wrapAsNullable=a}async convert({context:t,errorCollector:r}){if(t.isReferenceObject(this.schemaOrReference)){let l=await t.convertReferenceToTypeReference(this.schemaOrReference);return l.ok?{type:this.wrapTypeReference(l.reference),inlinedTypes:{}}:void 0}let i=this.schemaIdOverride??t.convertBreadcrumbsToName(this.breadcrumbs),n=new b_i({breadcrumbs:this.breadcrumbs,schema:this.schemaOrReference,id:i}),a=await t.getAvailability({node:this.schemaOrReference,breadcrumbs:this.breadcrumbs,errorCollector:r}),u=await n.convert({context:t,errorCollector:r});if(u!=null){if(u.typeDeclaration.shape.type==="alias"){let d=u.typeDeclaration.shape.aliasOf;return{type:this.wrapTypeReference(d),inlinedTypes:u.inlinedTypes,availability:a}}let l=t.createNamedTypeReference(i);return{type:this.wrapTypeReference(l),schema:u.typeDeclaration,inlinedTypes:{...u.inlinedTypes,[i]:u.typeDeclaration},availability:a}}}wrapTypeReference(t){return this.wrapAsOptional&&this.wrapAsNullable?this.wrapInOptional(this.wrapInNullable(t)):this.wrapAsOptional?this.wrapInOptional(t):this.wrapAsNullable?this.wrapInNullable(t):t}wrapInOptional(t){return ud.container(Kv.optional(t))}wrapInNullable(t){return ud.container(Kv.nullable(t))}};var XEn=class e extends og{static LIST_UNKNOWN=ud.container(Kv.list(ud.unknown()));schema;constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}async convert({context:t,errorCollector:r}){if(this.schema.items==null)return{typeReference:e.LIST_UNKNOWN};let n=await new nRe({breadcrumbs:[...this.breadcrumbs,"items"],schemaOrReference:this.schema.items}).convert({context:t,errorCollector:r});return n!=null?{typeReference:ud.container(Kv.list(n.type)),inlinedTypes:n.inlinedTypes}:{typeReference:e.LIST_UNKNOWN}}};var fba=class{errors=[];logger;constructor({logger:t}){this.logger=t}collect(t){this.errors.push(t)}getErrors(){return this.errors}hasErrors(){return this.errors.length>0}logErrors(){for(let t of this.errors)this.logger.log(W0.Info,Hie({title:t.message,breadcrumbs:t.path,subtitle:t.path!=null?eh.dim(t.path.join(" -> ")):void 0}))}};var G2={};Eo(G2,{FernAvailabilityExtension:()=>ZNo,FernEnumExtension:()=>kNo,FernIgnoreExtension:()=>eFo,FernOptionalExtension:()=>tFo,FernTypeExtension:()=>nFo,SdkGroupNameExtension:()=>rFo,SdkMethodNameExtension:()=>iFo});var ZNo=class extends sC{node;key="x-fern-availability";constructor({breadcrumbs:t,node:r}){super({breadcrumbs:t}),this.node=r}async convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.node);if(i==null||typeof i!="string")return;switch(i.toUpperCase().replace(/[-_\s]/g,"_")){case"IN_DEVELOPMENT":return h5.InDevelopment;case"PRE_RELEASE":return h5.PreRelease;case"GENERAL_AVAILABILITY":return h5.GeneralAvailability;case"DEPRECATED":return h5.Deprecated;default:return}}};var xnE=Yu.object({snake:Yu.string().optional(),camel:Yu.string().optional(),screamingSnake:Yu.string().optional(),pascal:Yu.string().optional()}),InE=Yu.object({description:Yu.string().optional(),name:Yu.string().optional(),casing:xnE.optional()}),Ze_=Yu.record(InE);var kNo=class extends sC{schema;key="x-fern-enum";constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.schema);if(i==null)return;let n=Ze_.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-enum extension: ${n.error.message}`,path:this.breadcrumbs});return}return n.data}};var eFo=class extends sC{operation;key="x-fern-ignore";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-ignore",path:this.breadcrumbs});return}return i}}};var tFo=class extends sC{parameter;key="x-fern-optional";constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.parameter);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-optional",path:this.breadcrumbs});return}return i}}};var rFo=class extends sC{operation;key="x-fern-sdk-group-name";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=Array.isArray(i)?i.filter(a=>typeof a=="string"):typeof i=="string"?[i]:[];if(n.length!==0)return{groups:n}}};var iFo=class extends sC{operation;key="x-fern-sdk-method-name";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null&&typeof i=="string")return{methodName:i}}};var nFo=class extends sC{schema;key="x-fern-type";constructor({breadcrumbs:t,schema:r}){super({breadcrumbs:t}),this.schema=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.schema);if(i!=null&&typeof i=="string")return i}};function lba(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],i=["","","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 u=Math.floor(e/10),l=e%10;return l===0?i[u]:`${i[u]}_${t[l]}`}if(e<1e3){let u=Math.floor(e/100),l=e%100;return l===0?`${t[u]}_hundred`:`${t[u]}_hundred_${lba(l)}`}let n=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[n]}_thousand`:`${t[n]}_thousand_${lba(a)}`}var g_i=class e extends og{static STRING=ud.primitive({v1:"STRING",v2:o_.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=ud.container(Kv.optional(e.STRING));parameter;constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}async convert({context:t,errorCollector:r}){let a=new G2.FernOptionalExtension({breadcrumbs:this.breadcrumbs,parameter:this.parameter}).convert({context:t,errorCollector:r})??this.parameter.required??!1,u=this.parameter.schema;u==null&&(u={...this.parameter,type:"string",enum:this.parameter.enum,default:this.parameter.default,example:this.parameter.examples?.[0],examples:void 0,required:void 0});let l,d={},o=await new Q2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaIdOverride:this.parameter.name,schemaOrReference:u,wrapAsOptional:a}).convert({context:t,errorCollector:r});o!=null&&(l=o.type,d=o.inlinedTypes??{});let c=await t.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs,errorCollector:r});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:l??(a?e.OPTIONAL_STRING:e.STRING),allowMultiple:this.parameter.explode??!1,availability:c},inlinedTypes:d};case"header":return{type:"header",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:l??(a?e.OPTIONAL_STRING:e.STRING),env:void 0,availability:c},inlinedTypes:d};case"path":return{type:"path",parameter:{name:t.casingsGenerator.generateName(this.parameter.name),docs:this.parameter.description,valueType:l??(a?e.OPTIONAL_STRING:e.STRING),location:"ENDPOINT",variable:void 0},inlinedTypes:d};default:r.collect({message:`Unsupported parameter location: ${this.parameter.in}`,path:this.breadcrumbs});return}}};var aFo=class extends og{channel;channelPath;group;inlinedTypes={};constructor({breadcrumbs:t,channel:r,channelPath:i,group:n}){super({breadcrumbs:t}),this.channel=r,this.channelPath=i,this.group=n}async convert({context:t,errorCollector:r}){let i=[],n=[],a=[],u=this.group?this.group.join("."):this.channelPath;this.channel.parameters&&await this.convertQueryParameters({context:t,errorCollector:r,queryParameters:n}),this.channel.bindings?.ws!=null&&(await this.convertHeaders({context:t,errorCollector:r,headers:a}),await this.convertBindingQueryParameters({context:t,errorCollector:r,queryParameters:n}));let l;this.channel.subscribe!=null&&(l=await this.convertMessage({context:t,errorCollector:r,origin:"server",operation:this.channel.subscribe,defaultId:"subscribeEvent",breadcrumbName:"subscribeEvent"}));let d;this.channel.publish!=null&&(d=await this.convertMessage({context:t,errorCollector:r,origin:"client",operation:this.channel.publish,defaultId:"publishEvent",breadcrumbName:"publishEvent"}));let s=[];l!=null&&s.push(l),d!=null&&s.push(d);let o=this.channel.servers?.[0]??Object.keys(t.spec.servers??{})[0];return{channel:{name:t.casingsGenerator.generateName(u),displayName:u,baseUrl:o,path:{head:this.transformToValidPath(this.channel.address??this.channelPath),parts:[]},auth:!1,headers:a,queryParameters:n,pathParameters:i,messages:s,examples:[],availability:await t.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.channel.description},inlinedTypes:this.inlinedTypes}}async convertMessage({context:t,errorCollector:r,origin:i,operation:n,defaultId:a,breadcrumbName:u}){let l;if(t.isReferenceObject(n.message)){let d=await t.resolveReference(n.message);d.resolved&&(n.message=d.value)}if("oneOf"in n.message){let s=await new Q2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,u],schemaOrReference:n.message,schemaIdOverride:n.operationId??a}).convert({context:t,errorCollector:r});s!=null&&s.schema!=null&&(l=s.schema,this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes})}else if(t.isMessageWithPayload(n.message)){let d;if(t.isReferenceObject(n.message.payload)){let s=await t.resolveReference(n.message.payload);s.resolved&&(d=s.value)}else d=n.message.payload;if(d!=null){let o=await new Q2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,u],schemaOrReference:d,schemaIdOverride:n.operationId??a}).convert({context:t,errorCollector:r});o!=null&&o.schema!=null&&(l=o.schema,this.inlinedTypes={...this.inlinedTypes,...o.inlinedTypes})}}if(l!=null){let d=l,s=sc.TypeReference.named({fernFilepath:t.createFernFilepath(),name:d.name.name,typeId:d.name.typeId,default:void 0,inline:!1}),o=sc.WebSocketMessageBody.reference({bodyType:s,docs:n.description});return{type:d.name.typeId,displayName:d.name.name.originalName,origin:i,body:o,availability:await t.getAvailability({node:n,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:n.description}}}async convertQueryParameters({context:t,errorCollector:r,queryParameters:i}){for(let[n,a]of Object.entries(this.channel.parameters??{})){let u=a;if(t.isReferenceObject(a)){let s=await t.resolveReference(a);if(s.resolved)u=s.value;else continue}let d=await new g_i({breadcrumbs:this.breadcrumbs,parameter:{...u,name:n,in:"query",description:a.description,required:a.required??!1}}).convert({context:t,errorCollector:r});d!=null&&(this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},d.type==="query"&&i.push(d.parameter))}}async convertHeaders({context:t,errorCollector:r,headers:i}){if(this.channel.bindings?.ws?.headers!=null){let n=this.channel.bindings.ws.headers.required??[];for(let[a,u]of Object.entries(this.channel.bindings.ws.headers.properties??{})){let l=u;if(t.isReferenceObject(u)){let o=await t.resolveReference(u);if(!o.resolved)continue;l=o.value}let s=await new g_i({breadcrumbs:[...this.breadcrumbs,a],parameter:{name:a,in:"header",required:n.includes(a),schema:l,description:"description"in l?l.description:void 0}}).convert({context:t,errorCollector:r});s!=null&&s.type==="header"&&(this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes},i.push(s.parameter))}}}async convertBindingQueryParameters({context:t,errorCollector:r,queryParameters:i}){if(this.channel.bindings?.ws?.query!=null){let n=this.channel.bindings.ws.query.required??[];for(let[a,u]of Object.entries(this.channel.bindings.ws.query.properties??{})){let l=u;if(t.isReferenceObject(u)){let o=await t.resolveReference(u);if(!o.resolved)continue;l=o.value}let s=await new g_i({breadcrumbs:[...this.breadcrumbs,a],parameter:{name:a,in:"query",required:n.includes(a),schema:l,description:"description"in l?l.description:void 0}}).convert({context:t,errorCollector:r});s!=null&&s.type==="query"&&(this.inlinedTypes={...this.inlinedTypes,...s.inlinedTypes},i.push(s.parameter))}}}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var oFo=class extends og{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||Object.keys(this.servers).length===0)return;let i=[],n;for(let[a,u]of Object.entries(this.servers)){let l={id:a,name:t.casingsGenerator.generateName(a),url:this.constructServerUrl(u.protocol,u.url),docs:void 0};i.push(l),n==null&&(n=l.id)}return{defaultEnvironment:n,environments:FC.singleBaseUrl({environments:i})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var FXs="$message.",ke_="#/channels/",et_="#/servers/",uFo=class extends og{channel;channelPath;operations;group;inlinedTypes={};constructor({breadcrumbs:t,channel:r,channelPath:i,operations:n,group:a}){super({breadcrumbs:t}),this.channel=r,this.channelPath=i,this.operations=n,this.group=a}async convert({context:t,errorCollector:r}){let i=[],n=[],a=[],u=this.group?this.group.join("."):this.channelPath;this.channel.parameters&&await this.convertChannelParameters({context:t,errorCollector:r,pathParameters:i,queryParameters:n,headers:a});let l=Object.entries(this.operations).reduce((o,[c,b])=>{try{this.getChannelPathFromOperation(b)===this.channelPath&&(o[c]=b)}catch{}return o},{}),d=[];for(let[o,c]of Object.entries(l))for(let b of c.messages){let g=await t.convertReferenceToTypeReference(b);if(g.ok){let O=sc.WebSocketMessageBody.reference({bodyType:g.reference,docs:c.description});d.push({type:o,displayName:o,origin:c.action==="send"?"client":"server",body:O,availability:await t.getAvailability({node:c,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:c.description})}}let s=this.resolveChannelServersFromReference(this.channel.servers??[],r)??Object.keys(t.spec.servers??{})[0];return{channel:{name:t.casingsGenerator.generateName(u),displayName:u,baseUrl:s,path:{head:this.transformToValidPath(this.channel.address??this.channelPath),parts:[]},auth:!1,headers:a,queryParameters:n,pathParameters:i,messages:d,examples:[],availability:await t.getAvailability({node:this.channel,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.channel.description},inlinedTypes:this.inlinedTypes}}async convertChannelParameters({context:t,errorCollector:r,pathParameters:i,queryParameters:n,headers:a}){for(let u of Object.values(this.channel.parameters??{})){let l=u;if(t.isReferenceObject(u)){let g=await t.resolveReference(u);if(g.resolved)l=g.value;else continue}let d=this.convertChannelParameterLocation(u.location,r);if(d==null)continue;let{type:s,parameterKey:o}=d,b=await new g_i({breadcrumbs:this.breadcrumbs,parameter:{...l,name:o,in:s}}).convert({context:t,errorCollector:r});if(b!=null)switch(this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},b.type){case"path":i.push(b.parameter);break;case"query":n.push(b.parameter);break;case"header":a.push(b.parameter);break}}}convertChannelParameterLocation(t,r){try{let[i,n]=t.split("#/");if(i==null||n==null){r.collect({message:`Invalid location format: ${t}; unable to parse message type and parameter key`,path:this.breadcrumbs});return}if(!i.startsWith(FXs)){r.collect({message:`Invalid location format: ${t}; expected ${FXs} prefix`,path:this.breadcrumbs});return}let a=i.substring(FXs.length);if(a!=="header"&&a!=="path"&&a!=="payload"){r.collect({message:`Invalid message type: ${a}. Must be one of: header, path, payload`,path:this.breadcrumbs});return}return a==="payload"?{type:"query",parameterKey:n}:{type:a,parameterKey:n}}catch{r.collect({message:`Invalid location format: ${t}; see here for more details: https://www.asyncapi.com/docs/reference/specification/v3.0.0#runtimeExpression`,path:this.breadcrumbs});return}}resolveChannelServersFromReference(t,r){if(t==null||t.length===0||t[0]==null)return;let i=t[0];if(!i.$ref.startsWith(et_)){r.collect({message:`Failed to resolve server name from server ref ${i.$ref}`,path:this.breadcrumbs});return}let n=i.$ref.substring(et_.length);if(n==null){r.collect({message:`Failed to find server with name ${n}`,path:this.breadcrumbs});return}return n}getChannelPathFromOperation(t){if(!t.channel.$ref.startsWith(ke_))throw new Error(`Failed to resolve channel path from operation ${t.channel.$ref}`);return t.channel.$ref.substring(ke_.length)}transformToValidPath(t){return t.startsWith("/")?t:"/"+t}};var sFo=class extends og{servers;constructor({breadcrumbs:t,servers:r}){super({breadcrumbs:t}),this.servers=r}convert({context:t,errorCollector:r}){if(this.servers==null||Object.keys(this.servers).length===0)return;let i=[],n;for(let[a,u]of Object.entries(this.servers)){let l={id:a,name:t.casingsGenerator.generateName(a),url:this.constructServerUrl(u.protocol,u.host),docs:void 0};i.push(l),n==null&&(n=l.id)}return{defaultEnvironment:n,environments:FC.singleBaseUrl({environments:i})}}constructServerUrl(t,r){return r.includes("://")?r:`${t}://${r}`}};var dba=class extends og{ir;constructor({breadcrumbs:t,context:r}){super({breadcrumbs:t}),this.ir={auth:{docs:void 0,requirement:sc.AuthSchemesRequirement.All,schemes:[]},types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:sc.ErrorDiscriminationStrategy.statusCode(),variables:[],serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:r.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}}}}async convert({context:t,errorCollector:r}){t.spec=this.removeXFernIgnores({document:t.spec,context:t,errorCollector:r}),this.isAsyncAPIV3(t)?await this.convertChannelMessages({context:t,errorCollector:r}):await this.convertComponentMessages({context:t,errorCollector:r}),await this.convertSchemas({context:t,errorCollector:r}),await this.convertServers({context:t,errorCollector:r}),await this.convertChannels({context:t,errorCollector:r});let i={...this.ir,apiName:t.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:t.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}};return i={...i,...jFi({ir:i,exampleGeneration:{disabled:!1}})},i}isAsyncAPIV3(t){return parseFloat(t.spec.asyncapi)>=3}removeXFernIgnores({document:t,context:r,errorCollector:i,breadcrumbs:n=[]}){return Array.isArray(t)?t.filter((a,u)=>!new G2.FernIgnoreExtension({breadcrumbs:[...n,String(u)],operation:a}).convert({context:r,errorCollector:i})).map((a,u)=>this.removeXFernIgnores({document:a,context:r,errorCollector:i,breadcrumbs:[...n,String(u)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([a,u])=>!new G2.FernIgnoreExtension({breadcrumbs:[...n,a],operation:u}).convert({context:r,errorCollector:i})).map(([a,u])=>[a,this.removeXFernIgnores({document:u,context:r,errorCollector:i,breadcrumbs:[...n,a]})])):t}async convertChannelMessages({context:t,errorCollector:r}){let i=t.spec;for(let[n,a]of Object.entries(i.channels??{}))for(let[u,l]of Object.entries(a.messages??{})){if(!t.isMessageWithPayload(l)&&!t.isReferenceObject(l))continue;let d;if(t.isMessageWithPayload(l))if(t.isReferenceObject(l.payload)){let b=await t.resolveReference(l.payload);b.resolved&&(d=b.value)}else d=l.payload;else if(t.isReferenceObject(l)){let b=await t.resolveReference(l);if(b.resolved){let g=b.value.payload;if(t.isReferenceObject(g)){let O=await t.resolveReference(g);O.resolved&&(d=O.value)}else d=g}}if(d==null)continue;let s=`${n}_${u}`,c=await new Q2.SchemaConverters.SchemaConverter({id:s,breadcrumbs:["channels",n,"messages",u],schema:d}).convert({context:t,errorCollector:r});c!=null&&(this.ir.rootPackage.types.push(s),this.ir.types={...this.ir.types,...c.inlinedTypes,[s]:c.typeDeclaration})}}async convertComponentMessages({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.messages??{})){if(n.payload==null)continue;let a;if(t.isReferenceObject(n.payload)){let d=await t.resolveReference(n.payload);d.resolved&&(a=d.value)}else a=n.payload;if(a==null)continue;let l=await new Q2.SchemaConverters.SchemaConverter({id:i,breadcrumbs:["components","messages",i],schema:a}).convert({context:t,errorCollector:r});l!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...l.inlinedTypes,[i]:l.typeDeclaration})}}async convertSchemas({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.components?.schemas??{})){let u=await new Q2.SchemaConverters.SchemaConverter({id:i,breadcrumbs:["components","schemas",i],schema:n}).convert({context:t,errorCollector:r});u!=null&&(this.ir.rootPackage.types.push(i),this.ir.types={...this.ir.types,...u.inlinedTypes,[i]:u.typeDeclaration})}}async convertServers({context:t,errorCollector:r}){if(this.isAsyncAPIV3(t)){let i=t.spec.servers,a=new sFo({breadcrumbs:["servers"],servers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a)}else{let i=t.spec.servers,a=new oFo({breadcrumbs:["servers"],servers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a)}}async convertChannels({context:t,errorCollector:r}){for(let[i,n]of Object.entries(t.spec.channels??{})){let u=new G2.SdkGroupNameExtension({breadcrumbs:["channels",i],operation:n}).convert({context:t,errorCollector:r})?.groups;if(this.isAsyncAPIV3(t)){let d=t.spec.operations??{},o=await new uFo({breadcrumbs:["channels",i],channel:n,channelPath:i,operations:d,group:u}).convert({context:t,errorCollector:r});o!=null&&(this.ir.websocketChannels={...this.ir.websocketChannels,[u?u.join("."):i]:o.channel},this.ir.types={...this.ir.types,...o.inlinedTypes})}else{let d=await new aFo({breadcrumbs:["channels",i],channel:n,channelPath:i,group:u}).convert({context:t,errorCollector:r});d!=null&&(this.ir.websocketChannels={...this.ir.websocketChannels,[u?u.join("."):i]:d.channel},this.ir.types={...this.ir.types,...d.inlinedTypes})}}this.addWebsocketsToIr({websocketChannels:this.ir.websocketChannels,context:t})}addWebsocketsToIr({websocketChannels:t,context:r}){if(t!=null)for(let[i,n]of Object.entries(t))i!==""?(this.ir.subpackages[i]==null&&(this.ir.subpackages[i]={name:r.casingsGenerator.generateName(i),...r.createPackage({name:i})}),this.ir.subpackages[i].websocket=i,this.ir.rootPackage.subpackages.push(i)):this.ir.rootPackage.websocket=i}};var pba=class extends wFi{isReferenceObject(t){return t!=null&&"$ref"in t}isMessageWithPayload(t){return t!=null&&typeof t=="object"&&"payload"in t}getTypeIdFromMessageReference(t){let r=t.$ref.match(/\/messages\/(.+)$/);if(!(!r||!r[1]))return r[1]}async convertReferenceToTypeReference(t){let r,i=t.$ref.match(/^.*\/schemas\/(.+)$/),n=t.$ref.match(/^.*\/channels\/([^/]+)\/messages\/(.+)$/),a=t.$ref.match(/^.*\/messages\/(.+)$/);if(i&&i[1])r=i[1];else if(n&&n[2]){let l=n[1],d=n[2];r=`${l}_${d}`}else a&&a[1]&&(r=a[1]);return r==null?{ok:!1}:(await this.resolveReference(t)).resolved?{ok:!0,reference:ud.named({fernFilepath:this.createFernFilepath(),name:this.casingsGenerator.generateName(r),typeId:r,default:void 0,inline:!1})}:{ok:!1}}};var it_=di(LXs(),1);var HXs=di(LXs(),1);var tt_=["get","post","put","delete","patch"];var cFo=class extends sC{operation;key="x-fern-idempotent";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-idempotent",path:this.breadcrumbs});return}return i}}};var NnE=Yu.object({cursor:Yu.string(),next_cursor:Yu.string(),results:Yu.string()}),FnE=Yu.object({offset:Yu.string(),results:Yu.string(),step:Yu.string().optional(),"has-next-page":Yu.string().optional()}),UXs=Yu.union([Yu.boolean(),NnE,FnE]);var VXs="$request.",lFo="$response.",fFo=class extends sC{operation;document;key="x-fern-pagination";constructor({breadcrumbs:t,operation:r,document:i}){super({breadcrumbs:t}),this.operation=r,this.document=i}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=UXs.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-pagination extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean"){let a=this.getExtensionValue(this.document);if(a==null)return;if(typeof a=="boolean"){r.collect({message:"Global pagination extension is a boolean, expected an object. Only endpoints may declare a boolean for x-fern-pagination.",path:this.breadcrumbs});return}let u=UXs.safeParse(a);if(!u.success){r.collect({message:`Invalid x-fern-pagination extension: ${u.error.message}`,path:this.breadcrumbs});return}if(typeof u.data=="boolean"){r.collect({message:"Global pagination extension is a boolean, expected an object.",path:this.breadcrumbs});return}return this.convertPaginationConfig(u.data,t)}if(typeof n.data=="boolean"){r.collect({message:"Pagination extension is a boolean with no global configuration.",path:this.breadcrumbs});return}return this.convertPaginationConfig(n.data,t)}convertPaginationConfig(t,r){let i=t;if("cursor"in i)return{type:"cursor",cursor:r.maybeTrimPrefix(i.cursor,VXs),nextCursor:r.maybeTrimPrefix(i.next_cursor,lFo),results:r.maybeTrimPrefix(i.results,lFo)};let n=t;return{type:"offset",offset:r.maybeTrimPrefix(n.offset,VXs),results:r.maybeTrimPrefix(n.results,lFo),step:n.step!=null?r.maybeTrimPrefix(n.step,VXs):void 0,hasNextPage:n["has-next-page"]!=null?r.maybeTrimPrefix(n["has-next-page"],lFo):void 0}}};var LnE="$request.",UnE=Yu.object({"stream-condition":Yu.string().optional(),format:Yu.enum(["sse","json"]).optional(),"stream-description":Yu.string().optional(),"response-stream":Yu.any(),response:Yu.any()}),VnE=Yu.union([Yu.boolean(),UnE]),ZEn=class extends sC{operation;key="x-fern-streaming";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i==null)return;let n=VnE.safeParse(i);if(!n.success){r.collect({message:`Invalid x-fern-streaming extension: ${n.error.message}`,path:this.breadcrumbs});return}if(typeof n.data=="boolean")return n.data?{type:"stream",format:"json"}:void 0;if(n.data["stream-condition"]==null&&n.data.format!=null)return{type:"stream",format:n.data.format};if(n.data["stream-condition"]==null){r.collect({message:"Missing required stream-condition property",path:this.breadcrumbs});return}return{type:"streamCondition",format:n.data.format??"json",streamDescription:n.data["stream-description"],streamConditionProperty:t.maybeTrimPrefix(n.data["stream-condition"],LnE),responseStream:n.data["response-stream"],response:n.data.response}}};var dFo=class extends sC{operation;key="x-fern-webhook";constructor({breadcrumbs:t,operation:r}){super({breadcrumbs:t}),this.operation=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.operation);if(i!=null){if(typeof i!="boolean"){r.collect({message:"Received unexpected non-boolean value for x-fern-webhook",path:this.breadcrumbs});return}return i}}};var pFo=class extends sC{server;key="x-fern-server-name";constructor({breadcrumbs:t,server:r}){super({breadcrumbs:t}),this.server=r}convert({context:t,errorCollector:r}){let i=this.getExtensionValue(this.server);if(!(i==null||typeof i!="string"))return i}};var WXs="Base",kEn=class e extends og{servers;endpointLevelServers;constructor({breadcrumbs:t,servers:r,endpointLevelServers:i}){super({breadcrumbs:t}),this.servers=r,this.endpointLevelServers=i}convert({context:t,errorCollector:r}){if(this.servers==null||this.servers.length===0||this.servers[0]==null)return;if(this.endpointLevelServers!=null&&this.endpointLevelServers.length>0){let n={id:WXs,name:t.casingsGenerator.generateName(WXs)},a=this.endpointLevelServers.map(d=>{let s=e.getServerName({server:d,errorCollector:r,context:t});return{id:s,name:t.casingsGenerator.generateName(s)}}).filter((d,s,o)=>o.findIndex(c=>c.id===d.id)===s),u=[n,...a],l=this.servers.map(d=>{let s=e.getServerName({server:d,errorCollector:r,context:t}),o=this.endpointLevelServers?.map(c=>[e.getServerName({server:c,errorCollector:r,context:t}),this.getServerUrl(c)]);return{id:s,name:t.casingsGenerator.generateName(s),urls:{[WXs]:this.getServerUrl(d),...Object.fromEntries(o??[])},docs:d.description}});return{value:{defaultEnvironment:l[0]?.id,environments:FC.multipleBaseUrls({baseUrls:u,environments:l})},defaultUrl:e.getServerName({server:this.servers[0],errorCollector:r,context:t})}}let i=this.servers.map(n=>{let a=e.getServerName({server:n,context:t,errorCollector:r});return{id:a,name:t.casingsGenerator.generateName(a),url:this.getServerUrl(n),docs:n.description}}).filter(Kb);return{value:{defaultEnvironment:i[0]?.id,environments:FC.singleBaseUrl({environments:i})}}}static getServerName({server:t,context:r,errorCollector:i}){return new pFo({breadcrumbs:[],server:t}).convert({context:r,errorCollector:i})??t.description??t.url}getServerUrl(t){if(t.variables==null)return t.url;let r=t.url;for(let[i,n]of Object.entries(t.variables))n.default!=null&&(r=r.replace(`{${i}}`,n.default));return r}};var _ba=class e extends og{static STRING=ud.primitive({v1:"STRING",v2:o_.string({default:void 0,validation:void 0})});static OPTIONAL_STRING=ud.container(Kv.optional(e.STRING));parameter;constructor({breadcrumbs:t,parameter:r}){super({breadcrumbs:t}),this.parameter=r}async convert({context:t,errorCollector:r}){let i,n={};if(this.parameter.schema!=null){let l=await new Q2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:this.parameter.schema,wrapAsOptional:this.parameter.required==null||!this.parameter.required}).convert({context:t,errorCollector:r});l!=null&&(i=l.type,n=l.inlinedTypes??{})}let a=await t.getAvailability({node:this.parameter,breadcrumbs:this.breadcrumbs,errorCollector:r});switch(this.parameter.in){case"query":return{type:"query",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??e.OPTIONAL_STRING,allowMultiple:this.parameter.explode??!1,availability:a},inlinedTypes:n};case"header":return{type:"header",parameter:{name:t.casingsGenerator.generateNameAndWireValue({name:this.parameter.name,wireValue:this.parameter.name}),docs:this.parameter.description,valueType:i??e.OPTIONAL_STRING,env:void 0,availability:a},inlinedTypes:n};case"path":return{type:"path",parameter:{name:t.casingsGenerator.generateName(this.parameter.name),docs:this.parameter.description,valueType:i??e.STRING,location:"ENDPOINT",variable:void 0},inlinedTypes:n};default:return}}};var _Fo=class extends og{requestBody;group;method;constructor({breadcrumbs:t,requestBody:r,group:i,method:n}){super({breadcrumbs:t}),this.requestBody=r,this.group=i,this.method=n}async convert({context:t,errorCollector:r}){if(!this.requestBody.content)return;let i=Object.keys(this.requestBody.content).filter(u=>u.includes("json"));for(let u of i){let l=this.handleJsonOrFormContent({contentType:u,context:t,errorCollector:r});if(l!=null)return l}let n=Object.keys(this.requestBody.content).filter(u=>u.includes("multipart"));for(let u of n){let l=[...this.group,this.method,"Request"].join("_"),d=await this.convertRequestSchemaForMediaType({schemaId:l,contentType:u,context:t,errorCollector:r});if(d!=null&&d.schema?.shape.type==="object")return{requestBody:_I.fileUpload({docs:this.requestBody.description,name:t.casingsGenerator.generateName(l),properties:d.schema?.shape.properties.map(o=>this.convertRequestBodyProperty({context:t,property:o,contentType:u}))}),inlinedTypes:t.removeSchemaFromInlinedTypes({id:l,inlinedTypes:d.inlinedTypes}),examples:d.examples}}let a=Object.keys(this.requestBody.content).filter(u=>u.includes("urlencoded"));for(let u of a){let l=this.handleJsonOrFormContent({contentType:u,context:t,errorCollector:r});if(l!=null)return l}}async convertRequestSchemaForMediaType({schemaId:t,contentType:r,context:i,errorCollector:n}){let a=this.requestBody.content[r];if(a==null||a.schema==null)return;let l=await new Q2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:a.schema,schemaIdOverride:t}).convert({context:i,errorCollector:n});if(l==null)return;let d=a.examples!=null?Object.fromEntries(await Promise.all(Object.entries(a.examples).map(async([s,o])=>[s,i.isReferenceObject(o)?await i.resolveReference(o):o]))):void 0;return{...l,examples:d}}async handleJsonOrFormContent({contentType:t,context:r,errorCollector:i}){let n=[...this.group,this.method,"Request"].join("_"),a=await this.convertRequestSchemaForMediaType({schemaId:n,contentType:t,context:r,errorCollector:i});if(a!=null)return a.schema?.shape.type==="object"?{requestBody:_I.inlinedRequestBody({contentType:t,docs:this.requestBody.description,name:r.casingsGenerator.generateName(n),extendedProperties:a.schema?.shape.extendedProperties,extends:a.schema?.shape.extends,properties:a.schema?.shape.properties,extraProperties:a.schema?.shape.extraProperties}),inlinedTypes:r.removeSchemaFromInlinedTypes({id:n,inlinedTypes:a.inlinedTypes})}:{requestBody:_I.reference({contentType:t,docs:this.requestBody.description,requestBodyType:a.type}),inlinedTypes:r.removeSchemaFromInlinedTypes({id:n,inlinedTypes:a.inlinedTypes})}}convertRequestBodyProperty({context:t,property:r,contentType:i}){return t.isFile(r.valueType)?uF.file(XU.file({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isOptional(r.valueType)&&t.isFile(r.valueType.container.optional)?uF.file(XU.file({key:r.name,isOptional:!0,contentType:i,docs:r.docs})):t.isList(r.valueType)&&t.isFile(r.valueType.container.list)?uF.file(XU.fileArray({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isList(r.valueType)&&t.isOptional(r.valueType.container.list)&&t.isFile(r.valueType.container.list.container.optional)?uF.file(XU.fileArray({key:r.name,isOptional:!1,contentType:i,docs:r.docs})):t.isOptional(r.valueType)&&t.isList(r.valueType.container.optional)&&t.isFile(r.valueType.container.optional.container.list)?uF.file(XU.fileArray({key:r.name,isOptional:!0,contentType:i,docs:r.docs})):uF.bodyProperty({...r,contentType:i,style:void 0,name:r.name})}};var hFo=class extends og{responseBody;group;method;statusCode;streamingExtension;constructor({breadcrumbs:t,responseBody:r,group:i,method:n,statusCode:a,streamingExtension:u}){super({breadcrumbs:t}),this.responseBody=r,this.group=i,this.method=n,this.statusCode=a,this.streamingExtension=u}async convert({context:t,errorCollector:r}){if(!this.responseBody.content)return;let i=Object.keys(this.responseBody.content).filter(a=>a.includes("json"));for(let a of[...i]){let u=await this.parseMediaTypeObject({context:t,errorCollector:r,contentType:a});if(u!=null&&a.includes("json"))return{responseBody:JA.json(qSe.response({responseBodyType:u.convertedSchema.type,docs:this.responseBody.description})),inlinedTypes:u.convertedSchema.inlinedTypes,examples:u.examples}}let n=Object.keys(this.responseBody.content).filter(a=>!a.includes("json"));for(let a of n){let u=await this.parseMediaTypeObject({context:t,errorCollector:r,contentType:a});if(u!=null&&this.isBinarySchema(u.convertedSchema))return t.settings?.useBytesForBinaryResponse&&this.streamingExtension==null?{responseBody:JA.bytes({docs:this.responseBody.description}),inlinedTypes:{}}:{responseBody:JA.fileDownload({docs:this.responseBody.description}),inlinedTypes:{}}}}async parseMediaTypeObject({context:t,errorCollector:r,contentType:i}){let n=this.responseBody.content?.[i];if(n==null||n.schema==null)return;let a=[...this.group,this.method,"Response",this.statusCode].join("_"),l=await new Q2.SchemaConverters.SchemaOrReferenceConverter({breadcrumbs:[...this.breadcrumbs,"schema"],schemaOrReference:n.schema,schemaIdOverride:a}).convert({context:t,errorCollector:r});if(l==null)return;let d=n.examples!=null?Object.fromEntries(await Promise.all(Object.entries(n.examples).map(async([s,o])=>[s,t.isReferenceObject(o)?await t.resolveReference(o):o]))):void 0;return{convertedSchema:l,examples:d}}isBinarySchema(t){let r=t.type;switch(r.type){case"container":case"named":case"unknown":return!1;case"primitive":return r.primitive.v2==null?!1:r.primitive.v2.type==="string"&&r.primitive.v2.validation?.format==="binary";default:return!1}}};var WnE=/{([^}]+)}/g,eMn=class extends og{operation;method;path;inlinedTypes={};constructor({breadcrumbs:t,operation:r,method:i,path:n}){super({breadcrumbs:t}),this.operation=r,this.method=i,this.path=n}convertHttpMethod(){switch(this.method){case"get":return g7.Get;case"post":return g7.Post;case"put":return g7.Put;case"delete":return g7.Delete;case"patch":return g7.Patch;default:return}}async convertParameters({context:t,errorCollector:r,breadcrumbs:i}){let n=[],a=[],u=[];if(!this.operation.parameters)return{pathParameters:n,queryParameters:a,headers:u};for(let s of this.operation.parameters){if(t.isReferenceObject(s)){let b=await t.resolveReference(s);if(b.resolved)s=b.value;else continue}let c=await new _ba({breadcrumbs:i,parameter:s}).convert({context:t,errorCollector:r});if(c!=null)switch(this.inlinedTypes={...this.inlinedTypes,...c.inlinedTypes},c.type){case"path":n.push(c.parameter);break;case"query":a.push(c.parameter);break;case"header":u.push(c.parameter);break}}let d=[...this.path.matchAll(WnE)].map(s=>s[1]).filter(s=>!n.some(o=>o.name.originalName===s));for(let s of d)s!=null&&n.push({name:t.casingsGenerator.generateName(s),valueType:_ba.STRING,docs:void 0,location:"ENDPOINT",variable:void 0});return{pathParameters:n,queryParameters:a,headers:u}}async convertRequestBody({context:t,errorCollector:r,breadcrumbs:i,group:n,method:a}){if(this.operation.requestBody==null)return;let u;if(t.isReferenceObject(this.operation.requestBody)){let s=await t.resolveReference(this.operation.requestBody);s.resolved&&(u=s.value)}else u=this.operation.requestBody;if(u==null)return null;let d=await new _Fo({breadcrumbs:i,requestBody:u,group:n??[],method:a}).convert({context:t,errorCollector:r});if(d!=null)return this.inlinedTypes={...this.inlinedTypes,...d.inlinedTypes},{value:d.requestBody,examples:d.examples}}async convertResponseBody({context:t,errorCollector:r,breadcrumbs:i,group:n,method:a,streamingExtension:u}){if(this.operation.responses!=null)for(let[l,d]of Object.entries(this.operation.responses)){let s=parseInt(l);if(isNaN(s)||s<200||s>=300)continue;let o;if(t.isReferenceObject(d)){let g=await t.resolveReference(d);g.resolved&&(o=g.value)}else o=d;if(o==null)continue;let b=await new hFo({breadcrumbs:[...i,l],responseBody:o,group:n??[],method:a,statusCode:l,streamingExtension:u}).convert({context:t,errorCollector:r});if(b!=null)return this.inlinedTypes={...this.inlinedTypes,...b.inlinedTypes},{value:{statusCode:s,body:b.responseBody},examples:b.examples}}}computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r}){let n=new G2.SdkMethodNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation}).convert({context:t,errorCollector:r})?.methodName,u=new G2.SdkGroupNameExtension({breadcrumbs:this.breadcrumbs,operation:this.operation}).convert({context:t,errorCollector:r})?.groups??[];if(n!=null)return{group:u,method:n}}computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}){let i=this.operation.tags?.[0],n=this.operation.operationId;if(n==null){let l=this.operation.summary!=null?U0(this.operation.summary):U0(`${this.method}_${this.path.split("/").join("_")}`);return i!=null?{group:[i],method:l}:{method:l}}if(i==null)return{method:n};let a=rt_(i),u=rt_(n);return uSe(a,u)?{method:i}:this.computeGroupAndMethodFromTokens({tag:i,tagTokens:a,operationId:n,operationIdTokens:u})}computeGroupAndMethodFromTokens({tag:t,tagTokens:r,operationId:i,operationIdTokens:n}){if(r.some((l,d)=>l!==n[d]))return{group:[t],method:i};let u=n.slice(r.length);return{group:[t],method:U0(u.join("_"))}}};function rt_(e){let t=HnE(e)?$nE(e):GnE(e);return t=t.map(r=>r.toLowerCase()),t=UBe(t),t}function HnE(e){return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)}function $nE(e){return e.split(/(?=[A-Z])/)}function GnE(e){return e.split(/[^a-zA-Z0-9]+/)}var yFo=class extends eMn{idempotent;servers;streamingExtensionConverter;constructor({breadcrumbs:t,operation:r,method:i,path:n,idempotent:a,servers:u}){super({breadcrumbs:t,operation:r,method:i,path:n}),this.idempotent=a,this.servers=u,this.streamingExtensionConverter=new ZEn({breadcrumbs:this.breadcrumbs,operation:this.operation})}async convert({context:t,errorCollector:r}){let i=this.convertHttpMethod();if(i==null)return;let{group:n,method:a}=this.computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r})??this.computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}),u=this.streamingExtensionConverter.convert({context:t,errorCollector:r}),{headers:l,pathParameters:d,queryParameters:s}=await this.convertParameters({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"parameters"]}),o=await this.convertRequestBody({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"requestBody"],group:n,method:a}),c=o?.value,b=await this.convertResponseBody({context:t,errorCollector:r,breadcrumbs:[...this.breadcrumbs,"responses"],group:n,method:a,streamingExtension:u}),g=this.operation.servers?.[0]??this.servers?.[0]??t.spec.servers?.[0],O=[];return t.namespace!=null&&O.push(t.namespace),O.push(...n??[]),O.push(a),{group:n,endpoint:{id:O.join("."),displayName:this.operation.summary,method:i,name:t.casingsGenerator.generateName(a),baseUrl:g!=null?kEn.getServerName({server:g,context:t,errorCollector:r}):void 0,path:VV(this.path),pathParameters:d,queryParameters:s,headers:l,requestBody:c,sdkRequest:void 0,response:b?.value,errors:[],auth:this.operation.security!=null||t.spec.security!=null,availability:await t.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.operation.description,userSpecifiedExamples:[],autogeneratedExamples:[],idempotent:this.idempotent??!1,basePath:void 0,fullPath:VV(this.path),allPathParameters:d,pagination:void 0,transport:void 0},inlinedTypes:this.inlinedTypes,servers:this.operation.servers}}convertExamples({requestExamples:t,responseExamples:r,context:i}){return[]}};var tMn=class extends eMn{constructor({breadcrumbs:t,operation:r,method:i,path:n}){super({breadcrumbs:t,operation:r,method:i,path:n})}async convert({context:t,errorCollector:r}){if(this.operation.operationId==null){r.collect({message:"Skipping webhook because no operation id present",path:this.breadcrumbs});return}if(this.operation.requestBody==null){r.collect({message:"Skipping webhook because no request body present",path:this.breadcrumbs});return}let i=this.convertHttpMethod();if(i==null)return;if(i!=="POST"&&i!=="GET"){r.collect({message:"Skipping webhook because non-POST or GET method",path:this.breadcrumbs});return}let{group:n,method:a}=this.computeGroupNameAndLocationFromExtensions({context:t,errorCollector:r})??this.computeGroupNameFromTagAndOperationId({context:t,errorCollector:r}),u=[...this.breadcrumbs,"Payload"],{headers:l,pathParameters:d,queryParameters:s}=await this.convertParameters({context:t,errorCollector:r,breadcrumbs:u}),o=await this.convertRequestBody({context:t,errorCollector:r,breadcrumbs:u,group:n,method:a}),c;if(o?.value.type==="inlinedRequestBody")c=eV.inlinedPayload({name:o.value.name,extends:o.value.extends,properties:o.value.properties});else if(o?.value.type==="reference")c=eV.reference({payloadType:o.value.requestBodyType,docs:o.value.docs});else return;return{group:n,webhook:{id:`${n?.join(".")??""}.${a}`,name:t.casingsGenerator.generateName(a),displayName:this.operation.summary,method:i,headers:l,payload:c,examples:[],availability:await t.getAvailability({node:this.operation,breadcrumbs:this.breadcrumbs,errorCollector:r}),docs:this.operation.description},inlinedTypes:this.inlinedTypes}}};var vFo=class extends og{pathItem;path;servers;constructor({breadcrumbs:t,pathItem:r,path:i,servers:n}){super({breadcrumbs:t}),this.pathItem=r,this.path=i,this.servers=n}async convert({context:t,errorCollector:r}){let i=[],n=[],a={};for(let u of tt_){let l=this.pathItem[u];if(l==null)continue;let d=[...this.breadcrumbs,u],s=await this.tryParseAsWebhook({operationBreadcrumbs:d,operation:l,method:u,context:t,errorCollector:r});if(s!=null){n.push(s),Object.assign(a,s.inlinedTypes);continue}new ZEn({breadcrumbs:d,operation:l}).convert({context:t,errorCollector:r})!=null;let b=await this.tryParseAsHttpEndpoint({operationBreadcrumbs:d,operation:l,method:u,context:t,errorCollector:r});b!=null&&(i.push(b),Object.assign(a,b.inlinedTypes))}return{endpoints:i,webhooks:n,inlinedTypes:a}}async tryParseAsWebhook({operation:t,method:r,operationBreadcrumbs:i,context:n,errorCollector:a}){return new dFo({breadcrumbs:i,operation:t}).convert({context:n,errorCollector:a})?await new tMn({breadcrumbs:i,operation:t,method:HXs.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path}).convert({context:n,errorCollector:a}):void 0}async tryParseAsHttpEndpoint({operation:t,method:r,operationBreadcrumbs:i,context:n,errorCollector:a}){new fFo({breadcrumbs:i,operation:t,document:n.spec}).convert({context:n,errorCollector:a})!=null;let s=new cFo({breadcrumbs:i,operation:t}).convert({context:n,errorCollector:a});return await new yFo({breadcrumbs:i,operation:t,method:HXs.OpenAPIV3.HttpMethods[r.toUpperCase()],path:this.path,idempotent:s}).convert({context:n,errorCollector:a})}};var bFo=class extends og{securityScheme;constructor({breadcrumbs:t,securityScheme:r}){super({breadcrumbs:t}),this.securityScheme=r}convert({context:t,errorCollector:r}){switch(this.securityScheme.type){case"http":{if(this.securityScheme.scheme==="bearer")return FR.bearer({token:t.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description});if(this.securityScheme.scheme==="basic")return FR.basic({username:t.casingsGenerator.generateName("username"),password:t.casingsGenerator.generateName("password"),usernameEnvVar:void 0,passwordEnvVar:void 0,docs:this.securityScheme.description});break}case"apiKey":{if(this.securityScheme.in==="header")return FR.header({name:{name:t.casingsGenerator.generateName(this.securityScheme.name),wireValue:this.securityScheme.name},valueType:ud.container(Kv.optional(ud.primitive({v1:"STRING",v2:o_.string({default:void 0,validation:void 0})}))),prefix:void 0,headerEnvVar:void 0,docs:this.securityScheme.description});break}case"oauth2":return FR.bearer({token:t.casingsGenerator.generateName("token"),tokenEnvVar:void 0,docs:this.securityScheme.description})}}};var hba=class extends og{ir;constructor({breadcrumbs:t,context:r}){super({breadcrumbs:t}),this.ir={auth:{docs:void 0,requirement:sc.AuthSchemesRequirement.All,schemes:[]},types:{},services:{},errors:{},webhookGroups:{},websocketChannels:void 0,headers:[],idempotencyHeaders:[],apiVersion:void 0,apiDisplayName:void 0,apiDocs:void 0,basePath:void 0,pathParameters:[],errorDiscriminationStrategy:sc.ErrorDiscriminationStrategy.statusCode(),variables:[],serviceTypeReferenceInfo:{sharedTypes:[],typesReferencedOnlyByService:{}},readmeConfig:void 0,sourceConfig:void 0,publishConfig:void 0,dynamic:void 0,environments:void 0,fdrApiDefinitionId:void 0,rootPackage:r.createPackage(),subpackages:{},sdkConfig:{hasFileDownloadEndpoints:!1,hasPaginatedEndpoints:!1,hasStreamingEndpoints:!1,isAuthMandatory:!0,platformHeaders:{language:"",sdkName:"",sdkVersion:"",userAgent:void 0}}}}async convert({context:t,errorCollector:r}){t.spec=this.removeXFernIgnores({document:t.spec,context:t,errorCollector:r}),await this.convertSecuritySchemes({context:t,errorCollector:r}),await this.convertSchemas({context:t,errorCollector:r}),await this.convertWebhooks({context:t,errorCollector:r});let{endpointLevelServers:i}=await this.convertPaths({context:t,errorCollector:r});this.convertServers({context:t,errorCollector:r,endpointLevelServers:i});let n={...this.ir,apiName:t.casingsGenerator.generateName(this.ir.apiDisplayName??""),constants:{errorInstanceIdKey:t.casingsGenerator.generateNameAndWireValue({wireValue:"errorInstanceId",name:"errorInstanceId"})}};return n={...n,...jFi({ir:n,exampleGeneration:{disabled:!1}})},n}removeXFernIgnores({document:t,context:r,errorCollector:i,breadcrumbs:n=[]}){return Array.isArray(t)?t.filter((a,u)=>!new G2.FernIgnoreExtension({breadcrumbs:[...n,String(u)],operation:a}).convert({context:r,errorCollector:i})).map((a,u)=>this.removeXFernIgnores({document:a,context:r,errorCollector:i,breadcrumbs:[...n,String(u)]})):t!=null&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([a,u])=>!new G2.FernIgnoreExtension({breadcrumbs:[...n,a],operation:u}).convert({context:r,errorCollector:i})).map(([a,u])=>[a,this.removeXFernIgnores({document:u,context:r,errorCollector:i,breadcrumbs:[...n,a]})])):t}async convertSecuritySchemes({context:t,errorCollector:r}){let i=[];for(let[n,a]of Object.entries(t.spec.components?.securitySchemes??{})){let u;if(t.isReferenceObject(a)){let s=await t.resolveReference(a);if(!s.resolved)continue;u=s.value}else u=a;let d=new bFo({breadcrumbs:["components","securitySchemes",n],securityScheme:u}).convert({context:t,errorCollector:r});d!=null&&i.push(d)}i.length>0&&(this.ir.auth={requirement:"ANY",schemes:i,docs:void 0})}convertServers({context:t,errorCollector:r,endpointLevelServers:i}){let a=new kEn({breadcrumbs:["servers"],servers:t.spec.servers,endpointLevelServers:i}).convert({context:t,errorCollector:r});a!=null&&(this.ir.environments=a.value)}async convertSchemas({context:t,errorCollector:r}){let i=this.getGroup({groupParts:[],namespace:t.namespace}),n=this.getOrCreatePackage({context:t,group:i});for(let[a,u]of Object.entries(t.spec.components?.schemas??{})){let d=await new Q2.SchemaConverters.SchemaConverter({id:a,breadcrumbs:["components","schemas",a],schema:u}).convert({context:t,errorCollector:r});d!=null&&(n.types.push(a),this.ir.types={...this.ir.types,...d.inlinedTypes,[a]:d.typeDeclaration})}}async convertWebhooks({context:t,errorCollector:r}){let i={};for(let[,n]of Object.entries(t.spec.webhooks??{})){if(n==null||!("post"in n)||!n.post?.operationId)continue;let a=n.post.operationId,l=await new tMn({breadcrumbs:["webhooks",a],operation:n.post,method:it_.OpenAPIV3.HttpMethods.POST,path:a}).convert({context:t,errorCollector:r});if(l!=null){let d=l.group?.join(".")??a;i[d]==null&&(i[d]=[]),i[d].push(a),this.ir.webhookGroups[d]==null&&(this.ir.webhookGroups[d]=[]),this.ir.webhookGroups[d].push(l.webhook),this.ir.types={...this.ir.types,...l.inlinedTypes}}}}async convertPaths({context:t,errorCollector:r}){let i=[];for(let[n,a]of Object.entries(t.spec.paths??{})){if(a==null)continue;let l=await new vFo({breadcrumbs:["paths",n],pathItem:a,path:n,servers:t.spec.servers}).convert({context:t,errorCollector:r});if(l!=null){for(let d of l.endpoints){let s=this.getGroup({groupParts:d.group,namespace:t.namespace}),o=s.join("."),c=this.getOrCreatePackage({context:t,group:d.group}),b=[...s].map(O=>t.casingsGenerator.generateName(O)),g=b[b.length-1];c.service==null&&(c.service=`service_${o}`),this.ir.services[c.service]==null&&(this.ir.services[c.service]={name:{fernFilepath:{allParts:b,packagePath:b.slice(0,-1),file:g}},displayName:void 0,basePath:VV(""),headers:[],pathParameters:[],availability:void 0,endpoints:[],transport:void 0,encoding:void 0}),this.ir.services[c.service]?.endpoints.push(d.endpoint),d.servers&&d.servers[0]!=null&&i.push(d.servers[0])}for(let d of l.webhooks){let o=this.getGroup({groupParts:d.group,namespace:t.namespace}).join("."),c=this.getOrCreatePackage({context:t,group:d.group});this.ir.webhookGroups[o]??=[],this.ir.webhookGroups[o].push(d.webhook),c.webhooks=o}this.ir.types={...this.ir.types,...l.inlinedTypes}}}return{endpointLevelServers:i}}getOrCreatePackage({context:t,group:r}){let i=[];if(t.namespace!=null&&i.push(t.namespace),i.push(...r??[]),i.length==0)return this.ir.rootPackage;let n=this.ir.rootPackage;for(let a=0;a<i.length;a++){let u=i[a],l=i.slice(0,a+1).join(".");this.ir.subpackages[l]==null&&(this.ir.subpackages[l]={name:t.casingsGenerator.generateName(u),...t.createPackage({name:u})});let d=this.ir.subpackages[l];n.subpackages.includes(l)||n.subpackages.push(l),n=d}return n}getGroup({groupParts:t,namespace:r}){let i=[];return r!=null&&i.push(r),i.push(...t??[]),i}};var yba=class extends wFi{isReferenceObject(t){return t!=null&&"$ref"in t}async convertReferenceToTypeReference(t){let r=this.getTypeIdFromSchemaReference(t);return r==null?{ok:!1}:(await this.resolveReference(t)).resolved?{ok:!0,reference:ud.named({fernFilepath:{allParts:[],packagePath:[],file:void 0},name:this.casingsGenerator.generateName(r),typeId:r,default:void 0,inline:!1})}:{ok:!1}}};var nt_={[Ay.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,fx(e)])),[Ay.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[Ay.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[Ay.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all"]),[Ay.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[Ay.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime"]),[Ay.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[Ay.GenerationLanguage.SWIFT]:new Set([])};var QnE=["go","ruby"];function at_({generationLanguage:e,keywords:t,smartCasing:r}){let i={generateName:(n,a)=>{let u=c=>({unsafeName:c,safeName:JnE({name:c,keywords:KnE({generationLanguage:e,keywords:t})})}),l=U0(n),d=fx(l),s=xCi(n),o=qCi(l);return r&&(!ZnE(o)&&(e==null||QnE.includes(e))&&(l=o.map((c,b)=>{if(b>0){let g=gFo(c);if(g!=null)return g;if(OFo(c))return c.toUpperCase()}return c}).join(""),d=o.map((c,b)=>{let g=gFo(c);return g??(OFo(c)?c.toUpperCase():b===0?fx(c):c)}).join("")),s=n.split(" ").map(c=>c.split(/(\d+)/).map(xCi).join("")).join("_")),{originalName:n,camelCase:u(a?.casingOverrides?.camel??l),snakeCase:u(a?.casingOverrides?.snake??s),screamingSnakeCase:u(a?.casingOverrides?.["screaming-snake"]??s.toUpperCase()),pascalCase:u(a?.casingOverrides?.pascal??d)}},generateNameAndWireValue:({name:n,wireValue:a,opts:u})=>({name:i.generateName(n,u),wireValue:a})};return i}function JnE({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":XnE(e)?"_"+e:e}function KnE({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return nt_[e]}var YnE=/^[0-9]/;function XnE(e){return YnE.test(e)}function ZnE(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let n=gFo(i)!=null||OFo(i),a=gFo(t)!=null||OFo(t);return n&&a})}function gFo(e){return eaE.get(e.toUpperCase())}function OFo(e){return knE.has(e.toUpperCase())}var knE=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),eaE=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]);var G7=class extends Tha{type="oss";specs;sources;loader;constructor({specs:t,...r}){super({...r,respectReadonlySchemas:t.every(i=>i.settings?.respectReadonlySchemas),respectNullableSchemas:t.every(i=>i.settings?.respectNullableSchemas),onlyIncludeReferencedSchemas:t.every(i=>i.settings?.onlyIncludeReferencedSchemas),inlinePathParameters:t.every(i=>i.settings?.inlinePathParameters),objectQueryParameters:t.every(i=>i.settings?.objectQueryParameters),useBytesForBinaryResponse:t.filter(i=>i.type==="openapi"&&i.source.type==="openapi").some(i=>i.settings?.useBytesForBinaryResponse),respectForwardCompatibleEnums:t.filter(i=>i.type==="openapi"&&i.source.type==="openapi").some(i=>i.settings?.respectForwardCompatibleEnums),exampleGeneration:t[0]?.settings?.exampleGeneration}),this.specs=t,this.sources=this.convertSpecsToIdentifiableSources(t),this.loader=new _9t(this.absoluteFilePath)}async getOpenAPIIr({context:t,relativePathToDependency:r},i){let n=await Xze({context:t,specs:this.specs,relativePathToDependency:r});return YNi({context:t,documents:await this.loader.loadDocuments({context:t,specs:n}),options:{...i,respectReadonlySchemas:i?.respectReadonlySchemas??this.respectReadonlySchemas,respectNullableSchemas:i?.respectNullableSchemas??this.respectNullableSchemas,onlyIncludeReferencedSchemas:i?.onlyIncludeReferencedSchemas??this.onlyIncludeReferencedSchemas,inlinePathParameters:i?.inlinePathParameters??this.inlinePathParameters,objectQueryParameters:i?.objectQueryParameters??this.objectQueryParameters,exampleGeneration:i?.exampleGeneration??this.exampleGeneration,useBytesForBinaryResponse:i?.useBytesForBinaryResponse??this.useBytesForBinaryResponse}})}async getIntermediateRepresentation({context:t}){let r=await Xze({context:t,specs:this.specs}),i=await this.loader.loadDocuments({context:t,specs:r}),n;for(let a of i){let u=new fba({logger:t.logger}),l;if(a.type==="openapi"){let s=new yba({namespace:a.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:a.value});l=await new hba({context:s}).convert({context:s,errorCollector:u})}else if(a.type==="asyncapi"){let s=new pba({namespace:a.namespace,generationLanguage:"typescript",logger:t.logger,smartCasing:!1,spec:a.value});l=await new dba({context:s}).convert({context:s,errorCollector:u})}else u.collect({message:`Unsupported document type: ${a}`,path:[]});u.hasErrors()&&(t.logger.info(`${a.type==="openapi"?"OpenAPI":"AsyncAPI"} Importer encountered errors:`),u.logErrors());let d=at_({generationLanguage:"typescript",keywords:void 0,smartCasing:!1});l!=null&&(n=n===void 0?l:zXs(n,l,d))}if(n===void 0)throw new Error("Failed to generate intermediate representation");return n}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new cDe({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion,sources:this.sources})}getAbsoluteFilePaths(){return[this.absoluteFilePath,...this.specs.flatMap(t=>[t.type==="protobuf"?t.absoluteFilepathToProtobufTarget:t.absoluteFilepath,t.absoluteFilepathToOverrides]).filter(Kb)]}getSources(){return this.sources}convertSpecsToIdentifiableSources(t){let r=new Set,i=[];return t.reduce((n,a)=>{let u=a.type==="protobuf"?a.absoluteFilepathToProtobufRoot:a.absoluteFilepath;return r.has(u)||(r.add(u),n.push({type:a.type,id:Cie(),absoluteFilePath:u})),n},i)}};var ot_={None:"none",Header:"header"};var WFo={};Eo(WFo,{ConjureAliasDeclaration:()=>EFo,ConjureArgument:()=>LFo,ConjureArgumentWithParamType:()=>FFo,ConjureAuthDefinition:()=>aMn,ConjureAuthDefinitionType:()=>RFo,ConjureDefinitions:()=>IFo,ConjureEndpointDefinition:()=>UFo,ConjureEnumDeclaration:()=>BFo,ConjureEnumVariant:()=>CFo,ConjureEnumWithDocs:()=>TFo,ConjureObjectDeclaration:()=>qFo,ConjureParamType:()=>NFo,ConjurePrimitive:()=>DFo,ConjureService:()=>VFo,ConjureServiceName:()=>SFo,ConjureType:()=>j_i,ConjureTypeDeclaration:()=>xFo,ConjureTypeReference:()=>w_i,ConjureTypeWithDocs:()=>MFo,ConjureTypes:()=>zFo,ConjureUnionDeclaration:()=>AFo,DefinitionFile:()=>xt_,WithDocs:()=>fZt,commons:()=>KXs,conjure:()=>YXs,services:()=>XXs,types:()=>ZXs});var KXs={};Eo(KXs,{WithDocs:()=>fZt});var ep={};Eo(ep,{JsonError:()=>rMn,ParseError:()=>iMn,any:()=>mt_,bigint:()=>st_,boolean:()=>Pt_,booleanLiteral:()=>Ot_,date:()=>ct_,discriminant:()=>Tt_,enum_:()=>PFo,getObjectLikeUtils:()=>v9t,getObjectUtils:()=>SFi,getSchemaUtils:()=>rq,isProperty:()=>P_i,lazy:()=>lt_,lazyObject:()=>vt_,list:()=>wFo,number:()=>jt_,object:()=>jFo,objectWithoutOptionalProperties:()=>yt_,optional:()=>$Xs,property:()=>dt_,record:()=>Et_,set:()=>Mt_,string:()=>wt_,stringLiteral:()=>gt_,transform:()=>GXs,undiscriminatedUnion:()=>qt_,union:()=>Bt_,unknown:()=>St_,withParsedProperties:()=>JXs});var tj={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",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function BM(e,t){return`Expected ${t}. Received ${taE(e)}.`}function taE(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 G5(e){return{...e,json:ut_(e.json),parse:ut_(e.parse)}}function ut_(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
|
|
1958
1958
|
`)),{ok:!0,value:t}):i}}function mFo(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var rMn=class e extends Error{errors;constructor(t){super(t.map(mFo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var iMn=class e extends Error{errors;constructor(t){super(t.map(mFo).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function rq(e){return{optional:()=>$Xs(e),transform:t=>GXs(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new iMn(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new rMn(i.errors)}}}function $Xs(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>tj.OPTIONAL};return{...t,...rq(t)}}function GXs(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(i,n)=>{let a=t.untransform(i);return e.json(a,n)},getType:()=>e.getType()};return{...r,...rq(r)}}function st_(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:BM(t,"string")}]}:{ok:!0,value:BigInt(t)},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t.toString()}:{ok:!1,errors:[{path:r,message:BM(t,"bigint")}]},getType:()=>tj.BIGINT};return{...G5(e),...rq(e)}}var raE=/^([+-]?\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 ct_(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:BM(t,"string")}]}:raE.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:BM(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:BM(t,"Date object")}]},getType:()=>tj.DATE};return{...G5(e),...rq(e)}}function $G(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...G5(r),...rq(r)}}}function PFo(e){let t=new Set(e);return $G(tj.ENUM,(i,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:a=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:a,message:BM(i,"string")}]}:!t.has(i)&&!n?{ok:!1,errors:[{path:a,message:BM(i,"enum")}]}:{ok:!0,value:i})()}function lt_(e){let t=QXs(e);return{...t,...rq(t)}}function QXs(e){return{parse:(t,r)=>nMn(e).parse(t,r),json:(t,r)=>nMn(e).json(t,r),getType:()=>nMn(e).getType()}}function nMn(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function vba(e){return Object.entries(e)}function bba(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[n,a])=>(r.has(n)&&(i[n]=a),i),{})}function m_i(e){if(typeof e!="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function gba(e){return Object.keys(e)}function ft_(e,t){let r=[],i=[];for(let n of e)t(n)?r.push(n):i.push(n);return[r,i]}function v9t(e){return{withParsedProperties:t=>JXs(e,t)}}function JXs(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);if(!a.ok)return a;let u=Object.entries(t).reduce((l,[d,s])=>({...l,[d]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...u}}},json:(i,n)=>{if(!m_i(i))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:BM(i,"object")}]};let a=new Set(Object.keys(t)),u=bba(i,Object.keys(i).filter(l=>!a.has(l)));return e.json(u,n)},getType:()=>e.getType()};return{...r,...rq(r),...v9t(r)}}function dt_(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function P_i(e){return e.isProperty}function jFo(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,i])=>P_i(i)?i.rawKey:r),_getParsedProperties:()=>gba(e),parse:(r,i)=>{let n={},a=[];for(let[u,l]of vba(e)){let d=P_i(l)?l.rawKey:u,s=P_i(l)?l.valueSchema:l,o={rawKey:d,parsedKey:u,valueSchema:s};n[d]=o,ht_(s)&&a.push(d)}return pt_({value:r,requiredKeys:a,getProperty:u=>{let l=n[u];if(l!=null)return{transformedKey:l.parsedKey,transform:d=>l.valueSchema.parse(d,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],u]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},json:(r,i)=>{let n=[];for(let[a,u]of vba(e)){let l=P_i(u)?u.valueSchema:u;ht_(l)&&n.push(a)}return pt_({value:r,requiredKeys:n,getProperty:a=>{let u=e[a];if(u!=null)return P_i(u)?{transformedKey:u.rawKey,transform:l=>u.valueSchema.json(l,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:l=>u.json(l,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},getType:()=>tj.OBJECT};return{...G5(t),...rq(t),...v9t(t),...SFi(t)}}function pt_({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:i="fail",skipValidation:n=!1,breadcrumbsPrefix:a=[]}){if(!m_i(e))return{ok:!1,errors:[{path:a,message:BM(e,"object")}]};let u=new Set(t),l=[],d={};for(let[s,o]of Object.entries(e)){let c=r(s);if(c!=null){u.delete(s);let b=c.transform(o);b.ok?d[c.transformedKey]=b.value:(d[s]=o,l.push(...b.errors))}else switch(i){case"fail":l.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":d[s]=o;break}}return l.push(...t.filter(s=>u.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),l.length===0||n?{ok:!0,value:d}:{ok:!1,errors:l}}function SFi(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,n)=>_t_({extensionKeys:t._getRawProperties(),value:i,transformBase:a=>e.parse(a,n),transformExtension:a=>t.parse(a,n)}),json:(i,n)=>_t_({extensionKeys:t._getParsedProperties(),value:i,transformBase:a=>e.json(a,n),transformExtension:a=>t.json(a,n)}),getType:()=>tj.OBJECT};return{...r,...rq(r),...v9t(r),...SFi(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,i)=>{let n=e.parse(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},json:(r,i)=>{let n=e.json(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},getType:()=>tj.OBJECT};return{...t,...rq(t),...v9t(t),...SFi(t)}}}}function _t_({extensionKeys:e,value:t,transformBase:r,transformExtension:i}){let n=new Set(e),[a,u]=ft_(gba(t),s=>n.has(s)),l=r(bba(t,u)),d=i(bba(t,a));return l.ok&&d.ok?{ok:!0,value:{...l.value,...d.value}}:{ok:!1,errors:[...l.ok?[]:l.errors,...d.ok?[]:d.errors]}}function ht_(e){return!iaE(e)}function iaE(e){switch(e.getType()){case tj.ANY:case tj.UNKNOWN:case tj.OPTIONAL:return!0;default:return!1}}function yt_(e){return jFo(e)}function vt_(e){let t={...QXs(e),_getRawProperties:()=>nMn(e)._getRawProperties(),_getParsedProperties:()=>nMn(e)._getParsedProperties()};return{...t,...rq(t),...v9t(t),...SFi(t)}}function wFo(e){let t={parse:(r,i)=>bt_(r,(n,a)=>e.parse(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,i)=>bt_(r,(n,a)=>e.json(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>tj.LIST};return{...G5(t),...rq(t)}}function bt_(e,t){return Array.isArray(e)?e.map((i,n)=>t(i,n)).reduce((i,n)=>{if(i.ok&&n.ok)return{ok:!0,value:[...i.value,n.value]};let a=[];return i.ok||a.push(...i.errors),n.ok||a.push(...n.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:BM(e,"list"),path:[]}]}}function gt_(e){return $G(tj.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:BM(r,`"${e}"`)}]})()}function Ot_(e){return $G(tj.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:BM(r,`${e.toString()}`)}]})()}var mt_=$G(tj.ANY,e=>({ok:!0,value:e}));var Pt_=$G(tj.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:BM(e,"boolean")}]});var jt_=$G(tj.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:BM(e,"number")}]});var wt_=$G(tj.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:BM(e,"string")}]});var St_=$G(tj.UNKNOWN,e=>({ok:!0,value:e}));function Et_(e,t){let r={parse:(i,n)=>Dt_({value:i,isKeyNumeric:e.getType()===tj.NUMBER,transformKey:a=>e.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(i,n)=>Dt_({value:i,isKeyNumeric:e.getType()===tj.NUMBER,transformKey:a=>e.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>tj.RECORD};return{...G5(r),...rq(r)}}function Dt_({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:n=[]}){return m_i(e)?vba(e).reduce((a,[u,l])=>{if(l==null)return a;let d=a,s=u;if(t){let g=u.length>0?Number(u):NaN;isNaN(g)||(s=g)}let o=r(s),c=i(l,s);if(d.ok&&o.ok&&c.ok)return{ok:!0,value:{...d.value,[o.value]:c.value}};let b=[];return d.ok||b.push(...d.errors),o.ok||b.push(...o.errors),c.ok||b.push(...c.errors),{ok:!1,errors:b}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:BM(e,"object")}]}}function Mt_(e){let t=wFo(e),r={parse:(i,n)=>{let a=t.parse(i,n);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(i,n)=>i instanceof Set?t.json([...i],n):{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:BM(i,"Set")}]},getType:()=>tj.SET};return{...G5(r),...rq(r)}}function qt_(e){let t={parse:(r,i)=>At_((n,a)=>n.parse(r,a),e,i),json:(r,i)=>At_((n,a)=>n.json(r,a),e,i),getType:()=>tj.UNDISCRIMINATED_UNION};return{...G5(t),...rq(t)}}function At_(e,t,r){let i=[];for(let[n,a]of t.entries()){let u=e(a,{...r,skipValidation:!1});if(u.ok)return u;for(let l of u.errors)i.push({path:l.path,message:`[Variant ${n}] ${l.message}`})}return{ok:!1,errors:i}}function Tt_(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function Bt_(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,n=PFo(gba(t)),a={parse:(u,l)=>Ct_({value:u,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:d=>n.parse(d,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.parse(d,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),json:(u,l)=>Ct_({value:u,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:d=>n.json(d,{allowUnrecognizedEnumValues:l?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...l?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:l?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.json(d,l),breadcrumbsPrefix:l?.breadcrumbsPrefix}),getType:()=>tj.UNION};return{...G5(a),...rq(a),...v9t(a)}}function Ct_({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:l=[]}){if(!m_i(e))return{ok:!1,errors:[{path:l,message:BM(e,"object")}]};let{[t]:d,...s}=e;if(d==null)return{ok:!1,errors:[{path:l,message:`Missing discriminant ("${t}")`}]};let o=i(d);if(!o.ok)return{ok:!1,errors:o.errors};let c=n(o.value);if(c==null)return a?{ok:!0,value:{[r]:o.value,...s}}:{ok:!1,errors:[{path:[...l,t],message:"Unexpected discriminant value"}]};let b=u(s,c);return b.ok?{ok:!0,value:{[r]:d,...b.value}}:b}var fZt=ep.objectWithoutOptionalProperties({docs:ep.string().optional()});var YXs={};Eo(YXs,{ConjureServiceName:()=>SFo,DefinitionFile:()=>xt_});var SFo=ep.string();var DFo=ep.enum_(["rid","string","safelong","integer","double","boolean"]);var j_i=ep.undiscriminatedUnion([DFo,ep.string()]);var EFo=ep.objectWithoutOptionalProperties({alias:j_i,docs:ep.string().optional()});var MFo=ep.objectWithoutOptionalProperties({type:j_i,docs:ep.string().optional()});var w_i=ep.undiscriminatedUnion([j_i,MFo]);var AFo=ep.objectWithoutOptionalProperties({union:ep.record(ep.string(),w_i)});var qFo=ep.objectWithoutOptionalProperties({fields:ep.record(ep.string(),w_i)});var TFo=ep.objectWithoutOptionalProperties({value:ep.string()}).extend(fZt);var CFo=ep.undiscriminatedUnion([ep.string(),TFo]);var BFo=ep.objectWithoutOptionalProperties({values:ep.list(CFo)});var xFo=ep.undiscriminatedUnion([EFo,AFo,qFo,BFo]);var IFo=ep.objectWithoutOptionalProperties({objects:ep.record(ep.string(),xFo).optional()});var zFo=ep.objectWithoutOptionalProperties({conjureImports:ep.property("conjure-imports",ep.record(ep.string(),ep.string()).optional()),definitions:IFo.optional()});var RFo=ep.enum_(["none","header"]);var aMn=ep.undiscriminatedUnion([RFo,ep.string()]);var NFo=ep.enum_(["path","query","body"]);var FFo=ep.objectWithoutOptionalProperties({paramType:ep.property("param-type",NFo),type:ep.string()}).extend(fZt);var LFo=ep.undiscriminatedUnion([ep.string(),FFo]);var UFo=ep.objectWithoutOptionalProperties({http:ep.string(),auth:aMn.optional(),args:ep.record(ep.string(),LFo).optional(),returns:w_i.optional()}).extend(fZt);var VFo=ep.objectWithoutOptionalProperties({name:ep.string().optional(),package:ep.string().optional(),basePath:ep.property("base-path",ep.string().optional()),defaultAuth:ep.property("default-auth",aMn.optional()),endpoints:ep.record(ep.string(),UFo).optional()}).extend(fZt);var xt_=ep.objectWithoutOptionalProperties({types:zFo.optional(),services:ep.record(SFo,VFo).optional()});var XXs={};Eo(XXs,{ConjureArgument:()=>LFo,ConjureArgumentWithParamType:()=>FFo,ConjureAuthDefinition:()=>aMn,ConjureAuthDefinitionType:()=>RFo,ConjureEndpointDefinition:()=>UFo,ConjureParamType:()=>NFo,ConjureService:()=>VFo});var ZXs={};Eo(ZXs,{ConjureAliasDeclaration:()=>EFo,ConjureDefinitions:()=>IFo,ConjureEnumDeclaration:()=>BFo,ConjureEnumVariant:()=>CFo,ConjureEnumWithDocs:()=>TFo,ConjureObjectDeclaration:()=>qFo,ConjurePrimitive:()=>DFo,ConjureType:()=>j_i,ConjureTypeDeclaration:()=>xFo,ConjureTypeReference:()=>w_i,ConjureTypeWithDocs:()=>MFo,ConjureTypes:()=>zFo,ConjureUnionDeclaration:()=>AFo});var It_=require("fs/promises");async function zt_(e,t){let r=[];for(let i of await exe(e,t))r.push(await naE({relativeFilepath:HA(e,i),absoluteFilepath:i}));return r}async function naE({relativeFilepath:e,absoluteFilepath:t}){let r=(await(0,It_.readFile)(t)).toString().replaceAll(/: rid(?:$|\s)/g,`: string
|
|
1959
1959
|
`).replaceAll("<rid>","<string>").replaceAll("rid>","string>").replaceAll(": safelong",": long").replaceAll("<safelong>","<long>").replaceAll("safelong>","long>").replaceAll(": any",": unknown").replaceAll("<any>","<unknown>").replaceAll("any>","unknown>");return{relativeFilepath:e,absoluteFilepath:t,fileContents:WFo.DefinitionFile.parseOrThrow(Yd.load(r),{unrecognizedObjectKeys:"passthrough",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0})}}function Rt_(e,t){if(aaE(e))return t.alias(e);if(oaE(e))return t.enum(e);if(uaE(e))return t.object(e);if(saE(e))return t.union(e);Fo(e)}function aaE(e){return e?.alias!=null}function oaE(e){return e?.values!=null}function uaE(e){return e?.fields!=null}function saE(e){return e?.union!=null}var Oba=class extends mha{fernDefinitionBuilder=new yNi(!1);conjureFilepathToFernFilepath={};async import({absolutePathToConjureFolder:t,authOverrides:r,environmentOverrides:i,globalHeaderOverrides:n}){if(r!=null){for(let[a,u]of Object.entries(r["auth-schemes"]??{}))this.fernDefinitionBuilder.addAuthScheme({name:a,schema:u});r.auth!=null&&this.fernDefinitionBuilder.setAuth(r.auth)}if(i!=null){for(let[a,u]of Object.entries(i.environments??{}))this.fernDefinitionBuilder.addEnvironment({name:a,schema:u});i["default-environment"]!=null&&this.fernDefinitionBuilder.setDefaultEnvironment(i["default-environment"]),i["default-url"]!=null&&this.fernDefinitionBuilder.setDefaultUrl(i["default-url"])}return await Nt_(t,(a,u,l)=>{for(let[o,c]of Object.entries(l.services??{})){let b=nZa({value:o,suffix:"Service"});this.conjureFilepathToFernFilepath[u]=uo.of(`${b}/__package__.yml`);return}let s=Vbs(u)?.split(".")[0];s!=null&&(this.conjureFilepathToFernFilepath[u]=uo.of(`${s}/__package__.yml`))}),await Nt_(t,(a,u,l)=>{if(l.services==null||Object.keys(l.services??{}).length===0){let d=this.conjureFilepathToFernFilepath[u];if(d==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${u}`);for(let[s,o]of Object.entries(l.types?.conjureImports??{})){let c=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:uo.of(o)});this.fernDefinitionBuilder.addImport({file:d,fileToImport:uo.of(c),alias:s})}this.importAllTypes({conjureFile:l,fernFilePath:d});return}for(let[d,s]of Object.entries(l.services)){let o=nZa({value:d,suffix:"Service"}),c=uo.of(`${o}/__package__.yml`),b={};s.basePath!=null&&(b["base-path"]=s.basePath),s.docs!=null&&(b.docs=s.docs),this.fernDefinitionBuilder.setServiceInfo(c,b),this.importAllTypes({conjureFile:l,fernFilePath:c});for(let[g,O]of Object.entries(l.types?.conjureImports??{})){let m=this.getFernFileToImport({absoluteFilePathToConjureFile:a,absoluteFilePathToConjureFolder:t,importFilePath:uo.of(O)});this.fernDefinitionBuilder.addImport({file:c,fileToImport:uo.of(m),alias:g})}for(let[g,O]of Object.entries(s.endpoints??{})){let m=X_s(O.http);if(m.type==="failure"){this.context?.logger.error(`Failed to parse ${O.http}. Skipping.`);continue}let E={auth:(O.auth??s.defaultAuth)!==ot_.None,path:m.path,method:m.method,response:O.returns==="binary"?"file":O.returns};O.docs!=null&&(E.docs=O.docs);let A={};if(O.args!=null)for(let q of m.pathParameters){let D=O.args[q];if(D==null)throw new Error(`Failed to find path parameter ${q} in ${O.http}`);A[q]=typeof D=="string"?D:{type:D.type}}Object.entries(A).length>0&&(E["path-parameters"]=A);for(let[q,D]of Object.entries(O.args??{}))if(A[q]==null)if(typeof D=="string")E.request?typeof E.request=="string"&&(E.request={body:E.request}):E.request={},E.request.body=D==="binary"?"bytes":D;else switch(D.paramType){case"body":E.request={body:D.type==="binary"?"bytes":D.type};break;case"query":E.request==null?E.request={"query-parameters":{[q]:D.type}}:typeof E.request!="string"&&E.request?.["query-parameters"]==null?E.request["query-parameters"]={[q]:D.type}:typeof E.request!="string"&&E.request?.["query-parameters"]!=null&&(E.request["query-parameters"][q]=D.type)}E.request!=null&&typeof E.request!="string"&&E.request?.["query-parameters"]!=null&&(E.request.name=`${g}Request`),this.fernDefinitionBuilder.addEndpoint(c,{name:g,schema:E,source:void 0})}}}),this.fernDefinitionBuilder.build()}importAllTypes({conjureFile:t,fernFilePath:r}){for(let[i,n]of Object.entries(t.types?.definitions?.objects??{}))Rt_(n,{alias:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{type:a.alias,docs:a.docs}})},object:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{properties:a.fields}})},enum:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{enum:a.values}})},union:a=>{this.fernDefinitionBuilder.addType(r,{name:i,schema:{union:Object.fromEntries(Object.entries(a.union).map(([u,l])=>[u,{type:typeof l=="string"?l:l.type,docs:typeof l=="string"?void 0:l.docs,key:u}]))}})}})}getFernFileToImport({absoluteFilePathToConjureFile:t,importFilePath:r,absoluteFilePathToConjureFolder:i}){let n=es(yp(t),uo.of(r)),a=lsi(i,n),u=this.conjureFilepathToFernFilepath[a];if(u==null)throw new Error(`Failed to find corresponding fern filepath for conjure file ${a}`);return u}};async function Nt_(e,t){for(let r of await zt_(e,"{yml,yaml}"))await t(r.absoluteFilepath,r.relativeFilepath,r.fileContents)}function Ft_(e,t){return rd(e,t)}var HFo=class extends k5t{type="conjure";absolutePathToConjureFolder;constructor({relativePathToConjureDirectory:t,...r}){super(r),this.absolutePathToConjureFolder=es(r.absoluteFilePath,t)}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new cDe({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion,sources:void 0})}async getDefinition({context:t},r){let n=await new Oba(t).import({absolutePathToConjureFolder:this.absolutePathToConjureFolder,authOverrides:this.generatorsConfiguration?.api?.auth!=null?{...this.generatorsConfiguration?.api}:void 0,environmentOverrides:this.generatorsConfiguration?.api?.environments!=null?{...this.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.generatorsConfiguration?.api?.headers!=null?{...this.generatorsConfiguration?.api}:void 0});return{absoluteFilePath:Wl.of("/DUMMY_PATH"),rootApiFile:{defaultUrl:n.rootApiFile["default-url"],contents:n.rootApiFile,rawContents:Yd.dump(n.rootApiFile)},namedDefinitionFiles:{...Ft_(n.definitionFiles,a=>({absoluteFilepath:Wl.of("/DUMMY_PATH"),rawContents:Yd.dump(a),contents:a})),[uo.of(iS)]:{absoluteFilepath:Wl.of("/DUMMY_PATH"),rawContents:Yd.dump(n.packageMarkerFile),contents:n.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}getAbsoluteFilePaths(){return[this.absolutePathToConjureFolder]}};function kXs(e,t){for(let[r,i]of $N(e.failures))caE({relativeFilepath:r,failure:i,logger:t})}function caE({relativeFilepath:e,failure:t,logger:r}){switch(t.type){case cP.MISCONFIGURED_DIRECTORY:r.error("Misconfigured fern directory: please see the docs at https://buildwithfern.com/learn/api-definition/introduction/what-is-the-fern-folder");break;case cP.FILE_READ:r.error("Failed to open file: "+e);break;case cP.FILE_MISSING:r.error("Missing file: "+e);break;case cP.FILE_PARSE:t.error instanceof Kaa?r.error(Hie({title:`Failed to parse ${e}: ${t.error.reason}`,subtitle:t.error.mark.snippet})):r.error("Failed to parse file: "+e);break;case cP.STRUCTURE_VALIDATION:for(let i of t.error.issues)for(let{title:n,subtitle:a}of laE(i))r.error(Hie({title:n,subtitle:a,breadcrumbs:[e,...i.path]}));break;case cP.FAILED_TO_LOAD_DEPENDENCY:r.error("Failed to load dependency: "+t.dependencyName);break;case cP.DEPENDENCY_NOT_LISTED:r.error(`Dependency is not listed in ${HZa}: `+t.dependencyName);break;case cP.EXPORT_PACKAGE_HAS_DEFINITIONS:r.error("Exported package contains API definitions: "+t.pathToPackage);break;case cP.EXPORTING_PACKAGE_MARKER_OTHER_KEYS:r.error(`${t.pathOfPackageMarker} has an export so it cannot define other keys.`);break;case cP.JSONSCHEMA_VALIDATION:t.error.error!=null&&r.error(Hie({title:t.error.error.message??"Unknown error",breadcrumbs:[e,...t.error.error.instancePath.split("/").filter(i=>i!=="")]}));break;default:Fo(t)}}function laE(e){switch(e.code){case Hl.invalid_type:return[{title:"Incorrect type",subtitle:`Expected ${Js.underline(e.expected)} but received ${Js.underline(e.received)}`}];case Hl.unrecognized_keys:return e.keys.map(t=>({title:"Unexpected key",subtitle:`Encountered unexpected key ${Js.underline(t)}`}));case Hl.invalid_enum_value:return[{title:"Unrecognized value",subtitle:`Allowed values: ${e.options.map(t=>Js.underline(t)).join(", ")}`}];case Hl.invalid_union:case Hl.invalid_arguments:case Hl.invalid_return_type:case Hl.invalid_date:case Hl.invalid_string:case Hl.too_small:case Hl.too_big:case Hl.invalid_intersection_types:case Hl.not_multiple_of:case Hl.custom:default:return[{title:e.message}]}}var Lt_=require("fs/promises");async function Ut_(e,t){let r=[];for(let i of await exe(e,t))r.push(await faE({relativeFilepath:HA(e,i),absoluteFilepath:i}));return r}async function faE({relativeFilepath:e,absoluteFilepath:t}){return{relativeFilepath:e,absoluteFilepath:t,fileContents:(await(0,Lt_.readFile)(t)).toString()}}async function Vt_({absolutePathToWorkspace:e}){let t=es(e,uo.of(HHf));if(!await Bf(t))return;let i=await Ut_(t,"{md,mdx}");return{files:await Promise.all(i.map(n=>({absoluteFilepath:n.absoluteFilepath,contents:n.fileContents})))}}async function eZs({absolutePathToWorkspace:e,namespace:t,definitions:r}){let i=[];for(let n of r){let a=n.overrides!=null?es(e,uo.of(n.overrides)):void 0;if(n.schema.type==="protobuf"){let l=uo.of(n.schema.root),d=es(e,l);if(!await Bf(d))return{didSucceed:!1,failures:{[uo.of(n.schema.root)]:{type:cP.FILE_MISSING}}};let s=es(e,uo.of(n.schema.target));if(!await Bf(s))return{didSucceed:!1,failures:{[uo.of(n.schema.target)]:{type:cP.FILE_MISSING}}};i.push({type:"protobuf",absoluteFilepathToProtobufRoot:d,absoluteFilepathToProtobufTarget:s,absoluteFilepathToOverrides:a,relativeFilepathToProtobufRoot:l,generateLocally:n.schema.localGeneration,settings:{audiences:n.audiences??[],useTitlesAsName:n.settings?.shouldUseTitleAsName??!0,shouldUseUndiscriminatedUnionsWithLiterals:n.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,shouldUseIdiomaticRequestNames:n.settings?.shouldUseIdiomaticRequestNames??!1,optionalAdditionalProperties:n.settings?.shouldUseOptionalAdditionalProperties??!0,coerceEnumsToLiterals:n.settings?.coerceEnumsToLiterals??!0,objectQueryParameters:n.settings?.objectQueryParameters??!1,respectReadonlySchemas:n.settings?.respectReadonlySchemas??!1,respectNullableSchemas:n.settings?.respectNullableSchemas??!1,onlyIncludeReferencedSchemas:n.settings?.onlyIncludeReferencedSchemas??!1,inlinePathParameters:n.settings?.inlinePathParameters??!1,disableExamples:!1,discriminatedUnionV2:n.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,preserveSchemaIds:!1,asyncApiNaming:n.settings?.asyncApiMessageNaming??"v1",filter:n.settings?.filter,exampleGeneration:void 0,defaultFormParameterEncoding:n.settings?.defaultFormParameterEncoding,useBytesForBinaryResponse:n.settings?.useBytesForBinaryResponse??!1,respectForwardCompatibleEnums:n.settings?.respectForwardCompatibleEnums??!1,additionalPropertiesDefaultsTo:n.settings?.additionalPropertiesDefaultsTo??!1}});continue}let u=es(e,uo.of(n.schema.path));if(!await Bf(u))return{didSucceed:!1,failures:{[uo.of(n.schema.path)]:{type:cP.FILE_MISSING}}};if(n.overrides!=null&&a!=null&&!await Bf(a))return{didSucceed:!1,failures:{[uo.of(n.overrides)]:{type:cP.FILE_MISSING}}};i.push({type:"openapi",absoluteFilepath:u,absoluteFilepathToOverrides:a,settings:{audiences:n.audiences??[],useTitlesAsName:n.settings?.shouldUseTitleAsName??!0,shouldUseUndiscriminatedUnionsWithLiterals:n.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,shouldUseIdiomaticRequestNames:n.settings?.shouldUseIdiomaticRequestNames??!1,optionalAdditionalProperties:n.settings?.shouldUseOptionalAdditionalProperties??!0,coerceEnumsToLiterals:n.settings?.coerceEnumsToLiterals??!0,objectQueryParameters:n.settings?.objectQueryParameters??!1,respectReadonlySchemas:n.settings?.respectReadonlySchemas??!1,respectNullableSchemas:n.settings?.respectNullableSchemas??!1,onlyIncludeReferencedSchemas:n.settings?.onlyIncludeReferencedSchemas??!1,inlinePathParameters:n.settings?.inlinePathParameters??!1,disableExamples:!1,discriminatedUnionV2:n.settings?.shouldUseUndiscriminatedUnionsWithLiterals??!1,preserveSchemaIds:!1,asyncApiNaming:n.settings?.asyncApiMessageNaming??"v1",filter:n.settings?.filter,exampleGeneration:n.settings?.exampleGeneration,defaultFormParameterEncoding:n.settings?.defaultFormParameterEncoding,useBytesForBinaryResponse:n.settings?.useBytesForBinaryResponse??!1,respectForwardCompatibleEnums:n.settings?.respectForwardCompatibleEnums??!1,additionalPropertiesDefaultsTo:n.settings?.additionalPropertiesDefaultsTo??!1},source:{type:"openapi",file:u},namespace:t})}return i}async function mba({absolutePathToWorkspace:e,context:t,cliVersion:r,workspaceName:i}){let n=await W8t({absolutePathToWorkspace:e,context:t}),a;try{a=await Vt_({absolutePathToWorkspace:e})}catch{}if(n?.api!=null&&n?.api.type==="conjure")return{didSucceed:!0,workspace:new HFo({workspaceName:i,absoluteFilePath:e,generatorsConfiguration:n,changelog:a,cliVersion:r,context:t,relativePathToConjureDirectory:uo.of(n.api.pathToConjureDefinition)})};if(n?.api!=null&&(n.api.type==="singleNamespace"&&n.api.definitions.length>0||n.api.type==="multiNamespace")){let u=[];if(n.api.type==="singleNamespace"){let l=await eZs({absolutePathToWorkspace:e,namespace:void 0,definitions:n.api.definitions});if(!Array.isArray(l))return l;u.push(...l)}else{for(let[l,d]of Object.entries(n.api.definitions)){let s=await eZs({absolutePathToWorkspace:e,namespace:l,definitions:d});if(!Array.isArray(s))return s;u.push(...s)}if(n.api.rootDefinitions!=null){let l=await eZs({absolutePathToWorkspace:e,namespace:void 0,definitions:n.api.rootDefinitions});if(!Array.isArray(l))return l;u.push(...l)}}return{didSucceed:!0,workspace:new G7({specs:u,workspaceName:i,absoluteFilePath:e,generatorsConfiguration:n,changelog:a,cliVersion:r})}}return await Bf(es(e,uo.of(e5)))?{didSucceed:!0,workspace:new v_i({absoluteFilePath:e,generatorsConfiguration:n,workspaceName:i,changelog:a,context:t,cliVersion:r,loadAPIWorkspace:mba})}:{didSucceed:!1,failures:{[uo.of(WZa)]:{type:cP.MISCONFIGURED_DIRECTORY}}}}var Wt_=require("fs/promises");var tZs={};Eo(tZs,{additionalProperties:()=>haE,default:()=>vaE,definitions:()=>yaE,properties:()=>paE,required:()=>_aE,type:()=>daE});var daE="object",paE={instances:{type:"array",items:{$ref:"#/definitions/docs.DocsInstance"}},title:{oneOf:[{type:"string"},{type:"null"}]},analytics:{oneOf:[{$ref:"#/definitions/docs.AnalyticsConfig"},{type:"null"}]},announcement:{oneOf:[{$ref:"#/definitions/docs.AnnouncementConfig"},{type:"null"}]},roles:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RoleId"}},{type:"null"}]},tabs:{oneOf:[{type:"object",additionalProperties:{$ref:"#/definitions/docs.TabConfig"}},{type:"null"}]},versions:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.VersionConfig"}},{type:"null"}]},"landing-page":{oneOf:[{$ref:"#/definitions/docs.PageConfiguration"},{type:"null"}]},navigation:{oneOf:[{$ref:"#/definitions/docs.NavigationConfig"},{type:"null"}]},"navbar-links":{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavbarLink"}},{type:"null"}]},"footer-links":{oneOf:[{$ref:"#/definitions/docs.FooterLinksConfig"},{type:"null"}]},experimental:{oneOf:[{$ref:"#/definitions/docs.ExperimentalConfig"},{type:"null"}]},"default-language":{oneOf:[{$ref:"#/definitions/docs.ProgrammingLanguage"},{type:"null"}]},"ai-chat":{oneOf:[{$ref:"#/definitions/docs.AIChatConfig"},{type:"null"}]},metadata:{oneOf:[{$ref:"#/definitions/docs.MetadataConfig"},{type:"null"}]},redirects:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.RedirectConfig"}},{type:"null"}]},logo:{oneOf:[{$ref:"#/definitions/docs.LogoConfiguration"},{type:"null"}]},favicon:{oneOf:[{type:"string"},{type:"null"}]},"background-image":{oneOf:[{$ref:"#/definitions/docs.BackgroundImageConfiguration"},{type:"null"}]},colors:{oneOf:[{$ref:"#/definitions/docs.ColorsConfiguration"},{type:"null"}]},typography:{oneOf:[{$ref:"#/definitions/docs.DocsTypographyConfig"},{type:"null"}]},layout:{oneOf:[{$ref:"#/definitions/docs.LayoutConfig"},{type:"null"}]},integrations:{oneOf:[{$ref:"#/definitions/docs.IntegrationsConfig"},{type:"null"}]},css:{oneOf:[{$ref:"#/definitions/docs.CssConfig"},{type:"null"}]},js:{oneOf:[{$ref:"#/definitions/docs.JsConfig"},{type:"null"}]}},_aE=["instances"],haE=!1,yaE={"docs.CustomDomain":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.GithubEditThisPageConfig":{type:"object",properties:{host:{oneOf:[{type:"string"},{type:"null"}]},owner:{type:"string"},repo:{type:"string"},branch:{oneOf:[{type:"string"},{type:"null"}]}},required:["owner","repo"],additionalProperties:!1},"docs.EditThisPageConfig":{type:"object",properties:{github:{oneOf:[{$ref:"#/definitions/docs.GithubEditThisPageConfig"},{type:"null"}]}},additionalProperties:!1},"docs.DocsInstance":{type:"object",properties:{url:{type:"string"},"custom-domain":{oneOf:[{$ref:"#/definitions/docs.CustomDomain"},{type:"null"}]},private:{oneOf:[{type:"boolean"},{type:"null"}]},"edit-this-page":{oneOf:[{$ref:"#/definitions/docs.EditThisPageConfig"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.SegmentConfig":{type:"object",properties:{"write-key":{type:"string"}},required:["write-key"],additionalProperties:!1},"docs.FullStoryAnalyticsConfig":{type:"object",properties:{"org-id":{type:"string"}},required:["org-id"],additionalProperties:!1},"docs.IntercomConfig":{type:"object",properties:{"app-id":{type:"string"},"api-base":{oneOf:[{type:"string"},{type:"null"}]}},required:["app-id"],additionalProperties:!1},"docs.PostHogConfig":{type:"object",properties:{"api-key":{type:"string"},endpoint:{oneOf:[{type:"string"},{type:"null"}]}},required:["api-key"],additionalProperties:!1},"docs.GTMConfig":{type:"object",properties:{"container-id":{type:"string"}},required:["container-id"],additionalProperties:!1},"docs.GoogleAnalytics4Config":{type:"object",properties:{"measurement-id":{type:"string"}},required:["measurement-id"],additionalProperties:!1},"docs.AnalyticsConfig":{type:"object",properties:{segment:{oneOf:[{$ref:"#/definitions/docs.SegmentConfig"},{type:"null"}]},fullstory:{oneOf:[{$ref:"#/definitions/docs.FullStoryAnalyticsConfig"},{type:"null"}]},intercom:{oneOf:[{$ref:"#/definitions/docs.IntercomConfig"},{type:"null"}]},posthog:{oneOf:[{$ref:"#/definitions/docs.PostHogConfig"},{type:"null"}]},gtm:{oneOf:[{$ref:"#/definitions/docs.GTMConfig"},{type:"null"}]},ga4:{oneOf:[{$ref:"#/definitions/docs.GoogleAnalytics4Config"},{type:"null"}]}},additionalProperties:!1},"docs.AnnouncementConfig":{type:"object",properties:{message:{type:"string"}},required:["message"],additionalProperties:!1},"docs.RoleId":{type:"string"},"docs.Role":{anyOf:[{$ref:"#/definitions/docs.RoleId"},{type:"array",items:{$ref:"#/definitions/docs.RoleId"}}]},"docs.FeatureFlag":{type:"object",properties:{flag:{type:"string"},"fallback-value":{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]},match:{oneOf:[{type:["string","number","boolean","object","array","null"]},{type:"null"}]}},required:["flag"],additionalProperties:!1},"docs.FeatureFlagConfiguration":{anyOf:[{type:"string",description:"The name of the feature flag, We assume that it is a boolean feature flag that needs to be evaluated to true."},{$ref:"#/definitions/docs.FeatureFlag",description:"A single feature flag with a configurable name, fallback value, and match value. Especially useful for non boolean feature flags."},{type:"array",items:{$ref:"#/definitions/docs.FeatureFlag"},description:"A list of feature flags. If any of the feature flags are satisfied, we will show all content."}]},"docs.ChangelogFolderRelativePath":{type:"string"},"docs.TabConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]},changelog:{oneOf:[{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},{type:"null"}]}},required:["display-name"],additionalProperties:!1},"docs.VersionAvailability":{type:"string",enum:["deprecated","ga","stable","beta"]},"docs.VersionConfig":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},"display-name":{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},availability:{oneOf:[{$ref:"#/definitions/docs.VersionAvailability"},{type:"null"}]}},required:["display-name","path"],additionalProperties:!1},"docs.PageConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},page:{type:"string"},path:{type:"string"},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},noindex:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["page","path"],additionalProperties:!1},"docs.SectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},path:{oneOf:[{type:"string"},{type:"null"}]},contents:{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},collapsed:{oneOf:[{type:"boolean"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]}},required:["section","contents"],additionalProperties:!1},"docs.AudienceId":{type:"string"},"docs.VersionedSnippetLanguageConfiguration":{type:"object",properties:{version:{type:"string"},package:{type:"string"}},required:["version","package"],additionalProperties:!1},"docs.SnippetLanguageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.VersionedSnippetLanguageConfiguration"}]},"docs.SnippetsConfiguration":{type:"object",properties:{python:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},typescript:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},go:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},java:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},ruby:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]},csharp:{oneOf:[{$ref:"#/definitions/docs.SnippetLanguageConfiguration"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundButtonSettings":{type:"object",properties:{href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.PlaygroundSettings":{type:"object",properties:{environments:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},button:{oneOf:[{$ref:"#/definitions/docs.PlaygroundButtonSettings"},{type:"null"}]},oauth:{oneOf:[{type:"boolean"},{type:"null"}]},"limit-websocket-messages-per-connection":{oneOf:[{type:"integer"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfigurationWithOptions":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},title:{oneOf:[{type:"string"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},additionalProperties:!1},"docs.ApiReferencePackageConfiguration":{anyOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{$ref:"#/definitions/docs.ApiReferencePackageConfigurationWithOptions"}]},"docs.ApiReferenceSectionConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},section:{type:"string"},"referenced-packages":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},contents:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["section"],additionalProperties:!1},"docs.ApiReferenceEndpointConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},endpoint:{type:"string"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["endpoint"],additionalProperties:!1},"docs.LinkConfiguration":{type:"object",properties:{link:{type:"string"},href:{type:"string"},icon:{oneOf:[{type:"string"},{type:"null"}]}},required:["link","href"],additionalProperties:!1},"docs.ApiReferenceLayoutItem":{anyOf:[{type:"string",description:"This should be either an endpoint, websocket, webhook, or subpackage ID"},{type:"object",additionalProperties:{$ref:"#/definitions/docs.ApiReferencePackageConfiguration"},description:"Keyed by subpackage name, this object allows you to group endpoints and pages together."},{$ref:"#/definitions/docs.ApiReferenceSectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceEndpointConfiguration"},{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"}]},"docs.ApiReferenceConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},api:{type:"string"},"api-name":{oneOf:[{type:"string"},{type:"null"}]},openrpc:{oneOf:[{type:"string"},{type:"null"}]},audiences:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.AudienceId"}},{type:"null"}]},"display-errors":{oneOf:[{type:"boolean"},{type:"null"}]},snippets:{oneOf:[{$ref:"#/definitions/docs.SnippetsConfiguration"},{type:"null"}]},summary:{oneOf:[{type:"string"},{type:"null"}]},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.ApiReferenceLayoutItem"}},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]},"skip-slug":{oneOf:[{type:"boolean"},{type:"null"}]},alphabetized:{oneOf:[{type:"boolean"},{type:"null"}]},flattened:{oneOf:[{type:"boolean"},{type:"null"}]},paginated:{oneOf:[{type:"boolean"},{type:"null"}]},playground:{oneOf:[{$ref:"#/definitions/docs.PlaygroundSettings"},{type:"null"}]}},required:["api"],additionalProperties:!1},"docs.ChangelogConfiguration":{type:"object",properties:{viewers:{oneOf:[{$ref:"#/definitions/docs.Role"},{type:"null"}]},orphaned:{oneOf:[{type:"boolean"},{type:"null"}]},"feature-flag":{oneOf:[{$ref:"#/definitions/docs.FeatureFlagConfiguration"},{type:"null"}]},changelog:{$ref:"#/definitions/docs.ChangelogFolderRelativePath"},title:{oneOf:[{type:"string"},{type:"null"}]},slug:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},hidden:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["changelog"],additionalProperties:!1},"docs.NavigationItem":{anyOf:[{$ref:"#/definitions/docs.PageConfiguration"},{$ref:"#/definitions/docs.SectionConfiguration"},{$ref:"#/definitions/docs.ApiReferenceConfiguration"},{$ref:"#/definitions/docs.LinkConfiguration"},{$ref:"#/definitions/docs.ChangelogConfiguration"}]},"docs.UntabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},"docs.TabId":{type:"string"},"docs.TabbedNavigationItem":{type:"object",properties:{tab:{$ref:"#/definitions/docs.TabId"},layout:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.NavigationItem"}},{type:"null"}]}},required:["tab"],additionalProperties:!1},"docs.TabbedNavigationConfig":{type:"array",items:{$ref:"#/definitions/docs.TabbedNavigationItem"}},"docs.NavigationConfig":{anyOf:[{$ref:"#/definitions/docs.UntabbedNavigationConfig"},{$ref:"#/definitions/docs.TabbedNavigationConfig"}]},"docs.NavbarGithubConfig":{type:"string"},"docs.NavbarLink":{type:"object",properties:{type:{type:"string",enum:["filled","outlined","minimal","github","primary","secondary"]}},required:["type"],oneOf:[{properties:{type:{const:"filled"},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"outlined"},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"minimal"},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"github"},value:{$ref:"#/definitions/docs.NavbarGithubConfig"}},required:["type"]},{properties:{type:{const:"primary"},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]},{properties:{type:{const:"secondary"},href:{oneOf:[{type:"string"},{type:"null"}]},url:{oneOf:[{type:"string"},{type:"null"}]},text:{oneOf:[{type:"string"},{type:"null"}]},icon:{oneOf:[{type:"string"},{type:"null"}]},rightIcon:{oneOf:[{type:"string"},{type:"null"}]},rounded:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["type"]}]},"docs.FooterLinksConfig":{type:"object",properties:{github:{oneOf:[{type:"string"},{type:"null"}]},twitter:{oneOf:[{type:"string"},{type:"null"}]},x:{oneOf:[{type:"string"},{type:"null"}]},linkedin:{oneOf:[{type:"string"},{type:"null"}]},youtube:{oneOf:[{type:"string"},{type:"null"}]},instagram:{oneOf:[{type:"string"},{type:"null"}]},facebook:{oneOf:[{type:"string"},{type:"null"}]},discord:{oneOf:[{type:"string"},{type:"null"}]},slack:{oneOf:[{type:"string"},{type:"null"}]},hackernews:{oneOf:[{type:"string"},{type:"null"}]},medium:{oneOf:[{type:"string"},{type:"null"}]},website:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.ExperimentalConfig":{type:"object",properties:{"mdx-components":{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"disable-stream-toggle":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v2":{oneOf:[{type:"boolean"},{type:"null"}]},"openapi-parser-v3":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.ProgrammingLanguage":{type:"string",enum:["typescript","javascript","python","java","go","ruby","csharp","nodets","nodejs","dotnet","curl","jvm","ts","js"]},"docs.AIChatModel":{type:"string",enum:["claude-3.5","claude-3.7","command-a"]},"docs.AIChatConfig":{type:"object",properties:{model:{oneOf:[{$ref:"#/definitions/docs.AIChatModel"},{type:"null"}]},"system-prompt":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.TwitterCardSetting":{type:"string",enum:["summary","summary_large_image","app","player"]},"docs.MetadataConfig":{type:"object",properties:{"og:site_name":{oneOf:[{type:"string"},{type:"null"}]},"og:title":{oneOf:[{type:"string"},{type:"null"}]},"og:description":{oneOf:[{type:"string"},{type:"null"}]},"og:url":{oneOf:[{type:"string"},{type:"null"}]},"og:image":{oneOf:[{type:"string"},{type:"null"}]},"og:image:width":{oneOf:[{type:"number"},{type:"null"}]},"og:image:height":{oneOf:[{type:"number"},{type:"null"}]},"og:locale":{oneOf:[{type:"string"},{type:"null"}]},"og:logo":{oneOf:[{type:"string"},{type:"null"}]},"twitter:title":{oneOf:[{type:"string"},{type:"null"}]},"twitter:description":{oneOf:[{type:"string"},{type:"null"}]},"twitter:handle":{oneOf:[{type:"string"},{type:"null"}]},"twitter:image":{oneOf:[{type:"string"},{type:"null"}]},"twitter:site":{oneOf:[{type:"string"},{type:"null"}]},"twitter:url":{oneOf:[{type:"string"},{type:"null"}]},"twitter:card":{oneOf:[{$ref:"#/definitions/docs.TwitterCardSetting"},{type:"null"}]}},additionalProperties:!1},"docs.RedirectConfig":{type:"object",properties:{source:{type:"string"},destination:{type:"string"},permanent:{oneOf:[{type:"boolean"},{type:"null"}]}},required:["source","destination"],additionalProperties:!1},"docs.LogoConfiguration":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]},height:{oneOf:[{type:"number"},{type:"null"}]},href:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.BackgroundImageConfiguration":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.BackgroundImageThemedConfig"}]},"docs.ColorThemedConfig":{type:"object",properties:{dark:{oneOf:[{type:"string"},{type:"null"}]},light:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.ColorConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.ColorThemedConfig"}]},"docs.ColorsConfiguration":{type:"object",properties:{"accent-primary":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},accentPrimary:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},background:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},border:{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"sidebar-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"header-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]},"card-background":{oneOf:[{$ref:"#/definitions/docs.ColorConfig"},{type:"null"}]}},additionalProperties:!1},"docs.FontWeight":{anyOf:[{type:"string"},{type:"integer"}]},"docs.FontStyle":{type:"string",enum:["normal","italic"]},"docs.FontConfigVariant":{type:"object",properties:{path:{type:"string"},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.FontConfigPath":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.FontConfigVariant"}]},"docs.FontDisplay":{type:"string",enum:["auto","block","swap","fallback","optional"]},"docs.FontConfig":{type:"object",properties:{name:{oneOf:[{type:"string"},{type:"null"}]},path:{oneOf:[{type:"string"},{type:"null"}]},weight:{oneOf:[{$ref:"#/definitions/docs.FontWeight"},{type:"null"}]},style:{oneOf:[{$ref:"#/definitions/docs.FontStyle"},{type:"null"}]},paths:{oneOf:[{type:"array",items:{$ref:"#/definitions/docs.FontConfigPath"}},{type:"null"}]},display:{oneOf:[{$ref:"#/definitions/docs.FontDisplay"},{type:"null"}]},fallback:{oneOf:[{type:"array",items:{type:"string"}},{type:"null"}]},"font-variation-settings":{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.DocsTypographyConfig":{type:"object",properties:{headingsFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},bodyFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]},codeFont:{oneOf:[{$ref:"#/definitions/docs.FontConfig"},{type:"null"}]}},additionalProperties:!1},"docs.SearchbarPlacement":{type:"string",enum:["header","header-tabs","sidebar"]},"docs.TabsPlacement":{type:"string",enum:["header","sidebar"]},"docs.ContentAlignment":{type:"string",enum:["center","left"]},"docs.HeaderPosition":{type:"string",enum:["fixed","static"]},"docs.LayoutConfig":{type:"object",properties:{"page-width":{oneOf:[{type:"string"},{type:"null"}]},"content-width":{oneOf:[{type:"string"},{type:"null"}]},"sidebar-width":{oneOf:[{type:"string"},{type:"null"}]},"header-height":{oneOf:[{type:"string"},{type:"null"}]},"searchbar-placement":{oneOf:[{$ref:"#/definitions/docs.SearchbarPlacement"},{type:"null"}]},"tabs-placement":{oneOf:[{$ref:"#/definitions/docs.TabsPlacement"},{type:"null"}]},"content-alignment":{oneOf:[{$ref:"#/definitions/docs.ContentAlignment"},{type:"null"}]},"header-position":{oneOf:[{$ref:"#/definitions/docs.HeaderPosition"},{type:"null"}]},"disable-header":{oneOf:[{type:"boolean"},{type:"null"}]}},additionalProperties:!1},"docs.IntegrationsConfig":{type:"object",properties:{intercom:{oneOf:[{type:"string"},{type:"null"}]}},additionalProperties:!1},"docs.CssConfig":{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}]},"docs.JsScriptStrategy":{type:"string",enum:["beforeInteractive","afterInteractive","lazyOnload"]},"docs.JsRemoteConfig":{type:"object",properties:{url:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["url"],additionalProperties:!1},"docs.JsFileConfigSettings":{type:"object",properties:{path:{type:"string"},strategy:{oneOf:[{$ref:"#/definitions/docs.JsScriptStrategy"},{type:"null"}]}},required:["path"],additionalProperties:!1},"docs.JsFileConfig":{anyOf:[{type:"string"},{$ref:"#/definitions/docs.JsFileConfigSettings"}]},"docs.JsConfigOptions":{anyOf:[{$ref:"#/definitions/docs.JsRemoteConfig"},{$ref:"#/definitions/docs.JsFileConfig"}]},"docs.JsConfig":{anyOf:[{$ref:"#/definitions/docs.JsConfigOptions"},{type:"array",items:{$ref:"#/definitions/docs.JsConfigOptions"}}]}},vaE={type:daE,properties:paE,required:_aE,additionalProperties:haE,definitions:yaE};async function rZs({fernDirectory:e,context:t}){let r=es(e,uo.of(e8t));if(!await Bf(r))return;let i=await baE({absolutePathToDocsDefinition:e,context:t});if(i!=null)return{type:"docs",absoluteFilePath:e,config:i,workspaceName:void 0,absoluteFilepathToDocsConfig:es(e,uo.of(e8t))}}async function baE({absolutePathToDocsDefinition:e,context:t}){if(!await Bf(e))return;let r=es(e,uo.of(e8t));return await gaE({absolutePathOfConfiguration:r,context:t})}async function gaE({absolutePathOfConfiguration:e,context:t}){let r=await(0,Wt_.readFile)(e),i=Yd.load(r.toString()),n=aQr(i,tZs);if(n.success)return i8t.RawSchemas.Serializer.DocsConfiguration.parseOrThrow(i);throw new Error(`Failed to parse docs.yml because of ${n.error?.message??"Unknown error"}`)}async function iZs({context:e,nameOverride:t,...r}){let i=await f8t(t);return i==null?e.failAndThrow(`Directory "${t??xU}" not found.`):await $t_({absolutePathToFernDirectory:i,context:e,nameOverride:t,...r})}async function $t_({absolutePathToFernDirectory:e,cliName:t,cliVersion:r,commandLineApiWorkspace:i,defaultToAllApiWorkspaces:n,context:a}){let u=[];return(await Bf(es(e,uo.of(Vui)))||await Bf(es(e,uo.of(e5)))||await Bf(es(e,uo.of(JN)))||await Bf(es(e,uo.of(WZa)))||await Bf(es(e,uo.of($Hf))))&&(u=await Gt_({cliName:t,fernDirectory:e,cliVersion:r,context:a,commandLineApiWorkspace:i,defaultToAllApiWorkspaces:n})),{config:await CQr({directory:e,context:a}),apiWorkspaces:u,docsWorkspaces:await rZs({fernDirectory:e,context:a}),loadAPIWorkspace:l=>l==null?u[0]:u.find(d=>d.workspaceName===l)}}async function Gt_({cliName:e,fernDirectory:t,context:r,cliVersion:i,commandLineApiWorkspace:n,defaultToAllApiWorkspaces:a}){let u=es(t,uo.of(Vui));if(await Bf(u)){let o=(await(0,Ht_.readdir)(u,{withFileTypes:!0})).reduce((g,O)=>(O.isDirectory()&&g.push(O.name),g),[]);if(n!=null){if(!o.includes(n))return r.failAndThrow("API does not exist: "+n)}else{if(o.length===0)return r.failAndThrow("No APIs found.");if(o.length>1&&!a){let g=`There are multiple workspaces. You must specify one with --api:
|
|
1960
1960
|
`,O=Math.max(...o.map(m=>m.length));return g+=o.map(m=>{let P=`${e} ${process.argv.slice(2).join(" ")} --api ${m}`;return` \u203A ${Js.bold(m.padEnd(O))} ${Js.dim(P)}`}).join(`
|