fern-api 0.51.27 → 0.51.28
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
|
@@ -1684,7 +1684,7 @@ ${c.indent}`:""}${Zmf(o)}:${l.indent?" ":""}`;return u=!1,s=!0,l.objectItem=void
|
|
|
1684
1684
|
`}),r.replaceAll(/\n$/g,"")}function i31(e){return e?Su.green(r3.radioOn):r3.radioOff}var Uio=Di(dwe(),1);function Lxd(e,t){return e=String(e),t=typeof t=="string"?t:"*",e.length===0?"":Array.from({length:e.length+1}).join(t)}var gGn=class extends r2{_run(t){this.done=t;let r=TL(this.rl),i=r.line.pipe((0,Uio.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,Uio.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=`
|
|
1685
1685
|
`+Su.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?Su.cyan(Lxd(t,this.opt.mask)):Su.italic.dim("[hidden]"):this.opt.mask?Lxd(t,this.opt.mask):Su.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 fzd=Di(Ids(),1),dzd=Di(dwe(),1);var MGn=class extends r2{_run(t){this.done=t,this.editorResult=new dzd.Subject;let r=TL(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"?Su.dim("Received"):Su.dim("Press <enter> to launch your preferred editor."),t&&(r=Su.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),(0,fzd.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 Ozd=Di(hzd(),1);var bzd=Di(require("readline"),1),gzd=Di(vzd(),1),Uji=class{constructor(t){this.rl||=bzd.default.createInterface(Q31(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 Q31(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 gzd.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var qGn=class extends Uji{constructor(t={}){super(t),this.log=(0,Ozd.default)(this.writeLog.bind(this)),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return fGn(this.rl,this.bottomBar.split(`
|
|
1686
1686
|
`).length),this}updateBottomBar(t){return fGn(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+`
|
|
1687
|
-
`}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&&Rio(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var qzd=Di(jzd(),1),Tzd=Di(Wls(),1),Czd=Di(Azd(),1),rM=Di(dwe(),1),Bzd=Di(O$n(),1);var uno=Di(dwe(),1),Mzd=Di(O$n(),1),sno=function(e,t,r){return typeof e[t]!="function"?(0,uno.of)(e):(0,uno.from)((0,Mzd.default)(e[t])(r).then(i=>(e[t]=i,e)))};var TGn={isPlainObject:qzd.default,set:Czd.default,get:Tzd.default},jun=class extends Uji{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=TGn.isPlainObject(r)?{...r}:{},TGn.isPlainObject(t)&&(t=Object.values(t).every(n=>TGn.isPlainObject(n)&&n.name===void 0)?Object.entries(t).map(([n,a])=>({name:n,...a})):[t]);let i=Array.isArray(t)?(0,rM.from)(t):t;return this.process=i.pipe((0,rM.concatMap)(this.processQuestion.bind(this)),(0,rM.publish)()),this.process.connect(),this.process.pipe((0,rM.reduce)((n,a)=>(TGn.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,rM.defer)(()=>(0,rM.of)(t).pipe((0,rM.concatMap)(this.setDefaultType.bind(this)),(0,rM.concatMap)(this.filterIfRunnable.bind(this)),(0,rM.concatMap)(()=>sno(t,"message",this.answers)),(0,rM.concatMap)(()=>sno(t,"default",this.answers)),(0,rM.concatMap)(()=>sno(t,"choices",this.answers)),(0,rM.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,rM.defer)(()=>(0,rM.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,rM.defer)(()=>(0,rM.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&TGn.get(this.answers,t.name)!==void 0)return(0,rM.empty)();if(t.when===!1)return(0,rM.empty)();if(typeof t.when!="function")return(0,rM.of)(t);let{answers:r}=this;return(0,rM.defer)(()=>(0,rM.from)((0,Bzd.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,rM.filter)(i=>i!=null)))}};function xzd(e){let t=function(r,i){let n;try{n=new jun(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",pGn),this.registerPrompt("input",Bji),this.registerPrompt("number",_Gn),this.registerPrompt("confirm",hGn),this.registerPrompt("rawlist",yGn),this.registerPrompt("expand",vGn),this.registerPrompt("checkbox",bGn),this.registerPrompt("password",gGn),this.registerPrompt("editor",MGn)},t.restoreDefaultPrompts(),t}var Fds=xzd();function f71(e,t){Fds.registerPrompt(e,t)}function d71(){Fds.restoreDefaultPrompts()}var p71={prompt:Fds,ui:{BottomBar:qGn,Prompt:jun},createPromptModule:xzd,registerPrompt:f71,restoreDefaultPrompts:d71,Separator:yte},cno=p71;var HRd=Di(Izd()),R61="4.2.1",n2t;(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"})(n2t||(n2t={}));function F61(e,t){if(!e)throw new Error(t)}function N61(e){return e?.replace(/\/+$/,"")}async function L61(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 U61(){return new Date().getTime()}function zRd(){return new Date().toISOString()}function $Rd(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var WGn=String.fromCharCode,RRd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Pno={};function V61(e,t){if(!Pno[e]){Pno[e]={};for(let r=0;r<e.length;r++)Pno[e][e.charAt(r)]=r}return Pno[e][t]}var HGn={compressToBase64:function(e){if(e==null)return"";let t=HGn._compress(e,6,function(r){return RRd.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:HGn._decompress(e.length,32,function(t){return V61(RRd,e.charAt(t))})},compress:function(e){return HGn._compress(e,16,function(t){return WGn(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,l,f="",s="",o="",c=2,b=3,g=2,O=0,m=0,w;for(w=0;w<e.length;w+=1)if(f=e.charAt(w),Object.prototype.hasOwnProperty.call(i,f)||(i[f]=b++,n[f]=!0),s=o+f,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(f)}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:HGn._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,f=3,s="",o,c,b,g,O,m,w;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;w=WGn(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;w=WGn(b);break;case 2:return""}for(i[3]=w,c=w,n.push(w);;){if(a.index>e)return"";for(b=0,O=Math.pow(2,f),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(w=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++]=WGn(b),w=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++]=WGn(b),w=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,f),f++),i[w])s=i[w];else if(w===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,f),f++)}}},wps=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 jno="0123456789abcdef",wno=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+=jno.charAt(this.bytes[r]>>>4),t+=jno.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+=jno.charAt(this.bytes[r]>>>4),t+=jno.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}},Sps=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??W61()}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 wno.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,wno.ofInner(t)}},W61=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),FRd,NRd=()=>H61().toString(),H61=()=>(FRd||(FRd=new Sps)).generate(),Sno=class extends Error{constructor(t){super("HTTP error while fetching PostHog: "+t.status),this.response=t,this.name="PostHogFetchHttpError"}},$Gn=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};function LRd(e){return typeof e=="object"&&(e instanceof Sno||e instanceof $Gn)}var Dps=class{constructor(t,r){this.flushPromise=null,this.disableGeoip=!0,this.historicalMigration=!1,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new wps,this._isInitialized=!1,F61(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=N61(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:LRd},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(n2t.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(n2t.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(n2t.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=NRd();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(f=>f.json()).catch(f=>{this._events.emit("error",f)})}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 f=l[t];return f===void 0&&(f=!1),f}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 f=l[t];return f===void 0?null:f}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),f=l?.featureFlags,s=l?.featureFlagPayloads,o=s;return s&&(o=Object.fromEntries(Object.entries(s).map(([c,b])=>[c,this._parsePayload(b)]))),{flags:f,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:zRd(),uuid:i?.uuid?i.uuid:NRd()};(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(n2t.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(n2t.Queue,u),this._events.emit(t,n),u.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=$Rd(()=>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(n2t.Queue)||[];if(!t.length)return[];let r=t.slice(0,this.maxBatchSize),i=r.map(s=>s.message),n=()=>{let s=this.getPersistedProperty(n2t.Queue)||[];this.setPersistedProperty(n2t.Queue,s.slice(r.length))},a={api_key:this.apiKey,batch:i,sent_at:zRd()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),l=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${U61()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,f=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(HGn.compressToBase64(u))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:u};try{await this.fetchWithRetry(l,f)}catch(s){throw s instanceof $Gn||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 f=new AbortController;return setTimeout(()=>f.abort(),l),f.signal}),await L61(async()=>{let u=null;try{u=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(f){throw new $Gn(f)}if(!(r.mode==="no-cors")&&(u.status<200||u.status>=400))throw new Sno(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(n2t.Queue)||[]).length!==0;){await this.flush();let n=Date.now();if(r<n)break}}catch(r){if(!LRd(r))throw r;this.logMsgIfDebug(()=>console.error("Error while shutting down PostHog",r))}}},Eps=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},Aps=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!Aps){let e=IRd();Aps=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 GRd=Aps,$61=1152921504606847e3,G61=["is_not"],Dno=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},i2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Mps=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||GRd,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 f of this.featureFlags)if(t===f.key){l=f;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(f){f instanceof i2?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${f}`)):f instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${f}`))}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 f=>{try{let s=this.computeFlagLocally(f,t,r,i,n);a[f.key]=s;let o=await this.computeFeatureFlagPayloadLocally(f.key,s);o&&(u[f.key]=o)}catch(s){s instanceof i2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${f.key}: ${s}`)),l=!0}}),{response:a,payloads:u,fallbackToDecide:l}}computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new i2("Flag has experience continuity enabled");if(!t.active)return!1;let l=(t.filters||{}).aggregation_group_type_index;if(l!=null){let f=this.groupTypeMapping[String(l)];if(!f)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${l} for feature flag ${t.key}`)),new i2("Flag has unknown group type index");if(!(f 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[f];return this.matchFeatureFlagProperties(t,i[f],s)}else return this.matchFeatureFlagProperties(t,r,n)}matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,l,f=[...a].sort((s,o)=>{let c=!!s.variant,b=!!o.variant;return c&&b?0:c?-1:b?1:0});for(let s of f)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 i2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new i2("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 f=l.type,s=!1;if(f==="cohort"?s=JRd(l,n,this.cohorts,this.debugMode):s=QRd(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&URd(t.key,r)>a/100)}getMatchingVariant(t,r){let i=URd(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 Dno("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 Dno&&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=$Rd(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function URd(e,t,r=""){let i=(0,HRd.createHash)();return i.update(`${e}.${t}${r}`),parseInt(i.digest("hex").slice(0,15),16)/$61}function QRd(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 i2("Operator is_not_set is not supported")}else throw new i2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!G61.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 f(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 VRd(String(n))&&String(u).match(String(n))!==null;case"not_regex":return VRd(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"?f(u,String(n),a):f(u,s,a):f(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=Q61(String(n));if(s==null&&(s=WRd(n)),s==null)throw new i2(`Invalid date: ${n}`);let o=WRd(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new i2(`Unknown operator: ${a}`)}}function JRd(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new i2("can't match cohort without a given cohort property value");let a=r[n];return KRd(a,t,r,i)}function KRd(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 f=KRd(l,t,r,i);if(n==="AND"){if(!f)return!1}else if(f)return!0}catch(f){if(f instanceof i2)i&&console.debug(`Failed to compute property ${l} locally: ${f}`),u=!0;else throw f}if(u)throw new i2("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let l of a)try{let f;l.type==="cohort"?f=JRd(l,t,r,i):f=QRd(l,t);let s=l.negation||!1;if(n==="AND"){if(!f&&!s||f&&s)return!1}else if(f&&!s||!f&&s)return!0}catch(f){if(f instanceof i2)i&&console.debug(`Failed to compute property ${l} locally: ${f}`),u=!0;else throw f}if(u)throw new i2("can't match cohort without a given cohort property value");return n==="AND"}}function VRd(e){try{return new RegExp(e),!0}catch{return!1}}function WRd(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 i2(`${e} is in an invalid date format`)}else throw new i2(`The date provided ${e} must be a string, number, or date object`)}function Q61(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 J61=30*1e3,K61=50*1e3,qun=class extends Dps{constructor(t,r={}){super(t,r),this._memoryStorage=new Eps,this.options=r,r.personalApiKey&&(this.featureFlagsPoller=new Mps({pollingInterval:typeof r.featureFlagsPollingInterval=="number"?r.featureFlagsPollingInterval:J61,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||K61}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):GRd(t,r)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return R61}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:f}){let s=b=>{super.captureStateless(t,r,b,{timestamp:u,disableGeoip:l,uuid:f})},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,w]of Object.entries(b))g[`$feature/${m}`]=w;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:f,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,f,s);f=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),l==null&&(l=!0);let c=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,f,s),b=c!==void 0;!b&&!u&&(c=await super.getFeatureFlagStateless(t,r,n,f,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:f,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),f==null&&(f=!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||{},f=this.addLocalPersonAndGroupProperties(t,i,u,l);u=f.allPersonProperties,l=f.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}}},qps=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})}};qps.POSTHOG_ID_TAG="posthog_distinct_id";var Eno=class{posthog;constructor({posthogApiKey:t}){this.posthog=new qun(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.51.27",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var GGn=class{async sendEvent(){}async identify(){}async flush(){}};var Tun=require("fs/promises"),kRd=require("os"),eFd=require("path");var YRd=Di(require("crypto")),Mno=new Uint8Array(256),Ano=Mno.length;function Tps(){return Ano>Mno.length-16&&(YRd.default.randomFillSync(Mno),Ano=0),Mno.slice(Ano,Ano+=16)}var xL=[];for(let e=0;e<256;++e)xL.push((e+256).toString(16).slice(1));function XRd(e,t=0){return xL[e[t+0]]+xL[e[t+1]]+xL[e[t+2]]+xL[e[t+3]]+"-"+xL[e[t+4]]+xL[e[t+5]]+"-"+xL[e[t+6]]+xL[e[t+7]]+"-"+xL[e[t+8]]+xL[e[t+9]]+"-"+xL[e[t+10]]+xL[e[t+11]]+xL[e[t+12]]+xL[e[t+13]]+xL[e[t+14]]+xL[e[t+15]]}var ZRd=Di(require("crypto")),Cps={randomUUID:ZRd.default.randomUUID};function Y61(e,t,r){if(Cps.randomUUID&&!t&&!e)return Cps.randomUUID();e=e||{};let i=e.random||(e.rng||Tps)();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 XRd(i)}var ZCe=Y61;var X61="id",Z61=".fern",QGn=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new qun(r),this.userId=t==null?void 0:Yas(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.51.27",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=ku(Kl.of((0,kRd.homedir)()),yo.of(Z61),yo.of(X61));await zf(t)||(await(0,Tun.mkdir)((0,eFd.dirname)(t),{recursive:!0}),await(0,Tun.writeFile)(t,ZCe())),this.persistedDistinctId=(await(0,Tun.readFile)(t)).toString()}return this.persistedDistinctId}};var Bps;async function Cun(){return Bps==null&&(Bps=await k61()),Bps}async function k61(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new GGn;let r=await LXa();return r!=null?new QGn({token:r,posthogApiKey:e}):await NXa()!=null?new Eno({posthogApiKey:e}):new QGn({token:void 0,posthogApiKey:e})}catch{return new GGn}}function JGn(e,t){return function(){return e.apply(t,arguments)}}var{toString:e41}=Object.prototype,{getPrototypeOf:zps}=Object,Tno=(e=>t=>{let r=e41.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),a2t=e=>(e=e.toLowerCase(),t=>Tno(t)===e),Cno=e=>t=>typeof t===e,{isArray:xun}=Array,KGn=Cno("undefined");function t41(e){return e!==null&&!KGn(e)&&e.constructor!==null&&!KGn(e.constructor)&&_we(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var iFd=a2t("ArrayBuffer");function r41(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&iFd(e.buffer),t}var i41=Cno("string"),_we=Cno("function"),nFd=Cno("number"),Bno=e=>e!==null&&typeof e=="object",n41=e=>e===!0||e===!1,qno=e=>{if(Tno(e)!=="object")return!1;let t=zps(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},a41=a2t("Date"),o41=a2t("File"),u41=a2t("Blob"),s41=a2t("FileList"),c41=e=>Bno(e)&&_we(e.pipe),l41=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||_we(e.append)&&((t=Tno(e))==="formdata"||t==="object"&&_we(e.toString)&&e.toString()==="[object FormData]"))},f41=a2t("URLSearchParams"),[d41,p41,_41,h41]=["ReadableStream","Request","Response","Headers"].map(a2t),y41=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function YGn(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),xun(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 aFd(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 $ji=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,oFd=e=>!KGn(e)&&e!==$ji;function Ips(){let{caseless:e}=oFd(this)&&this||{},t={},r=(i,n)=>{let a=e&&aFd(t,n)||n;qno(t[a])&&qno(i)?t[a]=Ips(t[a],i):qno(i)?t[a]=Ips({},i):xun(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&YGn(arguments[i],r);return t}var v41=(e,t,r,{allOwnKeys:i}={})=>(YGn(t,(n,a)=>{r&&_we(n)?e[a]=JGn(n,r):e[a]=n},{allOwnKeys:i}),e),b41=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),g41=(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)},O41=(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&&zps(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},m41=(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},P41=e=>{if(!e)return null;if(xun(e))return e;let t=e.length;if(!nFd(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},j41=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&zps(Uint8Array)),w41=(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])}},S41=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},D41=a2t("HTMLFormElement"),E41=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),tFd=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),A41=a2t("RegExp"),uFd=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};YGn(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},M41=e=>{uFd(e,(t,r)=>{if(_we(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(_we(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+"'")})}})},q41=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return xun(e)?i(e):i(String(e).split(t)),r},T41=()=>{},C41=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,xps="abcdefghijklmnopqrstuvwxyz",rFd="0123456789",sFd={DIGIT:rFd,ALPHA:xps,ALPHA_DIGIT:xps+xps.toUpperCase()+rFd},B41=(e=16,t=sFd.ALPHA_DIGIT)=>{let r="",{length:i}=t;for(;e--;)r+=t[Math.random()*i|0];return r};function x41(e){return!!(e&&_we(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var I41=e=>{let t=new Array(10),r=(i,n)=>{if(Bno(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=xun(i)?[]:{};return YGn(i,(u,l)=>{let f=r(u,n+1);!KGn(f)&&(a[l]=f)}),t[n]=void 0,a}}return i};return r(e,0)},z41=a2t("AsyncFunction"),R41=e=>e&&(Bno(e)||_we(e))&&_we(e.then)&&_we(e.catch),cFd=((e,t)=>e?setImmediate:t?((r,i)=>($ji.addEventListener("message",({source:n,data:a})=>{n===$ji&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),$ji.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",_we($ji.postMessage)),F41=typeof queueMicrotask<"u"?queueMicrotask.bind($ji):typeof process<"u"&&process.nextTick||cFd,os={isArray:xun,isArrayBuffer:iFd,isBuffer:t41,isFormData:l41,isArrayBufferView:r41,isString:i41,isNumber:nFd,isBoolean:n41,isObject:Bno,isPlainObject:qno,isReadableStream:d41,isRequest:p41,isResponse:_41,isHeaders:h41,isUndefined:KGn,isDate:a41,isFile:o41,isBlob:u41,isRegExp:A41,isFunction:_we,isStream:c41,isURLSearchParams:f41,isTypedArray:j41,isFileList:s41,forEach:YGn,merge:Ips,extend:v41,trim:y41,stripBOM:b41,inherits:g41,toFlatObject:O41,kindOf:Tno,kindOfTest:a2t,endsWith:m41,toArray:P41,forEachEntry:w41,matchAll:S41,isHTMLForm:D41,hasOwnProperty:tFd,hasOwnProp:tFd,reduceDescriptors:uFd,freezeMethods:M41,toObjectSet:q41,toCamelCase:E41,noop:T41,toFiniteNumber:C41,findKey:aFd,global:$ji,isContextDefined:oFd,ALPHABET:sFd,generateString:B41,isSpecCompliantForm:x41,toJSONObject:I41,isAsyncFn:z41,isThenable:R41,setImmediate:cFd,asap:F41};function Iun(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)}os.inherits(Iun,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:os.toJSONObject(this.config),code:this.code,status:this.status}}});var lFd=Iun.prototype,fFd={};["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=>{fFd[e]={value:e}});Object.defineProperties(Iun,fFd);Object.defineProperty(lFd,"isAxiosError",{value:!0});Iun.from=(e,t,r,i,n,a)=>{let u=Object.create(lFd);return os.toFlatObject(e,u,function(f){return f!==Error.prototype},l=>l!=="isAxiosError"),Iun.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var yp=Iun;var dFd=Di(CLn(),1),xno=dFd.default;function Rps(e){return os.isPlainObject(e)||os.isArray(e)}function _Fd(e){return os.endsWith(e,"[]")?e.slice(0,-2):e}function pFd(e,t,r){return e?e.concat(t).map(function(n,a){return n=_Fd(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function N41(e){return os.isArray(e)&&!e.some(Rps)}var L41=os.toFlatObject(os,{},null,function(t){return/^is[A-Z]/.test(t)});function U41(e,t,r){if(!os.isObject(e))throw new TypeError("target must be an object");t=t||new(xno||FormData),r=os.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!os.isUndefined(w[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&os.isSpecCompliantForm(t);if(!os.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(os.isDate(O))return O.toISOString();if(!f&&os.isBlob(O))throw new yp("Blob is not supported. Use a Buffer instead.");return os.isArrayBuffer(O)||os.isTypedArray(O)?f&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,w){let A=O;if(O&&!w&&typeof O=="object"){if(os.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(os.isArray(O)&&N41(O)||(os.isFileList(O)||os.endsWith(m,"[]"))&&(A=os.toArray(O)))return m=_Fd(m),A.forEach(function(q,D){!(os.isUndefined(q)||q===null)&&t.append(u===!0?pFd([m],D,a):u===null?m:m+"[]",s(q))}),!1}return Rps(O)?!0:(t.append(pFd(w,m,a),s(O)),!1)}let c=[],b=Object.assign(L41,{defaultVisitor:o,convertValue:s,isVisitable:Rps});function g(O,m){if(!os.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),os.forEach(O,function(A,M){(!(os.isUndefined(A)||A===null)&&n.call(t,A,os.isString(M)?M.trim():M,m,b))===!0&&g(A,m?m.concat(M):[M])}),c.pop()}}if(!os.isObject(e))throw new TypeError("data must be an object");return g(e),t}var tkr=U41;function hFd(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function yFd(e,t){this._pairs=[],e&&tkr(e,this,t)}var vFd=yFd.prototype;vFd.append=function(t,r){this._pairs.push([t,r])};vFd.toString=function(t){let r=t?function(i){return t.call(this,i,hFd)}:hFd;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var bFd=yFd;function V41(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Gji(e,t,r){if(!t)return e;let i=r&&r.encode||V41,n=r&&r.serialize,a;if(n?a=n(t,r):a=os.isURLSearchParams(t)?t.toString():new bFd(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var Fps=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){os.forEach(this.handlers,function(i){i!==null&&t(i)})}},Nps=Fps;var zun={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var gFd=Di(require("url"),1),OFd=gFd.default.URLSearchParams;var mFd={isNode:!0,classes:{URLSearchParams:OFd,FormData:xno,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]};var Vps={};Ro(Vps,{hasBrowserEnv:()=>Ups,hasStandardBrowserEnv:()=>W41,hasStandardBrowserWebWorkerEnv:()=>H41,navigator:()=>Lps,origin:()=>$41});var Ups=typeof window<"u"&&typeof document<"u",Lps=typeof navigator=="object"&&navigator||void 0,W41=Ups&&(!Lps||["ReactNative","NativeScript","NS"].indexOf(Lps.product)<0),H41=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",$41=Ups&&window.location.href||"http://localhost";var sT={...Vps,...mFd};function Wps(e,t){return tkr(e,new sT.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return sT.isNode&&os.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function G41(e){return os.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Q41(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 J41(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),f=a>=r.length;return u=!u&&os.isArray(n)?n.length:u,f?(os.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!os.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&os.isArray(n[u])&&(n[u]=Q41(n[u])),!l)}if(os.isFormData(e)&&os.isFunction(e.entries)){let r={};return os.forEachEntry(e,(i,n)=>{t(G41(i),n,r,0)}),r}return null}var Ino=J41;function K41(e,t,r){if(os.isString(e))try{return(t||JSON.parse)(e),os.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var Hps={transitional:zun,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=os.isObject(t);if(a&&os.isHTMLForm(t)&&(t=new FormData(t)),os.isFormData(t))return n?JSON.stringify(Ino(t)):t;if(os.isArrayBuffer(t)||os.isBuffer(t)||os.isStream(t)||os.isFile(t)||os.isBlob(t)||os.isReadableStream(t))return t;if(os.isArrayBufferView(t))return t.buffer;if(os.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 Wps(t,this.formSerializer).toString();if((l=os.isFileList(t))||i.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return tkr(l?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),K41(t)):t}],transformResponse:[function(t){let r=this.transitional||Hps.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(os.isResponse(t)||os.isReadableStream(t))return t;if(t&&os.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"?yp.from(l,yp.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:sT.classes.FormData,Blob:sT.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};os.forEach(["delete","get","head","post","put","patch"],e=>{Hps.headers[e]={}});var Run=Hps;var Y41=os.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"]),PFd=e=>{let t={},r,i,n;return e&&e.split(`
|
|
1687
|
+
`}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&&Rio(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var qzd=Di(jzd(),1),Tzd=Di(Wls(),1),Czd=Di(Azd(),1),rM=Di(dwe(),1),Bzd=Di(O$n(),1);var uno=Di(dwe(),1),Mzd=Di(O$n(),1),sno=function(e,t,r){return typeof e[t]!="function"?(0,uno.of)(e):(0,uno.from)((0,Mzd.default)(e[t])(r).then(i=>(e[t]=i,e)))};var TGn={isPlainObject:qzd.default,set:Czd.default,get:Tzd.default},jun=class extends Uji{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=TGn.isPlainObject(r)?{...r}:{},TGn.isPlainObject(t)&&(t=Object.values(t).every(n=>TGn.isPlainObject(n)&&n.name===void 0)?Object.entries(t).map(([n,a])=>({name:n,...a})):[t]);let i=Array.isArray(t)?(0,rM.from)(t):t;return this.process=i.pipe((0,rM.concatMap)(this.processQuestion.bind(this)),(0,rM.publish)()),this.process.connect(),this.process.pipe((0,rM.reduce)((n,a)=>(TGn.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,rM.defer)(()=>(0,rM.of)(t).pipe((0,rM.concatMap)(this.setDefaultType.bind(this)),(0,rM.concatMap)(this.filterIfRunnable.bind(this)),(0,rM.concatMap)(()=>sno(t,"message",this.answers)),(0,rM.concatMap)(()=>sno(t,"default",this.answers)),(0,rM.concatMap)(()=>sno(t,"choices",this.answers)),(0,rM.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,rM.defer)(()=>(0,rM.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,rM.defer)(()=>(0,rM.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&TGn.get(this.answers,t.name)!==void 0)return(0,rM.empty)();if(t.when===!1)return(0,rM.empty)();if(typeof t.when!="function")return(0,rM.of)(t);let{answers:r}=this;return(0,rM.defer)(()=>(0,rM.from)((0,Bzd.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,rM.filter)(i=>i!=null)))}};function xzd(e){let t=function(r,i){let n;try{n=new jun(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",pGn),this.registerPrompt("input",Bji),this.registerPrompt("number",_Gn),this.registerPrompt("confirm",hGn),this.registerPrompt("rawlist",yGn),this.registerPrompt("expand",vGn),this.registerPrompt("checkbox",bGn),this.registerPrompt("password",gGn),this.registerPrompt("editor",MGn)},t.restoreDefaultPrompts(),t}var Fds=xzd();function f71(e,t){Fds.registerPrompt(e,t)}function d71(){Fds.restoreDefaultPrompts()}var p71={prompt:Fds,ui:{BottomBar:qGn,Prompt:jun},createPromptModule:xzd,registerPrompt:f71,restoreDefaultPrompts:d71,Separator:yte},cno=p71;var HRd=Di(Izd()),R61="4.2.1",n2t;(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"})(n2t||(n2t={}));function F61(e,t){if(!e)throw new Error(t)}function N61(e){return e?.replace(/\/+$/,"")}async function L61(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 U61(){return new Date().getTime()}function zRd(){return new Date().toISOString()}function $Rd(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}var WGn=String.fromCharCode,RRd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Pno={};function V61(e,t){if(!Pno[e]){Pno[e]={};for(let r=0;r<e.length;r++)Pno[e][e.charAt(r)]=r}return Pno[e][t]}var HGn={compressToBase64:function(e){if(e==null)return"";let t=HGn._compress(e,6,function(r){return RRd.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:HGn._decompress(e.length,32,function(t){return V61(RRd,e.charAt(t))})},compress:function(e){return HGn._compress(e,16,function(t){return WGn(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,l,f="",s="",o="",c=2,b=3,g=2,O=0,m=0,w;for(w=0;w<e.length;w+=1)if(f=e.charAt(w),Object.prototype.hasOwnProperty.call(i,f)||(i[f]=b++,n[f]=!0),s=o+f,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(f)}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:HGn._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,f=3,s="",o,c,b,g,O,m,w;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;w=WGn(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;w=WGn(b);break;case 2:return""}for(i[3]=w,c=w,n.push(w);;){if(a.index>e)return"";for(b=0,O=Math.pow(2,f),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(w=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++]=WGn(b),w=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++]=WGn(b),w=l-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,f),f++),i[w])s=i[w];else if(w===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,f),f++)}}},wps=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 jno="0123456789abcdef",wno=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+=jno.charAt(this.bytes[r]>>>4),t+=jno.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+=jno.charAt(this.bytes[r]>>>4),t+=jno.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}},Sps=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??W61()}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 wno.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,wno.ofInner(t)}},W61=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),FRd,NRd=()=>H61().toString(),H61=()=>(FRd||(FRd=new Sps)).generate(),Sno=class extends Error{constructor(t){super("HTTP error while fetching PostHog: "+t.status),this.response=t,this.name="PostHogFetchHttpError"}},$Gn=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};function LRd(e){return typeof e=="object"&&(e instanceof Sno||e instanceof $Gn)}var Dps=class{constructor(t,r){this.flushPromise=null,this.disableGeoip=!0,this.historicalMigration=!1,this.disabled=!1,this.defaultOptIn=!0,this.pendingPromises={},this._events=new wps,this._isInitialized=!1,F61(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=N61(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:LRd},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(n2t.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(n2t.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(n2t.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=NRd();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(f=>f.json()).catch(f=>{this._events.emit("error",f)})}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 f=l[t];return f===void 0&&(f=!1),f}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 f=l[t];return f===void 0?null:f}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),f=l?.featureFlags,s=l?.featureFlagPayloads,o=s;return s&&(o=Object.fromEntries(Object.entries(s).map(([c,b])=>[c,this._parsePayload(b)]))),{flags:f,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:zRd(),uuid:i?.uuid?i.uuid:NRd()};(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(n2t.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(n2t.Queue,u),this._events.emit(t,n),u.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=$Rd(()=>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(n2t.Queue)||[];if(!t.length)return[];let r=t.slice(0,this.maxBatchSize),i=r.map(s=>s.message),n=()=>{let s=this.getPersistedProperty(n2t.Queue)||[];this.setPersistedProperty(n2t.Queue,s.slice(r.length))},a={api_key:this.apiKey,batch:i,sent_at:zRd()};this.historicalMigration&&(a.historical_migration=!0);let u=JSON.stringify(a),l=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${U61()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,f=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(HGn.compressToBase64(u))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:u};try{await this.fetchWithRetry(l,f)}catch(s){throw s instanceof $Gn||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 f=new AbortController;return setTimeout(()=>f.abort(),l),f.signal}),await L61(async()=>{let u=null;try{u=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(f){throw new $Gn(f)}if(!(r.mode==="no-cors")&&(u.status<200||u.status>=400))throw new Sno(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(n2t.Queue)||[]).length!==0;){await this.flush();let n=Date.now();if(r<n)break}}catch(r){if(!LRd(r))throw r;this.logMsgIfDebug(()=>console.error("Error while shutting down PostHog",r))}}},Eps=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},Aps=typeof fetch<"u"?fetch:typeof global.fetch<"u"?global.fetch:void 0;if(!Aps){let e=IRd();Aps=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 GRd=Aps,$61=1152921504606847e3,G61=["is_not"],Dno=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},i2=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Mps=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||GRd,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 f of this.featureFlags)if(t===f.key){l=f;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(f){f instanceof i2?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${f}`)):f instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${f}`))}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 f=>{try{let s=this.computeFlagLocally(f,t,r,i,n);a[f.key]=s;let o=await this.computeFeatureFlagPayloadLocally(f.key,s);o&&(u[f.key]=o)}catch(s){s instanceof i2||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${f.key}: ${s}`)),l=!0}}),{response:a,payloads:u,fallbackToDecide:l}}computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new i2("Flag has experience continuity enabled");if(!t.active)return!1;let l=(t.filters||{}).aggregation_group_type_index;if(l!=null){let f=this.groupTypeMapping[String(l)];if(!f)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${l} for feature flag ${t.key}`)),new i2("Flag has unknown group type index");if(!(f 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[f];return this.matchFeatureFlagProperties(t,i[f],s)}else return this.matchFeatureFlagProperties(t,r,n)}matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,l,f=[...a].sort((s,o)=>{let c=!!s.variant,b=!!o.variant;return c&&b?0:c?-1:b?1:0});for(let s of f)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 i2)u=!0;else throw o}if(l!==void 0)return l;if(u)throw new i2("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 f=l.type,s=!1;if(f==="cohort"?s=JRd(l,n,this.cohorts,this.debugMode):s=QRd(l,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&URd(t.key,r)>a/100)}getMatchingVariant(t,r){let i=URd(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 Dno("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 Dno&&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=$Rd(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}};function URd(e,t,r=""){let i=(0,HRd.createHash)();return i.update(`${e}.${t}${r}`),parseInt(i.digest("hex").slice(0,15),16)/$61}function QRd(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 i2("Operator is_not_set is not supported")}else throw new i2(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!G61.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 f(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 VRd(String(n))&&String(u).match(String(n))!==null;case"not_regex":return VRd(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"?f(u,String(n),a):f(u,s,a):f(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=Q61(String(n));if(s==null&&(s=WRd(n)),s==null)throw new i2(`Invalid date: ${n}`);let o=WRd(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new i2(`Unknown operator: ${a}`)}}function JRd(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new i2("can't match cohort without a given cohort property value");let a=r[n];return KRd(a,t,r,i)}function KRd(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 f=KRd(l,t,r,i);if(n==="AND"){if(!f)return!1}else if(f)return!0}catch(f){if(f instanceof i2)i&&console.debug(`Failed to compute property ${l} locally: ${f}`),u=!0;else throw f}if(u)throw new i2("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let l of a)try{let f;l.type==="cohort"?f=JRd(l,t,r,i):f=QRd(l,t);let s=l.negation||!1;if(n==="AND"){if(!f&&!s||f&&s)return!1}else if(f&&!s||!f&&s)return!0}catch(f){if(f instanceof i2)i&&console.debug(`Failed to compute property ${l} locally: ${f}`),u=!0;else throw f}if(u)throw new i2("can't match cohort without a given cohort property value");return n==="AND"}}function VRd(e){try{return new RegExp(e),!0}catch{return!1}}function WRd(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 i2(`${e} is in an invalid date format`)}else throw new i2(`The date provided ${e} must be a string, number, or date object`)}function Q61(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 J61=30*1e3,K61=50*1e3,qun=class extends Dps{constructor(t,r={}){super(t,r),this._memoryStorage=new Eps,this.options=r,r.personalApiKey&&(this.featureFlagsPoller=new Mps({pollingInterval:typeof r.featureFlagsPollingInterval=="number"?r.featureFlagsPollingInterval:J61,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||K61}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):GRd(t,r)}getLibraryId(){return"posthog-node"}getLibraryVersion(){return R61}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:f}){let s=b=>{super.captureStateless(t,r,b,{timestamp:u,disableGeoip:l,uuid:f})},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,w]of Object.entries(b))g[`$feature/${m}`]=w;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:f,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,f,s);f=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),l==null&&(l=!0);let c=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,f,s),b=c!==void 0;!b&&!u&&(c=await super.getFeatureFlagStateless(t,r,n,f,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:f,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),f==null&&(f=!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||{},f=this.addLocalPersonAndGroupProperties(t,i,u,l);u=f.allPersonProperties,l=f.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}}},qps=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})}};qps.POSTHOG_ID_TAG="posthog_distinct_id";var Eno=class{posthog;constructor({posthogApiKey:t}){this.posthog=new qun(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.51.28",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var GGn=class{async sendEvent(){}async identify(){}async flush(){}};var Tun=require("fs/promises"),kRd=require("os"),eFd=require("path");var YRd=Di(require("crypto")),Mno=new Uint8Array(256),Ano=Mno.length;function Tps(){return Ano>Mno.length-16&&(YRd.default.randomFillSync(Mno),Ano=0),Mno.slice(Ano,Ano+=16)}var xL=[];for(let e=0;e<256;++e)xL.push((e+256).toString(16).slice(1));function XRd(e,t=0){return xL[e[t+0]]+xL[e[t+1]]+xL[e[t+2]]+xL[e[t+3]]+"-"+xL[e[t+4]]+xL[e[t+5]]+"-"+xL[e[t+6]]+xL[e[t+7]]+"-"+xL[e[t+8]]+xL[e[t+9]]+"-"+xL[e[t+10]]+xL[e[t+11]]+xL[e[t+12]]+xL[e[t+13]]+xL[e[t+14]]+xL[e[t+15]]}var ZRd=Di(require("crypto")),Cps={randomUUID:ZRd.default.randomUUID};function Y61(e,t,r){if(Cps.randomUUID&&!t&&!e)return Cps.randomUUID();e=e||{};let i=e.random||(e.rng||Tps)();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 XRd(i)}var ZCe=Y61;var X61="id",Z61=".fern",QGn=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new qun(r),this.userId=t==null?void 0:Yas(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.51.28",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=ku(Kl.of((0,kRd.homedir)()),yo.of(Z61),yo.of(X61));await zf(t)||(await(0,Tun.mkdir)((0,eFd.dirname)(t),{recursive:!0}),await(0,Tun.writeFile)(t,ZCe())),this.persistedDistinctId=(await(0,Tun.readFile)(t)).toString()}return this.persistedDistinctId}};var Bps;async function Cun(){return Bps==null&&(Bps=await k61()),Bps}async function k61(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new GGn;let r=await LXa();return r!=null?new QGn({token:r,posthogApiKey:e}):await NXa()!=null?new Eno({posthogApiKey:e}):new QGn({token:void 0,posthogApiKey:e})}catch{return new GGn}}function JGn(e,t){return function(){return e.apply(t,arguments)}}var{toString:e41}=Object.prototype,{getPrototypeOf:zps}=Object,Tno=(e=>t=>{let r=e41.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),a2t=e=>(e=e.toLowerCase(),t=>Tno(t)===e),Cno=e=>t=>typeof t===e,{isArray:xun}=Array,KGn=Cno("undefined");function t41(e){return e!==null&&!KGn(e)&&e.constructor!==null&&!KGn(e.constructor)&&_we(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var iFd=a2t("ArrayBuffer");function r41(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&iFd(e.buffer),t}var i41=Cno("string"),_we=Cno("function"),nFd=Cno("number"),Bno=e=>e!==null&&typeof e=="object",n41=e=>e===!0||e===!1,qno=e=>{if(Tno(e)!=="object")return!1;let t=zps(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},a41=a2t("Date"),o41=a2t("File"),u41=a2t("Blob"),s41=a2t("FileList"),c41=e=>Bno(e)&&_we(e.pipe),l41=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||_we(e.append)&&((t=Tno(e))==="formdata"||t==="object"&&_we(e.toString)&&e.toString()==="[object FormData]"))},f41=a2t("URLSearchParams"),[d41,p41,_41,h41]=["ReadableStream","Request","Response","Headers"].map(a2t),y41=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function YGn(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),xun(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 aFd(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 $ji=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,oFd=e=>!KGn(e)&&e!==$ji;function Ips(){let{caseless:e}=oFd(this)&&this||{},t={},r=(i,n)=>{let a=e&&aFd(t,n)||n;qno(t[a])&&qno(i)?t[a]=Ips(t[a],i):qno(i)?t[a]=Ips({},i):xun(i)?t[a]=i.slice():t[a]=i};for(let i=0,n=arguments.length;i<n;i++)arguments[i]&&YGn(arguments[i],r);return t}var v41=(e,t,r,{allOwnKeys:i}={})=>(YGn(t,(n,a)=>{r&&_we(n)?e[a]=JGn(n,r):e[a]=n},{allOwnKeys:i}),e),b41=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),g41=(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)},O41=(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&&zps(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},m41=(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},P41=e=>{if(!e)return null;if(xun(e))return e;let t=e.length;if(!nFd(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},j41=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&zps(Uint8Array)),w41=(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])}},S41=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},D41=a2t("HTMLFormElement"),E41=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),tFd=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),A41=a2t("RegExp"),uFd=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};YGn(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},M41=e=>{uFd(e,(t,r)=>{if(_we(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(_we(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+"'")})}})},q41=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return xun(e)?i(e):i(String(e).split(t)),r},T41=()=>{},C41=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,xps="abcdefghijklmnopqrstuvwxyz",rFd="0123456789",sFd={DIGIT:rFd,ALPHA:xps,ALPHA_DIGIT:xps+xps.toUpperCase()+rFd},B41=(e=16,t=sFd.ALPHA_DIGIT)=>{let r="",{length:i}=t;for(;e--;)r+=t[Math.random()*i|0];return r};function x41(e){return!!(e&&_we(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}var I41=e=>{let t=new Array(10),r=(i,n)=>{if(Bno(i)){if(t.indexOf(i)>=0)return;if(!("toJSON"in i)){t[n]=i;let a=xun(i)?[]:{};return YGn(i,(u,l)=>{let f=r(u,n+1);!KGn(f)&&(a[l]=f)}),t[n]=void 0,a}}return i};return r(e,0)},z41=a2t("AsyncFunction"),R41=e=>e&&(Bno(e)||_we(e))&&_we(e.then)&&_we(e.catch),cFd=((e,t)=>e?setImmediate:t?((r,i)=>($ji.addEventListener("message",({source:n,data:a})=>{n===$ji&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),$ji.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",_we($ji.postMessage)),F41=typeof queueMicrotask<"u"?queueMicrotask.bind($ji):typeof process<"u"&&process.nextTick||cFd,os={isArray:xun,isArrayBuffer:iFd,isBuffer:t41,isFormData:l41,isArrayBufferView:r41,isString:i41,isNumber:nFd,isBoolean:n41,isObject:Bno,isPlainObject:qno,isReadableStream:d41,isRequest:p41,isResponse:_41,isHeaders:h41,isUndefined:KGn,isDate:a41,isFile:o41,isBlob:u41,isRegExp:A41,isFunction:_we,isStream:c41,isURLSearchParams:f41,isTypedArray:j41,isFileList:s41,forEach:YGn,merge:Ips,extend:v41,trim:y41,stripBOM:b41,inherits:g41,toFlatObject:O41,kindOf:Tno,kindOfTest:a2t,endsWith:m41,toArray:P41,forEachEntry:w41,matchAll:S41,isHTMLForm:D41,hasOwnProperty:tFd,hasOwnProp:tFd,reduceDescriptors:uFd,freezeMethods:M41,toObjectSet:q41,toCamelCase:E41,noop:T41,toFiniteNumber:C41,findKey:aFd,global:$ji,isContextDefined:oFd,ALPHABET:sFd,generateString:B41,isSpecCompliantForm:x41,toJSONObject:I41,isAsyncFn:z41,isThenable:R41,setImmediate:cFd,asap:F41};function Iun(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)}os.inherits(Iun,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:os.toJSONObject(this.config),code:this.code,status:this.status}}});var lFd=Iun.prototype,fFd={};["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=>{fFd[e]={value:e}});Object.defineProperties(Iun,fFd);Object.defineProperty(lFd,"isAxiosError",{value:!0});Iun.from=(e,t,r,i,n,a)=>{let u=Object.create(lFd);return os.toFlatObject(e,u,function(f){return f!==Error.prototype},l=>l!=="isAxiosError"),Iun.call(u,e.message,t,r,i,n),u.cause=e,u.name=e.name,a&&Object.assign(u,a),u};var yp=Iun;var dFd=Di(CLn(),1),xno=dFd.default;function Rps(e){return os.isPlainObject(e)||os.isArray(e)}function _Fd(e){return os.endsWith(e,"[]")?e.slice(0,-2):e}function pFd(e,t,r){return e?e.concat(t).map(function(n,a){return n=_Fd(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function N41(e){return os.isArray(e)&&!e.some(Rps)}var L41=os.toFlatObject(os,{},null,function(t){return/^is[A-Z]/.test(t)});function U41(e,t,r){if(!os.isObject(e))throw new TypeError("target must be an object");t=t||new(xno||FormData),r=os.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,w){return!os.isUndefined(w[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&os.isSpecCompliantForm(t);if(!os.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(os.isDate(O))return O.toISOString();if(!f&&os.isBlob(O))throw new yp("Blob is not supported. Use a Buffer instead.");return os.isArrayBuffer(O)||os.isTypedArray(O)?f&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,w){let A=O;if(O&&!w&&typeof O=="object"){if(os.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(os.isArray(O)&&N41(O)||(os.isFileList(O)||os.endsWith(m,"[]"))&&(A=os.toArray(O)))return m=_Fd(m),A.forEach(function(q,D){!(os.isUndefined(q)||q===null)&&t.append(u===!0?pFd([m],D,a):u===null?m:m+"[]",s(q))}),!1}return Rps(O)?!0:(t.append(pFd(w,m,a),s(O)),!1)}let c=[],b=Object.assign(L41,{defaultVisitor:o,convertValue:s,isVisitable:Rps});function g(O,m){if(!os.isUndefined(O)){if(c.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));c.push(O),os.forEach(O,function(A,M){(!(os.isUndefined(A)||A===null)&&n.call(t,A,os.isString(M)?M.trim():M,m,b))===!0&&g(A,m?m.concat(M):[M])}),c.pop()}}if(!os.isObject(e))throw new TypeError("data must be an object");return g(e),t}var tkr=U41;function hFd(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function yFd(e,t){this._pairs=[],e&&tkr(e,this,t)}var vFd=yFd.prototype;vFd.append=function(t,r){this._pairs.push([t,r])};vFd.toString=function(t){let r=t?function(i){return t.call(this,i,hFd)}:hFd;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var bFd=yFd;function V41(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Gji(e,t,r){if(!t)return e;let i=r&&r.encode||V41,n=r&&r.serialize,a;if(n?a=n(t,r):a=os.isURLSearchParams(t)?t.toString():new bFd(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var Fps=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){os.forEach(this.handlers,function(i){i!==null&&t(i)})}},Nps=Fps;var zun={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var gFd=Di(require("url"),1),OFd=gFd.default.URLSearchParams;var mFd={isNode:!0,classes:{URLSearchParams:OFd,FormData:xno,Blob:typeof Blob<"u"&&Blob||null},protocols:["http","https","file","data"]};var Vps={};Ro(Vps,{hasBrowserEnv:()=>Ups,hasStandardBrowserEnv:()=>W41,hasStandardBrowserWebWorkerEnv:()=>H41,navigator:()=>Lps,origin:()=>$41});var Ups=typeof window<"u"&&typeof document<"u",Lps=typeof navigator=="object"&&navigator||void 0,W41=Ups&&(!Lps||["ReactNative","NativeScript","NS"].indexOf(Lps.product)<0),H41=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",$41=Ups&&window.location.href||"http://localhost";var sT={...Vps,...mFd};function Wps(e,t){return tkr(e,new sT.classes.URLSearchParams,Object.assign({visitor:function(r,i,n,a){return sT.isNode&&os.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)}},t))}function G41(e){return os.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function Q41(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 J41(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let l=Number.isFinite(+u),f=a>=r.length;return u=!u&&os.isArray(n)?n.length:u,f?(os.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!l):((!n[u]||!os.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&os.isArray(n[u])&&(n[u]=Q41(n[u])),!l)}if(os.isFormData(e)&&os.isFunction(e.entries)){let r={};return os.forEachEntry(e,(i,n)=>{t(G41(i),n,r,0)}),r}return null}var Ino=J41;function K41(e,t,r){if(os.isString(e))try{return(t||JSON.parse)(e),os.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var Hps={transitional:zun,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=os.isObject(t);if(a&&os.isHTMLForm(t)&&(t=new FormData(t)),os.isFormData(t))return n?JSON.stringify(Ino(t)):t;if(os.isArrayBuffer(t)||os.isBuffer(t)||os.isStream(t)||os.isFile(t)||os.isBlob(t)||os.isReadableStream(t))return t;if(os.isArrayBufferView(t))return t.buffer;if(os.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 Wps(t,this.formSerializer).toString();if((l=os.isFileList(t))||i.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return tkr(l?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),K41(t)):t}],transformResponse:[function(t){let r=this.transitional||Hps.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(os.isResponse(t)||os.isReadableStream(t))return t;if(t&&os.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"?yp.from(l,yp.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:sT.classes.FormData,Blob:sT.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};os.forEach(["delete","get","head","post","put","patch"],e=>{Hps.headers[e]={}});var Run=Hps;var Y41=os.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"]),PFd=e=>{let t={},r,i,n;return e&&e.split(`
|
|
1688
1688
|
`).forEach(function(u){n=u.indexOf(":"),r=u.substring(0,n).trim().toLowerCase(),i=u.substring(n+1).trim(),!(!r||t[r]&&Y41[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var jFd=Symbol("internals");function XGn(e){return e&&String(e).trim().toLowerCase()}function zno(e){return e===!1||e==null?e:os.isArray(e)?e.map(zno):String(e)}function X41(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 Z41=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function $ps(e,t,r,i,n){if(os.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!os.isString(t)){if(os.isString(i))return t.indexOf(i)!==-1;if(os.isRegExp(i))return i.test(t)}}function k41(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function e81(e,t){let r=os.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 Fun=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(l,f,s){let o=XGn(f);if(!o)throw new Error("header name must be a non-empty string");let c=os.findKey(n,o);(!c||n[c]===void 0||s===!0||s===void 0&&n[c]!==!1)&&(n[c||f]=zno(l))}let u=(l,f)=>os.forEach(l,(s,o)=>a(s,o,f));if(os.isPlainObject(t)||t instanceof this.constructor)u(t,r);else if(os.isString(t)&&(t=t.trim())&&!Z41(t))u(PFd(t),r);else if(os.isHeaders(t))for(let[l,f]of t.entries())a(f,l,i);else t!=null&&a(r,t,i);return this}get(t,r){if(t=XGn(t),t){let i=os.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return X41(n);if(os.isFunction(r))return r.call(this,n,i);if(os.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=XGn(t),t){let i=os.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||$ps(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(u){if(u=XGn(u),u){let l=os.findKey(i,u);l&&(!r||$ps(i,i[l],l,r))&&(delete i[l],n=!0)}}return os.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||$ps(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return os.forEach(this,(n,a)=>{let u=os.findKey(i,a);if(u){r[u]=zno(n),delete r[a];return}let l=t?k41(a):String(a).trim();l!==a&&delete r[a],r[l]=zno(n),i[l]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return os.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&os.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(`
|
|
1689
1689
|
`)}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[jFd]=this[jFd]={accessors:{}}).accessors,n=this.prototype;function a(u){let l=XGn(u);i[l]||(e81(n,u),i[l]=!0)}return os.isArray(t)?t.forEach(a):a(t),this}};Fun.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);os.reduceDescriptors(Fun.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});os.freezeMethods(Fun);var sI=Fun;function ZGn(e,t){let r=this||Run,i=t||r,n=sI.from(i.headers),a=i.data;return os.forEach(e,function(l){a=l.call(r,a,n.normalize(),t?t.status:void 0)}),n.normalize(),a}function kGn(e){return!!(e&&e.__CANCEL__)}function wFd(e,t,r){yp.call(this,e??"canceled",yp.ERR_CANCELED,t,r),this.name="CanceledError"}os.inherits(wFd,yp,{__CANCEL__:!0});var hwe=wFd;function hGt(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new yp("Request failed with status code "+r.status,[yp.ERR_BAD_REQUEST,yp.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Gps(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Qps(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Qji(e,t){return e&&!Gps(t)?Qps(e,t):t}var LFd=Di(BGn(),1),UFd=Di(require("http"),1),VFd=Di(require("https"),1),WFd=Di(require("util"),1),HFd=Di(Zds(),1),R4r=Di(require("zlib"),1);var Jji="1.7.7";function eQn(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var t81=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Jps(e,t,r){let i=r&&r.Blob||sT.classes.Blob,n=eQn(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=t81.exec(e);if(!a)throw new yp("Invalid URL",yp.ERR_INVALID_URL);let u=a[1],l=a[2],f=a[3],s=Buffer.from(decodeURIComponent(f),l?"base64":"utf8");if(t){if(!i)throw new yp("Blob is not supported",yp.ERR_NOT_SUPPORT);return new i([s],{type:u})}return s}throw new yp("Unsupported protocol "+n,yp.ERR_NOT_SUPPORT)}var Kji=Di(require("stream"),1);var SFd=Di(require("stream"),1);var Kps=Symbol("internals"),Yps=class extends SFd.default.Transform{constructor(t){t=os.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!os.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[Kps]={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[Kps];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[Kps],a=n.maxRate,u=this.readableHighWaterMark,l=n.timeWindow,f=1e3/l,s=a/f,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),w=null,A=u,M,q=0;if(a){let D=Date.now();(!n.ts||(q=D-n.ts)>=l)&&(n.ts=D,M=s-n.bytes,n.bytes=M<0?-M:0,q=0),M=s-n.bytes}if(a){if(M<=0)return setTimeout(()=>{O(null,g)},l-q);M<A&&(A=M)}A&&m>A&&m-A>o&&(w=g.subarray(A),g=g.subarray(0,A)),c(g,w?()=>{process.nextTick(O,null,w)}:O)};b(t,function g(O,m){if(O)return i(O);m?b(m,g):i(null)})}},Xps=Yps;var $Fd=require("events");var EFd=require("util"),AFd=require("stream");var{asyncIterator:DFd}=Symbol,r81=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[DFd]?yield*e[DFd]():yield e},Rno=r81;var i81=os.ALPHABET.ALPHA_DIGIT+"-_",tQn=new EFd.TextEncoder,rkr=`\r
|
|
1690
1690
|
`,n81=tQn.encode(rkr),a81=2,Zps=class{constructor(t,r){let{escapeName:i}=this.constructor,n=os.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${rkr}`;n?r=tQn.encode(String(r).replace(/\r?\n|\r\n?/g,rkr)):a+=`Content-Type: ${r.type||"application/octet-stream"}${rkr}`,this.headers=tQn.encode(a+rkr),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+a81,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;os.isTypedArray(t)?yield t:yield*Rno(t),yield n81}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},o81=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+os.generateString(n,i81)}=r||{};if(!os.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=tQn.encode("--"+a+rkr),l=tQn.encode("--"+a+"--"+rkr+rkr),f=l.byteLength,s=Array.from(e.entries()).map(([c,b])=>{let g=new Zps(c,b);return f+=g.size,g});f+=u.byteLength*s.length,f=os.toFiniteNumber(f);let o={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(f)&&(o["Content-Length"]=f),t&&t(o),AFd.Readable.from(async function*(){for(let c of s)yield u,yield*c.encode();yield l}())},MFd=o81;var qFd=Di(require("stream"),1),kps=class extends qFd.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)}},TFd=kps;var u81=(e,t)=>os.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,CFd=u81;function s81(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(f){let s=Date.now(),o=i[a];u||(u=s),r[n]=f,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 BFd=s81;function c81(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 xFd=c81;var z4r=(e,t,r=3)=>{let i=0,n=BFd(50,250);return xFd(a=>{let u=a.loaded,l=a.lengthComputable?a.total:void 0,f=u-i,s=n(f),o=u<=l;i=u;let c={loaded:u,total:l,progress:l?u/l:void 0,bytes:f,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)},Nun=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},Lun=e=>(...t)=>os.asap(()=>e(...t));var IFd={flush:R4r.default.constants.Z_SYNC_FLUSH,finishFlush:R4r.default.constants.Z_SYNC_FLUSH},l81={flush:R4r.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:R4r.default.constants.BROTLI_OPERATION_FLUSH},zFd=os.isFunction(R4r.default.createBrotliDecompress),{http:f81,https:d81}=HFd.default,p81=/https:?/,RFd=sT.protocols.map(e=>e+":"),FFd=(e,[t,r])=>(e.on("end",r).on("error",r),t);function _81(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function GFd(e,t,r){let i=t;if(!i&&i!==!1){let n=(0,LFd.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){GFd(a,t,a.href)}}var h81=typeof process<"u"&&os.kindOf(process)==="process",y81=e=>new Promise((t,r)=>{let i,n,a=(f,s)=>{n||(n=!0,i&&i(f,s))},u=f=>{a(f),t(f)},l=f=>{a(f,!0),r(f)};e(u,l,f=>i=f).catch(l)}),v81=({address:e,family:t})=>{if(!os.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},NFd=(e,t)=>v81(os.isObject(e)?e:{address:e,family:t}),QFd=h81&&function(t){return y81(async function(i,n,a){let{data:u,lookup:l,family:f}=t,{responseType:s,responseEncoding:o}=t,c=t.method.toUpperCase(),b,g=!1,O;if(l){let we=CFd(l,Xe=>os.isArray(Xe)?Xe:[Xe]);l=(Xe,Mt,De)=>{we(Xe,Mt,(Te,It,Ee)=>{if(Te)return De(Te);let St=os.isArray(It)?It.map(ut=>NFd(ut)):[NFd(It,Ee)];Mt.all?De(Te,St):De(Te,St[0].address,St[0].family)})}}let m=new $Fd.EventEmitter,w=()=>{t.cancelToken&&t.cancelToken.unsubscribe(A),t.signal&&t.signal.removeEventListener("abort",A),m.removeAllListeners()};a((we,Xe)=>{b=!0,Xe&&(g=!0,w())});function A(we){m.emit("abort",!we||we.type?new hwe(null,t,O):we)}m.once("abort",n),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(A),t.signal&&(t.signal.aborted?A():t.signal.addEventListener("abort",A)));let M=Qji(t.baseURL,t.url),q=new URL(M,sT.hasBrowserEnv?sT.origin:void 0),D=q.protocol||RFd[0];if(D==="data:"){let we;if(c!=="GET")return hGt(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{we=Jps(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(Xe){throw yp.from(Xe,yp.ERR_BAD_REQUEST,t)}return s==="text"?(we=we.toString(o),(!o||o==="utf8")&&(we=os.stripBOM(we))):s==="stream"&&(we=Kji.default.Readable.from(we)),hGt(i,n,{data:we,status:200,statusText:"OK",headers:new sI,config:t})}if(RFd.indexOf(D)===-1)return n(new yp("Unsupported protocol "+D,yp.ERR_BAD_REQUEST,t));let C=sI.from(t.headers).normalize();C.set("User-Agent","axios/"+Jji,!1);let{onUploadProgress:R,onDownloadProgress:$}=t,I=t.maxRate,U,H;if(os.isSpecCompliantForm(u)){let we=C.getContentType(/boundary=([-_\w\d]{10,70})/i);u=MFd(u,Xe=>{C.set(Xe)},{tag:`axios-${Jji}-boundary`,boundary:we&&we[1]||void 0})}else if(os.isFormData(u)&&os.isFunction(u.getHeaders)){if(C.set(u.getHeaders()),!C.hasContentLength())try{let we=await WFd.default.promisify(u.getLength).call(u);Number.isFinite(we)&&we>=0&&C.setContentLength(we)}catch{}}else if(os.isBlob(u))u.size&&C.setContentType(u.type||"application/octet-stream"),C.setContentLength(u.size||0),u=Kji.default.Readable.from(Rno(u));else if(u&&!os.isStream(u)){if(!Buffer.isBuffer(u))if(os.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(os.isString(u))u=Buffer.from(u,"utf-8");else return n(new yp("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",yp.ERR_BAD_REQUEST,t));if(C.setContentLength(u.length,!1),t.maxBodyLength>-1&&u.length>t.maxBodyLength)return n(new yp("Request body larger than maxBodyLength limit",yp.ERR_BAD_REQUEST,t))}let te=os.toFiniteNumber(C.getContentLength());os.isArray(I)?(U=I[0],H=I[1]):U=H=I,u&&(R||U)&&(os.isStream(u)||(u=Kji.default.Readable.from(u,{objectMode:!1})),u=Kji.default.pipeline([u,new Xps({maxRate:os.toFiniteNumber(U)})],os.noop),R&&u.on("progress",FFd(u,Nun(te,z4r(Lun(R),!1,3)))));let J;if(t.auth){let we=t.auth.username||"",Xe=t.auth.password||"";J=we+":"+Xe}if(!J&&q.username){let we=q.username,Xe=q.password;J=we+":"+Xe}J&&C.delete("authorization");let ee;try{ee=Gji(q.pathname+q.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(we){let Xe=new Error(we.message);return Xe.config=t,Xe.url=t.url,Xe.exists=!0,n(Xe)}C.set("Accept-Encoding","gzip, compress, deflate"+(zFd?", br":""),!1);let fe={path:ee,method:c,headers:C.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:J,protocol:D,family:f,beforeRedirect:_81,beforeRedirects:{}};!os.isUndefined(l)&&(fe.lookup=l),t.socketPath?fe.socketPath=t.socketPath:(fe.hostname=q.hostname.startsWith("[")?q.hostname.slice(1,-1):q.hostname,fe.port=q.port,GFd(fe,t.proxy,D+"//"+q.hostname+(q.port?":"+q.port:"")+fe.path));let me,ve=p81.test(fe.protocol);if(fe.agent=ve?t.httpsAgent:t.httpAgent,t.transport?me=t.transport:t.maxRedirects===0?me=ve?VFd.default:UFd.default:(t.maxRedirects&&(fe.maxRedirects=t.maxRedirects),t.beforeRedirect&&(fe.beforeRedirects.config=t.beforeRedirect),me=ve?d81:f81),t.maxBodyLength>-1?fe.maxBodyLength=t.maxBodyLength:fe.maxBodyLength=1/0,t.insecureHTTPParser&&(fe.insecureHTTPParser=t.insecureHTTPParser),O=me.request(fe,function(Xe){if(O.destroyed)return;let Mt=[Xe],De=+Xe.headers["content-length"];if($||H){let ut=new Xps({maxRate:os.toFiniteNumber(H)});$&&ut.on("progress",FFd(ut,Nun(De,z4r(Lun($),!0,3)))),Mt.push(ut)}let Te=Xe,It=Xe.req||O;if(t.decompress!==!1&&Xe.headers["content-encoding"])switch((c==="HEAD"||Xe.statusCode===204)&&delete Xe.headers["content-encoding"],(Xe.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":Mt.push(R4r.default.createUnzip(IFd)),delete Xe.headers["content-encoding"];break;case"deflate":Mt.push(new TFd),Mt.push(R4r.default.createUnzip(IFd)),delete Xe.headers["content-encoding"];break;case"br":zFd&&(Mt.push(R4r.default.createBrotliDecompress(l81)),delete Xe.headers["content-encoding"])}Te=Mt.length>1?Kji.default.pipeline(Mt,os.noop):Mt[0];let Ee=Kji.default.finished(Te,()=>{Ee(),w()}),St={status:Xe.statusCode,statusText:Xe.statusMessage,headers:new sI(Xe.headers),config:t,request:It};if(s==="stream")St.data=Te,hGt(i,n,St);else{let ut=[],ge=0;Te.on("data",function(wt){ut.push(wt),ge+=wt.length,t.maxContentLength>-1&&ge>t.maxContentLength&&(g=!0,Te.destroy(),n(new yp("maxContentLength size of "+t.maxContentLength+" exceeded",yp.ERR_BAD_RESPONSE,t,It)))}),Te.on("aborted",function(){if(g)return;let wt=new yp("maxContentLength size of "+t.maxContentLength+" exceeded",yp.ERR_BAD_RESPONSE,t,It);Te.destroy(wt),n(wt)}),Te.on("error",function(wt){O.destroyed||n(yp.from(wt,null,t,It))}),Te.on("end",function(){try{let wt=ut.length===1?ut[0]:Buffer.concat(ut);s!=="arraybuffer"&&(wt=wt.toString(o),(!o||o==="utf8")&&(wt=os.stripBOM(wt))),St.data=wt}catch(wt){return n(yp.from(wt,null,t,St.request,St))}hGt(i,n,St)})}m.once("abort",ut=>{Te.destroyed||(Te.emit("error",ut),Te.destroy())})}),m.once("abort",we=>{n(we),O.destroy(we)}),O.on("error",function(Xe){n(yp.from(Xe,null,t,O))}),O.on("socket",function(Xe){Xe.setKeepAlive(!0,1e3*60)}),t.timeout){let we=parseInt(t.timeout,10);if(Number.isNaN(we)){n(new yp("error trying to parse `config.timeout` to int",yp.ERR_BAD_OPTION_VALUE,t,O));return}O.setTimeout(we,function(){if(b)return;let Mt=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",De=t.transitional||zun;t.timeoutErrorMessage&&(Mt=t.timeoutErrorMessage),n(new yp(Mt,De.clarifyTimeoutError?yp.ETIMEDOUT:yp.ECONNABORTED,t,O)),A()})}if(os.isStream(u)){let we=!1,Xe=!1;u.on("end",()=>{we=!0}),u.once("error",Mt=>{Xe=!0,O.destroy(Mt)}),u.on("close",()=>{!we&&!Xe&&A(new hwe("Request stream has been aborted",t,O))}),u.pipe(O)}else O.end(u)})};var JFd=sT.hasStandardBrowserEnv?function(){let t=sT.navigator&&/(msie|trident)/i.test(sT.navigator.userAgent),r=document.createElement("a"),i;function n(a){let u=a;return t&&(r.setAttribute("href",u),u=r.href),r.setAttribute("href",u),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:r.pathname.charAt(0)==="/"?r.pathname:"/"+r.pathname}}return i=n(window.location.href),function(u){let l=os.isString(u)?n(u):u;return l.protocol===i.protocol&&l.host===i.host}}():function(){return function(){return!0}}();var KFd=sT.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let u=[e+"="+encodeURIComponent(t)];os.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),os.isString(i)&&u.push("path="+i),os.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 YFd=e=>e instanceof sI?{...e}:e;function o2t(e,t){t=t||{};let r={};function i(s,o,c){return os.isPlainObject(s)&&os.isPlainObject(o)?os.merge.call({caseless:c},s,o):os.isPlainObject(o)?os.merge({},o):os.isArray(o)?o.slice():o}function n(s,o,c){if(os.isUndefined(o)){if(!os.isUndefined(s))return i(void 0,s,c)}else return i(s,o,c)}function a(s,o){if(!os.isUndefined(o))return i(void 0,o)}function u(s,o){if(os.isUndefined(o)){if(!os.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 f={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)=>n(YFd(s),YFd(o),!0)};return os.forEach(Object.keys(Object.assign({},e,t)),function(o){let c=f[o]||n,b=c(e[o],t[o],o);os.isUndefined(b)&&c!==l||(r[o]=b)}),r}var Fno=e=>{let t=o2t({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:u,auth:l}=t;t.headers=u=sI.from(u),t.url=Gji(Qji(t.baseURL,t.url),e.params,e.paramsSerializer),l&&u.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let f;if(os.isFormData(r)){if(sT.hasStandardBrowserEnv||sT.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if((f=u.getContentType())!==!1){let[s,...o]=f?f.split(";").map(c=>c.trim()).filter(Boolean):[];u.setContentType([s||"multipart/form-data",...o].join("; "))}}if(sT.hasStandardBrowserEnv&&(i&&os.isFunction(i)&&(i=i(t)),i||i!==!1&&JFd(t.url))){let s=n&&a&&KFd.read(a);s&&u.set(n,s)}return t};var b81=typeof XMLHttpRequest<"u",XFd=b81&&function(e){return new Promise(function(r,i){let n=Fno(e),a=n.data,u=sI.from(n.headers).normalize(),{responseType:l,onUploadProgress:f,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 w=new XMLHttpRequest;w.open(n.method.toUpperCase(),n.url,!0),w.timeout=n.timeout;function A(){if(!w)return;let q=sI.from("getAllResponseHeaders"in w&&w.getAllResponseHeaders()),C={data:!l||l==="text"||l==="json"?w.responseText:w.response,status:w.status,statusText:w.statusText,headers:q,config:e,request:w};hGt(function($){r($),m()},function($){i($),m()},C),w=null}"onloadend"in w?w.onloadend=A:w.onreadystatechange=function(){!w||w.readyState!==4||w.status===0&&!(w.responseURL&&w.responseURL.indexOf("file:")===0)||setTimeout(A)},w.onabort=function(){w&&(i(new yp("Request aborted",yp.ECONNABORTED,e,w)),w=null)},w.onerror=function(){i(new yp("Network Error",yp.ERR_NETWORK,e,w)),w=null},w.ontimeout=function(){let D=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",C=n.transitional||zun;n.timeoutErrorMessage&&(D=n.timeoutErrorMessage),i(new yp(D,C.clarifyTimeoutError?yp.ETIMEDOUT:yp.ECONNABORTED,e,w)),w=null},a===void 0&&u.setContentType(null),"setRequestHeader"in w&&os.forEach(u.toJSON(),function(D,C){w.setRequestHeader(C,D)}),os.isUndefined(n.withCredentials)||(w.withCredentials=!!n.withCredentials),l&&l!=="json"&&(w.responseType=n.responseType),s&&([b,O]=z4r(s,!0),w.addEventListener("progress",b)),f&&w.upload&&([c,g]=z4r(f),w.upload.addEventListener("progress",c),w.upload.addEventListener("loadend",g)),(n.cancelToken||n.signal)&&(o=q=>{w&&(i(!q||q.type?new hwe(null,e,w):q),w.abort(),w=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));let M=eQn(n.url);if(M&&sT.protocols.indexOf(M)===-1){i(new yp("Unsupported protocol "+M+":",yp.ERR_BAD_REQUEST,e));return}w.send(a||null)})};var g81=(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 yp?o:new hwe(o instanceof Error?o.message:o))}},u=t&&setTimeout(()=>{u=null,a(new yp(`timeout ${t} of ms exceeded`,yp.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:f}=i;return f.unsubscribe=()=>os.asap(l),f}},ZFd=g81;var O81=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},m81=async function*(e,t){for await(let r of P81(e))yield*O81(r,t)},P81=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()}},e_s=(e,t,r,i)=>{let n=m81(e,t),a=0,u,l=f=>{u||(u=!0,i&&i(f))};return new ReadableStream({async pull(f){try{let{done:s,value:o}=await n.next();if(s){l(),f.close();return}let c=o.byteLength;if(r){let b=a+=c;r(b)}f.enqueue(new Uint8Array(o))}catch(s){throw l(s),s}},cancel(f){return l(f),n.return()}},{highWaterMark:2})};var Lno=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",eNd=Lno&&typeof ReadableStream=="function",j81=Lno&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),tNd=(e,...t)=>{try{return!!e(...t)}catch{return!1}},w81=eNd&&tNd(()=>{let e=!1,t=new Request(sT.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),kFd=64*1024,t_s=eNd&&tNd(()=>os.isReadableStream(new Response("").body)),Nno={stream:t_s&&(e=>e.body)};Lno&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!Nno[t]&&(Nno[t]=os.isFunction(e[t])?r=>r[t]():(r,i)=>{throw new yp(`Response type '${t}' is not supported`,yp.ERR_NOT_SUPPORT,i)})})})(new Response);var S81=async e=>{if(e==null)return 0;if(os.isBlob(e))return e.size;if(os.isSpecCompliantForm(e))return(await new Request(sT.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(os.isArrayBufferView(e)||os.isArrayBuffer(e))return e.byteLength;if(os.isURLSearchParams(e)&&(e=e+""),os.isString(e))return(await j81(e)).byteLength},D81=async(e,t)=>{let r=os.toFiniteNumber(e.getContentLength());return r??S81(t)},rNd=Lno&&(async e=>{let{url:t,method:r,data:i,signal:n,cancelToken:a,timeout:u,onDownloadProgress:l,onUploadProgress:f,responseType:s,headers:o,withCredentials:c="same-origin",fetchOptions:b}=Fno(e);s=s?(s+"").toLowerCase():"text";let g=ZFd([n,a&&a.toAbortSignal()],u),O,m=g&&g.unsubscribe&&(()=>{g.unsubscribe()}),w;try{if(f&&w81&&r!=="get"&&r!=="head"&&(w=await D81(o,i))!==0){let C=new Request(t,{method:"POST",body:i,duplex:"half"}),R;if(os.isFormData(i)&&(R=C.headers.get("content-type"))&&o.setContentType(R),C.body){let[$,I]=Nun(w,z4r(Lun(f)));i=e_s(C.body,kFd,$,I)}}os.isString(c)||(c=c?"include":"omit");let A="credentials"in Request.prototype;O=new Request(t,{...b,signal:g,method:r.toUpperCase(),headers:o.normalize().toJSON(),body:i,duplex:"half",credentials:A?c:void 0});let M=await fetch(O),q=t_s&&(s==="stream"||s==="response");if(t_s&&(l||q&&m)){let C={};["status","statusText","headers"].forEach(U=>{C[U]=M[U]});let R=os.toFiniteNumber(M.headers.get("content-length")),[$,I]=l&&Nun(R,z4r(Lun(l),!0))||[];M=new Response(e_s(M.body,kFd,$,()=>{I&&I(),m&&m()}),C)}s=s||"text";let D=await Nno[os.findKey(Nno,s)||"text"](M,e);return!q&&m&&m(),await new Promise((C,R)=>{hGt(C,R,{data:D,headers:sI.from(M.headers),status:M.status,statusText:M.statusText,config:e,request:O})})}catch(A){throw m&&m(),A&&A.name==="TypeError"&&/fetch/i.test(A.message)?Object.assign(new yp("Network Error",yp.ERR_NETWORK,e,O),{cause:A.cause||A}):yp.from(A,A&&A.code,e,O)}});var r_s={http:QFd,xhr:XFd,fetch:rNd};os.forEach(r_s,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var iNd=e=>`- ${e}`,E81=e=>os.isFunction(e)||e===null||e===!1,Uno={getAdapter:e=>{e=os.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,!E81(r)&&(i=r_s[(u=String(r)).toLowerCase()],i===void 0))throw new yp(`Unknown adapter '${u}'`);if(i)break;n[u||"#"+a]=i}if(!i){let a=Object.entries(n).map(([l,f])=>`adapter ${l} `+(f===!1?"is not supported by the environment":"is not available in the build")),u=t?a.length>1?`since :
|
|
@@ -1922,7 +1922,7 @@ ${q}${M}${D}${Cop.default.cursorHide}`});var JXn=Di(rPi(),1);function $1s(e,t){i
|
|
|
1922
1922
|
Run ${Su.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
|
|
1923
1923
|
Run ${Su.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),Vun(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function rSs({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!rup(e))return;let n=t??"",a=e.filter(l=>l.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((l,f)=>l.generatorName.localeCompare(f.generatorName)||l.currentVersion.localeCompare(f.currentVersion));for(let l of u)n+=`
|
|
1924
1924
|
${await rjS(l.generatorName)} (${l.apiName!=null?"API: "+l.apiName+", ":""}Group: ${l.generatorGroup}) `+Su.dim(l.currentVersion)+Su.reset(" \u2192 ")+Su.green(l.latestVersion);return n+=`
|
|
1925
|
-
`,i?Vun(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function rjS(e){let r=await new tup.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 ijS({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await nup({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=qYr(o.name,c),g=await qWt({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 nup({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,f,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][f]==null&&(u.versions[l][f]={});let c=qYr(s.name,o),b=await qWt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][f][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function nup({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 T7t({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let f of l.groups)if(!(n!=null&&f.groupName!==n))for(let s of f.generators)i!=null&&s.name!==i||await r(a.workspaceName,f.groupName,s,u)}})}))}function aup(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 f=Tte(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:f,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function Vpo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await ijS({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[f,s]of Object.entries(l.versions))u.push(...aup(s,f,t.logger));else u.push(...aup(l.versions,void 0,t.logger))}return u}var rZn=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 Mfn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var qfn=e=>e!==null&&typeof e=="object";var iZn=(...e)=>{for(let t of e)if((!qfn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return aSs({},...e)},iSs=(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 Wpo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:aSs(e[r]??[],t[r]??[])}var nSs=(e={},t={})=>({beforeRequest:Wpo(e,t,"beforeRequest"),beforeRetry:Wpo(e,t,"beforeRetry"),afterResponse:Wpo(e,t,"afterResponse"),beforeError:Wpo(e,t,"beforeError")}),aSs=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(qfn(n)){for(let[a,u]of Object.entries(n))qfn(u)&&a in t&&(u=aSs(t[a],u)),t={...t,[a]:u};qfn(n.hooks)&&(i=nSs(i,n.hooks),t.hooks=i),qfn(n.headers)&&(r=iSs(r,n.headers),t.headers=r)}return t};var oup=(()=>{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})(),uup=typeof globalThis.AbortController=="function",sup=typeof globalThis.ReadableStream=="function",cup=typeof globalThis.FormData=="function",Hpo=["get","post","put","patch","head","delete"],njS=()=>{};njS();var lup={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},$po=2147483647,Gpo=Symbol("stop"),fup={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},dup={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 _up=e=>Hpo.includes(e)?e.toUpperCase():e,ajS=["get","put","head","delete","options","trace"],ojS=[408,413,429,500,502,503,504],ujS=[413,429,503],pup={limit:2,methods:ajS,statusCodes:ojS,afterStatusCodes:ujS,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},hup=(e={})=>{if(typeof e=="number")return{...pup,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{...pup,...e}};async function oSs(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new Mfn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function uSs(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 yup=(e,t)=>{let r={};for(let i in t)!(i in dup)&&!(i in fup)&&!(i in e)&&(r[i]=t[i]);return r};var nZn=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>$po)throw new RangeError(`The \`timeout\` option cannot be greater than ${$po}`);await Promise.resolve();let l=await i._fetch();for(let f of i._options.hooks.afterResponse){let s=await f(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let f=new rZn(l,i.request,i._options);for(let s of i._options.hooks.beforeError)f=await s(f);throw f}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!sup)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,f]of Object.entries(lup))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||f);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:iSs(this._input.headers,r.headers),hooks:nSs({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:_up(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:hup(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(uup){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(oup&&(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);(cup&&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 Mfn)throw t;if(t instanceof rZn){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),$po);if(this._retryCount<1)throw r;await uSs(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})===Gpo)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=yup(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):oSs(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:f,value:s}=await u.read();if(f){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 sSs=e=>{let t=(r,i)=>nZn.create(r,iZn(e,i));for(let r of Hpo)t[r]=(i,n)=>nZn.create(i,iZn(e,n,{method:r}));return t.create=r=>sSs(iZn(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),sSs(iZn(e,r))),t.stop=Gpo,t},sjS=sSs(),vup=sjS;var Lup=Di(Nup(),1);function pSs(e){let t=(0,Lup.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var xsp=Di(Bsp(),1),Isp=Di(rPi(),1),ESs=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},ASs=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function MSs(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??pSs(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,xsp.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,l&&(f.authorization=`${l.type} ${l.token}`);let s;try{s=await vup(u,{headers:f,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new ESs(e):c}if(t.allVersions)return s;let o=new ASs(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=Isp.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 lZn(e,t){let{version:r}=await MSs(e.toLowerCase(),t);return r}async function Aei({cliEnvironment:e,includePreReleases:t=!1}){return e.packageVersion==="0.0.0"?e.packageVersion:lZn(e.packageName,{version:t?"prerelease":"latest"})}var zsp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],n_o=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=k0.Info;constructor(t){this.ttyAwareLogger=new Upo(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.51.27"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Su.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Kk}failWithoutThrowing(t,r){this.didSucceed=!1,Rpo({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await Cun()).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 iup({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
1925
|
+
`,i?Vun(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function rjS(e){let r=await new tup.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 ijS({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let l={type:"singleApi",versions:{}};return await nup({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,s,o,c)=>{l.versions[s]==null&&(l.versions[s]={});let b=qYr(o.name,c),g=await qWt({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 nup({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(l,f,s,o)=>{if(l==null)return;u.versions[l]==null&&(u.versions[l]={}),u.versions[l][f]==null&&(u.versions[l][f]={});let c=qYr(s.name,o),b=await qWt({generatorName:c,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});b!=null&&(u.versions[l][f][s.name]={previousVersion:s.version,latestVersion:b})},generatorFilter:r,groupFilter:i}),u}async function nup({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 T7t({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(l==null||l.groups==null)){for(let f of l.groups)if(!(n!=null&&f.groupName!==n))for(let s of f.generators)i!=null&&s.name!==i||await r(a.workspaceName,f.groupName,s,u)}})}))}function aup(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 f=Tte(l.latestVersion,l.previousVersion);r.debug(`Latest version: ${l.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:f,currentVersion:l.previousVersion,latestVersion:l.latestVersion})}return i}async function Vpo({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let l=await ijS({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(l.type==="multiApi")for(let[f,s]of Object.entries(l.versions))u.push(...aup(s,f,t.logger));else u.push(...aup(l.versions,void 0,t.logger))}return u}var rZn=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 Mfn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var qfn=e=>e!==null&&typeof e=="object";var iZn=(...e)=>{for(let t of e)if((!qfn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return aSs({},...e)},iSs=(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 Wpo(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:aSs(e[r]??[],t[r]??[])}var nSs=(e={},t={})=>({beforeRequest:Wpo(e,t,"beforeRequest"),beforeRetry:Wpo(e,t,"beforeRetry"),afterResponse:Wpo(e,t,"afterResponse"),beforeError:Wpo(e,t,"beforeError")}),aSs=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(qfn(n)){for(let[a,u]of Object.entries(n))qfn(u)&&a in t&&(u=aSs(t[a],u)),t={...t,[a]:u};qfn(n.hooks)&&(i=nSs(i,n.hooks),t.hooks=i),qfn(n.headers)&&(r=iSs(r,n.headers),t.headers=r)}return t};var oup=(()=>{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})(),uup=typeof globalThis.AbortController=="function",sup=typeof globalThis.ReadableStream=="function",cup=typeof globalThis.FormData=="function",Hpo=["get","post","put","patch","head","delete"],njS=()=>{};njS();var lup={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},$po=2147483647,Gpo=Symbol("stop"),fup={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},dup={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 _up=e=>Hpo.includes(e)?e.toUpperCase():e,ajS=["get","put","head","delete","options","trace"],ojS=[408,413,429,500,502,503,504],ujS=[413,429,503],pup={limit:2,methods:ajS,statusCodes:ojS,afterStatusCodes:ujS,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},hup=(e={})=>{if(typeof e=="number")return{...pup,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{...pup,...e}};async function oSs(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new Mfn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function uSs(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 yup=(e,t)=>{let r={};for(let i in t)!(i in dup)&&!(i in fup)&&!(i in e)&&(r[i]=t[i]);return r};var nZn=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>$po)throw new RangeError(`The \`timeout\` option cannot be greater than ${$po}`);await Promise.resolve();let l=await i._fetch();for(let f of i._options.hooks.afterResponse){let s=await f(i.request,i._options,i._decorateResponse(l.clone()));s instanceof globalThis.Response&&(l=s)}if(i._decorateResponse(l),!l.ok&&i._options.throwHttpErrors){let f=new rZn(l,i.request,i._options);for(let s of i._options.hooks.beforeError)f=await s(f);throw f}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!sup)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,f]of Object.entries(lup))u[l]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||f);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:iSs(this._input.headers,r.headers),hooks:nSs({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:_up(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:hup(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(uup){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(oup&&(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);(cup&&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 Mfn)throw t;if(t instanceof rZn){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),$po);if(this._retryCount<1)throw r;await uSs(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})===Gpo)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=yup(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):oSs(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:f,value:s}=await u.read();if(f){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 sSs=e=>{let t=(r,i)=>nZn.create(r,iZn(e,i));for(let r of Hpo)t[r]=(i,n)=>nZn.create(i,iZn(e,n,{method:r}));return t.create=r=>sSs(iZn(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),sSs(iZn(e,r))),t.stop=Gpo,t},sjS=sSs(),vup=sjS;var Lup=Di(Nup(),1);function pSs(e){let t=(0,Lup.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var xsp=Di(Bsp(),1),Isp=Di(rPi(),1),ESs=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},ASs=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function MSs(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??pSs(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),l=(0,xsp.default)(a.toString(),{recursive:!0}),f={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete f.accept,l&&(f.authorization=`${l.type} ${l.token}`);let s;try{s=await vup(u,{headers:f,keepalive:!0}).json()}catch(c){throw c?.response?.status===404?new ESs(e):c}if(t.allVersions)return s;let o=new ASs(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=Isp.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 lZn(e,t){let{version:r}=await MSs(e.toLowerCase(),t);return r}async function Aei({cliEnvironment:e,includePreReleases:t=!1}){return e.packageVersion==="0.0.0"?e.packageVersion:lZn(e.packageName,{version:t?"prerelease":"latest"})}var zsp=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],n_o=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=k0.Info;constructor(t){this.ttyAwareLogger=new Upo(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.51.28"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Su.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new Kk}failWithoutThrowing(t,r){this.didSucceed=!1,Rpo({message:t,error:r,logger:this.logger})}async exit(){this._suppressUpgradeMessage||await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await Cun()).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 iup({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
1926
1926
|
`)||(r+=`
|
|
1927
1927
|
`),this.logger.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram(){process.exit(this.didSucceed?0:1)}longestWorkspaceName;registerWorkspaces(t){let r=S$u(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 KXn(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 Kk}finally{i.finish()}return n}async instrumentPostHogEvent(t){(await Cun()).sendEvent(t)}logger=h6r(this.log.bind(this));constructTaskInitForWorkspace(t){let r=Rsp(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?Rsp(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=zsp[this.numTasks++%zsp.length],u=Su.hex(a)(n);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===IT.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=>WKr.indexOf(i.level)>=WKr.indexOf(this.logLevel));this.ttyAwareLogger.log(r,{includeDebugInfo:this.logLevel===k0.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 Aei({cliEnvironment:this.environment,includePreReleases:t}),i=Tte(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await Vpo({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await N1s({message:t,default:r})}async getInput(t){return await L1s({message:t.message,default:t.default})}};function Rsp(e){return`[${e}]:`}var UEp=require("fs/promises");function NBe({breadcrumbs:e=[],title:t,subtitle:r}){let i=[];return e.length>0&&i.push(Su.blue(e.join(" -> "))),i.push(t),r!=null&&i.push(Su.dim(r)),i.join(`
|
|
1928
1928
|
`)}var cjp=require("fs/promises");var F2t=class e{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;type=e.Type;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 xwe=class extends F2t{definition;sources;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 fZn=class{context;constructor(t){this.context=t}};var a_o=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[u,l]of Object.entries(i.files)){let f=n!=null?Wh.of(`${n}${K3t}${u}`):Wh.of(u);t[f]=l}let a=Object.keys(i.directories).sort();for(let u of a){let l=n!=null?`${n}${K3t}${u}`:u,f=i.directories[u];r(f,l)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split(K3t))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[Wh.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 iSi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new a_o,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 W6r(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"]))pwS(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??pg((Kqe(r)+"/"+nmi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===Wh.of(UN))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=z4a(Kqe(ztn.of(`/${t}`)),ztn.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=z4a(Kqe(ztn.of(`/${t}`)),ztn.of(`/${r}`)),n}addType(t,{name:r,schema:i}){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=>N3t(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=Dz(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:Dz(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:Dz(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===P1?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 pwS(e){return e?.header!=null}var N2t={openapi:e=>({...e,type:"openapi",_visit:function(t){return N2t._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return N2t._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 Rfn={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return Rfn._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var Z4={basic:e=>({...e,type:"basic",_visit:function(t){return Z4._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return Z4._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return Z4._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return Z4._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return Z4._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 A0={primitive:e=>({value:e,type:"primitive",_visit:function(t){return A0._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return A0._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return A0._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return A0._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return A0._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return A0._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return A0._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return A0._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 Jp={int:e=>({value:e,type:"int",_visit:function(t){return Jp._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return Jp._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return Jp._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return Jp._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return Jp._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return Jp._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return Jp._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return Jp._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return Jp._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return Jp._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return Jp._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 Ffn={boolean:e=>({value:e,type:"boolean",_visit:function(t){return Ffn._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return Ffn._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 Mei={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return Mei._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return Mei._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 GL={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case GL.GenerallyAvailable:return t.generallyAvailable();case GL.Beta:return t.beta();case GL.Deprecated:return t.deprecated();default:return t._other()}}};var T8r={cursor:e=>({...e,type:"cursor",_visit:function(t){return T8r._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return T8r._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);default:return t._other(e)}}};var C8r={language:e=>({...e,type:"language",_visit:function(t){return C8r._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return C8r._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 QL={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 QL.Curl:return t.curl();case QL.Python:return t.python();case QL.Javascript:return t.javascript();case QL.Typescript:return t.typescript();case QL.Go:return t.go();case QL.Ruby:return t.ruby();case QL.Csharp:return t.csharp();case QL.Java:return t.java();case QL.Js:return t.js();case QL.Node:return t.node();case QL.Ts:return t.ts();case QL.Nodets:return t.nodets();case QL.Golang:return t.golang();case QL.Dotnet:return t.dotnet();case QL.Jvm:return t.jvm();default:return t._other()}}};var L2t={unknown:e=>({value:e,type:"unknown",_visit:function(t){return L2t._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return L2t._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 LBe={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return LBe._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return LBe._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 RH={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case RH.Get:return t.get();case RH.Post:return t.post();case RH.Put:return t.put();case RH.Patch:return t.patch();case RH.Delete:return t.delete();case RH.Head:return t.head();case RH.Options:return t.options();case RH.Trace:return t.trace();default:return t._other()}}};var qei={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return qei._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return qei._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return qei._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 UBe={file:e=>({...e,type:"file",_visit:function(t){return UBe._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return UBe._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 Cte={file:e=>({...e,type:"file",_visit:function(t){return Cte._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Cte._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return Cte._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return Cte._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return Cte._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return Cte._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"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var ey={primitive:e=>({...e,type:"primitive",_visit:function(t){return ey._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return ey._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return ey._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return ey._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return ey._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return ey._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return ey._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return ey._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return ey._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return ey._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return ey._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 WP={int:e=>({...e,type:"int",_visit:function(t){return WP._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return WP._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return WP._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return WP._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return WP._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return WP._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return WP._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return WP._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return WP._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return WP._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return WP._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 bB={boolean:e=>({value:e,type:"boolean",_visit:function(t){return bB._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return bB._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 B8r={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return B8r._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return B8r._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 Iwe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return Iwe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return Iwe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Iwe._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 gB={file:e=>({...e,type:"file",_visit:function(t){return gB._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return gB._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return gB._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return gB._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return gB._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return gB._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"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var Fl={primitive:e=>({...e,type:"primitive",_visit:function(t){return Fl._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Fl._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Fl._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Fl._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Fl._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Fl._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Fl._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Fl._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Fl._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Fl._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Fl._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 dK={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return dK._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return dK._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 Xd={int:e=>({...e,type:"int",_visit:function(t){return Xd._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Xd._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return Xd._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return Xd._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return Xd._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return Xd._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Xd._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return Xd._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return Xd._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return Xd._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Xd._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 Uy={};Ro(Uy,{AllOfPropertyConflict:()=>odn,ArraySchema:()=>vho,ArraySchemaWithExample:()=>$ho,Availability:()=>h_o,Base64WithExample:()=>Lho,BasicSecurityScheme:()=>b_o,BearerSecurityScheme:()=>g_o,BooleanSchema:()=>fho,BooleanWithExample:()=>Uho,CasingOverrides:()=>P_o,CommonProperty:()=>Sho,CommonPropertyWithExample:()=>eyo,CursorPagination:()=>Z_o,CustomCodeSample:()=>Y_o,CustomCodeSampleLanguage:()=>Q_o,CustomCodeSampleSdk:()=>K_o,DateWithExample:()=>Nho,DatetimeWithExample:()=>Fho,DiscriminatedOneOfSchema:()=>jho,DiscriminatedOneOfSchemaWithExample:()=>Zho,DoubleSchema:()=>cho,DoubleWithExample:()=>zho,Encoding:()=>__o,Endpoint:()=>eho,EndpointExample:()=>tdn,EndpointResponseExample:()=>G_o,EndpointSdkName:()=>aQt,EndpointWithExample:()=>pcp,EnumSchema:()=>Vfn,EnumSchemaWithExample:()=>Who,EnumValue:()=>Bei,ErrorExample:()=>U_o,FernExample:()=>W_o,FileResponse:()=>Yfn,FileSchema:()=>I_o,FloatWithExample:()=>Iho,FullEndpointExample:()=>X_o,FullExample:()=>aM,FullObjectExample:()=>q_o,FullOneOfExample:()=>C_o,GlobalHeader:()=>pho,Header:()=>Iei,HeaderExample:()=>edn,HeaderSecurityScheme:()=>O_o,HeaderWithExample:()=>Fei,HttpEndpointServer:()=>Zfn,HttpError:()=>V_o,HttpErrorWithExample:()=>qho,HttpMethod:()=>$fn,IdempotencyHeader:()=>_ho,Int64WithExample:()=>Cho,IntSchema:()=>uho,IntWithExample:()=>Tho,JsonRequest:()=>F_o,JsonRequestWithExample:()=>Eho,JsonResponse:()=>Xfn,JsonResponseWithExample:()=>cdn,KeyValuePair:()=>T_o,LiteralExample:()=>M_o,LiteralSchema:()=>adn,LiteralSchemaValue:()=>hho,LongSchema:()=>sho,MapSchema:()=>bho,MapSchemaWithExample:()=>Gho,MultipartRequest:()=>Kfn,MultipartRequestProperty:()=>R_o,MultipartSchema:()=>z_o,NamedFullExample:()=>uQt,Namespace:()=>j_o,NamespaceId:()=>A_o,NullableSchema:()=>Oho,NullableSchemaWithExample:()=>Jho,OauthSecurityScheme:()=>S_o,ObjectProperty:()=>Pho,ObjectPropertyConflictInfo:()=>udn,ObjectPropertyWithExample:()=>Xho,ObjectSchema:()=>yho,ObjectSchemaWithExample:()=>Kho,OctetStreamRequest:()=>Jfn,OffsetPagination:()=>k_o,OneOfSchema:()=>mho,OneOfSchemaWithExample:()=>Yho,OpenApiIntermediateRepresentation:()=>fcp,OpenApiSource:()=>l_o,OptionalSchema:()=>gho,OptionalSchemaWithExample:()=>Qho,Pagination:()=>rdn,PathParameter:()=>Gfn,PathParameterExample:()=>H_o,PathParameterWithExample:()=>Dho,PrimitiveExample:()=>Hfn,PrimitiveSchema:()=>Rei,PrimitiveSchemaValue:()=>dho,PrimitiveSchemaValueWithExample:()=>Vho,PrimitiveSchemaWithExample:()=>ldn,PropertyKey:()=>Wfn,ProtobufEncoding:()=>p_o,ProtobufSource:()=>f_o,QueryParameter:()=>Qfn,QueryParameterExample:()=>kfn,QueryParameterWithExample:()=>sdn,QuerySecurityScheme:()=>m_o,ReferencedSchema:()=>oQt,Request:()=>N_o,RequestWithExample:()=>Aho,Response:()=>L_o,ResponseWithExample:()=>Mho,Schema:()=>uO,SchemaId:()=>pK,SchemaWithExample:()=>GE,Schemas:()=>oho,SdkGroup:()=>w_o,SdkGroupInfo:()=>B_o,SdkGroupName:()=>xei,SecurityScheme:()=>D_o,SecuritySchemeId:()=>v_o,Server:()=>E_o,Source:()=>d_o,StatusCode:()=>rQt,StreamingResponseExample:()=>$_o,StringSchema:()=>lho,StringSchemaWithExample:()=>Rho,SupportedSdkLanguage:()=>J_o,Tag:()=>y_o,TagId:()=>_K,Tags:()=>x_o,TextResponse:()=>zei,Uint64WithExample:()=>xho,UintWithExample:()=>Bho,UnDiscriminatedOneOfSchema:()=>who,UnDiscriminatedOneOfSchemaWithExample:()=>kho,UnknownSchemaWithExample:()=>Hho,Webhook:()=>tho,WebhookExampleCall:()=>ndn,WebhookHttpMethod:()=>idn,WebhookWithExample:()=>_cp,WebsocketChannel:()=>aho,WebsocketHandshake:()=>rho,WebsocketHandshakeWithExample:()=>dcp,WebsocketMessageExample:()=>iho,WebsocketSessionExample:()=>nho,WithAvailability:()=>Q_,WithDescription:()=>vf,WithEncoding:()=>Bte,WithInline:()=>MD,WithName:()=>Bb,WithNamespace:()=>nQt,WithSdkGroupName:()=>oO,WithSource:()=>$h,WithStatusCode:()=>iQt,WithTitle:()=>aO,commons:()=>xSs,example:()=>ISs,finalIr:()=>zSs,parseIr:()=>RSs});var xSs={};Ro(xSs,{BasicSecurityScheme:()=>b_o,BearerSecurityScheme:()=>g_o,Encoding:()=>__o,HeaderSecurityScheme:()=>O_o,Namespace:()=>j_o,NamespaceId:()=>A_o,OauthSecurityScheme:()=>S_o,OpenApiSource:()=>l_o,ProtobufEncoding:()=>p_o,ProtobufSource:()=>f_o,QuerySecurityScheme:()=>m_o,SchemaId:()=>pK,SdkGroup:()=>w_o,SdkGroupName:()=>xei,SecurityScheme:()=>D_o,SecuritySchemeId:()=>v_o,Server:()=>E_o,Source:()=>d_o,StatusCode:()=>rQt,Tag:()=>y_o,TagId:()=>_K,WithAvailability:()=>Q_,WithDescription:()=>vf,WithEncoding:()=>Bte,WithInline:()=>MD,WithName:()=>Bb,WithNamespace:()=>nQt,WithSdkGroupName:()=>oO,WithSource:()=>$h,WithStatusCode:()=>iQt,WithTitle:()=>aO});var Ct={};Ro(Ct,{JsonError:()=>Nfn,ParseError:()=>Lfn,any:()=>Zsp,bigint:()=>Nsp,boolean:()=>ksp,booleanLiteral:()=>Xsp,date:()=>Lsp,discriminant:()=>scp,enum_:()=>u_o,getObjectLikeUtils:()=>U2t,getObjectUtils:()=>nSi,getSchemaUtils:()=>nM,isProperty:()=>Cei,lazy:()=>Usp,lazyObject:()=>Jsp,list:()=>c_o,number:()=>ecp,object:()=>s_o,objectWithoutOptionalProperties:()=>Qsp,optional:()=>qSs,property:()=>Wsp,record:()=>ncp,set:()=>acp,string:()=>tcp,stringLiteral:()=>Ysp,transform:()=>TSs,undiscriminatedUnion:()=>ucp,union:()=>lcp,unknown:()=>rcp,withParsedProperties:()=>BSs});var PP={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 $E(e,t){return`Expected ${t}. Received ${_wS(e)}.`}function _wS(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 k4(e){return{...e,json:Fsp(e.json),parse:Fsp(e.parse)}}function Fsp(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(`
|
|
@@ -1983,7 +1983,7 @@ ${U.stack}`)),O}};O=await M();let q=g.apiWorkspaces.flatMap($=>$.getAbsoluteFile
|
|
|
1983
1983
|
`},n)),a}var xUp=require("fs");var MbD=["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"];function qbD({readFile:e=r=>(0,xUp.readFileSync)(r,"utf-8"),...t}){let r=new Set,i=[t],n=[],a=[],u=1e3,l=0;do{if(l++,l>u)throw new Error("Infinite loop detected while collecting links and sources");let f=i.shift();if(f==null)break;let{content:s,absoluteFilepath:o}=f;if(o!=null){if(r.has(o))throw new Error(`Circular import detected: ${o}`);r.add(o)}let c=o?Nta(o):"mdx",b=Lta(s,c),g=n4s(b,{allowDangerousHtml:!0,passThrough:[...MbD]});Nf(g,O=>{if(O.type==="mdxjsEsm"&&o!=null)return O.data?.estree&&iUp(O.data.estree,{enter:m=>{if(m.type==="ImportDeclaration"&&m.source.type==="Literal"&&typeof m.source.value=="string"){let w=yo.of(m.source.value),A=Mm(Mp(o),w);(A.endsWith(".mdx")||A.endsWith(".md"))&&i.push({content:e(A),absoluteFilepath:A})}}}),"skip";if(O.type==="element"){let m=O.properties.href;typeof m=="string"&&n.push({href:m,sourceFilepath:o,position:O.position});let w=O.properties.src;typeof w=="string"&&a.push({src:w,sourceFilepath:o,position:O.position})}if(O.type==="mdxJsxFlowElement"||O.type==="mdxJsxTextElement"){let m=O.attributes.find(A=>A.type==="mdxJsxAttribute"&&A.name==="href"),w=O.attributes.find(A=>A.type==="mdxJsxAttribute"&&A.name==="src");if(O.name==="Markdown"){if(o&&w!=null&&typeof w.value=="string"){let A=Mm(Mp(o),w.value);i.push({content:e(A),absoluteFilepath:A})}return"skip"}m!=null&&typeof m.value=="string"&&n.push({href:m.value,sourceFilepath:o,position:O.position}),w!=null&&typeof w.value=="string"&&a.push({src:w.value,sourceFilepath:o,position:O.position})}})}while(i.length>0);return{links:n,sources:a}}function IUp({content:e,absoluteFilepath:t}){try{return qbD({content:e,absoluteFilepath:t})}catch{return{links:[],sources:[]}}}function zUp({relativeFilepath:e,allRuleVisitors:t,addViolations:r}){function i(n){let a=async(u,l)=>{for(let f of t){let s=f[n];if(s!=null){let o=await s(u);r(o.map(c=>({name:c.name,severity:c.severity,relativeFilepath:e,nodePath:l,message:c.message})))}}};return{[n]:a}}return{...i("file"),...i("filepath"),...i("markdownPage"),...i("versionFile"),...i("apiSection"),...i("permissions")}}var NUp=require("fs/promises");async function fU({absoluteFilepathToConfiguration:e,rawUnresolvedFilepath:t,visitor:r,nodePath:i,willBeUploaded:n=!0}){let a=Mm(Mp(e),t);await r.filepath?.({absoluteFilepath:a,value:t,willBeUploaded:n},[a])}var RUp=require("fs/promises");async function o4s({absolutePathToFernFolder:e,navigation:t,fernWorkspaces:r,visitor:i,absoluteFilepathToConfiguration:n,context:a,nodePath:u}){BbD(t)?await Promise.all(t.map(async(l,f)=>{l.layout!=null&&await Promise.all(l.layout.map(async(s,o)=>{await a4s({absolutePathToFernFolder:e,navigationItem:s,visitor:i,nodePath:[...u,`${f}`,"layout",`${o}`],absoluteFilepathToConfiguration:n,fernWorkspaces:r,context:a})}))})):await Promise.all(t.map(async(l,f)=>{await a4s({absolutePathToFernFolder:e,navigationItem:l,visitor:i,nodePath:[...u,`${f}`],absoluteFilepathToConfiguration:n,fernWorkspaces:r,context:a})}))}async function a4s({absolutePathToFernFolder:e,navigationItem:t,visitor:r,nodePath:i,absoluteFilepathToConfiguration:n,fernWorkspaces:a,context:u}){if(await AUt(t,{alphabetized:Yo,api:Yo,apiName:Yo,audiences:Yo,openrpc:async l=>{l!=null&&await fU({absoluteFilepathToConfiguration:n,rawUnresolvedFilepath:l,visitor:r,nodePath:[...i,"openrpc"],willBeUploaded:!1})},displayErrors:Yo,snippets:Yo,summary:Yo,title:Yo,layout:Yo,icon:Yo,slug:Yo,hidden:Yo,skipSlug:Yo,paginated:Yo,playground:Yo,flattened:Yo,featureFlag:Yo,path:async l=>{l!=null&&await fU({absoluteFilepathToConfiguration:n,rawUnresolvedFilepath:l,visitor:r,nodePath:[...i,"path"],willBeUploaded:!1})},page:Yo,contents:async l=>{l!=null&&await Promise.all(l.map(async(f,s)=>{await a4s({absolutePathToFernFolder:e,navigationItem:f,visitor:r,nodePath:[...i,"contents",`${s}`],absoluteFilepathToConfiguration:n,fernWorkspaces:a,context:u})}))},viewers:async l=>{l!=null&&l.length>0&&await r.permissions?.({viewers:l},[...i,"viewers"])},orphaned:Yo}),TbD(t)){let l=Mm(Mp(n),t.path);if(await zf(l)){let f=(await(0,RUp.readFile)(l)).toString();await r.markdownPage?.({title:t.page,content:f,absoluteFilepath:l},[...i,t.path]);try{let{filepaths:s}=Vta(f,{absolutePathToFernFolder:e,absolutePathToMarkdownFile:l});for(let o of s)await r.filepath?.({absoluteFilepath:o,value:xT(e,o),willBeUploaded:!0},[...i,t.path])}catch{}}}if(CbD(t)){let l=a.find(f=>f.workspaceName===t.apiName);l!=null&&await r.apiSection?.({config:t,workspace:l,context:u},[...i,"api"])}}function TbD(e){return e.page!=null}function CbD(e){return e.api!=null}function BbD(e){return e[0]?.tab!=null}async function LUp({contents:e,visitor:t,absoluteFilepathToConfiguration:r,context:i,fernWorkspaces:n,absolutePathToFernFolder:a}){await t.file?.({config:e},[]),await AUt(e,{instances:Yo,analytics:Yo,announcement:Yo,backgroundImage:async u=>{u!=null&&(typeof u=="string"?await fU({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:u,visitor:t,nodePath:["background-image"]}):(u.dark!=null&&await fU({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:u.dark,visitor:t,nodePath:["background-image","dark"]}),u.light!=null&&await fU({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:u.light,visitor:t,nodePath:["background-image","light"]})))},colors:Yo,css:async u=>{u!=null&&(Array.isArray(u)?await Promise.all(u.map((l,f)=>fU({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:l,visitor:t,nodePath:["css",`${f}`],willBeUploaded:!1}))):await fU({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:u,visitor:t,nodePath:["css"],willBeUploaded:!1}))},defaultLanguage:Yo,experimental:Yo,favicon:async u=>{u!=null&&await fU({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:u,visitor:t,nodePath:["favicon"]})},footerLinks:Yo,integrations:Yo,js:async u=>{u!=null&&(Array.isArray(u)?await Promise.all(u.map((l,f)=>FUp({absoluteFilepathToConfiguration:r,visitor:t,script:l,nodePath:["js",`${f}`]}))):await FUp({absoluteFilepathToConfiguration:r,visitor:t,script:u,nodePath:["js"]}))},landingPage:Yo,layout:Yo,logo:async u=>{e.logo?.dark!=null&&await fU({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:e.logo.dark,visitor:t,nodePath:["logo","dark"]}),e.logo?.light!=null&&await fU({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:e.logo.light,visitor:t,nodePath:["logo","light"]})},metadata:Yo,navbarLinks:Yo,navigation:async u=>{u!=null&&await o4s({absolutePathToFernFolder:a,navigation:u,visitor:t,nodePath:["navigation"],absoluteFilepathToConfiguration:r,fernWorkspaces:n,context:i})},redirects:Yo,tabs:Yo,title:Yo,typography:async u=>{u!=null&&await AUt(u,{bodyFont:async l=>{l!=null&&await u4s({absoluteFilepathToConfiguration:r,visitor:t,font:l,nodePath:["typography","bodyFont"]})},codeFont:async l=>{l!=null&&await u4s({absoluteFilepathToConfiguration:r,visitor:t,font:l,nodePath:["typography","codeFont"]})},headingsFont:async l=>{l!=null&&await u4s({absoluteFilepathToConfiguration:r,visitor:t,font:l,nodePath:["typography","headingsFont"]})}})},versions:async u=>{u!=null&&await Promise.all(u.map(async(l,f)=>{await fU({absoluteFilepathToConfiguration:r,rawUnresolvedFilepath:l.path,visitor:t,nodePath:["versions",`${f}`],willBeUploaded:!1});let s=Mm(Mp(r),l.path),o=pp.load((await(0,NUp.readFile)(s)).toString());await zf(s)&&await t.versionFile?.({path:l.path,content:o},[l.path]);let c=await H1o({value:o});c.type==="success"&&await o4s({absolutePathToFernFolder:a,navigation:c.contents.navigation,visitor:t,nodePath:["navigation"],absoluteFilepathToConfiguration:s,fernWorkspaces:n,context:i})}))},roles:Yo})}async function u4s({absoluteFilepathToConfiguration:e,visitor:t,font:r,nodePath:i}){r.path!=null&&await fU({absoluteFilepathToConfiguration:e,rawUnresolvedFilepath:r.path,visitor:t,nodePath:i,willBeUploaded:!0});for(let n of r.paths??[])typeof n=="string"?await fU({absoluteFilepathToConfiguration:e,rawUnresolvedFilepath:n,visitor:t,nodePath:i,willBeUploaded:!0}):await fU({absoluteFilepathToConfiguration:e,rawUnresolvedFilepath:n.path,visitor:t,nodePath:i,willBeUploaded:!0})}async function FUp({absoluteFilepathToConfiguration:e,visitor:t,script:r,nodePath:i}){let n=typeof r=="string"?r:"path"in r?r.path:null;n&&await fU({absoluteFilepathToConfiguration:e,rawUnresolvedFilepath:n,visitor:t,nodePath:i,willBeUploaded:!0})}var UUp={name:"accent-color-contrast",create:()=>({file:async({config:e})=>{if(e.colors==null)return[];let t=A8a(e.colors);return t==="dark"?J1o(e.colors,"dark"):t==="light"?J1o(e.colors,"light"):t==="darkAndLight"?[...J1o(e.colors,"dark"),...J1o(e.colors,"light")]:[]}})};function J1o(e,t){let r=zVn(e.accentPrimary??e.accentPrimaryDeprecated,"accent-primary",t),i=zVn(e.background,"background",t)??(t==="dark"?"#000":"#FFF"),n=[];if(!Hp(i).isValid())n.push({severity:"fatal",message:`Invalid background color provided for colors.background.${t}: ${i}.`});else{let a=xbD(Hp(i),t);Hp(i).toHexString()!==a.toHexString()&&n.push({severity:"warning",message:`The provided background color for ${t} mode is not ${t} enough. It will be adjusted to ${a.toHexString()}.`}),i=a.toHexString()}if(r==null)n.push({severity:"warning",message:`No accent-color provided for ${t} mode. A random color will be used.`});else if(!Hp(r).isValid())n.push({severity:"fatal",message:`Invalid accent-color provided for colors.accent-primary.${t}: ${r}.`});else{let a=Hp.readability(r,i),u=`${a.toFixed(2)}:1`;a<3?n.push({severity:"warning",message:`The contrast ratio between the accent color and the background color for ${t} mode is ${u}. It should be at least 3:1.`}):a<4.5?n.push({severity:"warning",message:`The contrast ratio between the accent color and the background color for ${t} mode is ${u}. Fern will adjust the color to meet the minimum contrast ratio of 4.5:1 for WCAG AA and 7:1 for WCAG AAA.`}):a<7&&n.push({severity:"warning",message:`The contrast ratio between the accent color and the background color for ${t} mode is ${u}. Fern will adjust the color to meet the minimum contrast ratio of 7:1 for WCAG AAA.`})}return n}function xbD(e,t){return t==="dark"&&e.isDark()||t==="light"&&e.isLight()?e:IbD(e)}function IbD(e){if(e==null)return;let{h:t,s:r,v:i}=e.toHsv();return Hp({h:t,s:r,v:1-i})}var VUp={name:"all-roles-must-be-declared",create:e=>{let t=e.workspace.config.roles;return{permissions:r=>{let i=[...r.viewers??[]],n=[];for(let a of i)(t==null||!t.includes(a))&&n.push({severity:"fatal",message:`Role "${a}" is used but not declared at the top level of the docs.yml file.`});return n}}}};var s4s={name:"filepaths-exist",create:()=>({filepath:async({absoluteFilepath:e,value:t})=>await zf(e)?[]:[{severity:"fatal",message:`Path ${t} does not exist`}]})};var c4s={name:"only-versioned-navigation",create:()=>({file:async({config:e})=>e.navigation!=null&&e.versions!=null?[{severity:"fatal",message:"Cannot contain both navigation and versions. If you want versioned docs, use versions. Otherwise use navigation."}]:[]})};var l4s={name:"playground-environments-exist",create:()=>({apiSection:async({workspace:e,context:t,config:r})=>{let i=(await e.getDefinition({context:t})).rootApiFile.contents.environments,n=new Set(Object.keys(i??{})),a=r.playground?.environments;if(a==null||a.length==null)return[];let u=a.filter(l=>!n.has(l));return u.length===0?[]:u.length===1?[{severity:"fatal",message:`The API does not contain the ${u[0]} environment. ${WUp(Array.from(n))??""}`}]:[{severity:"fatal",message:`The API does not contain the following environments: ${u.join(", ")}. ${WUp(Array.from(n))??""}`}]}})};function WUp(e){if(e.length!==0)return e.length===1&&e[0]!=null?`The only configured environment is ${e[0]}`:`Existing environments include ${e.join(", ")}.`}var f4s={name:"valid-docs-endpoints",create:()=>({file:async({config:e})=>!e.analytics||!Object.keys(e.analytics).length?[]:[[e.analytics.intercom?.apiBase,"Intercom API Base"],[e.analytics.posthog?.endpoint,"Posthog Host Endpoint"]].filter(([i])=>i&&!zbD(i)).map(([i,n])=>({severity:"warning",message:`${n} <${i}> is malformed. Make sure it includes a protocol (e.g. 'https://')!`}))})};function zbD(e){try{return!!new URL(e).protocol}catch{return!1}}var OVp=Di(rVp(),1);var o0D="End-Of-Stream",mI=class extends Error{constructor(){super(o0D)}};var tSo=class{constructor(){this.resolve=()=>null,this.reject=()=>null,this.promise=new Promise((t,r)=>{this.reject=r,this.resolve=t})}};var u0D=1*1024*1024,aia=class{constructor(t){if(this.s=t,this.deferred=null,this.endOfStream=!1,this.peekQueue=[],!t.read||!t.once)throw new Error("Expected an instance of stream.Readable");this.s.once("end",()=>this.reject(new mI)),this.s.once("error",r=>this.reject(r)),this.s.once("close",()=>this.reject(new Error("Stream closed")))}async peek(t,r,i){let n=await this.read(t,r,i);return this.peekQueue.push(t.subarray(r,r+n)),n}async read(t,r,i){if(i===0)return 0;if(this.peekQueue.length===0&&this.endOfStream)throw new mI;let n=i,a=0;for(;this.peekQueue.length>0&&n>0;){let u=this.peekQueue.pop();if(!u)throw new Error("peekData should be defined");let l=Math.min(u.length,n);t.set(u.subarray(0,l),r+a),a+=l,n-=l,l<u.length&&this.peekQueue.push(u.subarray(l))}for(;n>0&&!this.endOfStream;){let u=Math.min(n,u0D),l=await this.readFromStream(t,r+a,u);if(a+=l,l<u)break;n-=l}return a}async readFromStream(t,r,i){let n=this.s.read(i);if(n)return t.set(n,r),n.length;{let a={buffer:t,offset:r,length:i,deferred:new tSo};return this.deferred=a.deferred,this.s.once("readable",()=>{this.readDeferred(a)}),a.deferred.promise}}readDeferred(t){let r=this.s.read(t.length);r?(t.buffer.set(r,t.offset),t.deferred.resolve(r.length),this.deferred=null):this.s.once("readable",()=>{this.readDeferred(t)})}reject(t){this.endOfStream=!0,this.deferred&&(this.deferred.reject(t),this.deferred=null)}};var W4s=require("buffer"),Chn=class{constructor(t){this.position=0,this.numBuffer=new Uint8Array(8),this.fileInfo=t||{}}async readToken(t,r=this.position){let i=W4s.Buffer.alloc(t.len);if(await this.readBuffer(i,{position:r})<t.len)throw new mI;return t.get(i,0)}async peekToken(t,r=this.position){let i=W4s.Buffer.alloc(t.len);if(await this.peekBuffer(i,{position:r})<t.len)throw new mI;return t.get(i,0)}async readNumber(t){if(await this.readBuffer(this.numBuffer,{length:t.len})<t.len)throw new mI;return t.get(this.numBuffer,0)}async peekNumber(t){if(await this.peekBuffer(this.numBuffer,{length:t.len})<t.len)throw new mI;return t.get(this.numBuffer,0)}async ignore(t){if(this.fileInfo.size!==void 0){let r=this.fileInfo.size-this.position;if(t>r)return this.position+=r,r}return this.position+=t,t}async close(){}normalizeOptions(t,r){if(r&&r.position!==void 0&&r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");return r?{mayBeLess:r.mayBeLess===!0,offset:r.offset?r.offset:0,length:r.length?r.length:t.length-(r.offset?r.offset:0),position:r.position?r.position:this.position}:{mayBeLess:!1,offset:0,length:t.length,position:this.position}}};var s0D=256e3,rSo=class extends Chn{constructor(t,r){super(r),this.streamReader=new aia(t)}async getFileInfo(){return this.fileInfo}async readBuffer(t,r){let i=this.normalizeOptions(t,r),n=i.position-this.position;if(n>0)return await this.ignore(n),this.readBuffer(t,r);if(n<0)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");if(i.length===0)return 0;let a=await this.streamReader.read(t,i.offset,i.length);if(this.position+=a,(!r||!r.mayBeLess)&&a<i.length)throw new mI;return a}async peekBuffer(t,r){let i=this.normalizeOptions(t,r),n=0;if(i.position){let a=i.position-this.position;if(a>0){let u=new Uint8Array(i.length+a);return n=await this.peekBuffer(u,{mayBeLess:i.mayBeLess}),t.set(u.subarray(a),i.offset),n-a}else if(a<0)throw new Error("Cannot peek from a negative offset in a stream")}if(i.length>0){try{n=await this.streamReader.peek(t,i.offset,i.length)}catch(a){if(r&&r.mayBeLess&&a instanceof mI)return 0;throw a}if(!i.mayBeLess&&n<i.length)throw new mI}return n}async ignore(t){let r=Math.min(s0D,t),i=new Uint8Array(r),n=0;for(;n<t;){let a=t-n,u=await this.readBuffer(i,{length:Math.min(r,a)});if(u<0)return u;n+=u}return n}};var iSo=class extends Chn{constructor(t,r){super(r),this.uint8Array=t,this.fileInfo.size=this.fileInfo.size?this.fileInfo.size:t.length}async readBuffer(t,r){if(r&&r.position){if(r.position<this.position)throw new Error("`options.position` must be equal or greater than `tokenizer.position`");this.position=r.position}let i=await this.peekBuffer(t,r);return this.position+=i,i}async peekBuffer(t,r){let i=this.normalizeOptions(t,r),n=Math.min(this.uint8Array.length-i.position,i.length);if(!i.mayBeLess&&n<i.length)throw new mI;return t.set(this.uint8Array.subarray(i.position,i.position+n),i.offset),n}async close(){}};function iVp(e,t){return t=t||{},new rSo(e,t)}function nVp(e,t){return new iSo(e,t)}var z5r=require("buffer");var oVp=Di(aVp(),1),uVp=require("buffer");function rre(e){return new DataView(e.buffer,e.byteOffset)}var sVp={len:1,get(e,t){return rre(e).getUint8(t)},put(e,t,r){return rre(e).setUint8(t,r),t+1}},nSo={len:2,get(e,t){return rre(e).getUint16(t,!0)},put(e,t,r){return rre(e).setUint16(t,r,!0),t+2}},aSo={len:2,get(e,t){return rre(e).getUint16(t)},put(e,t,r){return rre(e).setUint16(t,r),t+2}};var cVp={len:4,get(e,t){return rre(e).getUint32(t,!0)},put(e,t,r){return rre(e).setUint32(t,r,!0),t+4}},lVp={len:4,get(e,t){return rre(e).getUint32(t)},put(e,t,r){return rre(e).setUint32(t,r),t+4}};var fVp={len:4,get(e,t){return rre(e).getInt32(t)},put(e,t,r){return rre(e).setInt32(t,r),t+4}};var dVp={len:8,get(e,t){return rre(e).getBigUint64(t,!0)},put(e,t,r){return rre(e).setBigUint64(t,r,!0),t+8}};var I5r=class{constructor(t,r){this.len=t,this.encoding=r}get(t,r){return uVp.Buffer.from(t).toString(this.encoding,r,r+this.len)}},$4s=class e{constructor(t){this.len=t}static decode(t,r,i){let n="";for(let a=r;a<i;++a)n+=e.codePointToString(e.singleByteDecoder(t[a]));return n}static inRange(t,r,i){return r<=t&&t<=i}static codePointToString(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}static singleByteDecoder(t){if(e.inRange(t,0,127))return t;let r=e.windows1252[t-128];if(r===null)throw Error("invaliding encoding");return r}get(t,r=0){return e.decode(t,r,r+this.len)}};$4s.windows1252=[8364,129,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,141,381,143,144,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,157,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255];function pVp(e){return[...e].map(t=>t.charCodeAt(0))}function _Vp(e,t=0){let r=Number.parseInt(e.toString("utf8",148,154).replace(/\0.*$/,"").trim(),8);if(Number.isNaN(r))return!1;let i=8*32;for(let n=t;n<t+148;n++)i+=e[n];for(let n=t+156;n<t+512;n++)i+=e[n];return r===i}var hVp={get:(e,t)=>e[t+3]&127|e[t+2]<<7|e[t+1]<<14|e[t]<<21,len:4};var yVp=["jpg","png","apng","gif","webp","flif","xcf","cr2","cr3","orf","arw","dng","nef","rw2","raf","tif","bmp","icns","jxr","psd","indd","zip","tar","rar","gz","bz2","7z","dmg","mp4","mid","mkv","webm","mov","avi","mpg","mp2","mp3","m4a","oga","ogg","ogv","opus","flac","wav","spx","amr","pdf","epub","elf","macho","exe","swf","rtf","wasm","woff","woff2","eot","ttf","otf","ico","flv","ps","xz","sqlite","nes","crx","xpi","cab","deb","ar","rpm","Z","lz","cfb","mxf","mts","blend","bpg","docx","pptx","xlsx","3gp","3g2","j2c","jp2","jpm","jpx","mj2","aif","qcp","odt","ods","odp","xml","mobi","heic","cur","ktx","ape","wv","dcm","ics","glb","pcap","dsf","lnk","alias","voc","ac3","m4v","m4p","m4b","f4v","f4p","f4b","f4a","mie","asf","ogm","ogx","mpc","arrow","shp","aac","mp1","it","s3m","xm","ai","skp","avif","eps","lzh","pgp","asar","stl","chm","3mf","zst","jxl","vcf","jls","pst","dwg","parquet","class","arj","cpio","ace","avro","icc","fbx"],vVp=["image/jpeg","image/png","image/gif","image/webp","image/flif","image/x-xcf","image/x-canon-cr2","image/x-canon-cr3","image/tiff","image/bmp","image/vnd.ms-photo","image/vnd.adobe.photoshop","application/x-indesign","application/epub+zip","application/x-xpinstall","application/vnd.oasis.opendocument.text","application/vnd.oasis.opendocument.spreadsheet","application/vnd.oasis.opendocument.presentation","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/zip","application/x-tar","application/x-rar-compressed","application/gzip","application/x-bzip2","application/x-7z-compressed","application/x-apple-diskimage","application/x-apache-arrow","video/mp4","audio/midi","video/x-matroska","video/webm","video/quicktime","video/vnd.avi","audio/wav","audio/qcelp","audio/x-ms-asf","video/x-ms-asf","application/vnd.ms-asf","video/mpeg","video/3gpp","audio/mpeg","audio/mp4","audio/opus","video/ogg","audio/ogg","application/ogg","audio/x-flac","audio/ape","audio/wavpack","audio/amr","application/pdf","application/x-elf","application/x-mach-binary","application/x-msdownload","application/x-shockwave-flash","application/rtf","application/wasm","font/woff","font/woff2","application/vnd.ms-fontobject","font/ttf","font/otf","image/x-icon","video/x-flv","application/postscript","application/eps","application/x-xz","application/x-sqlite3","application/x-nintendo-nes-rom","application/x-google-chrome-extension","application/vnd.ms-cab-compressed","application/x-deb","application/x-unix-archive","application/x-rpm","application/x-compress","application/x-lzip","application/x-cfb","application/x-mie","application/mxf","video/mp2t","application/x-blender","image/bpg","image/j2c","image/jp2","image/jpx","image/jpm","image/mj2","audio/aiff","application/xml","application/x-mobipocket-ebook","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/icns","image/ktx","application/dicom","audio/x-musepack","text/calendar","text/vcard","model/gltf-binary","application/vnd.tcpdump.pcap","audio/x-dsf","application/x.ms.shortcut","application/x.apple.alias","audio/x-voc","audio/vnd.dolby.dd-raw","audio/x-m4a","image/apng","image/x-olympus-orf","image/x-sony-arw","image/x-adobe-dng","image/x-nikon-nef","image/x-panasonic-rw2","image/x-fujifilm-raf","video/x-m4v","video/3gpp2","application/x-esri-shape","audio/aac","audio/x-it","audio/x-s3m","audio/x-xm","video/MP1S","video/MP2P","application/vnd.sketchup.skp","image/avif","application/x-lzh-compressed","application/pgp-encrypted","application/x-asar","model/stl","application/vnd.ms-htmlhelp","model/3mf","image/jxl","application/zstd","image/jls","application/vnd.ms-outlook","image/vnd.dwg","application/x-parquet","application/java-vm","application/x-arj","application/x-cpio","application/x-ace-compressed","application/avro","application/vnd.iccprofile","application/x.autodesk.fbx"];var bVp=4100;async function gVp(e){return new G4s().fromBuffer(e)}function cJt(e,t,r){r={offset:0,...r};for(let[i,n]of t.entries())if(r.mask){if(n!==(r.mask[i]&e[i+r.offset]))return!1}else if(n!==e[i+r.offset])return!1;return!0}var G4s=class{constructor(t){this.detectors=t?.customDetectors,this.fromTokenizer=this.fromTokenizer.bind(this),this.fromBuffer=this.fromBuffer.bind(this),this.parse=this.parse.bind(this)}async fromTokenizer(t){let r=t.position;for(let i of this.detectors||[]){let n=await i(t);if(n)return n;if(r!==t.position)return}return this.parse(t)}async fromBuffer(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer))throw new TypeError(`Expected the \`input\` argument to be of type \`Uint8Array\` or \`Buffer\` or \`ArrayBuffer\`, got \`${typeof t}\``);let r=t instanceof Uint8Array?t:new Uint8Array(t);if(r?.length>1)return this.fromTokenizer(nVp(r))}async fromBlob(t){let r=await t.arrayBuffer();return this.fromBuffer(new Uint8Array(r))}async fromStream(t){let r=await iVp(t);try{return await this.fromTokenizer(r)}finally{await r.close()}}async toDetectionStream(t,r={}){let{default:i}=await import("stream"),{sampleSize:n=bVp}=r;return new Promise((a,u)=>{t.on("error",u),t.once("readable",()=>{(async()=>{try{let l=new i.PassThrough,f=i.pipeline?i.pipeline(t,l,()=>{}):t.pipe(l),s=t.read(n)??t.read()??z5r.Buffer.alloc(0);try{l.fileType=await this.fromBuffer(s)}catch(o){o instanceof mI?l.fileType=void 0:u(o)}a(f)}catch(l){u(l)}})()})})}check(t,r){return cJt(this.buffer,t,r)}checkString(t,r){return this.check(pVp(t),r)}async parse(t){if(this.buffer=z5r.Buffer.alloc(bVp),t.fileInfo.size===void 0&&(t.fileInfo.size=Number.MAX_SAFE_INTEGER),this.tokenizer=t,await t.peekBuffer(this.buffer,{length:12,mayBeLess:!0}),this.check([66,77]))return{ext:"bmp",mime:"image/bmp"};if(this.check([11,119]))return{ext:"ac3",mime:"audio/vnd.dolby.dd-raw"};if(this.check([120,1]))return{ext:"dmg",mime:"application/x-apple-diskimage"};if(this.check([77,90]))return{ext:"exe",mime:"application/x-msdownload"};if(this.check([37,33]))return await t.peekBuffer(this.buffer,{length:24,mayBeLess:!0}),this.checkString("PS-Adobe-",{offset:2})&&this.checkString(" EPSF-",{offset:14})?{ext:"eps",mime:"application/eps"}:{ext:"ps",mime:"application/postscript"};if(this.check([31,160])||this.check([31,157]))return{ext:"Z",mime:"application/x-compress"};if(this.check([199,113]))return{ext:"cpio",mime:"application/x-cpio"};if(this.check([96,234]))return{ext:"arj",mime:"application/x-arj"};if(this.check([239,187,191]))return this.tokenizer.ignore(3),this.parse(t);if(this.check([71,73,70]))return{ext:"gif",mime:"image/gif"};if(this.check([73,73,188]))return{ext:"jxr",mime:"image/vnd.ms-photo"};if(this.check([31,139,8]))return{ext:"gz",mime:"application/gzip"};if(this.check([66,90,104]))return{ext:"bz2",mime:"application/x-bzip2"};if(this.checkString("ID3")){await t.ignore(6);let r=await t.readToken(hVp);return t.position+r>t.fileInfo.size?{ext:"mp3",mime:"audio/mpeg"}:(await t.ignore(r),this.fromTokenizer(t))}if(this.checkString("MP+"))return{ext:"mpc",mime:"audio/x-musepack"};if((this.buffer[0]===67||this.buffer[0]===70)&&this.check([87,83],{offset:1}))return{ext:"swf",mime:"application/x-shockwave-flash"};if(this.check([255,216,255]))return this.check([247],{offset:3})?{ext:"jls",mime:"image/jls"}:{ext:"jpg",mime:"image/jpeg"};if(this.check([79,98,106,1]))return{ext:"avro",mime:"application/avro"};if(this.checkString("FLIF"))return{ext:"flif",mime:"image/flif"};if(this.checkString("8BPS"))return{ext:"psd",mime:"image/vnd.adobe.photoshop"};if(this.checkString("WEBP",{offset:8}))return{ext:"webp",mime:"image/webp"};if(this.checkString("MPCK"))return{ext:"mpc",mime:"audio/x-musepack"};if(this.checkString("FORM"))return{ext:"aif",mime:"audio/aiff"};if(this.checkString("icns",{offset:0}))return{ext:"icns",mime:"image/icns"};if(this.check([80,75,3,4])){try{for(;t.position+30<t.fileInfo.size;){await t.readBuffer(this.buffer,{length:30});let r={compressedSize:this.buffer.readUInt32LE(18),uncompressedSize:this.buffer.readUInt32LE(22),filenameLength:this.buffer.readUInt16LE(26),extraFieldLength:this.buffer.readUInt16LE(28)};if(r.filename=await t.readToken(new I5r(r.filenameLength,"utf-8")),await t.ignore(r.extraFieldLength),r.filename==="META-INF/mozilla.rsa")return{ext:"xpi",mime:"application/x-xpinstall"};if(r.filename.endsWith(".rels")||r.filename.endsWith(".xml"))switch(r.filename.split("/")[0]){case"_rels":break;case"word":return{ext:"docx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"};case"ppt":return{ext:"pptx",mime:"application/vnd.openxmlformats-officedocument.presentationml.presentation"};case"xl":return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};default:break}if(r.filename.startsWith("xl/"))return{ext:"xlsx",mime:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"};if(r.filename.startsWith("3D/")&&r.filename.endsWith(".model"))return{ext:"3mf",mime:"model/3mf"};if(r.filename==="mimetype"&&r.compressedSize===r.uncompressedSize){let i=await t.readToken(new I5r(r.compressedSize,"utf-8"));switch(i=i.trim(),i){case"application/epub+zip":return{ext:"epub",mime:"application/epub+zip"};case"application/vnd.oasis.opendocument.text":return{ext:"odt",mime:"application/vnd.oasis.opendocument.text"};case"application/vnd.oasis.opendocument.spreadsheet":return{ext:"ods",mime:"application/vnd.oasis.opendocument.spreadsheet"};case"application/vnd.oasis.opendocument.presentation":return{ext:"odp",mime:"application/vnd.oasis.opendocument.presentation"};default:}}if(r.compressedSize===0){let i=-1;for(;i<0&&t.position<t.fileInfo.size;)await t.peekBuffer(this.buffer,{mayBeLess:!0}),i=this.buffer.indexOf("504B0304",0,"hex"),await t.ignore(i>=0?i:this.buffer.length)}else await t.ignore(r.compressedSize)}}catch(r){if(!(r instanceof mI))throw r}return{ext:"zip",mime:"application/zip"}}if(this.checkString("OggS")){await t.ignore(28);let r=z5r.Buffer.alloc(8);return await t.readBuffer(r),cJt(r,[79,112,117,115,72,101,97,100])?{ext:"opus",mime:"audio/opus"}:cJt(r,[128,116,104,101,111,114,97])?{ext:"ogv",mime:"video/ogg"}:cJt(r,[1,118,105,100,101,111,0])?{ext:"ogm",mime:"video/ogg"}:cJt(r,[127,70,76,65,67])?{ext:"oga",mime:"audio/ogg"}:cJt(r,[83,112,101,101,120,32,32])?{ext:"spx",mime:"audio/ogg"}:cJt(r,[1,118,111,114,98,105,115])?{ext:"ogg",mime:"audio/ogg"}:{ext:"ogx",mime:"application/ogg"}}if(this.check([80,75])&&(this.buffer[2]===3||this.buffer[2]===5||this.buffer[2]===7)&&(this.buffer[3]===4||this.buffer[3]===6||this.buffer[3]===8))return{ext:"zip",mime:"application/zip"};if(this.checkString("ftyp",{offset:4})&&this.buffer[8]&96){let r=this.buffer.toString("binary",8,12).replace("\0"," ").trim();switch(r){case"avif":case"avis":return{ext:"avif",mime:"image/avif"};case"mif1":return{ext:"heic",mime:"image/heif"};case"msf1":return{ext:"heic",mime:"image/heif-sequence"};case"heic":case"heix":return{ext:"heic",mime:"image/heic"};case"hevc":case"hevx":return{ext:"heic",mime:"image/heic-sequence"};case"qt":return{ext:"mov",mime:"video/quicktime"};case"M4V":case"M4VH":case"M4VP":return{ext:"m4v",mime:"video/x-m4v"};case"M4P":return{ext:"m4p",mime:"video/mp4"};case"M4B":return{ext:"m4b",mime:"audio/mp4"};case"M4A":return{ext:"m4a",mime:"audio/x-m4a"};case"F4V":return{ext:"f4v",mime:"video/mp4"};case"F4P":return{ext:"f4p",mime:"video/mp4"};case"F4A":return{ext:"f4a",mime:"audio/mp4"};case"F4B":return{ext:"f4b",mime:"audio/mp4"};case"crx":return{ext:"cr3",mime:"image/x-canon-cr3"};default:return r.startsWith("3g")?r.startsWith("3g2")?{ext:"3g2",mime:"video/3gpp2"}:{ext:"3gp",mime:"video/3gpp"}:{ext:"mp4",mime:"video/mp4"}}}if(this.checkString("MThd"))return{ext:"mid",mime:"audio/midi"};if(this.checkString("wOFF")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff",mime:"font/woff"};if(this.checkString("wOF2")&&(this.check([0,1,0,0],{offset:4})||this.checkString("OTTO",{offset:4})))return{ext:"woff2",mime:"font/woff2"};if(this.check([212,195,178,161])||this.check([161,178,195,212]))return{ext:"pcap",mime:"application/vnd.tcpdump.pcap"};if(this.checkString("DSD "))return{ext:"dsf",mime:"audio/x-dsf"};if(this.checkString("LZIP"))return{ext:"lz",mime:"application/x-lzip"};if(this.checkString("fLaC"))return{ext:"flac",mime:"audio/x-flac"};if(this.check([66,80,71,251]))return{ext:"bpg",mime:"image/bpg"};if(this.checkString("wvpk"))return{ext:"wv",mime:"audio/wavpack"};if(this.checkString("%PDF")){try{await t.ignore(1350);let r=10*1024*1024,i=z5r.Buffer.alloc(Math.min(r,t.fileInfo.size));if(await t.readBuffer(i,{mayBeLess:!0}),i.includes(z5r.Buffer.from("AIPrivateData")))return{ext:"ai",mime:"application/postscript"}}catch(r){if(!(r instanceof mI))throw r}return{ext:"pdf",mime:"application/pdf"}}if(this.check([0,97,115,109]))return{ext:"wasm",mime:"application/wasm"};if(this.check([73,73])){let r=await this.readTiffHeader(!1);if(r)return r}if(this.check([77,77])){let r=await this.readTiffHeader(!0);if(r)return r}if(this.checkString("MAC "))return{ext:"ape",mime:"audio/ape"};if(this.check([26,69,223,163])){async function r(){let l=await t.peekNumber(sVp),f=128,s=0;for(;!(l&f)&&f!==0;)++s,f>>=1;let o=z5r.Buffer.alloc(s+1);return await t.readBuffer(o),o}async function i(){let l=await r(),f=await r();f[0]^=128>>f.length-1;let s=Math.min(6,f.length);return{id:l.readUIntBE(0,l.length),len:f.readUIntBE(f.length-s,s)}}async function n(l){for(;l>0;){let f=await i();if(f.id===17026)return(await t.readToken(new I5r(f.len,"utf-8"))).replaceAll(/\00.*$/g,"");await t.ignore(f.len),--l}}let a=await i();switch(await n(a.len)){case"webm":return{ext:"webm",mime:"video/webm"};case"matroska":return{ext:"mkv",mime:"video/x-matroska"};default:return}}if(this.check([82,73,70,70])){if(this.check([65,86,73],{offset:8}))return{ext:"avi",mime:"video/vnd.avi"};if(this.check([87,65,86,69],{offset:8}))return{ext:"wav",mime:"audio/wav"};if(this.check([81,76,67,77],{offset:8}))return{ext:"qcp",mime:"audio/qcelp"}}if(this.checkString("SQLi"))return{ext:"sqlite",mime:"application/x-sqlite3"};if(this.check([78,69,83,26]))return{ext:"nes",mime:"application/x-nintendo-nes-rom"};if(this.checkString("Cr24"))return{ext:"crx",mime:"application/x-google-chrome-extension"};if(this.checkString("MSCF")||this.checkString("ISc("))return{ext:"cab",mime:"application/vnd.ms-cab-compressed"};if(this.check([237,171,238,219]))return{ext:"rpm",mime:"application/x-rpm"};if(this.check([197,208,211,198]))return{ext:"eps",mime:"application/eps"};if(this.check([40,181,47,253]))return{ext:"zst",mime:"application/zstd"};if(this.check([127,69,76,70]))return{ext:"elf",mime:"application/x-elf"};if(this.check([33,66,68,78]))return{ext:"pst",mime:"application/vnd.ms-outlook"};if(this.checkString("PAR1"))return{ext:"parquet",mime:"application/x-parquet"};if(this.check([207,250,237,254]))return{ext:"macho",mime:"application/x-mach-binary"};if(this.check([79,84,84,79,0]))return{ext:"otf",mime:"font/otf"};if(this.checkString("#!AMR"))return{ext:"amr",mime:"audio/amr"};if(this.checkString("{\\rtf"))return{ext:"rtf",mime:"application/rtf"};if(this.check([70,76,86,1]))return{ext:"flv",mime:"video/x-flv"};if(this.checkString("IMPM"))return{ext:"it",mime:"audio/x-it"};if(this.checkString("-lh0-",{offset:2})||this.checkString("-lh1-",{offset:2})||this.checkString("-lh2-",{offset:2})||this.checkString("-lh3-",{offset:2})||this.checkString("-lh4-",{offset:2})||this.checkString("-lh5-",{offset:2})||this.checkString("-lh6-",{offset:2})||this.checkString("-lh7-",{offset:2})||this.checkString("-lzs-",{offset:2})||this.checkString("-lz4-",{offset:2})||this.checkString("-lz5-",{offset:2})||this.checkString("-lhd-",{offset:2}))return{ext:"lzh",mime:"application/x-lzh-compressed"};if(this.check([0,0,1,186])){if(this.check([33],{offset:4,mask:[241]}))return{ext:"mpg",mime:"video/MP1S"};if(this.check([68],{offset:4,mask:[196]}))return{ext:"mpg",mime:"video/MP2P"}}if(this.checkString("ITSF"))return{ext:"chm",mime:"application/vnd.ms-htmlhelp"};if(this.check([202,254,186,190]))return{ext:"class",mime:"application/java-vm"};if(this.check([253,55,122,88,90,0]))return{ext:"xz",mime:"application/x-xz"};if(this.checkString("<?xml "))return{ext:"xml",mime:"application/xml"};if(this.check([55,122,188,175,39,28]))return{ext:"7z",mime:"application/x-7z-compressed"};if(this.check([82,97,114,33,26,7])&&(this.buffer[6]===0||this.buffer[6]===1))return{ext:"rar",mime:"application/x-rar-compressed"};if(this.checkString("solid "))return{ext:"stl",mime:"model/stl"};if(this.checkString("AC")){let r=this.buffer.toString("binary",2,6);if(r.match("^d*")&&r>=1e3&&r<=1050)return{ext:"dwg",mime:"image/vnd.dwg"}}if(this.checkString("070707"))return{ext:"cpio",mime:"application/x-cpio"};if(this.checkString("BLENDER"))return{ext:"blend",mime:"application/x-blender"};if(this.checkString("!<arch>"))return await t.ignore(8),await t.readToken(new I5r(13,"ascii"))==="debian-binary"?{ext:"deb",mime:"application/x-deb"}:{ext:"ar",mime:"application/x-unix-archive"};if(this.checkString("**ACE",{offset:7})&&(await t.peekBuffer(this.buffer,{length:14,mayBeLess:!0}),this.checkString("**",{offset:12})))return{ext:"ace",mime:"application/x-ace-compressed"};if(this.check([137,80,78,71,13,10,26,10])){await t.ignore(8);async function r(){return{length:await t.readToken(fVp),type:await t.readToken(new I5r(4,"binary"))}}do{let i=await r();if(i.length<0)return;switch(i.type){case"IDAT":return{ext:"png",mime:"image/png"};case"acTL":return{ext:"apng",mime:"image/apng"};default:await t.ignore(i.length+4)}}while(t.position+8<t.fileInfo.size);return{ext:"png",mime:"image/png"}}if(this.check([65,82,82,79,87,49,0,0]))return{ext:"arrow",mime:"application/x-apache-arrow"};if(this.check([103,108,84,70,2,0,0,0]))return{ext:"glb",mime:"model/gltf-binary"};if(this.check([102,114,101,101],{offset:4})||this.check([109,100,97,116],{offset:4})||this.check([109,111,111,118],{offset:4})||this.check([119,105,100,101],{offset:4}))return{ext:"mov",mime:"video/quicktime"};if(this.check([73,73,82,79,8,0,0,0,24]))return{ext:"orf",mime:"image/x-olympus-orf"};if(this.checkString("gimp xcf "))return{ext:"xcf",mime:"image/x-xcf"};if(this.check([73,73,85,0,24,0,0,0,136,231,116,216]))return{ext:"rw2",mime:"image/x-panasonic-rw2"};if(this.check([48,38,178,117,142,102,207,17,166,217])){async function r(){let i=z5r.Buffer.alloc(16);return await t.readBuffer(i),{id:i,size:Number(await t.readToken(dVp))}}for(await t.ignore(30);t.position+24<t.fileInfo.size;){let i=await r(),n=i.size-24;if(cJt(i.id,[145,7,220,183,183,169,207,17,142,230,0,192,12,32,83,101])){let a=z5r.Buffer.alloc(16);if(n-=await t.readBuffer(a),cJt(a,[64,158,105,248,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"audio/x-ms-asf"};if(cJt(a,[192,239,25,188,77,91,207,17,168,253,0,128,95,92,68,43]))return{ext:"asf",mime:"video/x-ms-asf"};break}await t.ignore(n)}return{ext:"asf",mime:"application/vnd.ms-asf"}}if(this.check([171,75,84,88,32,49,49,187,13,10,26,10]))return{ext:"ktx",mime:"image/ktx"};if((this.check([126,16,4])||this.check([126,24,4]))&&this.check([48,77,73,69],{offset:4}))return{ext:"mie",mime:"application/x-mie"};if(this.check([39,10,0,0,0,0,0,0,0,0,0,0],{offset:2}))return{ext:"shp",mime:"application/x-esri-shape"};if(this.check([255,79,255,81]))return{ext:"j2c",mime:"image/j2c"};if(this.check([0,0,0,12,106,80,32,32,13,10,135,10]))switch(await t.ignore(20),await t.readToken(new I5r(4,"ascii"))){case"jp2 ":return{ext:"jp2",mime:"image/jp2"};case"jpx ":return{ext:"jpx",mime:"image/jpx"};case"jpm ":return{ext:"jpm",mime:"image/jpm"};case"mjp2":return{ext:"mj2",mime:"image/mj2"};default:return}if(this.check([255,10])||this.check([0,0,0,12,74,88,76,32,13,10,135,10]))return{ext:"jxl",mime:"image/jxl"};if(this.check([254,255]))return this.check([0,60,0,63,0,120,0,109,0,108],{offset:2})?{ext:"xml",mime:"application/xml"}:void 0;if(this.check([0,0,1,186])||this.check([0,0,1,179]))return{ext:"mpg",mime:"video/mpeg"};if(this.check([0,1,0,0,0]))return{ext:"ttf",mime:"font/ttf"};if(this.check([0,0,1,0]))return{ext:"ico",mime:"image/x-icon"};if(this.check([0,0,2,0]))return{ext:"cur",mime:"image/x-icon"};if(this.check([208,207,17,224,161,177,26,225]))return{ext:"cfb",mime:"application/x-cfb"};if(await t.peekBuffer(this.buffer,{length:Math.min(256,t.fileInfo.size),mayBeLess:!0}),this.check([97,99,115,112],{offset:36}))return{ext:"icc",mime:"application/vnd.iccprofile"};if(this.checkString("BEGIN:")){if(this.checkString("VCARD",{offset:6}))return{ext:"vcf",mime:"text/vcard"};if(this.checkString("VCALENDAR",{offset:6}))return{ext:"ics",mime:"text/calendar"}}if(this.checkString("FUJIFILMCCD-RAW"))return{ext:"raf",mime:"image/x-fujifilm-raf"};if(this.checkString("Extended Module:"))return{ext:"xm",mime:"audio/x-xm"};if(this.checkString("Creative Voice File"))return{ext:"voc",mime:"audio/x-voc"};if(this.check([4,0,0,0])&&this.buffer.length>=16){let r=this.buffer.readUInt32LE(12);if(r>12&&this.buffer.length>=r+16)try{let i=this.buffer.slice(16,r+16).toString();if(JSON.parse(i).files)return{ext:"asar",mime:"application/x-asar"}}catch{}}if(this.check([6,14,43,52,2,5,1,1,13,1,2,1,1,2]))return{ext:"mxf",mime:"application/mxf"};if(this.checkString("SCRM",{offset:44}))return{ext:"s3m",mime:"audio/x-s3m"};if(this.check([71])&&this.check([71],{offset:188}))return{ext:"mts",mime:"video/mp2t"};if(this.check([71],{offset:4})&&this.check([71],{offset:196}))return{ext:"mts",mime:"video/mp2t"};if(this.check([66,79,79,75,77,79,66,73],{offset:60}))return{ext:"mobi",mime:"application/x-mobipocket-ebook"};if(this.check([68,73,67,77],{offset:128}))return{ext:"dcm",mime:"application/dicom"};if(this.check([76,0,0,0,1,20,2,0,0,0,0,0,192,0,0,0,0,0,0,70]))return{ext:"lnk",mime:"application/x.ms.shortcut"};if(this.check([98,111,111,107,0,0,0,0,109,97,114,107,0,0,0,0]))return{ext:"alias",mime:"application/x.apple.alias"};if(this.checkString("Kaydara FBX Binary \0"))return{ext:"fbx",mime:"application/x.autodesk.fbx"};if(this.check([76,80],{offset:34})&&(this.check([0,0,1],{offset:8})||this.check([1,0,2],{offset:8})||this.check([2,0,2],{offset:8})))return{ext:"eot",mime:"application/vnd.ms-fontobject"};if(this.check([6,6,237,245,216,29,70,229,189,49,239,231,254,116,183,29]))return{ext:"indd",mime:"application/x-indesign"};if(await t.peekBuffer(this.buffer,{length:Math.min(512,t.fileInfo.size),mayBeLess:!0}),_Vp(this.buffer))return{ext:"tar",mime:"application/x-tar"};if(this.check([255,254]))return this.check([60,0,63,0,120,0,109,0,108,0],{offset:2})?{ext:"xml",mime:"application/xml"}:this.check([255,14,83,0,107,0,101,0,116,0,99,0,104,0,85,0,112,0,32,0,77,0,111,0,100,0,101,0,108,0],{offset:2})?{ext:"skp",mime:"application/vnd.sketchup.skp"}:void 0;if(this.checkString("-----BEGIN PGP MESSAGE-----"))return{ext:"pgp",mime:"application/pgp-encrypted"};if(this.buffer.length>=2&&this.check([255,224],{offset:0,mask:[255,224]})){if(this.check([16],{offset:1,mask:[22]}))return this.check([8],{offset:1,mask:[8]})?{ext:"aac",mime:"audio/aac"}:{ext:"aac",mime:"audio/aac"};if(this.check([2],{offset:1,mask:[6]}))return{ext:"mp3",mime:"audio/mpeg"};if(this.check([4],{offset:1,mask:[6]}))return{ext:"mp2",mime:"audio/mpeg"};if(this.check([6],{offset:1,mask:[6]}))return{ext:"mp1",mime:"audio/mpeg"}}}async readTiffTag(t){let r=await this.tokenizer.readToken(t?aSo:nSo);switch(this.tokenizer.ignore(10),r){case 50341:return{ext:"arw",mime:"image/x-sony-arw"};case 50706:return{ext:"dng",mime:"image/x-adobe-dng"};default:}}async readTiffIFD(t){let r=await this.tokenizer.readToken(t?aSo:nSo);for(let i=0;i<r;++i){let n=await this.readTiffTag(t);if(n)return n}}async readTiffHeader(t){let r=(t?aSo:nSo).get(this.buffer,2),i=(t?lVp:cVp).get(this.buffer,4);if(r===42){if(i>=6){if(this.checkString("CR",{offset:8}))return{ext:"cr2",mime:"image/x-canon-cr2"};if(i>=8&&(this.check([28,0,254,0],{offset:8})||this.check([31,0,11,0],{offset:8})))return{ext:"nef",mime:"image/x-nikon-nef"}}return await this.tokenizer.ignore(i),await this.readTiffIFD(t)??{ext:"tif",mime:"image/tiff"}}if(r===43)return{ext:"tif",mime:"image/tiff"}}};var mP6=new Set(yVp),PP6=new Set(vVp);var mVp=require("fs/promises"),PVp=Di(require("path"),1);var f0D=new Set(["image/jpeg","image/png","image/gif","image/webp","image/tiff","image/x-icon","video/quicktime","video/mp4","video/webm","audio/mpeg","audio/ogg","audio/wav","application/pdf","application/xml","font/woff","font/woff2","font/otf","font/ttf"]),d0D=new Set(["js","svg"]),p0D=new Set(["ASCII","UTF-8","UTF-16","ISO-8859-1","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9","ISO-8859-10","ISO-8859-13","ISO-8859-14","ISO-8859-15","ISO-8859-16","WINDOWS-1250","WINDOWS-1251","WINDOWS-1252","WINDOWS-1253","WINDOWS-1254","WINDOWS-1255","WINDOWS-1256","WINDOWS-1257","WINDOWS-1258","SHIFT_JIS","SHIFT-JIS","EUC-JP","ISO-2022-JP","BIG5","GB2312","GB18030","KOI8-R"]),Q4s={name:"valid-file-types",create:()=>({filepath:async({absoluteFilepath:e,willBeUploaded:t})=>t?await zf(e)?_0D(e):[]:[]})},_0D=async e=>{let t=new Uint8Array(await(0,mVp.readFile)(e)),r=await gVp(t);if(r!=null)return f0D.has(r.mime)?[]:[{severity:"fatal",message:`The file type of ${r.mime} is not allowed: ${e}`}];let i=PVp.default.extname(e).toLowerCase();if(i.startsWith(".")&&(i=i.substring(1)),d0D.has(i)){let n=OVp.default.detect(t);return n==null?[{severity:"fatal",message:`The encoding of the file could not be detected: ${e}`}]:p0D.has(n.toUpperCase())?[]:[{severity:"fatal",message:`The encoding of ${n} is not allowed: ${e}`}]}return[{severity:"fatal",message:`File is not allowed to be uploaded: ${e}`}]};var jVp=require("fs/promises"),wVp=Di(U4r(),1),J4s={name:"valid-frontmatter",create:()=>({filepath:async({absoluteFilepath:e})=>{if(!e.endsWith(".md")&&!e.endsWith(".mdx"))return[];try{let t=await(0,jVp.readFile)(e,"utf-8");return(0,wVp.default)(t),[]}catch(t){return[{severity:"fatal",message:`Failed to parse frontmatter${t instanceof Error?`: ${t.message}`:""}`}]}}})};var K4s={name:"validate-version-file",create:()=>({versionFile:async({path:e,content:t})=>{let r=await H1o({value:t});return r.type==="success"?[]:[{severity:"fatal",message:`${r.message}`}]}})};function SVp(){return[s4s,c4s,K4s,UUp,Q4s,l4s,f4s,VUp,J4s]}var RVp=require("crypto");var DVp=require("fs"),oSo=class{parse({absoluteFilePath:t}){let r=(0,DVp.readFileSync)(t,"utf-8"),i=r.match(/option\s+csharp_namespace\s*=\s*"([^"]+)";/),n=r.match(/package\s+([a-zA-Z_][\w.]*);/),a=r.match(/service\s+([a-zA-Z_]\w*)\s*{/);return{csharpNamespace:i?.[1],packageName:n?.[1],serviceName:a?.[1]}}};var uSo=class{context;workspace;sourceCache;constructor(t,r){this.context=t,this.workspace=r,this.sourceCache=new Map}resolveSourceOrThrow({source:t,relativeFilepath:r}){let i=this.resolveSource({source:t});if(i==null){if(IWt(t))throw new Error(`Cannot resolve source ${t.proto} from file ${r}`);this.context.logger.warn(`Cannot resolve source ${t.openapi} from file ${r}`)}return i}resolveSource({source:t}){return IWt(t)?this.resolveProtobufSource({source:t}):this.resolveOpenAPISource({source:t})}resolveProtobufSource({source:t}){let r=ku(this.workspace.absoluteFilePath,yo.of(t.proto));if(this.sourceCache.has(r))return this.sourceCache.get(r);if(!o6r(r))return;let n=new oSo().parse({absoluteFilePath:r}),a={type:"protobuf",absoluteFilePath:r,relativeFilePath:yo.of(t.proto),csharpNamespace:n.csharpNamespace,packageName:n.packageName,serviceName:n.serviceName};return this.sourceCache.set(r,a),a}resolveOpenAPISource({source:t}){let r=ku(this.workspace.absoluteFilePath,yo.of(t.openapi));if(this.sourceCache.has(r))return this.sourceCache.get(r);if(!o6r(r))return;let i={type:"openapi",absoluteFilePath:r,relativeFilePath:yo.of(t.openapi)};return this.sourceCache.set(r,i),i}};function h0D(e){for(var t=[],r=0;r<e.length;){var i=e[r];if(i==="*"||i==="+"||i==="?"){t.push({type:"MODIFIER",index:r,value:e[r++]});continue}if(i==="\\"){t.push({type:"ESCAPED_CHAR",index:r++,value:e[r++]});continue}if(i==="{"){t.push({type:"OPEN",index:r,value:e[r++]});continue}if(i==="}"){t.push({type:"CLOSE",index:r,value:e[r++]});continue}if(i===":"){for(var n="",a=r+1;a<e.length;){var u=e.charCodeAt(a);if(u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||u===95){n+=e[a++];continue}break}if(!n)throw new TypeError("Missing parameter name at ".concat(r));t.push({type:"NAME",index:r,value:n}),r=a;continue}if(i==="("){var l=1,f="",a=r+1;if(e[a]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(a));for(;a<e.length;){if(e[a]==="\\"){f+=e[a++]+e[a++];continue}if(e[a]===")"){if(l--,l===0){a++;break}}else if(e[a]==="("&&(l++,e[a+1]!=="?"))throw new TypeError("Capturing groups are not allowed at ".concat(a));f+=e[a++]}if(l)throw new TypeError("Unbalanced pattern at ".concat(r));if(!f)throw new TypeError("Missing pattern at ".concat(r));t.push({type:"PATTERN",index:r,value:f}),r=a;continue}t.push({type:"CHAR",index:r,value:e[r++]})}return t.push({type:"END",index:r,value:""}),t}function EVp(e,t){t===void 0&&(t={});for(var r=h0D(e),i=t.prefixes,n=i===void 0?"./":i,a=t.delimiter,u=a===void 0?"/#?":a,l=[],f=0,s=0,o="",c=function(U){if(s<r.length&&r[s].type===U)return r[s++].value},b=function(U){var H=c(U);if(H!==void 0)return H;var te=r[s],J=te.type,ee=te.index;throw new TypeError("Unexpected ".concat(J," at ").concat(ee,", expected ").concat(U))},g=function(){for(var U="",H;H=c("CHAR")||c("ESCAPED_CHAR");)U+=H;return U},O=function(U){for(var H=0,te=u;H<te.length;H++){var J=te[H];if(U.indexOf(J)>-1)return!0}return!1},m=function(U){var H=l[l.length-1],te=U||(H&&typeof H=="string"?H:"");if(H&&!te)throw new TypeError('Must have text between two parameters, missing text after "'.concat(H.name,'"'));return!te||O(te)?"[^".concat(Tri(u),"]+?"):"(?:(?!".concat(Tri(te),")[^").concat(Tri(u),"])+?")};s<r.length;){var w=c("CHAR"),A=c("NAME"),M=c("PATTERN");if(A||M){var q=w||"";n.indexOf(q)===-1&&(o+=q,q=""),o&&(l.push(o),o=""),l.push({name:A||f++,prefix:q,suffix:"",pattern:M||m(q),modifier:c("MODIFIER")||""});continue}var D=w||c("ESCAPED_CHAR");if(D){o+=D;continue}o&&(l.push(o),o="");var C=c("OPEN");if(C){var q=g(),R=c("NAME")||"",$=c("PATTERN")||"",I=g();b("CLOSE"),l.push({name:R||($?f++:""),pattern:R&&!$?m(q):$,prefix:q,suffix:I,modifier:c("MODIFIER")||""});continue}b("END")}return l}function AVp(e,t){return y0D(EVp(e,t),t)}function y0D(e,t){t===void 0&&(t={});var r=Y4s(t),i=t.encode,n=i===void 0?function(f){return f}:i,a=t.validate,u=a===void 0?!0:a,l=e.map(function(f){if(typeof f=="object")return new RegExp("^(?:".concat(f.pattern,")$"),r)});return function(f){for(var s="",o=0;o<e.length;o++){var c=e[o];if(typeof c=="string"){s+=c;continue}var b=f?f[c.name]:void 0,g=c.modifier==="?"||c.modifier==="*",O=c.modifier==="*"||c.modifier==="+";if(Array.isArray(b)){if(!O)throw new TypeError('Expected "'.concat(c.name,'" to not repeat, but got an array'));if(b.length===0){if(g)continue;throw new TypeError('Expected "'.concat(c.name,'" to not be empty'))}for(var m=0;m<b.length;m++){var w=n(b[m],c);if(u&&!l[o].test(w))throw new TypeError('Expected all "'.concat(c.name,'" to match "').concat(c.pattern,'", but got "').concat(w,'"'));s+=c.prefix+w+c.suffix}continue}if(typeof b=="string"||typeof b=="number"){var w=n(String(b),c);if(u&&!l[o].test(w))throw new TypeError('Expected "'.concat(c.name,'" to match "').concat(c.pattern,'", but got "').concat(w,'"'));s+=c.prefix+w+c.suffix;continue}if(!g){var A=O?"an array":"a string";throw new TypeError('Expected "'.concat(c.name,'" to be ').concat(A))}}return s}}function MVp(e,t){var r=[],i=qVp(e,r,t);return v0D(i,r,t)}function v0D(e,t,r){r===void 0&&(r={});var i=r.decode,n=i===void 0?function(a){return a}:i;return function(a){var u=e.exec(a);if(!u)return!1;for(var l=u[0],f=u.index,s=Object.create(null),o=function(b){if(u[b]===void 0)return"continue";var g=t[b-1];g.modifier==="*"||g.modifier==="+"?s[g.name]=u[b].split(g.prefix+g.suffix).map(function(O){return n(O,g)}):s[g.name]=n(u[b],g)},c=1;c<u.length;c++)o(c);return{path:l,index:f,params:s}}}function Tri(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function Y4s(e){return e&&e.sensitive?"":"i"}function b0D(e,t){if(!t)return e;for(var r=/\((?:\?<(.*?)>)?(?!\?)/g,i=0,n=r.exec(e.source);n;)t.push({name:n[1]||i++,prefix:"",suffix:"",modifier:"",pattern:""}),n=r.exec(e.source);return e}function g0D(e,t,r){var i=e.map(function(n){return qVp(n,t,r).source});return new RegExp("(?:".concat(i.join("|"),")"),Y4s(r))}function O0D(e,t,r){return m0D(EVp(e,r),t,r)}function m0D(e,t,r){r===void 0&&(r={});for(var i=r.strict,n=i===void 0?!1:i,a=r.start,u=a===void 0?!0:a,l=r.end,f=l===void 0?!0:l,s=r.encode,o=s===void 0?function(H){return H}:s,c=r.delimiter,b=c===void 0?"/#?":c,g=r.endsWith,O=g===void 0?"":g,m="[".concat(Tri(O),"]|$"),w="[".concat(Tri(b),"]"),A=u?"^":"",M=0,q=e;M<q.length;M++){var D=q[M];if(typeof D=="string")A+=Tri(o(D));else{var C=Tri(o(D.prefix)),R=Tri(o(D.suffix));if(D.pattern)if(t&&t.push(D),C||R)if(D.modifier==="+"||D.modifier==="*"){var $=D.modifier==="*"?"?":"";A+="(?:".concat(C,"((?:").concat(D.pattern,")(?:").concat(R).concat(C,"(?:").concat(D.pattern,"))*)").concat(R,")").concat($)}else A+="(?:".concat(C,"(").concat(D.pattern,")").concat(R,")").concat(D.modifier);else{if(D.modifier==="+"||D.modifier==="*")throw new TypeError('Can not repeat "'.concat(D.name,'" without a prefix and suffix'));A+="(".concat(D.pattern,")").concat(D.modifier)}else A+="(?:".concat(C).concat(R,")").concat(D.modifier)}}if(f)n||(A+="".concat(w,"?")),A+=r.endsWith?"(?=".concat(m,")"):"$";else{var I=e[e.length-1],U=typeof I=="string"?w.indexOf(I[I.length-1])>-1:I===void 0;n||(A+="(?:".concat(w,"(?=").concat(m,"))?")),U||(A+="(?=".concat(w,"|").concat(m,")"))}return new RegExp(A,Y4s(r))}function qVp(e,t,r){return e instanceof RegExp?b0D(e,t):Array.isArray(e)?g0D(e,t,r):O0D(e,t,r)}function TVp(e){return e.split(/[?#]/)[0]??""}function sSo(e){return e.startsWith("/")?e.slice(1):e}function X4s(e){return e.startsWith("/")?e:`/${e}`}function cSo(e){return e.endsWith("/")?e.slice(0,-1):e}function CVp(e){let t=[];return e.config.instances.forEach(r=>{t.push(r.url),typeof r.customDomain=="string"?t.push(r.customDomain):Array.isArray(r.customDomain)&&t.push(...r.customDomain)}),t}function Z4s(e){let t=new URL(Zwe(e));return{domain:t.host,basePath:t.pathname==="/"||t.pathname===""?void 0:t.pathname}}function P0D(e,t){if(e===t)return{params:{},path:t,index:0};try{return MVp(e)(t)}catch(r){return console.error(r,{pattern:e,path:t}),!1}}function j0D(e,t){try{return AVp(e)(t.params)}catch(r){return console.error(r,{match:t,destination:e}),e}}function BVp(e,t,r=[]){for(let i of r){let n=cSo(w0D(i.source,t.basePath)),a=P0D(n,e);if(a){let u=j0D(i.destination,a);if(!u.startsWith("/"))try{new URL(u)}catch{console.error("Invalid redirect destination:",u);return}return{redirect:{destination:encodeURI(u),permanent:i.permanent??!1}}}}}function w0D(e,t){return t==null||e.startsWith(t)?e:Iv(t,e)}async function k4s({pathname:e,markdown:t,absoluteFilepath:r,workspaceAbsoluteFilePath:i,pageSlugs:n,absoluteFilePathsToSlugs:a,redirects:u=[],baseUrl:l}){e=cSo(e);let f=r!=null?a.get(r)??[]:[];if(e.trim()==="")return!0;if(e.startsWith("/")){let o=xVp(e,l,u);if(t&&n.has(sSo(o)))return!0;let c=ku(i,yo.of(sSo(e)));return await zf(c,"file")?!0:f.map(b=>X4s(b))}if(r!=null){let o=ku(Mp(r),yo.of(e));if(await zf(o,"file"))return!0}if(!t)return f.map(o=>X4s(o));let s=[];for(let o of f){let c=new URL(`/${o}`,Zwe(l.domain)),b=xVp(new URL(e,c).pathname,l,u);n.has(sSo(b))||s.push(o)}return s.length>0?s:!0}function xVp(e,t,r){let i=BVp(e,t,r);return i==null?e:i.redirect.destination}var IVp=/^(?:[a-z+]+:)/gi;function S0D(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);return r?(r[0].match(/\n/g)||[]).length+1:0}function e8s(e,t){return e&&{...e,start:{...e.start,line:e.start.line+t},end:{...e.end,line:e.end.line+t}}}function t8s(e,{absoluteFilepath:t,instanceUrls:r}){let i=[],n=[],a=S0D(e),{links:u,sources:l}=IUp({content:e,absoluteFilepath:t});return u.forEach(f=>{if(f.href.trimStart().match(IVp)){if(!f.href.trimStart().startsWith("http"))return;try{let o=new URL(f.href);if(!r.some(c=>f.href.includes(c)))return;n.push({pathname:o.pathname,sourceFilepath:f.sourceFilepath,position:e8s(f.position,a),markdown:!0})}catch{i.push({severity:"warning",message:`Invalid URL: ${f.href}`})}return}let s=TVp(f.href);s.trim()!==""&&n.push({pathname:s,sourceFilepath:f.sourceFilepath,position:e8s(f.position,a),markdown:!0})}),l.forEach(f=>{if(f.src.match(IVp))try{new URL(f.src)}catch{i.push({severity:"warning",message:`Invalid URL: ${f.src}`});return}else n.push({pathname:f.src,sourceFilepath:f.sourceFilepath,position:e8s(f.position,a),markdown:!1})}),{pathnamesToCheck:n,violations:i}}var lSo=DKu({logger:h6r(Yo)}),oia={name:"valid-markdown-links",create:async({workspace:e,fernWorkspaces:t,ossWorkspaces:r})=>{let i=CVp(e),n=i[0]??"http://localhost",u=await new v6t(n,e,r,t,lSo).resolve();if(!u.config.root)throw new Error("Root node not found");let l=To.migrate.FernNavigationV1ToLatest.create().root(u.config.root),f=To.NodeCollector.collect(l),s=new Set,o=new Map,c=[];return f.slugMap.forEach((b,g)=>{if(s.add(g),b==null||!To.isPage(b))return;To.isApiLeaf(b)&&c.push(b);let O=To.getPageId(b);if(O==null)return;let m=ku(e.absoluteFilePath,yo.of(O)),w=o.get(m)??[];w.push(g),o.set(m,w)}),{markdownPage:async({content:b,absoluteFilepath:g})=>{let O=o.get(g);if(!O||O.length===0)return[];let m="error";O.every(q=>!f.indexablePageSlugs.includes(q))&&(m="warning");let{pathnamesToCheck:w,violations:A}=t8s(b,{absoluteFilepath:g,instanceUrls:i}),M=await Promise.all(w.map(async q=>{let D=await k4s({pathname:q.pathname,markdown:q.markdown,absoluteFilepath:g,workspaceAbsoluteFilePath:e.absoluteFilePath,pageSlugs:s,absoluteFilePathsToSlugs:o,redirects:e.config.redirects,baseUrl:Z4s(i[0]??"http://localhost")});return D===!0?[]:D.map(C=>{let R=zVp(q,C);return{name:oia.name,severity:m,message:R}})}));return[...A,...M.flat()]},apiSection:async({workspace:b,config:g})=>{let O=await b.toFernWorkspace({context:lSo},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1}),m=b2({workspace:O,audiences:g.audiences?{type:"select",audiences:g.audiences}:{type:"all"},generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1},readme:void 0,version:void 0,packageName:void 0,context:lSo,sourceResolver:new uSo(lSo,O)}),w=E0D(Ora(m,(0,RVp.randomUUID)())),A=[];for(let M of c){let q=await A0D(dri.prune(w,M));for(let D of q){let{pathnamesToCheck:C,violations:R}=t8s(D,{instanceUrls:i});A.push(...R);let $=await Promise.all(C.map(async I=>{let U=await k4s({pathname:I.pathname,markdown:I.markdown,workspaceAbsoluteFilePath:e.absoluteFilePath,pageSlugs:s,absoluteFilePathsToSlugs:o,redirects:e.config.redirects,baseUrl:Z4s(i[0]??"http://localhost")});return U===!0?[]:U.map(H=>{let te=zVp(I,H);return{name:oia.name,severity:"error",message:te}})}));A.push(...$.flat())}}return A}}}};function zVp(e,t){return`${D0D(e)}Page (${t}) contains a link to ${Su.bold(e.pathname)} that does not exist.`}function D0D(e){let{position:t,sourceFilepath:r}=e;return r==null||t==null?"":`[${r.toString()}:${t.start.line}:${t.start.column}] `}function E0D(e){return dri.ApiDefinitionV1ToLatest.from(e,{useJavaScriptAsTypeScript:!1,alwaysEnableJavaScriptFetch:!1,usesApplicationJsonInFormDataValue:!1}).migrate()}async function A0D(e){let t=[];return dri.Transformer.descriptions(r=>(typeof r=="string"&&t.push(r),r)).apiDefinition(e),t}async function uia(e,t,r,i,n){let a=n?[oia]:SVp();return M0D({workspace:e,rules:a,context:t,fernWorkspaces:r,ossWorkspaces:i})}async function M0D({workspace:e,rules:t,context:r,fernWorkspaces:i,ossWorkspaces:n}){let a=[],u=await Promise.all(t.map(f=>f.create({workspace:e,fernWorkspaces:i,ossWorkspaces:n,logger:r.logger}))),l=zUp({relativeFilepath:yo.of(H3t),allRuleVisitors:u,addViolations:f=>{a.push(...f)}});return await LUp({contents:e.config,visitor:l,absoluteFilepathToConfiguration:ku(e.absoluteFilePath,yo.of(H3t)),absolutePathToFernFolder:e.absoluteFilePath,context:r,fernWorkspaces:i}),a}async function r8s({workspace:e,fernWorkspaces:t,ossWorkspaces:r,context:i,logWarnings:n,errorOnBrokenLinks:a,logSummary:u=!0}){let l=await uia(e,i,t,r),{hasErrors:f}=qri({violations:l,context:i,logWarnings:n,logSummary:u});return a&&(f=f||l.some(s=>s.name==="valid-markdown-links")),{hasErrors:f}}async function fSo({workspace:e,fernWorkspaces:t,ossWorkspaces:r,context:i,logWarnings:n,errorOnBrokenLinks:a}){let{hasErrors:u}=await r8s({workspace:e,context:i,logWarnings:n,fernWorkspaces:t,ossWorkspaces:r,errorOnBrokenLinks:a});u&&i.failAndThrow()}async function FVp({loadProject:e,cliContext:t,port:r,bundlePath:i}){let n=await e(),a=n.docsWorkspaces;a!=null&&(await t.instrumentPostHogEvent({orgId:n.config.organization,command:"fern docs dev"}),await t.runTaskForWorkspace(a,async u=>{u.logger.info(`Starting server on port ${r}`),await $2s({initialProject:n,reloadProject:e,validateProject:async l=>{let f=l.docsWorkspaces;if(f==null)return;let s=await Promise.all(l.apiWorkspaces.map(async o=>o.toFernWorkspace({context:u})));await r8s({workspace:f,context:u,logWarnings:!0,logSummary:!1,fernWorkspaces:s,ossWorkspaces:await ere(l)});for(let o of s)await t.runTaskForWorkspace(o,async c=>{await t4s({workspace:o,context:c,logWarnings:!1,logSummary:!1})})},context:u,port:r,bundlePath:i})}))}async function NVp({project:e,cliContext:t,shouldFix:r}){await Promise.all(e.apiWorkspaces.map(async i=>{i instanceof s8||await t.runTaskForWorkspace(i,async n=>{await Nhs({workspace:await i.toFernWorkspace({context:n}),context:n,shouldFix:r})})}))}var LVp=Di(require("path"),1);async function Bhn({workspace:e,context:t,generationLanguage:r,keywords:i,smartCasing:n,disableExamples:a,audiences:u,readme:l}){return await oJt({workspace:e,context:t,logWarnings:!1}),b2({workspace:e,generationLanguage:r,keywords:i,smartCasing:n,exampleGeneration:{disabled:a},audiences:u,readme:l,version:void 0,packageName:void 0,context:t,sourceResolver:new y2(t,e)})}async function UVp({project:e,irFilepath:t,cliContext:r,generationLanguage:i,audiences:n,version:a,keywords:u,smartCasing:l}){await Promise.all(e.apiWorkspaces.map(async f=>{await r.runTaskForWorkspace(f,async s=>{r.logger.info(`Generating IR for workspace ${f.workspaceName??"api"}`);let o=await f.toFernWorkspace({context:s}),c=await Bhn({workspace:o,context:s,generationLanguage:i,keywords:u,smartCasing:l,disableExamples:!1,audiences:n,readme:void 0});if(c.dynamic==null)throw new Error("Internal error; dynamic IR was not generated");let b=LVp.default.resolve(t);await c6r(Kl.of(b),c.dynamic),s.logger.info(`Wrote IR to ${b}`)})}))}var VVp=require("fs/promises"),WVp=Di(require("path"),1);async function HVp({project:e,outputFilepath:t,cliContext:r,audiences:i}){await Promise.all(e.apiWorkspaces.map(async n=>{await r.runTaskForWorkspace(n,async a=>{let u=await n.toFernWorkspace({context:a}),l=await Bhn({workspace:u,context:a,generationLanguage:void 0,audiences:i,keywords:void 0,smartCasing:!1,disableExamples:!1,readme:void 0}),f=Xwe({ir:l,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0}}),s=WVp.default.resolve(t);await(0,VVp.writeFile)(s,await d6r(f,{pretty:!0})),a.logger.info(`Wrote FDR API definition to ${s}`)})}))}var qxm=Di(require("path"),1);var Ge=Symbol(),ni=Symbol();var $Vp={laterVersion:"v2",earlierVersion:"v1",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.0.246",[K.TYPESCRIPT_EXPRESS]:"0.0.264",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:ni,[K.STOPLIGHT]:ni,[K.OPENAPI_PYTHON_CLIENT]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({apiName:e.apiName,auth:e.auth,headers:e.headers,types:e.types,services:e.services,constants:e.constants,constantsV2:e.constantsV2,defaultEnvironment:e.defaultEnvironment,environments:e.environments,errorDiscriminant:e.errorDiscriminant,errorDiscriminationStrategy:e.errorDiscriminationStrategy,sdkConfig:e.sdkConfig,errors:e.errors.map(t=>({name:t.name,docs:t.docs,discriminantValue:{originalValue:t.discriminantValueV4.name.unsafeName.originalValue,camelCase:t.discriminantValueV4.name.unsafeName.camelCase,pascalCase:t.discriminantValueV4.name.unsafeName.pascalCase,snakeCase:t.discriminantValueV4.name.unsafeName.snakeCase,screamingSnakeCase:t.discriminantValueV4.name.unsafeName.screamingSnakeCase,wireValue:t.discriminantValueV4.wireValue},discriminantValueV2:t.discriminantValueV2,discriminantValueV3:t.discriminantValueV3,discriminantValueV4:t.discriminantValueV4,type:t.type,typeV2:t.typeV2,typeV3:t.typeV3,http:t.http,statusCode:t.statusCode}))})};var he={};Ro(he,{V1:()=>RPC,V10:()=>FPC,V11:()=>NPC,V12:()=>LPC,V13:()=>UPC,V14:()=>VPC,V15:()=>WPC,V16:()=>HPC,V17:()=>$PC,V18:()=>GPC,V19:()=>QPC,V2:()=>JPC,V20:()=>KPC,V21:()=>YPC,V22:()=>XPC,V23:()=>y00.FernIrV23,V24:()=>v00.FernIrV24,V25:()=>b00.FernIrV25,V26:()=>g00.FernIrV26,V27:()=>O00.FernIrV27,V28:()=>m00.FernIrV28,V29:()=>P00.FernIrV29,V3:()=>ZPC,V30:()=>j00.FernIrV30,V31:()=>w00.FernIrV31,V32:()=>S00.FernIrV32,V33:()=>D00.FernIrV33,V34:()=>E00.FernIrV34,V35:()=>A00.FernIrV35,V36:()=>M00.FernIrV36,V37:()=>q00.FernIrV37,V38:()=>T00.FernIrV38,V39:()=>C00.FernIrV39,V4:()=>kPC,V40:()=>B00.FernIrV40,V41:()=>x00.FernIrV41,V42:()=>I00.FernIrV42,V43:()=>z00.FernIrV43,V44:()=>R00.FernIrV44,V45:()=>F00.FernIrV45,V46:()=>N00.FernIrV46,V47:()=>L00.FernIrV47,V48:()=>U00.FernIrV48,V49:()=>V00.FernIrV49,V5:()=>ejC,V50:()=>W00.FernIrV50,V51:()=>H00.FernIrV51,V52:()=>$00.FernIrV52,V53:()=>G00.FernIrV53,V54:()=>Q00.FernIrV54,V55:()=>Bc,V6:()=>tjC,V7:()=>rjC,V8:()=>ijC,V9:()=>njC});var RPC=Di(LJp(),1),FPC=Di(ut_(),1),NPC=Di(Tu_(),1),LPC=Di(A__(),1),UPC=Di(SO_(),1),VPC=Di(PD_(),1),WPC=Di(gB_(),1),HPC=Di(T3_(),1),$PC=Di(W9_(),1),GPC=Di(tQ_(),1),QPC=Di(yeh(),1),JPC=Di(foh(),1),KPC=Di(Uph(),1),YPC=Di(OOh(),1),XPC=Di(kDh(),1),y00=Di(bTh(),1),v00=Di(tzh(),1),b00=Di(V3h(),1),g00=Di(B8h(),1),O00=Di(AVh(),1),m00=Di(wQh(),1),P00=Di(OZh(),1),ZPC=Di(lay(),1),j00=Di(dly(),1),w00=Di(_hy(),1),S00=Di(Sgy(),1),D00=Di(ric(),1),E00=Di(JMy(),1),A00=Di(WIy(),1),M00=Di(F7y(),1),q00=Di(I9y(),1),T00=Di(I$y(),1),C00=Di(ZXy(),1),kPC=Di(Ynv(),1),B00=Di(pfv(),1),x00=Di(Cvv(),1),I00=Di(tjv(),1),z00=Di(DAv(),1),R00=Di(Zxv(),1),F00=Di(N7v(),1),N00=Di(CLv(),1),L00=Di(MQv(),1),U00=Di(Deb(),1),V00=Di(Dub(),1),ejC=Di(fpb(),1),W00=Di(Ogb(),1),H00=Di(NSb(),1),$00=Di(cBb(),1),G00=Di(R4b(),1),Q00=Di(gJb(),1),tjC=Di(Ee0(),1),rjC=Di(Io0(),1),ijC=Di(Wd0(),1),njC=Di(h00(),1);function J00({inlinedRequest:e,allTypes:t}){let r=new Set,i=t.reduce((n,a)=>({...n,[zyc(a.name)]:a}),{});for(let n of e.extends)K00({typeName:n,typeNameToDeclaration:i,referencedTypes:r});for(let n of e.properties)Qbn({reference:n.valueType,typeNameToDeclaration:i,referencedTypes:r});return[...r].reduce((n,a)=>{let u=i[a];if(u==null)throw new Error("Cannot find declaration for ID: "+a);return[...n,u.name]},[])}function Qbn({reference:e,typeNameToDeclaration:t,referencedTypes:r}){he.V2.types.TypeReference._visit(e,{primitive:Yo,container:i=>{ajC({container:i,typeNameToDeclaration:t,referencedTypes:r})},named:i=>{K00({typeName:i,typeNameToDeclaration:t,referencedTypes:r})},unknown:Yo,void:Yo,_unknown:()=>{throw new Error("Unknown TypeReference: "+e._type)}})}function ajC({container:e,typeNameToDeclaration:t,referencedTypes:r}){he.V2.types.ContainerType._visit(e,{list:i=>{Qbn({reference:i,typeNameToDeclaration:t,referencedTypes:r})},set:i=>{Qbn({reference:i,typeNameToDeclaration:t,referencedTypes:r})},optional:i=>{Qbn({reference:i,typeNameToDeclaration:t,referencedTypes:r})},map:({keyType:i,valueType:n})=>{Qbn({reference:i,typeNameToDeclaration:t,referencedTypes:r}),Qbn({reference:n,typeNameToDeclaration:t,referencedTypes:r})},literal:Yo,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function K00({typeName:e,typeNameToDeclaration:t,referencedTypes:r}){let i=zyc(e);r.add(i);let n=t[i];if(n==null)throw new Error("Cannot locate type: "+i);for(let a of n.referencedTypes)r.add(zyc(a))}function zyc(e){return[...e.fernFilepathV2.map(t=>t.unsafeName.originalValue),e.nameV3.unsafeName.originalValue].join(".")}var Y00={laterVersion:"v3",earlierVersion:"v2",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.0.249",[K.TYPESCRIPT_EXPRESS]:"0.0.264",[K.JAVA]:Ge,[K.JAVA_MODEL]:"0.0.134-3-g97d4964",[K.JAVA_SDK]:"0.0.134-3-g97d4964",[K.JAVA_SPRING]:"0.0.134-3-g97d4964",[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:ni,[K.STOPLIGHT]:ni,[K.OPENAPI_PYTHON_CLIENT]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=[...e.types];return{apiName:e.apiName,auth:e.auth,headers:e.headers,types:t,errors:e.errors,constants:e.constants,constantsV2:e.constantsV2,defaultEnvironment:e.defaultEnvironment,environments:e.environments,errorDiscriminant:e.errorDiscriminant,errorDiscriminationStrategy:e.errorDiscriminationStrategy,sdkConfig:e.sdkConfig,services:{websocket:e.services.websocket,http:e.services.http.map(r=>({availability:r.availability,docs:r.docs,name:r.name,basePath:r.basePath,basePathV2:r.basePathV2,headers:r.headers,pathParameters:r.pathParameters,endpoints:r.endpoints.map(i=>ojC(r,i,e.types,n=>{t.push(n)}))}))}}}};function ojC(e,t,r,i){return{docs:t.docs,availability:t.availability,id:t.id,name:t.name,nameV2:t.nameV2,method:t.method,headers:t.headers,path:t.path,pathParameters:t.pathParameters,queryParameters:t.queryParameters,request:ujC(t,e,r,i),response:t.response,errors:t.errors,errorsV2:t.errorsV2,auth:t.auth}}function ujC(e,t,r,i){let n=e.requestBody;return n==null?{docs:void 0,type:he.V2.types.TypeReference.void(),typeV2:void 0}:he.V3.services.http.HttpRequestBody._visit(n,{reference:a=>({docs:a.docs,type:a.requestBodyType,typeV2:a.requestBodyType}),inlinedRequestBody:a=>{let u={fernFilepath:t.name.fernFilepath,fernFilepathV2:t.name.fernFilepathV2,name:a.name.unsafeName.originalValue,nameV2:{originalValue:a.name.unsafeName.originalValue,camelCase:a.name.unsafeName.camelCase,pascalCase:a.name.unsafeName.pascalCase,snakeCase:a.name.unsafeName.snakeCase,screamingSnakeCase:a.name.unsafeName.screamingSnakeCase},nameV3:a.name},l=he.V2.types.Type.object({extends:a.extends,properties:a.properties.map(s=>({availability:e.availability,docs:s.docs,name:{originalValue:s.name.name.unsafeName.originalValue,camelCase:s.name.name.unsafeName.camelCase,pascalCase:s.name.name.unsafeName.pascalCase,snakeCase:s.name.name.unsafeName.snakeCase,screamingSnakeCase:s.name.name.unsafeName.screamingSnakeCase,wireValue:s.name.wireValue},nameV2:s.name,valueType:s.valueType}))});i({docs:void 0,availability:e.availability,name:u,shape:l,referencedTypes:J00({inlinedRequest:a,allTypes:r}),examples:[]});let f=he.V2.types.TypeReference.named(u);return{docs:void 0,type:f,typeV2:f}},_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+n.type)}})}var k00={laterVersion:"v4",earlierVersion:"v3",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:"0.0.264",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI]:"0.0.11-4-g1c29f6c",[K.POSTMAN]:"0.0.32-rc0",[K.STOPLIGHT]:ni,[K.OPENAPI_PYTHON_CLIENT]:ni,[K.PYTHON_SDK]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({apiName:e.apiName,auth:e.auth,headers:e.headers,types:e.types.map(t=>({docs:t.docs,availability:t.availability,name:t.name,shape:t.shape,examples:t.examples.map(r=>eg0(r.shape)),referencedTypes:t.referencedTypes})),errors:e.errors,constants:e.constants,constantsV2:e.constantsV2,defaultEnvironment:e.defaultEnvironment,environments:e.environments,errorDiscriminant:e.errorDiscriminant,errorDiscriminationStrategy:e.errorDiscriminationStrategy,sdkConfig:e.sdkConfig,services:{...e.services,http:e.services.http.map(t=>({...t,endpoints:t.endpoints.map(r=>({...r,examples:r.examples.map(i=>djC(i))}))}))}})};function eg0(e){return he.V4.types.ExampleTypeShape._visit(e,{object:t=>he.V3.types.ExampleType.object(sjC(t)),union:t=>he.V3.types.ExampleType.union(ljC(t)),alias:t=>he.V3.types.ExampleType.alias(fjC(t)),enum:he.V3.types.ExampleType.enum,_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function sjC(e){return{properties:e.properties.map(t=>({wireKey:t.wireKey,value:rX(t.value),originalTypeDeclaration:t.originalTypeDeclaration}))}}function rX(e){return he.V4.types.ExampleTypeReferenceShape._visit(e.shape,{primitive:he.V3.types.ExampleTypeReference.primitive,container:t=>he.V3.types.ExampleTypeReference.container(cjC(t)),named:t=>he.V3.types.ExampleTypeReference.named(tg0(t)),unknown:he.V3.types.ExampleTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReference: "+e.shape.type)}})}function cjC(e){return he.V4.types.ExampleContainer._visit(e,{list:t=>he.V3.types.ExampleContainer.list(t.map(rX)),set:t=>he.V3.types.ExampleContainer.set(t.map(rX)),optional:t=>he.V3.types.ExampleContainer.optional(t!=null?rX(t):void 0),map:t=>he.V3.types.ExampleContainer.map(t.map(r=>({key:rX(r.key),value:rX(r.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+e.type)}})}function tg0(e){return{typeName:e.typeName,shape:eg0(e.shape)}}function ljC(e){return{wireDiscriminantValue:e.wireDiscriminantValue,properties:he.V4.types.ExampleSingleUnionTypeProperties._visit(e.properties,{samePropertiesAsObject:t=>he.V3.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject(tg0(t)),singleProperty:t=>he.V3.types.ExampleSingleUnionTypeProperties.singleProperty(rX(t)),noProperties:()=>he.V3.types.ExampleSingleUnionTypeProperties.noProperties(),_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+e.properties.type)}})}}function fjC(e){return{value:rX(e.value)}}function djC(e){return{servicePathParameters:e.servicePathParameters.map(t=>X00(t)),endpointPathParameters:e.servicePathParameters.map(t=>X00(t)),serviceHeaders:e.serviceHeaders.map(t=>Z00(t)),endpointHeaders:e.endpointHeaders.map(t=>Z00(t)),queryParameters:e.queryParameters.map(t=>pjC(t)),request:e.request!=null?_jC(e.request):void 0,response:yjC(e.response)}}function X00(e){return{key:e.key,value:rX(e.value)}}function Z00(e){return{key:e.wireKey,value:rX(e.value)}}function pjC(e){return{key:e.wireKey,value:rX(e.value)}}function _jC(e){return he.V4.services.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>he.V3.services.http.ExampleRequestBody.inlinedRequestBody({properties:t.properties.map(r=>hjC(r))}),reference:t=>he.V3.services.http.ExampleRequestBody.reference(rX(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function hjC(e){return{wireKey:e.wireKey,value:rX(e.value),originalTypeDeclaration:e.originalTypeDeclaration}}function yjC(e){return he.V4.services.http.ExampleResponse._visit(e,{ok:t=>he.V3.services.http.ExampleResponse.ok({body:t.body!=null?rX(t.body):void 0}),error:t=>he.V3.services.http.ExampleResponse.error({error:t.error,body:t.body!=null?rX(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}var cCo=class{errors;constructor(t){this.errors=t.errors.reduce((r,i)=>({...r,[rg0(i.name)]:i}),{})}getDeclaration(t){let r=rg0(t),i=this.errors[r];if(i==null)throw new Error("Error does not exist: "+r);return i}};function rg0(e){return`${e.fernFilepath.join("/")}:${e.name.originalName}`}function Z4t(e){return{originalValue:e.originalName,camelCase:e.camelCase.unsafeName,pascalCase:e.pascalCase.unsafeName,snakeCase:e.snakeCase.unsafeName,screamingSnakeCase:e.screamingSnakeCase.unsafeName}}function cSe(e){return{...Z4t(e.name),wireValue:e.wireValue}}function q2(e){return{safeName:{originalValue:e.originalName,camelCase:e.camelCase.safeName,pascalCase:e.pascalCase.safeName,snakeCase:e.snakeCase.safeName,screamingSnakeCase:e.screamingSnakeCase.safeName},unsafeName:{originalValue:e.originalName,camelCase:e.camelCase.unsafeName,pascalCase:e.pascalCase.unsafeName,snakeCase:e.snakeCase.unsafeName,screamingSnakeCase:e.screamingSnakeCase.unsafeName}}}function T2(e){return{wireValue:e.wireValue,name:q2(e.name)}}function aRi(e){return e.map(t=>Z4t(t))}function oRi(e){return e.map(t=>q2(t))}function K8(e){return{fernFilepath:aRi(e.fernFilepath),fernFilepathV2:oRi(e.fernFilepath),name:e.name.originalName,nameV2:Z4t(e.name),nameV3:q2(e.name)}}function BI(e){return he.V5.types.TypeReference._visit(e,{named:t=>he.V4.types.TypeReference.named(K8(t)),container:t=>he.V4.types.TypeReference.container(Jbn(t)),primitive:t=>he.V4.types.TypeReference.primitive(t),unknown:he.V4.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown TypeReference: "+e._type)}})}function Jbn(e){return he.V5.types.ContainerType._visit(e,{list:t=>he.V4.types.ContainerType.list(BI(t)),set:t=>he.V4.types.ContainerType.set(BI(t)),map:({keyType:t,valueType:r})=>he.V4.types.ContainerType.map({keyType:BI(t),valueType:BI(r)}),optional:t=>he.V4.types.ContainerType.optional(BI(t)),literal:t=>he.V5.types.Literal._visit(t,{string:r=>he.V4.types.ContainerType.literal(he.V4.types.Literal.string(r)),_unknown:()=>{throw new Error("Unknown Literal: "+t.type)}}),_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}var lCo=class{types;constructor(t){this.types=t.types.reduce((r,i)=>({...r,[ig0(i.name)]:i}),{})}resolveTypeReference(t){return he.V5.types.TypeReference._visit(t,{container:r=>he.V4.types.ResolvedTypeReference.container(Jbn(r)),named:r=>{let i=this.getTypeDeclaration(r);return i.shape._type==="alias"?this.resolveTypeReference(i.shape.aliasOf):he.V4.types.ResolvedTypeReference.named({name:K8(r),shape:vjC(i.shape._type)})},primitive:he.V4.types.ResolvedTypeReference.primitive,unknown:he.V4.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown TypeReference: "+t._type)}})}getTypeDeclaration(t){let r=ig0(t),i=this.types[r];if(i==null)throw new Error("Type does not exist: "+i);return i}};function ig0(e){return`${e.fernFilepath.join("/")}:${e.name.originalName}`}function vjC(e){switch(e){case"object":return he.V4.types.ShapeType.Object;case"union":return he.V4.types.ShapeType.Union;case"enum":return he.V4.types.ShapeType.Enum;default:Zo(e)}}function uRi(e){return{name:cSe(e.name),nameV2:T2(e.name),valueType:BI(e.valueType),availability:e.availability,docs:e.docs}}function ng0(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>bjC(t))}}function bjC(e){return he.V5.auth.AuthScheme._visit(e,{basic:he.V4.auth.AuthScheme.basic,bearer:he.V4.auth.AuthScheme.bearer,header:t=>he.V4.auth.AuthScheme.header(uRi(t)),_unknown:()=>{throw new Error("Unknown AuthScheme: "+e._type)}})}function ag0(e){return{docs:e.docs,id:e.id,url:e.url,name:q2(e.name)}}function og0({errorDeclaration:e,errorDiscriminationStrategy:t,typeReferenceResolver:r}){let i=e.type!=null?he.V4.types.Type.alias({aliasOf:BI(e.type),resolvedType:r.resolveTypeReference(e.type)}):void 0;return{docs:e.docs,name:{name:e.name.name.originalName,nameV2:Z4t(e.name.name),nameV3:q2(e.name.name),fernFilepath:aRi(e.name.fernFilepath),fernFilepathV2:oRi(e.name.fernFilepath)},discriminantValueV2:T2(e.discriminantValue),discriminantValueV3:he.V5.ir.ErrorDiscriminationStrategy._visit(t,{statusCode:he.V4.errors.ErrorDeclarationDiscriminantValue.statusCode,property:n=>he.V4.errors.ErrorDeclarationDiscriminantValue.property(T2(n.contentProperty)),_unknown:()=>{throw new Error("Unknown ErrorDiscriminationStrategy: "+t.type)}}),discriminantValueV4:T2(e.discriminantValue),type:i??he.V4.types.Type.alias({aliasOf:he.V4.types.TypeReference.void(),resolvedType:he.V4.types.ResolvedTypeReference.void()}),typeV2:i,typeV3:e.type!=null?BI(e.type):e.type,http:{statusCode:e.statusCode},statusCode:e.statusCode}}function iX(e){return{jsonExample:e.jsonExample,shape:ug0(e.shape)}}function ug0(e){return he.V5.types.ExampleTypeReferenceShape._visit(e,{primitive:he.V4.types.ExampleTypeReferenceShape.primitive,container:t=>he.V4.types.ExampleTypeReferenceShape.container(OjC(t)),unknown:he.V4.types.ExampleTypeReferenceShape.unknown,named:t=>he.V4.types.ExampleTypeReferenceShape.named(gjC(t)),_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function gjC(e){return{typeName:K8(e.typeName),shape:fCo(e.shape)}}function OjC(e){return he.V5.types.ExampleContainer._visit(e,{list:t=>he.V4.types.ExampleContainer.list(t.map(r=>iX(r))),set:t=>he.V4.types.ExampleContainer.set(t.map(r=>iX(r))),optional:t=>he.V4.types.ExampleContainer.optional(t!=null?iX(t):void 0),map:t=>he.V4.types.ExampleContainer.map(t.map(r=>({key:iX(r.key),value:iX(r.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+e.type)}})}function fCo(e){return he.V5.types.ExampleTypeShape._visit(e,{alias:t=>he.V4.types.ExampleTypeShape.alias({value:iX(t.value)}),object:t=>he.V4.types.ExampleTypeShape.object({properties:t.properties.map(r=>({wireKey:r.wireKey,value:iX(r.value),originalTypeDeclaration:K8(r.originalTypeDeclaration)}))}),union:t=>he.V4.types.ExampleTypeShape.union({wireDiscriminantValue:t.wireDiscriminantValue,properties:he.V5.types.ExampleSingleUnionTypeProperties._visit(t.properties,{samePropertiesAsObject:r=>he.V4.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:K8(r.typeName),shape:fCo(r.shape)}),singleProperty:r=>he.V4.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:r.jsonExample,shape:ug0(r.shape)}),noProperties:he.V4.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+t.properties.type)}})}),enum:t=>he.V4.types.ExampleTypeShape.enum({wireValue:t.wireValue}),_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function lg0({service:e,errorResolver:t}){return{docs:e.docs,availability:e.availability,displayName:e.displayName,name:mjC(e.name),basePath:PjC(e.basePath),basePathV2:e.basePath,endpoints:e.endpoints.map(r=>jjC({endpoint:r,errorResolver:t})),headers:e.headers.map(r=>uRi(r)),pathParameters:e.pathParameters.map(r=>fg0(r))}}function mjC(e){return{name:e.name.pascalCase.unsafeName,fernFilepath:aRi(e.fernFilepath),fernFilepathV2:oRi(e.fernFilepath)}}function PjC(e){return e.parts.reduce((t,r)=>t+`{${r.pathParameter}}`+r.tail,e.head)}function jjC({endpoint:e,errorResolver:t}){return{docs:e.docs,availability:e.availability,id:e.name.originalName,name:Z4t(e.name),nameV2:q2(e.name),displayName:e.displayName,method:e.method,headers:e.headers.map(r=>uRi(r)),path:e.path,pathParameters:e.pathParameters.map(r=>fg0(r)),queryParameters:e.queryParameters.map(r=>wjC(r)),requestBody:e.requestBody!=null?SjC(e.requestBody):void 0,sdkRequest:e.sdkRequest!=null?DjC(e.sdkRequest):void 0,response:EjC(e.response),errors:e.errors.map(r=>AjC(r)),errorsV2:MjC({responseErrors:e.errors,errorResolver:t}),auth:e.auth,examples:e.examples.map(r=>CjC(r))}}function fg0(e){return{docs:e.docs,availability:e.availability,name:Z4t(e.name),nameV2:q2(e.name),valueType:BI(e.valueType)}}function wjC(e){return{docs:e.docs,availability:e.availability,name:cSe(e.name),nameV2:T2(e.name),valueType:BI(e.valueType),allowMultiple:e.allowMultiple}}function SjC(e){return he.V5.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V4.services.http.HttpRequestBody.inlinedRequestBody({name:q2(t.name),extends:t.extends.map(r=>K8(r)),properties:t.properties.map(r=>({docs:r.docs,name:T2(r.name),valueType:BI(r.valueType)}))}),reference:t=>he.V4.services.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:BI(t.requestBodyType)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+e.type)}})}function DjC(e){return{requestParameterName:q2(e.requestParameterName),shape:he.V5.http.SdkRequestShape._visit(e.shape,{justRequestBody:t=>he.V4.services.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:BI(t.requestBodyType)}),wrapper:t=>he.V4.services.http.SdkRequestShape.wrapper({wrapperName:q2(t.wrapperName),bodyKey:q2(t.bodyKey)}),_unknown:()=>{throw new Error("Unknown SdkRequestShape type: "+e.shape.type)}})}}function EjC(e){let t=e.type!=null?BI(e.type):void 0;return{docs:e.docs,type:t??he.V4.types.TypeReference.void(),typeV2:t}}function AjC(e){return{docs:e.docs,error:Ryc(e.error)}}function MjC({responseErrors:e,errorResolver:t}){return{discriminant:{originalValue:"errorName",camelCase:"errorName",snakeCase:"error_name",pascalCase:"ErrorName",screamingSnakeCase:"ERROR_NAME",wireValue:"errorName"},types:e.map(r=>qjC({responseError:r,errorResolver:t}))}}function qjC({responseError:e,errorResolver:t}){let r=t.getDeclaration(e.error);return{docs:e.docs,discriminantValue:cSe(r.discriminantValue),shape:TjC({responseError:e,declaration:r})}}function TjC({responseError:e,declaration:t}){return t.type==null?he.V4.services.commons.ResponseErrorShape.noProperties():he.V4.services.commons.ResponseErrorShape.singleProperty({name:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT",wireValue:"content"},error:Ryc(e.error)})}function Ryc(e){return{name:e.name.originalName,nameV2:Z4t(e.name),nameV3:q2(e.name),fernFilepath:aRi(e.fernFilepath),fernFilepathV2:oRi(e.fernFilepath)}}function CjC(e){return{docs:e.docs,name:e.name?.originalName,servicePathParameters:e.servicePathParameters.map(t=>sg0(t)),endpointPathParameters:e.endpointPathParameters.map(t=>sg0(t)),serviceHeaders:e.serviceHeaders.map(t=>cg0(t)),endpointHeaders:e.endpointHeaders.map(t=>cg0(t)),queryParameters:e.queryParameters.map(t=>BjC(t)),request:e.request!=null?xjC(e.request):void 0,response:zjC(e.response)}}function sg0(e){return{key:e.key,value:iX(e.value)}}function cg0(e){return{wireKey:e.wireKey,value:iX(e.value)}}function BjC(e){return{wireKey:e.wireKey,value:iX(e.value)}}function xjC(e){return he.V5.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>he.V4.services.http.ExampleRequestBody.inlinedRequestBody({jsonExample:t.jsonExample,properties:t.properties.map(r=>IjC(r))}),reference:t=>he.V4.services.http.ExampleRequestBody.reference(iX(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function IjC(e){return{wireKey:e.wireKey,value:iX(e.value),originalTypeDeclaration:e.originalTypeDeclaration!=null?K8(e.originalTypeDeclaration):void 0}}function zjC(e){return he.V5.http.ExampleResponse._visit(e,{ok:t=>he.V4.services.http.ExampleResponse.ok({body:t.body!=null?iX(t.body):void 0}),error:t=>he.V4.services.http.ExampleResponse.error({error:Ryc(t.error),body:t.body!=null?iX(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}function dg0(e){return{docs:e.docs,availability:e.availability,name:K8(e.name),shape:RjC(e.shape),examples:e.examples.map(t=>FjC(t)),referencedTypes:e.referencedTypes.map(t=>K8(t))}}function RjC(e){return he.V5.types.Type._visit(e,{alias:({aliasOf:t,resolvedType:r})=>he.V4.types.Type.alias({aliasOf:BI(t),resolvedType:NjC(r)}),enum:t=>he.V4.types.Type.enum({values:t.values.map(r=>({docs:r.docs,availability:r.availability,name:cSe(r.name),nameV2:T2(r.name),value:r.name.wireValue}))}),object:t=>he.V4.types.Type.object({extends:t.extends.map(r=>K8(r)),properties:t.properties.map(r=>({docs:r.docs,availability:r.availability,name:cSe(r.name),nameV2:T2(r.name),valueType:BI(r.valueType)}))}),union:t=>he.V4.types.Type.union({discriminant:t.discriminant.wireValue,discriminantV2:cSe(t.discriminant),discriminantV3:T2(t.discriminant),types:t.types.map(r=>({docs:r.docs,discriminantValue:cSe(r.discriminantValue),discriminantValueV2:T2(r.discriminantValue),valueType:he.V5.types.SingleUnionTypeProperties._visit(r.shape,{samePropertiesAsObject:i=>he.V4.types.TypeReference.named(K8(i)),singleProperty:i=>BI(i.type),noProperties:he.V4.types.TypeReference.void,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+r.shape._type)}}),shape:he.V5.types.SingleUnionTypeProperties._visit(r.shape,{samePropertiesAsObject:i=>he.V4.types.SingleUnionTypeProperties.samePropertiesAsObject(K8(i)),singleProperty:i=>he.V4.types.SingleUnionTypeProperties.singleProperty({name:cSe(i.name),nameV2:T2(i.name),type:BI(i.type)}),noProperties:he.V4.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+r.shape._type)}})}))}),_unknown:()=>{throw new Error("Unknown shape: "+e._type)}})}function FjC(e){return{docs:e.docs,jsonExample:e.jsonExample,name:e.name?.originalName,shape:fCo(e.shape)}}function NjC(e){return he.V5.types.ResolvedTypeReference._visit(e,{named:t=>he.V4.types.ResolvedTypeReference.named({name:K8(t.name),shape:LjC(t.shape)}),container:t=>he.V4.types.ResolvedTypeReference.container(Jbn(t)),primitive:he.V4.types.ResolvedTypeReference.primitive,unknown:he.V4.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function LjC(e){return he.V5.types.ShapeType._visit(e,{enum:()=>he.V5.types.ShapeType.Enum,object:()=>he.V5.types.ShapeType.Object,union:()=>he.V5.types.ShapeType.Union,_unknown:()=>{throw new Error("Unknown ShapeType: "+e)}})}var pg0={laterVersion:"v5",earlierVersion:"v4",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.0.257-2-g46fe4ff",[K.TYPESCRIPT_EXPRESS]:"0.0.264",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:"0.0.33-9-gf683b5e",[K.PYTHON_PYDANTIC]:"0.0.33-9-gf683b5e",[K.OPENAPI]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:ni,[K.STOPLIGHT]:ni,[K.OPENAPI_PYTHON_CLIENT]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=new lCo(e),r=new cCo(e);return{apiName:e.apiName.originalName,apiDisplayName:e.apiDisplayName,apiDocs:e.apiDocs,auth:ng0(e.auth),headers:e.headers.map(i=>uRi(i)),types:e.types.map(i=>dg0(i)),services:{http:e.services.map(i=>lg0({service:i,errorResolver:r})),websocket:[]},errors:e.errors.map(i=>og0({errorDeclaration:i,errorDiscriminationStrategy:e.errorDiscriminationStrategy,typeReferenceResolver:t})),constants:{errorDiscriminant:"_error",errorInstanceIdKey:"_errorInstanceId",unknownErrorDiscriminantValue:"_unknown"},constantsV2:{errors:{errorInstanceIdKey:cSe(e.constants.errorInstanceIdKey),errorDiscriminant:{originalValue:"error",camelCase:"error",snakeCase:"error",pascalCase:"Error",screamingSnakeCase:"ERROR",wireValue:"error"},errorContentKey:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT",wireValue:"content"}},errorsV2:{errorInstanceIdKey:T2(e.constants.errorInstanceIdKey),errorDiscriminant:{name:{unsafeName:{originalValue:"error",camelCase:"error",snakeCase:"error",pascalCase:"Error",screamingSnakeCase:"ERROR"},safeName:{originalValue:"error",camelCase:"error",snakeCase:"error",pascalCase:"Error",screamingSnakeCase:"ERROR"}},wireValue:"error"},errorContentKey:{name:{unsafeName:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT"},safeName:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT"}},wireValue:"content"}}},defaultEnvironment:e.defaultEnvironment,environments:e.environments.map(i=>ag0(i)),errorDiscriminant:e.errorDiscriminationStrategy.type==="property"?q2(e.errorDiscriminationStrategy.discriminant.name):void 0,errorDiscriminationStrategy:he.V5.ir.ErrorDiscriminationStrategy._visit(e.errorDiscriminationStrategy,{statusCode:he.V4.ir.ErrorDiscriminationStrategy.statusCode,property:i=>he.V4.ir.ErrorDiscriminationStrategy.property({discriminant:T2(i.discriminant),contentProperty:T2(i.contentProperty)}),_unknown:()=>{throw new Error("Unknown ErrorDiscriminationStrategy: "+e.errorDiscriminationStrategy.type)}}),sdkConfig:e.sdkConfig}}};var _g0={laterVersion:"v6",earlierVersion:"v5",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.0.257-4-ge56e5d2",[K.TYPESCRIPT_EXPRESS]:"0.0.264",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:"0.0.35-1-g071a04a",[K.PYTHON_PYDANTIC]:"0.0.35-1-g071a04a",[K.OPENAPI]:"0.0.16-1-ga2c0ada",[K.STOPLIGHT]:ni,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:ni,[K.OPENAPI_PYTHON_CLIENT]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>({...e,defaultEnvironment:e.environments?.defaultEnvironment,environments:e.environments!=null?he.V6.environment.Environments._visit(e.environments.environments,{singleBaseUrl:i=>i.environments,multipleBaseUrls:()=>t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support specifying multiple URLs for a single environment. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a multiple URls for a single environment."),_unknown:()=>{throw new Error("Unknown Environments: "+e.environments?.environments.type)}}):[]})};var hg0={laterVersion:"v7",earlierVersion:"v6",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.0.268",[K.TYPESCRIPT_EXPRESS]:"0.0.268",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:ni,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:ni,[K.OPENAPI_PYTHON_CLIENT]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,services:e.services.map(t=>{let r=t.name.fernFilepath[t.name.fernFilepath.length-1],i=r!=null?`${r.pascalCase.safeName}Service`:"Service",n=r!=null?`${r.camelCase.unsafeName}Service`:"Service",a=r!=null?`${r.snakeCase.unsafeName}_service`:"service",u=a.toUpperCase(),l=G9(n);return{...t,name:{name:{originalName:i,camelCase:{safeName:n,unsafeName:n},snakeCase:{safeName:a,unsafeName:a},screamingSnakeCase:{safeName:u,unsafeName:u},pascalCase:{safeName:l,unsafeName:l}},fernFilepath:t.name.fernFilepath}}})})};var bg0={laterVersion:"v8",earlierVersion:"v7",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.0.273-5-g1b00245b",[K.TYPESCRIPT_EXPRESS]:"0.0.273-5-g1b00245b",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:"0.0.45-1-g8bb600f",[K.PYTHON_PYDANTIC]:"0.0.45-1-g8bb600f",[K.OPENAPI_PYTHON_CLIENT]:"0.0.0",[K.OPENAPI]:"0.0.20-1-gbbeb9bd",[K.STOPLIGHT]:ni,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,auth:UjC(e.auth),headers:e.headers.map(t=>dCo(t)),types:e.types.map(t=>VjC(t)),errors:e.errors.map(t=>KjC(t)),services:e.services.map(t=>YjC(t))})};function Fyc(e){return e.allParts}function UjC(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:he.V7.auth.AuthScheme.header(dCo(t)))}}function dCo(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:W$(e.valueType)}}function W$(e){return he.V8.types.TypeReference._visit(e,{container:t=>he.V7.types.TypeReference.container(gg0(t)),named:t=>he.V7.types.TypeReference.named(k4t(t)),primitive:he.V7.types.TypeReference.primitive,unknown:he.V7.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function gg0(e){return he.V8.types.ContainerType._visit(e,{list:t=>he.V7.types.ContainerType.list(W$(t)),optional:t=>he.V7.types.ContainerType.optional(W$(t)),set:t=>he.V7.types.ContainerType.set(W$(t)),map:({keyType:t,valueType:r})=>he.V7.types.ContainerType.map({keyType:W$(t),valueType:W$(r)}),literal:he.V7.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function k4t(e){return{name:e.name,fernFilepath:Fyc(e.fernFilepath)}}function VjC(e){return{docs:e.docs,availability:e.availability,name:k4t(e.name),shape:WjC(e.shape),examples:e.examples.map(t=>QjC(t)),referencedTypes:e.referencedTypes.map(t=>k4t(t))}}function WjC(e){return he.V8.types.Type._visit(e,{alias:t=>he.V7.types.Type.alias({aliasOf:W$(t.aliasOf),resolvedType:HjC(t.resolvedType)}),enum:he.V7.types.Type.enum,object:t=>he.V7.types.Type.object({extends:t.extends.map(r=>k4t(r)),properties:t.properties.map(r=>({docs:r.docs,availability:r.availability,name:r.name,valueType:W$(r.valueType)}))}),union:t=>he.V7.types.Type.union({discriminant:t.discriminant,types:t.types.map(r=>$jC(r))}),_unknown:()=>{throw new Error("Unknown Type shape: "+e._type)}})}function HjC(e){return he.V8.types.ResolvedTypeReference._visit(e,{container:t=>he.V7.types.ResolvedTypeReference.container(gg0(t)),named:t=>he.V7.types.ResolvedTypeReference.named({name:k4t(t.name),shape:t.shape}),primitive:he.V7.types.ResolvedTypeReference.primitive,unknown:he.V7.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function $jC(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:GjC(e.shape)}}function GjC(e){return he.V8.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V7.types.SingleUnionTypeProperties.samePropertiesAsObject(k4t(t)),singleProperty:t=>he.V7.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:W$(t.type)}),noProperties:he.V7.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function QjC(e){return{jsonExample:e.jsonExample,docs:e.docs,name:e.name,shape:Nyc(e.shape)}}function Nyc(e){return he.V8.types.ExampleTypeShape._visit(e,{alias:t=>he.V7.types.ExampleTypeShape.alias({value:xie(t.value)}),enum:he.V7.types.ExampleTypeShape.enum,object:t=>he.V7.types.ExampleTypeShape.object({properties:t.properties.map(r=>({wireKey:r.wireKey,value:xie(r.value),originalTypeDeclaration:k4t(r.originalTypeDeclaration)}))}),union:t=>he.V7.types.ExampleTypeShape.union({wireDiscriminantValue:t.wireDiscriminantValue,properties:JjC(t.properties)}),_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function xie(e){return{jsonExample:e.jsonExample,shape:Og0(e.shape)}}function Og0(e){return he.V8.types.ExampleTypeReferenceShape._visit(e,{named:t=>he.V7.types.ExampleTypeReferenceShape.named({typeName:k4t(t.typeName),shape:Nyc(t.shape)}),container:t=>he.V7.types.ExampleTypeReferenceShape.container(he.V8.types.ExampleContainer._visit(t,{list:r=>he.V7.types.ExampleContainer.list(r.map(i=>xie(i))),set:r=>he.V7.types.ExampleContainer.set(r.map(i=>xie(i))),optional:r=>he.V7.types.ExampleContainer.optional(r!=null?xie(r):void 0),map:r=>he.V7.types.ExampleContainer.map(r.map(i=>({key:xie(i.key),value:xie(i.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+t.type)}})),primitive:he.V7.types.ExampleTypeReferenceShape.primitive,unknown:he.V7.types.ExampleTypeReferenceShape.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function JjC(e){return he.V8.types.ExampleSingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V7.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:k4t(t.typeName),shape:Nyc(t.shape)}),singleProperty:t=>he.V7.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:t.jsonExample,shape:Og0(t.shape)}),noProperties:he.V7.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+e.type)}})}function KjC(e){return{docs:e.docs,name:Lyc(e.name),discriminantValue:e.discriminantValue,type:e.type!=null?W$(e.type):void 0,statusCode:e.statusCode}}function Lyc(e){return{name:e.name,fernFilepath:Fyc(e.fernFilepath)}}function YjC(e){return{docs:e.docs,availability:e.availability,name:{fernFilepath:Fyc(e.name.fernFilepath)},displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>mg0(t)),headers:e.headers.map(t=>dCo(t)),endpoints:e.endpoints.map(t=>XjC(t))}}function mg0(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:W$(e.valueType)}}function XjC(e){return{docs:e.docs,availability:e.availability,name:e.name,displayName:e.displayName,errors:e.errors.map(t=>ZjC(t)),auth:e.auth,method:e.method,path:e.path,pathParameters:e.pathParameters.map(t=>mg0(t)),sdkRequest:e.sdkRequest!=null?ewC(e.sdkRequest):void 0,requestBody:e.requestBody!=null?rwC(e.requestBody):void 0,response:iwC(e.response),headers:e.headers.map(t=>dCo(t)),queryParameters:e.queryParameters.map(t=>kjC(t)),examples:e.examples.map(t=>nwC(t))}}function ZjC(e){return{docs:e.docs,error:Lyc(e.error)}}function kjC(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:W$(e.valueType),allowMultiple:e.allowMultiple}}function ewC(e){return{requestParameterName:e.requestParameterName,shape:twC(e.shape)}}function twC(e){return he.V8.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V7.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:W$(t.requestBodyType)}),wrapper:he.V7.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function rwC(e){return he.V8.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V7.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends.map(r=>k4t(r)),properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:W$(r.valueType)}))}),reference:t=>he.V7.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:W$(t.requestBodyType)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function iwC(e){return{docs:e.docs,type:e.type!=null?W$(e.type):void 0}}function nwC(e){return{name:e.name,docs:e.docs,servicePathParameters:e.servicePathParameters.map(t=>yg0(t)),endpointPathParameters:e.endpointPathParameters.map(t=>yg0(t)),queryParameters:e.queryParameters.map(t=>awC(t)),serviceHeaders:e.serviceHeaders.map(t=>vg0(t)),endpointHeaders:e.endpointHeaders.map(t=>vg0(t)),request:e.request!=null?owC(e.request):void 0,response:uwC(e.response)}}function yg0(e){return{key:e.key,value:xie(e.value)}}function awC(e){return{wireKey:e.wireKey,value:xie(e.value)}}function vg0(e){return{wireKey:e.wireKey,value:xie(e.value)}}function owC(e){return he.V8.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>he.V7.http.ExampleRequestBody.inlinedRequestBody({jsonExample:t.jsonExample,properties:t.properties.map(r=>({wireKey:r.wireKey,value:xie(r.value),originalTypeDeclaration:r.originalTypeDeclaration!=null?k4t(r.originalTypeDeclaration):void 0}))}),reference:t=>he.V7.http.ExampleRequestBody.reference(xie(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function uwC(e){return he.V8.http.ExampleResponse._visit(e,{ok:t=>he.V7.http.ExampleResponse.ok({body:t.body!=null?xie(t.body):void 0}),error:t=>he.V7.http.ExampleResponse.error({error:Lyc(t.error),body:t.body!=null?xie(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}var Pg0={laterVersion:"v9",earlierVersion:"v8",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.3.0-2-g85e8aa08",[K.TYPESCRIPT_EXPRESS]:"0.3.0-2-g85e8aa08",[K.JAVA]:Ge,[K.JAVA_MODEL]:"0.0.134-4-gef1ec4f",[K.JAVA_SDK]:"0.0.134-4-gef1ec4f",[K.JAVA_SPRING]:"0.0.134-4-gef1ec4f",[K.PYTHON_FASTAPI]:"0.0.51-1-g977dd1f",[K.PYTHON_PYDANTIC]:"0.0.51-1-g977dd1f",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:ni,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{for(let[i,n]of Object.entries(e.types))n.shape._type==="union"&&n.shape.baseProperties.length>0&&t.failWithoutThrowing(r!=null?`Type ${n.name.name.originalName} uses base-properties. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a union with base-properties.");return t.getResult()===IT.Failure&&t.failAndThrow(),{...e,types:Object.values(e.types),errors:Object.values(e.errors),services:Object.values(e.services)}}};var jg0={laterVersion:"v10",earlierVersion:"v9",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.STOPLIGHT]:ni,[K.OPENAPI]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=cd(e.services,r=>({docs:void 0,...r}));for(let r of Object.values(e.subpackages))if(r.docs!=null&&r.service!=null){let i=t[r.service];if(i==null)throw new Error("Service does not exist: "+r.service);i.docs=r.docs}return{...e,services:t}}};var wg0={laterVersion:"v11",earlierVersion:"v10",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.5.0-rc0-1-g83a12940",[K.TYPESCRIPT_EXPRESS]:"0.5.0-rc0-1-g83a12940",[K.JAVA]:Ge,[K.JAVA_MODEL]:"0.0.134-15-ge1ac358",[K.JAVA_SDK]:"0.0.134-15-ge1ac358",[K.JAVA_SPRING]:"0.0.134-15-ge1ac358",[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.STOPLIGHT]:ni,[K.OPENAPI]:Ge,[K.POSTMAN]:"0.0.40-1-g9aa2117",[K.PYTHON_SDK]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,auth:swC(e.auth,t)})};function swC(e,t){return{...e,schemes:e.schemes.map(r=>cwC(r,t))}}function cwC(e,{taskContext:t,targetGenerator:r}){return he.V11.auth.AuthScheme._visit(e,{bearer:he.V10.auth.AuthScheme.bearer,basic:he.V10.auth.AuthScheme.basic,header:i=>i.prefix!=null?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support specifying an auth header prefix. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains an auth header prefix."):he.V10.auth.AuthScheme.header({docs:i.docs,availability:{status:he.V10.commons.AvailabilityStatus.GeneralAvailability,message:void 0},name:{name:i.name,wireValue:i.header},valueType:i.valueType}),_unknown:()=>{throw new Error("Unknown auth scheme: "+e._type)}})}var Dg0={laterVersion:"v12",earlierVersion:"v11",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.5.0-rc0-6-g80f89f98",[K.TYPESCRIPT_EXPRESS]:"0.5.0-rc0-6-g80f89f98",[K.JAVA]:Ge,[K.JAVA_MODEL]:"0.1.0-1-gdb5c636",[K.JAVA_SDK]:"0.1.0-1-gdb5c636",[K.JAVA_SPRING]:"0.1.0-1-gdb5c636",[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.STOPLIGHT]:"0.0.23-8-g479c860",[K.OPENAPI]:"0.0.22-1-g1c86b58",[K.POSTMAN]:Ge,[K.PYTHON_SDK]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{let i=cd(e.types,n=>({...n,shape:he.V12.types.Type._visit(n.shape,{union:he.V11.types.Type.union,enum:he.V11.types.Type.enum,object:he.V11.types.Type.object,alias:a=>he.V11.types.Type.alias({aliasOf:a.aliasOf,resolvedType:he.V12.types.ResolvedTypeReference._visit(a.resolvedType,{container:he.V11.types.ResolvedTypeReference.container,primitive:he.V11.types.ResolvedTypeReference.primitive,named:u=>u.shape==="UNDISCRIMINATED_UNION"?t.failAndThrow(Sg0({taskContext:t,targetGenerator:r})):he.V11.types.ResolvedTypeReference.named({shape:u.shape,name:u.name}),unknown:he.V11.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Encountered unknown alias")}})}),undiscriminatedUnion:()=>t.failAndThrow(Sg0({taskContext:t,targetGenerator:r})),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,types:i,services:cd(e.services,n=>lwC(n,{taskContext:t,targetGenerator:r}))}}};function Sg0(e){return e.targetGenerator!=null?`Generator ${e.targetGenerator.name}@${e.targetGenerator.version} does not support undiscriminated unions If you'd like to use this feature, please upgrade ${e.targetGenerator.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains an undiscriminated union."}function lwC(e,t){return{...e,endpoints:e.endpoints.map(r=>fwC(r,t))}}function fwC(e,{taskContext:t,targetGenerator:r}){return e.streamingResponse!=null?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support streaming responses. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a streaming response."):{...e,requestBody:e.requestBody!=null?he.V12.http.HttpRequestBody._visit(e.requestBody,{inlinedRequestBody:he.V11.http.HttpRequestBody.inlinedRequestBody,reference:he.V11.http.HttpRequestBody.reference,fileUpload:()=>t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support file upload requests. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a file upload request."),_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+e.requestBody?.type)}}):void 0,response:e.response!=null?{docs:e.response.docs,type:e.response.responseBodyType}:{docs:void 0,type:void 0}}}var Eg0={laterVersion:"v13",earlierVersion:"v12",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,types:cd(e.types,t=>t.shape._type!=="undiscriminatedUnion"?{...t,shape:t.shape}:{...t,shape:he.V12.types.Type.undiscriminatedUnion({docs:void 0,members:t.shape.members})}),auth:{...e.auth,schemes:e.auth.schemes.map(t=>t._type!=="header"?t:{...t,name:t.name.name,header:t.name.wireValue})}})};var Ag0={laterVersion:"v14",earlierVersion:"v13",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:ni,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=cd(e.types,r=>({...r,shape:he.V14.types.Type._visit(r.shape,{union:i=>he.V13.types.Type.union({discriminant:i.discriminant,baseProperties:i.baseProperties.map(n=>({...n,valueType:UF(n.valueType)})),types:i.types.map(n=>_wC(n))}),enum:he.V13.types.Type.enum,object:i=>he.V13.types.Type.object({...i,properties:i.properties.map(n=>({...n,valueType:UF(n.valueType)}))}),alias:i=>he.V13.types.Type.alias({aliasOf:UF(i.aliasOf),resolvedType:ywC(i.resolvedType)}),undiscriminatedUnion:i=>he.V13.types.Type.undiscriminatedUnion(vwC(i)),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:dwC(e.auth),headers:e.headers.map(r=>Wyc(r)),types:t,services:cd(e.services,r=>bwC(r)),errors:cd(e.errors,r=>SwC(r))}}};function dwC(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:he.V13.auth.AuthScheme.header(pwC(t)))}}function pwC(e){return{docs:e.docs,prefix:e.prefix,name:e.name,valueType:UF(e.valueType)}}function Wyc(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:UF(e.valueType)}}function UF(e){return he.V14.types.TypeReference._visit(e,{container:t=>he.V13.types.TypeReference.container(Mg0(t)),primitive:t=>t==="DATE"?he.V13.types.TypeReference.primitive(he.V13.types.PrimitiveType.String):he.V13.types.TypeReference.primitive(t),named:he.V13.types.TypeReference.named,unknown:he.V13.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function Mg0(e){return he.V14.types.ContainerType._visit(e,{list:t=>he.V13.types.ContainerType.list(UF(t)),optional:t=>he.V13.types.ContainerType.optional(UF(t)),set:t=>he.V13.types.ContainerType.set(UF(t)),map:({keyType:t,valueType:r})=>he.V13.types.ContainerType.map({keyType:UF(t),valueType:UF(r)}),literal:he.V13.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function _wC(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:hwC(e.shape)}}function hwC(e){return he.V14.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V13.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V13.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:UF(t.type)}),noProperties:he.V13.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function ywC(e){return he.V14.types.ResolvedTypeReference._visit(e,{container:t=>he.V13.types.ResolvedTypeReference.container(Mg0(t)),named:he.V13.types.ResolvedTypeReference.named,primitive:t=>t==="DATE"?he.V13.types.ResolvedTypeReference.primitive(he.V13.types.PrimitiveType.String):he.V13.types.ResolvedTypeReference.primitive(t),unknown:he.V13.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function vwC(e){return{members:e.members.map(t=>({...t,type:UF(t.type)}))}}function bwC(e){return{availability:e.availability,name:e.name,displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>qg0(t)),headers:e.headers.map(t=>Wyc(t)),endpoints:e.endpoints.map(t=>gwC(t))}}function qg0(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:UF(e.valueType)}}function gwC(e){return{docs:e.docs,availability:e.availability,name:e.name,displayName:e.displayName,errors:e.errors,auth:e.auth,method:e.method,path:e.path,pathParameters:e.pathParameters.map(t=>qg0(t)),sdkRequest:e.sdkRequest!=null?mwC(e.sdkRequest):void 0,requestBody:e.requestBody!=null?jwC(e.requestBody):void 0,response:e.response!=null?Uyc(e.response):void 0,headers:e.headers.map(t=>Wyc(t)),queryParameters:e.queryParameters.map(t=>OwC(t)),examples:e.examples,streamingResponse:e.streamingResponse!=null?Vyc(e.streamingResponse):void 0,sdkResponse:e.sdkResponse!=null?wwC(e.sdkResponse):void 0}}function OwC(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:UF(e.valueType),allowMultiple:e.allowMultiple}}function mwC(e){return{requestParameterName:e.requestParameterName,shape:PwC(e.shape)}}function PwC(e){return he.V14.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V13.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:UF(t.requestBodyType)}),wrapper:he.V13.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function jwC(e){return he.V14.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V13.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends,properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:UF(r.valueType)}))}),reference:t=>he.V13.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:UF(t.requestBodyType)}),fileUpload:t=>he.V13.http.HttpRequestBody.fileUpload({name:t.name,properties:t.properties.map(r=>r.type==="bodyProperty"?{...r,valueType:UF(r.valueType)}:r)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Uyc(e){return{docs:e.docs,responseBodyType:UF(e.responseBodyType)}}function Vyc(e){return{dataEventType:UF(e.dataEventType),terminator:e.terminator}}function wwC(e){return he.V14.http.SdkResponse._visit(e,{streaming:t=>he.V13.http.SdkResponse.streaming(Vyc(t)),nonStreaming:t=>he.V13.http.SdkResponse.nonStreaming(Uyc(t)),maybeStreaming:t=>he.V13.http.SdkResponse.maybeStreaming({condition:t.condition,nonStreaming:Uyc(t.nonStreaming),streaming:Vyc(t.streaming)}),_unknown:()=>{throw new Error("Encountered unknown sdk response")}})}function SwC(e){return{docs:e.docs,name:e.name,discriminantValue:e.discriminantValue,type:e.type!=null?UF(e.type):void 0,statusCode:e.statusCode}}var Tg0={laterVersion:"v15",earlierVersion:"v14",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:"0.0.52-3-gd9df38df",[K.PYTHON_PYDANTIC]:"0.0.52-3-gd9df38df",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"0.0.52-3-gd9df38df",[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=cd(e.types,r=>({...r,shape:he.V15.types.Type._visit(r.shape,{union:i=>he.V14.types.Type.union({discriminant:i.discriminant,baseProperties:i.baseProperties.map(n=>({...n,valueType:VF(n.valueType)})),types:i.types.map(n=>AwC(n))}),enum:he.V14.types.Type.enum,object:i=>he.V14.types.Type.object({...i,properties:i.properties.map(n=>({...n,valueType:VF(n.valueType)}))}),alias:i=>he.V14.types.Type.alias({aliasOf:VF(i.aliasOf),resolvedType:qwC(i.resolvedType)}),undiscriminatedUnion:i=>he.V14.types.Type.undiscriminatedUnion(TwC(i)),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:DwC(e.auth),headers:e.headers.map(r=>Gyc(r)),types:t,services:cd(e.services,r=>CwC(r)),errors:cd(e.errors,r=>NwC(r))}}};function DwC(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:he.V14.auth.AuthScheme.header(EwC(t)))}}function EwC(e){return{docs:e.docs,prefix:e.prefix,name:e.name,valueType:VF(e.valueType)}}function Gyc(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:VF(e.valueType)}}function VF(e){return he.V15.types.TypeReference._visit(e,{container:t=>he.V14.types.TypeReference.container(Cg0(t)),primitive:t=>t==="BASE_64"?he.V14.types.TypeReference.primitive(he.V14.types.PrimitiveType.String):he.V14.types.TypeReference.primitive(t),named:he.V14.types.TypeReference.named,unknown:he.V14.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function Cg0(e){return he.V15.types.ContainerType._visit(e,{list:t=>he.V14.types.ContainerType.list(VF(t)),optional:t=>he.V14.types.ContainerType.optional(VF(t)),set:t=>he.V14.types.ContainerType.set(VF(t)),map:({keyType:t,valueType:r})=>he.V14.types.ContainerType.map({keyType:VF(t),valueType:VF(r)}),literal:he.V14.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function AwC(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:MwC(e.shape)}}function MwC(e){return he.V15.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V14.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V14.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:VF(t.type)}),noProperties:he.V14.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function qwC(e){return he.V15.types.ResolvedTypeReference._visit(e,{container:t=>he.V14.types.ResolvedTypeReference.container(Cg0(t)),named:he.V14.types.ResolvedTypeReference.named,primitive:t=>t==="BASE_64"?he.V14.types.ResolvedTypeReference.primitive(he.V14.types.PrimitiveType.String):he.V14.types.ResolvedTypeReference.primitive(t),unknown:he.V14.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function TwC(e){return{members:e.members.map(t=>({...t,type:VF(t.type)}))}}function CwC(e){return{availability:e.availability,name:e.name,displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>Bg0(t)),headers:e.headers.map(t=>Gyc(t)),endpoints:e.endpoints.map(t=>BwC(t))}}function Bg0(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:VF(e.valueType)}}function BwC(e){return{docs:e.docs,availability:e.availability,name:e.name,displayName:e.displayName,errors:e.errors,auth:e.auth,method:e.method,path:e.path,pathParameters:e.pathParameters.map(t=>Bg0(t)),sdkRequest:e.sdkRequest!=null?IwC(e.sdkRequest):void 0,requestBody:e.requestBody!=null?RwC(e.requestBody):void 0,response:e.response!=null?Hyc(e.response):void 0,headers:e.headers.map(t=>Gyc(t)),queryParameters:e.queryParameters.map(t=>xwC(t)),examples:e.examples,streamingResponse:e.streamingResponse!=null?$yc(e.streamingResponse):void 0,sdkResponse:e.sdkResponse!=null?FwC(e.sdkResponse):void 0}}function xwC(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:VF(e.valueType),allowMultiple:e.allowMultiple}}function IwC(e){return{requestParameterName:e.requestParameterName,shape:zwC(e.shape)}}function zwC(e){return he.V15.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V14.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:VF(t.requestBodyType)}),wrapper:he.V14.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function RwC(e){return he.V15.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V14.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends,properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:VF(r.valueType)}))}),reference:t=>he.V14.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:VF(t.requestBodyType)}),fileUpload:t=>he.V14.http.HttpRequestBody.fileUpload({name:t.name,properties:t.properties.map(r=>r.type==="bodyProperty"?{...r,valueType:VF(r.valueType)}:r)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Hyc(e){return{docs:e.docs,responseBodyType:VF(e.responseBodyType)}}function $yc(e){return{dataEventType:VF(e.dataEventType),terminator:e.terminator}}function FwC(e){return he.V15.http.SdkResponse._visit(e,{streaming:t=>he.V14.http.SdkResponse.streaming($yc(t)),nonStreaming:t=>he.V14.http.SdkResponse.nonStreaming(Hyc(t)),maybeStreaming:t=>he.V14.http.SdkResponse.maybeStreaming({condition:t.condition,nonStreaming:Hyc(t.nonStreaming),streaming:$yc(t.streaming)}),_unknown:()=>{throw new Error("Encountered unknown sdk response")}})}function NwC(e){return{docs:e.docs,name:e.name,discriminantValue:e.discriminantValue,type:e.type!=null?VF(e.type):void 0,statusCode:e.statusCode}}var xg0={laterVersion:"v16",earlierVersion:"v15",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.5.4-1-g4e69d312",[K.TYPESCRIPT_EXPRESS]:"0.5.4-1-g4e69d312",[K.JAVA]:Ge,[K.JAVA_MODEL]:"0.3.8-rc6-1-gcf4b372",[K.JAVA_SDK]:"0.3.8-rc6-1-gcf4b372",[K.JAVA_SPRING]:"0.3.8-rc6-1-gcf4b372",[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>e.basePath!=null?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support specifying a base-path in api.yml. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains a root base-path."):{...e,services:cd(e.services,i=>({...i,pathParameters:Qyc(i.pathParameters),endpoints:i.endpoints.map(n=>({...n,allPathParameters:Qyc(n.allPathParameters),pathParameters:Qyc(n.pathParameters)}))}))}};function Qyc(e){return e.map(t=>LwC(t))}function LwC(e){return{...e,availability:{status:he.V15.commons.AvailabilityStatus.GeneralAvailability,message:void 0}}}var Ig0={laterVersion:"v17",earlierVersion:"v16",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{for(let[i,n]of Object.entries(e.types))if(n.shape._type==="union"&&n.shape.extends.length>0)return t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support union types with extensions. See ${i} in file ${n.name.fernFilepath.allParts.join("/")}. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains union types with extensions.");return{...e}}};var zg0={laterVersion:"v18",earlierVersion:"v17",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.5.14-1-ga6817141",[K.TYPESCRIPT_EXPRESS]:"0.5.14-1-ga6817141",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:"0.3.0-3-ge125e311",[K.PYTHON_PYDANTIC]:"0.3.0-3-ge125e311",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"0.3.0-3-ge125e311",[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>({...e,services:cd(e.services,i=>{let n=i.endpoints[0]?.baseUrl;return i.endpoints.some(a=>a.baseUrl!==n)?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support endpoint-level server URLs. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains endpoint-level server URLs."):{...i,baseUrl:n}})})};var Fg0={laterVersion:"v19",earlierVersion:"v18",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:ni,[K.TYPESCRIPT_BROWSER_SDK]:ni,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.5.19-1-gef223230",[K.TYPESCRIPT_EXPRESS]:"0.5.19-1-gef223230",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:"0.3.4-rc0-9-ge815162f",[K.PYTHON_PYDANTIC]:"0.3.4-rc0-9-ge815162f",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:"0.0.44-1-gbf4b0f3",[K.PYTHON_SDK]:"0.3.4-rc0-9-ge815162f",[K.GO_FIBER]:ni,[K.GO_MODEL]:ni,[K.GO_SDK]:ni,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:cd(e.services,r=>UwC(r,t)),types:cd(e.types,r=>QwC(r,t))})};function UwC(e,t){return{...e,endpoints:e.endpoints.map(r=>VwC(r,t))}}function VwC(e,t){return{...e,examples:e.examples.map(r=>WwC(r,t))}}function WwC(e,t){return{docs:e.docs,name:e.name,url:e.url,rootPathParameters:e.rootPathParameters.map(r=>Jyc(r,t)),servicePathParameters:e.servicePathParameters.map(r=>Jyc(r,t)),endpointPathParameters:e.endpointPathParameters.map(r=>Jyc(r,t)),serviceHeaders:e.serviceHeaders.map(r=>Rg0(r,t)),endpointHeaders:e.endpointHeaders.map(r=>Rg0(r,t)),queryParameters:e.queryParameters.map(r=>HwC(r,t)),request:e.request!=null?$wC(e.request,t):void 0,response:GwC(e.response,t)}}function Jyc(e,t){return{key:e.key,value:Iie(e.value,t)}}function Rg0(e,t){return{wireKey:e.wireKey,value:Iie(e.value,t)}}function HwC(e,t){return{wireKey:e.wireKey,value:Iie(e.value,t)}}function $wC(e,t){return he.V19.http.ExampleRequestBody._visit(e,{inlinedRequestBody:r=>he.V18.http.ExampleRequestBody.inlinedRequestBody({jsonExample:r.jsonExample,properties:r.properties.map(i=>({wireKey:i.wireKey,value:Iie(i.value,t),originalTypeDeclaration:i.originalTypeDeclaration}))}),reference:r=>he.V18.http.ExampleRequestBody.reference(Iie(r,t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function GwC(e,t){return he.V19.http.ExampleResponse._visit(e,{ok:r=>he.V18.http.ExampleResponse.ok({body:r.body!=null?Iie(r.body,t):void 0}),error:r=>he.V18.http.ExampleResponse.error({error:r.error,body:r.body!=null?Iie(r.body,t):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}function QwC(e,t){return{...e,examples:e.examples.map(r=>JwC(r,t))}}function JwC(e,t){return{...e,shape:Kyc(e.shape,t)}}function Kyc(e,t){return he.V19.types.ExampleTypeShape._visit(e,{alias:r=>he.V18.types.ExampleTypeShape.alias({value:Iie(r.value,t)}),object:r=>he.V18.types.ExampleTypeShape.object({properties:r.properties.map(i=>({wireKey:i.wireKey,value:Iie(i.value,t),originalTypeDeclaration:i.originalTypeDeclaration}))}),union:r=>he.V18.types.ExampleTypeShape.union({wireDiscriminantValue:r.wireDiscriminantValue,properties:he.V19.types.ExampleSingleUnionTypeProperties._visit(r.properties,{singleProperty:i=>he.V18.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:i.jsonExample,shape:Ng0(i.shape,t)}),samePropertiesAsObject:i=>he.V18.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:i.typeName,shape:Kyc(i.shape,t)}),noProperties:he.V18.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+r.properties.type)}})}),enum:he.V18.types.ExampleTypeShape.enum,_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function Iie(e,t){return{jsonExample:e.jsonExample,shape:Ng0(e.shape,t)}}function Ng0(e,t){return he.V19.types.ExampleTypeReferenceShape._visit(e,{primitive:r=>he.V18.types.ExampleTypeReferenceShape.primitive(KwC(r,t)),named:r=>he.V18.types.ExampleTypeReferenceShape.named({typeName:r.typeName,shape:Kyc(r.shape,t)}),container:r=>he.V18.types.ExampleTypeReferenceShape.container(he.V19.types.ExampleContainer._visit(r,{list:i=>he.V18.types.ExampleContainer.list(i.map(n=>Iie(n,t))),set:i=>he.V18.types.ExampleContainer.set(i.map(n=>Iie(n,t))),optional:i=>he.V18.types.ExampleContainer.optional(i!=null?Iie(i,t):void 0),map:i=>he.V18.types.ExampleContainer.map(i.map(n=>({key:Iie(n.key,t),value:Iie(n.value,t)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+r.type)}})),unknown:he.V18.types.ExampleTypeReferenceShape.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function KwC(e,{taskContext:t,targetGenerator:r}){return e.type==="date"?t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support examples for dates. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains date examples."):e}var Lg0={laterVersion:"v20",earlierVersion:"v19",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.5.26-rc0-3-gdfabd674",[K.TYPESCRIPT_BROWSER_SDK]:"0.5.26-rc0-3-gdfabd674",[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.5.20-3-g2505487f",[K.TYPESCRIPT_EXPRESS]:"0.5.20-3-g2505487f",[K.JAVA]:Ge,[K.JAVA_MODEL]:"0.3.10-rc2-1-g1c0d853",[K.JAVA_SDK]:"0.3.10-rc2-1-g1c0d853",[K.JAVA_SPRING]:"0.3.10-rc2-1-g1c0d853",[K.PYTHON_FASTAPI]:"0.3.6-rc1-2-g6050f7f8",[K.PYTHON_PYDANTIC]:"0.3.6-rc1-2-g6050f7f8",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"0.3.6-rc1-2-g6050f7f8",[K.GO_FIBER]:ni,[K.GO_MODEL]:"0.0.0",[K.GO_SDK]:"0.0.0",[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:cd(e.services,r=>YwC(r,t))})};function YwC(e,t){return{...e,endpoints:e.endpoints.map(r=>XwC(r,t))}}function XwC(e,t){return{...e,response:e.response!=null?Ug0(e.response,t):void 0,sdkResponse:e.sdkResponse!=null?ZwC(e.sdkResponse,t):void 0}}function Ug0(e,t){return he.V20.http.HttpResponse._visit(e,{fileDownload:()=>Vg0(t),json:r=>r,_unknown:()=>{throw new Error("Unknown HttpResponse: "+e.type)}})}function ZwC(e,t){return he.V20.http.SdkResponse._visit(e,{fileDownload:()=>Vg0(t),streaming:he.V19.http.SdkResponse.streaming,maybeStreaming:r=>he.V19.http.SdkResponse.maybeStreaming({condition:r.condition,streaming:r.streaming,nonStreaming:Ug0(r.nonStreaming,t)}),json:he.V19.http.SdkResponse.nonStreaming,_unknown:()=>{throw new Error("Unknown SdkResponse: "+e.type)}})}function Vg0({targetGenerator:e,taskContext:t}){return t.failAndThrow(e!=null?`Generator ${e.name}@${e.version} does not support file download. If you'd like to use this feature, please upgrade ${e.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains file download.")}var Wg0={laterVersion:"v21",earlierVersion:"v20",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:ni,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:cd(e.services,r=>kwC(r,t))})};function kwC(e,t){return{...e,endpoints:e.endpoints.map(r=>e1C(r,t))}}function e1C(e,t){return{...e,streamingResponse:e.streamingResponse!=null?Yyc(e.streamingResponse,t):void 0,sdkResponse:e.sdkResponse!=null?t1C(e.sdkResponse,t):void 0}}function Yyc(e,{taskContext:t,targetGenerator:r}){return{dataEventType:he.V21.http.StreamingResponseChunkType._visit(e.dataEventType,{json:i=>i,text:()=>t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support streaming text responses. If you'd like to use this feature, please upgrade ${r.name} to a compatible version.`:"Cannot backwards-migrate IR because this IR contains streaming text responses."),_unknown:()=>{throw new Error("Unknown StreamingResponseChunkType: "+e.dataEventType.type)}}),terminator:e.terminator}}function t1C(e,t){return he.V21.http.SdkResponse._visit(e,{fileDownload:he.V20.http.SdkResponse.fileDownload,streaming:r=>he.V20.http.SdkResponse.streaming(Yyc(r,t)),maybeStreaming:r=>he.V20.http.SdkResponse.maybeStreaming({condition:r.condition,streaming:Yyc(r.streaming,t),nonStreaming:r.nonStreaming}),json:he.V20.http.SdkResponse.json,_unknown:()=>{throw new Error("Unknown SdkResponse: "+e.type)}})}var Hg0={laterVersion:"v22",earlierVersion:"v21",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:"0.5.0-3-gac7ce7c",[K.GO_MODEL]:"0.0.14-8-g2fa39f7",[K.GO_SDK]:"0.0.14-8-g2fa39f7",[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,services:cd(e.services,t=>r1C(t))})};function r1C(e){return{...e,endpoints:e.endpoints.map(t=>i1C(t))}}function i1C(e){return{...e,...e.response!=null?he.V22.http.HttpResponse._visit(e.response,{json:t=>({response:he.V21.http.HttpResponse.json(t),streamingResponse:void 0,sdkResponse:he.V21.http.SdkResponse.json(t)}),fileDownload:t=>({response:he.V21.http.HttpResponse.fileDownload(t),streamingResponse:void 0,sdkResponse:he.V21.http.SdkResponse.fileDownload(t)}),streaming:t=>({response:void 0,streamingResponse:t,sdkResponse:he.V21.http.SdkResponse.streaming(t)}),_unknown:()=>{throw new Error("Unknown HttpResponse: "+e.response?.type)}}):{response:void 0,streamingResponse:void 0,sdkResponse:void 0}}}var Qg0={laterVersion:"v23",earlierVersion:"v22",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.7.4-rc3-4-g6cf92f81",[K.TYPESCRIPT_BROWSER_SDK]:"0.7.4-rc3-4-g6cf92f81",[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:"0.7.4-rc3-4-g6cf92f81",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:"0.0.28-3-g112d3dd",[K.STOPLIGHT]:"0.0.28-3-g112d3dd",[K.POSTMAN]:"0.0.44-4-gddab2ae",[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>{let r=[],i={};for(let[n,a]of Object.entries(e.services)){let u=[];for(let l of a.endpoints){let f=n1C(l);f==null?r.push(l):u.push(f)}i[n]={...a,endpoints:u,headers:a.headers.map(l=>Zyc(l)),pathParameters:a.pathParameters.map(l=>pCo(l))}}return r.length>0&&(t.taskContext.logger.warn(`Generator ${t.targetGenerator?.name}@${t.targetGenerator?.version} does not support bytes requests. `),r.length===1&&r[0]!=null?t.taskContext.logger.warn(`Therefore, endpoint ${r[0].name.originalName} will be skipped.`):t.taskContext.logger.warn(`Therefore, endpoints ${r.map(n=>n.name.originalName).join(", ")} will be skipped.`)),{...e,auth:{...e.auth,schemes:e.auth.schemes.map(n=>o1C(n))},headers:e.headers.map(n=>Zyc(n)),types:cd(e.types,n=>u1C(n)),services:i,errors:cd(e.errors,n=>p1C(n)),subpackages:e.subpackages,pathParameters:e.pathParameters.map(n=>pCo(n)),variables:e.variables.map(n=>_1C(n))}}};function n1C(e){let t;if(!(e.requestBody!=null&&(t=a1C(e.requestBody),t==null)))return{...e,headers:e.headers.map(r=>Zyc(r)),pathParameters:e.pathParameters.map(r=>pCo(r)),allPathParameters:e.allPathParameters.map(r=>pCo(r)),queryParameters:e.queryParameters.map(r=>h1C(r)),requestBody:t,sdkRequest:e.sdkRequest!=null?{requestParameterName:e.sdkRequest.requestParameterName,shape:y1C(e.sdkRequest.shape)}:void 0,response:e.response!=null?v1C(e.response):void 0,examples:e.examples.map(r=>b1C(r))}}function a1C(e){switch(e.type){case"bytes":return;case"fileUpload":return he.V22.http.HttpRequestBody.fileUpload({...e,properties:e.properties.map(t=>O1C(t))});case"inlinedRequestBody":return he.V22.http.HttpRequestBody.inlinedRequestBody({...e,properties:e.properties.map(t=>m1C(t))});case"reference":return he.V22.http.HttpRequestBody.reference({...e,requestBodyType:WF(e.requestBodyType)});default:Zo(e)}}function Zyc(e){return{...e,valueType:WF(e.valueType)}}function o1C(e){return e._visit({bearer:he.V22.auth.AuthScheme.bearer,basic:he.V22.auth.AuthScheme.basic,header:t=>he.V22.auth.AuthScheme.header({...t,valueType:WF(t.valueType)}),_other:()=>{throw new Error("Unknown auth scheme: "+e.type)}})}function u1C(e){return{...e,shape:s1C(e.shape),examples:e.examples.map(t=>c1C(t))}}function s1C(e){return e._visit({alias:t=>he.V22.types.Type.alias({...t,aliasOf:WF(t.aliasOf),resolvedType:f1C(t.resolvedType)}),enum:he.V22.types.Type.enum,object:t=>he.V22.types.Type.object({...t,properties:t.properties.map(r=>$g0(r))}),union:t=>he.V22.types.Type.union({...t,baseProperties:t.baseProperties.map(r=>$g0(r)),types:t.types.map(r=>({...r,shape:d1C(r.shape)}))}),undiscriminatedUnion:t=>he.V22.types.Type.undiscriminatedUnion({...t,members:t.members.map(r=>({...r,type:WF(r.type)}))}),_other:()=>{throw new Error("Unknown type shape: "+e.type)}})}function c1C(e){return{...e,shape:kyc(e.shape)}}function kyc(e){return e._visit({alias:t=>he.V22.types.ExampleTypeShape.alias({...t,value:lSe(t.value)}),enum:he.V22.types.ExampleTypeShape.enum,object:t=>he.V22.types.ExampleTypeShape.object({...t,properties:t.properties.map(r=>({...r,value:lSe(r.value)}))}),union:t=>he.V22.types.ExampleTypeShape.union({...t,properties:l1C(t.properties)}),_other:()=>{throw new Error("Unknown example type shape: "+e.type)}})}function lSe(e){return{...e,shape:evc(e.shape)}}function evc(e){return e._visit({primitive:t=>he.V22.types.ExampleTypeReferenceShape.primitive(t._visit({integer:he.V22.types.ExamplePrimitive.integer,double:he.V22.types.ExamplePrimitive.double,string:he.V22.types.ExamplePrimitive.string,boolean:he.V22.types.ExamplePrimitive.boolean,long:he.V22.types.ExamplePrimitive.long,datetime:r=>he.V22.types.ExamplePrimitive.datetime(r.toISOString()),date:he.V22.types.ExamplePrimitive.date,uuid:he.V22.types.ExamplePrimitive.uuid,_other:()=>{throw new Error("Unknown example primitive: "+t.type)}})),named:t=>he.V22.types.ExampleTypeReferenceShape.named({...t,shape:kyc(t.shape)}),container:t=>he.V22.types.ExampleTypeReferenceShape.container(t._visit({list:r=>he.V22.types.ExampleContainer.list(r.map(i=>lSe(i))),set:r=>he.V22.types.ExampleContainer.set(r.map(i=>lSe(i))),optional:r=>he.V22.types.ExampleContainer.optional(r!=null?lSe(r):void 0),map:r=>he.V22.types.ExampleContainer.map(r.map(i=>({key:lSe(i.key),value:lSe(i.value)}))),_other:()=>{throw new Error("Unknown example container: "+t.type)}})),unknown:he.V22.types.ExampleTypeReferenceShape.unknown,_other:()=>{throw new Error("Unknown example type reference shape: "+e.type)}})}function l1C(e){return e._visit({singleProperty:t=>he.V22.types.ExampleSingleUnionTypeProperties.singleProperty({...t,shape:evc(t.shape)}),noProperties:he.V22.types.ExampleSingleUnionTypeProperties.noProperties,samePropertiesAsObject:t=>he.V22.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...t,shape:kyc(t.shape)}),_other:()=>{throw new Error("Unknown example single union type properties: "+e.type)}})}function WF(e){return e._visit({container:t=>he.V22.types.TypeReference.container(Jg0(t)),primitive:he.V22.types.TypeReference.primitive,named:he.V22.types.TypeReference.named,unknown:he.V22.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function Jg0(e){return e._visit({list:t=>he.V22.types.ContainerType.list(WF(t)),set:t=>he.V22.types.ContainerType.set(WF(t)),optional:t=>he.V22.types.ContainerType.optional(WF(t)),map:t=>he.V22.types.ContainerType.map({keyType:WF(t.keyType),valueType:WF(t.valueType)}),literal:he.V22.types.ContainerType.literal,_other:()=>{throw new Error("Unknown container type: "+e.type)}})}function f1C(e){return e._visit({container:t=>he.V22.types.ResolvedTypeReference.container(Jg0(t)),primitive:he.V22.types.ResolvedTypeReference.primitive,named:he.V22.types.ResolvedTypeReference.named,unknown:he.V22.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown resolved type reference: "+e.type)}})}function $g0(e){return{...e,valueType:WF(e.valueType)}}function d1C(e){return e._visit({noProperties:he.V22.types.SingleUnionTypeProperties.noProperties,singleProperty:t=>he.V22.types.SingleUnionTypeProperties.singleProperty({...t,type:WF(t.type)}),samePropertiesAsObject:he.V22.types.SingleUnionTypeProperties.samePropertiesAsObject,_other:()=>{throw new Error("Unknown single union type properties: "+e.propertiesType)}})}function p1C(e){return{...e,type:e.type!=null?WF(e.type):void 0}}function _1C(e){return{...e,type:WF(e.type)}}function pCo(e){return{...e,valueType:WF(e.valueType)}}function h1C(e){return{...e,valueType:WF(e.valueType)}}function y1C(e){return e._visit({justRequestBody:t=>he.V22.http.SdkRequestShape.justRequestBody({...t,requestBodyType:WF(t.requestBodyType)}),wrapper:he.V22.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SDK request shape: "+e.type)}})}function v1C(e){return e._visit({json:t=>he.V22.http.HttpResponse.json({...t,responseBodyType:WF(t.responseBodyType)}),fileDownload:he.V22.http.HttpResponse.fileDownload,streaming:t=>he.V22.http.HttpResponse.streaming({...t,dataEventType:t.dataEventType._visit({json:r=>he.V22.http.StreamingResponseChunkType.json(WF(r)),text:he.V22.http.StreamingResponseChunkType.text,_other:()=>{throw new Error("Unknown streaming data event type: "+t.dataEventType.type)}})}),_other:()=>{throw new Error("Unknown response: "+e.type)}})}function b1C(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>Xyc(t)),servicePathParameters:e.servicePathParameters.map(t=>Xyc(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Xyc(t)),serviceHeaders:e.serviceHeaders.map(t=>Gg0(t)),endpointHeaders:e.endpointHeaders.map(t=>Gg0(t)),queryParameters:e.queryParameters.map(t=>g1C(t)),request:e.request!=null?e.request._visit({inlinedRequestBody:t=>he.V22.http.ExampleRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,value:lSe(r.value)}))}),reference:t=>he.V22.http.ExampleRequestBody.reference({...t,shape:evc(t.shape)}),_other:()=>{throw new Error("Unknown example request body: "+e.request?.type)}}):void 0,response:e.response._visit({ok:t=>he.V22.http.ExampleResponse.ok({...t,body:t.body!=null?lSe(t.body):void 0}),error:t=>he.V22.http.ExampleResponse.error({...t,body:t.body!=null?lSe(t.body):void 0}),_other:()=>{throw new Error("Unknown example response: "+e.response.type)}})}}function Xyc(e){return{...e,value:lSe(e.value)}}function g1C(e){return{...e,value:lSe(e.value)}}function Gg0(e){return{...e,value:lSe(e.value)}}function O1C(e){return e._visit({file:he.V22.http.FileUploadRequestProperty.file,bodyProperty:t=>he.V22.http.FileUploadRequestProperty.bodyProperty({...t,valueType:WF(t.valueType)}),_other:()=>{throw new Error("Unknown file upload request body property: "+e.type)}})}function m1C(e){return{...e,valueType:WF(e.valueType)}}var eh={};Ro(eh,{V23:()=>HDF,V24:()=>$DF,V25:()=>GDF,V26:()=>QDF,V27:()=>JDF,V28:()=>KDF,V29:()=>YDF,V30:()=>XDF,V31:()=>ZDF,V32:()=>kDF,V33:()=>eEF,V34:()=>tEF,V35:()=>rEF,V36:()=>iEF,V37:()=>nEF,V38:()=>aEF,V39:()=>oEF,V40:()=>uEF,V41:()=>sEF,V42:()=>cEF,V43:()=>lEF,V44:()=>fEF,V45:()=>dEF,V46:()=>pEF,V47:()=>_EF,V48:()=>hEF,V49:()=>yEF,V50:()=>vEF,V51:()=>bEF,V52:()=>gEF,V53:()=>OEF,V54:()=>mEF,V55:()=>Gp});var HDF=Di(Do(),1),$DF=Di(oo(),1),GDF=Di(Ya(),1),QDF=Di(Qa(),1),JDF=Di(La(),1),KDF=Di(Ua(),1),YDF=Di(Va(),1),XDF=Di(xa(),1),ZDF=Di(Ba(),1),kDF=Di(Oa(),1),eEF=Di(Wn(),1),tEF=Di(Vn(),1),rEF=Di(Tn(),1),iEF=Di(Cn(),1),nEF=Di(qn(),1),aEF=Di(Sn(),1),oEF=Di(ln(),1),uEF=Di(fn(),1),sEF=Di(sn(),1),cEF=Di(tn(),1),lEF=Di(en(),1),fEF=Di(Zi(),1),dEF=Di($i(),1),pEF=Di(Li(),1),_EF=Di(Ni(),1),hEF=Di(Ri(),1),yEF=Di(xi(),1),vEF=Di(Mi(),1),bEF=Di(Ei(),1),gEF=Di(bi(),1),OEF=Di(Gt(),1),mEF=Di(Lh(),1);var KCm={laterVersion:"v24",earlierVersion:"v23",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V23.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e})};var YCm={laterVersion:"v25",earlierVersion:"v24",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:"0.4.9-1-ge0997b3",[K.JAVA_SDK]:"0.4.9-1-ge0997b3",[K.JAVA_SPRING]:"0.4.9-1-ge0997b3",[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V24.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:(e,t)=>{let r=[],i=[],n={};for(let[a,u]of Object.entries(e.services)){let l=[];for(let f of u.endpoints){let s;if(f.sdkRequest!=null&&(s=PEF(f.sdkRequest),s==null)){r.push(f);continue}if(f.response!=null){let o=f.response._visit({fileDownload:c=>he.V24.HttpResponse.fileDownload(c),json:c=>he.V24.HttpResponse.json(c),streaming:c=>he.V24.HttpResponse.streaming(c),text:()=>(i.push(f),he.V24.HttpResponse.json({docs:void 0,responseBodyType:he.V24.TypeReference.unknown()})),_other:()=>{throw new Error("Encountered unknown response type")}});l.push({...f,sdkRequest:s,response:o})}else l.push({...f,sdkRequest:s,response:void 0})}n[a]={...u,endpoints:l}}return i.length>0&&(t.taskContext.logger.warn(`Generator ${t.targetGenerator?.name}@${t.targetGenerator?.version} does not support text/plain responses. `),i.length===1&&i[0]!=null?t.taskContext.logger.warn(`Therefore, endpoint ${i[0].name.originalName} response type will be casted to unknown.`):t.taskContext.logger.warn(`Therefore, endpoints ${i.map(a=>a.name.originalName).join(", ")} response types will be casted to unknown.`)),r.length>0&&(t.taskContext.logger.warn(`Generator ${t.targetGenerator?.name}@${t.targetGenerator?.version} does not support bytes requests. `),r.length===1&&r[0]!=null?t.taskContext.logger.warn(`Therefore, endpoint ${r[0].name.originalName} will be skipped.`):t.taskContext.logger.warn(`Therefore, endpoints ${r.map(a=>a.name.originalName).join(", ")} will be skipped.`)),{...e,services:n}}};function PEF(e){let t=e.shape;if(t.type==="wrapper")return{shape:he.V24.SdkRequestShape.wrapper({...t}),requestParameterName:e.requestParameterName};if(t.value.type==="typeReference")return{shape:he.V24.SdkRequestShape.justRequestBody({...t.value}),requestParameterName:e.requestParameterName}}var ZCm={laterVersion:"v26",earlierVersion:"v25",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:"0.5.0-rc2-16-g4177fafd",[K.PYTHON_PYDANTIC]:"0.5.0-rc2-16-g4177fafd",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"0.5.0-rc2-16-g4177fafd",[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V25.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,EEF(r)])),headers:e.headers.map(t=>lzu(t)),webhookGroups:Object.fromEntries(Object.entries(e.webhookGroups).map(([t,r])=>[t,r.map(i=>jEF(i))])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,wEF(r)]))})};function jEF(e){return{...e,headers:e.headers.map(t=>lzu(t)),availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function wEF(e){return{...e,endpoints:e.endpoints.map(t=>SEF(t)),headers:e.headers.map(t=>lzu(t)),availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function SEF(e){return{...e,headers:e.headers.map(t=>lzu(t)),queryParameters:e.queryParameters.map(t=>DEF(t)),availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function lzu(e){return{...e,availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function DEF(e){return{...e,availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function EEF(e){return{...e,shape:e.shape._visit({union:t=>he.V25.Type.union({...t,baseProperties:t.baseProperties.map(r=>XCm(r))}),object:t=>he.V25.Type.object({...t,properties:t.properties.map(r=>XCm(r))}),enum:t=>he.V25.Type.enum({...t,values:t.values.map(r=>AEF(r))}),alias:t=>he.V25.Type.alias(t),undiscriminatedUnion:t=>he.V25.Type.undiscriminatedUnion(t),_other:()=>{throw new Error("Encountered unknown shape")}}),availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function XCm(e){return{...e,availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function AEF(e){return{...e,availability:e.availability==null?{status:he.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}var kCm={laterVersion:"v27",earlierVersion:"v26",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:"0.6.1-3-g94ee67a",[K.GO_MODEL]:"0.6.1-3-g94ee67a",[K.GO_SDK]:"0.6.1-3-g94ee67a",[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V26.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,MEF(r)]))})};function MEF(e){return{...e,endpoints:e.endpoints.map(t=>qEF(t))}}function qEF(e){return{...e,response:e.response!=null?TEF(e.response):void 0}}function TEF(e){if(e.type!=="json")return e;let t=e.value;return t.type==="response"?he.V26.HttpResponse.json(t):he.V26.HttpResponse.json({docs:t.docs,responseBodyType:t.responseBodyType})}var eBm={laterVersion:"v28",earlierVersion:"v27",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.8.1-1-g0f40bf18",[K.TYPESCRIPT_BROWSER_SDK]:"0.8.1-1-g0f40bf18",[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:"0.8.1-1-g0f40bf18",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:"0.9.0-2-g6b0be0e",[K.GO_MODEL]:"0.9.0-2-g6b0be0e",[K.GO_SDK]:"0.9.0-2-g6b0be0e",[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V27.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,auth:oAF(e.auth),headers:dzu(e.headers),types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,fAF(r)])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,UEF(r)])),webhookGroups:Object.fromEntries(Object.entries(e.webhookGroups).map(([t,r])=>[t,IEF(r)])),errors:Object.fromEntries(Object.entries(e.errors).map(([t,r])=>[t,xEF(r)])),pathParameters:fzu(e.pathParameters),variables:CEF(e.variables)})};function CEF(e){return e.map(t=>BEF(t))}function BEF(e){return{...e,type:aR(e.type)}}function xEF(e){return{...e,type:e.type!=null?aR(e.type):void 0}}function IEF(e){return e.map(t=>zEF(t))}function zEF(e){return{...e,headers:dzu(e.headers),payload:REF(e.payload)}}function REF(e){switch(e.type){case"inlinedPayload":return he.V27.WebhookPayload.inlinedPayload(FEF(e));case"reference":return he.V27.WebhookPayload.reference({...e,payloadType:aR(e.payloadType)})}}function FEF(e){return{...e,properties:NEF(e.properties)}}function NEF(e){return e.map(t=>LEF(t))}function LEF(e){return{...e,valueType:aR(e.valueType)}}function UEF(e){return{...e,endpoints:VEF(e.endpoints),headers:dzu(e.headers),pathParameters:fzu(e.pathParameters)}}function VEF(e){return e.map(t=>WEF(t))}function WEF(e){return{...e,headers:dzu(e.headers),pathParameters:fzu(e.pathParameters),allPathParameters:fzu(e.allPathParameters),queryParameters:nAF(e.queryParameters),requestBody:e.requestBody!=null?XEF(e.requestBody):void 0,sdkRequest:e.sdkRequest!=null?JEF(e.sdkRequest):void 0,response:e.response!=null?HEF(e.response):void 0}}function HEF(e){switch(e.type){case"json":return he.V27.HttpResponse.json(QEF(e.value));case"fileDownload":return he.V27.HttpResponse.fileDownload(e);case"text":return he.V27.HttpResponse.text(e);case"streaming":return he.V27.HttpResponse.streaming($EF(e));default:Zo(e)}}function $EF(e){return{...e,dataEventType:GEF(e.dataEventType)}}function GEF(e){switch(e.type){case"json":return he.V27.StreamingResponseChunkType.json(aR(e.json));case"text":return he.V27.StreamingResponseChunkType.text();default:Zo(e)}}function QEF(e){switch(e.type){case"response":return he.V27.JsonResponse.response({...e,responseBodyType:aR(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V27.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:aR(e.responseBodyType),responseProperty:e.responseProperty!=null?nBm(e.responseProperty):void 0});default:Zo(e)}}function JEF(e){return{...e,shape:KEF(e.shape)}}function KEF(e){switch(e.type){case"justRequestBody":return he.V27.SdkRequestShape.justRequestBody(YEF(e.value));case"wrapper":return he.V27.SdkRequestShape.wrapper(e);default:Zo(e)}}function YEF(e){switch(e.type){case"typeReference":return he.V27.SdkRequestBodyType.typeReference(tBm(e));case"bytes":return he.V27.SdkRequestBodyType.bytes(e);default:Zo(e)}}function XEF(e){switch(e.type){case"inlinedRequestBody":return he.V27.HttpRequestBody.inlinedRequestBody(tAF(e));case"reference":return he.V27.HttpRequestBody.reference(tBm(e));case"fileUpload":return he.V27.HttpRequestBody.fileUpload(ZEF(e));case"bytes":return he.V27.HttpRequestBody.bytes(e);default:Zo(e)}}function ZEF(e){return{...e,properties:kEF(e.properties)}}function kEF(e){return e.map(t=>eAF(t))}function eAF(e){switch(e.type){case"file":return he.V27.FileUploadRequestProperty.file(e);case"bodyProperty":return he.V27.FileUploadRequestProperty.bodyProperty(rBm(e));default:Zo(e)}}function tBm(e){return{...e,requestBodyType:aR(e.requestBodyType)}}function tAF(e){return{...e,properties:rAF(e.properties)}}function rAF(e){return e.map(t=>rBm(t))}function rBm(e){return{...e,valueType:aR(e.valueType)}}function fzu(e){return e.map(t=>iAF(t))}function iAF(e){return{...e,valueType:aR(e.valueType)}}function nAF(e){return e.map(t=>aAF(t))}function aAF(e){return{...e,valueType:aR(e.valueType)}}function oAF(e){return{...e,schemes:uAF(e.schemes)}}function uAF(e){return e.map(t=>sAF(t))}function sAF(e){switch(e.type){case"basic":return he.V27.AuthScheme.basic(e);case"bearer":return he.V27.AuthScheme.bearer(e);case"header":return cAF(e);default:Zo(e)}}function cAF(e){return he.V27.AuthScheme.header({...e,valueType:aR(e.valueType)})}function dzu(e){return e.map(t=>lAF(t))}function lAF(e){return{...e,valueType:aR(e.valueType)}}function fAF(e){return{...e,shape:dAF(e.shape)}}function dAF(e){switch(e.type){case"alias":return he.V27.Type.alias(pAF(e));case"enum":return he.V27.Type.enum(e);case"object":return he.V27.Type.object(_AF(e));case"union":return he.V27.Type.union(hAF(e));case"undiscriminatedUnion":return he.V27.Type.undiscriminatedUnion(yAF(e));default:Zo(e)}}function pAF(e){return{aliasOf:aR(e.aliasOf),resolvedType:OAF(e.resolvedType)}}function _AF(e){return{...e,properties:iBm(e.properties)}}function hAF(e){return{...e,types:vAF(e.types),baseProperties:iBm(e.baseProperties)}}function yAF(e){return{members:gAF(e.members)}}function iBm(e){return e.map(t=>nBm(t))}function nBm(e){return{...e,valueType:aR(e.valueType)}}function vAF(e){return e.map(t=>({...t,shape:bAF(t.shape)}))}function bAF(e){switch(e.propertiesType){case"samePropertiesAsObject":return he.V27.SingleUnionTypeProperties.samePropertiesAsObject(e);case"singleProperty":return he.V27.SingleUnionTypeProperties.singleProperty({name:e.name,type:aR(e.type)});case"noProperties":return he.V27.SingleUnionTypeProperties.noProperties();default:Zo(e)}}function gAF(e){return e.map(t=>({...t,type:aR(t.type)}))}function OAF(e){switch(e.type){case"container":return e.container.type==="literal"?e.container.literal.type==="boolean"?he.V27.ResolvedTypeReference.primitive(he.V27.PrimitiveType.Boolean):he.V27.ResolvedTypeReference.container(he.V27.ContainerType.literal(he.V27.Literal.string(e.container.literal.string))):he.V27.ResolvedTypeReference.container(aBm(e.container));case"named":return he.V27.ResolvedTypeReference.named(e);case"primitive":return he.V27.ResolvedTypeReference.primitive(e.primitive);case"unknown":return he.V27.ResolvedTypeReference.unknown();default:Zo(e)}}function aR(e){switch(e.type){case"container":return e.container.type==="literal"?e.container.literal.type==="boolean"?he.V27.TypeReference.primitive(he.V27.PrimitiveType.Boolean):he.V27.TypeReference.container(he.V27.ContainerType.literal(he.V27.Literal.string(e.container.literal.string))):he.V27.TypeReference.container(aBm(e.container));case"named":return he.V27.TypeReference.named(e);case"primitive":return he.V27.TypeReference.primitive(e.primitive);case"unknown":return he.V27.TypeReference.unknown();default:Zo(e)}}function aBm(e){switch(e.type){case"list":return he.V27.ContainerType.list(aR(e.list));case"map":return he.V27.ContainerType.map({keyType:aR(e.keyType),valueType:aR(e.valueType)});case"optional":return he.V27.ContainerType.optional(aR(e.optional));case"set":return he.V27.ContainerType.set(aR(e.set));case"literal":if(e.literal.type==="boolean")throw new Error("Internal error; failed to transform boolean literal between IR versions");return he.V27.ContainerType.literal(he.V27.Literal.string(e.literal.string));default:Zo(e)}}var uBm={laterVersion:"v29",earlierVersion:"v28",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.8.6-1-g3d8d8591",[K.TYPESCRIPT_BROWSER_SDK]:"0.8.6-1-g3d8d8591",[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:"0.8.6-1-g3d8d8591",[K.JAVA]:Ge,[K.JAVA_MODEL]:"0.5.14-1-ge4bcd98",[K.JAVA_SDK]:"0.5.14-1-ge4bcd98",[K.JAVA_SPRING]:"0.5.14-1-ge4bcd98",[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V28.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.keys(e.types).map(t=>[t,mAF({typeId:t,allTypes:e.types})]))})};function mAF({typeId:e,allTypes:t}){let r=oBm({typeId:e,allTypes:t});return{availability:r.availability,docs:r.docs,name:r.name,shape:r.shape,examples:r.examples,referencedTypes:Array.from(r.referencedTypes).map(i=>{let n=oBm({typeId:i,allTypes:t});return{typeId:i,fernFilepath:n.name.fernFilepath,name:n.name.name}})}}function oBm({typeId:e,allTypes:t}){let r=t[e];if(r==null)throw new Error(`Type definition for type id ${e} is undefined`);return r}var sBm={laterVersion:"v30",earlierVersion:"v29",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:"0.6.5-1-g0ef31b7a",[K.PYTHON_PYDANTIC]:"0.6.5-1-g0ef31b7a",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"0.6.5-1-g0ef31b7a",[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V29.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=new hUl(e);return{...e,types:t.convertTypes(e.types),services:t.convertServices(e.services)}}},hUl=class{ir;constructor(t){this.ir=t}convertTypes(t){return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,this.convertType(i)]))}convertServices(t){return Object.fromEntries(Object.entries(t).map(([r,i])=>[r,this.convertService(i)]))}convertService(t){return{...t,endpoints:this.convertEndpoints(t.endpoints)}}convertEndpoints(t){return t.map(r=>({...r,examples:this.convertExampleEndpointCalls(r.examples)}))}convertExampleEndpointCalls(t){return t.map(r=>({...r,rootPathParameters:this.convertExamplePathParameters(r.rootPathParameters),servicePathParameters:this.convertExamplePathParameters(r.servicePathParameters),endpointPathParameters:this.convertExamplePathParameters(r.endpointPathParameters),serviceHeaders:this.convertExampleHeaders(r.serviceHeaders),endpointHeaders:this.convertExampleHeaders(r.endpointHeaders),queryParameters:this.convertExampleQueryParameters(r.queryParameters),request:r.request!=null?this.convertExampleRequestBody(r.request):void 0,response:this.convertExampleResponse(r.response)}))}convertExamplePathParameters(t){return t.map(r=>({key:r.name.originalName,value:this.convertExampleTypeReference(r.value)}))}convertExampleHeaders(t){return t.map(r=>({wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))}convertExampleQueryParameters(t){return t.map(r=>({wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))}convertExampleRequestBody(t){switch(t.type){case"inlinedRequestBody":return he.V29.ExampleRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))});case"reference":return he.V29.ExampleRequestBody.reference(this.convertExampleTypeReference(t));default:Zo(t)}}convertExampleResponse(t){switch(t.type){case"ok":return he.V29.ExampleResponse.ok({body:t.body!=null?this.convertExampleTypeReference(t.body):void 0});case"error":return he.V29.ExampleResponse.error({...t,body:t.body!=null?this.convertExampleTypeReference(t.body):void 0});default:Zo(t)}}convertType(t){return{...t,examples:this.convertExampleTypes(t.examples)}}convertExampleTypes(t){return t.map(r=>this.convertExampleType(r))}convertExampleType(t){return{...t,shape:this.convertExampleTypeShape(t.shape)}}convertExampleTypeReferences(t){return t.map(r=>this.convertExampleTypeReference(r))}convertExampleTypeReference(t){return{...t,shape:this.convertExampleTypeReferenceShape(t.shape)}}convertExampleTypeReferenceShape(t){switch(t.type){case"primitive":return he.V29.ExampleTypeReferenceShape.primitive(this.convertExamplePrimitive(t.primitive));case"container":return he.V29.ExampleTypeReferenceShape.container(this.convertExampleContainer(t.container));case"named":return he.V29.ExampleTypeReferenceShape.named(this.convertExampleNamedType(t));case"unknown":return he.V29.ExampleTypeReferenceShape.unknown(t);default:Zo(t)}}convertExamplePrimitive(t){switch(t.type){case"integer":return he.V29.ExamplePrimitive.integer(t.integer);case"double":return he.V29.ExamplePrimitive.double(t.double);case"string":return he.V29.ExamplePrimitive.string(t.string.original);case"boolean":return he.V29.ExamplePrimitive.boolean(t.boolean);case"long":return he.V29.ExamplePrimitive.long(t.long);case"datetime":return he.V29.ExamplePrimitive.datetime(t.datetime);case"date":return he.V29.ExamplePrimitive.date(t.date);case"uuid":return he.V29.ExamplePrimitive.uuid(t.uuid);default:Zo(t)}}convertExampleContainer(t){switch(t.type){case"list":return he.V29.ExampleContainer.list(this.convertExampleTypeReferences(t.list));case"set":return he.V29.ExampleContainer.set(this.convertExampleTypeReferences(t.set));case"optional":return he.V29.ExampleContainer.optional(t.optional!=null?this.convertExampleTypeReference(t.optional):void 0);case"map":return he.V29.ExampleContainer.map(this.convertKeyValuePairs(t.map));default:Zo(t)}}convertKeyValuePairs(t){return t.map(r=>({key:this.convertExampleTypeReference(r.key),value:this.convertExampleTypeReference(r.value)}))}convertExampleNamedType(t){return{...t,shape:this.convertExampleTypeShape(t.shape)}}convertExampleTypeShape(t){switch(t.type){case"alias":return he.V29.ExampleTypeShape.alias({value:this.convertExampleTypeReference(t.value)});case"enum":return he.V29.ExampleTypeShape.enum({wireValue:t.value.wireValue});case"object":return he.V29.ExampleTypeShape.object(this.convertExampleObjectType(t));case"union":return he.V29.ExampleTypeShape.union(this.convertExampleUnionType(t));default:Zo(t)}}convertExampleObjectType(t){return{properties:t.properties.map(r=>({...r,wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))}}convertExampleUnionType(t){return{wireDiscriminantValue:t.singleUnionType.wireDiscriminantValue.wireValue,properties:this.convertExampleSingleUnionTypeProperties(t.singleUnionType.shape)}}convertExampleSingleUnionTypeProperties(t){switch(t.type){case"samePropertiesAsObject":{let r=this.ir.types[t.typeId]?.name;if(r==null)throw new Error(`Internal error; type ID ${t.typeId} does not exist in the IR`);return he.V29.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:r,shape:this.convertExampleTypeShape(he.V30.ExampleTypeShape.object({properties:t.object.properties}))})}case"singleProperty":return he.V29.ExampleSingleUnionTypeProperties.singleProperty({...t,shape:this.convertExampleTypeReferenceShape(t.shape)});case"noProperties":return he.V29.ExampleSingleUnionTypeProperties.noProperties();default:Zo(t)}}};var cBm={laterVersion:"v31",earlierVersion:"v30",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.8.8",[K.TYPESCRIPT_BROWSER_SDK]:"0.8.8",[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:"0.8.8",[K.JAVA]:Ge,[K.JAVA_MODEL]:"0.7.0-rc0",[K.JAVA_SDK]:"0.7.0-rc0",[K.JAVA_SPRING]:"0.7.0-rc0",[K.PYTHON_FASTAPI]:"0.7.5-1-gb54fb677",[K.PYTHON_PYDANTIC]:"0.7.5-1-gb54fb677",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"0.7.5-1-gb54fb677",[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:ni,[K.RUBY_SDK]:ni,[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V30.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({apiName:e.apiName,apiDisplayName:e.apiDisplayName,apiDocs:e.apiDocs,auth:e.auth,headers:e.headers,types:e.types,webhookGroups:e.webhookGroups,errors:e.errors,subpackages:e.subpackages,rootPackage:e.rootPackage,constants:e.constants,environments:e.environments,basePath:e.basePath,pathParameters:e.pathParameters,errorDiscriminationStrategy:e.errorDiscriminationStrategy,sdkConfig:e.sdkConfig,variables:e.variables,serviceTypeReferenceInfo:e.serviceTypeReferenceInfo,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{availability:r.availability,name:r.name,displayName:r.displayName,basePath:r.basePath,endpoints:r.endpoints.map(i=>({id:i.id,docs:i.docs,availability:i.availability,name:i.name,displayName:i.displayName,method:i.method,headers:i.headers,baseUrl:i.baseUrl,path:i.path,fullPath:i.fullPath,pathParameters:i.pathParameters,allPathParameters:i.allPathParameters,queryParameters:i.queryParameters,requestBody:i.requestBody,sdkRequest:i.sdkRequest,response:i.response,errors:i.errors,auth:i.auth,examples:i.examples})),headers:r.headers,pathParameters:r.pathParameters}]))})};var fBm={laterVersion:"v32",earlierVersion:"v31",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:"0.9.4-2-g139cf36",[K.GO_MODEL]:"0.9.4-2-g139cf36",[K.GO_SDK]:"0.9.4-2-g139cf36",[K.RUBY_MODEL]:"0.0.0",[K.RUBY_SDK]:"0.0.0",[K.CSHARP_MODEL]:ni,[K.CSHARP_SDK]:ni,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V31.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,{...r,examples:EAF(r.examples)}])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(PAF)}]))})};function NWi({examples:e,convert:t}){let r=[];for(let i of e){let n=t(i);n!=null&&r.push(n)}return r}function PAF(e){return{...e,examples:NWi({examples:e.examples,convert:jAF})}}function jAF(e){let t;if(e.request!=null&&(t=wAF(e.request),t==null))return;let r=SAF(e.response);if(r!=null)return{...e,rootPathParameters:NWi({examples:e.rootPathParameters,convert:yUl}),endpointPathParameters:NWi({examples:e.endpointPathParameters,convert:yUl}),servicePathParameters:NWi({examples:e.servicePathParameters,convert:yUl}),endpointHeaders:NWi({examples:e.endpointHeaders,convert:lBm}),serviceHeaders:NWi({examples:e.serviceHeaders,convert:lBm}),queryParameters:NWi({examples:e.queryParameters,convert:DAF}),request:t,response:r}}function wAF(e){switch(e.type){case"inlinedRequestBody":{let t=[];for(let r of e.properties){let i=yme(r.value);i!=null&&t.push({...r,value:i})}return he.V31.ExampleRequestBody.inlinedRequestBody({...e,properties:t})}case"reference":{let t=vUl(e.shape);return t==null?void 0:he.V31.ExampleRequestBody.reference({...e,shape:t})}default:Zo(e)}}function SAF(e){switch(e.type){case"ok":{if(e.body==null)return he.V31.ExampleResponse.ok({body:void 0});let t=yme(e.body);return t==null?void 0:he.V31.ExampleResponse.ok({body:t})}case"error":{if(e.body==null)return he.V31.ExampleResponse.error({...e,body:void 0});let t=yme(e.body);return t==null?void 0:he.V31.ExampleResponse.error({...e,body:t})}}}function yUl(e){let t=yme(e.value);if(t!=null)return{...e,value:t}}function lBm(e){let t=yme(e.value);if(t!=null)return{...e,value:t}}function DAF(e){let t=yme(e.value);if(t!=null)return{...e,value:t}}function EAF(e){let t=[];for(let r of e){let i=AAF(r);i!=null&&t.push(i)}return t}function AAF(e){let t=dBm(e.shape);if(t!=null)return{...e,shape:t}}function dBm(e){switch(e.type){case"enum":return he.V31.ExampleTypeShape.enum(e);case"alias":{let t=yme(e.value);return t==null?void 0:he.V31.ExampleTypeShape.alias({value:t})}case"object":{let t=[];for(let r of e.properties){let i=yme(r.value);i!=null&&t.push({...r,value:i})}return he.V31.ExampleTypeShape.object({properties:t})}case"union":{let t=MAF(e.singleUnionType);return t==null?void 0:he.V31.ExampleTypeShape.union({...e,singleUnionType:t})}case"undiscriminatedUnion":return;default:Zo(e)}}function yme(e){let t=vUl(e.shape);if(t!=null)return{shape:t,jsonExample:e.jsonExample}}function MAF(e){let t=qAF(e.shape);if(t!=null)return{...e,shape:t}}function qAF(e){switch(e.type){case"noProperties":return he.V31.ExampleSingleUnionTypeProperties.noProperties();case"singleProperty":{let t=vUl(e.shape);return t==null?void 0:he.V31.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:t})}case"samePropertiesAsObject":{let t=[];for(let r of e.object.properties){let i=yme(r.value);i!=null&&t.push({...r,value:i})}return he.V31.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:{properties:t}})}default:Zo(e)}}function vUl(e){switch(e.type){case"container":{let t=TAF(e.container);return t==null?void 0:he.V31.ExampleTypeReferenceShape.container(t)}case"named":{let t=dBm(e.shape);return t==null?void 0:he.V31.ExampleTypeReferenceShape.named({...e,shape:t})}case"primitive":return he.V31.ExampleTypeReferenceShape.primitive(e.primitive);case"unknown":return he.V31.ExampleTypeReferenceShape.unknown(e.unknown);default:Zo(e)}}function TAF(e){switch(e.type){case"list":{let t=[];for(let r of e.list){let i=yme(r);i!=null&&t.push(i)}return he.V31.ExampleContainer.list(t)}case"set":{let t=[];for(let r of e.set){let i=yme(r);i!=null&&t.push(i)}return he.V31.ExampleContainer.set(t)}case"map":{let t=[];for(let r of e.map){let i=yme(r.key),n=yme(r.value);i!=null&&n!=null&&t.push({key:i,value:n})}return he.V31.ExampleContainer.map(t)}case"optional":{if(e.optional==null)return he.V31.ExampleContainer.optional();let t=yme(e.optional);return t==null?he.V31.ExampleContainer.optional():he.V31.ExampleContainer.optional(t)}default:Zo(e)}}var pBm={laterVersion:"v33",earlierVersion:"v32",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.12.0",[K.TYPESCRIPT_BROWSER_SDK]:"0.12.0",[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:"0.13.0-3-g8c56a41",[K.GO_MODEL]:"0.13.0-3-g8c56a41",[K.GO_SDK]:"0.13.0-3-g8c56a41",[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:"0.0.0",[K.CSHARP_SDK]:"0.0.0",[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V32.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=new bUl(e);return{...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>t.convertEndpoint(n))}]))}}},bUl=class{ir;constructor(t){this.ir=t}convertEndpoint(t){return{...t,queryParameters:t.queryParameters.map(r=>this.isTypeReferenceObject(r.valueType)?{...r,valueType:he.V33.TypeReference.container(he.V33.ContainerType.optional(he.V33.TypeReference.primitive("STRING")))}:r),examples:CAF({examples:t.examples,convert:BAF})}}isTypeReferenceObject(t){switch(t.type){case"container":return this.isContainerObject(t.container);case"named":return this.isNamedTypeObject(t);case"primitive":return!1;case"unknown":return!0;default:Zo(t)}}isContainerObject(t){switch(t.type){case"map":case"list":case"set":return!0;case"optional":return this.isTypeReferenceObject(t.optional);case"literal":return!1;default:Zo(t)}}isNamedTypeObject(t){let r=this.ir.types[t.typeId];if(r==null)return!0;switch(r.shape.type){case"alias":return this.isTypeReferenceObject(r.shape.aliasOf);case"enum":return!1;case"object":case"union":case"undiscriminatedUnion":return!0;default:Zo(r.shape)}}};function CAF({examples:e,convert:t}){let r=[];for(let i of e){let n=t(i);n!=null&&r.push(n)}return r}function BAF(e){return{...e,queryParameters:e.queryParameters.filter(t=>!gUl(t.value))}}function gUl(e){switch(e.shape.type){case"container":return xAF(e.shape.container);case"named":return IAF(e.shape);case"primitive":return!1;case"unknown":return!0;default:Zo(e.shape)}}function xAF(e){switch(e.type){case"map":case"list":case"set":return!0;case"optional":return e.optional!=null&&gUl(e.optional);default:Zo(e)}}function IAF(e){switch(e.shape.type){case"alias":return gUl(e.shape.value);case"enum":return!1;case"object":case"union":case"undiscriminatedUnion":return!0;default:Zo(e.shape)}}var fzn=Di(ric(),1);var _Bm={laterVersion:"v34",earlierVersion:"v33",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"0.10.4",[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V33.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,requestBody:n.requestBody?._visit({inlinedRequestBody:a=>fzn.FernIrV33.HttpRequestBody.inlinedRequestBody(a),reference:a=>fzn.FernIrV33.HttpRequestBody.reference(a),fileUpload:a=>fzn.FernIrV33.HttpRequestBody.fileUpload({...a,properties:a.properties.map(u=>(u.type==="file"&&u.value.type==="fileArray"&&t.taskContext.logger.warn(`${n.method} ${n.fullPath.head} accepts a list of files however the ${t.targetGenerator?.name}@${t.targetGenerator?.version} only supports accepting a single file. File an [issue](https://github.com/fern-api/fern/issues) to add request for file arrays in ${t.targetGenerator?.name}@${t.targetGenerator?.version}!`),u.type==="file"?fzn.FernIrV33.FileUploadRequestProperty.file({...u.value}):u))}),bytes:a=>fzn.FernIrV33.HttpRequestBody.bytes(a),_other:a=>{}})}))}]))})};var hBm={laterVersion:"v35",earlierVersion:"v34",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:"0.18.0",[K.GO_MODEL]:"0.18.0",[K.GO_SDK]:"0.18.0",[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V34.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(i=>({docs:i.docs,availability:i.availability,id:i.id,name:i.name,displayName:i.displayName,method:i.method,headers:i.headers,baseUrl:i.baseUrl,path:i.path,fullPath:i.fullPath,pathParameters:i.pathParameters,allPathParameters:i.allPathParameters,queryParameters:i.queryParameters,requestBody:i.requestBody,sdkRequest:i.sdkRequest,response:i.response,errors:i.errors,auth:i.auth,idempotent:i.idempotent,examples:i.examples}))}]))})};var yBm={laterVersion:"v36",earlierVersion:"v35",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"0.11.6",[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V35.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e})};var vBm={laterVersion:"v37",earlierVersion:"v36",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.13.0",[K.TYPESCRIPT_BROWSER_SDK]:"0.13.0",[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:"0.13.0",[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"0.12.0",[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V36.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,examples:n.examples.filter(a=>a.exampleType==="userProvided")}))}]))})};var bBm={laterVersion:"v38",earlierVersion:"v37",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.15.0-rc0",[K.TYPESCRIPT_BROWSER_SDK]:"0.15.0-rc0",[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:"0.12.0-rc0",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:"0.9.0-rc0",[K.PYTHON_PYDANTIC]:"0.9.0-rc0",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"1.2.0-rc0",[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V37.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,response:n.response?._visit({fileDownload:a=>he.V37.HttpResponse.fileDownload(a),json:a=>he.V37.HttpResponse.json(a),streaming:a=>a._visit({json:u=>he.V37.HttpResponse.streaming({dataEventType:he.V37.StreamingResponseChunkType.json(u.payload),docs:u.docs,terminator:u.terminator}),sse:()=>{},text:u=>he.V37.HttpResponse.streaming({dataEventType:he.V37.StreamingResponseChunkType.text(),docs:u.docs,terminator:void 0}),_other:()=>{}}),text:a=>he.V37.HttpResponse.text(a),_other:()=>{}})}))}]))})};var gBm={laterVersion:"v39",earlierVersion:"v38",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:"0.9.0-rc1",[K.PYTHON_PYDANTIC]:"0.9.0-rc1",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"1.4.0-rc1",[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:"0.7.0-rc0",[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V38.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,auth:{...e.auth,schemes:e.auth.schemes.map(r=>zAF(r))}})};function zAF(e){switch(e.type){case"basic":return he.V38.AuthScheme.basic(e);case"bearer":return he.V38.AuthScheme.bearer(e);case"header":return he.V38.AuthScheme.header(e);case"oauth":return he.V38.AuthScheme.bearer({docs:e.docs,token:{originalName:"token",camelCase:{unsafeName:"token",safeName:"token"},pascalCase:{unsafeName:"Token",safeName:"Token"},snakeCase:{unsafeName:"token",safeName:"token"},screamingSnakeCase:{unsafeName:"TOKEN",safeName:"TOKEN"}},tokenEnvVar:void 0});default:Zo(e)}}var OBm={laterVersion:"v40",earlierVersion:"v39",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:"0.20.0",[K.GO_MODEL]:"0.20.0",[K.GO_SDK]:"0.20.0",[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V39.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e})};var mBm={laterVersion:"v41",earlierVersion:"v40",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V40.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,errors:Object.fromEntries(Object.entries(e.errors).map(([r,i])=>[r,{name:i.name,discriminantValue:i.discriminantValue,type:i.type,statusCode:i.statusCode,docs:i.docs}]))})};var PBm={laterVersion:"v42",earlierVersion:"v41",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:"0.8.0-rc0",[K.JAVA_SDK]:"0.9.0-rc0",[K.JAVA_SPRING]:"0.8.0-rc0",[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V41.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,auth:{...e.auth,schemes:e.auth.schemes.map(r=>RAF(r))}})};function RAF(e){switch(e.type){case"basic":return he.V41.AuthScheme.basic(e);case"bearer":return he.V41.AuthScheme.bearer(e);case"header":return he.V41.AuthScheme.header(e);case"oauth":return he.V41.AuthScheme.oauth(FAF(e));default:Zo(e)}}function FAF(e){switch(e.configuration.type){case"clientCredentials":return{...e,configuration:he.V41.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:{...e.configuration.tokenEndpoint,endpointReference:e.configuration.tokenEndpoint.endpointReference.endpointId},refreshEndpoint:e.configuration.refreshEndpoint!=null?{...e.configuration.refreshEndpoint,endpointReference:e.configuration.refreshEndpoint?.endpointReference.endpointId}:void 0})};default:Zo(e.configuration.type)}}var jBm={laterVersion:"v43",earlierVersion:"v42",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.17.0",[K.TYPESCRIPT_BROWSER_SDK]:"0.17.0",[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:"0.13.0",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V42.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,response:n.response?.body}))}]))})};var SBm={laterVersion:"v44",earlierVersion:"v43",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V43.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,i])=>[r,{...i,endpoints:i.endpoints.map(n=>({...n,examples:n.examples.map(a=>NAF({example:a})).filter(dg)}))}]))})};function NAF({example:e}){return e._visit({userProvided:t=>he.V43.HttpEndpointExample.userProvided(wBm({example:t})),generated:t=>he.V43.HttpEndpointExample.generated(wBm({example:t})),_other:()=>{}})}function wBm({example:e}){return{...e,response:LAF({example:e.response})}}function LAF({example:e}){switch(e.type){case"ok":return UAF({example:e.value});case"error":return he.V43.ExampleResponse.error(e);default:Zo(e)}}function UAF({example:e}){switch(e.type){case"body":return he.V43.ExampleResponse.ok({body:e.value});case"sse":return he.V43.ExampleResponse.ok({body:void 0});case"stream":return he.V43.ExampleResponse.ok({body:void 0});default:Zo(e)}}var DBm={laterVersion:"v45",earlierVersion:"v44",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V44.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=cd(e.types,r=>({...r,shape:he.V45.types.Type._visit(r.shape,{union:i=>he.V44.types.Type.union({...i,baseProperties:i.baseProperties.map(n=>({...n,valueType:rq(n.valueType)})),types:i.types.map(n=>kAF(n))}),enum:he.V44.types.Type.enum,object:i=>he.V44.types.Type.object({...i,properties:i.properties.map(n=>({...n,valueType:rq(n.valueType)}))}),alias:i=>he.V44.types.Type.alias({aliasOf:rq(i.aliasOf),resolvedType:tMF(i.resolvedType)}),undiscriminatedUnion:i=>he.V44.types.Type.undiscriminatedUnion(rMF(i)),_other:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:JAF(e.auth),headers:e.headers.map(r=>dzn(r)),idempotencyHeaders:e.idempotencyHeaders.map(r=>dzn(r)),types:t,services:cd(e.services,r=>iMF(r)),errors:cd(e.errors,r=>gMF(r)),webhookGroups:cd(e.webhookGroups,r=>$AF(r)),websocketChannels:cd(e.websocketChannels,r=>VAF(r)),pathParameters:e.pathParameters.map(r=>AMa(r)),variables:e.variables.map(r=>nMF(r))}}};function VAF(e){return{...e,headers:e.headers.map(t=>dzn(t)),queryParameters:e.queryParameters.map(t=>MMa(t)),pathParameters:e.pathParameters.map(t=>AMa(t)),messages:e.messages.map(t=>WAF(t))}}function WAF(e){return{...e,body:HAF(e.body)}}function HAF(e){switch(e.type){case"inlinedBody":return he.V44.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:rq(t.valueType)}))});case"reference":return he.V44.websocket.WebSocketMessageBody.reference({...e,bodyType:rq(e.bodyType)})}}function $AF(e){return e.map(t=>GAF(t))}function GAF(e){return{...e,headers:e.headers.map(t=>dzn(t)),payload:QAF(e.payload)}}function QAF(e){switch(e.type){case"reference":return he.V44.webhooks.WebhookPayload.reference({...e,payloadType:rq(e.payloadType)});case"inlinedPayload":return he.V44.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:rq(t.valueType)}))})}}function JAF(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V44.auth.AuthScheme.basic(t);case"bearer":return he.V44.auth.AuthScheme.bearer(t);case"header":return he.V44.auth.AuthScheme.header(KAF(t));case"oauth":return he.V44.auth.AuthScheme.oauth(YAF(t))}})}}function KAF(e){return{...e,valueType:rq(e.valueType)}}function YAF(e){return{...e,configuration:he.V44.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:XAF(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?ZAF(e.configuration.refreshEndpoint):void 0})}}function XAF(e){return{...e,requestProperties:{clientId:pzu(e.requestProperties.clientId),clientSecret:pzu(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?pzu(e.requestProperties.scopes):void 0},responseProperties:{accessToken:r$r(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?r$r(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?r$r(e.responseProperties.refreshToken):void 0}}}function ZAF(e){return{...e,requestProperties:{refreshToken:pzu(e.requestProperties.refreshToken)},responseProperties:{accessToken:r$r(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?r$r(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?r$r(e.responseProperties.refreshToken):void 0}}}function dzn(e){return{...e,valueType:rq(e.valueType)}}function rq(e){return he.V45.types.TypeReference._visit(e,{container:t=>he.V44.types.TypeReference.container(EBm(t)),primitive:t=>t.v1==="BIG_INTEGER"?he.V44.types.TypeReference.primitive(he.V44.types.PrimitiveType.String):he.V44.types.TypeReference.primitive(t.v1),named:he.V44.types.TypeReference.named,unknown:he.V44.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function EBm(e){return he.V45.types.ContainerType._visit(e,{list:t=>he.V44.types.ContainerType.list(rq(t)),optional:t=>he.V44.types.ContainerType.optional(rq(t)),set:t=>he.V44.types.ContainerType.set(rq(t)),map:({keyType:t,valueType:r})=>he.V44.types.ContainerType.map({keyType:rq(t),valueType:rq(r)}),literal:he.V44.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function kAF(e){return{...e,shape:eMF(e.shape)}}function eMF(e){return he.V45.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V44.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V44.types.SingleUnionTypeProperties.singleProperty({...t,type:rq(t.type)}),noProperties:he.V44.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function tMF(e){return he.V45.types.ResolvedTypeReference._visit(e,{container:t=>he.V44.types.ResolvedTypeReference.container(EBm(t)),named:he.V44.types.ResolvedTypeReference.named,primitive:t=>t.v1==="BIG_INTEGER"?he.V44.types.ResolvedTypeReference.primitive(he.V44.types.PrimitiveType.String):he.V44.types.ResolvedTypeReference.primitive(t.v1),unknown:he.V44.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function rMF(e){return{members:e.members.map(t=>({...t,type:rq(t.type)}))}}function iMF(e){return{...e,pathParameters:e.pathParameters.map(t=>AMa(t)),headers:e.headers.map(t=>dzn(t)),endpoints:e.endpoints.map(t=>aMF(t))}}function AMa(e){return{...e,valueType:rq(e.valueType)}}function nMF(e){return{...e,type:rq(e.type)}}function aMF(e){return{...e,pagination:e.pagination!=null?lMF(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>AMa(t)),pathParameters:e.pathParameters.map(t=>AMa(t)),sdkRequest:e.sdkRequest!=null?_MF(e.sdkRequest):void 0,requestBody:e.requestBody!=null?vMF(e.requestBody):void 0,response:e.response!=null?oMF(e.response):void 0,headers:e.headers.map(t=>dzn(t)),queryParameters:e.queryParameters.map(t=>MMa(t))}}function oMF(e){return{...e,body:e.body!=null?uMF(e.body):void 0}}function uMF(e){switch(e.type){case"json":return he.V44.http.HttpResponseBody.json(sMF(e.value));case"fileDownload":return he.V44.http.HttpResponseBody.fileDownload(e);case"text":return he.V44.http.HttpResponseBody.text(e);case"streaming":return he.V44.http.HttpResponseBody.streaming(cMF(e.value))}}function sMF(e){switch(e.type){case"response":return he.V44.http.JsonResponse.response({...e,responseBodyType:rq(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V44.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:rq(e.responseBodyType),responseProperty:e.responseProperty!=null?OUl(e.responseProperty):void 0})}}function cMF(e){switch(e.type){case"json":return he.V44.http.StreamingResponse.json({...e,payload:rq(e.payload)});case"text":return he.V44.http.StreamingResponse.text(e);case"sse":return he.V44.http.StreamingResponse.sse({...e,payload:rq(e.payload)})}}function lMF(e){switch(e.type){case"cursor":return he.V44.http.Pagination.cursor(fMF(e));case"offset":return he.V44.http.Pagination.offset(dMF(e))}}function fMF(e){return{...e,page:MMa(e.page),next:r$r(e.next),results:r$r(e.results)}}function dMF(e){return{...e,page:MMa(e.page),results:r$r(e.results)}}function pzu(e){return{...e,property:pMF(e.property)}}function pMF(e){switch(e.type){case"query":return he.V44.RequestPropertyValue.query(MMa(e));case"body":return he.V44.RequestPropertyValue.body(OUl(e))}}function r$r(e){return{...e,property:OUl(e.property)}}function OUl(e){return{...e,valueType:rq(e.valueType)}}function MMa(e){return{...e,valueType:rq(e.valueType)}}function _MF(e){return{...e,shape:hMF(e.shape)}}function hMF(e){return he.V45.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V44.http.SdkRequestShape.justRequestBody(yMF(t)),wrapper:he.V44.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function yMF(e){switch(e.type){case"bytes":return he.V44.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V44.http.SdkRequestBodyType.typeReference({...e,requestBodyType:rq(e.requestBodyType)})}}function vMF(e){return he.V45.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V44.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:rq(r.valueType)}))}),reference:t=>he.V44.http.HttpRequestBody.reference({...t,requestBodyType:rq(t.requestBodyType)}),fileUpload:t=>he.V44.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V44.http.FileUploadRequestProperty.bodyProperty({...r,valueType:rq(r.valueType)});case"file":return he.V44.http.FileUploadRequestProperty.file(bMF(r.value))}})}),bytes:t=>he.V44.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function bMF(e){switch(e.type){case"file":return he.V44.http.FileProperty.file(e);case"fileArray":return he.V44.http.FileProperty.fileArray(e)}}function gMF(e){return{...e,type:e.type!=null?rq(e.type):void 0}}var MBm={laterVersion:"v46",earlierVersion:"v45",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.21.0",[K.TYPESCRIPT_BROWSER_SDK]:"0.21.0",[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:"0.16.0",[K.JAVA]:Ge,[K.JAVA_MODEL]:"0.9.0",[K.JAVA_SDK]:"0.10.0",[K.JAVA_SPRING]:"0.9.0",[K.PYTHON_FASTAPI]:"0.10.1",[K.PYTHON_PYDANTIC]:"0.9.1",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"2.9.9",[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V45.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,{...r,examples:OMF(r.examples)}])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(i=>({...i,examples:mMF(i.examples)}))}])),websocketChannels:e.websocketChannels!=null?Object.fromEntries(Object.entries(e.websocketChannels).map(([t,r])=>[t,{...r,examples:PMF(r.examples)}])):void 0,errors:Object.fromEntries(Object.entries(e.errors).map(([t,r])=>[t,{...r,examples:r.examples.map(i=>({...i,shape:pN(i.shape)}))}]))})};function pN(e){return e.shape._visit({container:t=>({...e,shape:t._visit({list:r=>he.V45.ExampleTypeReferenceShape.container(he.V45.ExampleContainer.list(r.map(i=>pN(i)))),set:r=>he.V45.ExampleTypeReferenceShape.container(he.V45.ExampleContainer.set(r.map(i=>pN(i)))),map:r=>he.V45.ExampleTypeReferenceShape.container(he.V45.ExampleContainer.map(r.map(i=>({key:pN(i.key),value:pN(i.value)})))),optional:r=>he.V45.ExampleTypeReferenceShape.container(he.V45.ExampleContainer.optional(r!=null?pN(r):void 0)),literal:r=>he.V45.ExampleTypeReferenceShape.primitive(r._visit({string:i=>he.V45.ExamplePrimitive.string(i),integer:i=>he.V45.ExamplePrimitive.integer(i),double:i=>he.V45.ExamplePrimitive.double(i),long:i=>he.V45.ExamplePrimitive.long(i),boolean:i=>he.V45.ExamplePrimitive.boolean(i),datetime:i=>he.V45.ExamplePrimitive.datetime(i),date:i=>he.V45.ExamplePrimitive.date(i),uuid:i=>he.V45.ExamplePrimitive.uuid(i),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})),_other:r=>{throw new Error(`Unexpected value: ${JSON.stringify(r)}`)}})}),named:t=>({...e,shape:he.V45.ExampleTypeReferenceShape.named({...t,shape:qBm(t.shape)})}),primitive:t=>({...e,shape:he.V45.ExampleTypeReferenceShape.primitive(t._visit({string:r=>he.V45.ExamplePrimitive.string(r),integer:r=>he.V45.ExamplePrimitive.integer(r),double:r=>he.V45.ExamplePrimitive.double(r),long:r=>he.V45.ExamplePrimitive.long(r),boolean:r=>he.V45.ExamplePrimitive.boolean(r),datetime:r=>he.V45.ExamplePrimitive.datetime(r),date:r=>he.V45.ExamplePrimitive.date(r),uuid:r=>he.V45.ExamplePrimitive.uuid(r),_other:r=>{throw new Error(`Unexpected value: ${JSON.stringify(r)}`)}}))}),unknown:t=>({...e,shape:he.V45.ExampleTypeReferenceShape.unknown(t)}),_other:t=>{throw new Error(`Unexpected value: ${JSON.stringify(t)}`)}})}function ABm(e){return{...e,properties:e.properties.map(t=>({...t,value:pN(t.value)}))}}function qBm(e){return e.type==="alias"?he.V45.ExampleTypeShape.alias({value:pN(e.value)}):e.type==="object"?he.V45.ExampleTypeShape.object(ABm(e)):e.type==="union"?he.V45.ExampleTypeShape.union({...e,singleUnionType:{...e.singleUnionType,shape:e.singleUnionType.shape._visit({samePropertiesAsObject:t=>he.V45.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...t,object:ABm(t.object)}),singleProperty:t=>he.V45.ExampleSingleUnionTypeProperties.singleProperty(pN(t)),noProperties:()=>he.V45.ExampleSingleUnionTypeProperties.noProperties(),_other:t=>{throw new Error(`Unexpected value: ${JSON.stringify(t)}`)}})}}):e.type==="undiscriminatedUnion"?he.V45.ExampleTypeShape.undiscriminatedUnion({...e,singleUnionType:pN(e.singleUnionType)}):he.V45.ExampleTypeShape.enum(e)}function OMF(e){return e.map(t=>({...t,shape:qBm(t.shape)}))}function _zu(e){return e.map(t=>({...t,value:pN(t.value)}))}function mUl(e){return e.map(t=>({...t,value:pN(t.value)}))}function TBm(e){return e.map(t=>({...t,value:pN(t.value)}))}function mMF(e){return e.map(t=>{let r={...t,rootPathParameters:_zu(t.rootPathParameters),servicePathParameters:_zu(t.servicePathParameters),endpointPathParameters:_zu(t.endpointPathParameters),serviceHeaders:mUl(t.serviceHeaders),endpointHeaders:mUl(t.endpointHeaders),queryParameters:TBm(t.queryParameters),request:t.request?._visit({inlinedRequestBody:i=>he.V45.ExampleRequestBody.inlinedRequestBody({...i,properties:i.properties.map(n=>({...n,value:pN(n.value)}))}),reference:i=>he.V45.ExampleRequestBody.reference(pN(i)),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}}),response:t.response._visit({ok:i=>he.V45.ExampleResponse.ok(i._visit({body:n=>he.V45.ExampleEndpointSuccessResponse.body(n!=null?pN(n):void 0),stream:n=>he.V45.ExampleEndpointSuccessResponse.stream(n.map(pN)),sse:n=>he.V45.ExampleEndpointSuccessResponse.sse(n.map(a=>({...a,data:pN(a.data)}))),_other:n=>{throw new Error(`Unexpected value: ${JSON.stringify(n)}`)}})),error:i=>he.V45.ExampleResponse.error({...i,body:i.body!=null?pN(i.body):void 0}),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})};return t._visit({userProvided:()=>he.V45.HttpEndpointExample.userProvided(r),generated:()=>he.V45.HttpEndpointExample.generated(r),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})})}function PMF(e){return e.map(t=>({...t,pathParameters:_zu(t.pathParameters),headers:mUl(t.headers),queryParameters:TBm(t.queryParameters),messages:t.messages.map(r=>({...r,body:r.body._visit({inlinedBody:i=>he.V45.ExampleWebSocketMessageBody.inlinedBody({...i,properties:i.properties.map(n=>({...n,value:pN(n.value)}))}),reference:i=>he.V45.ExampleWebSocketMessageBody.reference(pN(i)),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})}))}))}var CBm={laterVersion:"v47",earlierVersion:"v46",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V46.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>{let i=r.endpoints.map(n=>{let{autogeneratedExamples:a,userSpecifiedExamples:u,...l}=n;return{...l,autogeneratedExamples:void 0,userSpecifiedExamples:void 0,examples:[...n.userSpecifiedExamples.map(s=>{if(s.example!=null)return he.V46.HttpEndpointExample.userProvided({...s.example,codeSamples:s.codeSamples})}).filter(dg),...n.autogeneratedExamples.map(s=>he.V46.HttpEndpointExample.generated({...s.example,codeSamples:void 0}))]}});return[t,{...r,endpoints:i}]}))})};var BBm={laterVersion:"v48",earlierVersion:"v47",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.29.0",[K.TYPESCRIPT_BROWSER_SDK]:"0.29.0",[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:"0.17.0",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V47.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=Object.fromEntries(Object.entries(e.services).map(([r,i])=>{let n=i.endpoints.map(a=>({...a,pagination:a.pagination!=null?wMF(a.pagination):void 0}));return[r,{...i,endpoints:n}]}));return{...e,sdkConfig:{...e.sdkConfig,hasPaginatedEndpoints:jMF(t)},services:t}}};function jMF(e){for(let t of Object.values(e))for(let r of t.endpoints)if(r.pagination!=null)return!0;return!1}function wMF(e){switch(e.type){case"cursor":{let t=SMF(e);return t!=null?he.V47.Pagination.cursor(t):void 0}case"offset":{let t=DMF(e);return t!=null?he.V47.Pagination.offset(t):void 0}default:Zo(e)}}function SMF(e){let t=xBm(e.page);if(t!=null)return{...e,page:t}}function DMF(e){if(e.step!=null)return;let t=xBm(e.page);if(t!=null)return{...e,page:t}}function xBm(e){switch(e.property.type){case"query":return e.property}}var IBm={laterVersion:"v49",earlierVersion:"v48",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:"0.11.0-rc0",[K.PYTHON_PYDANTIC]:"0.10.0-rc0",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:"2.11.0-rc0",[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:ni,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V48.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=Object.fromEntries(Object.entries(e.services).map(([r,i])=>{let n=i.endpoints.flatMap(a=>{let u;return a.response?.body!=null&&(u=a.response.body?._visit({json:f=>he.V48.HttpResponseBody.json({...f}),fileDownload:f=>he.V48.HttpResponseBody.fileDownload({...f}),text:f=>he.V48.HttpResponseBody.text({...f}),streaming:f=>he.V48.HttpResponseBody.streaming({...f}),streamParameter:()=>{},_other:()=>{}}),u==null)?[]:{...a,response:a.response==null?void 0:{statusCode:a.response?.statusCode,body:u}}});return[r,{...i,endpoints:n}]}));return{...e,services:t}}};var zBm={laterVersion:"v50",earlierVersion:"v49",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.34.0",[K.TYPESCRIPT_BROWSER_SDK]:"0.34.0",[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:"0.17.2",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:"0.0.0",[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V49.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=cd(e.types,r=>({...r,shape:he.V50.types.Type._visit(r.shape,{union:i=>he.V49.types.Type.union({...i,baseProperties:i.baseProperties.map(n=>({...n,valueType:iq(n.valueType)})),types:i.types.map(n=>FMF(n))}),enum:he.V49.types.Type.enum,object:i=>he.V49.types.Type.object({...i,properties:i.properties.map(n=>({...n,valueType:iq(n.valueType)}))}),alias:i=>he.V49.types.Type.alias({aliasOf:iq(i.aliasOf),resolvedType:LMF(i.resolvedType)}),undiscriminatedUnion:i=>he.V49.types.Type.undiscriminatedUnion(UMF(i)),_other:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:BMF(e.auth),headers:e.headers.map(r=>pzn(r)),idempotencyHeaders:e.idempotencyHeaders.map(r=>pzn(r)),types:t,services:cd(e.services,r=>VMF(r)),errors:cd(e.errors,r=>nqF(r)),webhookGroups:cd(e.webhookGroups,r=>qMF(r)),websocketChannels:cd(e.websocketChannels,r=>EMF(r)),pathParameters:e.pathParameters.map(r=>qMa(r)),variables:e.variables.map(r=>WMF(r))}}};function EMF(e){return{...e,headers:e.headers.map(t=>pzn(t)),queryParameters:e.queryParameters.map(t=>jUl(t)),pathParameters:e.pathParameters.map(t=>qMa(t)),messages:e.messages.map(t=>AMF(t))}}function AMF(e){return{...e,body:MMF(e.body)}}function MMF(e){switch(e.type){case"inlinedBody":return he.V49.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:iq(t.valueType)}))});case"reference":return he.V49.websocket.WebSocketMessageBody.reference({...e,bodyType:iq(e.bodyType)})}}function qMF(e){return e.map(t=>TMF(t))}function TMF(e){return{...e,headers:e.headers.map(t=>pzn(t)),payload:CMF(e.payload)}}function CMF(e){switch(e.type){case"reference":return he.V49.webhooks.WebhookPayload.reference({...e,payloadType:iq(e.payloadType)});case"inlinedPayload":return he.V49.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:iq(t.valueType)}))})}}function BMF(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V49.auth.AuthScheme.basic(t);case"bearer":return he.V49.auth.AuthScheme.bearer(t);case"header":return he.V49.auth.AuthScheme.header(xMF(t));case"oauth":return he.V49.auth.AuthScheme.oauth(IMF(t))}})}}function xMF(e){return{...e,valueType:iq(e.valueType)}}function IMF(e){return{...e,configuration:he.V49.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:zMF(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?RMF(e.configuration.refreshEndpoint):void 0})}}function zMF(e){return{...e,requestProperties:{clientId:q_i(e.requestProperties.clientId),clientSecret:q_i(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?q_i(e.requestProperties.scopes):void 0},responseProperties:{accessToken:i$r(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?i$r(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?i$r(e.responseProperties.refreshToken):void 0}}}function RMF(e){return{...e,requestProperties:{refreshToken:q_i(e.requestProperties.refreshToken)},responseProperties:{accessToken:i$r(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?i$r(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?i$r(e.responseProperties.refreshToken):void 0}}}function pzn(e){return{...e,valueType:iq(e.valueType)}}function iq(e){return he.V50.types.TypeReference._visit(e,{container:t=>he.V49.types.TypeReference.container(RBm(t)),primitive:t=>t.v2?.type==="integer"?he.V49.types.TypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.integer(t.v2)}):t.v2?.type==="double"?he.V49.types.TypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.double(t.v2)}):t.v2?.type==="string"?he.V49.types.TypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.string(t.v2)}):he.V49.types.TypeReference.primitive({v1:t.v1,v2:void 0}),named:he.V49.types.TypeReference.named,unknown:he.V49.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function RBm(e){return he.V50.types.ContainerType._visit(e,{list:t=>he.V49.types.ContainerType.list(iq(t)),optional:t=>he.V49.types.ContainerType.optional(iq(t)),set:t=>he.V49.types.ContainerType.set(iq(t)),map:({keyType:t,valueType:r})=>he.V49.types.ContainerType.map({keyType:iq(t),valueType:iq(r)}),literal:he.V49.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function FMF(e){return{...e,shape:NMF(e.shape)}}function NMF(e){return he.V50.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V49.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V49.types.SingleUnionTypeProperties.singleProperty({...t,type:iq(t.type)}),noProperties:he.V49.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function LMF(e){return he.V50.types.ResolvedTypeReference._visit(e,{container:t=>he.V49.types.ResolvedTypeReference.container(RBm(t)),named:he.V49.types.ResolvedTypeReference.named,primitive:t=>t.v2?.type==="integer"?he.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.integer(t.v2)}):t.v2?.type==="double"?he.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.double(t.v2)}):t.v2?.type==="string"?he.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:he.V49.types.PrimitiveTypeV2.string(t.v2)}):he.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:void 0}),unknown:he.V49.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function UMF(e){return{members:e.members.map(t=>({...t,type:iq(t.type)}))}}function VMF(e){return{...e,pathParameters:e.pathParameters.map(t=>qMa(t)),headers:e.headers.map(t=>pzn(t)),endpoints:e.endpoints.map(t=>HMF(t))}}function qMa(e){return{...e,valueType:iq(e.valueType)}}function WMF(e){return{...e,type:iq(e.type)}}function HMF(e){return{...e,pagination:e.pagination!=null?KMF(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>qMa(t)),pathParameters:e.pathParameters.map(t=>qMa(t)),sdkRequest:e.sdkRequest!=null?kMF(e.sdkRequest):void 0,requestBody:e.requestBody!=null?rqF(e.requestBody):void 0,response:e.response!=null?$MF(e.response):void 0,headers:e.headers.map(t=>pzn(t)),queryParameters:e.queryParameters.map(t=>jUl(t))}}function $MF(e){return{...e,body:e.body!=null?GMF(e.body):void 0}}function GMF(e){switch(e.type){case"json":return he.V49.http.HttpResponseBody.json(FBm(e.value));case"fileDownload":return he.V49.http.HttpResponseBody.fileDownload(e);case"text":return he.V49.http.HttpResponseBody.text(e);case"streaming":return he.V49.http.HttpResponseBody.streaming(NBm(e.value));case"streamParameter":return he.V49.http.HttpResponseBody.streamParameter(JMF(e))}}function FBm(e){switch(e.type){case"response":return he.V49.http.JsonResponse.response({...e,responseBodyType:iq(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V49.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:iq(e.responseBodyType),responseProperty:e.responseProperty!=null?PUl(e.responseProperty):void 0})}}function NBm(e){switch(e.type){case"json":return he.V49.http.StreamingResponse.json({...e,payload:iq(e.payload)});case"text":return he.V49.http.StreamingResponse.text(e);case"sse":return he.V49.http.StreamingResponse.sse({...e,payload:iq(e.payload)})}}function QMF(e){switch(e.type){case"json":return he.V49.http.NonStreamHttpResponseBody.json(FBm(e.value));case"text":return he.V49.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return he.V49.http.NonStreamHttpResponseBody.fileDownload(e)}}function JMF(e){return{nonStreamResponse:QMF(e.nonStreamResponse),streamResponse:NBm(e.streamResponse)}}function KMF(e){switch(e.type){case"cursor":return he.V49.http.Pagination.cursor(YMF(e));case"offset":return he.V49.http.Pagination.offset(XMF(e))}}function YMF(e){return{...e,page:q_i(e.page),next:i$r(e.next),results:i$r(e.results)}}function XMF(e){return{...e,page:q_i(e.page),results:i$r(e.results),step:e.step!=null?q_i(e.step):void 0}}function q_i(e){return{...e,property:ZMF(e.property)}}function ZMF(e){switch(e.type){case"query":return he.V49.RequestPropertyValue.query(jUl(e));case"body":return he.V49.RequestPropertyValue.body(PUl(e))}}function i$r(e){return{...e,property:PUl(e.property)}}function PUl(e){return{...e,valueType:iq(e.valueType)}}function jUl(e){return{...e,valueType:iq(e.valueType)}}function kMF(e){return{...e,streamParameter:e.streamParameter!=null?q_i(e.streamParameter):void 0,shape:eqF(e.shape)}}function eqF(e){return he.V50.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V49.http.SdkRequestShape.justRequestBody(tqF(t)),wrapper:he.V49.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function tqF(e){switch(e.type){case"bytes":return he.V49.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V49.http.SdkRequestBodyType.typeReference({...e,requestBodyType:iq(e.requestBodyType)})}}function rqF(e){return he.V50.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V49.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:iq(r.valueType)}))}),reference:t=>he.V49.http.HttpRequestBody.reference({...t,requestBodyType:iq(t.requestBodyType)}),fileUpload:t=>he.V49.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V49.http.FileUploadRequestProperty.bodyProperty({...r,valueType:iq(r.valueType)});case"file":return he.V49.http.FileUploadRequestProperty.file(iqF(r.value))}})}),bytes:t=>he.V49.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function iqF(e){switch(e.type){case"file":return he.V49.http.FileProperty.file(e);case"fileArray":return he.V49.http.FileProperty.fileArray(e)}}function nqF(e){return{...e,type:e.type!=null?iq(e.type):void 0}}var VBm={laterVersion:"v51",earlierVersion:"v50",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:"0.1.2",[K.SWIFT_MODEL]:Ge,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V50.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=cd(e.types,r=>{let i=r.autogeneratedExamples.map(a=>LBm(a)),n=r.userProvidedExamples.map(a=>LBm(a));return{...r,examples:[...i,...n]}});return{...e,types:t,services:cd(e.services,r=>hqF(r)),errors:cd(e.errors,r=>OqF(r)),webhookGroups:cd(e.webhookGroups,r=>sqF(r)),websocketChannels:cd(e.websocketChannels,r=>aqF(r))}}};function aqF(e){return{...e,examples:e.examples.map(t=>oqF(t))}}function oqF(e){return{...e,pathParameters:e.pathParameters.map(t=>hzu(t)),headers:e.headers.map(t=>wUl(t)),queryParameters:e.queryParameters.map(t=>WBm(t)),messages:e.messages.map(t=>({...t,body:uqF(t.body)}))}}function WBm(e){return{...e,value:S6(e.value)}}function wUl(e){return{...e,value:S6(e.value)}}function hzu(e){return{...e,value:S6(e.value)}}function uqF(e){switch(e.type){case"inlinedBody":return he.V50.ExampleWebSocketMessageBody.inlinedBody(HBm(e));case"reference":return he.V50.ExampleWebSocketMessageBody.reference(S6(e))}}function HBm(e){return{...e,properties:e.properties.map(t=>({...t,value:S6(t.value)}))}}function sqF(e){return e.map(t=>({...t,examples:t.examples?.map(r=>({...r,payload:S6(r.payload)}))}))}function LBm(e){return{...e,shape:$Bm(e.shape)}}function SUl(e){switch(e.type){case"primitive":return he.V50.ExampleTypeReferenceShape.primitive({...e.primitive});case"container":return he.V50.ExampleTypeReferenceShape.container(cqF(e));case"unknown":return he.V50.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return he.V50.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:$Bm(e.shape)})}}function cqF(e){switch(e.container.type){case"list":return he.V50.ExampleContainer.list(e.container.list.map(t=>S6(t)));case"set":return he.V50.ExampleContainer.set(e.container.set.map(t=>S6(t)));case"optional":return he.V50.ExampleContainer.optional(e.container.optional!=null?S6(e.container.optional):void 0);case"map":return he.V50.ExampleContainer.map(e.container.map.map(t=>({key:S6(t.key),value:S6(t.value)})));case"literal":return he.V50.ExampleContainer.literal(e.container.literal)}}function S6(e){return{...e,shape:SUl(e.shape)}}function $Bm(e){switch(e.type){case"object":return he.V50.ExampleTypeShape.object({properties:e.properties.map(t=>GBm(t))});case"alias":return he.V50.ExampleTypeShape.alias({value:{...S6(e.value)}});case"enum":return he.V50.ExampleTypeShape.enum(e);case"union":return he.V50.ExampleTypeShape.union(fqF(e));case"undiscriminatedUnion":return he.V50.ExampleTypeShape.undiscriminatedUnion(lqF(e))}}function lqF(e){return{...e,singleUnionType:S6(e.singleUnionType)}}function fqF(e){return{...e,singleUnionType:dqF(e.singleUnionType)}}function dqF(e){return{...e,shape:pqF(e.shape)}}function pqF(e){switch(e.type){case"samePropertiesAsObject":return he.V50.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:_qF(e.object)});case"singleProperty":return he.V50.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:SUl(e.shape)});case"noProperties":return he.V50.ExampleSingleUnionTypeProperties.noProperties()}}function _qF(e){return{...e,properties:e.properties.map(t=>GBm(t))}}function GBm(e){return{...e,value:{...e.value,shape:SUl(e.value.shape)}}}function hqF(e){return{...e,endpoints:e.endpoints.map(t=>yqF(t))}}function yqF(e){return{...e,autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:UBm(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?UBm(t.example):void 0}))}}function UBm(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>hzu(t)),servicePathParameters:e.servicePathParameters.map(t=>hzu(t)),endpointPathParameters:e.endpointPathParameters.map(t=>hzu(t)),serviceHeaders:e.serviceHeaders.map(t=>wUl(t)),endpointHeaders:e.endpointHeaders.map(t=>wUl(t)),queryParameters:e.queryParameters.map(t=>WBm(t)),request:e.request!=null?gqF(e.request):void 0,response:vqF(e.response)}}function vqF(e){switch(e.type){case"error":return he.V50.ExampleResponse.error({...e,body:e.body!=null?S6(e.body):void 0});case"ok":return he.V50.ExampleResponse.ok(bqF(e))}}function bqF(e){switch(e.value.type){case"body":return he.V50.ExampleEndpointSuccessResponse.body(e.value.value!=null?S6(e.value.value):void 0);case"stream":return he.V50.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>S6(t)));case"sse":return he.V50.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:S6(t.data)})))}}function gqF(e){switch(e.type){case"inlinedRequestBody":return he.V50.ExampleRequestBody.inlinedRequestBody(HBm(e));case"reference":return he.V50.ExampleRequestBody.reference(S6(e))}}function OqF(e){return{...e,examples:e.examples.map(t=>({...t,shape:S6(t.shape)}))}}var KBm={laterVersion:"v52",earlierVersion:"v51",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:Ge,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:ni},jsonifyEarlierVersion:e=>eh.V51.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?PqF(e.apiVersion):void 0,auth:qqF(e.auth),headers:e.headers.map(t=>LWi(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>LWi(t)),types:mqF(e.types),services:cd(e.services,t=>UqF(t)),webhookGroups:cd(e.webhookGroups,t=>DqF(t)),websocketChannels:cd(e.websocketChannels,t=>jqF(t)),errors:cd(e.errors,t=>iTF(t)),pathParameters:e.pathParameters.map(t=>TMa(t)),variables:e.variables.map(t=>VqF(t))})};function mqF(e){return cd(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>QBm(r)),userProvidedExamples:t.userProvidedExamples.map(r=>QBm(r)),shape:he.V52.types.Type._visit(t.shape,{union:r=>he.V51.types.Type.union({...r,baseProperties:r.baseProperties.map(i=>({...i,valueType:HD(i.valueType)})),types:r.types.map(i=>RqF(i))}),enum:he.V51.types.Type.enum,object:r=>he.V51.types.Type.object({...r,properties:r.properties.map(i=>({...i,valueType:HD(i.valueType)}))}),alias:r=>he.V51.types.Type.alias({aliasOf:HD(r.aliasOf),resolvedType:NqF(r.resolvedType)}),undiscriminatedUnion:r=>he.V51.types.Type.undiscriminatedUnion(LqF(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function PqF(e){return he.V51.ApiVersionScheme.header({...e,header:LWi(e.header)})}function jqF(e){return{...e,headers:e.headers.map(t=>LWi(t)),queryParameters:e.queryParameters.map(t=>AUl(t)),pathParameters:e.pathParameters.map(t=>TMa(t)),messages:e.messages.map(t=>wqF(t)),examples:e.examples.map(t=>nTF(t))}}function wqF(e){return{...e,body:SqF(e.body)}}function SqF(e){switch(e.type){case"inlinedBody":return he.V51.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:HD(t.valueType)}))});case"reference":return he.V51.websocket.WebSocketMessageBody.reference({...e,bodyType:HD(e.bodyType)})}}function DqF(e){return e.map(t=>EqF(t))}function EqF(e){return{...e,headers:e.headers.map(t=>LWi(t)),payload:AqF(e.payload),examples:e.examples!=null?e.examples.map(t=>MqF(t)):void 0}}function AqF(e){switch(e.type){case"reference":return he.V51.webhooks.WebhookPayload.reference({...e,payloadType:HD(e.payloadType)});case"inlinedPayload":return he.V51.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:HD(t.valueType)}))})}}function MqF(e){return{...e,payload:D6(e.payload)}}function qqF(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V51.auth.AuthScheme.basic(t);case"bearer":return he.V51.auth.AuthScheme.bearer(t);case"header":return he.V51.auth.AuthScheme.header(TqF(t));case"oauth":return he.V51.auth.AuthScheme.oauth(CqF(t))}})}}function TqF(e){return{...e,valueType:HD(e.valueType)}}function CqF(e){return{...e,configuration:he.V51.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:BqF(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?xqF(e.configuration.refreshEndpoint):void 0})}}function BqF(e){return{...e,requestProperties:{clientId:T_i(e.requestProperties.clientId),clientSecret:T_i(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?T_i(e.requestProperties.scopes):void 0},responseProperties:{accessToken:n$r(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?n$r(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?n$r(e.responseProperties.refreshToken):void 0}}}function xqF(e){return{...e,requestProperties:{refreshToken:T_i(e.requestProperties.refreshToken)},responseProperties:{accessToken:n$r(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?n$r(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?n$r(e.responseProperties.refreshToken):void 0}}}function LWi(e){return{...e,valueType:HD(e.valueType)}}function HD(e){return he.V52.types.TypeReference._visit(e,{container:t=>he.V51.types.TypeReference.container(XBm(t)),primitive:t=>he.V51.types.TypeReference.primitive(YBm(t)),named:he.V51.types.TypeReference.named,unknown:he.V51.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function YBm(e){return{v1:IqF(e.v1),v2:e.v2!=null?zqF(e.v2):void 0}}function IqF(e){switch(e){case"UINT":return he.V51.types.PrimitiveTypeV1.Integer;case"UINT_64":return he.V51.types.PrimitiveTypeV1.Long}return e}function zqF(e){switch(e.type){case"integer":return he.V51.types.PrimitiveTypeV2.integer(e);case"double":return he.V51.types.PrimitiveTypeV2.double(e);case"string":return he.V51.types.PrimitiveTypeV2.string(e);case"boolean":return he.V51.types.PrimitiveTypeV2.boolean(e);case"long":return he.V51.types.PrimitiveTypeV2.long(e);case"bigInteger":return he.V51.types.PrimitiveTypeV2.bigInteger(e);case"uint":return;case"uint64":return;default:Zo(e)}}function XBm(e){return he.V52.types.ContainerType._visit(e,{list:t=>he.V51.types.ContainerType.list(HD(t)),optional:t=>he.V51.types.ContainerType.optional(HD(t)),set:t=>he.V51.types.ContainerType.set(HD(t)),map:({keyType:t,valueType:r})=>he.V51.types.ContainerType.map({keyType:HD(t),valueType:HD(r)}),literal:he.V51.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function RqF(e){return{...e,shape:FqF(e.shape)}}function FqF(e){return he.V52.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V51.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V51.types.SingleUnionTypeProperties.singleProperty({...t,type:HD(t.type)}),noProperties:he.V51.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function NqF(e){return he.V52.types.ResolvedTypeReference._visit(e,{container:t=>he.V51.types.ResolvedTypeReference.container(XBm(t)),named:he.V51.types.ResolvedTypeReference.named,primitive:t=>he.V51.types.ResolvedTypeReference.primitive(YBm(t)),unknown:he.V51.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function LqF(e){return{members:e.members.map(t=>({...t,type:HD(t.type)}))}}function UqF(e){return{...e,pathParameters:e.pathParameters.map(t=>TMa(t)),headers:e.headers.map(t=>LWi(t)),endpoints:e.endpoints.map(t=>WqF(t))}}function TMa(e){return{...e,valueType:HD(e.valueType)}}function VqF(e){return{...e,type:HD(e.type)}}function WqF(e){return{...e,pagination:e.pagination!=null?JqF(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>TMa(t)),pathParameters:e.pathParameters.map(t=>TMa(t)),sdkRequest:e.sdkRequest!=null?ZqF(e.sdkRequest):void 0,requestBody:e.requestBody!=null?tTF(e.requestBody):void 0,response:e.response!=null?HqF(e.response):void 0,headers:e.headers.map(t=>LWi(t)),queryParameters:e.queryParameters.map(t=>AUl(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:JBm(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?JBm(t.example):void 0}))}}function HqF(e){return{...e,body:e.body!=null?$qF(e.body):void 0}}function $qF(e){switch(e.type){case"json":return he.V51.http.HttpResponseBody.json(ZBm(e.value));case"fileDownload":return he.V51.http.HttpResponseBody.fileDownload(e);case"text":return he.V51.http.HttpResponseBody.text(e);case"streaming":return he.V51.http.HttpResponseBody.streaming(kBm(e.value));case"streamParameter":return he.V51.http.HttpResponseBody.streamParameter(QqF(e))}}function ZBm(e){switch(e.type){case"response":return he.V51.http.JsonResponse.response({...e,responseBodyType:HD(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V51.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:HD(e.responseBodyType),responseProperty:e.responseProperty!=null?EUl(e.responseProperty):void 0})}}function kBm(e){switch(e.type){case"json":return he.V51.http.StreamingResponse.json({...e,payload:HD(e.payload)});case"text":return he.V51.http.StreamingResponse.text(e);case"sse":return he.V51.http.StreamingResponse.sse({...e,payload:HD(e.payload)})}}function GqF(e){switch(e.type){case"json":return he.V51.http.NonStreamHttpResponseBody.json(ZBm(e.value));case"text":return he.V51.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return he.V51.http.NonStreamHttpResponseBody.fileDownload(e)}}function QqF(e){return{nonStreamResponse:GqF(e.nonStreamResponse),streamResponse:kBm(e.streamResponse)}}function JqF(e){switch(e.type){case"cursor":return he.V51.http.Pagination.cursor(KqF(e));case"offset":return he.V51.http.Pagination.offset(YqF(e))}}function KqF(e){return{...e,page:T_i(e.page),next:n$r(e.next),results:n$r(e.results)}}function YqF(e){return{...e,page:T_i(e.page),results:n$r(e.results),step:e.step!=null?T_i(e.step):void 0}}function T_i(e){return{...e,property:XqF(e.property)}}function XqF(e){switch(e.type){case"query":return he.V51.RequestPropertyValue.query(AUl(e));case"body":return he.V51.RequestPropertyValue.body(EUl(e))}}function n$r(e){return{...e,property:EUl(e.property)}}function EUl(e){return{...e,valueType:HD(e.valueType)}}function AUl(e){return{...e,valueType:HD(e.valueType)}}function ZqF(e){return{...e,streamParameter:e.streamParameter!=null?T_i(e.streamParameter):void 0,shape:kqF(e.shape)}}function kqF(e){return he.V52.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V51.http.SdkRequestShape.justRequestBody(eTF(t)),wrapper:he.V51.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function eTF(e){switch(e.type){case"bytes":return he.V51.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V51.http.SdkRequestBodyType.typeReference({...e,requestBodyType:HD(e.requestBodyType)})}}function tTF(e){return he.V52.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V51.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:HD(r.valueType)}))}),reference:t=>he.V51.http.HttpRequestBody.reference({...t,requestBodyType:HD(t.requestBodyType)}),fileUpload:t=>he.V51.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V51.http.FileUploadRequestProperty.bodyProperty({...r,valueType:HD(r.valueType)});case"file":return he.V51.http.FileUploadRequestProperty.file(rTF(r.value))}})}),bytes:t=>he.V51.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function rTF(e){switch(e.type){case"file":return he.V51.http.FileProperty.file(e);case"fileArray":return he.V51.http.FileProperty.fileArray(e)}}function iTF(e){return{...e,type:e.type!=null?HD(e.type):void 0,examples:e.examples.map(t=>({...t,shape:D6(t.shape)}))}}function nTF(e){return{...e,pathParameters:e.pathParameters.map(t=>yzu(t)),headers:e.headers.map(t=>DUl(t)),queryParameters:e.queryParameters.map(t=>exm(t)),messages:e.messages.map(t=>({...t,body:aTF(t.body)}))}}function exm(e){return{...e,value:D6(e.value)}}function DUl(e){return{...e,value:D6(e.value)}}function yzu(e){return{...e,value:D6(e.value)}}function aTF(e){switch(e.type){case"inlinedBody":return he.V51.ExampleWebSocketMessageBody.inlinedBody(txm(e));case"reference":return he.V51.ExampleWebSocketMessageBody.reference(D6(e))}}function txm(e){return{...e,properties:e.properties.map(t=>({...t,value:D6(t.value)}))}}function QBm(e){return{...e,shape:ixm(e.shape)}}function MUl(e){switch(e.type){case"primitive":return he.V51.ExampleTypeReferenceShape.primitive(oTF(e));case"container":return he.V51.ExampleTypeReferenceShape.container(uTF(e));case"unknown":return he.V51.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return he.V51.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:ixm(e.shape)})}}function rxm(e){switch(e.type){case"integer":return he.V51.ExamplePrimitive.integer(e.integer);case"uint":return he.V51.ExamplePrimitive.integer(e.uint);case"uint64":return he.V51.ExamplePrimitive.integer(e.uint64);case"double":return he.V51.ExamplePrimitive.double(e.double);case"long":return he.V51.ExamplePrimitive.long(e.long);case"boolean":return he.V51.ExamplePrimitive.boolean(e.boolean);case"string":return he.V51.ExamplePrimitive.string(e.string);case"date":return he.V51.ExamplePrimitive.date(e.date);case"datetime":return he.V51.ExamplePrimitive.datetime(e.datetime);case"uuid":return he.V51.ExamplePrimitive.uuid(e.uuid)}}function oTF(e){return rxm(e.primitive)}function uTF(e){switch(e.container.type){case"list":return he.V51.ExampleContainer.list({list:e.container.list.map(t=>D6(t)),itemType:HD(e.container.itemType)});case"set":return he.V51.ExampleContainer.set({set:e.container.set.map(t=>D6(t)),itemType:HD(e.container.itemType)});case"optional":return he.V51.ExampleContainer.optional({optional:e.container.optional!=null?D6(e.container.optional):void 0,valueType:HD(e.container.valueType)});case"map":return he.V51.ExampleContainer.map({map:e.container.map.map(t=>({key:D6(t.key),value:D6(t.value)})),keyType:HD(e.container.keyType),valueType:HD(e.container.valueType)});case"literal":return he.V51.ExampleContainer.literal({literal:rxm(e.container.literal)})}}function D6(e){return{...e,shape:MUl(e.shape)}}function ixm(e){switch(e.type){case"object":return he.V51.ExampleTypeShape.object({properties:e.properties.map(t=>nxm(t))});case"alias":return he.V51.ExampleTypeShape.alias({value:{...D6(e.value)}});case"enum":return he.V51.ExampleTypeShape.enum(e);case"union":return he.V51.ExampleTypeShape.union(cTF(e));case"undiscriminatedUnion":return he.V51.ExampleTypeShape.undiscriminatedUnion(sTF(e))}}function sTF(e){return{...e,singleUnionType:D6(e.singleUnionType)}}function cTF(e){return{...e,singleUnionType:lTF(e.singleUnionType)}}function lTF(e){return{...e,shape:fTF(e.shape)}}function fTF(e){switch(e.type){case"samePropertiesAsObject":return he.V51.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:dTF(e.object)});case"singleProperty":return he.V51.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:MUl(e.shape)});case"noProperties":return he.V51.ExampleSingleUnionTypeProperties.noProperties()}}function dTF(e){return{...e,properties:e.properties.map(t=>nxm(t))}}function nxm(e){return{...e,value:{...e.value,shape:MUl(e.value.shape)}}}function JBm(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>yzu(t)),servicePathParameters:e.servicePathParameters.map(t=>yzu(t)),endpointPathParameters:e.endpointPathParameters.map(t=>yzu(t)),serviceHeaders:e.serviceHeaders.map(t=>DUl(t)),endpointHeaders:e.endpointHeaders.map(t=>DUl(t)),queryParameters:e.queryParameters.map(t=>exm(t)),request:e.request!=null?hTF(e.request):void 0,response:pTF(e.response)}}function pTF(e){switch(e.type){case"error":return he.V51.ExampleResponse.error({...e,body:e.body!=null?D6(e.body):void 0});case"ok":return he.V51.ExampleResponse.ok(_TF(e))}}function _TF(e){switch(e.value.type){case"body":return he.V51.ExampleEndpointSuccessResponse.body(e.value.value!=null?D6(e.value.value):void 0);case"stream":return he.V51.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>D6(t)));case"sse":return he.V51.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:D6(t.data)})))}}function hTF(e){switch(e.type){case"inlinedRequestBody":return he.V51.ExampleRequestBody.inlinedRequestBody(txm(e));case"reference":return he.V51.ExampleRequestBody.reference(D6(e))}}var uxm={laterVersion:"v53",earlierVersion:"v52",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.38.0-rc0",[K.TYPESCRIPT_BROWSER_SDK]:"0.38.0-rc0",[K.TYPESCRIPT]:"0.38.0-rc0",[K.TYPESCRIPT_SDK]:"0.38.0-rc0",[K.TYPESCRIPT_EXPRESS]:"0.17.3",[K.JAVA]:Ge,[K.JAVA_MODEL]:"1.3.0",[K.JAVA_SDK]:"2.5.0",[K.JAVA_SPRING]:"1.3.0",[K.PYTHON_FASTAPI]:"1.1.0-rc0",[K.PYTHON_PYDANTIC]:"1.1.0-rc0",[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:"0.1.0",[K.STOPLIGHT]:Ge,[K.POSTMAN]:"0.2.0",[K.PYTHON_SDK]:"3.3.0-rc0",[K.GO_FIBER]:"0.23.5",[K.GO_MODEL]:"0.23.5",[K.GO_SDK]:"0.28.3",[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:"0.5.0",[K.SWIFT_MODEL]:Ge,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:"0.1.0"},jsonifyEarlierVersion:e=>eh.V52.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?vTF(e.apiVersion):void 0,auth:STF(e.auth),headers:e.headers.map(t=>UWi(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>UWi(t)),types:yTF(e.types),services:cd(e.services,t=>zTF(t)),webhookGroups:cd(e.webhookGroups,t=>mTF(t)),websocketChannels:cd(e.websocketChannels,t=>bTF(t)),errors:cd(e.errors,t=>ZTF(t)),pathParameters:e.pathParameters.map(t=>CMa(t)),variables:e.variables.map(t=>RTF(t))})};function yTF(e){return cd(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>axm(r)),userProvidedExamples:t.userProvidedExamples.map(r=>axm(r)),shape:he.V53.types.Type._visit(t.shape,{union:r=>he.V52.types.Type.union({...r,baseProperties:r.baseProperties.map(i=>({...i,valueType:$D(i.valueType)})),types:r.types.map(i=>CTF(i))}),enum:he.V52.types.Type.enum,object:r=>he.V52.types.Type.object({...r,properties:r.properties.map(i=>({...i,valueType:$D(i.valueType)}))}),alias:r=>he.V52.types.Type.alias({aliasOf:$D(r.aliasOf),resolvedType:xTF(r.resolvedType)}),undiscriminatedUnion:r=>he.V52.types.Type.undiscriminatedUnion(ITF(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function vTF(e){return he.V52.ApiVersionScheme.header({...e,header:UWi(e.header)})}function bTF(e){return{...e,headers:e.headers.map(t=>UWi(t)),queryParameters:e.queryParameters.map(t=>CUl(t)),pathParameters:e.pathParameters.map(t=>CMa(t)),messages:e.messages.map(t=>gTF(t)),examples:e.examples.map(t=>kTF(t))}}function gTF(e){return{...e,body:OTF(e.body)}}function OTF(e){switch(e.type){case"inlinedBody":return he.V52.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:$D(t.valueType)}))});case"reference":return he.V52.websocket.WebSocketMessageBody.reference({...e,bodyType:$D(e.bodyType)})}}function mTF(e){return e.map(t=>PTF(t))}function PTF(e){return{...e,headers:e.headers.map(t=>UWi(t)),payload:jTF(e.payload),examples:e.examples!=null?e.examples.map(t=>wTF(t)):void 0}}function jTF(e){switch(e.type){case"reference":return he.V52.webhooks.WebhookPayload.reference({...e,payloadType:$D(e.payloadType)});case"inlinedPayload":return he.V52.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:$D(t.valueType)}))})}}function wTF(e){return{...e,payload:E6(e.payload)}}function STF(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V52.auth.AuthScheme.basic(t);case"bearer":return he.V52.auth.AuthScheme.bearer(t);case"header":return he.V52.auth.AuthScheme.header(DTF(t));case"oauth":return he.V52.auth.AuthScheme.oauth(ETF(t))}})}}function DTF(e){return{...e,valueType:$D(e.valueType)}}function ETF(e){return{...e,configuration:he.V52.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:ATF(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?MTF(e.configuration.refreshEndpoint):void 0})}}function ATF(e){return{...e,requestProperties:{clientId:C_i(e.requestProperties.clientId),clientSecret:C_i(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?C_i(e.requestProperties.scopes):void 0},responseProperties:{accessToken:a$r(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?a$r(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?a$r(e.responseProperties.refreshToken):void 0}}}function MTF(e){return{...e,requestProperties:{refreshToken:C_i(e.requestProperties.refreshToken)},responseProperties:{accessToken:a$r(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?a$r(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?a$r(e.responseProperties.refreshToken):void 0}}}function UWi(e){return{...e,valueType:$D(e.valueType)}}function $D(e){return he.V53.types.TypeReference._visit(e,{container:t=>he.V52.types.TypeReference.container(cxm(t)),primitive:t=>he.V52.types.TypeReference.primitive(sxm(t)),named:he.V52.types.TypeReference.named,unknown:he.V52.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function sxm(e){return{v1:qTF(e.v1),v2:e.v2!=null?TTF(e.v2):void 0}}function qTF(e){switch(e){case"FLOAT":return he.V52.types.PrimitiveTypeV1.Double}return e}function TTF(e){switch(e.type){case"integer":return he.V52.types.PrimitiveTypeV2.integer(e);case"double":return he.V52.types.PrimitiveTypeV2.double(e);case"string":return he.V52.types.PrimitiveTypeV2.string(e);case"boolean":return he.V52.types.PrimitiveTypeV2.boolean(e);case"long":return he.V52.types.PrimitiveTypeV2.long(e);case"bigInteger":return he.V52.types.PrimitiveTypeV2.bigInteger(e);case"uint":return he.V52.types.PrimitiveTypeV2.uint();case"uint64":return he.V52.types.PrimitiveTypeV2.uint64();case"date":return;case"dateTime":return;case"uuid":return;case"base64":return;case"float":return;default:Zo(e)}}function cxm(e){return he.V53.types.ContainerType._visit(e,{list:t=>he.V52.types.ContainerType.list($D(t)),optional:t=>he.V52.types.ContainerType.optional($D(t)),set:t=>he.V52.types.ContainerType.set($D(t)),map:({keyType:t,valueType:r})=>he.V52.types.ContainerType.map({keyType:$D(t),valueType:$D(r)}),literal:he.V52.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function CTF(e){return{...e,shape:BTF(e.shape)}}function BTF(e){return he.V53.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V52.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V52.types.SingleUnionTypeProperties.singleProperty({...t,type:$D(t.type)}),noProperties:he.V52.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function xTF(e){return he.V53.types.ResolvedTypeReference._visit(e,{container:t=>he.V52.types.ResolvedTypeReference.container(cxm(t)),named:he.V52.types.ResolvedTypeReference.named,primitive:t=>he.V52.types.ResolvedTypeReference.primitive(sxm(t)),unknown:he.V52.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function ITF(e){return{members:e.members.map(t=>({...t,type:$D(t.type)}))}}function zTF(e){return{...e,pathParameters:e.pathParameters.map(t=>CMa(t)),headers:e.headers.map(t=>UWi(t)),endpoints:e.endpoints.map(t=>FTF(t))}}function CMa(e){return{...e,valueType:$D(e.valueType)}}function RTF(e){return{...e,type:$D(e.type)}}function FTF(e){return{...e,pagination:e.pagination!=null?WTF(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>CMa(t)),pathParameters:e.pathParameters.map(t=>CMa(t)),sdkRequest:e.sdkRequest!=null?QTF(e.sdkRequest):void 0,requestBody:e.requestBody!=null?YTF(e.requestBody):void 0,response:e.response!=null?NTF(e.response):void 0,headers:e.headers.map(t=>UWi(t)),queryParameters:e.queryParameters.map(t=>CUl(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:oxm(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?oxm(t.example):void 0}))}}function NTF(e){return{...e,body:e.body!=null?LTF(e.body):void 0}}function LTF(e){switch(e.type){case"json":return he.V52.http.HttpResponseBody.json(lxm(e.value));case"fileDownload":return he.V52.http.HttpResponseBody.fileDownload(e);case"text":return he.V52.http.HttpResponseBody.text(e);case"streaming":return he.V52.http.HttpResponseBody.streaming(fxm(e.value));case"streamParameter":return he.V52.http.HttpResponseBody.streamParameter(VTF(e))}}function lxm(e){switch(e.type){case"response":return he.V52.http.JsonResponse.response({...e,responseBodyType:$D(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V52.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:$D(e.responseBodyType),responseProperty:e.responseProperty!=null?TUl(e.responseProperty):void 0})}}function fxm(e){switch(e.type){case"json":return he.V52.http.StreamingResponse.json({...e,payload:$D(e.payload)});case"text":return he.V52.http.StreamingResponse.text(e);case"sse":return he.V52.http.StreamingResponse.sse({...e,payload:$D(e.payload)})}}function UTF(e){switch(e.type){case"json":return he.V52.http.NonStreamHttpResponseBody.json(lxm(e.value));case"text":return he.V52.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return he.V52.http.NonStreamHttpResponseBody.fileDownload(e)}}function VTF(e){return{nonStreamResponse:UTF(e.nonStreamResponse),streamResponse:fxm(e.streamResponse)}}function WTF(e){switch(e.type){case"cursor":return he.V52.http.Pagination.cursor(HTF(e));case"offset":return he.V52.http.Pagination.offset($TF(e))}}function HTF(e){return{...e,page:C_i(e.page),next:a$r(e.next),results:a$r(e.results)}}function $TF(e){return{...e,page:C_i(e.page),results:a$r(e.results),step:e.step!=null?C_i(e.step):void 0}}function C_i(e){return{...e,property:GTF(e.property)}}function GTF(e){switch(e.type){case"query":return he.V52.RequestPropertyValue.query(CUl(e));case"body":return he.V52.RequestPropertyValue.body(TUl(e))}}function a$r(e){return{...e,property:TUl(e.property)}}function TUl(e){return{...e,valueType:$D(e.valueType)}}function CUl(e){return{...e,valueType:$D(e.valueType)}}function QTF(e){return{...e,streamParameter:e.streamParameter!=null?C_i(e.streamParameter):void 0,shape:JTF(e.shape)}}function JTF(e){return he.V53.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V52.http.SdkRequestShape.justRequestBody(KTF(t)),wrapper:he.V52.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function KTF(e){switch(e.type){case"bytes":return he.V52.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V52.http.SdkRequestBodyType.typeReference({...e,requestBodyType:$D(e.requestBodyType)})}}function YTF(e){return he.V53.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V52.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:$D(r.valueType)}))}),reference:t=>he.V52.http.HttpRequestBody.reference({...t,requestBodyType:$D(t.requestBodyType)}),fileUpload:t=>he.V52.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V52.http.FileUploadRequestProperty.bodyProperty({...r,valueType:$D(r.valueType)});case"file":return he.V52.http.FileUploadRequestProperty.file(XTF(r.value))}})}),bytes:t=>he.V52.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function XTF(e){switch(e.type){case"file":return he.V52.http.FileProperty.file(e);case"fileArray":return he.V52.http.FileProperty.fileArray(e)}}function ZTF(e){return{...e,type:e.type!=null?$D(e.type):void 0,examples:e.examples.map(t=>({...t,shape:E6(t.shape)}))}}function kTF(e){return{...e,pathParameters:e.pathParameters.map(t=>vzu(t)),headers:e.headers.map(t=>qUl(t)),queryParameters:e.queryParameters.map(t=>dxm(t)),messages:e.messages.map(t=>({...t,body:eCF(t.body)}))}}function dxm(e){return{...e,value:E6(e.value)}}function qUl(e){return{...e,value:E6(e.value)}}function vzu(e){return{...e,value:E6(e.value)}}function eCF(e){switch(e.type){case"inlinedBody":return he.V52.ExampleWebSocketMessageBody.inlinedBody(pxm(e));case"reference":return he.V52.ExampleWebSocketMessageBody.reference(E6(e))}}function pxm(e){return{...e,properties:e.properties.map(t=>({...t,value:E6(t.value)}))}}function axm(e){return{...e,shape:hxm(e.shape)}}function BUl(e){switch(e.type){case"primitive":return he.V52.ExampleTypeReferenceShape.primitive(tCF(e));case"container":return he.V52.ExampleTypeReferenceShape.container(rCF(e));case"unknown":return he.V52.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return he.V52.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:hxm(e.shape)})}}function _xm(e){switch(e.type){case"integer":return he.V52.ExamplePrimitive.integer(e.integer);case"uint":return he.V52.ExamplePrimitive.integer(e.uint);case"uint64":return he.V52.ExamplePrimitive.integer(e.uint64);case"float":return he.V52.ExamplePrimitive.double(e.float);case"double":return he.V52.ExamplePrimitive.double(e.double);case"long":return he.V52.ExamplePrimitive.long(e.long);case"boolean":return he.V52.ExamplePrimitive.boolean(e.boolean);case"string":return he.V52.ExamplePrimitive.string(e.string);case"date":return he.V52.ExamplePrimitive.date(e.date);case"datetime":return he.V52.ExamplePrimitive.datetime(e.datetime);case"uuid":return he.V52.ExamplePrimitive.uuid(e.uuid);case"base64":return he.V52.ExamplePrimitive.string({original:e.base64});case"bigInteger":return he.V52.ExamplePrimitive.string({original:e.bigInteger})}}function tCF(e){return _xm(e.primitive)}function rCF(e){switch(e.container.type){case"list":return he.V52.ExampleContainer.list({list:e.container.list.map(t=>E6(t)),itemType:$D(e.container.itemType)});case"set":return he.V52.ExampleContainer.set({set:e.container.set.map(t=>E6(t)),itemType:$D(e.container.itemType)});case"optional":return he.V52.ExampleContainer.optional({optional:e.container.optional!=null?E6(e.container.optional):void 0,valueType:$D(e.container.valueType)});case"map":return he.V52.ExampleContainer.map({map:e.container.map.map(t=>({key:E6(t.key),value:E6(t.value)})),keyType:$D(e.container.keyType),valueType:$D(e.container.valueType)});case"literal":return he.V52.ExampleContainer.literal({literal:_xm(e.container.literal)})}}function E6(e){return{...e,shape:BUl(e.shape)}}function hxm(e){switch(e.type){case"object":return he.V52.ExampleTypeShape.object({properties:e.properties.map(t=>yxm(t))});case"alias":return he.V52.ExampleTypeShape.alias({value:{...E6(e.value)}});case"enum":return he.V52.ExampleTypeShape.enum(e);case"union":return he.V52.ExampleTypeShape.union(nCF(e));case"undiscriminatedUnion":return he.V52.ExampleTypeShape.undiscriminatedUnion(iCF(e))}}function iCF(e){return{...e,singleUnionType:E6(e.singleUnionType)}}function nCF(e){return{...e,singleUnionType:aCF(e.singleUnionType)}}function aCF(e){return{...e,shape:oCF(e.shape)}}function oCF(e){switch(e.type){case"samePropertiesAsObject":return he.V52.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:uCF(e.object)});case"singleProperty":return he.V52.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:BUl(e.shape)});case"noProperties":return he.V52.ExampleSingleUnionTypeProperties.noProperties()}}function uCF(e){return{...e,properties:e.properties.map(t=>yxm(t))}}function yxm(e){return{...e,value:{...e.value,shape:BUl(e.value.shape)}}}function oxm(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>vzu(t)),servicePathParameters:e.servicePathParameters.map(t=>vzu(t)),endpointPathParameters:e.endpointPathParameters.map(t=>vzu(t)),serviceHeaders:e.serviceHeaders.map(t=>qUl(t)),endpointHeaders:e.endpointHeaders.map(t=>qUl(t)),queryParameters:e.queryParameters.map(t=>dxm(t)),request:e.request!=null?lCF(e.request):void 0,response:sCF(e.response)}}function sCF(e){switch(e.type){case"error":return he.V52.ExampleResponse.error({...e,body:e.body!=null?E6(e.body):void 0});case"ok":return he.V52.ExampleResponse.ok(cCF(e))}}function cCF(e){switch(e.value.type){case"body":return he.V52.ExampleEndpointSuccessResponse.body(e.value.value!=null?E6(e.value.value):void 0);case"stream":return he.V52.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>E6(t)));case"sse":return he.V52.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:E6(t.data)})))}}function lCF(e){switch(e.type){case"inlinedRequestBody":return he.V52.ExampleRequestBody.inlinedRequestBody(pxm(e));case"reference":return he.V52.ExampleRequestBody.reference(E6(e))}}var vxm={laterVersion:"v54",earlierVersion:"v53",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:Ge,[K.TYPESCRIPT_BROWSER_SDK]:Ge,[K.TYPESCRIPT]:Ge,[K.TYPESCRIPT_SDK]:Ge,[K.TYPESCRIPT_EXPRESS]:Ge,[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:Ge,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:Ge},jsonifyEarlierVersion:e=>eh.V53.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:cd(e.services,t=>({...t,endpoints:t.endpoints.map(r=>({...r,response:fCF(r.response)}))}))})};function fCF(e){if(e!=null)return{statusCode:e.statusCode,body:e.body?.type==="bytes"?he.V53.HttpResponseBody.fileDownload({docs:void 0}):e.body}}var Oxm={laterVersion:"v55",earlierVersion:"v54",firstGeneratorVersionToConsumeNewIR:{[K.TYPESCRIPT_NODE_SDK]:"0.47.0",[K.TYPESCRIPT_BROWSER_SDK]:"0.47.0",[K.TYPESCRIPT]:"0.47.0",[K.TYPESCRIPT_SDK]:"0.47.0",[K.TYPESCRIPT_EXPRESS]:"0.17.7",[K.JAVA]:Ge,[K.JAVA_MODEL]:Ge,[K.JAVA_SDK]:Ge,[K.JAVA_SPRING]:Ge,[K.PYTHON_FASTAPI]:Ge,[K.PYTHON_PYDANTIC]:Ge,[K.OPENAPI_PYTHON_CLIENT]:Ge,[K.OPENAPI]:Ge,[K.STOPLIGHT]:Ge,[K.POSTMAN]:Ge,[K.PYTHON_SDK]:Ge,[K.GO_FIBER]:Ge,[K.GO_MODEL]:Ge,[K.GO_SDK]:Ge,[K.RUBY_MODEL]:Ge,[K.RUBY_SDK]:Ge,[K.CSHARP_MODEL]:Ge,[K.CSHARP_SDK]:Ge,[K.SWIFT_MODEL]:Ge,[K.SWIFT_SDK]:ni,[K.PHP_MODEL]:ni,[K.PHP_SDK]:Ge},jsonifyEarlierVersion:e=>eh.V54.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?pCF(e.apiVersion):void 0,auth:mCF(e.auth),headers:e.headers.map(t=>VWi(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>VWi(t)),types:dCF(e.types),services:cd(e.services,t=>qCF(t)),webhookGroups:cd(e.webhookGroups,t=>vCF(t)),websocketChannels:cd(e.websocketChannels,t=>_CF(t)),errors:cd(e.errors,t=>GCF(t)),pathParameters:e.pathParameters.map(t=>BMa(t)),variables:e.variables.map(t=>TCF(t)),dynamic:e.dynamic!=null?aBF(e.dynamic):void 0})};function dCF(e){return cd(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>bxm(r)),userProvidedExamples:t.userProvidedExamples.map(r=>bxm(r)),shape:he.V55.types.Type._visit(t.shape,{union:r=>he.V54.types.Type.union({...r,baseProperties:r.baseProperties.map(i=>({...i,valueType:rP(i.valueType)})),types:r.types.map(i=>DCF(i))}),enum:he.V54.types.Type.enum,object:r=>he.V54.types.Type.object({...r,properties:r.properties.map(i=>({...i,valueType:rP(i.valueType)})),extendedProperties:r.extendedProperties?.map(i=>({...i,valueType:rP(i.valueType)}))}),alias:r=>he.V54.types.Type.alias({aliasOf:rP(r.aliasOf),resolvedType:ACF(r.resolvedType)}),undiscriminatedUnion:r=>he.V54.types.Type.undiscriminatedUnion(MCF(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function pCF(e){return he.V54.ApiVersionScheme.header({...e,header:VWi(e.header)})}function _CF(e){return{...e,headers:e.headers.map(t=>VWi(t)),queryParameters:e.queryParameters.map(t=>zUl(t)),pathParameters:e.pathParameters.map(t=>BMa(t)),messages:e.messages.map(t=>hCF(t)),examples:e.examples.map(t=>QCF(t))}}function hCF(e){return{...e,body:yCF(e.body)}}function yCF(e){switch(e.type){case"inlinedBody":return he.V54.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:rP(t.valueType)}))});case"reference":return he.V54.websocket.WebSocketMessageBody.reference({...e,bodyType:rP(e.bodyType)})}}function vCF(e){return e.map(t=>bCF(t))}function bCF(e){return{...e,headers:e.headers.map(t=>VWi(t)),payload:gCF(e.payload),examples:e.examples!=null?e.examples.map(t=>OCF(t)):void 0}}function gCF(e){switch(e.type){case"reference":return he.V54.webhooks.WebhookPayload.reference({...e,payloadType:rP(e.payloadType)});case"inlinedPayload":return he.V54.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:rP(t.valueType)}))})}}function OCF(e){return{...e,payload:b7(e.payload)}}function mCF(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return he.V54.auth.AuthScheme.basic(t);case"bearer":return he.V54.auth.AuthScheme.bearer(t);case"header":return he.V54.auth.AuthScheme.header(PCF(t));case"oauth":return he.V54.auth.AuthScheme.oauth(jCF(t))}})}}function PCF(e){return{...e,valueType:rP(e.valueType)}}function jCF(e){return{...e,configuration:he.V54.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:wCF(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?SCF(e.configuration.refreshEndpoint):void 0})}}function wCF(e){return{...e,requestProperties:{clientId:B_i(e.requestProperties.clientId),clientSecret:B_i(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?B_i(e.requestProperties.scopes):void 0},responseProperties:{accessToken:PNr(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?PNr(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?PNr(e.responseProperties.refreshToken):void 0}}}function SCF(e){return{...e,requestProperties:{refreshToken:B_i(e.requestProperties.refreshToken)},responseProperties:{accessToken:PNr(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?PNr(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?PNr(e.responseProperties.refreshToken):void 0}}}function VWi(e){return{...e,valueType:rP(e.valueType)}}function rP(e){return e.type==="container"&&e.container.type==="nullable"?bBF(e.container.nullable):e.type==="container"&&e.container.type==="optional"?vBF(e.container.optional):he.V55.types.TypeReference._visit(e,{container:t=>he.V54.types.TypeReference.container(Pxm(t)),primitive:t=>he.V54.types.TypeReference.primitive(mxm(t)),named:he.V54.types.TypeReference.named,unknown:he.V54.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function mxm(e){return{v1:e.v1,v2:e.v2!=null?e.v2:void 0}}function Pxm(e){return he.V55.types.ContainerType._visit(e,{list:t=>he.V54.types.ContainerType.list(rP(t)),optional:t=>he.V54.types.ContainerType.optional(rP(t)),nullable:t=>he.V54.types.ContainerType.optional(rP(t)),set:t=>he.V54.types.ContainerType.set(rP(t)),map:({keyType:t,valueType:r})=>he.V54.types.ContainerType.map({keyType:rP(t),valueType:rP(r)}),literal:he.V54.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function DCF(e){return{...e,shape:ECF(e.shape)}}function ECF(e){return he.V55.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>he.V54.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>he.V54.types.SingleUnionTypeProperties.singleProperty({...t,type:rP(t.type)}),noProperties:he.V54.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function ACF(e){return he.V55.types.ResolvedTypeReference._visit(e,{container:t=>he.V54.types.ResolvedTypeReference.container(Pxm(t)),named:he.V54.types.ResolvedTypeReference.named,primitive:t=>he.V54.types.ResolvedTypeReference.primitive(mxm(t)),unknown:he.V54.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function MCF(e){return{members:e.members.map(t=>({...t,type:rP(t.type)}))}}function qCF(e){return{...e,pathParameters:e.pathParameters.map(t=>BMa(t)),headers:e.headers.map(t=>VWi(t)),endpoints:e.endpoints.map(t=>CCF(t))}}function BMa(e){return{...e,valueType:rP(e.valueType)}}function TCF(e){return{...e,type:rP(e.type)}}function CCF(e){return{...e,pagination:e.pagination!=null?RCF(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>BMa(t)),pathParameters:e.pathParameters.map(t=>BMa(t)),sdkRequest:e.sdkRequest!=null?UCF(e.sdkRequest):void 0,requestBody:e.requestBody!=null?HCF(e.requestBody):void 0,response:e.response!=null?BCF(e.response):void 0,headers:e.headers.map(t=>VWi(t)),queryParameters:e.queryParameters.map(t=>zUl(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:gxm(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?gxm(t.example):void 0}))}}function BCF(e){return{...e,body:e.body!=null?xCF(e.body):void 0}}function xCF(e){switch(e.type){case"json":return he.V54.http.HttpResponseBody.json(jxm(e.value));case"fileDownload":return he.V54.http.HttpResponseBody.fileDownload(e);case"bytes":return he.V54.http.HttpResponseBody.bytes(e);case"text":return he.V54.http.HttpResponseBody.text(e);case"streaming":return he.V54.http.HttpResponseBody.streaming(wxm(e.value));case"streamParameter":return he.V54.http.HttpResponseBody.streamParameter(zCF(e));default:Zo(e)}}function jxm(e){switch(e.type){case"response":return he.V54.http.JsonResponse.response({...e,responseBodyType:rP(e.responseBodyType)});case"nestedPropertyAsResponse":return he.V54.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:rP(e.responseBodyType),responseProperty:e.responseProperty!=null?IUl(e.responseProperty):void 0})}}function wxm(e){switch(e.type){case"json":return he.V54.http.StreamingResponse.json({...e,payload:rP(e.payload)});case"text":return he.V54.http.StreamingResponse.text(e);case"sse":return he.V54.http.StreamingResponse.sse({...e,payload:rP(e.payload)})}}function ICF(e){switch(e.type){case"json":return he.V54.http.NonStreamHttpResponseBody.json(jxm(e.value));case"bytes":return he.V54.http.NonStreamHttpResponseBody.bytes(e);case"text":return he.V54.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return he.V54.http.NonStreamHttpResponseBody.fileDownload(e);default:Zo(e)}}function zCF(e){return{nonStreamResponse:ICF(e.nonStreamResponse),streamResponse:wxm(e.streamResponse)}}function RCF(e){switch(e.type){case"cursor":return he.V54.http.Pagination.cursor(FCF(e));case"offset":return he.V54.http.Pagination.offset(NCF(e))}}function FCF(e){return{...e,page:B_i(e.page),next:PNr(e.next),results:PNr(e.results)}}function NCF(e){return{...e,page:B_i(e.page),results:PNr(e.results),step:e.step!=null?B_i(e.step):void 0,hasNextPage:e.hasNextPage!=null?PNr(e.hasNextPage):void 0}}function B_i(e){return{...e,property:LCF(e.property)}}function LCF(e){switch(e.type){case"query":return he.V54.RequestPropertyValue.query(zUl(e));case"body":return he.V54.RequestPropertyValue.body(IUl(e))}}function PNr(e){return{...e,property:IUl(e.property)}}function IUl(e){return{...e,valueType:rP(e.valueType)}}function zUl(e){return{...e,valueType:rP(e.valueType)}}function UCF(e){return{...e,streamParameter:e.streamParameter!=null?B_i(e.streamParameter):void 0,shape:VCF(e.shape)}}function VCF(e){return he.V55.http.SdkRequestShape._visit(e,{justRequestBody:t=>he.V54.http.SdkRequestShape.justRequestBody(WCF(t)),wrapper:he.V54.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function WCF(e){switch(e.type){case"bytes":return he.V54.http.SdkRequestBodyType.bytes(e);case"typeReference":return he.V54.http.SdkRequestBodyType.typeReference({...e,requestBodyType:rP(e.requestBodyType)})}}function HCF(e){return he.V55.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>he.V54.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:rP(r.valueType)})),extendedProperties:t.extendedProperties?.map(r=>({...r,valueType:rP(r.valueType)}))}),reference:t=>he.V54.http.HttpRequestBody.reference({...t,requestBodyType:rP(t.requestBodyType)}),fileUpload:t=>he.V54.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return he.V54.http.FileUploadRequestProperty.bodyProperty({...r,valueType:rP(r.valueType)});case"file":return he.V54.http.FileUploadRequestProperty.file($CF(r.value))}})}),bytes:t=>he.V54.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function $CF(e){switch(e.type){case"file":return he.V54.http.FileProperty.file(e);case"fileArray":return he.V54.http.FileProperty.fileArray(e)}}function GCF(e){return{...e,type:e.type!=null?rP(e.type):void 0,examples:e.examples.map(t=>({...t,shape:b7(t.shape)}))}}function QCF(e){return{...e,pathParameters:e.pathParameters.map(t=>bzu(t)),headers:e.headers.map(t=>xUl(t)),queryParameters:e.queryParameters.map(t=>Sxm(t)),messages:e.messages.map(t=>({...t,body:JCF(t.body)}))}}function Sxm(e){return{...e,value:b7(e.value)}}function xUl(e){return{...e,value:b7(e.value)}}function bzu(e){return{...e,value:b7(e.value)}}function JCF(e){switch(e.type){case"inlinedBody":return he.V54.ExampleWebSocketMessageBody.inlinedBody(Dxm(e));case"reference":return he.V54.ExampleWebSocketMessageBody.reference(b7(e))}}function Dxm(e){return{...e,properties:e.properties.map(t=>({...t,value:b7(t.value)}))}}function bxm(e){return{...e,shape:Exm(e.shape)}}function RUl(e){switch(e.type){case"primitive":return he.V54.ExampleTypeReferenceShape.primitive(KCF(e));case"container":return he.V54.ExampleTypeReferenceShape.container(YCF(e));case"unknown":return he.V54.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return he.V54.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:Exm(e.shape)})}}function KCF(e){return e.primitive}function YCF(e){switch(e.container.type){case"list":return he.V54.ExampleContainer.list({list:e.container.list.map(t=>b7(t)),itemType:rP(e.container.itemType)});case"set":return he.V54.ExampleContainer.set({set:e.container.set.map(t=>b7(t)),itemType:rP(e.container.itemType)});case"optional":return he.V54.ExampleContainer.optional({optional:e.container.optional!=null?b7(e.container.optional):void 0,valueType:rP(e.container.valueType)});case"nullable":return he.V54.ExampleContainer.optional({optional:e.container.nullable!=null?b7(e.container.nullable):void 0,valueType:rP(e.container.valueType)});case"map":return he.V54.ExampleContainer.map({map:e.container.map.map(t=>({key:b7(t.key),value:b7(t.value)})),keyType:rP(e.container.keyType),valueType:rP(e.container.valueType)});case"literal":return he.V54.ExampleContainer.literal({literal:e.container.literal})}}function b7(e){return{...e,shape:RUl(e.shape)}}function Exm(e){switch(e.type){case"object":return he.V54.ExampleTypeShape.object({properties:e.properties.map(t=>Axm(t))});case"alias":return he.V54.ExampleTypeShape.alias({value:{...b7(e.value)}});case"enum":return he.V54.ExampleTypeShape.enum(e);case"union":return he.V54.ExampleTypeShape.union(ZCF(e));case"undiscriminatedUnion":return he.V54.ExampleTypeShape.undiscriminatedUnion(XCF(e))}}function XCF(e){return{...e,singleUnionType:b7(e.singleUnionType)}}function ZCF(e){return{...e,singleUnionType:kCF(e.singleUnionType)}}function kCF(e){return{...e,shape:eBF(e.shape)}}function eBF(e){switch(e.type){case"samePropertiesAsObject":return he.V54.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:tBF(e.object)});case"singleProperty":return he.V54.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:RUl(e.shape)});case"noProperties":return he.V54.ExampleSingleUnionTypeProperties.noProperties()}}function tBF(e){return{...e,properties:e.properties.map(t=>Axm(t))}}function Axm(e){return{...e,value:{...e.value,shape:RUl(e.value.shape)}}}function gxm(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>bzu(t)),servicePathParameters:e.servicePathParameters.map(t=>bzu(t)),endpointPathParameters:e.endpointPathParameters.map(t=>bzu(t)),serviceHeaders:e.serviceHeaders.map(t=>xUl(t)),endpointHeaders:e.endpointHeaders.map(t=>xUl(t)),queryParameters:e.queryParameters.map(t=>Sxm(t)),request:e.request!=null?nBF(e.request):void 0,response:rBF(e.response)}}function rBF(e){switch(e.type){case"error":return he.V54.ExampleResponse.error({...e,body:e.body!=null?b7(e.body):void 0});case"ok":return he.V54.ExampleResponse.ok(iBF(e))}}function iBF(e){switch(e.value.type){case"body":return he.V54.ExampleEndpointSuccessResponse.body(e.value.value!=null?b7(e.value.value):void 0);case"stream":return he.V54.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>b7(t)));case"sse":return he.V54.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:b7(t.data)})))}}function nBF(e){switch(e.type){case"inlinedRequestBody":return he.V54.ExampleRequestBody.inlinedRequestBody(Dxm(e));case"reference":return he.V54.ExampleRequestBody.reference(b7(e))}}function aBF(e){return{...e,types:cd(e.types,t=>oBF(t)),endpoints:cd(e.endpoints,t=>uBF(t)),headers:e.headers?.map(t=>EFt(t))}}function oBF(e){switch(e.type){case"alias":return he.V54.dynamic.NamedType.alias({...e,typeReference:dEe(e.typeReference)});case"enum":return he.V54.dynamic.NamedType.enum(e);case"object":return he.V54.dynamic.NamedType.object({...e,properties:e.properties.map(t=>EFt(t))});case"discriminatedUnion":return he.V54.dynamic.NamedType.discriminatedUnion({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,cBF(r)]))});case"undiscriminatedUnion":return he.V54.dynamic.NamedType.undiscriminatedUnion({...e,types:e.types.map(t=>dEe(t))});default:Zo(e)}}function uBF(e){return{...e,auth:e.auth!=null?sBF(e.auth):void 0,request:lBF(e.request)}}function sBF(e){switch(e.type){case"basic":return he.V54.dynamic.Auth.basic(e);case"bearer":return he.V54.dynamic.Auth.bearer(e);case"header":return he.V54.dynamic.Auth.header({header:EFt(e.header)})}}function dEe(e){switch(e.type){case"list":return he.V54.dynamic.TypeReference.list(dEe(e.value));case"optional":return OBF(e.value);case"nullable":return gBF(e.value);case"map":return he.V54.dynamic.TypeReference.map({...e,key:dEe(e.key),value:dEe(e.value)});case"literal":return he.V54.dynamic.TypeReference.literal(e.value);case"named":return he.V54.dynamic.TypeReference.named(e.value);case"primitive":return he.V54.dynamic.TypeReference.primitive(e.value);case"set":return he.V54.dynamic.TypeReference.set(dEe(e.value));case"unknown":return he.V54.dynamic.TypeReference.unknown();default:Zo(e)}}function cBF(e){switch(e.type){case"samePropertiesAsObject":return he.V54.dynamic.SingleDiscriminatedUnionType.samePropertiesAsObject({...e,properties:e.properties.map(t=>EFt(t))});case"singleProperty":return he.V54.dynamic.SingleDiscriminatedUnionType.singleProperty({...e,typeReference:dEe(e.typeReference),properties:e.properties?.map(t=>EFt(t))});case"noProperties":return he.V54.dynamic.SingleDiscriminatedUnionType.noProperties({...e,properties:e.properties?.map(t=>EFt(t))});default:Zo(e)}}function EFt(e){return{...e,typeReference:dEe(e.typeReference)}}function lBF(e){switch(e.type){case"body":return he.V54.dynamic.Request.body(fBF(e));case"inlined":return he.V54.dynamic.Request.inlined(dBF(e));default:Zo(e)}}function fBF(e){return{pathParameters:e.pathParameters?.map(t=>EFt(t)),body:e.body!=null?Mxm(e.body):void 0}}function dBF(e){return{...e,pathParameters:e.pathParameters?.map(t=>EFt(t)),queryParameters:e.queryParameters?.map(t=>EFt(t)),headers:e.headers?.map(t=>EFt(t)),body:e.body!=null?pBF(e.body):void 0}}function pBF(e){switch(e.type){case"properties":return he.V54.dynamic.InlinedRequestBody.properties(e.value.map(t=>EFt(t)));case"referenced":return he.V54.dynamic.InlinedRequestBody.referenced(_BF(e));case"fileUpload":return he.V54.dynamic.InlinedRequestBody.fileUpload(hBF(e));default:Zo(e)}}function _BF(e){return{...e,bodyType:Mxm(e.bodyType)}}function Mxm(e){switch(e.type){case"bytes":return he.V54.dynamic.ReferencedRequestBodyType.bytes();case"typeReference":return he.V54.dynamic.ReferencedRequestBodyType.typeReference(dEe(e.value));default:Zo(e)}}function hBF(e){return{properties:e.properties.map(t=>yBF(t))}}function yBF(e){switch(e.type){case"file":return he.V54.dynamic.FileUploadRequestBodyProperty.file(e);case"fileArray":return he.V54.dynamic.FileUploadRequestBodyProperty.fileArray(e);case"bodyProperty":return he.V54.dynamic.FileUploadRequestBodyProperty.bodyProperty(EFt(e));default:Zo(e)}}function vBF(e){return e.type==="container"&&e.container.type==="nullable"?he.V54.types.TypeReference.container(he.V54.types.ContainerType.optional(rP(e.container.nullable))):he.V54.types.TypeReference.container(he.V54.types.ContainerType.optional(rP(e)))}function bBF(e){return e.type==="container"&&e.container.type==="optional"?rP(e):he.V54.types.TypeReference.container(he.V54.types.ContainerType.optional(rP(e)))}function gBF(e){return e.type==="optional"?dEe(e):he.V54.dynamic.TypeReference.optional(dEe(e))}function OBF(e){return e.type==="nullable"?he.V54.dynamic.TypeReference.optional(dEe(e.value)):he.V54.dynamic.TypeReference.optional(dEe(e))}function xMa(){return PBF}var gzu=class{migrations;constructor(t){this.migrations=t}withMigration(t){return new FUl([...this.migrations,t])}},FUl=class extends gzu{build(){return new NUl(this.migrations)}},NUl=class{migrations;constructor(t){this.migrations=t}migrateForGenerator({intermediateRepresentation:t,context:r,targetGenerator:i}){return this.migrate({intermediateRepresentation:t,shouldMigrate:n=>this.shouldRunMigration({migration:n,targetGenerator:i}),context:r,targetGenerator:i})}migrateThroughMigration({migration:t,intermediateRepresentation:r,context:i,targetGenerator:n}){return this.migrateThroughVersion({version:t.earlierVersion,intermediateRepresentation:r,context:i,targetGenerator:n})}migrateThroughVersion({version:t,intermediateRepresentation:r,context:i,targetGenerator:n}){let a=!1;if(this.migrations[0]?.laterVersion===t)return{ir:r,jsonify:()=>Promise.resolve().then(()=>Gp.IntermediateRepresentation.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}))};let l=this.migrate({intermediateRepresentation:r,shouldMigrate:f=>{let s=f.earlierVersion===t;return a||=s,s||!a},context:i,targetGenerator:n});return a||i.failAndThrow(`IR ${t} does not exist`),l}migrate({intermediateRepresentation:t,shouldMigrate:r,context:i,targetGenerator:n}){let a=t,u=async()=>await Gp.IntermediateRepresentation.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"});for(let l of this.migrations){if(!r(l))break;i.logger.debug(`Migrating IR from ${l.laterVersion} to ${l.earlierVersion}`),a=l.migrateBackwards(a,{taskContext:i,targetGenerator:n}),u=()=>Promise.resolve().then(()=>l.jsonifyEarlierVersion(a))}return{ir:a,jsonify:u}}shouldRunMigration({migration:t,targetGenerator:r}){let i=t.firstGeneratorVersionToConsumeNewIR[r.name];if(i==null)throw new Error(`Cannot migrate intermediate representation. Unrecognized generator: ${r.name}. If leveraging a custom generator, ensure you are specifying "ir-version" within the generator configuration.`);switch(i){case Ge:return!0;case ni:throw new Error(`Cannot migrate intermediate representation. Generator was created after intermediate representation ${t.laterVersion}.`)}return Tte(i,r.version)}getIRVersionForGenerator({targetGenerator:t}){let r=this.migrations[0]?.laterVersion;for(let i of this.migrations)if(this.shouldRunMigration({migration:i,targetGenerator:t}))r=i.earlierVersion;else break;return r}},mBF={Builder:new gzu([])},PBF=mBF.Builder.withMigration(Oxm).withMigration(vxm).withMigration(uxm).withMigration(KBm).withMigration(VBm).withMigration(zBm).withMigration(IBm).withMigration(BBm).withMigration(CBm).withMigration(MBm).withMigration(DBm).withMigration(SBm).withMigration(jBm).withMigration(PBm).withMigration(mBm).withMigration(OBm).withMigration(gBm).withMigration(bBm).withMigration(vBm).withMigration(yBm).withMigration(hBm).withMigration(_Bm).withMigration(pBm).withMigration(fBm).withMigration(cBm).withMigration(sBm).withMigration(uBm).withMigration(eBm).withMigration(kCm).withMigration(ZCm).withMigration(YCm).withMigration(KCm).withMigration(Qg0).withMigration(Hg0).withMigration(Wg0).withMigration(Lg0).withMigration(Fg0).withMigration(zg0).withMigration(Ig0).withMigration(xg0).withMigration(Tg0).withMigration(Ag0).withMigration(Eg0).withMigration(Dg0).withMigration(wg0).withMigration(jg0).withMigration(Pg0).withMigration(bg0).withMigration(hg0).withMigration(_g0).withMigration(pg0).withMigration(k00).withMigration(Y00).withMigration($Vp).build();function IMa({intermediateRepresentation:e,context:t,targetGenerator:r}){return xMa().migrateForGenerator({intermediateRepresentation:e,context:t,targetGenerator:r}).jsonify()}function LUl({intermediateRepresentation:e,context:t,targetGenerator:r,irVersion:i}){return xMa().migrateThroughVersion({version:i,intermediateRepresentation:e,context:t,targetGenerator:r}).jsonify()}function zMa({intermediateRepresentation:e,context:t,version:r}){return xMa().migrateThroughVersion({version:r,intermediateRepresentation:e,context:t}).jsonify()}async function Txm({project:e,irFilepath:t,cliContext:r,generationLanguage:i,audiences:n,version:a,keywords:u,smartCasing:l,readme:f}){await Promise.all(e.apiWorkspaces.map(async s=>{await r.runTaskForWorkspace(s,async o=>{r.logger.info(`Generating IR for workspace ${s.workspaceName??"api"}`);let c=await s.toFernWorkspace({context:o}),b=await jBF({workspace:c,context:o,generationLanguage:i,keywords:u,smartCasing:l,disableExamples:!1,audiences:n,version:a,readme:f}),g=qxm.default.resolve(t);await c6r(Kl.of(g),b),o.logger.info(`Wrote IR to ${g}`)})}))}async function jBF({workspace:e,context:t,generationLanguage:r,audiences:i,keywords:n,smartCasing:a,disableExamples:u,version:l,readme:f}){let s=await Bhn({workspace:e,context:t,generationLanguage:r,audiences:i,keywords:n,smartCasing:a,disableExamples:u,readme:f});return l==null?Gp.IntermediateRepresentation.jsonOrThrow(s,{unrecognizedObjectKeys:"strip"}):zMa({intermediateRepresentation:s,version:l,context:t})}var Cxm=require("fs/promises"),Bxm=Di(require("path"),1);async function xxm({project:e,outputFilepath:t,cliContext:r}){await Promise.all(e.apiWorkspaces.map(async i=>{await r.runTaskForWorkspace(i,async n=>{let a=await Era(i,n),u=Bxm.default.resolve(t);await(0,Cxm.writeFile)(u,await d6r(a,{pretty:!0})),n.logger.info(`Wrote FDR API definition to ${u}`)})}))}var Ixm=require("fs/promises"),zxm=Di(require("path"),1);async function Rxm({project:e,irFilepath:t,cliContext:r,sdkLanguage:i}){await Promise.all(e.apiWorkspaces.map(async n=>{await r.runTaskForWorkspace(n,async a=>{if(n instanceof Qti){a.logger.info("Skipping, API is specified as a Fern Definition.");return}else if(!(n instanceof s8))return;let u=new e6t(n.absoluteFilePath),l=await t6t({context:a,specs:n.specs}),f=FSi({context:a,documents:await u.loadDocuments({context:a,specs:l})}),s=zxm.default.resolve(t),o=await Uy.OpenApiIntermediateRepresentation.jsonOrThrow(f,{skipValidation:!0});await(0,Ixm.writeFile)(s,await d6r(o,{pretty:!0})),a.logger.info(`Wrote IR to ${s}`)})}))}var Ozu=require("fs/promises");async function Nxm({project:e,includeModels:t,cliContext:r}){await Promise.all(e.apiWorkspaces.map(async i=>{await r.runTaskForWorkspace(i,async n=>{i instanceof s8?await SBF({workspace:i,context:n,includeModels:t}):n.logger.warn("Skipping fern workspace definition generation")})}))}async function wBF(e,t){let r=null;try{let i=(await(0,Ozu.readFile)(e,"utf8")).toString();try{r=JSON.parse(i)}catch{r=pp.load(i,{json:!0})}}catch{return t.failAndThrow(`Failed to read OpenAPI overrides from file ${e}`)}return r}async function SBF({workspace:e,includeModels:t,context:r}){let i=new e6t(e.absoluteFilePath),n=await t6t({context:r,specs:e.specs});for(let a of n){let u=FSi({context:r,documents:await i.loadDocuments({context:r,specs:[a]})}),l={};a.absoluteFilepathToOverrides!==void 0&&(l=await wBF(a.absoluteFilepathToOverrides,r));let f="path"in l?l.path:{};for(let c of u.endpoints){let b=gZn(c);c.path in f||(f[c.path]={});let g=f[c.path];if(g!=null&&g[c.method]==null){let O=b.file.split("/").map(w=>w.replace(".yml","")).filter(w=>w!=="__package__"),m={};O.length>0&&(m["x-fern-sdk-group-name"]=O),m["x-fern-sdk-method-name"]=b.endpointId,g[c.method.toLowerCase()]=m}else l==null&&r.logger.warn(`Endpoint ${c.path} ${c.method} is defined multiple times`)}let s="path"in l?l.path:{};if(t){Fxm(s,u.groupedSchemas.rootSchemas);for(let[c,b]of Object.entries(u.groupedSchemas.namespacedSchemas))Fxm(s,b)}let o={schemas:s};await(0,Ozu.writeFile)(ku(Mp(a.absoluteFilepath),yo.of("openapi-overrides.yml")),pp.dump({paths:f,components:o}))}}function Fxm(e,t){for(let[r,i]of Object.entries(t)){if(r in e)continue;let n={};n["x-fern-type-name"]="nameOverride"in i?i.nameOverride??r:r,e[r]=n}}var mzu="api",Lxm="group";var Uxm=".preview",Vxm="approved-output-directories",Wxm=".fern";var Kxm=require("fs/promises");var $xm=require("fs/promises");var Hxm=require("os");function RMa(){return ku(Kl.of((0,Hxm.homedir)()),yo.of(Wxm),yo.of(Vxm))}async function Gxm(){let e=RMa();if(!await zf(e))return[];let r=await(0,$xm.readFile)(e,{encoding:"utf-8"});return JSON.parse(r)}var Pzu=require("fs/promises"),Qxm=Di(require("path"),1);async function Jxm(e){await(0,Pzu.mkdir)(Qxm.default.dirname(RMa()),{recursive:!0}),await(0,Pzu.writeFile)(RMa(),JSON.stringify(e,null,2))}async function Yxm(e,t,r){if(!e||jKu()||r)return{shouldProceed:!0};let i=await Gxm();return i?.includes(e)?{shouldProceed:!0}:await zf(e)?(await(0,Kxm.readdir)(e)).length===0?{shouldProceed:!0}:await t.confirmPrompt(`Directory ${e} contains existing files that may be overwritten. Continue?`,!1)?(await Jxm([...i??[],e]),{shouldProceed:!0}):{shouldProceed:!1}:{shouldProceed:!0}}var p7m=Di(hg(),1),pNt=Di(c7m(),1),bEe=Di(nq(),1);var J_i=Di(require("path"),1),nHi="/fern",aHi=J_i.default.join(nHi,"output"),aWl=J_i.default.join(nHi,"config.json"),HRu=J_i.default.join(nHi,"ir.json"),uqa=J_i.default.join(nHi,"snippet.json"),sqa=J_i.default.join(nHi,"snippet-templates.json"),YTL=J_i.default.join(nHi,"generators"),l7m=J_i.default.join(nHi,"sources");var R7F="0.0.1";function f7m(e){return e!=null?p7m.GithubPublishInfo._visit(e,{npm:t=>pNt.FernGeneratorExec.GithubPublishInfo.npm({registryUrl:t.registryUrl,packageName:t.packageName,tokenEnvironmentVariable:(0,bEe.EnvironmentVariable)(t.token??"")}),maven:t=>pNt.FernGeneratorExec.GithubPublishInfo.maven({registryUrl:t.registryUrl,coordinate:t.coordinate,usernameEnvironmentVariable:(0,bEe.EnvironmentVariable)(t.credentials?.username??""),passwordEnvironmentVariable:(0,bEe.EnvironmentVariable)(t.credentials?.password??""),signature:t.signature!=null?{keyIdEnvironmentVariable:(0,bEe.EnvironmentVariable)(t.signature.keyId??""),passwordEnvironmentVariable:(0,bEe.EnvironmentVariable)(t.signature.password??""),secretKeyEnvironmentVariable:(0,bEe.EnvironmentVariable)(t.signature.secretKey??"")}:void 0}),pypi:t=>pNt.FernGeneratorExec.GithubPublishInfo.pypi({registryUrl:t.registryUrl,packageName:t.packageName,usernameEnvironmentVariable:(0,bEe.EnvironmentVariable)(t.credentials?.username??""),passwordEnvironmentVariable:(0,bEe.EnvironmentVariable)(t.credentials?.password??"")}),rubygems:t=>pNt.FernGeneratorExec.GithubPublishInfo.rubygems({registryUrl:t.registryUrl,packageName:t.packageName,apiKeyEnvironmentVariable:(0,bEe.EnvironmentVariable)(t.apiKey??"")}),postman:t=>pNt.FernGeneratorExec.GithubPublishInfo.postman({apiKeyEnvironmentVariable:(0,bEe.EnvironmentVariable)(t.apiKey??""),workspaceIdEnvironmentVariable:(0,bEe.EnvironmentVariable)(t.workspaceId??"")}),nuget:t=>pNt.FernGeneratorExec.GithubPublishInfo.nuget({registryUrl:t.registryUrl,packageName:t.packageName,apiKeyEnvironmentVariable:(0,bEe.EnvironmentVariable)(t.apiKey??"")}),_other:()=>{}}):void 0}function _7m({generatorInvocation:e,customConfig:t,workspaceName:r,organization:i,outputVersion:n=R7F,absolutePathToSnippet:a,absolutePathToSnippetTemplates:u,writeUnitTests:l,generateOauthClients:f,generatePaginatedClients:s}){let o=[],c=e.outputMode._visit({publish:b=>({...d7m(n,b),publishingMetadata:e.publishMetadata}),publishV2:b=>({...d7m(n,b),publishingMetadata:e.publishMetadata}),downloadFiles:()=>({mode:pNt.FernGeneratorExec.OutputMode.downloadFiles(),path:aHi,publishingMetadata:e.publishMetadata}),github:b=>{let g={mode:pNt.FernGeneratorExec.OutputMode.github({repoUrl:`https://github.com/${b.owner}/${b.repo}`,version:n,publishInfo:f7m(b.publishInfo),installationToken:void 0}),path:aHi,publishingMetadata:e.publishMetadata};return a!==void 0&&(o.push(`${a}:${uqa}`),g.snippetFilepath=uqa),u!==void 0&&(o.push(`${u}:${sqa}`),g.snippetTemplateFilepath=sqa),g},githubV2:b=>{let g=b._visit({commitAndRelease:m=>`https://github.com/${m.owner}/${m.repo}`,push:m=>`https://github.com/${m.owner}/${m.repo}`,pullRequest:m=>`https://github.com/${m.owner}/${m.repo}`,_other:()=>{throw new Error("Encountered unknown github mode")}}),O={mode:pNt.FernGeneratorExec.OutputMode.github({repoUrl:g,version:n,publishInfo:f7m(b.publishInfo)}),path:aHi,publishingMetadata:e.publishMetadata};return a!==void 0&&(o.push(`${a}:${uqa}`),O.snippetFilepath=uqa),u!==void 0&&(o.push(`${u}:${sqa}`),O.snippetTemplateFilepath=sqa),O},_other:()=>{throw new Error("Output type did not match any of the types supported by Fern")}});return{binds:o,config:{irFilepath:HRu,output:c,publish:void 0,customConfig:t,workspaceName:r,organization:i,environment:pNt.FernGeneratorExec.GeneratorEnvironment.local(),dryRun:!1,whitelabel:!1,writeUnitTests:l,generateOauthClients:f,generatePaginatedClients:s}}}function d7m(e,t){let r;return"registryOverrides"in t?r=t.registryOverrides.maven??t.registryOverrides.npm:r!=null&&(r=t._visit({mavenOverride:i=>i,npmOverride:i=>i,pypiOverride:i=>i,rubyGemsOverride:i=>i,postman:i=>i,nugetOverride:i=>i,_other:()=>{}})),{mode:pNt.FernGeneratorExec.OutputMode.publish({registries:{maven:{group:"",password:r?.password??"",registryUrl:r?.registryUrl??"",username:r?.username??""},npm:{registryUrl:r?.registryUrl??"",scope:"",token:r?.token??""}},publishTarget:void 0,registriesV2:{maven:{password:r?.password??"",registryUrl:r?.registryUrl??"",username:r?.username??"",coordinate:r?.coordinate??"",signature:r?.signature},npm:{registryUrl:r?.registryUrl??"",token:r?.token??"",packageName:r?.packageName??""},pypi:{packageName:r?.coordinate??"",password:r?.password??"",registryUrl:r?.registryUrl??"",username:r?.username??"",pypiMetadata:r?.pypiMetadata},rubygems:{registryUrl:r?.registryUrl??"",apiKey:r?.apiKey??"",packageName:r?.packageName??""},nuget:{registryUrl:r?.registryUrl??"",apiKey:r?.apiKey??"",packageName:r?.packageName??""}},version:e}),path:aHi}}async function h7m({workspace:e,audiences:t,generatorInvocation:r,context:i,irVersionOverride:n,version:a,packageName:u,sourceConfig:l,includeOptionalRequestPropertyExamples:f}){let s=b2({workspace:e,audiences:t,generationLanguage:r.language,keywords:r.keywords,smartCasing:r.smartCasing,exampleGeneration:{includeOptionalRequestPropertyExamples:f,disabled:r.disableExamples},readme:r.readme,version:a,packageName:u,context:i,sourceResolver:new y2(i,e)});l!=null&&(s.sourceConfig=l),i.logger.debug("Generated IR");let o=n!=null?await zMa({intermediateRepresentation:s,context:i,version:n}):await IMa({intermediateRepresentation:s,context:i,targetGenerator:{name:r.name,version:r.version}});return{latest:s,migrated:o}}var O7m=require("fs/promises"),Jzn=Di(Jk(),1);var y7m=require("fs/promises"),v7m=Di(Jk(),1);async function oWl({logger:e,imageName:t,args:r=[],binds:i=[],writeLogsToFile:n=!0,removeAfterCompletion:a=!1}){let u=()=>F7F({logger:e,imageName:t,args:r,binds:i,removeAfterCompletion:a,writeLogsToFile:n});try{await u()}catch(l){if(l instanceof Error&&l.message.includes("No such image"))await N7F(t),await u();else throw l}}async function F7F({logger:e,imageName:t,args:r,binds:i,removeAfterCompletion:n,writeLogsToFile:a}){let u=["run","--user","root",...i.flatMap(c=>["-v",c]),n?"--rm":"",t,...r].filter(Boolean),{stdout:l,stderr:f,exitCode:s}=await QH(e,"docker",u,{reject:!1,all:!0,doNotPipeOutput:!0}),o=l+f;if(a){let c=await v7m.default.file();await(0,y7m.writeFile)(c.path,o),e.info(`Generator logs here: ${c.path}`)}if(s!==0)throw new Error(`Docker exited with code ${s}.
|
|
1984
1984
|
${l}
|
|
1985
1985
|
${f}`)}async function N7F(e){await QH(void 0,"docker",["pull",e],{all:!0,doNotPipeOutput:!0})}var m7m=Di(Lf(),1);var b7m=Di(_1o(),1),Cme=require("fs/promises"),g7m=Di(Jk(),1);var $Ru=class{context;absolutePathToTmpOutputDirectory;absolutePathToTmpSnippetJSON;absolutePathToTmpSnippetTemplatesJSON;absolutePathToLocalSnippetTemplateJSON;absolutePathToLocalOutput;absolutePathToLocalSnippetJSON;constructor({context:t,absolutePathToTmpOutputDirectory:r,absolutePathToTmpSnippetJSON:i,absolutePathToLocalSnippetTemplateJSON:n,absolutePathToLocalOutput:a,absolutePathToLocalSnippetJSON:u,absolutePathToTmpSnippetTemplatesJSON:l}){this.context=t,this.absolutePathToLocalOutput=a,this.absolutePathToTmpOutputDirectory=r,this.absolutePathToTmpSnippetJSON=i,this.absolutePathToLocalSnippetJSON=u,this.absolutePathToLocalSnippetTemplateJSON=n,this.absolutePathToTmpSnippetTemplatesJSON=l}async copyGeneratedFiles(){await this.isFernIgnorePresent()?await this.copyGeneratedFilesWithFernIgnore():await this.copyGeneratedFilesNoFernIgnore(),this.absolutePathToTmpSnippetJSON!=null&&this.absolutePathToLocalSnippetJSON!=null&&await zf(this.absolutePathToTmpSnippetJSON)&&await this.copySnippetJSON({absolutePathToTmpSnippetJSON:this.absolutePathToTmpSnippetJSON,absolutePathToLocalSnippetJSON:this.absolutePathToLocalSnippetJSON}),this.absolutePathToTmpSnippetTemplatesJSON!=null&&this.absolutePathToLocalSnippetTemplateJSON!=null&&await zf(this.absolutePathToTmpSnippetTemplatesJSON)&&await this.copySnippetJSON({absolutePathToTmpSnippetJSON:this.absolutePathToTmpSnippetTemplatesJSON,absolutePathToLocalSnippetJSON:this.absolutePathToLocalSnippetTemplateJSON})}async isFernIgnorePresent(){let t=Kl.of(ku(this.absolutePathToLocalOutput,yo.of($7a)));return await zf(t)}async copyGeneratedFilesWithFernIgnore(){let t=Kl.of((await g7m.default.dir({})).path),r=Kl.of(ku(this.absolutePathToLocalOutput,yo.of($7a))),i=await U7F({absolutePathToFernignore:r});await(0,Cme.cp)(this.absolutePathToLocalOutput,t,{recursive:!0}),await this.runGitCommand(["init"],t),await this.runGitCommand(["add","."],t),(await this.runGitCommand(["config","--list"],t)).includes("user.name")||(await this.runGitCommand(["config","user.name","fern-api"],t),await this.runGitCommand(["config","user.email","info@buildwithfern.com"],t)),await this.runGitCommand(["commit","--allow-empty","-m",'"init"'],t),await this.runGitCommand(["rm","-rf","."],t),await this.copyGeneratedFilesToDirectory(t),await this.runGitCommand(["reset","--",...i],t),await this.runGitCommand(["restore","."],t),await(0,Cme.rmdir)(this.absolutePathToLocalOutput,{recursive:!0}),await(0,Cme.cp)(t,this.absolutePathToLocalOutput,{recursive:!0})}async copyGeneratedFilesNoFernIgnore(){this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`),await(0,Cme.rm)(this.absolutePathToLocalOutput,{force:!0,recursive:!0}),await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput)}async copyGeneratedFilesToDirectory(t){let[r,...i]=await(0,Cme.readdir)(this.absolutePathToTmpOutputDirectory);if(r!=null)if(this.context.logger.debug(`Copying generated files to ${t}`),r.endsWith(".zip")){await(0,b7m.default)(ku(this.absolutePathToTmpOutputDirectory,yo.of(r)),t);for(let n of i)await(0,Cme.cp)(ku(this.absolutePathToTmpOutputDirectory,yo.of(n)),ku(t,yo.of(n)),{recursive:!0})}else await(0,Cme.cp)(this.absolutePathToTmpOutputDirectory,t,{recursive:!0})}async copySnippetJSON({absolutePathToTmpSnippetJSON:t,absolutePathToLocalSnippetJSON:r}){this.context.logger.debug(`Copying generated snippets to ${r}`),await(0,Cme.cp)(t,r)}async runGitCommand(t,r){return(await QH(this.context.logger,"git",t,{cwd:r,doNotPipeOutput:!0})).stdout}},L7F=/\r?\n/;async function U7F({absolutePathToFernignore:e}){let t=(await(0,Cme.readFile)(e)).toString();return[$7a,...t.trim().split(L7F).filter(r=>!r.startsWith("#")&&r.length>0)]}async function P7m({organization:e,workspace:t,generatorInvocation:r,absolutePathToLocalOutput:i,absolutePathToLocalSnippetJSON:n,absolutePathToLocalSnippetTemplateJSON:a,absolutePathToFernConfig:u,audiences:l,workspaceTempDir:f,keepDocker:s,context:o,irVersionOverride:c,outputVersionOverride:b,writeUnitTests:g,generateOauthClients:O,generatePaginatedClients:m,includeOptionalRequestPropertyExamples:w}){let{latest:A,migrated:M}=await h7m({workspace:t,audiences:l,generatorInvocation:r,context:o,irVersionOverride:c,packageName:j0.getPackageName({generatorInvocation:r}),version:b,sourceConfig:H7F(t),includeOptionalRequestPropertyExamples:w}),q=await V7F({workspaceTempDir:f,context:o,ir:M});o.logger.debug("Wrote IR to: "+q);let D=await Jzn.default.file({tmpdir:f.path}),C=Kl.of(D.path);o.logger.debug("Will write config.json to: "+C);let R=await Jzn.default.dir({tmpdir:f.path}),$=Kl.of(R.path);o.logger.debug("Will write output to: "+$);let I;if(n!=null){let J=await Jzn.default.file({tmpdir:f.path});I=Kl.of(J.path),o.logger.debug("Will write snippet.json to: "+I)}let U;if(a!=null){let J=await Jzn.default.file({tmpdir:f.path});U=Kl.of(J.path),o.logger.debug("Will write snippet-templates.json to: "+U)}let{generatorConfig:H}=await W7F({absolutePathToOutput:$,absolutePathToSnippet:I,absolutePathToSnippetTemplates:U,absolutePathToIr:q,absolutePathToWriteConfigJson:C,workspaceName:t.definition.rootApiFile.contents.name,organization:e,outputVersion:b,keepDocker:s,generatorInvocation:r,context:o,writeUnitTests:g,generateOauthClients:O,generatePaginatedClients:m,sources:t.getSources()});return await new $Ru({context:o,absolutePathToLocalOutput:i,absolutePathToTmpOutputDirectory:$,absolutePathToLocalSnippetJSON:n,absolutePathToLocalSnippetTemplateJSON:a,absolutePathToTmpSnippetJSON:I,absolutePathToTmpSnippetTemplatesJSON:U}).copyGeneratedFiles(),{absolutePathToIr:q,absolutePathToConfigJson:C,ir:A,generatorConfig:H}}async function V7F({ir:e,workspaceTempDir:t,context:r}){r.logger.debug("Migrated IR");let i=await Jzn.default.file({tmpdir:t.path}),n=Kl.of(i.path);return await c6r(n,e,{pretty:!1}),r.logger.debug(`Wrote IR to ${n}`),n}async function W7F({workspaceName:e,organization:t,outputVersion:r,absolutePathToOutput:i,absolutePathToSnippet:n,absolutePathToSnippetTemplates:a,absolutePathToIr:u,absolutePathToWriteConfigJson:l,keepDocker:f,context:s,generatorInvocation:o,writeUnitTests:c,generateOauthClients:b,generatePaginatedClients:g,sources:O}){let{name:m,version:w,config:A}=o,M=`${m}:${w}`,q=[`${l}:${aWl}:ro`,`${u}:${HRu}:ro`,`${i}:${aHi}`];for(let I of O)q.push(`${I.absoluteFilePath}:${j7m(I)}:ro`);let{config:D,binds:C}=_7m({generatorInvocation:o,customConfig:A,workspaceName:e,outputVersion:r,organization:t,absolutePathToSnippet:n,absolutePathToSnippetTemplates:a,writeUnitTests:c,generateOauthClients:b,generatePaginatedClients:g});q.push(...C);let R=await m7m.GeneratorConfig.json(D);if(!R.ok)throw new Error(`Failed to parse config.json into ${l}`);if(await(0,O7m.writeFile)(l,JSON.stringify(R.value,void 0,4)),!await PKu(l,5e3))throw new Error(`Failed to create ${l}`);return await oWl({logger:s.logger,imageName:M,args:[aWl],binds:q,removeAfterCompletion:!f}),{generatorConfig:D}}function H7F(e){return{sources:e.getSources().map(t=>t.type==="protobuf"?xee.proto({id:t.id,protoRootUrl:`file:///${j7m(t)}`}):xee.openapi())}}function j7m(e){return`${l7m}/${e.id}`}var uWl=Di(require("os"),1),w7m=Di(require("path"),1),S7m=Di(Jk(),1);async function sWl({projectConfig:e,workspace:t,generatorGroup:r,keepDocker:i,context:n}){let a=await $7F();(await Promise.all(r.generators.map(async l=>n.runInteractiveTask({name:l.name},async f=>{if(l.absolutePathToLocalOutput==null)f.failWithoutThrowing("Cannot generate because output location is not local-file-system");else{let s=await t.toFernWorkspace({context:n},ydn(l));await P7m({organization:e.organization,absolutePathToFernConfig:e._absolutePath,workspace:s,generatorInvocation:l,absolutePathToLocalOutput:l.absolutePathToLocalOutput,absolutePathToLocalSnippetJSON:void 0,absolutePathToLocalSnippetTemplateJSON:void 0,audiences:r.audiences,workspaceTempDir:a,keepDocker:i,context:f,irVersionOverride:l.irVersionOverride,outputVersionOverride:void 0,writeUnitTests:!1,generateOauthClients:!1,generatePaginatedClients:!1}),f.logger.info(Su.green("Wrote files to "+l.absolutePathToLocalOutput))}})))).some(l=>!l)&&n.failAndThrow()}async function $7F(){return S7m.default.dir({tmpdir:uWl.default.platform()==="darwin"?w7m.default.join("/private",uWl.default.tmpdir()):void 0,prefix:"fern"})}var ZRu=Di(LPi(),1);var D7m=require("fs"),GRu=require("fs/promises"),E7m=require("stream/promises");async function A7m({snippetsS3PreSignedReadUrl:e,absolutePathToLocalSnippetJSON:t,context:r}){try{await G7F({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}),r.logger.info(Su.green(`Downloaded to ${t}`))}catch{r.logger.debug(Su.yellow("Failed to download snippet.json from output."))}}async function G7F({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await zz.get(e,{responseType:"stream"});await zf(t)&&await(0,GRu.rm)(t,{recursive:!0}),await(0,GRu.mkdir)(Mp(t),{recursive:!0}),await(0,E7m.pipeline)(r.data,(0,D7m.createWriteStream)(t))}var fWl=Di(twe(),1);var C7m=Di(_1o(),1),B7m=require("fs"),KRu=require("fs/promises"),lWl=Di(require("path"),1),x7m=require("stream/promises");var QRu=Di(T7m(),1);function d$r(e,t,{target:r="stdout",...i}={}){return QRu.default[r]?Efn.link(e,t):i.fallback===!1?e:typeof i.fallback=="function"?i.fallback(e,t):`${e} (\u200B${t}\u200B)`}d$r.isSupported=QRu.default.stdout;d$r.stderr=(e,t,r={})=>d$r(e,t,{target:"stderr",...r});d$r.stderr.isSupported=QRu.default.stderr;var I7m=Di(Jk(),1);var JRu=class{context;generatorInvocation;absolutePathToPreview;lengthOfLastLogs=0;constructor({interactiveTaskContext:t,generatorInvocation:r,absolutePathToPreview:i}){this.context=t,this.generatorInvocation=r,this.absolutePathToPreview=i}async processUpdate(t){t==null&&this.context.failAndThrow("Task is missing on job status");let r=t.packages.map(n=>n.coordinate._visit({npm:a=>`${a.name}@${a.version}`,maven:a=>`${a.group}:${a.artifact}:${a.version}`,pypi:a=>`${a.name} ${a.version}`,ruby:a=>`${a.name}:${a.version}`,nuget:a=>`${a.name} ${a.version}`,_other:()=>"<unknown package>"}));this.absolutePathToPreview==null&&this.context.setSubtitle(r.length>0?r.map(n=>`\u25E6 ${n}`).join(`
|
|
1986
|
-
`):void 0);for(let n of t.logs.slice(this.lengthOfLastLogs))this.context.logger.log(Y7F(n.level),n.message);this.lengthOfLastLogs=t.logs.length;let i=n=>{this.context.logger.debug(`Generated files. ${d$r("View here",n,{fallback:(a,u)=>`${a}: ${u}`})}`)};return await t.status._visit({notStarted:Yo,running:Yo,failed:({message:n,s3PreSignedReadUrl:a})=>{a!=null&&i(a),this.context.failAndThrow(n)},finished:async n=>{if(n.s3PreSignedReadUrlV2!=null){i(n.s3PreSignedReadUrlV2);let a=this.getAbsolutePathToLocalOutput();a!=null&&await J7F({s3PreSignedReadUrl:n.s3PreSignedReadUrlV2,absolutePathToLocalOutput:a,context:this.context})}if(this.absolutePathToPreview==null)for(let a of r)this.context.logger.info(`Published ${a}`);this.#e=!0,this.#t=n.createdSnippets!=null?n.createdSnippets:!1,this.#r=n.snippetsS3PreSignedReadUrl},_other:()=>{this.context.logger.warn("Received unknown update type: "+t.status.type)}}),this.#e?{createdSnippets:this.#t,snippetsS3PreSignedReadUrl:this.#r}:void 0}getAbsolutePathToLocalOutput(){return this.absolutePathToPreview!=null?ku(this.absolutePathToPreview,yo.of(lWl.default.basename(this.generatorInvocation.name))):this.generatorInvocation.absolutePathToLocalOutput}#e=!1;get isFinished(){return this.#e}#t=!1;get createdSnippets(){return this.#t}#r=void 0;get snippetsS3PreSignedReadUrl(){return this.#r}};async function J7F({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t,context:r}){try{await K7F({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}),r.logger.info(Su.green(`Downloaded to ${t}`))}catch(i){r.failAndThrow("Failed to download files",i)}}async function K7F({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await zz.get(e,{responseType:"stream"}),i=await I7m.default.dir({prefix:"fern",unsafeCleanup:!0}),n=lWl.default.join(i.path,"output.zip");await(0,x7m.pipeline)(r.data,(0,B7m.createWriteStream)(n)),await zf(t)&&await(0,KRu.rm)(t,{recursive:!0}),await(0,KRu.mkdir)(t,{recursive:!0}),await(0,C7m.default)(n,t)}function Y7F(e){switch(e){case"DEBUG":return k0.Debug;case"INFO":return k0.Info;case"WARN":return k0.Warn;case"ERROR":return k0.Error;default:return k0.Info}}var XRu=require("fs/promises"),z7m=Di(Jk(),1);var X7F="proto.zip",YRu=class{sourceTypes;context;sources;constructor(t,r){this.context=t,this.sources=Object.fromEntries(r.map(i=>[i.id,i])),this.sourceTypes=new Set(Object.values(this.sources).map(i=>i.type))}async uploadSources(t){for(let[r,i]of Object.entries(t)){let n=this.getSourceOrThrow(r);await this.uploadSource(n,i.uploadUrl)}return this.convertFdrSourceUploadsToSourceConfig(t)}async uploadSource(t,r){let i=await this.getUploadCommand(t),n=await(0,XRu.readFile)(i.absoluteFilePath),a=await fetch(r,{method:"PUT",body:n,headers:{"Content-Type":"application/octet-stream"}});await i.cleanup(),a.ok||this.context.failAndThrow(`Failed to upload source file: ${t.absoluteFilePath}. Status: ${a.status}, ${a.statusText}`)}async getUploadCommand(t){if(t.type==="protobuf"){let r=await this.zipSource(t.absoluteFilePath);return{absoluteFilePath:r,cleanup:async()=>{this.context.logger.debug(`Removing ${r}`),await(0,XRu.unlink)(r)}}}return{absoluteFilePath:t.absoluteFilePath,cleanup:async()=>{}}}async zipSource(t){let r=await z7m.default.dir(),i=ku(Kl.of(r.path),yo.of(X7F));return this.context.logger.debug(`Zipping source ${t} into ${i}`),await QH(this.context.logger,"zip",["-r",i,"."],{cwd:t,doNotPipeOutput:!0}),i}convertFdrSourceUploadsToSourceConfig(t){let r=[];for(let[i,n]of Object.entries(t))switch(this.getSourceOrThrow(i).type){case"protobuf":r.push(xee.proto({id:i,protoRootUrl:n.downloadUrl}));continue;case"openapi":r.push(xee.openapi());continue;case"asyncapi":continue}return{sources:r}}getSourceOrThrow(t){let r=this.sources[t];return r==null&&this.context.failAndThrow(`Internal error; server responded with source id "${t}" which does not exist in the workspace.`),r}};var R7m=Di(CLn(),1),Bme=require("fs/promises");var F7m=require("path"),N7m=Di(rmo(),1),L7m=Di(Jk(),1);var Yzn=Di(LPi(),1);async function U7m({projectConfig:e,workspace:t,organization:r,intermediateRepresentation:i,generatorInvocation:n,version:a,context:u,shouldLogS3Url:l,token:f,whitelabel:s,irVersionOverride:o,absolutePathToPreview:c}){let b=await Z7F({projectConfig:e,workspace:t,organization:r,generatorInvocation:n,version:a,context:u,shouldLogS3Url:l,token:f,whitelabel:s,absolutePathToPreview:c});return await k7F({intermediateRepresentation:i,job:b,context:u,generatorInvocation:n,irVersionOverride:o}),b}async function Z7F({projectConfig:e,workspace:t,organization:r,generatorInvocation:i,version:n,context:a,shouldLogS3Url:u,token:l,whitelabel:f,absolutePathToPreview:s}){let o=l4r({token:l.value}),c={id:i.name,version:i.version,outputMode:i.outputMode,customConfig:i.config,publishMetadata:i.publishMetadata},b;if(i.outputMode.type.startsWith("github"))try{let O=await L7m.default.dir(),m=Kl.of(O.path);a.logger.debug(`Writing mock fern definition to ${m}`);let w=ku(m,yo.of(K9)),A=ku(w,yo.of(v4));await(0,Bme.mkdir)(A,{recursive:!0});let M=ku(A,yo.of(UN));await(0,Bme.writeFile)(M,pp.dump(t.definition.rootApiFile.contents)),await V7m({absolutePathToDefinitionDirectory:A,definition:t.definition});let q=ku(w,yo.of($k));await(0,Bme.writeFile)(q,JSON.stringify(e.rawConfig,void 0,2));try{let R=t.getSources();for(let $ of R){let I=await(0,Bme.readFile)($.absoluteFilePath),U=(0,F7m.relative)(t.absoluteFilePath,$.absoluteFilePath),H=ku(w,yo.of(U));await(0,Bme.mkdir)(Mp(H),{recursive:!0}),await(0,Bme.writeFile)(H,new Uint8Array(I))}}catch(R){a.logger.debug(`Failed to write source files to disk, continuing: ${R}`)}let D=ku(m,yo.of("definition.tgz"));await(0,N7m.create)({file:D,cwd:w},["."]),a.logger.debug("Getting upload URL for Fern definition.");let C=await o.remoteGen.getDefinitionUploadUrl({apiName:t.definition.rootApiFile.contents.name,organizationName:r,version:n});C.ok?(a.logger.debug("Uploading definition..."),await zz.put(C.body.s3Url,await(0,Bme.readFile)(D)),b={definitionS3DownloadUrl:C.body.s3Url,outputPath:".mock",cliVersion:e.version}):C.error.content.reason==="status-code"?a.logger.debug(`Failed with status-code to get upload URL with status code ${C.error.content.statusCode}, continuing: ${C.error.content.body}`):C.error.content.reason==="non-json"?a.logger.debug(`Failed with non-json to get upload URL with status code ${C.error.content.statusCode}, continuing: ${C.error.content.rawBody}`):C.error.content.reason==="unknown"&&a.logger.debug(`Failed to get upload URL as unknown error occurred continuing: ${C.error.content.errorMessage}`)}catch(O){a.logger.debug(`Failed to upload definition to S3, continuing: ${O}`)}let g=await o.remoteGen.createJobV3({apiName:t.definition.rootApiFile.contents.name,version:n,organizationName:r,generators:[c],uploadToS3:t2F({outputMode:i.outputMode,generatorInvocation:i,absolutePathToPreview:s,shouldLogS3Url:u}),whitelabel:f,fernDefinitionMetadata:b,preview:s!=null});return g.ok?g.body:e2F(g.error)._visit({illegalApiNameError:()=>a.failAndThrow("API name is invalid: "+t.definition.rootApiFile.contents.name),illegalApiVersionError:()=>a.failAndThrow("API version is invalid: "+n),cannotPublishToNpmScope:({validScope:O,invalidScope:m})=>a.failAndThrow(`You do not have permission to publish to ${m} (expected ${O})`),cannotPublishToMavenGroup:({validGroup:O,invalidGroup:m})=>a.failAndThrow(`You do not have permission to publish to ${m} (expected ${O})`),cannotPublishPypiPackage:({validPrefix:O,invalidPackageName:m})=>a.failAndThrow(`You do not have permission to publish to ${m} (expected ${O})`),generatorsDoNotExistError:O=>a.failAndThrow("Generators do not exist: "+O.nonExistentGenerators.map(m=>`${m.id}@${m.version}`).join(", ")),insufficientPermissions:()=>a.failAndThrow("Insufficient permissions."),orgNotConfiguredForWhitelabel:()=>a.failAndThrow("Your org is not configured for white-labeling. Please reach out to support@buildwithfern.com."),_other:O=>a.failAndThrow("Failed to create job",O)})}async function V7m({absolutePathToDefinitionDirectory:e,definition:t}){for(let[r,i]of Object.entries(t.namedDefinitionFiles)){let n=ku(e,yo.of(r));await(0,Bme.mkdir)(Mp(n),{recursive:!0}),await(0,Bme.writeFile)(n,pp.dump(i.contents))}for(let[r,i]of Object.entries(t.packageMarkers))if(i.contents.export==null){let n=ku(e,yo.of(r));await(0,Bme.mkdir)(Mp(n),{recursive:!0}),await(0,Bme.writeFile)(n,pp.dump(i.contents))}for(let[r,i]of Object.entries(t.importedDefinitions))await V7m({absolutePathToDefinitionDirectory:ku(e,yo.of(r)),definition:i.definition})}async function k7F({intermediateRepresentation:e,generatorInvocation:t,job:r,context:i,irVersionOverride:n}){let a=n==null?await IMa({intermediateRepresentation:e,context:i,targetGenerator:{name:t.name,version:t.version}}):await LUl({intermediateRepresentation:e,context:i,irVersion:n,targetGenerator:{name:t.name,version:t.version}}),u=new R7m.default,l=await d6r(a,{onWrite:s=>{i.logger.debug("Wrote IR to disk: "+s)}});u.append("file",l);let f=Iv(ins(),`/api/remote-gen/jobs/${r.jobId}/start`);try{await zz.post(f,u,{headers:u.getHeaders(),maxBodyLength:1/0})}catch(s){let o=s instanceof sNd?s.response?.data:s;i.logger.debug(`POST ${f} failed with ${JSON.stringify(s)}`),i.failAndThrow("Failed to start job",o)}}function e2F(e){if(e?.reason==="status-code"){let t=e.body;switch(t?._error){case"IllegalApiNameError":return Yzn.FernFiddle.remoteGen.createJobV3.Error.illegalApiNameError();case"GeneratorsDoNotExistError":return Yzn.FernFiddle.remoteGen.createJobV3.Error.generatorsDoNotExistError(t.body);case"CannotPublishToNpmScope":return Yzn.FernFiddle.remoteGen.createJobV3.Error.cannotPublishToNpmScope(t.body);case"CannotPublishToMavenScope":return Yzn.FernFiddle.remoteGen.createJobV3.Error.cannotPublishToMavenGroup(t.body);case"InsufficientPermissions":return Yzn.FernFiddle.remoteGen.createJobV3.Error.insufficientPermissions(t.body)}}return e}function t2F({outputMode:e,generatorInvocation:t,absolutePathToPreview:r,shouldLogS3Url:i}){return e.type==="downloadFiles"||t.absolutePathToLocalSnippets!=null||r!=null||i}var W7m=l4r();var r2F=3;function H7m({job:e,taskId:t,taskHandler:r,context:i}){let n=0,a=async()=>{let u=await W7m.remoteGen.getJobStatus(e.jobId);if(u.ok)return u.body[t];i.logger.debug("Failed to get job status.",JSON.stringify(u.error.content))};return new Promise((u,l)=>{f();async function f(){try{let s=await a();if(s==null)n++,n===r2F&&i.failAndThrow(`Failed to get job status after ${n} attempts.`),setTimeout(f,2e3+1e3*n);else{n=0;let o=await r.processUpdate(s);r.isFinished?u(o):setTimeout(f,2e3)}}catch(s){l(s)}}})}async function $7m({projectConfig:e,organization:t,workspace:r,interactiveTaskContext:i,generatorInvocation:n,version:a,audiences:u,shouldLogS3Url:l,token:f,whitelabel:s,irVersionOverride:o,absolutePathToPreview:c,readme:b}){let g=HPi({token:f.value}),O=j0.getPackageName({generatorInvocation:n}),m=b2({workspace:r,generationLanguage:n.language,keywords:n.keywords,smartCasing:n.smartCasing,exampleGeneration:{disabled:n.disableExamples},audiences:u,readme:b,packageName:O,version:a??await n2F({fdr:g,packageName:O,generatorInvocation:n}),context:i,sourceResolver:new y2(i,r)}),w=r.getSources(),A=Xwe({ir:m,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0}}),M=await g.api.v1.register.registerApiDefinition({orgId:fWl.FernRegistry.OrgId(t),apiId:fWl.FernRegistry.ApiId(m.apiName.originalName),definition:A,sources:w.length>0?a2F(w):void 0}),q,D;M.ok&&(q=M.body.apiDefinitionId,D=M.body.sources);let C=new YRu(i,w);if(D==null&&C.sourceTypes.has("protobuf")&&(M.ok||i.failAndThrow(`Failed to register API definition: ${JSON.stringify(M.error.content)}`),i.failAndThrow("Did not successfully upload Protobuf source files.")),D!=null){i.logger.debug("Uploading source files ...");let J=await C.uploadSources(D);i.logger.debug("Setting IR source configuration ..."),m.sourceConfig=J}let R=c!=null,$=J=>wen(J,{onError:ee=>i.failAndThrow(ee)},{substituteAsEmpty:R}),I=$(n),U=await U7m({projectConfig:e,workspace:r,organization:t,generatorInvocation:I,context:i,version:a,intermediateRepresentation:{...m,fdrApiDefinitionId:q,publishConfig:i2F({generatorInvocation:I})},shouldLogS3Url:l,token:f,whitelabel:s!=null?$(s):void 0,irVersionOverride:o,absolutePathToPreview:c});i.logger.debug(`Job ID: ${U.jobId}`);let H=U.taskIds[0];if(H==null){i.failAndThrow("Did not receive a task ID.");return}i.logger.debug(`Task ID: ${H}`);let te=new JRu({job:U,taskId:H,generatorInvocation:n,interactiveTaskContext:i,absolutePathToPreview:c});return await H7m({job:U,taskHandler:te,taskId:H,context:i})}function i2F({generatorInvocation:e}){return e.outputMode._visit({downloadFiles:()=>{},github:()=>{},githubV2:()=>{},publish:()=>{},publishV2:t=>t._visit({mavenOverride:()=>{},pypiOverride:()=>{},nugetOverride:()=>{},npmOverride:()=>{},rubyGemsOverride:()=>{},postman:r=>{let i;return e.raw?.output?.location==="postman"&&(i=e.raw.output?.["collection-id"]),Bc.PublishingConfig.direct({target:Bc.PublishTarget.postman({apiKey:r.apiKey,workspaceId:r.workspaceId,collectionId:i})})},_other:()=>{}}),_other:()=>{}})}async function n2F({fdr:e,packageName:t,generatorInvocation:r}){if(r.language==null)return;let i;switch(r.language){case"csharp":i="Csharp";break;case"go":i="Go";break;case"java":i="Java";break;case"python":i="Python";break;case"ruby":i="Ruby";break;case"typescript":i="TypeScript";break;default:return}if(t==null)return;let n=await e.sdks.versions.computeSemanticVersion({githubRepository:r.outputMode.type==="githubV2"?`${r.outputMode.githubV2.owner}/${r.outputMode.githubV2.repo}`:void 0,language:i,package:t});if(n.ok)return n.body.version}function a2F(e){return Object.fromEntries(Object.values(e).map(t=>[t.id,{type:t.type==="protobuf"?"proto":t.type}]))}async function dWl({projectConfig:e,organization:t,workspace:r,context:i,generatorGroup:n,version:a,shouldLogS3Url:u,token:l,whitelabel:f,absolutePathToPreview:s,mode:o}){if(n.generators.length===0)return i.logger.warn("No generators specified."),null;let c=[],b=[];return c.push(...n.generators.map(O=>i.runInteractiveTask({name:O.name},async m=>{let w=await r.toFernWorkspace({context:i},ydn(O)),A=await $7m({projectConfig:e,organization:t,workspace:w,interactiveTaskContext:m,generatorInvocation:{...O,outputMode:O.outputMode._visit({downloadFiles:()=>O.outputMode,github:M=>ZRu.FernFiddle.OutputMode.github({...M,makePr:o==="pull-request"}),githubV2:M=>o==="pull-request"?ZRu.FernFiddle.OutputMode.githubV2(ZRu.FernFiddle.GithubOutputModeV2.pullRequest(M)):O.outputMode,publish:()=>O.outputMode,publishV2:()=>O.outputMode,_other:()=>O.outputMode})},version:a,audiences:n.audiences,shouldLogS3Url:u,token:l,whitelabel:f,readme:O.readme,irVersionOverride:O.irVersionOverride,absolutePathToPreview:s});A!=null&&A.createdSnippets&&(b.push(O),O.absolutePathToLocalSnippets!=null&&A.snippetsS3PreSignedReadUrl!=null&&await A7m({snippetsS3PreSignedReadUrl:A.snippetsS3PreSignedReadUrl,absolutePathToLocalSnippetJSON:O.absolutePathToLocalSnippets,context:m}))}))),(await Promise.all(c)).some(O=>!O)&&i.failAndThrow(),{snippetsProducedBy:b}}var I2m=require("fs/promises");var TWl=Di(uen(),1);var _Nt=Di(twe(),1);var A2m=Di(E2m(),1);var M2m=require("util");var R6F=(0,M2m.promisify)(A2m.default);async function q2m(e,t,r){let i=rUn(e,t),n=[];for(let a of i){let u=await Promise.all(a.map(async l=>{try{let f=await R6F(l);return f==null||f.height==null||f.width==null?void 0:{filePath:l,width:f.width,height:f.height,blurDataUrl:void 0}}catch(f){r.logger.error(`Failed to measure image size for ${l}. ${f?.message}`);return}}));n.push(...u.filter(dg))}return new Map(n.map(a=>[a.filePath,a]))}var F6F=10,T2m=10;async function z2m({token:e,organization:t,docsWorkspace:r,domain:i,customDomains:n,fernWorkspaces:a,ossWorkspaces:u,context:l,preview:f,editThisPage:s,isPrivate:o=!1}){let c=HPi({token:e.value}),b=o?{type:"private",authType:"sso"}:{type:"public"},g,O=n[0]??i,m=N6F(i),A=await new v6t(i,r,u,a,l,s,async q=>{let D=new Map(q.map(H=>[H.absoluteFilePath,H])),R=q.map(H=>({...H,mediaType:TWl.lookup(H.absoluteFilePath)})).filter(H=>H.mediaType!==!1).filter(H=>aB.parse(H.mediaType)?.isImage()??!1).map(H=>H.absoluteFilePath),$=await q2m(R,F6F,l),I=[];[...$.values()].forEach(H=>{let te=D.get(H.filePath);if(te==null)return;let J={filePath:_Nt.FernRegistry.docs.v1.write.FilePath(R4a(te.relativeFilePath)),width:H.width,height:H.height,blurDataUrl:H.blurDataUrl,alt:void 0};I.push(J)});let U=q.filter(({absoluteFilePath:H})=>!$.has(H)).map(({relativeFilePath:H})=>R4a(H));if(f){let H=await c.docs.v2.write.startDocsPreviewRegister({orgId:_Nt.FernRegistry.OrgId(t),authConfig:o?{type:"private",authType:"sso"}:{type:"public"},filepaths:U.map(te=>_Nt.FernRegistry.docs.v1.write.FilePath(te)),images:I,basePath:m});return H.ok?(O=H.body.previewUrl,g=H.body.docsRegistrationId,await C2m(H.body.uploadUrls,r.absoluteFilePath,l,T2m),B2m(H.body.uploadUrls,r.absoluteFilePath)):await x2m(H.error,l)}else{let H=await c.docs.v2.write.startDocsRegister({domain:i,customDomains:n,authConfig:b,apiId:_Nt.FernRegistry.ApiId(""),orgId:_Nt.FernRegistry.OrgId(t),filepaths:U.map(te=>_Nt.FernRegistry.docs.v1.write.FilePath(te)),images:I});return H.ok?(g=H.body.docsRegistrationId,await C2m(H.body.uploadUrls,r.absoluteFilePath,l,T2m),B2m(H.body.uploadUrls,r.absoluteFilePath)):x2m(H.error,l)}},async({ir:q,snippetsConfig:D,playgroundConfig:C,apiName:R})=>{let $=Xwe({ir:q,snippetsConfig:D,playgroundConfig:C}),I=await c.api.v1.register.registerApiDefinition({orgId:_Nt.FernRegistry.OrgId(t),apiId:_Nt.FernRegistry.ApiId(q.apiName.originalName),definition:$,definitionV2:void 0});if(I.ok)return l.logger.debug(`Registered API Definition ${I.body.apiDefinitionId}`),I.body.apiDefinitionId;switch(I.error.error){case"UnauthorizedError":case"UserNotInOrgError":return l.failAndThrow("You do not have permissions to register the docs. Reach out to support@buildwithfern.com");default:return R!=null?l.failAndThrow(`Failed to publish docs because API definition (${R}) could not be uploaded. Please contact support@buildwithfern.com
|
|
1986
|
+
`):void 0);for(let n of t.logs.slice(this.lengthOfLastLogs))this.context.logger.log(Y7F(n.level),n.message);this.lengthOfLastLogs=t.logs.length;let i=n=>{this.context.logger.debug(`Generated files. ${d$r("View here",n,{fallback:(a,u)=>`${a}: ${u}`})}`)};return await t.status._visit({notStarted:Yo,running:Yo,failed:({message:n,s3PreSignedReadUrl:a})=>{a!=null&&i(a),this.context.failAndThrow(n)},finished:async n=>{if(n.s3PreSignedReadUrlV2!=null){i(n.s3PreSignedReadUrlV2);let a=this.getAbsolutePathToLocalOutput();a!=null&&await J7F({s3PreSignedReadUrl:n.s3PreSignedReadUrlV2,absolutePathToLocalOutput:a,context:this.context})}if(this.absolutePathToPreview==null)for(let a of r)this.context.logger.info(`Published ${a}`);this.#e=!0,this.#t=n.createdSnippets!=null?n.createdSnippets:!1,this.#r=n.snippetsS3PreSignedReadUrl},_other:()=>{this.context.logger.warn("Received unknown update type: "+t.status.type)}}),this.#e?{createdSnippets:this.#t,snippetsS3PreSignedReadUrl:this.#r}:void 0}getAbsolutePathToLocalOutput(){return this.absolutePathToPreview!=null?ku(this.absolutePathToPreview,yo.of(lWl.default.basename(this.generatorInvocation.name))):this.generatorInvocation.absolutePathToLocalOutput}#e=!1;get isFinished(){return this.#e}#t=!1;get createdSnippets(){return this.#t}#r=void 0;get snippetsS3PreSignedReadUrl(){return this.#r}};async function J7F({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t,context:r}){try{await K7F({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}),r.logger.info(Su.green(`Downloaded to ${t}`))}catch(i){r.failAndThrow("Failed to download files",i)}}async function K7F({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await zz.get(e,{responseType:"stream"}),i=await I7m.default.dir({prefix:"fern",unsafeCleanup:!0}),n=lWl.default.join(i.path,"output.zip");await(0,x7m.pipeline)(r.data,(0,B7m.createWriteStream)(n)),await zf(t)&&await(0,KRu.rm)(t,{recursive:!0}),await(0,KRu.mkdir)(t,{recursive:!0}),await(0,C7m.default)(n,t)}function Y7F(e){switch(e){case"DEBUG":return k0.Debug;case"INFO":return k0.Info;case"WARN":return k0.Warn;case"ERROR":return k0.Error;default:return k0.Info}}var XRu=require("fs/promises"),z7m=Di(Jk(),1);var X7F="proto.zip",YRu=class{sourceTypes;context;sources;constructor(t,r){this.context=t,this.sources=Object.fromEntries(r.map(i=>[i.id,i])),this.sourceTypes=new Set(Object.values(this.sources).map(i=>i.type))}async uploadSources(t){for(let[r,i]of Object.entries(t)){let n=this.getSourceOrThrow(r);await this.uploadSource(n,i.uploadUrl)}return this.convertFdrSourceUploadsToSourceConfig(t)}async uploadSource(t,r){let i=await this.getUploadCommand(t),n=await(0,XRu.readFile)(i.absoluteFilePath),a=await fetch(r,{method:"PUT",body:n,headers:{"Content-Type":"application/octet-stream"}});await i.cleanup(),a.ok||this.context.failAndThrow(`Failed to upload source file: ${t.absoluteFilePath}. Status: ${a.status}, ${a.statusText}`)}async getUploadCommand(t){if(t.type==="protobuf"){let r=await this.zipSource(t.absoluteFilePath);return{absoluteFilePath:r,cleanup:async()=>{this.context.logger.debug(`Removing ${r}`),await(0,XRu.unlink)(r)}}}return{absoluteFilePath:t.absoluteFilePath,cleanup:async()=>{}}}async zipSource(t){let r=await z7m.default.dir(),i=ku(Kl.of(r.path),yo.of(X7F));return this.context.logger.debug(`Zipping source ${t} into ${i}`),await QH(this.context.logger,"zip",["-r",i,"."],{cwd:t,doNotPipeOutput:!0}),i}convertFdrSourceUploadsToSourceConfig(t){let r=[];for(let[i,n]of Object.entries(t))switch(this.getSourceOrThrow(i).type){case"protobuf":r.push(xee.proto({id:i,protoRootUrl:n.downloadUrl}));continue;case"openapi":r.push(xee.openapi());continue;case"asyncapi":continue}return{sources:r}}getSourceOrThrow(t){let r=this.sources[t];return r==null&&this.context.failAndThrow(`Internal error; server responded with source id "${t}" which does not exist in the workspace.`),r}};var R7m=Di(CLn(),1),Bme=require("fs/promises");var F7m=require("path"),N7m=Di(rmo(),1),L7m=Di(Jk(),1);var Yzn=Di(LPi(),1);async function U7m({projectConfig:e,workspace:t,organization:r,intermediateRepresentation:i,generatorInvocation:n,version:a,context:u,shouldLogS3Url:l,token:f,whitelabel:s,irVersionOverride:o,absolutePathToPreview:c}){let b=await Z7F({projectConfig:e,workspace:t,organization:r,generatorInvocation:n,version:a,context:u,shouldLogS3Url:l,token:f,whitelabel:s,absolutePathToPreview:c});return await k7F({intermediateRepresentation:i,job:b,context:u,generatorInvocation:n,irVersionOverride:o}),b}async function Z7F({projectConfig:e,workspace:t,organization:r,generatorInvocation:i,version:n,context:a,shouldLogS3Url:u,token:l,whitelabel:f,absolutePathToPreview:s}){let o=l4r({token:l.value}),c={id:i.name,version:i.version,outputMode:i.outputMode,customConfig:i.config,publishMetadata:i.publishMetadata},b;if(i.outputMode.type.startsWith("github"))try{let O=await L7m.default.dir(),m=Kl.of(O.path);a.logger.debug(`Writing mock fern definition to ${m}`);let w=ku(m,yo.of(K9)),A=ku(w,yo.of(v4));await(0,Bme.mkdir)(A,{recursive:!0});let M=ku(A,yo.of(UN));await(0,Bme.writeFile)(M,pp.dump(t.definition.rootApiFile.contents)),await V7m({absolutePathToDefinitionDirectory:A,definition:t.definition});let q=ku(w,yo.of($k));await(0,Bme.writeFile)(q,JSON.stringify(e.rawConfig,void 0,2));try{let R=t.getSources();for(let $ of R){let I=await(0,Bme.readFile)($.absoluteFilePath),U=(0,F7m.relative)(t.absoluteFilePath,$.absoluteFilePath),H=ku(w,yo.of(U));await(0,Bme.mkdir)(Mp(H),{recursive:!0}),await(0,Bme.writeFile)(H,new Uint8Array(I))}}catch(R){a.logger.debug(`Failed to write source files to disk, continuing: ${R}`)}let D=ku(m,yo.of("definition.tgz"));await(0,N7m.create)({file:D,cwd:w},["."]),a.logger.debug("Getting upload URL for Fern definition.");let C=await o.remoteGen.getDefinitionUploadUrl({apiName:t.definition.rootApiFile.contents.name,organizationName:r,version:n});C.ok?(a.logger.debug("Uploading definition..."),await zz.put(C.body.s3Url,await(0,Bme.readFile)(D)),b={definitionS3DownloadUrl:C.body.s3Url,outputPath:".mock",cliVersion:e.version}):C.error.content.reason==="status-code"?a.logger.debug(`Failed with status-code to get upload URL with status code ${C.error.content.statusCode}, continuing: ${C.error.content.body}`):C.error.content.reason==="non-json"?a.logger.debug(`Failed with non-json to get upload URL with status code ${C.error.content.statusCode}, continuing: ${C.error.content.rawBody}`):C.error.content.reason==="unknown"&&a.logger.debug(`Failed to get upload URL as unknown error occurred continuing: ${C.error.content.errorMessage}`)}catch(O){a.logger.debug(`Failed to upload definition to S3, continuing: ${O}`)}let g=await o.remoteGen.createJobV3({apiName:t.definition.rootApiFile.contents.name,version:n,organizationName:r,generators:[c],uploadToS3:t2F({outputMode:i.outputMode,generatorInvocation:i,absolutePathToPreview:s,shouldLogS3Url:u}),whitelabel:f,fernDefinitionMetadata:b,preview:s!=null});return g.ok?g.body:e2F(g.error)._visit({illegalApiNameError:()=>a.failAndThrow("API name is invalid: "+t.definition.rootApiFile.contents.name),illegalApiVersionError:()=>a.failAndThrow("API version is invalid: "+n),cannotPublishToNpmScope:({validScope:O,invalidScope:m})=>a.failAndThrow(`You do not have permission to publish to ${m} (expected ${O})`),cannotPublishToMavenGroup:({validGroup:O,invalidGroup:m})=>a.failAndThrow(`You do not have permission to publish to ${m} (expected ${O})`),cannotPublishPypiPackage:({validPrefix:O,invalidPackageName:m})=>a.failAndThrow(`You do not have permission to publish to ${m} (expected ${O})`),generatorsDoNotExistError:O=>a.failAndThrow("Generators do not exist: "+O.nonExistentGenerators.map(m=>`${m.id}@${m.version}`).join(", ")),insufficientPermissions:()=>a.failAndThrow("Insufficient permissions."),orgNotConfiguredForWhitelabel:()=>a.failAndThrow("Your org is not configured for white-labeling. Please reach out to support@buildwithfern.com."),_other:O=>a.failAndThrow("Failed to create job",O)})}async function V7m({absolutePathToDefinitionDirectory:e,definition:t}){for(let[r,i]of Object.entries(t.namedDefinitionFiles)){let n=ku(e,yo.of(r));await(0,Bme.mkdir)(Mp(n),{recursive:!0}),await(0,Bme.writeFile)(n,pp.dump(i.contents))}for(let[r,i]of Object.entries(t.packageMarkers))if(i.contents.export==null){let n=ku(e,yo.of(r));await(0,Bme.mkdir)(Mp(n),{recursive:!0}),await(0,Bme.writeFile)(n,pp.dump(i.contents))}for(let[r,i]of Object.entries(t.importedDefinitions))await V7m({absolutePathToDefinitionDirectory:ku(e,yo.of(r)),definition:i.definition})}async function k7F({intermediateRepresentation:e,generatorInvocation:t,job:r,context:i,irVersionOverride:n}){let a=n==null?await IMa({intermediateRepresentation:e,context:i,targetGenerator:{name:t.name,version:t.version}}):await LUl({intermediateRepresentation:e,context:i,irVersion:n,targetGenerator:{name:t.name,version:t.version}}),u=new R7m.default,l=await d6r(a,{onWrite:s=>{i.logger.debug("Wrote IR to disk: "+s)}});u.append("file",l);let f=Iv(ins(),`/api/remote-gen/jobs/${r.jobId}/start`);try{await zz.post(f,u,{headers:u.getHeaders(),maxBodyLength:1/0})}catch(s){let o=s instanceof sNd?s.response?.data:s;i.logger.debug(`POST ${f} failed with ${JSON.stringify(s)}`),i.failAndThrow("Failed to start job",o)}}function e2F(e){if(e?.reason==="status-code"){let t=e.body;switch(t?._error){case"IllegalApiNameError":return Yzn.FernFiddle.remoteGen.createJobV3.Error.illegalApiNameError();case"GeneratorsDoNotExistError":return Yzn.FernFiddle.remoteGen.createJobV3.Error.generatorsDoNotExistError(t.body);case"CannotPublishToNpmScope":return Yzn.FernFiddle.remoteGen.createJobV3.Error.cannotPublishToNpmScope(t.body);case"CannotPublishToMavenScope":return Yzn.FernFiddle.remoteGen.createJobV3.Error.cannotPublishToMavenGroup(t.body);case"InsufficientPermissions":return Yzn.FernFiddle.remoteGen.createJobV3.Error.insufficientPermissions(t.body)}}return e}function t2F({outputMode:e,generatorInvocation:t,absolutePathToPreview:r,shouldLogS3Url:i}){return e.type==="downloadFiles"||t.absolutePathToLocalSnippets!=null||r!=null||i}var W7m=l4r();var r2F=3;function H7m({job:e,taskId:t,taskHandler:r,context:i}){let n=0,a=async()=>{let u=await W7m.remoteGen.getJobStatus(e.jobId);if(u.ok)return u.body[t];i.logger.debug("Failed to get job status.",JSON.stringify(u.error.content))};return new Promise((u,l)=>{f();async function f(){try{let s=await a();if(s==null)n++,n===r2F&&i.failAndThrow(`Failed to get job status after ${n} attempts.`),setTimeout(f,2e3+1e3*n);else{n=0;let o=await r.processUpdate(s);r.isFinished?u(o):setTimeout(f,2e3)}}catch(s){l(s)}}})}async function $7m({projectConfig:e,organization:t,workspace:r,interactiveTaskContext:i,generatorInvocation:n,version:a,audiences:u,shouldLogS3Url:l,token:f,whitelabel:s,irVersionOverride:o,absolutePathToPreview:c,readme:b}){let g=HPi({token:f.value}),O=j0.getPackageName({generatorInvocation:n}),m=b2({workspace:r,generationLanguage:n.language,keywords:n.keywords,smartCasing:n.smartCasing,exampleGeneration:{disabled:n.disableExamples,skipAutogenerationIfManualExamplesExist:!0},audiences:u,readme:b,packageName:O,version:a??await n2F({fdr:g,packageName:O,generatorInvocation:n}),context:i,sourceResolver:new y2(i,r)}),w=r.getSources(),A=Xwe({ir:m,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0}}),M=await g.api.v1.register.registerApiDefinition({orgId:fWl.FernRegistry.OrgId(t),apiId:fWl.FernRegistry.ApiId(m.apiName.originalName),definition:A,sources:w.length>0?a2F(w):void 0}),q,D;M.ok&&(q=M.body.apiDefinitionId,D=M.body.sources);let C=new YRu(i,w);if(D==null&&C.sourceTypes.has("protobuf")&&(M.ok||i.failAndThrow(`Failed to register API definition: ${JSON.stringify(M.error.content)}`),i.failAndThrow("Did not successfully upload Protobuf source files.")),D!=null){i.logger.debug("Uploading source files ...");let J=await C.uploadSources(D);i.logger.debug("Setting IR source configuration ..."),m.sourceConfig=J}let R=c!=null,$=J=>wen(J,{onError:ee=>i.failAndThrow(ee)},{substituteAsEmpty:R}),I=$(n),U=await U7m({projectConfig:e,workspace:r,organization:t,generatorInvocation:I,context:i,version:a,intermediateRepresentation:{...m,fdrApiDefinitionId:q,publishConfig:i2F({generatorInvocation:I})},shouldLogS3Url:l,token:f,whitelabel:s!=null?$(s):void 0,irVersionOverride:o,absolutePathToPreview:c});i.logger.debug(`Job ID: ${U.jobId}`);let H=U.taskIds[0];if(H==null){i.failAndThrow("Did not receive a task ID.");return}i.logger.debug(`Task ID: ${H}`);let te=new JRu({job:U,taskId:H,generatorInvocation:n,interactiveTaskContext:i,absolutePathToPreview:c});return await H7m({job:U,taskHandler:te,taskId:H,context:i})}function i2F({generatorInvocation:e}){return e.outputMode._visit({downloadFiles:()=>{},github:()=>{},githubV2:()=>{},publish:()=>{},publishV2:t=>t._visit({mavenOverride:()=>{},pypiOverride:()=>{},nugetOverride:()=>{},npmOverride:()=>{},rubyGemsOverride:()=>{},postman:r=>{let i;return e.raw?.output?.location==="postman"&&(i=e.raw.output?.["collection-id"]),Bc.PublishingConfig.direct({target:Bc.PublishTarget.postman({apiKey:r.apiKey,workspaceId:r.workspaceId,collectionId:i})})},_other:()=>{}}),_other:()=>{}})}async function n2F({fdr:e,packageName:t,generatorInvocation:r}){if(r.language==null)return;let i;switch(r.language){case"csharp":i="Csharp";break;case"go":i="Go";break;case"java":i="Java";break;case"python":i="Python";break;case"ruby":i="Ruby";break;case"typescript":i="TypeScript";break;default:return}if(t==null)return;let n=await e.sdks.versions.computeSemanticVersion({githubRepository:r.outputMode.type==="githubV2"?`${r.outputMode.githubV2.owner}/${r.outputMode.githubV2.repo}`:void 0,language:i,package:t});if(n.ok)return n.body.version}function a2F(e){return Object.fromEntries(Object.values(e).map(t=>[t.id,{type:t.type==="protobuf"?"proto":t.type}]))}async function dWl({projectConfig:e,organization:t,workspace:r,context:i,generatorGroup:n,version:a,shouldLogS3Url:u,token:l,whitelabel:f,absolutePathToPreview:s,mode:o}){if(n.generators.length===0)return i.logger.warn("No generators specified."),null;let c=[],b=[];return c.push(...n.generators.map(O=>i.runInteractiveTask({name:O.name},async m=>{let w=await r.toFernWorkspace({context:i},ydn(O)),A=await $7m({projectConfig:e,organization:t,workspace:w,interactiveTaskContext:m,generatorInvocation:{...O,outputMode:O.outputMode._visit({downloadFiles:()=>O.outputMode,github:M=>ZRu.FernFiddle.OutputMode.github({...M,makePr:o==="pull-request"}),githubV2:M=>o==="pull-request"?ZRu.FernFiddle.OutputMode.githubV2(ZRu.FernFiddle.GithubOutputModeV2.pullRequest(M)):O.outputMode,publish:()=>O.outputMode,publishV2:()=>O.outputMode,_other:()=>O.outputMode})},version:a,audiences:n.audiences,shouldLogS3Url:u,token:l,whitelabel:f,readme:O.readme,irVersionOverride:O.irVersionOverride,absolutePathToPreview:s});A!=null&&A.createdSnippets&&(b.push(O),O.absolutePathToLocalSnippets!=null&&A.snippetsS3PreSignedReadUrl!=null&&await A7m({snippetsS3PreSignedReadUrl:A.snippetsS3PreSignedReadUrl,absolutePathToLocalSnippetJSON:O.absolutePathToLocalSnippets,context:m}))}))),(await Promise.all(c)).some(O=>!O)&&i.failAndThrow(),{snippetsProducedBy:b}}var I2m=require("fs/promises");var TWl=Di(uen(),1);var _Nt=Di(twe(),1);var A2m=Di(E2m(),1);var M2m=require("util");var R6F=(0,M2m.promisify)(A2m.default);async function q2m(e,t,r){let i=rUn(e,t),n=[];for(let a of i){let u=await Promise.all(a.map(async l=>{try{let f=await R6F(l);return f==null||f.height==null||f.width==null?void 0:{filePath:l,width:f.width,height:f.height,blurDataUrl:void 0}}catch(f){r.logger.error(`Failed to measure image size for ${l}. ${f?.message}`);return}}));n.push(...u.filter(dg))}return new Map(n.map(a=>[a.filePath,a]))}var F6F=10,T2m=10;async function z2m({token:e,organization:t,docsWorkspace:r,domain:i,customDomains:n,fernWorkspaces:a,ossWorkspaces:u,context:l,preview:f,editThisPage:s,isPrivate:o=!1}){let c=HPi({token:e.value}),b=o?{type:"private",authType:"sso"}:{type:"public"},g,O=n[0]??i,m=N6F(i),A=await new v6t(i,r,u,a,l,s,async q=>{let D=new Map(q.map(H=>[H.absoluteFilePath,H])),R=q.map(H=>({...H,mediaType:TWl.lookup(H.absoluteFilePath)})).filter(H=>H.mediaType!==!1).filter(H=>aB.parse(H.mediaType)?.isImage()??!1).map(H=>H.absoluteFilePath),$=await q2m(R,F6F,l),I=[];[...$.values()].forEach(H=>{let te=D.get(H.filePath);if(te==null)return;let J={filePath:_Nt.FernRegistry.docs.v1.write.FilePath(R4a(te.relativeFilePath)),width:H.width,height:H.height,blurDataUrl:H.blurDataUrl,alt:void 0};I.push(J)});let U=q.filter(({absoluteFilePath:H})=>!$.has(H)).map(({relativeFilePath:H})=>R4a(H));if(f){let H=await c.docs.v2.write.startDocsPreviewRegister({orgId:_Nt.FernRegistry.OrgId(t),authConfig:o?{type:"private",authType:"sso"}:{type:"public"},filepaths:U.map(te=>_Nt.FernRegistry.docs.v1.write.FilePath(te)),images:I,basePath:m});return H.ok?(O=H.body.previewUrl,g=H.body.docsRegistrationId,await C2m(H.body.uploadUrls,r.absoluteFilePath,l,T2m),B2m(H.body.uploadUrls,r.absoluteFilePath)):await x2m(H.error,l)}else{let H=await c.docs.v2.write.startDocsRegister({domain:i,customDomains:n,authConfig:b,apiId:_Nt.FernRegistry.ApiId(""),orgId:_Nt.FernRegistry.OrgId(t),filepaths:U.map(te=>_Nt.FernRegistry.docs.v1.write.FilePath(te)),images:I});return H.ok?(g=H.body.docsRegistrationId,await C2m(H.body.uploadUrls,r.absoluteFilePath,l,T2m),B2m(H.body.uploadUrls,r.absoluteFilePath)):x2m(H.error,l)}},async({ir:q,snippetsConfig:D,playgroundConfig:C,apiName:R})=>{let $=Xwe({ir:q,snippetsConfig:D,playgroundConfig:C}),I=await c.api.v1.register.registerApiDefinition({orgId:_Nt.FernRegistry.OrgId(t),apiId:_Nt.FernRegistry.ApiId(q.apiName.originalName),definition:$,definitionV2:void 0});if(I.ok)return l.logger.debug(`Registered API Definition ${I.body.apiDefinitionId}`),I.body.apiDefinitionId;switch(I.error.error){case"UnauthorizedError":case"UserNotInOrgError":return l.failAndThrow("You do not have permissions to register the docs. Reach out to support@buildwithfern.com");default:return R!=null?l.failAndThrow(`Failed to publish docs because API definition (${R}) could not be uploaded. Please contact support@buildwithfern.com
|
|
1987
1987
|
${I.error}`):l.failAndThrow(`Failed to publish docs because API definition could not be uploaded. Please contact support@buildwithfern.com
|
|
1988
1988
|
${I.error}`)}},async({api:q,apiName:D})=>{let C=await c.api.v1.register.registerApiDefinition({orgId:_Nt.FernRegistry.OrgId(t),apiId:_Nt.FernRegistry.ApiId(D??q.id),definition:void 0,definitionV2:q});if(C.ok)return l.logger.debug(`Registered API Definition ${C.body.apiDefinitionId}`),C.body.apiDefinitionId;switch(C.error.error){case"UnauthorizedError":case"UserNotInOrgError":return l.failAndThrow("You do not have permissions to register the docs. Reach out to support@buildwithfern.com");default:return D!=null?l.failAndThrow(`Failed to publish docs because API definition (${D}) could not be uploaded. Please contact support@buildwithfern.com
|
|
1989
1989
|
${JSON.stringify(C.error)}`):l.failAndThrow(`Failed to publish docs because API definition could not be uploaded. Please contact support@buildwithfern.com
|