fern-api 0.80.0 → 0.80.1

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.
Files changed (2) hide show
  1. package/cli.cjs +3 -3
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -2159,7 +2159,7 @@ ${fGh.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&sXl(th
2159
2159
  `+mYi.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?mYi.default.cyan(mGh(t,this.opt.mask)):mYi.default.italic(mYi.default.dim("[hidden]")):this.opt.mask?mGh(t,this.opt.mask):mYi.default.italic(mYi.default.dim("[input is hidden] "))}getSpinningValue(t){return this.getMaskedValue(t)}filterInput(t){return t||(this.opt.default==null?"":this.opt.default)}onEnd(t){this.status="answered",this.answer=t.value,this.render(),this.screen.done(),this.done(t.value)}onError(t){this.render(t.isValid)}onKeypress(){this.opt.default&&=void 0,this.render()}};var bfu=aa(rse(),1);var mJh=aa(UXl(),1),yfu=require("child_process"),uQa=require("fs"),hfu=aa(require("path"),1),OJh=aa(require("os"),1),AJh=require("crypto"),EZl=aa(bJh(),1);var dfu=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var r6o=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var pfu=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var _fu=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function vfu(e="",t,r){let n=new SZl(e,r);n.runAsync((i,a)=>{if(i)setImmediate(t,i,void 0);else try{n.cleanup(),setImmediate(t,void 0,a)}catch(o){setImmediate(t,o,void 0)}})}function gJh(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function ahD(e){let t=[],r="";for(let n=0;n<e.length;n++){let i=e.charAt(n);n>0&&i===" "&&e[n-1]!=="\\"&&r.length>0?(t.push(r),r=""):r=`${r}${i}`}return r.length>0&&t.push(r),t}var SZl=class{text="";tempFile;editor;lastExitStatus=0;fileOptions={};get temp_file(){return console.log("DEPRECATED: temp_file. Use tempFile moving forward."),this.tempFile}get last_exit_status(){return console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."),this.lastExitStatus}constructor(t="",r){this.text=t,r&&(this.fileOptions=r),this.determineEditor(),this.createTemporaryFile()}run(){return this.launchEditor(),this.readTemporaryFile(),this.text}runAsync(t){try{this.launchEditorAsync(()=>{try{this.readTemporaryFile(),setImmediate(t,void 0,this.text)}catch(r){setImmediate(t,r,void 0)}})}catch(r){setImmediate(t,r,void 0)}}cleanup(){this.removeTemporaryFile()}determineEditor(){let t=process.env.VISUAL?process.env.VISUAL:process.env.EDITOR?process.env.EDITOR:process.platform.startsWith("win")?"notepad":"vim",r=ahD(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??OJh.default.tmpdir(),r=(0,AJh.randomUUID)(),n=gJh(this.fileOptions.prefix),i=gJh(this.fileOptions.postfix),a=`${n}${r}${i}`,o=hfu.default.resolve(t,a),c=hfu.default.resolve(t)+hfu.default.sep;if(!o.startsWith(c))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=o;let f={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(f.mode=this.fileOptions.mode),(0,uQa.writeFileSync)(this.tempFile,this.text,f)}catch(t){throw new dfu(t)}}readTemporaryFile(){try{let t=(0,uQa.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,mJh.detect)(t)??"utf8";EZl.default.encodingExists(r)||(r="utf8"),this.text=EZl.default.decode(t,r)}}catch(t){throw new pfu(t)}}removeTemporaryFile(){try{(0,uQa.unlinkSync)(this.tempFile)}catch(t){throw new _fu(t)}}launchEditor(){try{let t=(0,yfu.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new r6o(t)}}launchEditorAsync(t){try{(0,yfu.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new r6o(r)}}};var PJh=aa(Ltt(),1);var n6o=class extends nse{_run(t){this.done=t,this.editorResult=new PJh.Subject;let r=Dve(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let n=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,i=this.handleSubmitEvents(this.editorResult);return i.success.forEach(this.onEnd.bind(this)),i.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,n?this.render():this.startExternalEditor(),this}render(t){let r="",n=this.getQuestion();n+=this.status==="answered"?bfu.default.dim("Received"):bfu.default.dim("Press <enter> to launch your preferred editor."),t&&(r=bfu.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),vfu(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 DJh=require("stream");var EJh=aa(require("readline"),1),SJh=aa(jJh(),1),wYi=class{constructor(t){this.rl||=EJh.default.createInterface(shD(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 shD(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let i=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw i.isTtyError=!0,i}let r=new SJh.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var i6o=class extends wYi{constructor(t={}){super(t),this.log=new DJh.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return L2o(this.rl,this.bottomBar.split(`
2160
2160
  `).length),this}updateBottomBar(t){return L2o(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+`
2161
2161
  `}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&&Qlu(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var d6=aa(Ltt(),1),MJh=aa(u2o(),1);var gfu=aa(Ltt(),1),CJh=aa(u2o(),1),mfu=function(e,t,r){return typeof e[t]!="function"?(0,gfu.of)(e):(0,gfu.from)((0,CJh.default)(e[t])(r).then(n=>(e[t]=n,e)))};var IJh={set:(e,t="",r)=>{let n=e;t.split(".").forEach((i,a,o)=>{i==="__proto__"||i==="constructor"||(a===o.length-1?n[i]=r:(!(i in n)||typeof n[i]!="object")&&(n[i]={}),n=n[i])})},get:(e,t="",r)=>{let n=a=>String.prototype.split.call(t,a).filter(Boolean).reduce((o,c)=>o!=null?o[c]:o,e),i=n(/[,[\]]+?/)||n(/[,.[\]]+?/);return i===void 0||i===e?r:i}},cQa=class extends wYi{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let n;return Array.isArray(t)?n=(0,d6.from)(t):(0,d6.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,d6.from)(Object.entries(t).map(([i,a])=>({name:i,...a}))):n=(0,d6.from)([t]),this.process=n.pipe((0,d6.concatMap)(this.processQuestion.bind(this)),(0,d6.publish)()),this.process.connect(),this.process.pipe((0,d6.reduce)((i,a)=>(IJh.set(i,a.name,a.answer),i),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,d6.defer)(()=>(0,d6.of)(t).pipe((0,d6.concatMap)(this.setDefaultType.bind(this)),(0,d6.concatMap)(this.filterIfRunnable.bind(this)),(0,d6.concatMap)(()=>mfu(t,"message",this.answers)),(0,d6.concatMap)(()=>mfu(t,"default",this.answers)),(0,d6.concatMap)(()=>mfu(t,"choices",this.answers)),(0,d6.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,d6.defer)(()=>(0,d6.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,d6.defer)(()=>(0,d6.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&IJh.get(this.answers,t.name)!==void 0)return d6.EMPTY;if(t.when===!1)return d6.EMPTY;if(typeof t.when!="function")return(0,d6.of)(t);let{answers:r}=this;return(0,d6.defer)(()=>(0,d6.from)((0,MJh.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,d6.filter)(n=>n!=null)))}};function BJh(e){let t=function(r,n){let i;try{i=new cQa(t.prompts,e)}catch(o){return Promise.reject(o)}let a=i.run(r,n);return a.ui=i,a};return t.prompts={},t.registerPrompt=function(r,n){return t.prompts[r]=n,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",V2o),this.registerPrompt("input",gYi),this.registerPrompt("number",W2o),this.registerPrompt("confirm",H2o),this.registerPrompt("rawlist",G2o),this.registerPrompt("expand",J2o),this.registerPrompt("checkbox",K2o),this.registerPrompt("password",$2o),this.registerPrompt("editor",n6o)},t.restoreDefaultPrompts(),t}var CZl=BJh();function chD(e,t){CZl.registerPrompt(e,t)}function lhD(){CZl.restoreDefaultPrompts()}var fhD={prompt:CZl,ui:{BottomBar:i6o,Prompt:cQa},createPromptModule:BJh,registerPrompt:chD,restoreDefaultPrompts:lhD,Separator:oxe},Ofu=fhD;var AQa=require("path"),b$h=require("fs"),g$h=require("readline"),VKh="posthog-node";function ZvD(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"]}={}){return a=>{if(!(i==="*"||i.includes(a.level)))return a;a.tags||(a.tags={});let c=a.tags[Wfu.POSTHOG_ID_TAG];if(c===void 0)return a;let f=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${c}`,f).toString();a.tags["PostHog Person URL"]=u;let s=a.exception?.values||[],l=s.map(A=>({...A,stacktrace:A.stacktrace?{...A.stacktrace,type:"raw",frames:(A.stacktrace.frames||[]).map(P=>({...P,platform:"node:javascript"}))}:void 0})),m={$exception_message:s[0]?.value||a.message,$exception_type:s[0]?.type,$exception_personURL:u,$exception_level:a.level,$exception_list:l,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:s[0]?.value||a.message,$sentry_exception_type:s[0]?.type,$sentry_tags:a.tags};return t&&r&&(m.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),e.capture({event:"$exception",distinctId:c,properties:m}),a}}var Wfu=class{constructor(t,r,n,i){this.name=VKh,this.name=VKh,this.setupOnce=function(a,o){let c=o()?.getClient()?.getDsn()?.projectId;a(ZvD(t,{organization:r,projectId:c,prefix:n,severityAllowList:i}))}}};Wfu.POSTHOG_ID_TAG="posthog_distinct_id";var zfu="0123456789abcdef",Hfu=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,n,i){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||t<0||r<0||n<0||i<0||t>0xffffffffffff||r>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");let 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|n>>>24,a[9]=n>>>16,a[10]=n>>>8,a[11]=n,a[12]=i>>>24,a[13]=i>>>16,a[14]=i>>>8,a[15]=i,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 n=new Uint8Array(16);for(let i=0;i<16;i+=4){let a=parseInt(r.substring(2*i,2*i+8),16);n[i+0]=a>>>24,n[i+1]=a>>>16,n[i+2]=a>>>8,n[i+3]=a}return new e(n)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=zfu.charAt(this.bytes[r]>>>4),t+=zfu.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+=zfu.charAt(this.bytes[r]>>>4),t+=zfu.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 n=this.bytes[r]-t.bytes[r];if(n!==0)return Math.sign(n)}return 0}},vkl=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??kvD()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let n=this.generateOrAbortCore(t,r);return n===void 0&&(this.timestamp=0,n=this.generateOrAbortCore(t,r)),n}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return Hfu.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,Hfu.ofInner(t)}},kvD=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),WKh,bkl=()=>ebD().toString(),ebD=()=>(WKh||(WKh=new vkl)).generate();function tbD(e,t){let r=!1;return Object.assign(n=>{let a=global.process.listeners("uncaughtException").filter(o=>o.name!=="domainUncaughtExceptionClear"&&o._posthogErrorHandler!==!0).length===0;e(n,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t())},{_posthogErrorHandler:!0})}function rbD(e,t){global.process.on("uncaughtException",tbD(e,t))}function nbD(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var Qfu,HKh,Lfu;function ibD(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return Lfu&&r.length===HKh||(HKh=r.length,Lfu=r.reduce((n,i)=>{Qfu||(Qfu={});let a=Qfu[i];if(a)n[a[0]]=a[1];else{let o=e(i);for(let c=o.length-1;c>=0;c--){let u=o[c]?.filename,s=t[i];if(u&&s){n[u]=s,Qfu[i]=[u,s];break}}}return n},{})),Lfu}function abD(e){return typeof Event<"u"&&m$h(e,Event)}function obD(e){return O$h(e,"Object")}function Ekl(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return m$h(e,Error)}}function m$h(e,t){try{return e instanceof t}catch{return!1}}function sbD(e){return O$h(e,"ErrorEvent")}function O$h(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function ubD(e,t,r,n){let a=n&&n.mechanism||{handled:!0,type:"generic"},o=A$h(a,r,n);return{$exception_list:await Promise.all(o.map(async u=>{let s=await hbD(e,t,u);return s.value=s.value||"",s.type=s.type||"Error",s.mechanism=a,s}))}}function A$h(e,t,r){let n=cbD(e,t,r);return n.cause?[n,...A$h(e,n.cause,r)]:[n]}function cbD(e,t,r){if(Ekl(t))return t;if(e.synthetic=!0,obD(t)){let i=lbD(t);if(i)return i;let a=fbD(t),o=r?.syntheticException||new Error(a);return o.message=a,o}let n=r?.syntheticException||new Error(t);return n.message=`${t}`,n}function lbD(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(Ekl(r))return r}}function fbD(e){if("name"in e&&typeof e.name=="string"){let n=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(n+=` with message '${e.message}'`),n}else if("message"in e&&typeof e.message=="string")return e.message;let t=pbD(e);if(sbD(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=dbD(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function dbD(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function pbD(e,t=40){let r=Object.keys(_bD(e));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=t)return GKh(n,t);for(let i=r.length;i>0;i--){let a=r.slice(0,i).join(", ");if(!(a.length>t))return i===r.length?a:GKh(a,t)}return""}function GKh(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function _bD(e){return Ekl(e)?{message:e.message,name:e.name,stack:e.stack,...JKh(e)}:abD(e)?{type:e.type,target:KKh(e.target),currentTarget:KKh(e.currentTarget),...JKh(e)}:e}function JKh(e){if(typeof e=="object"&&e!==null){let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}else return{}}function KKh(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function hbD(e,t,r){let n={type:r.name||r.constructor.name,value:r.message},i=ybD(e,r);for(let a of t)i=await a(i);return i.length&&(n.stacktrace={frames:i,type:"raw"}),n}function ybD(e,t){return vbD(e(t.stack||"",1),e)}function vbD(e,t){let r=ibD(t);return e.forEach(n=>{n.filename&&(n.chunk_id=r[n.filename])}),e}var bbD=2e3,gQa=class e{static async captureException(t,r,n,i,a){let o={...a};i||(o.$process_person_profile=!1);let c=await ubD(this.stackParser,this.frameModifiers,r,n);t.capture({event:"$exception",distinctId:i||bkl(),properties:{...c,...o}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(rbD(this.onException.bind(this),this.onFatalError.bind(this)),nbD(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(bbD)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function gbD(e=process.argv[1]?(0,AQa.dirname)(process.argv[1]):process.cwd(),t=AQa.sep==="\\"){let r=t?$Kh(e):e;return n=>{if(!n)return;let i=t?$Kh(n):n,{dir:a,base:o,ext:c}=AQa.posix.parse(i);(c===".js"||c===".mjs"||c===".cjs")&&(o=o.slice(0,c.length*-1));let f=decodeURIComponent(o);a||(a=".");let u=a.lastIndexOf("/node_modules");if(u>-1)return`${a.slice(u+14).replace(/\//g,".")}:${f}`;if(a.startsWith(r)){let s=a.slice(r.length+1).replace(/\//g,".");return s?`${s}:${f}`:f}return f}}function $Kh(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var Gfu=class{constructor(t){this._maxSize=t,this._cache=new Map}get(t){let r=this._cache.get(t);if(r!==void 0)return this._cache.delete(t),this._cache.set(t,r),r}set(t,r){this._cache.set(t,r)}reduce(){for(;this._cache.size>=this._maxSize;){let t=this._cache.keys().next().value;t&&this._cache.delete(t)}}},Vfu=new Gfu(25),P$h=new Gfu(20),Skl=7,mbD=1e3,ObD=1e4;async function AbD(e){let t={};for(let i=e.length-1;i>=0;i--){let a=e[i],o=a?.filename;if(!a||typeof o!="string"||typeof a.lineno!="number"||EbD(o)||SbD(a))continue;t[o]||(t[o]=[]),t[o].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let n=[];for(let i of r){if(P$h.get(i))continue;let a=t[i];if(!a)continue;a.sort((f,u)=>f-u);let o=CbD(a);if(o.every(f=>DbD(i,f)))continue;let c=IbD(Vfu,i,{});n.push(PbD(i,o,c))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&wbD(e,Vfu),Vfu.reduce(),e}function PbD(e,t,r){return new Promise(n=>{let i=(0,b$h.createReadStream)(e),a=(0,g$h.createInterface)({input:i});function o(){i.destroy(),n()}let c=0,f=0,u=t[f];if(u===void 0){o();return}let s=u[0],l=u[1];function m(){P$h.set(e,1),a.close(),a.removeAllListeners(),o()}i.on("error",m),a.on("error",m),a.on("close",o),a.on("line",A=>{if(c++,!(c<s)&&(r[c]=MbD(A,0),c>=l)){if(f===t.length-1){a.close(),a.removeAllListeners();return}f++;let P=t[f];if(P===void 0){a.close(),a.removeAllListeners();return}s=P[0],l=P[1]}})})}function wbD(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let n=t.get(r.filename);if(n===void 0)continue;jbD(r.lineno,r,n)}}function jbD(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=w$h(e);i<e;i++){let a=r[i];if(a===void 0){YKh(t);return}t.pre_context.push(a)}if(r[e]===void 0){YKh(t);return}t.context_line=r[e];let n=j$h(e);t.post_context=[];for(let i=e+1;i<=n;i++){let a=r[i];if(a===void 0)break;t.post_context.push(a)}}function YKh(e){delete e.pre_context,delete e.context_line,delete e.post_context}function EbD(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function SbD(e){return e.lineno!==void 0&&e.lineno>ObD||e.colno!==void 0&&e.colno>mbD}function DbD(e,t){let r=Vfu.get(e);if(r===void 0)return!1;for(let n=t[0];n<=t[1];n++)if(r[n]===void 0)return!1;return!0}function CbD(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=XKh(r),i=[];for(;;){if(t===e.length-1){i.push(n);break}let a=e[t+1];if(typeof a!="number")break;a<=n[1]?n[1]=a+Skl:(i.push(n),n=XKh(a)),t++}return i}function XKh(e){return[w$h(e),j$h(e)]}function w$h(e){return Math.max(1,e-Skl)}function j$h(e){return e+Skl}function IbD(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function MbD(e,t){let r=e,n=r.length;if(n<=150)return r;t>n&&(t=n);let i=Math.max(t-60,0);i<5&&(i=0);let a=Math.min(i+140,n);return a>n-5&&(a=n),a===n&&(i=Math.max(a-140,0)),r=r.slice(i,a),i>0&&(r=`...${r}`),a<n&&(r+="..."),r}var BbD="4.18.0",fxe;(function(e){e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.DecideEndpointWasHit="decide_endpoint_was_hit",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config"})(fxe||(fxe={}));var ZKh;(function(e){e.Left="left",e.Right="right",e.Center="center"})(ZKh||(ZKh={}));var kKh;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(kKh||(kKh={}));var e$h;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(e$h||(e$h={}));var t$h;(function(e){e.Html="html",e.Text="text"})(t$h||(t$h={}));var r$h;(function(e){e.Number="number",e.Emoji="emoji"})(r$h||(r$h={}));var n$h;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(n$h||(n$h={}));var i$h;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(i$h||(i$h={}));var a$h;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(a$h||(a$h={}));var o$h;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(o$h||(o$h={}));var TbD=e=>{if("flags"in e){let t=RbD(e.flags),r=NbD(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,a])=>[i,E$h(a)])),n=Object.fromEntries(Object.entries(t).map(([i,a])=>[i,qbD(i,a,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function qbD(e,t,r){return{key:e,enabled:typeof t=="string"?!0:t,variant:typeof t=="string"?t:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:r?JSON.stringify(r):void 0,description:void 0}}}var RbD=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,Dkl(r)]).filter(([,t])=>t!==void 0)),NbD=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let n=t[r];return n.enabled&&n.metadata&&n.metadata.payload!==void 0}).map(r=>{let n=t[r].metadata?.payload;return[r,n?E$h(n):void 0]}))},Dkl=e=>e===void 0?void 0:e.variant??e.enabled,E$h=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},xbD=1,FbD=new Set(["61be3dd8","96f6df5f","8cfdba9b","bf027177","e59430a8","7fa5500b","569798e9","04809ff7","0ebc61a5","32de7f98","3beeb69a","12d34ad9","733853ec","0645bb64","5dcbee21","b1f95fa3","2189e408","82b460c2","3a8cc979","29ef8843","2cdbf767","38084b54","50f9f8de","41d0df91","5c236689","c11aedd3","ada46672","f4331ee1","42fed62a","c957462c","d62f705a","e0162666","01b3e5cf","441cef7f","bb9cafee","8f348eb0","b2553f3a","97469d7d","39f21a76","03706dcc","27d50569","307584a7","6433e92e","150c7fbb","49f57f22","3772f65b","01eb8256","3c9e9234","f853c7f7","c0ac4b67","cd609d40","10ca9b1a","8a87f11b","8e8e5216","1f6b63b3","db7943dd","79b7164c","07f78e33","2d21b6fd","952db5ee","a7d3b43f","1924dd9c","84e1b8f6","dff631b6","c5aa8a79","fa133a95","498a4508","24748755","98f3d658","21bbda67","7dbfed69","be3ec24c","fc80b8e2","75cc0998"]),zbD="utf8";function QbD(e,t){if(!e||typeof e!="string"||LbD(e))throw new Error(t)}function LbD(e){return e.trim().length===0}function UbD(e){return e?.replace(/\/+$/,"")}async function VbD(e,t){let r=null;for(let n=0;n<t.retryCount+1;n++){n>0&&await new Promise(i=>setTimeout(i,t.retryDelay));try{return await e()}catch(i){if(r=i,!t.retryCheck(i))throw i}}throw r}function s$h(){return new Date().getTime()}function hkl(){return new Date().toISOString()}function Jfu(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function WbD(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function HbD(e){let t=2166136261;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t+=(t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24);return(t>>>0).toString(16).padStart(8,"0")}function GbD(e,t=0,r){let n=HbD(e);return r?.has(n)?!1:parseInt(n,16)/4294967295<t}function u$h(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var _6o=String.fromCharCode,c$h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Ufu={};function JbD(e,t){if(!Ufu[e]){Ufu[e]={};for(let r=0;r<e.length;r++)Ufu[e][e.charAt(r)]=r}return Ufu[e][t]}var vQa={compressToBase64:function(e){if(e==null)return"";let t=vQa._compress(e,6,function(r){return c$h.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:vQa._decompress(e.length,32,function(t){return JbD(c$h,e.charAt(t))})},compress:function(e){return vQa._compress(e,16,function(t){return _6o(t)})},_compress:function(e,t,r){if(e==null)return"";let n={},i={},a=[],o,c,f="",u="",s="",l=2,m=3,A=2,P=0,C=0,M;for(M=0;M<e.length;M+=1)if(f=e.charAt(M),Object.prototype.hasOwnProperty.call(n,f)||(n[f]=m++,i[f]=!0),u=s+f,Object.prototype.hasOwnProperty.call(n,u))s=u;else{if(Object.prototype.hasOwnProperty.call(i,s)){if(s.charCodeAt(0)<256){for(o=0;o<A;o++)P=P<<1,C==t-1?(C=0,a.push(r(P)),P=0):C++;for(c=s.charCodeAt(0),o=0;o<8;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}else{for(c=1,o=0;o<A;o++)P=P<<1|c,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=0;for(c=s.charCodeAt(0),o=0;o<16;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,A),A++),delete i[s]}else for(c=n[s],o=0;o<A;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;l--,l==0&&(l=Math.pow(2,A),A++),n[u]=m++,s=String(f)}if(s!==""){if(Object.prototype.hasOwnProperty.call(i,s)){if(s.charCodeAt(0)<256){for(o=0;o<A;o++)P=P<<1,C==t-1?(C=0,a.push(r(P)),P=0):C++;for(c=s.charCodeAt(0),o=0;o<8;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}else{for(c=1,o=0;o<A;o++)P=P<<1|c,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=0;for(c=s.charCodeAt(0),o=0;o<16;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1}l--,l==0&&(l=Math.pow(2,A),A++),delete i[s]}else for(c=n[s],o=0;o<A;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;l--,l==0&&(l=Math.pow(2,A),A++)}for(c=2,o=0;o<A;o++)P=P<<1|c&1,C==t-1?(C=0,a.push(r(P)),P=0):C++,c=c>>1;for(;;)if(P=P<<1,C==t-1){a.push(r(P));break}else C++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:vQa._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let n=[],i=[],a={val:r(0),position:t,index:1},o=4,c=4,f=3,u="",s,l,m,A,P,C,M;for(s=0;s<3;s+=1)n[s]=s;for(m=0,P=Math.pow(2,2),C=1;C!=P;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(A>0?1:0)*C,C<<=1;switch(m){case 0:for(m=0,P=Math.pow(2,8),C=1;C!=P;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(A>0?1:0)*C,C<<=1;M=_6o(m);break;case 1:for(m=0,P=Math.pow(2,16),C=1;C!=P;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(A>0?1:0)*C,C<<=1;M=_6o(m);break;case 2:return""}for(n[3]=M,l=M,i.push(M);;){if(a.index>e)return"";for(m=0,P=Math.pow(2,f),C=1;C!=P;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(A>0?1:0)*C,C<<=1;switch(M=m){case 0:for(m=0,P=Math.pow(2,8),C=1;C!=P;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(A>0?1:0)*C,C<<=1;n[c++]=_6o(m),M=c-1,o--;break;case 1:for(m=0,P=Math.pow(2,16),C=1;C!=P;)A=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),m|=(A>0?1:0)*C,C<<=1;n[c++]=_6o(m),M=c-1,o--;break;case 2:return i.join("")}if(o==0&&(o=Math.pow(2,f),f++),n[M])u=n[M];else if(M===c)u=l+l.charAt(0);else return null;i.push(u),n[c++]=l+u.charAt(0),o--,l=u,o==0&&(o=Math.pow(2,f),f++)}}},gkl=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(n=>n!==r)}}emit(t,r){for(let n of this.events[t]||[])n(r);for(let n of this.events["*"]||[])n(t,r)}},mQa=class extends Error{constructor(t,r){super("HTTP error while fetching PostHog: status="+t.status+", reqByteLength="+r),this.response=t,this.reqByteLength=r,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}},h6o=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function l$h(e){if(e instanceof mQa){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function ykl(e){return typeof e=="object"&&(e instanceof mQa||e instanceof h6o)}function f$h(e){return typeof e=="object"&&e instanceof mQa&&e.status===413}var mkl;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(mkl||(mkl={}));var Okl=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new gkl,this._isInitialized=!1,QbD(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=UbD(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.preloadFeatureFlags=r?.preloadFeatureFlags??!0,this.defaultOptIn=r?.defaultOptIn??!0,this.disableSurveys=r?.disableSurveys??!1,this._retryOptions={retryCount:r?.fetchRetryCount??3,retryDelay:r?.fetchRetryDelay??3e3,retryCheck:ykl},this.requestTimeout=r?.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=r?.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=r?.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=r?.disableGeoip??!0,this.disabled=r?.disabled??!1,this.historicalMigration=r?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0}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(fxe.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(fxe.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(fxe.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(n,i)=>console.log("PostHog Debug",n,i));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(t){return{distinct_id:t.distinct_id,event:t.event,properties:{...t.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(t){let r=bkl();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,n){this.wrap(()=>{let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",i,n)})}async identifyStatelessImmediate(t,r,n){let i={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",i,n)}captureStateless(t,r,n,i){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:n});this.enqueue("capture",a,i)})}async captureStatelessImmediate(t,r,n,i){let a=this.buildPayload({distinct_id:t,event:r,properties:n});await this.sendImmediate("capture",a,i)}aliasStateless(t,r,n,i){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});this.enqueue("alias",a,i)})}async aliasStatelessImmediate(t,r,n,i){let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...n||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",a,i)}groupIdentifyStateless(t,r,n,i,a,o){this.wrap(()=>{let c=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:n||{},...o||{}}});this.enqueue("capture",c,i)})}async getRemoteConfig(){await this._initPromise;let t=this.host;t==="https://us.i.posthog.com"?t="https://us-assets.i.posthog.com":t==="https://eu.i.posthog.com"&&(t="https://eu-assets.i.posthog.com");let r=`${t}/array/${this.apiKey}/config`,n={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,n,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(i=>i.json()).catch(i=>{this.logMsgIfDebug(()=>console.error("Remote config could not be loaded",i)),this._events.emit("error",i)})}async getDecide(t,r={},n={},i={},a={}){await this._initPromise;let c=GbD(this.apiKey,xbD,FbD)?`${this.host}/flags/?v=2`:`${this.host}/decide/?v=4`,f={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify({token:this.apiKey,distinct_id:t,groups:r,person_properties:n,group_properties:i,...a})};return this.logMsgIfDebug(()=>console.log("PostHog Debug","Decide URL",c)),this.fetchWithRetry(c,f,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(u=>u.json()).then(u=>TbD(u)).catch(u=>{this._events.emit("error",u)})}async getFeatureFlagStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailStateless(t,r,n,i,a,o);if(c===void 0)return{response:void 0,requestId:void 0};let f=Dkl(c.response);return f===void 0&&(f=!1),{response:f,requestId:c.requestId}}async getFeatureFlagDetailStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(r,n,i,a,o,[t]);return c===void 0?void 0:{response:c.flags[t],requestId:c.requestId}}async getFeatureFlagPayloadStateless(t,r,n={},i={},a={},o){await this._initPromise;let c=await this.getFeatureFlagPayloadsStateless(r,n,i,a,o,[t]);if(!c)return;let f=c[t];return f===void 0?null:f}async getFeatureFlagPayloadsStateless(t,r={},n={},i={},a,o){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,o)).payloads}async getFeatureFlagsStateless(t,r={},n={},i={},a,o){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,n,i,a,o)}async getFeatureFlagsAndPayloadsStateless(t,r={},n={},i={},a,o){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(t,r,n,i,a,o);return c?{flags:c.featureFlags,payloads:c.featureFlagPayloads,requestId:c.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},n={},i={},a,o){await this._initPromise;let c={};(a??this.disableGeoip)&&(c.geoip_disable=!0),o&&(c.flag_keys_to_evaluate=o);let f=await this.getDecide(t,r,n,i,c);if(f!==void 0)return f.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),f.quotaLimited?.includes(mkl.FeatureFlags)?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:f?.requestId}):f}async getSurveysStateless(){if(await this._initPromise,this.disableSurveys===!0)return this.logMsgIfDebug(()=>console.log("PostHog Debug","Loading surveys is disabled.")),[];let t=`${this.host}/api/surveys/?token=${this.apiKey}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},i=(await this.fetchWithRetry(t,r).then(a=>{if(a.status!==200||!a.json){let o=`Surveys API could not be loaded: ${a.status}`,c=new Error(o);this.logMsgIfDebug(()=>console.error(c)),this._events.emit("error",new Error(o));return}return a.json()}).catch(a=>{this.logMsgIfDebug(()=>console.error("Surveys API could not be loaded",a)),this._events.emit("error",a)}))?.surveys;return i&&this.logMsgIfDebug(()=>console.log("PostHog Debug","Surveys fetched from API: ",JSON.stringify(i))),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(fxe.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(fxe.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(fxe.Props,this.props)})}enqueue(t,r,n){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let i=this.prepareMessage(t,r,n),a=this.getPersistedProperty(fxe.Queue)||[];a.length>=this.maxQueueSize&&(a.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),a.push({message:i}),this.setPersistedProperty(fxe.Queue,a),this._events.emit(t,i),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=Jfu(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,n){if(this.disabled){this.logMsgIfDebug(()=>console.warn("[PostHog] The client is disabled"));return}if(this._isInitialized||await this._initPromise,this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let i={api_key:this.apiKey,batch:[this.prepareMessage(t,r,n)],sent_at:hkl()};this.historicalMigration&&(i.historical_migration=!0);let a=JSON.stringify(i),o=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${s$h()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,c=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(vQa.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(o,c)}catch(f){this._events.emit("error",f)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:hkl(),uuid:n?.uuid?n.uuid:bkl()};return(n?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await l$h(t)})}async flush(){let t=u$h([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),u$h([t]).then(()=>{this.flushPromise===t&&(this.flushPromise=null)}),t}getCustomHeaders(){let t=this.getCustomUserAgent(),r={};return t&&t!==""&&(r["User-Agent"]=t),r}async _flush(){this.clearFlushTimer(),await this._initPromise;let t=this.getPersistedProperty(fxe.Queue)||[];if(!t.length)return;let r=[],n=t.length;for(;t.length>0&&r.length<n;){let i=t.slice(0,this.maxBatchSize),a=i.map(m=>m.message),o=()=>{let A=(this.getPersistedProperty(fxe.Queue)||[]).slice(i.length);this.setPersistedProperty(fxe.Queue,A),t=A},c={api_key:this.apiKey,batch:a,sent_at:hkl()};this.historicalMigration&&(c.historical_migration=!0);let f=JSON.stringify(c),u=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${s$h()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,s=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(vQa.compressToBase64(f))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:f},l={retryCheck:m=>f$h(m)?!1:ykl(m)};try{await this.fetchWithRetry(u,s,l)}catch(m){if(f$h(m)&&a.length>1){this.maxBatchSize=Math.max(1,Math.floor(a.length/2)),this.logMsgIfDebug(()=>console.warn(`Received 413 when sending batch of size ${a.length}, reducing batch size to ${this.maxBatchSize}`));continue}throw m instanceof h6o||o(),this._events.emit("error",m),m}o(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,n,i){var a;(a=AbortSignal).timeout??(a.timeout=function(u){let s=new AbortController;return setTimeout(()=>s.abort(),u),s.signal});let o=r.body?r.body:"",c=-1;try{c=Buffer.byteLength(o,zbD)}catch{c=new TextEncoder().encode(o).length}return await VbD(async()=>{let f=null;try{f=await this.fetch(t,{signal:AbortSignal.timeout(i??this.requestTimeout),...r})}catch(s){throw new h6o(s)}if(!(r.mode==="no-cors")&&(f.status<200||f.status>=400))throw new mQa(f,c);return f},{...this._retryOptions,...n})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let n=async()=>{try{for(await Promise.all(Object.values(this.pendingPromises));!((this.getPersistedProperty(fxe.Queue)||[]).length===0||(await this.flush(),r)););}catch(i){if(!ykl(i))throw i;await l$h(i)}};return Promise.race([new Promise((i,a)=>{Jfu(()=>{this.logMsgIfDebug(()=>console.error("Timed out while shutting down PostHog")),r=!0,a("Timeout while shutting down PostHog. Some events may not have been sent.")},t)}),n()])}async shutdown(t=3e4){return this.shutdownPromise?this.logMsgIfDebug(()=>console.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup")):this.shutdownPromise=this._shutdown(t).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}},Akl=WbD();if(!Akl){let e=UKh();Akl=async(t,r)=>{let n=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:n.status,text:async()=>n.data,json:async()=>n.data}}}var S$h=Akl,Kfu=class{constructor(t){this.factory=t}async getValue(){return this.value!==void 0?this.value:(this.initializationPromise===void 0&&(this.initializationPromise=(async()=>{try{let t=await this.factory();return this.value=t,t}finally{this.initializationPromise=void 0}})()),this.initializationPromise)}isInitialized(){return this.value!==void 0}async waitForInitialization(){this.isInitialized()||await this.getValue()}},D$h=new Kfu(async()=>{try{return await import("crypto")}catch{return}});async function KbD(){return await D$h.getValue()}var $bD=new Kfu(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await D$h.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function YbD(){return await $bD.getValue()}async function XbD(e){let t=await KbD();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await YbD();if(r){let n=await r.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(n)).map(a=>a.toString(16).padStart(2,"0")).join("")}throw new Error("No crypto implementation available. Tried Node Crypto API and Web SubtleCrypto API")}var ZbD=60*1e3,kbD=1152921504606847e3,egD=["is_not"],bQa=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},ise=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},Pkl=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:n,timeout:i,host:a,customHeaders:o,...c}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=t,this.personalApiKey=r,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=n,this.host=a,this.poller=void 0,this.fetch=c.fetch||S$h,this.onError=c.onError,this.customHeaders=o,this.onLoad=c.onLoad,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,n={},i={},a={}){await this.loadFeatureFlags();let o,c;if(!this.loadedSuccessfullyOnce)return o;for(let f of this.featureFlags)if(t===f.key){c=f;break}if(c!==void 0)try{o=await this.computeFlagLocally(c,r,n,i,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${o}`))}catch(f){f instanceof ise?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 o}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let n;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(n=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),n==null)return null;try{return JSON.parse(n)}catch{return n}}}async getAllFlagsAndPayloads(t,r={},n={},i={}){await this.loadFeatureFlags();let a={},o={},c=this.featureFlags.length==0;return await Promise.all(this.featureFlags.map(async f=>{try{let u=await this.computeFlagLocally(f,t,r,n,i);a[f.key]=u;let s=await this.computeFeatureFlagPayloadLocally(f.key,u);s&&(o[f.key]=s)}catch(u){u instanceof ise||u instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${f.key}: ${u}`)),c=!0}})),{response:a,payloads:o,fallbackToDecide:c}}async computeFlagLocally(t,r,n={},i={},a={}){if(t.ensure_experience_continuity)throw new ise("Flag has experience continuity enabled");if(!t.active)return!1;let c=(t.filters||{}).aggregation_group_type_index;if(c!=null){let f=this.groupTypeMapping[String(c)];if(!f)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${c} for feature flag ${t.key}`)),new ise("Flag has unknown group type index");if(!(f in n))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let u=a[f];return await this.matchFeatureFlagProperties(t,n[f],u)}else return await this.matchFeatureFlagProperties(t,r,i)}async matchFeatureFlagProperties(t,r,n){let i=t.filters||{},a=i.groups||[],o=!1,c,f=[...a].sort((u,s)=>{let l=!!u.variant,m=!!s.variant;return l&&m?0:l?-1:m?1:0});for(let u of f)try{if(await this.isConditionMatch(t,r,u,n)){let s=u.variant,l=i.multivariate?.variants||[];s&&l.some(m=>m.key===s)?c=s:c=await this.getMatchingVariant(t,r)||!0;break}}catch(s){if(s instanceof ise)o=!0;else throw s}if(c!==void 0)return c;if(o)throw new ise("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,n,i){let a=n.rollout_percentage,o=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((n.properties||[]).length>0){for(let c of n.properties){let f=c.type,u=!1;if(f==="cohort"?u=I$h(c,i,this.cohorts,this.debugMode):u=C$h(c,i,o),!u)return!1}if(a==null)return!0}return!(a!=null&&await d$h(t.key,r)>a/100)}async getMatchingVariant(t,r){let n=await d$h(t.key,r,"variant"),i=this.variantLookupTable(t).find(a=>n>=a.valueMin&&n<a.valueMax);if(i)return i.key}variantLookupTable(t){let r=[],n=0,i=0;return((t.filters||{}).multivariate?.variants||[]).forEach(c=>{i=n+c.rollout_percentage/100,r.push({valueMin:n,valueMax:i,key:c.key}),n=i}),r}async loadFeatureFlags(t=!1){(!this.loadedSuccessfullyOnce||t)&&await this._loadFeatureFlags()}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(ZbD,this.pollingInterval*2**this.backOffCount):this.pollingInterval}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this._loadFeatureFlags(),this.getPollingInterval());try{let t=await this._requestFeatureFlagDefinitions();if(!t)return;switch(t.status){case 401:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new bQa(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new bQa(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,new bQa(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let r=await t.json()??{};if(!("flags"in r)){this.onError?.(new Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`));return}this.featureFlags=r.flags??[],this.featureFlagsByKey=this.featureFlags.reduce((n,i)=>(n[i.key]=i,n),{}),this.groupTypeMapping=r.group_type_mapping||{},this.cohorts=r.cohorts||{},this.loadedSuccessfullyOnce=!0,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.onLoad?.(this.featureFlags.length);break}default:return}}catch(t){t instanceof bQa&&this.onError?.(t)}}getPersonalApiKeyRequestOptions(t="GET"){return{method:t,headers:{...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`}}}async _requestFeatureFlagDefinitions(){let t=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,r=this.getPersonalApiKeyRequestOptions(),n=null;if(this.timeout&&typeof this.timeout=="number"){let i=new AbortController;n=Jfu(()=>{i.abort()},this.timeout),r.signal=i.signal}try{return await this.fetch(t,r)}finally{clearTimeout(n)}}stopPoller(){clearTimeout(this.poller)}_requestRemoteConfigPayload(t){let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config/`,n=this.getPersonalApiKeyRequestOptions(),i=null;if(this.timeout&&typeof this.timeout=="number"){let a=new AbortController;i=Jfu(()=>{a.abort()},this.timeout),n.signal=a.signal}try{return this.fetch(r,n)}finally{clearTimeout(i)}}};async function d$h(e,t,r=""){let n=await XbD(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/kbD}function C$h(e,t,r){let n=e.key,i=e.value,a=e.operator||"exact";if(n in t){if(a==="is_not_set")throw new ise("Operator is_not_set is not supported")}else throw new ise(`Property ${n} not found in propertyValues`);let o=t[n];if(o==null&&!egD.includes(a))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${a} operator`),!1;function c(u,s){return Array.isArray(u)?u.map(l=>String(l).toLowerCase()).includes(String(s).toLowerCase()):String(u).toLowerCase()===String(s).toLowerCase()}function f(u,s,l){if(l==="gt")return u>s;if(l==="gte")return u>=s;if(l==="lt")return u<s;if(l==="lte")return u<=s;throw new Error(`Invalid operator: ${l}`)}switch(a){case"exact":return c(i,o);case"is_not":return!c(i,o);case"is_set":return n in t;case"icontains":return String(o).toLowerCase().includes(String(i).toLowerCase());case"not_icontains":return!String(o).toLowerCase().includes(String(i).toLowerCase());case"regex":return p$h(String(i))&&String(o).match(String(i))!==null;case"not_regex":return p$h(String(i))&&String(o).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let u=typeof i=="number"?i:null;if(typeof i=="string")try{u=parseFloat(i)}catch{}return u!=null&&o!=null?typeof o=="string"?f(o,String(i),a):f(o,u,a):f(String(o),String(i),a)}case"is_date_after":case"is_date_before":{let u=tgD(String(i));if(u==null&&(u=_$h(i)),u==null)throw new ise(`Invalid date: ${i}`);let s=_$h(o);return["is_date_before"].includes(a)?s<u:s>u}default:throw new ise(`Unknown operator: ${a}`)}}function I$h(e,t,r,n=!1){let i=String(e.value);if(!(i in r))throw new ise("can't match cohort without a given cohort property value");let a=r[i];return M$h(a,t,r,n)}function M$h(e,t,r,n=!1){if(!e)return!0;let i=e.type,a=e.values;if(!a||a.length===0)return!0;let o=!1;if("values"in a[0]){for(let c of a)try{let f=M$h(c,t,r,n);if(i==="AND"){if(!f)return!1}else if(f)return!0}catch(f){if(f instanceof ise)n&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new ise("Can't match cohort without a given cohort property value");return i==="AND"}else{for(let c of a)try{let f;c.type==="cohort"?f=I$h(c,t,r,n):f=C$h(c,t);let u=c.negation||!1;if(i==="AND"){if(!f&&!u||f&&u)return!1}else if(f&&!u||!f&&u)return!0}catch(f){if(f instanceof ise)n&&console.debug(`Failed to compute property ${c} locally: ${f}`),o=!0;else throw f}if(o)throw new ise("can't match cohort without a given cohort property value");return i==="AND"}}function p$h(e){try{return new RegExp(e),!0}catch{return!1}}function _$h(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 ise(`${e} is in an invalid date format`)}else throw new ise(`The date provided ${e} must be a string, number, or date object`)}function tgD(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),n=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let i=parseInt(r.groups.number);if(i>=1e4)return null;let a=r.groups.interval;if(a=="h")n.setUTCHours(n.getUTCHours()-i);else if(a=="d")n.setUTCDate(n.getUTCDate()-i);else if(a=="w")n.setUTCDate(n.getUTCDate()-i*7);else if(a=="m")n.setUTCMonth(n.getUTCMonth()-i);else if(a=="y")n.setUTCFullYear(n.getUTCFullYear()-i);else return null;return n}else return null}var wkl=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},rgD=100,h$h=30*1e3,ngD=50*1e3,jkl=class extends Okl{constructor(t,r={}){if(super(t,r),this._memoryStorage=new wkl,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,rgD):h$h,r.personalApiKey){if(r.personalApiKey.includes("phc_"))throw new Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');this.featureFlagsPoller=new Pkl({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:n=>{this._events.emit("error",n)},onLoad:n=>{this._events.emit("localEvaluationFlagsLoaded",n)},customHeaders:this.getCustomHeaders()})}this.errorTracking=new gQa(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||ngD}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):S$h(t,r)}getLibraryVersion(){return BbD}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(t=!0){super.debug(t),this.featureFlagsPoller?.debug(t)}capture(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:n,properties:i,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:f,uuid:u}=t,s=A=>{super.captureStateless(r,n,A,{timestamp:c,disableGeoip:f,uuid:u})},l=async(A,P,C)=>(await super.getFeatureFlagsStateless(A,P,void 0,void 0,C)).flags,m=Promise.resolve().then(async()=>{if(o)return await l(r,a,f);if(n==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let A={};for(let[P,C]of Object.entries(a||{}))A[P]=String(C);return await this.getAllFlags(r,{groups:A,disableGeoip:f,onlyEvaluateLocally:!0})}return{}}).then(A=>{let P={};if(A)for(let[M,T]of Object.entries(A))P[`$feature/${M}`]=T;let C=Object.keys(A||{}).filter(M=>A?.[M]!==!1).sort();return C.length>0&&(P.$active_feature_flags=C),P}).catch(()=>({})).then(A=>{s({...A,...i,$groups:a})});this.addPendingPromise(m)}async captureImmediate(t){typeof t=="string"&&this.logMsgIfDebug(()=>console.warn("Called capture() with a string as the first argument when an object was expected."));let{distinctId:r,event:n,properties:i,groups:a,sendFeatureFlags:o,timestamp:c,disableGeoip:f,uuid:u}=t,s=A=>super.captureStatelessImmediate(r,n,A,{timestamp:c,disableGeoip:f,uuid:u}),l=async(A,P,C)=>(await super.getFeatureFlagsStateless(A,P,void 0,void 0,C)).flags;await Promise.resolve().then(async()=>{if(o)return await l(r,a,f);if(n==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let A={};for(let[P,C]of Object.entries(a||{}))A[P]=String(C);return await this.getAllFlags(r,{groups:A,disableGeoip:f,onlyEvaluateLocally:!0})}return{}}).then(A=>{let P={};if(A)for(let[M,T]of Object.entries(A))P[`$feature/${M}`]=T;let C=Object.keys(A||{}).filter(M=>A?.[M]!==!1).sort();return C.length>0&&(P.$active_feature_flags=C),P}).catch(()=>({})).then(A=>{s({...A,...i,$groups:a})})}identify({distinctId:t,properties:r,disableGeoip:n}){let i=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;super.identifyStateless(t,{$set:a,$set_once:i},{disableGeoip:n})}async identifyImmediate({distinctId:t,properties:r,disableGeoip:n}){let i=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;await super.identifyStatelessImmediate(t,{$set:a,$set_once:i},{disableGeoip:n})}alias(t){super.aliasStateless(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}async aliasImmediate(t){await super.aliasStatelessImmediate(t.alias,t.distinctId,void 0,{disableGeoip:t.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(t=h$h){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let n=setTimeout(()=>{i(),r(!1)},t),i=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(n),i(),r(a>0)})})}async getFeatureFlag(t,r,n){let{groups:i,disableGeoip:a}=n||{},{onlyEvaluateLocally:o,sendFeatureFlagEvents:c,personProperties:f,groupProperties:u}=n||{},s=this.addLocalPersonAndGroupProperties(r,i,f,u);f=s.allPersonProperties,u=s.allGroupProperties,o==null&&(o=!1),c==null&&(c=!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,i,f,u),m=l!==void 0,A,P;if(!m&&!o){let M=await super.getFeatureFlagDetailStateless(t,r,i,f,u,a);if(M===void 0)return;P=M.response,l=Dkl(P),A=M?.requestId}let C=`${t}_${l}`;return c&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(C))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(C):this.distinctIdHasSentFlagCalls[r]=[C],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:l,$feature_flag_id:P?.metadata?.id,$feature_flag_version:P?.metadata?.version,$feature_flag_reason:P?.reason?.description??P?.reason?.code,locally_evaluated:m,[`$feature/${t}`]:l,$feature_flag_request_id:A},groups:i,disableGeoip:a})),l}async getFeatureFlagPayload(t,r,n,i){let{groups:a,disableGeoip:o}=i||{},{onlyEvaluateLocally:c,sendFeatureFlagEvents:f,personProperties:u,groupProperties:s}=i||{},l=this.addLocalPersonAndGroupProperties(r,a,u,s);u=l.allPersonProperties,s=l.allGroupProperties;let m;return this.featureFlagsPoller!==void 0&&(n||(n=await this.getFeatureFlag(t,r,{...i,onlyEvaluateLocally:!0,sendFeatureFlagEvents:!1})),n&&(m=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,n))),c==null&&(c=!1),f==null&&(f=!0),c==null&&(c=!1),!(m!==void 0)&&!c&&(m=await super.getFeatureFlagPayloadStateless(t,r,a,u,s,o)),m}async getRemoteConfigPayload(t){return(await this.featureFlagsPoller?._requestRemoteConfigPayload(t))?.json()}async isFeatureEnabled(t,r,n){let i=await this.getFeatureFlag(t,r,n);if(i!==void 0)return!!i||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags||{}}async getAllFlagsAndPayloads(t,r){let{groups:n,disableGeoip:i}=r||{},{onlyEvaluateLocally:a,personProperties:o,groupProperties:c}=r||{},f=this.addLocalPersonAndGroupProperties(t,n,o,c);o=f.allPersonProperties,c=f.allGroupProperties,a==null&&(a=!1);let u=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,n,o,c),s={},l={},m=!0;if(u&&(s=u.response,l=u.payloads,m=u.fallbackToDecide),m&&!a){let A=await super.getFeatureFlagsAndPayloadsStateless(t,n,o,c,i);s={...s,...A.flags||{}},l={...l,...A.payloads||{}}}return{featureFlags:s,featureFlagPayloads:l}}groupIdentify({groupType:t,groupKey:r,properties:n,distinctId:i,disableGeoip:a}){super.groupIdentifyStateless(t,r,n,{disableGeoip:a},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(),super._shutdown(t)}addLocalPersonAndGroupProperties(t,r,n,i){let a={distinct_id:t,...n||{}},o={};if(r)for(let c of Object.keys(r))o[c]={$group_key:r[c],...i?.[c]||{}};return{allPersonProperties:a,allGroupProperties:o}}captureException(t,r,n){let i=new Error("PostHog syntheticException");gQa.captureException(this,t,{syntheticException:i},r,n)}},y$h=/\(error: (.*)\)/,B$h=50,T$h="?";function igD(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return n=>{let i=n.match(r);if(i){let a,o,c,f,u;if(i[1]){c=i[1];let m=c.lastIndexOf(".");if(c[m-1]==="."&&m--,m>0){a=c.slice(0,m),o=c.slice(m+1);let A=a.indexOf(".Module");A>0&&(c=c.slice(A+1),a=a.slice(0,A))}f=void 0}o&&(f=a,u=o),o==="<anonymous>"&&(u=void 0,c=void 0),c===void 0&&(u=u||T$h,c=f?`${f}.${u}`:u);let s=i[2]?.startsWith("file://")?i[2].slice(7):i[2],l=i[5]==="native";return s?.match(/\/[A-Z]:/)&&(s=s.slice(1)),!s&&i[5]&&!l&&(s=i[5]),{filename:s?decodeURI(s):void 0,module:e?e(s):void 0,function:c,lineno:v$h(i[3]),colno:v$h(i[4]),in_app:agD(s||"",l),platform:"node:javascript"}}if(n.match(t))return{filename:n,platform:"node:javascript"}}}function agD(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&e!==void 0&&!e.includes("node_modules/")}function v$h(e){return parseInt(e||"",10)||void 0}function ogD(e){return[90,igD(e)]}function sgD(e){let r=[ogD(e)].sort((n,i)=>n[0]-i[0]).map(n=>n[1]);return(n,i=0)=>{let a=[],o=n.split(`
2162
- `);for(let c=i;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let u=y$h.test(f)?f.replace(y$h,"$1"):f;if(!u.match(/\S*Error: /)){for(let s of r){let l=s(u);if(l){a.push(l);break}}if(a.length>=B$h)break}}return ugD(a)}}function ugD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,B$h).map(r=>({...r,filename:r.filename||cgD(t).filename,function:r.function||T$h}))}function cgD(e){return e[e.length-1]||{}}gQa.stackParser=sgD(gbD());gQa.frameModifiers=[AbD];var OQa=class extends jkl{getLibraryId(){return"posthog-node"}};var $fu=class{posthog;constructor({posthogApiKey:t}){this.posthog=new OQa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.80.0",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var y6o=class{async sendEvent(){}async identify(){}async flush(){}};var PQa=require("fs/promises"),x$h=require("os"),F$h=require("path");var q$h=aa(require("crypto")),Xfu=new Uint8Array(256),Yfu=Xfu.length;function Ckl(){return Yfu>Xfu.length-16&&(q$h.default.randomFillSync(Xfu),Yfu=0),Xfu.slice(Yfu,Yfu+=16)}var Ive=[];for(let e=0;e<256;++e)Ive.push((e+256).toString(16).slice(1));function R$h(e,t=0){return Ive[e[t+0]]+Ive[e[t+1]]+Ive[e[t+2]]+Ive[e[t+3]]+"-"+Ive[e[t+4]]+Ive[e[t+5]]+"-"+Ive[e[t+6]]+Ive[e[t+7]]+"-"+Ive[e[t+8]]+Ive[e[t+9]]+"-"+Ive[e[t+10]]+Ive[e[t+11]]+Ive[e[t+12]]+Ive[e[t+13]]+Ive[e[t+14]]+Ive[e[t+15]]}var N$h=aa(require("crypto")),Ikl={randomUUID:N$h.default.randomUUID};function lgD(e,t,r){if(Ikl.randomUUID&&!t&&!e)return Ikl.randomUUID();e=e||{};let n=e.random||(e.rng||Ckl)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return R$h(n)}var wpt=lgD;var fgD="id",dgD=".fern",v6o=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new OQa(r),this.userId=t==null?void 0:WHl(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.80.0",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=$l(Q_.of((0,x$h.homedir)()),vu.of(dgD),vu.of(fgD));await qv(t)||(await(0,PQa.mkdir)((0,F$h.dirname)(t),{recursive:!0}),await(0,PQa.writeFile)(t,wpt())),this.persistedDistinctId=(await(0,PQa.readFile)(t)).toString()}return this.persistedDistinctId}};var Mkl;async function wQa(){return Mkl==null&&(Mkl=await pgD()),Mkl}async function pgD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new y6o;let r=await oau();return r!=null?new v6o({token:r,posthogApiKey:e}):await w8a()!=null?new $fu({posthogApiKey:e}):new v6o({token:void 0,posthogApiKey:e})}catch{return new y6o}}function b6o(e,t){return function(){return e.apply(t,arguments)}}var{toString:_gD}=Object.prototype,{getPrototypeOf:Tkl}=Object,{iterator:kfu,toStringTag:Q$h}=Symbol,edu=(e=>t=>{let r=_gD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),BIr=e=>(e=e.toLowerCase(),t=>edu(t)===e),tdu=e=>t=>typeof t===e,{isArray:EQa}=Array,jQa=tdu("undefined");function g6o(e){return e!==null&&!jQa(e)&&e.constructor!==null&&!jQa(e.constructor)&&dxe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var L$h=BIr("ArrayBuffer");function hgD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&L$h(e.buffer),t}var ygD=tdu("string"),dxe=tdu("function"),U$h=tdu("number"),m6o=e=>e!==null&&typeof e=="object",vgD=e=>e===!0||e===!1,Zfu=e=>{if(edu(e)!=="object")return!1;let t=Tkl(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Q$h in e)&&!(kfu in e)},bgD=e=>{if(!m6o(e)||g6o(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},ggD=BIr("Date"),mgD=BIr("File"),OgD=BIr("Blob"),AgD=BIr("FileList"),PgD=e=>m6o(e)&&dxe(e.pipe),wgD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||dxe(e.append)&&((t=edu(e))==="formdata"||t==="object"&&dxe(e.toString)&&e.toString()==="[object FormData]"))},jgD=BIr("URLSearchParams"),[EgD,SgD,DgD,CgD]=["ReadableStream","Request","Response","Headers"].map(BIr),IgD=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function O6o(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),EQa(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(g6o(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(n=0;n<o;n++)c=a[n],t.call(null,e[c],c,e)}}function V$h(e,t){if(g6o(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var IYi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,W$h=e=>!jQa(e)&&e!==IYi;function Bkl(){let{caseless:e,skipUndefined:t}=W$h(this)&&this||{},r={},n=(i,a)=>{let o=e&&V$h(r,a)||a;Zfu(r[o])&&Zfu(i)?r[o]=Bkl(r[o],i):Zfu(i)?r[o]=Bkl({},i):EQa(i)?r[o]=i.slice():(!t||!jQa(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&O6o(arguments[i],n);return r}var MgD=(e,t,r,{allOwnKeys:n}={})=>(O6o(t,(i,a)=>{r&&dxe(i)?e[a]=b6o(i,r):e[a]=i},{allOwnKeys:n}),e),BgD=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),TgD=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},qgD=(e,t,r,n)=>{let i,a,o,c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!n||n(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&Tkl(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},RgD=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},NgD=e=>{if(!e)return null;if(EQa(e))return e;let t=e.length;if(!U$h(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},xgD=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Tkl(Uint8Array)),FgD=(e,t)=>{let n=(e&&e[kfu]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},zgD=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},QgD=BIr("HTMLFormElement"),LgD=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),z$h=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),UgD=BIr("RegExp"),H$h=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};O6o(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},VgD=e=>{H$h(e,(t,r)=>{if(dxe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(dxe(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},WgD=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return EQa(e)?n(e):n(String(e).split(t)),r},HgD=()=>{},GgD=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function JgD(e){return!!(e&&dxe(e.append)&&e[Q$h]==="FormData"&&e[kfu])}var KgD=e=>{let t=new Array(10),r=(n,i)=>{if(m6o(n)){if(t.indexOf(n)>=0)return;if(g6o(n))return n;if(!("toJSON"in n)){t[i]=n;let a=EQa(n)?[]:{};return O6o(n,(o,c)=>{let f=r(o,i+1);!jQa(f)&&(a[c]=f)}),t[i]=void 0,a}}return n};return r(e,0)},$gD=BIr("AsyncFunction"),YgD=e=>e&&(m6o(e)||dxe(e))&&dxe(e.then)&&dxe(e.catch),G$h=((e,t)=>e?setImmediate:t?((r,n)=>(IYi.addEventListener("message",({source:i,data:a})=>{i===IYi&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),IYi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",dxe(IYi.postMessage)),XgD=typeof queueMicrotask<"u"?queueMicrotask.bind(IYi):typeof process<"u"&&process.nextTick||G$h,ZgD=e=>e!=null&&dxe(e[kfu]),Kf={isArray:EQa,isArrayBuffer:L$h,isBuffer:g6o,isFormData:wgD,isArrayBufferView:hgD,isString:ygD,isNumber:U$h,isBoolean:vgD,isObject:m6o,isPlainObject:Zfu,isEmptyObject:bgD,isReadableStream:EgD,isRequest:SgD,isResponse:DgD,isHeaders:CgD,isUndefined:jQa,isDate:ggD,isFile:mgD,isBlob:OgD,isRegExp:UgD,isFunction:dxe,isStream:PgD,isURLSearchParams:jgD,isTypedArray:xgD,isFileList:AgD,forEach:O6o,merge:Bkl,extend:MgD,trim:IgD,stripBOM:BgD,inherits:TgD,toFlatObject:qgD,kindOf:edu,kindOfTest:BIr,endsWith:RgD,toArray:NgD,forEachEntry:FgD,matchAll:zgD,isHTMLForm:QgD,hasOwnProperty:z$h,hasOwnProp:z$h,reduceDescriptors:H$h,freezeMethods:VgD,toObjectSet:WgD,toCamelCase:LgD,noop:HgD,toFiniteNumber:GgD,findKey:V$h,global:IYi,isContextDefined:W$h,isSpecCompliantForm:JgD,toJSONObject:KgD,isAsyncFn:$gD,isThenable:YgD,setImmediate:G$h,asap:XgD,isIterable:ZgD};function SQa(e,t,r,n,i){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),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Kf.inherits(SQa,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:Kf.toJSONObject(this.config),code:this.code,status:this.status}}});var J$h=SQa.prototype,K$h={};["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=>{K$h[e]={value:e}});Object.defineProperties(SQa,K$h);Object.defineProperty(J$h,"isAxiosError",{value:!0});SQa.from=(e,t,r,n,i,a)=>{let o=Object.create(J$h);Kf.toFlatObject(e,o,function(s){return s!==Error.prototype},u=>u!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return SQa.call(o,c,f,r,n,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var hm=SQa;var $$h=aa(wfu(),1),rdu=$$h.default;function qkl(e){return Kf.isPlainObject(e)||Kf.isArray(e)}function X$h(e){return Kf.endsWith(e,"[]")?e.slice(0,-2):e}function Y$h(e,t,r){return e?e.concat(t).map(function(i,a){return i=X$h(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function kgD(e){return Kf.isArray(e)&&!e.some(qkl)}var e0D=Kf.toFlatObject(Kf,{},null,function(t){return/^is[A-Z]/.test(t)});function t0D(e,t,r){if(!Kf.isObject(e))throw new TypeError("target must be an object");t=t||new(rdu||FormData),r=Kf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,M){return!Kf.isUndefined(M[C])});let n=r.metaTokens,i=r.visitor||s,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&Kf.isSpecCompliantForm(t);if(!Kf.isFunction(i))throw new TypeError("visitor must be a function");function u(P){if(P===null)return"";if(Kf.isDate(P))return P.toISOString();if(Kf.isBoolean(P))return P.toString();if(!f&&Kf.isBlob(P))throw new hm("Blob is not supported. Use a Buffer instead.");return Kf.isArrayBuffer(P)||Kf.isTypedArray(P)?f&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function s(P,C,M){let T=P;if(P&&!M&&typeof P=="object"){if(Kf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if(Kf.isArray(P)&&kgD(P)||(Kf.isFileList(P)||Kf.endsWith(C,"[]"))&&(T=Kf.toArray(P)))return C=X$h(C),T.forEach(function(U,R){!(Kf.isUndefined(U)||U===null)&&t.append(o===!0?Y$h([C],R,a):o===null?C:C+"[]",u(U))}),!1}return qkl(P)?!0:(t.append(Y$h(M,C,a),u(P)),!1)}let l=[],m=Object.assign(e0D,{defaultVisitor:s,convertValue:u,isVisitable:qkl});function A(P,C){if(!Kf.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),Kf.forEach(P,function(T,z){(!(Kf.isUndefined(T)||T===null)&&i.call(t,T,Kf.isString(z)?z.trim():z,C,m))===!0&&A(T,C?C.concat(z):[z])}),l.pop()}}if(!Kf.isObject(e))throw new TypeError("data must be an object");return A(e),t}var NIi=t0D;function Z$h(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function k$h(e,t){this._pairs=[],e&&NIi(e,this,t)}var eYh=k$h.prototype;eYh.append=function(t,r){this._pairs.push([t,r])};eYh.toString=function(t){let r=t?function(n){return t.call(this,n,Z$h)}:Z$h;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var tYh=k$h;function r0D(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function MYi(e,t,r){if(!t)return e;let n=r&&r.encode||r0D;Kf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Kf.isURLSearchParams(t)?t.toString():new tYh(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var Rkl=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Kf.forEach(this.handlers,function(n){n!==null&&t(n)})}},Nkl=Rkl;var DQa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var aYh=aa(require("crypto"),1);var rYh=aa(require("url"),1),nYh=rYh.default.URLSearchParams;var xkl="abcdefghijklmnopqrstuvwxyz",iYh="0123456789",oYh={DIGIT:iYh,ALPHA:xkl,ALPHA_DIGIT:xkl+xkl.toUpperCase()+iYh},n0D=(e=16,t=oYh.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);aYh.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},sYh={isNode:!0,classes:{URLSearchParams:nYh,FormData:rdu,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:oYh,generateString:n0D,protocols:["http","https","file","data"]};var Qkl={};mf(Qkl,{hasBrowserEnv:()=>zkl,hasStandardBrowserEnv:()=>i0D,hasStandardBrowserWebWorkerEnv:()=>a0D,navigator:()=>Fkl,origin:()=>o0D});var zkl=typeof window<"u"&&typeof document<"u",Fkl=typeof navigator=="object"&&navigator||void 0,i0D=zkl&&(!Fkl||["ReactNative","NativeScript","NS"].indexOf(Fkl.product)<0),a0D=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",o0D=zkl&&window.location.href||"http://localhost";var d4={...Qkl,...sYh};function Lkl(e,t){return NIi(e,new d4.classes.URLSearchParams,{visitor:function(r,n,i,a){return d4.isNode&&Kf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function s0D(e){return Kf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function u0D(e){let t={},r=Object.keys(e),n,i=r.length,a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}function c0D(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&Kf.isArray(i)?i.length:o,f?(Kf.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!Kf.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&Kf.isArray(i[o])&&(i[o]=u0D(i[o])),!c)}if(Kf.isFormData(e)&&Kf.isFunction(e.entries)){let r={};return Kf.forEachEntry(e,(n,i)=>{t(s0D(n),i,r,0)}),r}return null}var ndu=c0D;function l0D(e,t,r){if(Kf.isString(e))try{return(t||JSON.parse)(e),Kf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Ukl={transitional:DQa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Kf.isObject(t);if(a&&Kf.isHTMLForm(t)&&(t=new FormData(t)),Kf.isFormData(t))return i?JSON.stringify(ndu(t)):t;if(Kf.isArrayBuffer(t)||Kf.isBuffer(t)||Kf.isStream(t)||Kf.isFile(t)||Kf.isBlob(t)||Kf.isReadableStream(t))return t;if(Kf.isArrayBufferView(t))return t.buffer;if(Kf.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Lkl(t,this.formSerializer).toString();if((c=Kf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return NIi(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),l0D(t)):t}],transformResponse:[function(t){let r=this.transitional||Ukl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Kf.isResponse(t)||Kf.isReadableStream(t))return t;if(t&&Kf.isString(t)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?hm.from(c,hm.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:d4.classes.FormData,Blob:d4.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Kf.forEach(["delete","get","head","post","put","patch"],e=>{Ukl.headers[e]={}});var CQa=Ukl;var f0D=Kf.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"]),uYh=e=>{let t={},r,n,i;return e&&e.split(`
2162
+ `);for(let c=i;c<o.length;c++){let f=o[c];if(f.length>1024)continue;let u=y$h.test(f)?f.replace(y$h,"$1"):f;if(!u.match(/\S*Error: /)){for(let s of r){let l=s(u);if(l){a.push(l);break}}if(a.length>=B$h)break}}return ugD(a)}}function ugD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,B$h).map(r=>({...r,filename:r.filename||cgD(t).filename,function:r.function||T$h}))}function cgD(e){return e[e.length-1]||{}}gQa.stackParser=sgD(gbD());gQa.frameModifiers=[AbD];var OQa=class extends jkl{getLibraryId(){return"posthog-node"}};var $fu=class{posthog;constructor({posthogApiKey:t}){this.posthog=new OQa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.80.1",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var y6o=class{async sendEvent(){}async identify(){}async flush(){}};var PQa=require("fs/promises"),x$h=require("os"),F$h=require("path");var q$h=aa(require("crypto")),Xfu=new Uint8Array(256),Yfu=Xfu.length;function Ckl(){return Yfu>Xfu.length-16&&(q$h.default.randomFillSync(Xfu),Yfu=0),Xfu.slice(Yfu,Yfu+=16)}var Ive=[];for(let e=0;e<256;++e)Ive.push((e+256).toString(16).slice(1));function R$h(e,t=0){return Ive[e[t+0]]+Ive[e[t+1]]+Ive[e[t+2]]+Ive[e[t+3]]+"-"+Ive[e[t+4]]+Ive[e[t+5]]+"-"+Ive[e[t+6]]+Ive[e[t+7]]+"-"+Ive[e[t+8]]+Ive[e[t+9]]+"-"+Ive[e[t+10]]+Ive[e[t+11]]+Ive[e[t+12]]+Ive[e[t+13]]+Ive[e[t+14]]+Ive[e[t+15]]}var N$h=aa(require("crypto")),Ikl={randomUUID:N$h.default.randomUUID};function lgD(e,t,r){if(Ikl.randomUUID&&!t&&!e)return Ikl.randomUUID();e=e||{};let n=e.random||(e.rng||Ckl)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(let i=0;i<16;++i)t[r+i]=n[i];return t}return R$h(n)}var wpt=lgD;var fgD="id",dgD=".fern",v6o=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new OQa(r),this.userId=t==null?void 0:WHl(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.80.1",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=$l(Q_.of((0,x$h.homedir)()),vu.of(dgD),vu.of(fgD));await qv(t)||(await(0,PQa.mkdir)((0,F$h.dirname)(t),{recursive:!0}),await(0,PQa.writeFile)(t,wpt())),this.persistedDistinctId=(await(0,PQa.readFile)(t)).toString()}return this.persistedDistinctId}};var Mkl;async function wQa(){return Mkl==null&&(Mkl=await pgD()),Mkl}async function pgD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new y6o;let r=await oau();return r!=null?new v6o({token:r,posthogApiKey:e}):await w8a()!=null?new $fu({posthogApiKey:e}):new v6o({token:void 0,posthogApiKey:e})}catch{return new y6o}}function b6o(e,t){return function(){return e.apply(t,arguments)}}var{toString:_gD}=Object.prototype,{getPrototypeOf:Tkl}=Object,{iterator:kfu,toStringTag:Q$h}=Symbol,edu=(e=>t=>{let r=_gD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),BIr=e=>(e=e.toLowerCase(),t=>edu(t)===e),tdu=e=>t=>typeof t===e,{isArray:EQa}=Array,jQa=tdu("undefined");function g6o(e){return e!==null&&!jQa(e)&&e.constructor!==null&&!jQa(e.constructor)&&dxe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var L$h=BIr("ArrayBuffer");function hgD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&L$h(e.buffer),t}var ygD=tdu("string"),dxe=tdu("function"),U$h=tdu("number"),m6o=e=>e!==null&&typeof e=="object",vgD=e=>e===!0||e===!1,Zfu=e=>{if(edu(e)!=="object")return!1;let t=Tkl(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Q$h in e)&&!(kfu in e)},bgD=e=>{if(!m6o(e)||g6o(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},ggD=BIr("Date"),mgD=BIr("File"),OgD=BIr("Blob"),AgD=BIr("FileList"),PgD=e=>m6o(e)&&dxe(e.pipe),wgD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||dxe(e.append)&&((t=edu(e))==="formdata"||t==="object"&&dxe(e.toString)&&e.toString()==="[object FormData]"))},jgD=BIr("URLSearchParams"),[EgD,SgD,DgD,CgD]=["ReadableStream","Request","Response","Headers"].map(BIr),IgD=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function O6o(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),EQa(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(g6o(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),o=a.length,c;for(n=0;n<o;n++)c=a[n],t.call(null,e[c],c,e)}}function V$h(e,t){if(g6o(e))return null;t=t.toLowerCase();let r=Object.keys(e),n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}var IYi=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,W$h=e=>!jQa(e)&&e!==IYi;function Bkl(){let{caseless:e,skipUndefined:t}=W$h(this)&&this||{},r={},n=(i,a)=>{let o=e&&V$h(r,a)||a;Zfu(r[o])&&Zfu(i)?r[o]=Bkl(r[o],i):Zfu(i)?r[o]=Bkl({},i):EQa(i)?r[o]=i.slice():(!t||!jQa(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&O6o(arguments[i],n);return r}var MgD=(e,t,r,{allOwnKeys:n}={})=>(O6o(t,(i,a)=>{r&&dxe(i)?e[a]=b6o(i,r):e[a]=i},{allOwnKeys:n}),e),BgD=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),TgD=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},qgD=(e,t,r,n)=>{let i,a,o,c={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),a=i.length;a-- >0;)o=i[a],(!n||n(o,e,t))&&!c[o]&&(t[o]=e[o],c[o]=!0);e=r!==!1&&Tkl(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},RgD=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let n=e.indexOf(t,r);return n!==-1&&n===r},NgD=e=>{if(!e)return null;if(EQa(e))return e;let t=e.length;if(!U$h(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},xgD=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Tkl(Uint8Array)),FgD=(e,t)=>{let n=(e&&e[kfu]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},zgD=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},QgD=BIr("HTMLFormElement"),LgD=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),z$h=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),UgD=BIr("RegExp"),H$h=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};O6o(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},VgD=e=>{H$h(e,(t,r)=>{if(dxe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(dxe(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},WgD=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return EQa(e)?n(e):n(String(e).split(t)),r},HgD=()=>{},GgD=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function JgD(e){return!!(e&&dxe(e.append)&&e[Q$h]==="FormData"&&e[kfu])}var KgD=e=>{let t=new Array(10),r=(n,i)=>{if(m6o(n)){if(t.indexOf(n)>=0)return;if(g6o(n))return n;if(!("toJSON"in n)){t[i]=n;let a=EQa(n)?[]:{};return O6o(n,(o,c)=>{let f=r(o,i+1);!jQa(f)&&(a[c]=f)}),t[i]=void 0,a}}return n};return r(e,0)},$gD=BIr("AsyncFunction"),YgD=e=>e&&(m6o(e)||dxe(e))&&dxe(e.then)&&dxe(e.catch),G$h=((e,t)=>e?setImmediate:t?((r,n)=>(IYi.addEventListener("message",({source:i,data:a})=>{i===IYi&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),IYi.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",dxe(IYi.postMessage)),XgD=typeof queueMicrotask<"u"?queueMicrotask.bind(IYi):typeof process<"u"&&process.nextTick||G$h,ZgD=e=>e!=null&&dxe(e[kfu]),Kf={isArray:EQa,isArrayBuffer:L$h,isBuffer:g6o,isFormData:wgD,isArrayBufferView:hgD,isString:ygD,isNumber:U$h,isBoolean:vgD,isObject:m6o,isPlainObject:Zfu,isEmptyObject:bgD,isReadableStream:EgD,isRequest:SgD,isResponse:DgD,isHeaders:CgD,isUndefined:jQa,isDate:ggD,isFile:mgD,isBlob:OgD,isRegExp:UgD,isFunction:dxe,isStream:PgD,isURLSearchParams:jgD,isTypedArray:xgD,isFileList:AgD,forEach:O6o,merge:Bkl,extend:MgD,trim:IgD,stripBOM:BgD,inherits:TgD,toFlatObject:qgD,kindOf:edu,kindOfTest:BIr,endsWith:RgD,toArray:NgD,forEachEntry:FgD,matchAll:zgD,isHTMLForm:QgD,hasOwnProperty:z$h,hasOwnProp:z$h,reduceDescriptors:H$h,freezeMethods:VgD,toObjectSet:WgD,toCamelCase:LgD,noop:HgD,toFiniteNumber:GgD,findKey:V$h,global:IYi,isContextDefined:W$h,isSpecCompliantForm:JgD,toJSONObject:KgD,isAsyncFn:$gD,isThenable:YgD,setImmediate:G$h,asap:XgD,isIterable:ZgD};function SQa(e,t,r,n,i){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),n&&(this.request=n),i&&(this.response=i,this.status=i.status?i.status:null)}Kf.inherits(SQa,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:Kf.toJSONObject(this.config),code:this.code,status:this.status}}});var J$h=SQa.prototype,K$h={};["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=>{K$h[e]={value:e}});Object.defineProperties(SQa,K$h);Object.defineProperty(J$h,"isAxiosError",{value:!0});SQa.from=(e,t,r,n,i,a)=>{let o=Object.create(J$h);Kf.toFlatObject(e,o,function(s){return s!==Error.prototype},u=>u!=="isAxiosError");let c=e&&e.message?e.message:"Error",f=t==null&&e?e.code:t;return SQa.call(o,c,f,r,n,i),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",a&&Object.assign(o,a),o};var hm=SQa;var $$h=aa(wfu(),1),rdu=$$h.default;function qkl(e){return Kf.isPlainObject(e)||Kf.isArray(e)}function X$h(e){return Kf.endsWith(e,"[]")?e.slice(0,-2):e}function Y$h(e,t,r){return e?e.concat(t).map(function(i,a){return i=X$h(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function kgD(e){return Kf.isArray(e)&&!e.some(qkl)}var e0D=Kf.toFlatObject(Kf,{},null,function(t){return/^is[A-Z]/.test(t)});function t0D(e,t,r){if(!Kf.isObject(e))throw new TypeError("target must be an object");t=t||new(rdu||FormData),r=Kf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,M){return!Kf.isUndefined(M[C])});let n=r.metaTokens,i=r.visitor||s,a=r.dots,o=r.indexes,f=(r.Blob||typeof Blob<"u"&&Blob)&&Kf.isSpecCompliantForm(t);if(!Kf.isFunction(i))throw new TypeError("visitor must be a function");function u(P){if(P===null)return"";if(Kf.isDate(P))return P.toISOString();if(Kf.isBoolean(P))return P.toString();if(!f&&Kf.isBlob(P))throw new hm("Blob is not supported. Use a Buffer instead.");return Kf.isArrayBuffer(P)||Kf.isTypedArray(P)?f&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function s(P,C,M){let T=P;if(P&&!M&&typeof P=="object"){if(Kf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if(Kf.isArray(P)&&kgD(P)||(Kf.isFileList(P)||Kf.endsWith(C,"[]"))&&(T=Kf.toArray(P)))return C=X$h(C),T.forEach(function(U,R){!(Kf.isUndefined(U)||U===null)&&t.append(o===!0?Y$h([C],R,a):o===null?C:C+"[]",u(U))}),!1}return qkl(P)?!0:(t.append(Y$h(M,C,a),u(P)),!1)}let l=[],m=Object.assign(e0D,{defaultVisitor:s,convertValue:u,isVisitable:qkl});function A(P,C){if(!Kf.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),Kf.forEach(P,function(T,z){(!(Kf.isUndefined(T)||T===null)&&i.call(t,T,Kf.isString(z)?z.trim():z,C,m))===!0&&A(T,C?C.concat(z):[z])}),l.pop()}}if(!Kf.isObject(e))throw new TypeError("data must be an object");return A(e),t}var NIi=t0D;function Z$h(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function k$h(e,t){this._pairs=[],e&&NIi(e,this,t)}var eYh=k$h.prototype;eYh.append=function(t,r){this._pairs.push([t,r])};eYh.toString=function(t){let r=t?function(n){return t.call(this,n,Z$h)}:Z$h;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var tYh=k$h;function r0D(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function MYi(e,t,r){if(!t)return e;let n=r&&r.encode||r0D;Kf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Kf.isURLSearchParams(t)?t.toString():new tYh(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var Rkl=class{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Kf.forEach(this.handlers,function(n){n!==null&&t(n)})}},Nkl=Rkl;var DQa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var aYh=aa(require("crypto"),1);var rYh=aa(require("url"),1),nYh=rYh.default.URLSearchParams;var xkl="abcdefghijklmnopqrstuvwxyz",iYh="0123456789",oYh={DIGIT:iYh,ALPHA:xkl,ALPHA_DIGIT:xkl+xkl.toUpperCase()+iYh},n0D=(e=16,t=oYh.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);aYh.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},sYh={isNode:!0,classes:{URLSearchParams:nYh,FormData:rdu,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:oYh,generateString:n0D,protocols:["http","https","file","data"]};var Qkl={};mf(Qkl,{hasBrowserEnv:()=>zkl,hasStandardBrowserEnv:()=>i0D,hasStandardBrowserWebWorkerEnv:()=>a0D,navigator:()=>Fkl,origin:()=>o0D});var zkl=typeof window<"u"&&typeof document<"u",Fkl=typeof navigator=="object"&&navigator||void 0,i0D=zkl&&(!Fkl||["ReactNative","NativeScript","NS"].indexOf(Fkl.product)<0),a0D=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",o0D=zkl&&window.location.href||"http://localhost";var d4={...Qkl,...sYh};function Lkl(e,t){return NIi(e,new d4.classes.URLSearchParams,{visitor:function(r,n,i,a){return d4.isNode&&Kf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function s0D(e){return Kf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function u0D(e){let t={},r=Object.keys(e),n,i=r.length,a;for(n=0;n<i;n++)a=r[n],t[a]=e[a];return t}function c0D(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),f=a>=r.length;return o=!o&&Kf.isArray(i)?i.length:o,f?(Kf.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!Kf.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&Kf.isArray(i[o])&&(i[o]=u0D(i[o])),!c)}if(Kf.isFormData(e)&&Kf.isFunction(e.entries)){let r={};return Kf.forEachEntry(e,(n,i)=>{t(s0D(n),i,r,0)}),r}return null}var ndu=c0D;function l0D(e,t,r){if(Kf.isString(e))try{return(t||JSON.parse)(e),Kf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Ukl={transitional:DQa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Kf.isObject(t);if(a&&Kf.isHTMLForm(t)&&(t=new FormData(t)),Kf.isFormData(t))return i?JSON.stringify(ndu(t)):t;if(Kf.isArrayBuffer(t)||Kf.isBuffer(t)||Kf.isStream(t)||Kf.isFile(t)||Kf.isBlob(t)||Kf.isReadableStream(t))return t;if(Kf.isArrayBufferView(t))return t.buffer;if(Kf.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1)return Lkl(t,this.formSerializer).toString();if((c=Kf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let f=this.env&&this.env.FormData;return NIi(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),l0D(t)):t}],transformResponse:[function(t){let r=this.transitional||Ukl.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Kf.isResponse(t)||Kf.isReadableStream(t))return t;if(t&&Kf.isString(t)&&(n&&!this.responseType||i)){let o=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(c){if(o)throw c.name==="SyntaxError"?hm.from(c,hm.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:d4.classes.FormData,Blob:d4.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Kf.forEach(["delete","get","head","post","put","patch"],e=>{Ukl.headers[e]={}});var CQa=Ukl;var f0D=Kf.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"]),uYh=e=>{let t={},r,n,i;return e&&e.split(`
2163
2163
  `).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||t[r]&&f0D[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var cYh=Symbol("internals");function A6o(e){return e&&String(e).trim().toLowerCase()}function idu(e){return e===!1||e==null?e:Kf.isArray(e)?e.map(idu):String(e)}function d0D(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}var p0D=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Vkl(e,t,r,n,i){if(Kf.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!Kf.isString(t)){if(Kf.isString(n))return t.indexOf(n)!==-1;if(Kf.isRegExp(n))return n.test(t)}}function _0D(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function h0D(e,t){let r=Kf.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,a,o){return this[n].call(this,t,i,a,o)},configurable:!0})})}var IQa=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function a(c,f,u){let s=A6o(f);if(!s)throw new Error("header name must be a non-empty string");let l=Kf.findKey(i,s);(!l||i[l]===void 0||u===!0||u===void 0&&i[l]!==!1)&&(i[l||f]=idu(c))}let o=(c,f)=>Kf.forEach(c,(u,s)=>a(u,s,f));if(Kf.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(Kf.isString(t)&&(t=t.trim())&&!p0D(t))o(uYh(t),r);else if(Kf.isObject(t)&&Kf.isIterable(t)){let c={},f,u;for(let s of t){if(!Kf.isArray(s))throw TypeError("Object iterator must return a key-value pair");c[u=s[0]]=(f=c[u])?Kf.isArray(f)?[...f,s[1]]:[f,s[1]]:s[1]}o(c,r)}else t!=null&&a(r,t,n);return this}get(t,r){if(t=A6o(t),t){let n=Kf.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return d0D(i);if(Kf.isFunction(r))return r.call(this,i,n);if(Kf.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=A6o(t),t){let n=Kf.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Vkl(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function a(o){if(o=A6o(o),o){let c=Kf.findKey(n,o);c&&(!r||Vkl(n,n[c],c,r))&&(delete n[c],i=!0)}}return Kf.isArray(t)?t.forEach(a):a(t),i}clear(t){let r=Object.keys(this),n=r.length,i=!1;for(;n--;){let a=r[n];(!t||Vkl(this,this[a],a,t,!0))&&(delete this[a],i=!0)}return i}normalize(t){let r=this,n={};return Kf.forEach(this,(i,a)=>{let o=Kf.findKey(n,a);if(o){r[o]=idu(i),delete r[a];return}let c=t?_0D(a):String(a).trim();c!==a&&delete r[a],r[c]=idu(i),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return Kf.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&Kf.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
2164
2164
  `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){let n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){let n=(this[cYh]=this[cYh]={accessors:{}}).accessors,i=this.prototype;function a(o){let c=A6o(o);n[c]||(h0D(i,o),n[c]=!0)}return Kf.isArray(t)?t.forEach(a):a(t),this}};IQa.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Kf.reduceDescriptors(IQa.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});Kf.freezeMethods(IQa);var SK=IQa;function P6o(e,t){let r=this||CQa,n=t||r,i=SK.from(n.headers),a=n.data;return Kf.forEach(e,function(c){a=c.call(r,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function w6o(e){return!!(e&&e.__CANCEL__)}function lYh(e,t,r){hm.call(this,e??"canceled",hm.ERR_CANCELED,t,r),this.name="CanceledError"}Kf.inherits(lYh,hm,{__CANCEL__:!0});var Vtt=lYh;function W5r(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new hm("Request failed with status code "+r.status,[hm.ERR_BAD_REQUEST,hm.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Wkl(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Hkl(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function BYi(e,t,r){let n=!Wkl(t);return e&&(n||r==!1)?Hkl(e,t):t}var EYh=aa(jfu(),1),SYh=aa(require("http"),1),DYh=aa(require("https"),1),CYh=aa(require("util"),1),IYh=aa(GZl(),1),Jfi=aa(require("zlib"),1);var TYi="1.12.2";function j6o(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var y0D=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Gkl(e,t,r){let n=r&&r.Blob||d4.classes.Blob,i=j6o(e);if(t===void 0&&n&&(t=!0),i==="data"){e=i.length?e.slice(i.length+1):e;let a=y0D.exec(e);if(!a)throw new hm("Invalid URL",hm.ERR_INVALID_URL);let o=a[1],c=a[2],f=a[3],u=Buffer.from(decodeURIComponent(f),c?"base64":"utf8");if(t){if(!n)throw new hm("Blob is not supported",hm.ERR_NOT_SUPPORT);return new n([u],{type:o})}return u}throw new hm("Unsupported protocol "+i,hm.ERR_NOT_SUPPORT)}var RYi=aa(require("stream"),1);var fYh=aa(require("stream"),1);var Jkl=Symbol("internals"),Kkl=class extends fYh.default.Transform{constructor(t){t=Kf.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,i)=>!Kf.isUndefined(i[n])),super({readableHighWaterMark:t.chunkSize});let r=this[Jkl]={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",n=>{n==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[Jkl];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,n){let i=this[Jkl],a=i.maxRate,o=this.readableHighWaterMark,c=i.timeWindow,f=1e3/c,u=a/f,s=i.minChunkSize!==!1?Math.max(i.minChunkSize,u*.01):0,l=(A,P)=>{let C=Buffer.byteLength(A);i.bytesSeen+=C,i.bytes+=C,i.isCaptured&&this.emit("progress",i.bytesSeen),this.push(A)?process.nextTick(P):i.onReadCallback=()=>{i.onReadCallback=null,process.nextTick(P)}},m=(A,P)=>{let C=Buffer.byteLength(A),M=null,T=o,z,U=0;if(a){let R=Date.now();(!i.ts||(U=R-i.ts)>=c)&&(i.ts=R,z=u-i.bytes,i.bytes=z<0?-z:0,U=0),z=u-i.bytes}if(a){if(z<=0)return setTimeout(()=>{P(null,A)},c-U);z<T&&(T=z)}T&&C>T&&C-T>s&&(M=A.subarray(T),A=A.subarray(0,T)),l(A,M?()=>{process.nextTick(P,null,M)}:P)};m(t,function A(P,C){if(P)return n(P);C?m(C,A):n(null)})}},$kl=Kkl;var MYh=require("events");var pYh=aa(require("util"),1),_Yh=require("stream");var{asyncIterator:dYh}=Symbol,v0D=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[dYh]?yield*e[dYh]():yield e},adu=v0D;var b0D=d4.ALPHABET.ALPHA_DIGIT+"-_",E6o=typeof TextEncoder=="function"?new TextEncoder:new pYh.default.TextEncoder,qYi=`\r
2165
2165
  `,g0D=E6o.encode(qYi),m0D=2,Ykl=class{constructor(t,r){let{escapeName:n}=this.constructor,i=Kf.isString(r),a=`Content-Disposition: form-data; name="${n(t)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${qYi}`;i?r=E6o.encode(String(r).replace(/\r?\n|\r\n?/g,qYi)):a+=`Content-Type: ${r.type||"application/octet-stream"}${qYi}`,this.headers=E6o.encode(a+qYi),this.contentLength=i?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+m0D,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;Kf.isTypedArray(t)?yield t:yield*adu(t),yield g0D}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},O0D=(e,t,r)=>{let{tag:n="form-data-boundary",size:i=25,boundary:a=n+"-"+d4.generateString(i,b0D)}=r||{};if(!Kf.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let o=E6o.encode("--"+a+qYi),c=E6o.encode("--"+a+"--"+qYi),f=c.byteLength,u=Array.from(e.entries()).map(([l,m])=>{let A=new Ykl(l,m);return f+=A.size,A});f+=o.byteLength*u.length,f=Kf.toFiniteNumber(f);let s={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(f)&&(s["Content-Length"]=f),t&&t(s),_Yh.Readable.from((async function*(){for(let l of u)yield o,yield*l.encode();yield c})())},hYh=O0D;var yYh=aa(require("stream"),1),Xkl=class extends yYh.default.Transform{__transform(t,r,n){this.push(t),n()}_transform(t,r,n){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let i=Buffer.alloc(2);i[0]=120,i[1]=156,this.push(i,r)}this.__transform(t,r,n)}},vYh=Xkl;var A0D=(e,t)=>Kf.isAsyncFn(e)?function(...r){let n=r.pop();e.apply(this,r).then(i=>{try{t?n(null,...t(i)):n(null,i)}catch(a){n(a)}},n)}:e,bYh=A0D;function P0D(e,t){e=e||10;let r=new Array(e),n=new Array(e),i=0,a=0,o;return t=t!==void 0?t:1e3,function(f){let u=Date.now(),s=n[a];o||(o=u),r[i]=f,n[i]=u;let l=a,m=0;for(;l!==i;)m+=r[l++],l=l%e;if(i=(i+1)%e,i===a&&(a=(a+1)%e),u-o<t)return;let A=s&&u-s;return A?Math.round(m*1e3/A):void 0}}var gYh=P0D;function w0D(e,t){let r=0,n=1e3/t,i,a,o=(u,s=Date.now())=>{r=s,i=null,a&&(clearTimeout(a),a=null),e(...u)};return[(...u)=>{let s=Date.now(),l=s-r;l>=n?o(u,s):(i=u,a||(a=setTimeout(()=>{a=null,o(i)},n-l)))},()=>i&&o(i)]}var mYh=w0D;var Gfi=(e,t,r=3)=>{let n=0,i=gYh(50,250);return mYh(a=>{let o=a.loaded,c=a.lengthComputable?a.total:void 0,f=o-n,u=i(f),s=o<=c;n=o;let l={loaded:o,total:c,progress:c?o/c:void 0,bytes:f,rate:u||void 0,estimated:u&&c&&s?(c-o)/u:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},r)},MQa=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},BQa=e=>(...t)=>Kf.asap(()=>e(...t));function Zkl(e){if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;let t=e.indexOf(",");if(t<0)return 0;let r=e.slice(5,t),n=e.slice(t+1);if(/;base64/i.test(r)){let a=n.length,o=n.length;for(let m=0;m<o;m++)if(n.charCodeAt(m)===37&&m+2<o){let A=n.charCodeAt(m+1),P=n.charCodeAt(m+2);(A>=48&&A<=57||A>=65&&A<=70||A>=97&&A<=102)&&(P>=48&&P<=57||P>=65&&P<=70||P>=97&&P<=102)&&(a-=2,m+=2)}let c=0,f=o-1,u=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);f>=0&&(n.charCodeAt(f)===61?(c++,f--):u(f)&&(c++,f-=3)),c===1&&f>=0&&(n.charCodeAt(f)===61||u(f))&&c++;let l=Math.floor(a/4)*3-(c||0);return l>0?l:0}return Buffer.byteLength(n,"utf8")}var OYh={flush:Jfi.default.constants.Z_SYNC_FLUSH,finishFlush:Jfi.default.constants.Z_SYNC_FLUSH},j0D={flush:Jfi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:Jfi.default.constants.BROTLI_OPERATION_FLUSH},AYh=Kf.isFunction(Jfi.default.createBrotliDecompress),{http:E0D,https:S0D}=IYh.default,D0D=/https:?/,PYh=d4.protocols.map(e=>e+":"),wYh=(e,[t,r])=>(e.on("end",r).on("error",r),t);function C0D(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function BYh(e,t,r){let n=t;if(!n&&n!==!1){let i=EYh.default.getProxyForUrl(r);i&&(n=new URL(i))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));let a=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let i=n.hostname||n.host;e.hostname=i,e.host=i,e.port=n.port,e.path=r,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=function(a){BYh(a,t,a.href)}}var I0D=typeof process<"u"&&Kf.kindOf(process)==="process",M0D=e=>new Promise((t,r)=>{let n,i,a=(f,u)=>{i||(i=!0,n&&n(f,u))},o=f=>{a(f),t(f)},c=f=>{a(f,!0),r(f)};e(o,c,f=>n=f).catch(c)}),B0D=({address:e,family:t})=>{if(!Kf.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},jYh=(e,t)=>B0D(Kf.isObject(e)?e:{address:e,family:t}),TYh=I0D&&function(t){return M0D(async function(n,i,a){let{data:o,lookup:c,family:f}=t,{responseType:u,responseEncoding:s}=t,l=t.method.toUpperCase(),m,A=!1,P;if(c){let Se=bYh(c,St=>Kf.isArray(St)?St:[St]);c=(St,_t,qe)=>{Se(St,_t,(De,Qt,Xe)=>{if(De)return qe(De);let Xt=Kf.isArray(Qt)?Qt.map(Mt=>jYh(Mt)):[jYh(Qt,Xe)];_t.all?qe(De,Xt):qe(De,Xt[0].address,Xt[0].family)})}}let C=new MYh.EventEmitter,M=()=>{t.cancelToken&&t.cancelToken.unsubscribe(T),t.signal&&t.signal.removeEventListener("abort",T),C.removeAllListeners()};a((Se,St)=>{m=!0,St&&(A=!0,M())});function T(Se){C.emit("abort",!Se||Se.type?new Vtt(null,t,P):Se)}C.once("abort",i),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(T),t.signal&&(t.signal.aborted?T():t.signal.addEventListener("abort",T)));let z=BYi(t.baseURL,t.url,t.allowAbsoluteUrls),U=new URL(z,d4.hasBrowserEnv?d4.origin:void 0),R=U.protocol||PYh[0];if(R==="data:"){if(t.maxContentLength>-1){let St=String(t.url||z||"");if(Zkl(St)>t.maxContentLength)return i(new hm("maxContentLength size of "+t.maxContentLength+" exceeded",hm.ERR_BAD_RESPONSE,t))}let Se;if(l!=="GET")return W5r(n,i,{status:405,statusText:"method not allowed",headers:{},config:t});try{Se=Gkl(t.url,u==="blob",{Blob:t.env&&t.env.Blob})}catch(St){throw hm.from(St,hm.ERR_BAD_REQUEST,t)}return u==="text"?(Se=Se.toString(s),(!s||s==="utf8")&&(Se=Kf.stripBOM(Se))):u==="stream"&&(Se=RYi.default.Readable.from(Se)),W5r(n,i,{data:Se,status:200,statusText:"OK",headers:new SK,config:t})}if(PYh.indexOf(R)===-1)return i(new hm("Unsupported protocol "+R,hm.ERR_BAD_REQUEST,t));let V=SK.from(t.headers).normalize();V.set("User-Agent","axios/"+TYi,!1);let{onUploadProgress:$,onDownloadProgress:re}=t,Y=t.maxRate,te,ne;if(Kf.isSpecCompliantForm(o)){let Se=V.getContentType(/boundary=([-_\w\d]{10,70})/i);o=hYh(o,St=>{V.set(St)},{tag:`axios-${TYi}-boundary`,boundary:Se&&Se[1]||void 0})}else if(Kf.isFormData(o)&&Kf.isFunction(o.getHeaders)){if(V.set(o.getHeaders()),!V.hasContentLength())try{let Se=await CYh.default.promisify(o.getLength).call(o);Number.isFinite(Se)&&Se>=0&&V.setContentLength(Se)}catch{}}else if(Kf.isBlob(o)||Kf.isFile(o))o.size&&V.setContentType(o.type||"application/octet-stream"),V.setContentLength(o.size||0),o=RYi.default.Readable.from(adu(o));else if(o&&!Kf.isStream(o)){if(!Buffer.isBuffer(o))if(Kf.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(Kf.isString(o))o=Buffer.from(o,"utf-8");else return i(new hm("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",hm.ERR_BAD_REQUEST,t));if(V.setContentLength(o.length,!1),t.maxBodyLength>-1&&o.length>t.maxBodyLength)return i(new hm("Request body larger than maxBodyLength limit",hm.ERR_BAD_REQUEST,t))}let Ae=Kf.toFiniteNumber(V.getContentLength());Kf.isArray(Y)?(te=Y[0],ne=Y[1]):te=ne=Y,o&&($||te)&&(Kf.isStream(o)||(o=RYi.default.Readable.from(o,{objectMode:!1})),o=RYi.default.pipeline([o,new $kl({maxRate:Kf.toFiniteNumber(te)})],Kf.noop),$&&o.on("progress",wYh(o,MQa(Ae,Gfi(BQa($),!1,3)))));let ge;if(t.auth){let Se=t.auth.username||"",St=t.auth.password||"";ge=Se+":"+St}if(!ge&&U.username){let Se=U.username,St=U.password;ge=Se+":"+St}ge&&V.delete("authorization");let ve;try{ve=MYi(U.pathname+U.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(Se){let St=new Error(Se.message);return St.config=t,St.url=t.url,St.exists=!0,i(St)}V.set("Accept-Encoding","gzip, compress, deflate"+(AYh?", br":""),!1);let be={path:ve,method:l,headers:V.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:ge,protocol:R,family:f,beforeRedirect:C0D,beforeRedirects:{}};!Kf.isUndefined(c)&&(be.lookup=c),t.socketPath?be.socketPath=t.socketPath:(be.hostname=U.hostname.startsWith("[")?U.hostname.slice(1,-1):U.hostname,be.port=U.port,BYh(be,t.proxy,R+"//"+U.hostname+(U.port?":"+U.port:"")+be.path));let Me,Be=D0D.test(be.protocol);if(be.agent=Be?t.httpsAgent:t.httpAgent,t.transport?Me=t.transport:t.maxRedirects===0?Me=Be?DYh.default:SYh.default:(t.maxRedirects&&(be.maxRedirects=t.maxRedirects),t.beforeRedirect&&(be.beforeRedirects.config=t.beforeRedirect),Me=Be?S0D:E0D),t.maxBodyLength>-1?be.maxBodyLength=t.maxBodyLength:be.maxBodyLength=1/0,t.insecureHTTPParser&&(be.insecureHTTPParser=t.insecureHTTPParser),P=Me.request(be,function(St){if(P.destroyed)return;let _t=[St],qe=+St.headers["content-length"];if(re||ne){let Mt=new $kl({maxRate:Kf.toFiniteNumber(ne)});re&&Mt.on("progress",wYh(Mt,MQa(qe,Gfi(BQa(re),!0,3)))),_t.push(Mt)}let De=St,Qt=St.req||P;if(t.decompress!==!1&&St.headers["content-encoding"])switch((l==="HEAD"||St.statusCode===204)&&delete St.headers["content-encoding"],(St.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":_t.push(Jfi.default.createUnzip(OYh)),delete St.headers["content-encoding"];break;case"deflate":_t.push(new vYh),_t.push(Jfi.default.createUnzip(OYh)),delete St.headers["content-encoding"];break;case"br":AYh&&(_t.push(Jfi.default.createBrotliDecompress(j0D)),delete St.headers["content-encoding"])}De=_t.length>1?RYi.default.pipeline(_t,Kf.noop):_t[0];let Xe=RYi.default.finished(De,()=>{Xe(),M()}),Xt={status:St.statusCode,statusText:St.statusMessage,headers:new SK(St.headers),config:t,request:Qt};if(u==="stream")Xt.data=De,W5r(n,i,Xt);else{let Mt=[],Ke=0;De.on("data",function(ur){Mt.push(ur),Ke+=ur.length,t.maxContentLength>-1&&Ke>t.maxContentLength&&(A=!0,De.destroy(),i(new hm("maxContentLength size of "+t.maxContentLength+" exceeded",hm.ERR_BAD_RESPONSE,t,Qt)))}),De.on("aborted",function(){if(A)return;let ur=new hm("stream has been aborted",hm.ERR_BAD_RESPONSE,t,Qt);De.destroy(ur),i(ur)}),De.on("error",function(ur){P.destroyed||i(hm.from(ur,null,t,Qt))}),De.on("end",function(){try{let ur=Mt.length===1?Mt[0]:Buffer.concat(Mt);u!=="arraybuffer"&&(ur=ur.toString(s),(!s||s==="utf8")&&(ur=Kf.stripBOM(ur))),Xt.data=ur}catch(ur){return i(hm.from(ur,null,t,Xt.request,Xt))}W5r(n,i,Xt)})}C.once("abort",Mt=>{De.destroyed||(De.emit("error",Mt),De.destroy())})}),C.once("abort",Se=>{i(Se),P.destroy(Se)}),P.on("error",function(St){i(hm.from(St,null,t,P))}),P.on("socket",function(St){St.setKeepAlive(!0,1e3*60)}),t.timeout){let Se=parseInt(t.timeout,10);if(Number.isNaN(Se)){i(new hm("error trying to parse `config.timeout` to int",hm.ERR_BAD_OPTION_VALUE,t,P));return}P.setTimeout(Se,function(){if(m)return;let _t=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",qe=t.transitional||DQa;t.timeoutErrorMessage&&(_t=t.timeoutErrorMessage),i(new hm(_t,qe.clarifyTimeoutError?hm.ETIMEDOUT:hm.ECONNABORTED,t,P)),T()})}if(Kf.isStream(o)){let Se=!1,St=!1;o.on("end",()=>{Se=!0}),o.once("error",_t=>{St=!0,P.destroy(_t)}),o.on("close",()=>{!Se&&!St&&T(new Vtt("Request stream has been aborted",t,P))}),o.pipe(P)}else P.end(o)})};var qYh=d4.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,d4.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(d4.origin),d4.navigator&&/(msie|trident)/i.test(d4.navigator.userAgent)):()=>!0;var RYh=d4.hasStandardBrowserEnv?{write(e,t,r,n,i,a){let o=[e+"="+encodeURIComponent(t)];Kf.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Kf.isString(n)&&o.push("path="+n),Kf.isString(i)&&o.push("domain="+i),a===!0&&o.push("secure"),document.cookie=o.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 NYh=e=>e instanceof SK?{...e}:e;function TIr(e,t){t=t||{};let r={};function n(u,s,l,m){return Kf.isPlainObject(u)&&Kf.isPlainObject(s)?Kf.merge.call({caseless:m},u,s):Kf.isPlainObject(s)?Kf.merge({},s):Kf.isArray(s)?s.slice():s}function i(u,s,l,m){if(Kf.isUndefined(s)){if(!Kf.isUndefined(u))return n(void 0,u,l,m)}else return n(u,s,l,m)}function a(u,s){if(!Kf.isUndefined(s))return n(void 0,s)}function o(u,s){if(Kf.isUndefined(s)){if(!Kf.isUndefined(u))return n(void 0,u)}else return n(void 0,s)}function c(u,s,l){if(l in t)return n(u,s);if(l in e)return n(void 0,u)}let f={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:c,headers:(u,s,l)=>i(NYh(u),NYh(s),l,!0)};return Kf.forEach(Object.keys({...e,...t}),function(s){let l=f[s]||i,m=l(e[s],t[s],s);Kf.isUndefined(m)&&l!==c||(r[s]=m)}),r}var odu=e=>{let t=TIr({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:a,headers:o,auth:c}=t;if(t.headers=o=SK.from(o),t.url=MYi(BYi(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),Kf.isFormData(r)){if(d4.hasStandardBrowserEnv||d4.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Kf.isFunction(r.getHeaders)){let f=r.getHeaders(),u=["content-type","content-length"];Object.entries(f).forEach(([s,l])=>{u.includes(s.toLowerCase())&&o.set(s,l)})}}if(d4.hasStandardBrowserEnv&&(n&&Kf.isFunction(n)&&(n=n(t)),n||n!==!1&&qYh(t.url))){let f=i&&a&&RYh.read(a);f&&o.set(i,f)}return t};var T0D=typeof XMLHttpRequest<"u",xYh=T0D&&function(e){return new Promise(function(r,n){let i=odu(e),a=i.data,o=SK.from(i.headers).normalize(),{responseType:c,onUploadProgress:f,onDownloadProgress:u}=i,s,l,m,A,P;function C(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let M=new XMLHttpRequest;M.open(i.method.toUpperCase(),i.url,!0),M.timeout=i.timeout;function T(){if(!M)return;let U=SK.from("getAllResponseHeaders"in M&&M.getAllResponseHeaders()),V={data:!c||c==="text"||c==="json"?M.responseText:M.response,status:M.status,statusText:M.statusText,headers:U,config:e,request:M};W5r(function(re){r(re),C()},function(re){n(re),C()},V),M=null}"onloadend"in M?M.onloadend=T:M.onreadystatechange=function(){!M||M.readyState!==4||M.status===0&&!(M.responseURL&&M.responseURL.indexOf("file:")===0)||setTimeout(T)},M.onabort=function(){M&&(n(new hm("Request aborted",hm.ECONNABORTED,e,M)),M=null)},M.onerror=function(R){let V=R&&R.message?R.message:"Network Error",$=new hm(V,hm.ERR_NETWORK,e,M);$.event=R||null,n($),M=null},M.ontimeout=function(){let R=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded",V=i.transitional||DQa;i.timeoutErrorMessage&&(R=i.timeoutErrorMessage),n(new hm(R,V.clarifyTimeoutError?hm.ETIMEDOUT:hm.ECONNABORTED,e,M)),M=null},a===void 0&&o.setContentType(null),"setRequestHeader"in M&&Kf.forEach(o.toJSON(),function(R,V){M.setRequestHeader(V,R)}),Kf.isUndefined(i.withCredentials)||(M.withCredentials=!!i.withCredentials),c&&c!=="json"&&(M.responseType=i.responseType),u&&([m,P]=Gfi(u,!0),M.addEventListener("progress",m)),f&&M.upload&&([l,A]=Gfi(f),M.upload.addEventListener("progress",l),M.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(s=U=>{M&&(n(!U||U.type?new Vtt(null,e,M):U),M.abort(),M=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));let z=j6o(i.url);if(z&&d4.protocols.indexOf(z)===-1){n(new hm("Unsupported protocol "+z+":",hm.ERR_BAD_REQUEST,e));return}M.send(a||null)})};var q0D=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,a=function(u){if(!i){i=!0,c();let s=u instanceof Error?u:this.reason;n.abort(s instanceof hm?s:new Vtt(s instanceof Error?s.message:s))}},o=t&&setTimeout(()=>{o=null,a(new hm(`timeout ${t} of ms exceeded`,hm.ETIMEDOUT))},t),c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(a):u.removeEventListener("abort",a)}),e=null)};e.forEach(u=>u.addEventListener("abort",a));let{signal:f}=n;return f.unsubscribe=()=>Kf.asap(c),f}},FYh=q0D;var R0D=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},N0D=async function*(e,t){for await(let r of x0D(e))yield*R0D(r,t)},x0D=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},kkl=(e,t,r,n)=>{let i=N0D(e,t),a=0,o,c=f=>{o||(o=!0,n&&n(f))};return new ReadableStream({async pull(f){try{let{done:u,value:s}=await i.next();if(u){c(),f.close();return}let l=s.byteLength;if(r){let m=a+=l;r(m)}f.enqueue(new Uint8Array(s))}catch(u){throw c(u),u}},cancel(f){return c(f),i.return()}},{highWaterMark:2})};var zYh=64*1024,{isFunction:sdu}=Kf,F0D=(({Request:e,Response:t})=>({Request:e,Response:t}))(Kf.global),{ReadableStream:QYh,TextEncoder:LYh}=Kf.global,UYh=(e,...t)=>{try{return!!e(...t)}catch{return!1}},z0D=e=>{e=Kf.merge.call({skipUndefined:!0},F0D,e);let{fetch:t,Request:r,Response:n}=e,i=t?sdu(t):typeof fetch=="function",a=sdu(r),o=sdu(n);if(!i)return!1;let c=i&&sdu(QYh),f=i&&(typeof LYh=="function"?(P=>C=>P.encode(C))(new LYh):async P=>new Uint8Array(await new r(P).arrayBuffer())),u=a&&c&&UYh(()=>{let P=!1,C=new r(d4.origin,{body:new QYh,method:"POST",get duplex(){return P=!0,"half"}}).headers.has("Content-Type");return P&&!C}),s=o&&c&&UYh(()=>Kf.isReadableStream(new n("").body)),l={stream:s&&(P=>P.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(P=>{!l[P]&&(l[P]=(C,M)=>{let T=C&&C[P];if(T)return T.call(C);throw new hm(`Response type '${P}' is not supported`,hm.ERR_NOT_SUPPORT,M)})});let m=async P=>{if(P==null)return 0;if(Kf.isBlob(P))return P.size;if(Kf.isSpecCompliantForm(P))return(await new r(d4.origin,{method:"POST",body:P}).arrayBuffer()).byteLength;if(Kf.isArrayBufferView(P)||Kf.isArrayBuffer(P))return P.byteLength;if(Kf.isURLSearchParams(P)&&(P=P+""),Kf.isString(P))return(await f(P)).byteLength},A=async(P,C)=>{let M=Kf.toFiniteNumber(P.getContentLength());return M??m(C)};return async P=>{let{url:C,method:M,data:T,signal:z,cancelToken:U,timeout:R,onDownloadProgress:V,onUploadProgress:$,responseType:re,headers:Y,withCredentials:te="same-origin",fetchOptions:ne}=odu(P),Ae=t||fetch;re=re?(re+"").toLowerCase():"text";let ge=FYh([z,U&&U.toAbortSignal()],R),ve=null,be=ge&&ge.unsubscribe&&(()=>{ge.unsubscribe()}),Me;try{if($&&u&&M!=="get"&&M!=="head"&&(Me=await A(Y,T))!==0){let De=new r(C,{method:"POST",body:T,duplex:"half"}),Qt;if(Kf.isFormData(T)&&(Qt=De.headers.get("content-type"))&&Y.setContentType(Qt),De.body){let[Xe,Xt]=MQa(Me,Gfi(BQa($)));T=kkl(De.body,zYh,Xe,Xt)}}Kf.isString(te)||(te=te?"include":"omit");let Be=a&&"credentials"in r.prototype,Se={...ne,signal:ge,method:M.toUpperCase(),headers:Y.normalize().toJSON(),body:T,duplex:"half",credentials:Be?te:void 0};ve=a&&new r(C,Se);let St=await(a?Ae(ve,ne):Ae(C,Se)),_t=s&&(re==="stream"||re==="response");if(s&&(V||_t&&be)){let De={};["status","statusText","headers"].forEach(Mt=>{De[Mt]=St[Mt]});let Qt=Kf.toFiniteNumber(St.headers.get("content-length")),[Xe,Xt]=V&&MQa(Qt,Gfi(BQa(V),!0))||[];St=new n(kkl(St.body,zYh,Xe,()=>{Xt&&Xt(),be&&be()}),De)}re=re||"text";let qe=await l[Kf.findKey(l,re)||"text"](St,P);return!_t&&be&&be(),await new Promise((De,Qt)=>{W5r(De,Qt,{data:qe,headers:SK.from(St.headers),status:St.status,statusText:St.statusText,config:P,request:ve})})}catch(Be){throw be&&be(),Be&&Be.name==="TypeError"&&/Load failed|fetch/i.test(Be.message)?Object.assign(new hm("Network Error",hm.ERR_NETWORK,P,ve),{cause:Be.cause||Be}):hm.from(Be,Be&&Be.code,P,ve)}}},Q0D=new Map,eef=e=>{let t=e?e.env:{},{fetch:r,Request:n,Response:i}=t,a=[n,i,r],o=a.length,c=o,f,u,s=Q0D;for(;c--;)f=a[c],u=s.get(f),u===void 0&&s.set(f,u=c?new Map:z0D(t)),s=u;return u},kZL=eef();var tef={http:TYh,xhr:xYh,fetch:{get:eef}};Kf.forEach(tef,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var VYh=e=>`- ${e}`,U0D=e=>Kf.isFunction(e)||e===null||e===!1,udu={getAdapter:(e,t)=>{e=Kf.isArray(e)?e:[e];let{length:r}=e,n,i,a={};for(let o=0;o<r;o++){n=e[o];let c;if(i=n,!U0D(n)&&(i=tef[(c=String(n)).toLowerCase()],i===void 0))throw new hm(`Unknown adapter '${c}'`);if(i&&(Kf.isFunction(i)||(i=i.get(t))))break;a[c||"#"+o]=i}if(!i){let o=Object.entries(a).map(([f,u])=>`adapter ${f} `+(u===!1?"is not supported by the environment":"is not available in the build")),c=r?o.length>1?`since :
@@ -2400,7 +2400,7 @@ ${R}${z}${V}${OVa}`});function Dmu({message:e,error:t,logger:r,logLevel:n=E1.Err
2400
2400
  Run ${gd.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
2401
2401
  Run ${gd.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),qQa(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function phf({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!Zwy(e))return;let i=t??"",a=e.filter(c=>c.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let o=a.sort((c,f)=>c.generatorName.localeCompare(f.generatorName)||c.currentVersion.localeCompare(f.currentVersion));for(let c of o)i+=`
2402
2402
  ${await aeC(c.generatorName)} (${c.apiName!=null?"API: "+c.apiName+", ":""}Group: ${c.generatorGroup}) `+gd.dim(c.currentVersion)+gd.reset(" \u2192 ")+gd.green(c.latestVersion);return i+=`
2403
- `,n?qQa(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function aeC(e){let r=await new Xwy.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 oeC({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await ejy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,u,s,l)=>{c.versions[u]==null&&(c.versions[u]={});let m=DDi(s.name,l),A=await z7r({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:l});A!=null&&(c.versions[u][s.name]={previousVersion:s.version,latestVersion:A})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await ejy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,u,s)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=DDi(u.name,s),m=await z7r({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:s});m!=null&&(o.versions[c][f][u.name]={previousVersion:u.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function ejy({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await lIr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(i!=null&&f.groupName!==i))for(let u of f.generators)n!=null&&u.name!==n||await r(a.workspaceName,f.groupName,u,o)}})}))}function tjy(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${i} has an upgrade available...`);let f=Cxe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function Bmu({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await oeC({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[f,u]of Object.entries(c.versions))o.push(...tjy(u,f,t.logger));else o.push(...tjy(c.versions,void 0,t.logger))}return o}var y8o=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText||"",o=`${i} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var jVa=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var _hf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)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(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),rjy=typeof globalThis.AbortController=="function",njy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",ijy=typeof globalThis.ReadableStream=="function",ajy=typeof globalThis.FormData=="function",Tmu=["get","post","put","patch","head","delete"],seC=()=>{};seC();var ojy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},qmu=2147483647,sjy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Rmu=Symbol("stop"),ujy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},cjy={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 ueC=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=sjy,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},ljy=(e,t)=>{let r=Number(e.headers.get("content-length"))||0,n=0;return e.status===204?(t&&t({percent:1,totalBytes:r,transferredBytes:n},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(i){let a=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array);async function o(){let{done:c,value:f}=await a.read();if(c){i.close();return}if(t){n+=f.byteLength;let u=r===0?0:n/r;t({percent:u,transferredBytes:n,totalBytes:r},f)}i.enqueue(f),await o()}await o()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},fjy=(e,t,r)=>{let n=ueC(r??e.body),i=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(a){let o=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function c(){let{done:f,value:u}=await o.read();if(f){t&&t({percent:1,transferredBytes:i,totalBytes:Math.max(n,i)},new Uint8Array),a.close();return}i+=u.byteLength;let s=n===0?0:i/n;(n<i||s===1)&&(s=.99),t&&t({percent:Number(s.toFixed(2)),transferredBytes:i,totalBytes:n},u),a.enqueue(u),await c()}await c()}})})};var EVa=e=>e!==null&&typeof e=="object";var v8o=(...e)=>{for(let t of e)if((!EVa(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return vhf({},...e)},hhf=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,o]of i.entries())n&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function Nmu(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:vhf(e[r]??[],t[r]??[])}var yhf=(e={},t={})=>({beforeRequest:Nmu(e,t,"beforeRequest"),beforeRetry:Nmu(e,t,"beforeRetry"),afterResponse:Nmu(e,t,"afterResponse"),beforeError:Nmu(e,t,"beforeError")}),vhf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(EVa(i)){for(let[a,o]of Object.entries(i))EVa(o)&&a in t&&(o=vhf(t[a],o)),t={...t,[a]:o};EVa(i.hooks)&&(n=yhf(n,i.hooks),t.hooks=n),EVa(i.headers)&&(r=hhf(r,i.headers),t.headers=r)}return t};var pjy=e=>Tmu.includes(e)?e.toUpperCase():e,ceC=["get","put","head","delete","options","trace"],leC=[408,413,429,500,502,503,504],feC=[413,429,503],djy={limit:2,methods:ceC,statusCodes:leC,afterStatusCodes:feC,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},_jy=(e={})=>{if(typeof e=="number")return{...djy,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{...djy,...e}};async function bhf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new jVa(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function ghf(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var hjy=(e,t)=>{let r={};for(let n in t)!(n in cjy)&&!(n in ujy)&&!(n in e)&&(r[n]=t[n]);return r},yjy=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e=="object"?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!!e;var b8o=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>qmu)throw new RangeError(`The \`timeout\` option cannot be greater than ${qmu}`);await Promise.resolve();let c=await n._fetch();for(let f of n._options.hooks.afterResponse){let u=await f(n.request,n._options,n._decorateResponse(c.clone()));u instanceof globalThis.Response&&(c=u)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let f=new y8o(c,n.request,n._options);for(let u of n._options.hooks.beforeError)f=await u(f);throw f}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!ijy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return ljy(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{n.request.bodyUsed||await n.request.body?.cancel()});for(let[c,f]of Object.entries(ojy))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||f);let u=await o;if(c==="json"){if(u.status===204)return"";let s=await u.text();return s===""?"":r.parseJson?r.parseJson(s):JSON.parse(s)}return u[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:hhf(this._input.headers,r.headers),hooks:yhf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:pjy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:_jy(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(rjy&&njy){let n=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=n?AbortSignal.any([n,this.abortController.signal]):this.abortController.signal}if(_hf&&(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),yjy(this._options.searchParams)){let i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(ajy&&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)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!_hf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=fjy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof jVa)throw t;if(t instanceof y8o){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let n=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(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let a=this._options.retry.maxRetryAfter??i;return i<a?i: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 n=Math.min(this._calculateRetryDelay(r),qmu);if(this._retryCount<1)throw r;await ghf(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===Rmu)return;return this._retry(t)}}async _fetch(){for(let n of this._options.hooks.beforeRequest){let i=await n(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=hjy(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):bhf(r,t,this.abortController,this._options)}};var mhf=e=>{let t=(r,n)=>b8o.create(r,v8o(e,n));for(let r of Tmu)t[r]=(n,i)=>b8o.create(n,v8o(e,i,{method:r}));return t.create=r=>mhf(v8o(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),mhf(v8o(e,r))),t.stop=Rmu,t},deC=mhf(),vjy=deC;var Qjy=aa(zjy(),1);function jhf(e){let t=(0,Qjy.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var q1y=aa(T1y(),1),R1y=aa(xzr(),1),Fhf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},zhf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Qhf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??jhf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,q1y.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,c&&(f.authorization=`${c.type} ${c.token}`);let u;try{u=await vjy(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new Fhf(e):l}if(t.allVersions)return u;let s=new zhf(e,r);if(u["dist-tags"][r]){let{time:l}=u;u=u.versions[u["dist-tags"][r]],u.time=l}else if(r){let l=!!u.versions[r];if(n&&!l)for(let[A,P]of Object.entries(u.versions))P.deprecated&&delete u.versions[A];if(!l){let A=Object.keys(u.versions);if(r=R1y.default.maxSatisfying(A,r),!r)throw s}let{time:m}=u;if(u=u.versions[r],u.time=m,!u)throw s}return u}async function w8o(e,t){let{version:r}=await Qhf(e.toLowerCase(),t);return r}async function sBi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:w8o(e.packageName,{version:t?"prerelease":"latest"})}var N1y=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],Kmu=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=E1.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new Mmu(t,r),this.isLocal=n??!1;let i=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(i==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.80.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${gd.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new zoe}failWithoutThrowing(t,r){this.didSucceed=!1,Dmu({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await wQa()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await kwy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
2403
+ `,n?qQa(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function aeC(e){let r=await new Xwy.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 oeC({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await ejy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(f,u,s,l)=>{c.versions[u]==null&&(c.versions[u]={});let m=DDi(s.name,l),A=await z7r({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:l});A!=null&&(c.versions[u][s.name]={previousVersion:s.version,latestVersion:A})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await ejy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,f,u,s)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][f]==null&&(o.versions[c][f]={});let l=DDi(u.name,s),m=await z7r({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:s});m!=null&&(o.versions[c][f][u.name]={previousVersion:u.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function ejy({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:n,groupFilter:i}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async o=>{let c=await lIr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let f of c.groups)if(!(i!=null&&f.groupName!==i))for(let u of f.generators)n!=null&&u.name!==n||await r(a.workspaceName,f.groupName,u,o)}})}))}function tjy(e,t,r){let n=[];for(let[i,a]of Object.entries(e))for(let[o,c]of Object.entries(a)){r.debug(`Checking if ${o} in group ${i} has an upgrade available...`);let f=Cxe(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(f?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:f,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function Bmu({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await oeC({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[f,u]of Object.entries(c.versions))o.push(...tjy(u,f,t.logger));else o.push(...tjy(c.versions,void 0,t.logger))}return o}var y8o=class extends Error{response;request;options;constructor(t,r,n){let i=t.status||t.status===0?t.status:"",a=t.statusText||"",o=`${i} ${a}`.trim(),c=o?`status code ${o}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=n}};var jVa=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var _hf=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)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(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return e&&!t})(),rjy=typeof globalThis.AbortController=="function",njy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",ijy=typeof globalThis.ReadableStream=="function",ajy=typeof globalThis.FormData=="function",Tmu=["get","post","put","patch","head","delete"],seC=()=>{};seC();var ojy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},qmu=2147483647,sjy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Rmu=Symbol("stop"),ujy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},cjy={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 ueC=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=sjy,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof n=="string"?new TextEncoder().encode(n).length:n.size;return t}if(e instanceof Blob)return e.size;if(e instanceof ArrayBuffer)return e.byteLength;if(typeof e=="string")return new TextEncoder().encode(e).length;if(e instanceof URLSearchParams)return new TextEncoder().encode(e.toString()).length;if("byteLength"in e)return e.byteLength;if(typeof e=="object"&&e!==null)try{let t=JSON.stringify(e);return new TextEncoder().encode(t).length}catch{return 0}return 0},ljy=(e,t)=>{let r=Number(e.headers.get("content-length"))||0,n=0;return e.status===204?(t&&t({percent:1,totalBytes:r,transferredBytes:n},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(i){let a=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array);async function o(){let{done:c,value:f}=await a.read();if(c){i.close();return}if(t){n+=f.byteLength;let u=r===0?0:n/r;t({percent:u,transferredBytes:n,totalBytes:r},f)}i.enqueue(f),await o()}await o()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},fjy=(e,t,r)=>{let n=ueC(r??e.body),i=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(a){let o=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function c(){let{done:f,value:u}=await o.read();if(f){t&&t({percent:1,transferredBytes:i,totalBytes:Math.max(n,i)},new Uint8Array),a.close();return}i+=u.byteLength;let s=n===0?0:i/n;(n<i||s===1)&&(s=.99),t&&t({percent:Number(s.toFixed(2)),transferredBytes:i,totalBytes:n},u),a.enqueue(u),await c()}await c()}})})};var EVa=e=>e!==null&&typeof e=="object";var v8o=(...e)=>{for(let t of e)if((!EVa(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return vhf({},...e)},hhf=(e={},t={})=>{let r=new globalThis.Headers(e),n=t instanceof globalThis.Headers,i=new globalThis.Headers(t);for(let[a,o]of i.entries())n&&o==="undefined"||o===void 0?r.delete(a):r.set(a,o);return r};function Nmu(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:vhf(e[r]??[],t[r]??[])}var yhf=(e={},t={})=>({beforeRequest:Nmu(e,t,"beforeRequest"),beforeRetry:Nmu(e,t,"beforeRetry"),afterResponse:Nmu(e,t,"afterResponse"),beforeError:Nmu(e,t,"beforeError")}),vhf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(EVa(i)){for(let[a,o]of Object.entries(i))EVa(o)&&a in t&&(o=vhf(t[a],o)),t={...t,[a]:o};EVa(i.hooks)&&(n=yhf(n,i.hooks),t.hooks=n),EVa(i.headers)&&(r=hhf(r,i.headers),t.headers=r)}return t};var pjy=e=>Tmu.includes(e)?e.toUpperCase():e,ceC=["get","put","head","delete","options","trace"],leC=[408,413,429,500,502,503,504],feC=[413,429,503],djy={limit:2,methods:ceC,statusCodes:leC,afterStatusCodes:feC,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},_jy=(e={})=>{if(typeof e=="number")return{...djy,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{...djy,...e}};async function bhf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new jVa(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function ghf(e,{signal:t}){return new Promise((r,n)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(a),n(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",i),r()},e)})}var hjy=(e,t)=>{let r={};for(let n in t)!(n in cjy)&&!(n in ujy)&&!(n in e)&&(r[n]=t[n]);return r},yjy=e=>e===void 0?!1:Array.isArray(e)?e.length>0:e instanceof URLSearchParams?e.size>0:typeof e=="object"?Object.keys(e).length>0:typeof e=="string"?e.trim().length>0:!!e;var b8o=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>qmu)throw new RangeError(`The \`timeout\` option cannot be greater than ${qmu}`);await Promise.resolve();let c=await n._fetch();for(let f of n._options.hooks.afterResponse){let u=await f(n.request,n._options,n._decorateResponse(c.clone()));u instanceof globalThis.Response&&(c=u)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let f=new y8o(c,n.request,n._options);for(let u of n._options.hooks.beforeError)f=await u(f);throw f}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!ijy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return ljy(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{n.request.bodyUsed||await n.request.body?.cancel()});for(let[c,f]of Object.entries(ojy))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||f);let u=await o;if(c==="json"){if(u.status===204)return"";let s=await u.text();return s===""?"":r.parseJson?r.parseJson(s):JSON.parse(s)}return u[c]()});return o}static#e(t){return t&&typeof t=="object"&&!Array.isArray(t)&&!(t instanceof URLSearchParams)?Object.fromEntries(Object.entries(t).filter(([,r])=>r!==void 0)):t}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:hhf(this._input.headers,r.headers),hooks:yhf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:pjy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:_jy(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(rjy&&njy){let n=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=n?AbortSignal.any([n,this.abortController.signal]):this.abortController.signal}if(_hf&&(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),yjy(this._options.searchParams)){let i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(e.#e(this._options.searchParams)).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(ajy&&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)}if(this._options.onUploadProgress){if(typeof this._options.onUploadProgress!="function")throw new TypeError("The `onUploadProgress` option must be a function");if(!_hf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=fjy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof jVa)throw t;if(t instanceof y8o){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let n=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(n&&this._options.retry.afterStatusCodes.includes(t.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let a=this._options.retry.maxRetryAfter??i;return i<a?i: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 n=Math.min(this._calculateRetryDelay(r),qmu);if(this._retryCount<1)throw r;await ghf(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===Rmu)return;return this._retry(t)}}async _fetch(){for(let n of this._options.hooks.beforeRequest){let i=await n(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let t=hjy(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):bhf(r,t,this.abortController,this._options)}};var mhf=e=>{let t=(r,n)=>b8o.create(r,v8o(e,n));for(let r of Tmu)t[r]=(n,i)=>b8o.create(n,v8o(e,i,{method:r}));return t.create=r=>mhf(v8o(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),mhf(v8o(e,r))),t.stop=Rmu,t},deC=mhf(),vjy=deC;var Qjy=aa(zjy(),1);function jhf(e){let t=(0,Qjy.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var q1y=aa(T1y(),1),R1y=aa(xzr(),1),Fhf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},zhf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function Qhf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??jhf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,q1y.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,c&&(f.authorization=`${c.type} ${c.token}`);let u;try{u=await vjy(o,{headers:f,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new Fhf(e):l}if(t.allVersions)return u;let s=new zhf(e,r);if(u["dist-tags"][r]){let{time:l}=u;u=u.versions[u["dist-tags"][r]],u.time=l}else if(r){let l=!!u.versions[r];if(n&&!l)for(let[A,P]of Object.entries(u.versions))P.deprecated&&delete u.versions[A];if(!l){let A=Object.keys(u.versions);if(r=R1y.default.maxSatisfying(A,r),!r)throw s}let{time:m}=u;if(u=u.versions[r],u.time=m,!u)throw s}return u}async function w8o(e,t){let{version:r}=await Qhf(e.toLowerCase(),t);return r}async function sBi({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:w8o(e.packageName,{version:t?"prerelease":"latest"})}var N1y=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],Kmu=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=E1.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new Mmu(t,r),this.isLocal=n??!1;let i=this.getPackageName(),a=this.getPackageVersion(),o=this.getCliName();(i==null||a==null||o==null)&&this.exitProgram(),this.environment={packageName:i,packageVersion:a,cliName:o}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.80.1"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${gd.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new zoe}failWithoutThrowing(t,r){this.didSucceed=!1,Dmu({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await wQa()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((n,i)=>setTimeout(()=>i("Request timed out"),300))]),r=await kwy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
2404
2404
  `)||(r+=`
2405
2405
  `),this.stderr.info(r))}catch{}}async exitIfFailed(){this.didSucceed||await this.exit()}exitProgram({code:t}={}){process.exit(t??(this.didSucceed?0:1))}longestWorkspaceName;registerWorkspaces(t){let r=OFl(t.map(n=>n.type==="docs"?"docs":n.workspaceName??"api"),n=>n.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new l8o(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let n=this.addTaskWithInit(t).start(),i;try{i=await r(n)}catch(a){throw a.message.includes("globalThis")?(n.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),n.failWithoutThrowing()):n.failWithoutThrowing(void 0,a),new zoe}finally{n.finish()}return i}async instrumentPostHogEvent(t){this.isLocal||(await wQa()).sendEvent(t)}logger=e4r((t,...r)=>this.log(t,...r));stderr=e4r((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=x1y(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?x1y(this.longestWorkspaceName):r).length,i=r.padEnd(n),a=N1y[this.numTasks++%N1y.length],o=gd.hex(a)(i);return{...this.constructTaskInit(),logPrefix:o}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===C9.Failure&&(this.didSucceed=!1)},instrumentPostHogEvent:async t=>{await this.instrumentPostHogEvent(t)},shouldBufferLogs:!1}}log(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}])}logStderr(t,...r){this.logImmediately([{parts:r,level:t,time:new Date}],{stderr:!0})}logImmediately(t,{stderr:r=!1}={}){let n=t.filter(i=>QSi.indexOf(i.level)>=QSi.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===E1.Debug,stderr:r})}_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 sBi({cliEnvironment:this.environment,includePreReleases:t}),n=Cxe(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},a=await Bmu({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await Z_f({message:t,default:r})}async getInput(t){return await k_f({message:t.message,default:t.default})}};function x1y(e){return`[${e}]:`}var iMr=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:n,absoluteFilePath:i,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=n,this.absoluteFilePath=i,this.changelog=a}};var yrt=class extends iMr{definition;sources;type="fern";constructor({definition:t,sources:r,...n}){super(n),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace(){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var Gdi={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!1,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1};function j8o({options:e,overrides:t}){return{enableUniqueErrorsPerEndpoint:t?.enableUniqueErrorsPerEndpoint??e?.enableUniqueErrorsPerEndpoint??Gdi.enableUniqueErrorsPerEndpoint,detectGlobalHeaders:t?.detectGlobalHeaders??e?.detectGlobalHeaders??Gdi.detectGlobalHeaders,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??Gdi.objectQueryParameters,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??Gdi.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??Gdi.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??Gdi.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??Gdi.inlinePathParameters,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??Gdi.useBytesForBinaryResponse,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??Gdi.respectForwardCompatibleEnums}}var cPe={openapi:e=>({...e,type:"openapi",_visit:function(t){return cPe._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return cPe._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 TVa={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return TVa._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var $fe={basic:e=>({...e,type:"basic",_visit:function(t){return $fe._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return $fe._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return $fe._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return $fe._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return $fe._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 ED={primitive:e=>({value:e,type:"primitive",_visit:function(t){return ED._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return ED._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return ED._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return ED._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return ED._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return ED._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return ED._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return ED._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 pO={int:e=>({value:e,type:"int",_visit:function(t){return pO._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return pO._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return pO._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return pO._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return pO._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return pO._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return pO._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return pO._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return pO._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return pO._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return pO._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 uBi={boolean:e=>({value:e,type:"boolean",_visit:function(t){return uBi._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return uBi._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 cBi={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return cBi._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return cBi._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 $mu={};mf($mu,{Availability:()=>Yfe,CustomCodeSample:()=>QQr,EndpointExample:()=>__t,EndpointResponseExample:()=>h_t,HttpMethod:()=>Zfe,LiteralSchemaValue:()=>J9,MultipartRequestPropertyEncoding:()=>Vhf,MultipartSchema:()=>LQr,OneOfSchema:()=>UQr,Pagination:()=>vrt,PrimitiveSchemaValue:()=>KT,Request:()=>aMr,Response:()=>xve,RetriesConfiguration:()=>E8o,Schema:()=>xw,SupportedSdkLanguage:()=>Xfe,WebhookHttpMethod:()=>Uhf,WebsocketMessageOrigin:()=>Lhf});var Lhf={Client:"client",Server:"server",_visit:(e,t)=>{switch(e){case Lhf.Client:return t.client();case Lhf.Server:return t.server();default:return t._other()}}};var Uhf={Get:"GET",Post:"POST",_visit:(e,t)=>{switch(e){case Uhf.Get:return t.get();case Uhf.Post:return t.post();default:return t._other()}}};var Yfe={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case Yfe.GenerallyAvailable:return t.generallyAvailable();case Yfe.Beta:return t.beta();case Yfe.Deprecated:return t.deprecated();default:return t._other()}}};var E8o={disabled:e=>({value:e,type:"disabled",_visit:function(t){return E8o._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"disabled":return t.disabled(e.value);default:return t._other(e)}}};var vrt={cursor:e=>({...e,type:"cursor",_visit:function(t){return vrt._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return vrt._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return vrt._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"cursor":return t.cursor(e);case"offset":return t.offset(e);case"custom":return t.custom(e);default:return t._other(e)}}};var QQr={language:e=>({...e,type:"language",_visit:function(t){return QQr._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return QQr._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 Xfe={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 Xfe.Curl:return t.curl();case Xfe.Python:return t.python();case Xfe.Javascript:return t.javascript();case Xfe.Typescript:return t.typescript();case Xfe.Go:return t.go();case Xfe.Ruby:return t.ruby();case Xfe.Csharp:return t.csharp();case Xfe.Java:return t.java();case Xfe.Js:return t.js();case Xfe.Node:return t.node();case Xfe.Ts:return t.ts();case Xfe.Nodets:return t.nodets();case Xfe.Golang:return t.golang();case Xfe.Dotnet:return t.dotnet();case Xfe.Jvm:return t.jvm();default:return t._other()}}};var __t={unknown:e=>({value:e,type:"unknown",_visit:function(t){return __t._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return __t._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 h_t={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return h_t._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return h_t._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 Zfe={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case Zfe.Get:return t.get();case Zfe.Post:return t.post();case Zfe.Put:return t.put();case Zfe.Patch:return t.patch();case Zfe.Delete:return t.delete();case Zfe.Head:return t.head();case Zfe.Options:return t.options();case Zfe.Trace:return t.trace();default:return t._other()}}};var aMr={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return aMr._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return aMr._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return aMr._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return aMr._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var Vhf={Json:"json",Form:"form",_visit:(e,t)=>{switch(e){case Vhf.Json:return t.json();case Vhf.Form:return t.form();default:return t._other()}}};var LQr={file:e=>({...e,type:"file",_visit:function(t){return LQr._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return LQr._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 xve={file:e=>({...e,type:"file",_visit:function(t){return xve._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return xve._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return xve._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return xve._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return xve._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return xve._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return xve._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var xw={primitive:e=>({...e,type:"primitive",_visit:function(t){return xw._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return xw._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return xw._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return xw._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return xw._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return xw._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return xw._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return xw._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return xw._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return xw._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return xw._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 KT={int:e=>({...e,type:"int",_visit:function(t){return KT._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return KT._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return KT._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return KT._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return KT._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return KT._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return KT._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return KT._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return KT._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return KT._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return KT._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 J9={boolean:e=>({value:e,type:"boolean",_visit:function(t){return J9._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return J9._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 UQr={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return UQr._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return UQr._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 UDe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return UDe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return UDe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return UDe._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return UDe._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"octetStream":return t.octetStream(e);case"multipart":return t.multipart(e);case"json":return t.json(e);case"formUrlEncoded":return t.formUrlEncoded(e);default:return t._other(e)}}};var dL={file:e=>({...e,type:"file",_visit:function(t){return dL._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return dL._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return dL._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return dL._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return dL._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return dL._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return dL._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"file":return t.file(e);case"json":return t.json(e);case"text":return t.text(e);case"bytes":return t.bytes(e);case"streamingSse":return t.streamingSse(e);case"streamingText":return t.streamingText(e);case"streamingJson":return t.streamingJson(e);default:return t._other(e)}}};var ay={primitive:e=>({...e,type:"primitive",_visit:function(t){return ay._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return ay._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return ay._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return ay._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return ay._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return ay._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return ay._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return ay._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return ay._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return ay._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return ay._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 VDe={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return VDe._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return VDe._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 M0={int:e=>({...e,type:"int",_visit:function(t){return M0._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return M0._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return M0._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return M0._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return M0._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return M0._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return M0._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return M0._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return M0._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return M0._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return M0._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 lj={};mf(lj,{AllOfPropertyConflict:()=>aWa,ArraySchema:()=>fAu,ArraySchemaWithExample:()=>UAu,Availability:()=>aOu,Base64WithExample:()=>xAu,BasicSecurityScheme:()=>sOu,BearerSecurityScheme:()=>uOu,BooleanSchema:()=>aAu,BooleanWithExample:()=>FAu,BytesResponse:()=>$Va,CasingOverrides:()=>fOu,CommonProperty:()=>gAu,CommonPropertyWithExample:()=>XAu,CursorPagination:()=>UOu,CustomCodeSample:()=>QOu,CustomCodeSampleLanguage:()=>xOu,CustomCodeSampleSdk:()=>zOu,CustomPagination:()=>WOu,DateWithExample:()=>NAu,DatetimeWithExample:()=>RAu,DiscriminatedOneOfSchema:()=>vAu,DiscriminatedOneOfSchemaWithExample:()=>$Au,DoubleSchema:()=>nAu,DoubleWithExample:()=>TAu,Encoding:()=>iOu,Endpoint:()=>HOu,EndpointExample:()=>kVa,EndpointResponseExample:()=>NOu,EndpointSdkName:()=>HQr,EndpointSecurity:()=>LVa,EndpointWithExample:()=>pEy,EnumSchema:()=>FVa,EnumSchemaWithExample:()=>QAu,EnumValue:()=>dBi,ErrorExample:()=>MOu,FernExample:()=>TOu,FileResponse:()=>JVa,FileSchema:()=>POu,FloatWithExample:()=>BAu,FormUrlEncodedRequest:()=>DOu,FullEndpointExample:()=>LOu,FullExample:()=>N8,FullObjectExample:()=>bOu,FullOneOfExample:()=>mOu,GlobalHeader:()=>sAu,Header:()=>_Bi,HeaderExample:()=>ZVa,HeaderSecurityScheme:()=>cOu,HeaderWithExample:()=>vBi,HttpEndpointServer:()=>YVa,HttpError:()=>BOu,HttpErrorWithExample:()=>SAu,HttpMethod:()=>UVa,IdempotencyHeader:()=>uAu,Int64WithExample:()=>CAu,IntSchema:()=>tAu,IntWithExample:()=>DAu,JsonRequest:()=>SOu,JsonRequestWithExample:()=>PAu,JsonResponse:()=>KVa,JsonResponseWithExample:()=>uWa,KeyValuePair:()=>gOu,LiteralExample:()=>vOu,LiteralSchema:()=>iWa,LiteralSchemaValue:()=>cAu,LongSchema:()=>rAu,MapSchema:()=>dAu,MapSchemaWithExample:()=>VAu,MultipartRequest:()=>GVa,MultipartRequestProperty:()=>EOu,MultipartRequestPropertyEncoding:()=>jOu,MultipartSchema:()=>wOu,NamedFullExample:()=>v_t,Namespace:()=>dOu,NamespaceId:()=>yOu,NullableSchema:()=>_Au,NullableSchemaWithExample:()=>HAu,OauthSecurityScheme:()=>_Ou,ObjectProperty:()=>yAu,ObjectPropertyConflictInfo:()=>oWa,ObjectPropertyWithExample:()=>KAu,ObjectSchema:()=>lAu,ObjectSchemaWithExample:()=>GAu,OctetStreamRequest:()=>HVa,OffsetPagination:()=>VOu,OneOfSchema:()=>hAu,OneOfSchemaWithExample:()=>JAu,OpenApiIntermediateRepresentation:()=>fEy,OpenApiSource:()=>eOu,OptionalSchema:()=>pAu,OptionalSchemaWithExample:()=>WAu,Pagination:()=>eWa,ParseFormUrlEncodedRequest:()=>wAu,ParseMultipartRequest:()=>AAu,ParseOctetStreamRequest:()=>OAu,PathParameter:()=>VVa,PathParameterExample:()=>qOu,PathParameterWithExample:()=>mAu,PrimitiveExample:()=>QVa,PrimitiveSchema:()=>yBi,PrimitiveSchemaValue:()=>oAu,PrimitiveSchemaValueWithExample:()=>zAu,PrimitiveSchemaWithExample:()=>cWa,PropertyKey:()=>zVa,ProtobufEncoding:()=>nOu,ProtobufSource:()=>tOu,QueryParameter:()=>WVa,QueryParameterExample:()=>XVa,QueryParameterWithExample:()=>sWa,QuerySecurityScheme:()=>lOu,ReferencedSchema:()=>GQr,Request:()=>COu,RequestWithExample:()=>jAu,Response:()=>IOu,ResponseWithExample:()=>EAu,RetriesConfiguration:()=>tWa,Schema:()=>eI,SchemaId:()=>WDe,SchemaWithExample:()=>y6,Schemas:()=>eAu,SdkGroup:()=>pOu,SdkGroupInfo:()=>OOu,SdkGroupName:()=>pBi,SecurityScheme:()=>hOu,SecuritySchemeId:()=>xVa,Server:()=>I8o,Source:()=>rOu,StatusCode:()=>VQr,StreamingResponseExample:()=>ROu,StringSchema:()=>iAu,StringSchemaWithExample:()=>qAu,SupportedSdkLanguage:()=>FOu,Tag:()=>oOu,TagId:()=>HDe,Tags:()=>AOu,TextResponse:()=>hBi,Uint64WithExample:()=>MAu,UintWithExample:()=>IAu,UnDiscriminatedOneOfSchema:()=>bAu,UnDiscriminatedOneOfSchemaWithExample:()=>YAu,UnknownSchemaWithExample:()=>LAu,Webhook:()=>GOu,WebhookExampleCall:()=>nWa,WebhookHttpMethod:()=>rWa,WebhookWithExample:()=>_Ey,WebsocketChannel:()=>kOu,WebsocketHandshake:()=>JOu,WebsocketHandshakeWithExample:()=>dEy,WebsocketMessageExample:()=>XOu,WebsocketMessageOrigin:()=>KOu,WebsocketMessageSchema:()=>$Ou,WebsocketServer:()=>YOu,WebsocketSessionExample:()=>ZOu,WithAvailability:()=>mP,WithDescription:()=>Xy,WithEncoding:()=>Mxe,WithInline:()=>h6,WithName:()=>zS,WithNamespace:()=>kE,WithSdkGroupName:()=>YI,WithSdkMethodName:()=>WQr,WithSource:()=>QA,WithStatusCode:()=>y_t,WithTitle:()=>$I,commons:()=>Khf,example:()=>$hf,finalIr:()=>Yhf,parseIr:()=>Xhf});var Khf={};mf(Khf,{BasicSecurityScheme:()=>sOu,BearerSecurityScheme:()=>uOu,Encoding:()=>iOu,HeaderSecurityScheme:()=>cOu,Namespace:()=>dOu,NamespaceId:()=>yOu,OauthSecurityScheme:()=>_Ou,OpenApiSource:()=>eOu,ProtobufEncoding:()=>nOu,ProtobufSource:()=>tOu,QuerySecurityScheme:()=>lOu,SchemaId:()=>WDe,SdkGroup:()=>pOu,SdkGroupName:()=>pBi,SecurityScheme:()=>hOu,SecuritySchemeId:()=>xVa,Server:()=>I8o,Source:()=>rOu,StatusCode:()=>VQr,Tag:()=>oOu,TagId:()=>HDe,WithAvailability:()=>mP,WithDescription:()=>Xy,WithEncoding:()=>Mxe,WithInline:()=>h6,WithName:()=>zS,WithNamespace:()=>kE,WithSdkGroupName:()=>YI,WithSdkMethodName:()=>WQr,WithSource:()=>QA,WithStatusCode:()=>y_t,WithTitle:()=>$I});var Gr={};mf(Gr,{JsonError:()=>qVa,ParseError:()=>RVa,any:()=>Z1y,bigint:()=>z1y,boolean:()=>k1y,booleanLiteral:()=>X1y,date:()=>Q1y,discriminant:()=>uEy,enum_:()=>Xmu,getObjectLikeUtils:()=>oMr,getObjectUtils:()=>$Zi,getSchemaUtils:()=>R8,isProperty:()=>fBi,lazy:()=>L1y,lazyObject:()=>K1y,list:()=>kmu,number:()=>eEy,object:()=>Zmu,objectWithoutOptionalProperties:()=>J1y,optional:()=>Whf,property:()=>V1y,record:()=>iEy,set:()=>aEy,string:()=>tEy,stringLiteral:()=>Y1y,transform:()=>Hhf,undiscriminatedUnion:()=>sEy,union:()=>lEy,unknown:()=>rEy,withParsedProperties:()=>Jhf});var $T={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 v4(e,t){return`Expected ${t}. Received ${btC(e)}.`}function btC(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 kfe(e){return{...e,json:F1y(e.json),parse:F1y(e.parse)}}function F1y(e){return(t,r)=>{let n=e(t,r),{skipValidation:i=!1}=r??{};return!n.ok&&i?(console.warn(["Failed to validate.",...n.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
2406
2406
  `)),{ok:!0,value:t}):n}}function Ymu(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var qVa=class e extends Error{errors;constructor(t){super(t.map(Ymu).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var RVa=class e extends Error{errors;constructor(t){super(t.map(Ymu).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function R8(e){return{optional:()=>Whf(e),transform:t=>Hhf(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new RVa(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new qVa(n.errors)}}}function Whf(e){let t={parse:(r,n)=>r==null?{ok:!0,value:void 0}:e.parse(r,n),json:(r,n)=>n?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,n),getType:()=>$T.OPTIONAL};return{...t,...R8(t)}}function Hhf(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(n,i)=>{let a=t.untransform(n);return e.json(a,i)},getType:()=>e.getType()};return{...r,...R8(r)}}function z1y(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:v4(t,"string")}]}:{ok:!0,value:BigInt(t)},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t.toString()}:{ok:!1,errors:[{path:r,message:v4(t,"bigint")}]},getType:()=>$T.BIGINT};return{...kfe(e),...R8(e)}}var gtC=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function Q1y(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:v4(t,"string")}]}:gtC.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:v4(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:v4(t,"Date object")}]},getType:()=>$T.DATE};return{...kfe(e),...R8(e)}}function lPe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...kfe(r),...R8(r)}}}function Xmu(e){let t=new Set(e);return lPe($T.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:v4(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:v4(n,"enum")}]}:{ok:!0,value:n})()}function L1y(e){let t=Ghf(e);return{...t,...R8(t)}}function Ghf(e){return{parse:(t,r)=>NVa(e).parse(t,r),json:(t,r)=>NVa(e).json(t,r),getType:()=>NVa(e).getType()}}function NVa(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function S8o(e){return Object.entries(e)}function D8o(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function lBi(e){if(typeof e!="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function C8o(e){return Object.keys(e)}function U1y(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function oMr(e){return{withParsedProperties:t=>Jhf(e,t)}}function Jhf(e,t){let r={parse:(n,i)=>{let a=e.parse(n,i);if(!a.ok)return a;let o=Object.entries(t).reduce((c,[f,u])=>({...c,[f]:typeof u=="function"?u(a.value):u}),{});return{ok:!0,value:{...a.value,...o}}},json:(n,i)=>{if(!lBi(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:v4(n,"object")}]};let a=new Set(Object.keys(t)),o=D8o(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(o,i)},getType:()=>e.getType()};return{...r,...R8(r),...oMr(r)}}function V1y(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function fBi(e){return e.isProperty}function Zmu(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>fBi(n)?n.rawKey:r),_getParsedProperties:()=>C8o(e),parse:(r,n)=>{let i={},a=[];for(let[o,c]of S8o(e)){let f=fBi(c)?c.rawKey:o,u=fBi(c)?c.valueSchema:c,s={rawKey:f,parsedKey:o,valueSchema:u};i[f]=s,G1y(u)&&a.push(f)}return W1y({value:r,requiredKeys:a,getProperty:o=>{let c=i[o];if(c!=null)return{transformedKey:c.parsedKey,transform:f=>c.valueSchema.parse(f,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],o]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:(r,n)=>{let i=[];for(let[a,o]of S8o(e)){let c=fBi(o)?o.valueSchema:o;G1y(c)&&i.push(a)}return W1y({value:r,requiredKeys:i,getProperty:a=>{let o=e[a];if(o!=null)return fBi(o)?{transformedKey:o.rawKey,transform:c=>o.valueSchema.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>o.json(c,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:()=>$T.OBJECT};return{...kfe(t),...R8(t),...oMr(t),...$Zi(t)}}function W1y({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!lBi(e))return{ok:!1,errors:[{path:a,message:v4(e,"object")}]};let o=new Set(t),c=[],f={};for(let[u,s]of Object.entries(e)){let l=r(u);if(l!=null){o.delete(u);let m=l.transform(s);m.ok?f[l.transformedKey]=m.value:(f[u]=s,c.push(...m.errors))}else switch(n){case"fail":c.push({path:[...a,u],message:`Unexpected key "${u}"`});break;case"strip":break;case"passthrough":f[u]=s;break}}return c.push(...t.filter(u=>o.has(u)).map(u=>({path:a,message:`Missing required key "${u}"`}))),c.length===0||i?{ok:!0,value:f}:{ok:!1,errors:c}}function $Zi(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>H1y({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>H1y({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>$T.OBJECT};return{...r,...R8(r),...oMr(r),...$Zi(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,n)=>{let i=e.parse(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},json:(r,n)=>{let i=e.json(r,{...n,unrecognizedObjectKeys:"passthrough"});return i.ok?{ok:!0,value:{...r,...i.value}}:i},getType:()=>$T.OBJECT};return{...t,...R8(t),...oMr(t),...$Zi(t)}}}}function H1y({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,o]=U1y(C8o(t),u=>i.has(u)),c=r(D8o(t,o)),f=n(D8o(t,a));return c.ok&&f.ok?{ok:!0,value:{...c.value,...f.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...f.ok?[]:f.errors]}}function G1y(e){return!mtC(e)}function mtC(e){switch(e.getType()){case $T.ANY:case $T.UNKNOWN:case $T.OPTIONAL:return!0;default:return!1}}function J1y(e){return Zmu(e)}function K1y(e){let t={...Ghf(e),_getRawProperties:()=>NVa(e)._getRawProperties(),_getParsedProperties:()=>NVa(e)._getParsedProperties()};return{...t,...R8(t),...oMr(t),...$Zi(t)}}function kmu(e){let t={parse:(r,n)=>$1y(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>$1y(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>$T.LIST};return{...kfe(t),...R8(t)}}function $1y(e,t){return Array.isArray(e)?e.map((n,i)=>t(n,i)).reduce((n,i)=>{if(n.ok&&i.ok)return{ok:!0,value:[...n.value,i.value]};let a=[];return n.ok||a.push(...n.errors),i.ok||a.push(...i.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:v4(e,"list"),path:[]}]}}function Y1y(e){return lPe($T.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:v4(r,`"${e}"`)}]})()}function X1y(e){return lPe($T.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:v4(r,`${e.toString()}`)}]})()}var Z1y=lPe($T.ANY,e=>({ok:!0,value:e}));var k1y=lPe($T.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:v4(e,"boolean")}]});var eEy=lPe($T.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:v4(e,"number")}]});var tEy=lPe($T.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:v4(e,"string")}]});var rEy=lPe($T.UNKNOWN,e=>({ok:!0,value:e}));function iEy(e,t){let r={parse:(n,i)=>nEy({value:n,isKeyNumeric:e.getType()===$T.NUMBER,transformKey:a=>e.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.parse(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),json:(n,i)=>nEy({value:n,isKeyNumeric:e.getType()===$T.NUMBER,transformKey:a=>e.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,o)=>t.json(a,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`${o}`]}),breadcrumbsPrefix:i?.breadcrumbsPrefix}),getType:()=>$T.RECORD};return{...kfe(r),...R8(r)}}function nEy({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return lBi(e)?S8o(e).reduce((a,[o,c])=>{if(c==null)return a;let f=a,u=o;if(t){let A=o.length>0?Number(o):NaN;isNaN(A)||(u=A)}let s=r(u),l=n(c,u);if(f.ok&&s.ok&&l.ok)return{ok:!0,value:{...f.value,[s.value]:l.value}};let m=[];return f.ok||m.push(...f.errors),s.ok||m.push(...s.errors),l.ok||m.push(...l.errors),{ok:!1,errors:m}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:v4(e,"object")}]}}function aEy(e){let t=kmu(e),r={parse:(n,i)=>{let a=t.parse(n,i);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(n,i)=>n instanceof Set?t.json([...n],i):{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:v4(n,"Set")}]},getType:()=>$T.SET};return{...kfe(r),...R8(r)}}function sEy(e){let t={parse:(r,n)=>oEy((i,a)=>i.parse(r,a),e,n),json:(r,n)=>oEy((i,a)=>i.json(r,a),e,n),getType:()=>$T.UNDISCRIMINATED_UNION};return{...kfe(t),...R8(t)}}function oEy(e,t,r){let n=[];for(let[i,a]of t.entries()){let o=e(a,{...r,skipValidation:!1});if(o.ok)return o;for(let c of o.errors)n.push({path:c.path,message:`[Variant ${i}] ${c.message}`})}return{ok:!1,errors:n}}function uEy(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function lEy(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=Xmu(C8o(t)),a={parse:(o,c)=>cEy({value:o,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:f=>i.parse(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.parse(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>cEy({value:o,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:f=>i.json(f,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:f=>t[f],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,u)=>u.json(f,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>$T.UNION};return{...kfe(a),...R8(a),...oMr(a)}}function cEy({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!lBi(e))return{ok:!1,errors:[{path:c,message:v4(e,"object")}]};let{[t]:f,...u}=e;if(f==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let s=n(f);if(!s.ok)return{ok:!1,errors:s.errors};let l=i(s.value);if(l==null)return a?{ok:!0,value:{[r]:s.value,...u}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let m=o(u,l);return m.ok?{ok:!0,value:{[r]:f,...m.value}}:m}var $I=Gr.objectWithoutOptionalProperties({title:Gr.string().optional()});var eOu=Gr.objectWithoutOptionalProperties({file:Gr.string()});var tOu=Gr.objectWithoutOptionalProperties({file:Gr.string()});var rOu=Gr.union("type",{openapi:eOu,protobuf:tOu}).transform({transform:e=>{switch(e.type){case"openapi":return cPe.openapi(e);case"protobuf":return cPe.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var QA=Gr.objectWithoutOptionalProperties({source:rOu.optional()});var nOu=Gr.objectWithoutOptionalProperties({typeName:Gr.string()});var iOu=Gr.union("type",{protobuf:nOu}).transform({transform:e=>{switch(e.type){case"protobuf":return TVa.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Mxe=Gr.objectWithoutOptionalProperties({encoding:iOu.optional()});var Xy=Gr.objectWithoutOptionalProperties({description:Gr.string().optional()});var aOu=Gr.enum_(["GenerallyAvailable","Beta","Deprecated"]);var mP=Gr.objectWithoutOptionalProperties({availability:aOu.optional()});var VQr=Gr.number();var y_t=Gr.objectWithoutOptionalProperties({statusCode:VQr.optional()});var zS=Gr.objectWithoutOptionalProperties({nameOverride:Gr.string().optional(),generatedName:Gr.string()});var h6=Gr.objectWithoutOptionalProperties({inline:Gr.boolean().optional()});var WDe=Gr.string();var HDe=Gr.string();var oOu=Gr.objectWithoutOptionalProperties({id:HDe}).extend(Xy);var xVa=Gr.string();var sOu=Gr.objectWithoutOptionalProperties({usernameVariableName:Gr.string().optional(),usernameEnvVar:Gr.string().optional(),passwordVariableName:Gr.string().optional(),passwordEnvVar:Gr.string().optional()});var uOu=Gr.objectWithoutOptionalProperties({tokenVariableName:Gr.string().optional(),tokenEnvVar:Gr.string().optional()});var cOu=Gr.objectWithoutOptionalProperties({headerName:Gr.string(),prefix:Gr.string().optional(),headerVariableName:Gr.string().optional(),headerEnvVar:Gr.string().optional()});var lOu=Gr.objectWithoutOptionalProperties({queryParameterName:Gr.string()});var fOu=Gr.objectWithoutOptionalProperties({snake:Gr.string().optional(),camel:Gr.string().optional(),screamingSnake:Gr.string().optional(),pascal:Gr.string().optional()});var dBi=Gr.objectWithoutOptionalProperties({nameOverride:Gr.string().optional(),generatedName:Gr.string(),value:Gr.string(),casing:fOu.optional()}).extend(Xy).extend(mP);var dOu=Gr.objectWithoutOptionalProperties({type:Gr.stringLiteral("namespace"),name:Gr.string()});var pOu=Gr.undiscriminatedUnion([Gr.string(),dOu]);var pBi=Gr.list(pOu);var YI=Gr.objectWithoutOptionalProperties({groupName:pBi.optional()});var kE=Gr.objectWithoutOptionalProperties({namespace:Gr.string().optional()});var FVa=Gr.objectWithoutOptionalProperties({default:dBi.optional(),values:Gr.list(dBi)}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend(QA).extend($I).extend(h6);var _Ou=Gr.objectWithoutOptionalProperties({scopesEnum:FVa.optional()});var hOu=Gr.union("type",{basic:sOu,bearer:uOu,header:cOu,query:lOu,oauth:_Ou}).transform({transform:e=>{switch(e.type){case"basic":return $fe.basic(e);case"bearer":return $fe.bearer(e);case"header":return $fe.header(e);case"query":return $fe.query(e);case"oauth":return $fe.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var I8o=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),url:Gr.string(),audiences:Gr.list(Gr.string()).optional()}).extend(Xy);var yOu=Gr.string();var WQr=Gr.objectWithoutOptionalProperties({sdkMethodName:Gr.string().optional()});var $hf={};mf($hf,{FullExample:()=>N8,FullObjectExample:()=>bOu,FullOneOfExample:()=>mOu,KeyValuePair:()=>gOu,LiteralExample:()=>vOu,PrimitiveExample:()=>QVa,PropertyKey:()=>zVa});var zVa=Gr.string();var QVa=Gr.union("type",{int:Gr.object({value:Gr.number()}),int64:Gr.object({value:Gr.number()}),uint:Gr.object({value:Gr.number()}),uint64:Gr.object({value:Gr.number()}),float:Gr.object({value:Gr.number()}),double:Gr.object({value:Gr.number()}),string:Gr.object({value:Gr.string()}),datetime:Gr.object({value:Gr.string()}),date:Gr.object({value:Gr.string()}),base64:Gr.object({value:Gr.string()}),boolean:Gr.object({value:Gr.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return pO.int(e.value);case"int64":return pO.int64(e.value);case"uint":return pO.uint(e.value);case"uint64":return pO.uint64(e.value);case"float":return pO.float(e.value);case"double":return pO.double(e.value);case"string":return pO.string(e.value);case"datetime":return pO.datetime(e.value);case"date":return pO.date(e.value);case"base64":return pO.base64(e.value);case"boolean":return pO.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var vOu=Gr.union("type",{boolean:Gr.object({value:Gr.boolean()}),string:Gr.object({value:Gr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return uBi.boolean(e.value);case"string":return uBi.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var N8=Gr.union("type",{primitive:Gr.object({value:QVa}),object:Gr.lazyObject(()=>bOu),array:Gr.object({value:Gr.list(Gr.lazy(()=>N8))}),map:Gr.object({value:Gr.list(Gr.lazyObject(()=>gOu))}),enum:Gr.object({value:Gr.string()}),literal:Gr.object({value:vOu}),oneOf:Gr.object({value:Gr.lazy(()=>mOu)}),unknown:Gr.object({value:Gr.lazy(()=>N8)})}).transform({transform:e=>{switch(e.type){case"primitive":return ED.primitive(e.value);case"object":return ED.object(e);case"array":return ED.array(e.value);case"map":return ED.map(e.value);case"enum":return ED.enum(e.value);case"literal":return ED.literal(e.value);case"oneOf":return ED.oneOf(e.value);case"unknown":return ED.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var bOu=Gr.objectWithoutOptionalProperties({properties:Gr.record(zVa,Gr.lazy(()=>N8))});var gOu=Gr.objectWithoutOptionalProperties({key:QVa,value:Gr.lazy(()=>N8)});var mOu=Gr.union("type",{discriminated:Gr.object({value:Gr.record(zVa,Gr.lazy(()=>N8))}),undiscriminated:Gr.object({value:Gr.lazy(()=>N8)})}).transform({transform:e=>{switch(e.type){case"discriminated":return cBi.discriminated(e.value);case"undiscriminated":return cBi.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Yhf={};mf(Yhf,{AllOfPropertyConflict:()=>aWa,ArraySchema:()=>fAu,Availability:()=>aOu,BooleanSchema:()=>aAu,BytesResponse:()=>$Va,CasingOverrides:()=>fOu,CommonProperty:()=>gAu,CursorPagination:()=>UOu,CustomCodeSample:()=>QOu,CustomCodeSampleLanguage:()=>xOu,CustomCodeSampleSdk:()=>zOu,CustomPagination:()=>WOu,DiscriminatedOneOfSchema:()=>vAu,DoubleSchema:()=>nAu,Endpoint:()=>HOu,EndpointExample:()=>kVa,EndpointResponseExample:()=>NOu,EndpointSdkName:()=>HQr,EndpointSecurity:()=>LVa,EnumSchema:()=>FVa,EnumValue:()=>dBi,ErrorExample:()=>MOu,FernExample:()=>TOu,FileResponse:()=>JVa,FileSchema:()=>POu,FormUrlEncodedRequest:()=>DOu,FullEndpointExample:()=>LOu,GlobalHeader:()=>sAu,Header:()=>_Bi,HeaderExample:()=>ZVa,HttpEndpointServer:()=>YVa,HttpError:()=>BOu,HttpMethod:()=>UVa,IdempotencyHeader:()=>uAu,IntSchema:()=>tAu,JsonRequest:()=>SOu,JsonResponse:()=>KVa,LiteralSchema:()=>iWa,LiteralSchemaValue:()=>cAu,LongSchema:()=>rAu,MapSchema:()=>dAu,MultipartRequest:()=>GVa,MultipartRequestProperty:()=>EOu,MultipartRequestPropertyEncoding:()=>jOu,MultipartSchema:()=>wOu,NullableSchema:()=>_Au,ObjectProperty:()=>yAu,ObjectPropertyConflictInfo:()=>oWa,ObjectSchema:()=>lAu,OctetStreamRequest:()=>HVa,OffsetPagination:()=>VOu,OneOfSchema:()=>hAu,OpenApiIntermediateRepresentation:()=>fEy,OptionalSchema:()=>pAu,Pagination:()=>eWa,PathParameter:()=>VVa,PathParameterExample:()=>qOu,PrimitiveSchema:()=>yBi,PrimitiveSchemaValue:()=>oAu,QueryParameter:()=>WVa,QueryParameterExample:()=>XVa,ReferencedSchema:()=>GQr,Request:()=>COu,Response:()=>IOu,RetriesConfiguration:()=>tWa,Schema:()=>eI,Schemas:()=>eAu,SdkGroupInfo:()=>OOu,StreamingResponseExample:()=>ROu,StringSchema:()=>iAu,SupportedSdkLanguage:()=>FOu,Tags:()=>AOu,TextResponse:()=>hBi,UnDiscriminatedOneOfSchema:()=>bAu,Webhook:()=>GOu,WebhookExampleCall:()=>nWa,WebhookHttpMethod:()=>rWa,WebsocketChannel:()=>kOu,WebsocketHandshake:()=>JOu,WebsocketMessageExample:()=>XOu,WebsocketMessageOrigin:()=>KOu,WebsocketMessageSchema:()=>$Ou,WebsocketServer:()=>YOu,WebsocketSessionExample:()=>ZOu});var OOu=Gr.objectWithoutOptionalProperties({summary:Gr.string().optional(),description:Gr.string().optional()});var AOu=Gr.objectWithoutOptionalProperties({tagsById:Gr.record(HDe,oOu),orderedTagIds:Gr.list(HDe).optional()});var LVa=Gr.list(Gr.record(xVa,Gr.list(Gr.string())));var UVa=Gr.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var VVa=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>eI),variableReference:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Xy).extend(mP).extend(QA);var WVa=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>eI),parameterNameOverride:Gr.string().optional()}).extend(Xy).extend(mP).extend(QA);var _Bi=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>eI),env:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Xy).extend(mP).extend(QA);var HQr=Gr.objectWithoutOptionalProperties({groupName:pBi,methodName:Gr.string()});var HVa=Gr.objectWithoutOptionalProperties({contentType:Gr.string().optional()}).extend(Xy).extend(QA);var POu=Gr.objectWithoutOptionalProperties({isOptional:Gr.boolean(),isArray:Gr.boolean()}).extend(Xy);var wOu=Gr.union("type",{file:POu,json:Gr.object({value:Gr.lazy(()=>eI)})}).transform({transform:e=>{switch(e.type){case"file":return LQr.file(e);case"json":return LQr.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var jOu=Gr.enum_(["json","form"]);var EOu=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:wOu,contentType:Gr.string().optional(),exploded:Gr.boolean().optional(),encoding:jOu.optional()}).extend(Xy);var GVa=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),properties:Gr.list(EOu)}).extend(Xy).extend(QA);var SOu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>eI),contentType:Gr.string().optional(),additionalProperties:Gr.boolean()}).extend(Xy).extend(QA);var DOu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>eI),contentType:Gr.string().optional(),additionalProperties:Gr.boolean()}).extend(Xy).extend(QA);var COu=Gr.union("type",{octetStream:HVa,multipart:GVa,json:SOu,formUrlEncoded:DOu}).transform({transform:e=>{switch(e.type){case"octetStream":return aMr.octetStream(e);case"multipart":return aMr.multipart(e);case"json":return aMr.json(e);case"formUrlEncoded":return aMr.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var JVa=Gr.objectWithoutOptionalProperties({}).extend(Xy).extend(QA).extend(y_t);var KVa=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>eI),responseProperty:Gr.string().optional()}).extend(Xy).extend(QA).extend(y_t);var hBi=Gr.objectWithoutOptionalProperties({}).extend(Xy).extend(QA).extend(y_t);var $Va=Gr.objectWithoutOptionalProperties({}).extend(Xy).extend(QA).extend(y_t);var IOu=Gr.union("type",{file:JVa,json:KVa,text:hBi,bytes:$Va,streamingSse:KVa,streamingText:hBi,streamingJson:KVa}).transform({transform:e=>{switch(e.type){case"file":return xve.file(e);case"json":return xve.json(e);case"text":return xve.text(e);case"bytes":return xve.bytes(e);case"streamingSse":return xve.streamingSse(e);case"streamingText":return xve.streamingText(e);case"streamingJson":return xve.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var MOu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),description:Gr.string().optional(),example:Gr.lazy(()=>N8)});var BOu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>eI).optional(),examples:Gr.list(MOu).optional()}).extend(Xy).extend(zS).extend(QA);var YVa=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),url:Gr.string().optional(),audiences:Gr.list(Gr.string()).optional()});var TOu=Gr.unknown();var qOu=Gr.objectWithoutOptionalProperties({name:Gr.string(),parameterNameOverride:Gr.string().optional(),value:Gr.lazy(()=>N8)});var XVa=Gr.objectWithoutOptionalProperties({name:Gr.string(),value:Gr.lazy(()=>N8)});var ZVa=Gr.objectWithoutOptionalProperties({name:Gr.string(),value:Gr.lazy(()=>N8)});var ROu=Gr.objectWithoutOptionalProperties({sse:Gr.boolean(),events:Gr.list(Gr.lazy(()=>N8))});var NOu=Gr.union("type",{withStreaming:ROu,withoutStreaming:Gr.object({value:Gr.lazy(()=>N8)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return h_t.withStreaming(e);case"withoutStreaming":return h_t.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var xOu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),language:Gr.string(),code:Gr.string(),install:Gr.string().optional()}).extend(Xy);var FOu=Gr.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var zOu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),sdk:FOu,code:Gr.string()}).extend(Xy);var QOu=Gr.union("type",{language:xOu,sdk:zOu}).transform({transform:e=>{switch(e.type){case"language":return QQr.language(e);case"sdk":return QQr.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var LOu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),pathParameters:Gr.list(qOu).optional(),queryParameters:Gr.list(XVa).optional(),headers:Gr.list(ZVa).optional(),request:Gr.lazy(()=>N8).optional(),response:NOu.optional(),codeSamples:Gr.list(QOu)}).extend(Xy);var kVa=Gr.union("type",{unknown:Gr.object({value:TOu}),full:LOu}).transform({transform:e=>{switch(e.type){case"unknown":return __t.unknown(e.value);case"full":return __t.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var UOu=Gr.objectWithoutOptionalProperties({cursor:Gr.string(),nextCursor:Gr.property("next_cursor",Gr.string()),results:Gr.string()});var VOu=Gr.objectWithoutOptionalProperties({offset:Gr.string(),results:Gr.string(),step:Gr.string().optional(),hasNextPage:Gr.string().optional()});var WOu=Gr.objectWithoutOptionalProperties({results:Gr.string()});var eWa=Gr.union("type",{cursor:UOu,offset:VOu,custom:WOu}).transform({transform:e=>{switch(e.type){case"cursor":return vrt.cursor(e);case"offset":return vrt.offset(e);case"custom":return vrt.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var tWa=Gr.union("type",{disabled:Gr.object({value:Gr.boolean().optional()})}).transform({transform:e=>{switch(e.type){case"disabled":return E8o.disabled(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var HOu=Gr.objectWithoutOptionalProperties({authed:Gr.boolean(),security:LVa,internal:Gr.boolean().optional(),idempotent:Gr.boolean().optional(),method:UVa,audiences:Gr.list(Gr.string()),path:Gr.string(),summary:Gr.string().optional(),operationId:Gr.string().optional(),tags:Gr.list(HDe),pathParameters:Gr.list(VVa),queryParameters:Gr.list(WVa),headers:Gr.list(_Bi),sdkName:HQr.optional(),generatedRequestName:Gr.string(),requestNameOverride:Gr.string().optional(),request:COu.optional(),response:IOu.optional(),errors:Gr.record(VQr,BOu),servers:Gr.list(YVa),examples:Gr.list(kVa),pagination:eWa.optional(),retries:tWa.optional()}).extend(Xy).extend(mP).extend(QA).extend(kE);var rWa=Gr.enum_(["GET","POST"]);var nWa=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),payload:Gr.lazy(()=>N8)}).extend(Xy);var GOu=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),sdkName:HQr.optional(),method:rWa,summary:Gr.string().optional(),operationId:Gr.string(),tags:Gr.list(HDe),headers:Gr.list(_Bi),generatedPayloadName:Gr.string(),payload:Gr.lazy(()=>eI),examples:Gr.list(nWa)}).extend(Xy).extend(QA).extend(kE);var JOu=Gr.objectWithoutOptionalProperties({queryParameters:Gr.list(WVa),headers:Gr.list(_Bi),pathParameters:Gr.list(VVa)});var KOu=Gr.enum_(["client","server"]);var $Ou=Gr.objectWithoutOptionalProperties({name:Gr.string(),origin:KOu,body:Gr.lazy(()=>eI)});var YOu=Gr.objectWithoutOptionalProperties({name:Gr.string(),url:Gr.string()});var XOu=Gr.objectWithoutOptionalProperties({messageType:Gr.string(),payload:Gr.lazy(()=>N8)}).extend(Xy);var ZOu=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),queryParameters:Gr.list(XVa).optional(),headers:Gr.list(ZVa).optional(),messages:Gr.list(XOu)}).extend(Xy);var kOu=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),path:Gr.string(),groupName:pBi,summary:Gr.string().optional(),handshake:JOu,messages:Gr.list($Ou),servers:Gr.list(YOu),examples:Gr.list(ZOu)}).extend(Xy).extend(QA);var eAu=Gr.objectWithoutOptionalProperties({rootSchemas:Gr.record(WDe,Gr.lazy(()=>eI)),namespacedSchemas:Gr.record(yOu,Gr.record(WDe,Gr.lazy(()=>eI)))});var tAu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional()});var rAu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional()});var nAu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional()});var iAu=Gr.objectWithoutOptionalProperties({default:Gr.string().optional(),pattern:Gr.string().optional(),format:Gr.string().optional(),minLength:Gr.number().optional(),maxLength:Gr.number().optional()});var aAu=Gr.objectWithoutOptionalProperties({default:Gr.boolean().optional()});var oAu=Gr.union("type",{int:tAu,int64:rAu,uint:Gr.object({}),uint64:Gr.object({}),float:Gr.object({}),double:nAu,string:iAu,datetime:Gr.object({}),date:Gr.object({}),base64:Gr.object({}),boolean:aAu}).transform({transform:e=>{switch(e.type){case"int":return KT.int(e);case"int64":return KT.int64(e);case"uint":return KT.uint();case"uint64":return KT.uint64();case"float":return KT.float();case"double":return KT.double(e);case"string":return KT.string(e);case"datetime":return KT.datetime();case"date":return KT.date();case"base64":return KT.base64();case"boolean":return KT.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var yBi=Gr.objectWithoutOptionalProperties({schema:oAu}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend($I);var sAu=Gr.objectWithoutOptionalProperties({header:Gr.string(),name:Gr.string().optional(),optional:Gr.boolean().optional(),env:Gr.string().optional(),schema:Gr.lazy(()=>eI).optional()});var uAu=Gr.objectWithoutOptionalProperties({header:Gr.string(),name:Gr.string().optional(),env:Gr.string().optional(),schema:Gr.lazy(()=>eI).optional()});var fEy=Gr.objectWithoutOptionalProperties({apiVersion:Gr.unknown().optional(),title:Gr.string().optional(),description:Gr.string().optional(),basePath:Gr.string().optional(),servers:Gr.list(I8o),websocketServers:Gr.list(I8o),groups:Gr.record(Gr.string(),OOu),tags:AOu,hasEndpointsMarkedInternal:Gr.boolean(),endpoints:Gr.list(HOu),webhooks:Gr.list(GOu),channels:Gr.record(Gr.string(),kOu),groupedSchemas:eAu,variables:Gr.record(Gr.string(),yBi),nonRequestReferencedSchemas:Gr.set(WDe),securitySchemes:Gr.record(xVa,hOu),globalHeaders:Gr.list(sAu).optional(),idempotencyHeaders:Gr.list(uAu).optional()});var GQr=Gr.objectWithoutOptionalProperties({schema:WDe}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend(QA).extend($I);var cAu=Gr.union("type",{boolean:Gr.object({value:Gr.boolean()}),string:Gr.object({value:Gr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return J9.boolean(e.value);case"string":return J9.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var iWa=Gr.objectWithoutOptionalProperties({value:cAu}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend($I);var eI=Gr.union("type",{primitive:yBi,object:Gr.lazyObject(()=>lAu),array:Gr.lazyObject(()=>fAu),map:Gr.lazyObject(()=>dAu),optional:Gr.lazyObject(()=>pAu),enum:FVa,reference:GQr,literal:iWa,oneOf:Gr.object({value:Gr.lazy(()=>hAu)}),nullable:Gr.lazyObject(()=>_Au),unknown:zS}).transform({transform:e=>{switch(e.type){case"primitive":return xw.primitive(e);case"object":return xw.object(e);case"array":return xw.array(e);case"map":return xw.map(e);case"optional":return xw.optional(e);case"enum":return xw.enum(e);case"reference":return xw.reference(e);case"literal":return xw.literal(e);case"oneOf":return xw.oneOf(e.value);case"nullable":return xw.nullable(e);case"unknown":return xw.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var aWa=Gr.objectWithoutOptionalProperties({propertyKey:Gr.string(),allOfSchemaIds:Gr.list(WDe),conflictingTypeSignatures:Gr.boolean()});var lAu=Gr.objectWithoutOptionalProperties({allOf:Gr.list(GQr),properties:Gr.list(Gr.lazyObject(()=>yAu)),allOfPropertyConflicts:Gr.list(aWa),additionalProperties:Gr.boolean()}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend(QA).extend($I).extend(h6);var oWa=Gr.objectWithoutOptionalProperties({differentSchema:Gr.boolean()});var yAu=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>eI),readonly:Gr.boolean().optional(),writeonly:Gr.boolean().optional(),conflict:Gr.record(WDe,oWa),generatedName:Gr.string(),nameOverride:Gr.string().optional(),audiences:Gr.list(Gr.string())}).extend(mP);var fAu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>eI)}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend($I).extend(h6);var dAu=Gr.objectWithoutOptionalProperties({key:yBi,value:Gr.lazy(()=>eI)}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend(Mxe).extend($I).extend(h6);var pAu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>eI)}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend($I).extend(h6);var _Au=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>eI)}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend($I).extend(h6);var hAu=Gr.union("type",{discriminated:Gr.lazyObject(()=>vAu),undiscriminated:Gr.lazyObject(()=>bAu)}).transform({transform:e=>{switch(e.type){case"discriminated":return UQr.discriminated(e);case"undiscriminated":return UQr.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var vAu=Gr.objectWithoutOptionalProperties({discriminantProperty:Gr.string(),commonProperties:Gr.list(Gr.lazyObject(()=>gAu)),schemas:Gr.record(Gr.string(),Gr.lazy(()=>eI))}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend(Mxe).extend(QA).extend($I).extend(h6);var gAu=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>eI)});var bAu=Gr.objectWithoutOptionalProperties({schemas:Gr.list(Gr.lazy(()=>eI))}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend(Mxe).extend(QA).extend($I).extend(h6);var Xhf={};mf(Xhf,{ArraySchemaWithExample:()=>UAu,Base64WithExample:()=>xAu,BooleanWithExample:()=>FAu,CommonPropertyWithExample:()=>XAu,DateWithExample:()=>NAu,DatetimeWithExample:()=>RAu,DiscriminatedOneOfSchemaWithExample:()=>$Au,DoubleWithExample:()=>TAu,EndpointWithExample:()=>pEy,EnumSchemaWithExample:()=>QAu,FloatWithExample:()=>BAu,HeaderWithExample:()=>vBi,HttpErrorWithExample:()=>SAu,Int64WithExample:()=>CAu,IntWithExample:()=>DAu,JsonRequestWithExample:()=>PAu,JsonResponseWithExample:()=>uWa,MapSchemaWithExample:()=>VAu,NamedFullExample:()=>v_t,NullableSchemaWithExample:()=>HAu,ObjectPropertyWithExample:()=>KAu,ObjectSchemaWithExample:()=>GAu,OneOfSchemaWithExample:()=>JAu,OptionalSchemaWithExample:()=>WAu,ParseFormUrlEncodedRequest:()=>wAu,ParseMultipartRequest:()=>AAu,ParseOctetStreamRequest:()=>OAu,PathParameterWithExample:()=>mAu,PrimitiveSchemaValueWithExample:()=>zAu,PrimitiveSchemaWithExample:()=>cWa,QueryParameterWithExample:()=>sWa,RequestWithExample:()=>jAu,ResponseWithExample:()=>EAu,SchemaWithExample:()=>y6,StringSchemaWithExample:()=>qAu,Uint64WithExample:()=>MAu,UintWithExample:()=>IAu,UnDiscriminatedOneOfSchemaWithExample:()=>YAu,UnknownSchemaWithExample:()=>LAu,WebhookWithExample:()=>_Ey,WebsocketHandshakeWithExample:()=>dEy});var v_t=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),value:Gr.unknown()}).extend(Xy);var sWa=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>y6),parameterNameOverride:Gr.string().optional()}).extend(Xy).extend(mP).extend(QA);var vBi=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>y6),env:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Xy).extend(mP).extend(QA);var dEy=Gr.objectWithoutOptionalProperties({queryParameters:Gr.list(sWa),headers:Gr.list(vBi)});var mAu=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>y6),variableReference:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(Xy).extend(mP).extend(QA);var OAu=Gr.objectWithoutOptionalProperties({}).extend(HVa).extend(WQr);var AAu=Gr.objectWithoutOptionalProperties({}).extend(GVa).extend(WQr);var PAu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>y6),contentType:Gr.string().optional(),fullExamples:Gr.list(v_t).optional(),additionalProperties:Gr.boolean()}).extend(Xy).extend(QA).extend(WQr);var wAu=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>y6),contentType:Gr.string().optional(),fullExamples:Gr.list(v_t).optional(),additionalProperties:Gr.boolean()}).extend(Xy).extend(QA).extend(WQr);var jAu=Gr.union("type",{octetStream:OAu,multipart:AAu,json:PAu,formUrlEncoded:wAu}).transform({transform:e=>{switch(e.type){case"octetStream":return UDe.octetStream(e);case"multipart":return UDe.multipart(e);case"json":return UDe.json(e);case"formUrlEncoded":return UDe.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var uWa=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>y6),responseProperty:Gr.string().optional(),fullExamples:Gr.list(v_t).optional()}).extend(Xy).extend(QA).extend(y_t);var EAu=Gr.union("type",{file:JVa,json:uWa,text:hBi,bytes:$Va,streamingSse:uWa,streamingText:hBi,streamingJson:uWa}).transform({transform:e=>{switch(e.type){case"file":return dL.file(e);case"json":return dL.json(e);case"text":return dL.text(e);case"bytes":return dL.bytes(e);case"streamingSse":return dL.streamingSse(e);case"streamingText":return dL.streamingText(e);case"streamingJson":return dL.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var SAu=Gr.objectWithoutOptionalProperties({statusCode:VQr,schema:Gr.lazy(()=>y6),fullExamples:Gr.list(v_t).optional()}).extend(Xy).extend(zS).extend(QA);var pEy=Gr.objectWithoutOptionalProperties({authed:Gr.boolean(),security:LVa,internal:Gr.boolean().optional(),idempotent:Gr.boolean().optional(),method:UVa,audiences:Gr.list(Gr.string()),path:Gr.string(),summary:Gr.string().optional(),operationId:Gr.string().optional(),tags:Gr.list(HDe),pathParameters:Gr.list(mAu),queryParameters:Gr.list(sWa),headers:Gr.list(vBi),sdkName:HQr.optional(),generatedRequestName:Gr.string(),requestNameOverride:Gr.string().optional(),request:jAu.optional(),response:EAu.optional(),errors:Gr.record(VQr,SAu),servers:Gr.list(YVa),examples:Gr.list(kVa),pagination:eWa.optional(),retries:tWa.optional()}).extend(Xy).extend(mP).extend(QA).extend(kE);var _Ey=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),sdkName:HQr.optional(),method:rWa,summary:Gr.string().optional(),operationId:Gr.string(),tags:Gr.list(HDe),headers:Gr.list(vBi),generatedPayloadName:Gr.string(),payload:Gr.lazy(()=>y6),examples:Gr.list(nWa)}).extend(Xy).extend(QA).extend(kE);var DAu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional(),example:Gr.number().optional()});var CAu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var IAu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var MAu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var BAu=Gr.objectWithoutOptionalProperties({example:Gr.number().optional()});var TAu=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),minimum:Gr.number().optional(),maximum:Gr.number().optional(),exclusiveMinimum:Gr.boolean().optional(),exclusiveMaximum:Gr.boolean().optional(),multipleOf:Gr.number().optional(),example:Gr.number().optional()});var qAu=Gr.objectWithoutOptionalProperties({default:Gr.string().optional(),pattern:Gr.string().optional(),format:Gr.string().optional(),minLength:Gr.number().optional(),maxLength:Gr.number().optional(),example:Gr.string().optional()});var RAu=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var NAu=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var xAu=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var FAu=Gr.objectWithoutOptionalProperties({default:Gr.boolean().optional(),example:Gr.boolean().optional()});var zAu=Gr.union("type",{int:DAu,int64:CAu,uint:IAu,uint64:MAu,float:BAu,double:TAu,string:qAu,datetime:RAu,date:NAu,base64:xAu,boolean:FAu}).transform({transform:e=>{switch(e.type){case"int":return M0.int(e);case"int64":return M0.int64(e);case"uint":return M0.uint(e);case"uint64":return M0.uint64(e);case"float":return M0.float(e);case"double":return M0.double(e);case"string":return M0.string(e);case"datetime":return M0.datetime(e);case"date":return M0.date(e);case"base64":return M0.base64(e);case"boolean":return M0.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var cWa=Gr.objectWithoutOptionalProperties({schema:zAu}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend($I);var QAu=Gr.objectWithoutOptionalProperties({default:dBi.optional(),values:Gr.list(dBi),example:Gr.string().optional()}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend(QA).extend($I).extend(h6);var LAu=Gr.objectWithoutOptionalProperties({example:Gr.unknown()}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend($I);var y6=Gr.union("type",{primitive:cWa,object:Gr.lazyObject(()=>GAu),array:Gr.lazyObject(()=>UAu),map:Gr.lazyObject(()=>VAu),optional:Gr.lazyObject(()=>WAu),enum:QAu,reference:GQr,literal:iWa,oneOf:Gr.object({value:Gr.lazy(()=>JAu)}),nullable:Gr.lazyObject(()=>HAu),unknown:LAu}).transform({transform:e=>{switch(e.type){case"primitive":return ay.primitive(e);case"object":return ay.object(e);case"array":return ay.array(e);case"map":return ay.map(e);case"optional":return ay.optional(e);case"enum":return ay.enum(e);case"reference":return ay.reference(e);case"literal":return ay.literal(e);case"oneOf":return ay.oneOf(e.value);case"nullable":return ay.nullable(e);case"unknown":return ay.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var UAu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>y6),example:Gr.list(Gr.unknown()).optional()}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend($I).extend(h6);var VAu=Gr.objectWithoutOptionalProperties({key:cWa,value:Gr.lazy(()=>y6),example:Gr.unknown().optional()}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend(Mxe).extend($I).extend(h6);var WAu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>y6)}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend($I).extend(h6);var HAu=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>y6)}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend($I).extend(h6);var GAu=Gr.objectWithoutOptionalProperties({allOf:Gr.list(GQr),properties:Gr.list(Gr.lazyObject(()=>KAu)),allOfPropertyConflicts:Gr.list(aWa),fullExamples:Gr.list(v_t).optional(),additionalProperties:Gr.boolean()}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend(QA).extend($I).extend(h6);var KAu=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>y6),readonly:Gr.boolean().optional(),writeonly:Gr.boolean().optional(),audiences:Gr.list(Gr.string()),conflict:Gr.record(WDe,oWa),nameOverride:Gr.string().optional(),generatedName:Gr.string()}).extend(mP);var JAu=Gr.union("type",{discriminated:Gr.lazyObject(()=>$Au),undiscriminated:Gr.lazyObject(()=>YAu)}).transform({transform:e=>{switch(e.type){case"discriminated":return VDe.discriminated(e);case"undiscriminated":return VDe.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var $Au=Gr.objectWithoutOptionalProperties({discriminantProperty:Gr.string(),commonProperties:Gr.list(Gr.lazyObject(()=>XAu)),schemas:Gr.record(Gr.string(),Gr.lazy(()=>y6))}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend(Mxe).extend(QA).extend($I).extend(h6);var XAu=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>y6)});var YAu=Gr.objectWithoutOptionalProperties({schemas:Gr.list(Gr.lazy(()=>y6))}).extend(YI).extend(kE).extend(zS).extend(Xy).extend(mP).extend(Mxe).extend(QA).extend($I).extend(h6);var hEy=/^(\d+)/,lWa=/^[a-zA-Z][a-zA-Z0-9_]*$/,yEy={"<":"LESS_THAN",">":"GREATER_THAN",">=":"GREATER_THAN_OR_EQUAL_TO","<=":"LESS_THAN_OR_EQUAL_TO","!=":"NOT_EQUALS","=":"EQUAL_TO","==":"EQUAL_TO","*":"ALL","":"EMPTY",'""':"EMPTY_STRING","-":"HYPHEN","|":"PIPE",".":"DOT","/":"SLASH"};function bBi(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],n=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let o=Math.floor(e/10),c=e%10;return c===0?n[o]:`${n[o]}_${t[c]}`}if(e<1e3){let o=Math.floor(e/100),c=e%100;return c===0?`${t[o]}_hundred`:`${t[o]}_hundred_${bBi(c)}`}let i=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[i]}_thousand`:`${t[i]}_thousand_${bBi(a)}`}function M8o(e){let t=e.match(hEy);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let a=bBi(i);return n.length>0?`${a}_${n}`:a}}}function fWa(e){let t=M8o(e),r=yEy[e];return t!=null?bU(hA(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":bU(hA(e)))}function Bxe(e,t){return e.type==="primitive"&&t.type==="primitive"?vEy(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?OtC(e.values,t.values):e.type==="array"&&t.type==="array"?Bxe(e.value,t.value):e.type==="unknown"&&t.type==="unknown"?!0:e.type==="reference"&&t.type==="reference"?e.schema===t.schema:e.type==="optional"&&t.type==="optional"?Bxe(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?AtC(e.value,t.value):e.type==="object"&&t.type==="object"?PtC(e,t):e.type==="map"&&t.type==="map"?vEy(e.key.schema,t.key.schema)&&Bxe(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function vEy(e,t){return e.type===t.type}function OtC(e,t){let r=new Set(...e.map(i=>i.value)),n=new Set(...t.map(i=>i.value));return Foe(r,n)}function AtC(e,t){return e.type==="discriminated"&&t.type==="discriminated"?e.discriminantProperty===t.discriminantProperty&&Object.keys(e.schemas).length===Object.keys(t.schemas).length&&Object.entries(e.schemas).every(([r,n])=>{let i=t.schemas[r];return i==null?!1:Bxe(n,i)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,n)=>{let i=t.schemas[n];return i==null?!1:Bxe(r,i)}):!1}function PtC(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(n=>[n.key,n.schema]));return Object.entries(t.properties).every(([n,i])=>{let a=r[n];return a==null?!1:Bxe(a,i.schema)})}function zG(e){switch(e){case Yfe.Deprecated:return"deprecated";case Yfe.Beta:return"pre-release";case Yfe.GenerallyAvailable:return"generally-available";default:return}}function wtC(e){let t=e.find(n=>typeof n=="object"&&n.type==="namespace"),r=e.filter(n=>typeof n=="string"||n.type!=="namespace");return t?[t,...r]:r}function bEy(e){let t=e?wtC(e):void 0;if(t==null||t.length===0)return OJi;let r=[];for(let[n,i]of t.entries())if(typeof i=="string")r.push(hA(i));else if(typeof i=="object")switch(i.type){case"namespace":{n<t.length-1?r.push(hA(i.name)):r.push(i.name,OJi);break}default:fc(i.type)}else fc(i);return r.join("/")}function gBi(e){return HP.of(`${bEy(e)}.yml`)}function Zhf({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?OJi:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,bEy(r))}function gEy({sdkName:e,namespaceOverride:t}){return HP.of(`${Zhf({sdkName:e,namespaceOverride:t})}.yml`)}function mEy({location:e,namespaceOverride:t}){return t!=null?HY(HP.of(t),e):e}function ZAu(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:fc(e.type)}}function dWa(e){switch(e.type){case"object":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":case"primitive":return e.groupName??void 0;case"oneOf":return e.value.groupName??void 0;case"unknown":return;default:fc(e)}}function v6(e){return typeof e=="string"?e:e.type}function pWa(e){if(typeof e!="string")return e.docs}function B8o(e){if(typeof e!="string")return e.default}function khf(e){if(typeof e!="string")return e.validation}function AEy(e){let t=v6(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?OEy(e):{...e,type:OEy(e.type)}}function OEy(e){return e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function mBi(e){return v6(e).startsWith("optional<")?e:typeof e=="string"?PEy(e):{...e,type:PEy(e.type)}}function PEy(e){return`optional<${e}>`}var jtC=-2147483648,EtC=2147483647,StC=-17976931348623157e292,DtC=17976931348623157e292;function SD({schema:e,fileContainingReference:t,declarationFile:r=t,context:n,namespace:i,declarationDepth:a}){switch(n.shouldMarkSchemaAsReferenced()&&n.markSchemaAsReferenced(e,i),e.type){case"primitive":return kAu(e);case"array":return ryf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"map":return nyf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"reference":return tyf({schema:e,fileContainingReference:t,context:n,namespace:i});case"unknown":return ayf();case"optional":return ePu({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"nullable":return iyf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"enum":return xtC({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:a});case"literal":return e.value,oyf(e);case"object":return FtC({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"oneOf":return ztC({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});default:fc(e)}}function kAu(e){switch(e.schema.type){case"string":return MtC({description:e.description,schema:e.schema});case"int":return BtC({description:e.description,schema:e.schema});case"float":return TtC({description:e.description,schema:e.schema});case"double":return qtC({description:e.description,schema:e.schema});case"boolean":return CtC({description:e.description,schema:e.schema});case"int64":return ItC({description:e.description,schema:e.schema})}let t=e.schema._visit({int:()=>"integer",int64:()=>"long",uint:()=>"uint",uint64:()=>"uint64",float:()=>"double",double:()=>"double",string:()=>"string",datetime:()=>"datetime",date:()=>"date",base64:()=>"base64",boolean:()=>"boolean",_other:()=>"unknown"});return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:zG(e.availability)}:{}}}function CtC({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function ItC({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),n}function MtC({description:e,schema:t}){let r="string",n=RtC(t);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function BtC({description:e,schema:t}){let r="integer",n=wEy(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function TtC({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function qtC({description:e,schema:t}){let r="double",n=wEy(t,r);if(e==null&&t.default==null&&n==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),n!=null&&(i.validation=n),i}function RtC(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,a=NtC(t);if(!(a==null&&r==null&&n==null&&i==null))return{format:a,pattern:r,minLength:n,maxLength:i}}function NtC(e){switch(e){case"date":case"date-time":case"password":case"byte":case"bytes":case"binary":case"email":case"uuid":case"uri":case"hostname":case"ipv4":case"ipv6":return e;default:return}}function wEy(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:a,exclusiveMaximum:o}=e;if(r=eyf(r,t),n=eyf(n,t),i=eyf(i,t),!(r==null&&n==null&&a==null&&o==null&&i==null))return{min:r,max:n,exclusiveMin:a,exclusiveMax:o,multipleOf:i}}function eyf(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[jtC,EtC]:[StC,DtC];return e<r||e>n?void 0:e}function tyf({schema:e,fileContainingReference:t,context:r,namespace:n}){let i=r.getSchema(e.schema,n);if(i==null)return"unknown";let a=QtC(i)??e.schema,o=dWa(i),c=LtC(i),f=tPu({context:r,fileContainingReference:t,declarationFile:gBi(o),type:a}),u=i.type==="nullable"?`optional<${f}>`:f;return e.description==null&&c==null?u:{type:i.type==="nullable"?`optional<${f}>`:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:zG(e.availability)}:{}}}function ryf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=SD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=`list<${v6(o)}>`;return e.description==null&&e.title==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:zG(e.availability)}:{},type:c}}function nyf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=kAu(e.key),c=SD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),f=e.encoding!=null?ZAu(e.encoding):void 0,u=`map<${v6(o)}, ${v6(c)}>`;if(e.description==null&&f==null&&e.title==null)return u;let s={type:u};return e.description!=null&&(s.docs=e.description),e.encoding!=null&&(s.encoding=f),e.availability!=null&&(s.availability=zG(e.availability)),s}function iyf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){if(!n.respectNullableSchemas)return ePu({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});let o=SD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=v6(o),f=pWa(o),u=B8o(o),s=khf(o),l=AEy(c);if(e.availability==null&&e.description==null&&f==null&&u==null&&s==null&&e.title==null)return mBi(l);let m=typeof l=="string"?{type:l}:l;return(e.description!=null||f!=null)&&(m.docs=e.description??f),u!=null&&(m.default=u),s!=null&&(m.validation=s),e.availability!=null&&(m.availability=zG(e.availability)),mBi(m)}function ePu({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=SD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=v6(o),f=pWa(o),u=B8o(o),s=khf(o),l=mBi(c);if(e.availability==null&&e.description==null&&f==null&&u==null&&s==null&&e.title==null)return l;let m=typeof l=="string"?{type:l}:l;return(e.description!=null||f!=null)&&(m.docs=e.description??f),u!=null&&(m.default=u),s!=null&&(m.validation=s),e.availability!=null&&(m.availability=zG(e.availability)),m}function ayf(){return"unknown"}function oyf(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:fc(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:zG(e.availability)}:{}}}function xtC({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let a=T8o(e,i),o=e.nameOverride??e.generatedName;n.builder.addType(r,{name:o,schema:a.schema});let c=tPu({type:o,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return c;let f={type:c};return e.description!=null&&(f.docs=e.description),e.default!=null&&(f.default=e.default.value),e.availability!=null&&(f.availability=zG(e.availability)),f}function FtC({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=syf({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:o.schema});let f=tPu({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?f:{type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:zG(e.availability)}:{}}}function ztC({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=uyf({schema:e,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=e.nameOverride??e.generatedName;n.builder.addType(r,{name:c,schema:o.schema});let f=tPu({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?f:{...e.title!=null?{"display-name":e.title}:{},type:f,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:zG(e.availability)}:{}}}function tPu({type:e,fileContainingReference:t,declarationFile:r,context:n}){if(r===t)return e;let i=n.builder.addImport({file:t,fileToImport:r});return i!=null?`${i}.${e}`:e}function QtC(e){return xw._visit(e,{primitive:t=>t.nameOverride??t.generatedName,object:t=>t.nameOverride??t.generatedName,array:t=>t.nameOverride??t.generatedName,map:t=>t.nameOverride??t.generatedName,enum:t=>t.nameOverride??t.generatedName,reference:t=>t.nameOverride??t.generatedName,literal:t=>t.nameOverride??t.generatedName,oneOf:t=>t.nameOverride??t.generatedName,optional:t=>t.nameOverride??t.generatedName,nullable:t=>t.nameOverride??t.generatedName,unknown:t=>t.nameOverride??t.generatedName,_other:()=>{}})}function LtC(e){return xw._visit(e,{primitive:t=>t.title,object:t=>t.title,array:t=>t.title,map:t=>t.title,enum:t=>t.title,reference:t=>t.title,literal:t=>t.title,oneOf:t=>t.title,optional:t=>t.title,nullable:t=>t.title,unknown:t=>{},_other:()=>{}})}var yse;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(yse||(yse={}));function Jdi(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:fc(e)}}function EEy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a;switch(e.type){case"primitive":a=WtC(e);break;case"array":a=UtC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":a=VtC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":a=HtC({schema:e,context:t,declarationFile:r,namespace:n});break;case"unknown":a=JtC(e.nameOverride,e.generatedName);break;case"optional":a=SEy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":a=GtC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":a=T8o(e,i);break;case"literal":a=KtC(e,e.nameOverride,e.generatedName);break;case"object":a=syf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"oneOf":a=uyf({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;default:fc(e)}return a}function syf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=t.isInState(yse.Request)&&t.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),o=!1,c={},f=new Set;for(let A of e.properties){if(A.readonly&&(o=!0),a&&A.readonly)continue;if(Object.keys(A.conflict).length>0){if(Object.entries(A.conflict).every(([R,V])=>!V.differentSchema))continue;Object.entries(A.conflict).forEach(([R])=>{cyf({property:A.key,schemaId:R,context:t,namespace:n}).forEach($=>{f.add($)})})}let P=SD({schema:A.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}),C=A.audiences,M=A.nameOverride,T=zG(A.availability),z=ZtC(A);c[A.key]=XtC({typeReference:P,audiences:C,name:M,availability:T,propertyAccess:z})}let u=new Set;for(let A of e.allOfPropertyConflicts)A.allOfSchemaIds.forEach(P=>f.add(P)),A.conflictingTypeSignatures&&u.add(A.propertyKey);let s=[];for(let A of e.allOf){let P=DEy({schema:A.schema,context:t,namespace:n});if(P==null||f.has(A.schema)||f.has(P))continue;let C=SD({schema:xw.reference(A),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});s.push(v6(C))}for(let A of f){let P=lyf(t,A,n);for(let C of P.properties)c[C.key]==null&&(u.has(C.key)&&(c[C.key]="unknown"),c[C.key]=SD({schema:C.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}));for(let C of P.allOf){if(f.has(C.schema))continue;let M=SD({schema:xw.reference(C),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});s.push(v6(M))}}let l={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([A,P])=>YtC(A)?[A,typeof P=="string"?{type:P,name:`_${A}`}:{...P,name:`_${A}`}]:[A,P]))};s.length>0&&(l.extends=s),e.additionalProperties&&(l["extra-properties"]=!0),e.availability!=null&&(l.availability=zG(e.availability)),e.source!=null&&(l.source=Jdi(e.source)),l.inline=fyf(e,i);let m=e.nameOverride??e.generatedName;return{name:o&&t.respectReadonlySchemas&&!a?`${m}Read`:m,schema:l}}function cyf({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return cyf({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:a,allOf:o}=lyf(r,t,n),c=a.some(u=>u.key===e),f=[...o.flatMap(u=>cyf({property:e,context:r,schemaId:u.schema,namespace:n}))];if(c||f.length>0)return[t,...f]}return[]}function lyf(e,t,r){let n=e.getSchema(t,r);if(n==null)return{properties:[],allOf:[]};if(n.type==="object")return{properties:n.properties,allOf:n.allOf};if(n.type==="reference")return lyf(e,n.schema,r);throw new Error(`Cannot getAllProperties for a non-object schema. schemaId=${t}, type=${n.type}`)}function UtC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:ryf({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function VtC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:nyf({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function WtC(e){let t=kAu(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...n}=t;return{name:e.nameOverride??e.generatedName,schema:{...n}}}function jEy(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function T8o(e,t){let r={enum:e.values.map(a=>{let o=a.nameOverride??a.generatedName,c=a.value;if(o===c&&a.description==null&&(a.casing==null||jEy(a.casing)))return o;let f={value:a.value};if(o!==c&&(f.name=o),a.description!=null&&(f.docs=a.description),a.casing!=null&&!jEy(a.casing)){let u={},s=!1;a.casing.camel!=null&&(u.camel=a.casing.camel,s=!0),a.casing.screamingSnake!=null&&(u["screaming-snake"]=a.casing.screamingSnake,s=!0),a.casing.snake!=null&&(u.snake=a.casing.snake,s=!0),a.casing.pascal!=null&&(u.pascal=a.casing.pascal,s=!0),s&&(f.casing=u)}return f})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=fyf(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?Jdi(e.source):void 0};for(let a of r.enum){let o=typeof a=="string"?a:a.name??a.value;n.has(o.toLowerCase())||(i.enum.push(a),n.add(o.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:i}}function HtC({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:tyf({schema:e,context:t,fileContainingReference:r,namespace:n})}}function GtC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:iyf({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:SEy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function SEy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:ePu({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function JtC(e,t){return{name:e??t,schema:ayf()}}function KtC(e,t,r){return{name:t??r,schema:oyf(e)}}function uyf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=e.encoding!=null?ZAu(e.encoding):void 0;if(e.type==="discriminated"){let c={};for(let u of e.commonProperties)c[u.key]=SD({schema:u.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1});let f={};for(let[u,s]of Object.entries(e.schemas))f[u]=SD({schema:s,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantProperty,"base-properties":c,docs:e.description??void 0,availability:e.availability!=null?zG(e.availability):void 0,union:f,encoding:a,source:e.source!=null?Jdi(e.source):void 0}}}let o=[];for(let c of e.schemas)o.push(SD({schema:c,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:o,encoding:a,source:e.source!=null?Jdi(e.source):void 0,inline:fyf(e,i)}}}var $tC=/^[0-9]/;function YtC(e){return $tC.test(e)}function DEy({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?DEy({context:t,schema:n.schema,namespace:r}):e}function XtC({typeReference:e,audiences:t,name:r,availability:n,propertyAccess:i}){return t.length===0&&r==null&&n==null&&i==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...n!=null?{availability:n}:{},...i!=null?{access:i}:{}}}function fyf(e,t){return e.inline===!0||t>0?!0:void 0}function ZtC(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return XY.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return XY.ObjectPropertyAccess.WriteOnly}}function CEy(e){let t=e.replace(/^x-|^X-/,"");return hA(t)}var IEy="BasicAuthScheme",rPu="BearerAuthScheme";function MEy(e){if(e.authOverrides!=null){for(let[r,n]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:n});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,n]of Object.entries(e.ir.securitySchemes))if(n.type==="basic"){let i={scheme:"basic"};n.usernameVariableName!=null&&(i.username===void 0?i.username={name:n.usernameVariableName}:i.username.name=n.usernameVariableName),n.usernameEnvVar!=null&&(i.username===void 0?i.username={env:n.usernameEnvVar}:i.username.env=n.usernameEnvVar),n.passwordVariableName!=null&&(i.password===void 0?i.password={name:n.passwordVariableName}:i.password.name=n.passwordVariableName),n.passwordEnvVar!=null&&(i.password===void 0?i.password={env:n.passwordEnvVar}:i.password.env=n.passwordEnvVar),e.builder.addAuthScheme({name:IEy,schema:i}),t||(e.builder.setAuth(IEy),t=!0)}else if(n.type==="bearer"){let i={scheme:"bearer"};n.tokenVariableName!=null&&(i.token===void 0?i.token={name:n.tokenVariableName}:i.token.name=n.tokenVariableName),n.tokenEnvVar!=null&&(i.token===void 0?i.token={env:n.tokenEnvVar}:i.token.env=n.tokenEnvVar),e.builder.addAuthScheme({name:rPu,schema:i}),t||(e.builder.setAuth(rPu),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??CEy(n.headerName),env:n.headerEnvVar}});else{let i={header:n.headerName,name:n.headerVariableName??"apiKey",type:"string"};n.headerEnvVar!=null&&(i.env=n.headerEnvVar),n.prefix!=null&&(i.prefix=n.prefix),e.builder.addAuthScheme({name:r,schema:i}),e.builder.setAuth(r),t=!0}else if(n.type==="oauth"){let i={scheme:"bearer"};e.builder.addAuthScheme({name:rPu,schema:i}),t||(e.builder.setAuth(rPu),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(HP.of("__package__.yml"),{name:"OauthScope",schema:T8o(n.scopesEnum,0).schema})}}function JQr({header:e,context:t,fileContainingReference:r,namespace:n}){let i=SD({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),a=v6(i),o=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:hA(o);if(e.description==null&&e.name===c&&e.env==null&&e.availability==null)return a;let f={type:a};return c!==e.name&&(f.name=c),e.description!=null&&(f.docs=e.description),e.env!=null&&(f.env=e.env),e.availability!=null&&(f.availability=zG(e.availability)),f}function nPu({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=SD({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return v6(i);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:v6(i)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=zG(e.availability)),a}function aPu({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=dyf({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let a=v6(i.value),o=B8o(i.value);a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>");let c={type:a};return o!=null&&(c.default=o),i.allowMultiple&&(c["allow-multiple"]=!0),e.description!=null&&(c.docs=e.description),e.parameterNameOverride!=null&&(c.name=e.parameterNameOverride),e.availability!=null&&(c.availability=zG(e.availability)),ktC(i.value)&&i.value.validation!==void 0&&(c.validation=i.value.validation),c.default==null&&c["allow-multiple"]==null&&c.docs==null&&c.name==null&&c.availability==null&&c.validation==null?a:c}function dyf({schema:e,context:t,fileContainingReference:r,namespace:n}){if(e.type==="reference"){let i=t.getSchema(e.schema,n);if(i==null)return;if(i.type==="array")return{value:SD({schema:xw.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,declarationFile:HP.of(xN),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,f]of Object.entries(i.value.schemas))f.type==="primitive"&&f.schema.type==="string"&&(o=!0),f.type==="literal"&&f.value.type==="string"&&(lWa.test(f.value.value)?a.push(f.value.value):a.push({value:f.value.value,name:fWa(f.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),o&&t.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:e.generatedName}]}}),{value:`${e.generatedName}OrString`,allowMultiple:!1}):{value:e.generatedName,allowMultiple:!1};if(i.value.schemas.length===2){let[c,f]=i.value.schemas;if(c!=null&&f!=null&&iPu({array:c,primitive:f}))return{value:SD({schema:xw.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:f,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(c!=null&&f!=null&&iPu({array:c,primitive:f}))return{value:SD({schema:xw.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}for(let[c,f]of Object.entries(i.value.schemas))return dyf({schema:f,context:t,fileContainingReference:r,namespace:n})}else if(t.objectQueryParameters)return{value:SD({schema:e,context:t,fileContainingReference:r,declarationFile:HP.of(xN),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){if(e.value.type==="reference"){let i=t.getSchema(e.value.schema,n);if(i==null)return;if(i.type==="array")return{value:SD({schema:xw.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:i.value,description:e.description??i.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:HP.of(xN),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.objectQueryParameters)return{value:SD({schema:e,context:t,fileContainingReference:r,declarationFile:HP.of(xN),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:SD({schema:xw.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let i=[],a=!1;for(let[o,c]of Object.entries(e.value.value.schemas))c.type==="primitive"&&c.schema.type==="string"&&(a=!0),c.type==="literal"&&c.value.type==="string"&&(lWa.test(c.value.value)?i.push(c.value.value):i.push({value:c.value.value,name:fWa(c.value.value)}));if(i.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:i}}),a&&t.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[o,c]=e.value.value.schemas;if(o!=null&&c!=null&&iPu({array:o,primitive:c}))return{value:SD({schema:xw.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(o!=null&&c!=null&&iPu({array:c,primitive:o}))return{value:SD({schema:xw.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:o,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}}if(t.objectQueryParameters)return{value:SD({schema:e,context:t,fileContainingReference:r,declarationFile:HP.of(xN),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[o,c]of Object.entries(e.value.value.schemas))return dyf({schema:xw.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n})}else if(e.value.type==="object")return t.objectQueryParameters?{value:SD({schema:e,context:t,fileContainingReference:r,declarationFile:HP.of(xN),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:SD({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:SD({schema:xw.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0}:{value:SD({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function iPu({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function ktC(e){return e.type!=null}function BEy({websocketExample:e,context:t}){let r={messages:[]};e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=erC(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=trC({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=OBi(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function erC(e){let t={};return e.forEach(r=>{let n=OBi(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function trC({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let a=OBi(i.value);r.has(i.name)||a!=null&&(n[i.name]=a)}),n}function OBi(e){switch(e.type){case"primitive":return TEy(e.value);case"object":return qEy(e.properties);case"array":return rrC(e.value);case"map":return nrC(e.value);case"oneOf":return irC(e.value);case"enum":return e.value;case"literal":return arC(e.value);case"unknown":return OBi(e.value);default:fc(e)}}function TEy(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`${e.value.slice(1)}`:e.value;case"datetime":try{return new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"date":return e.value;case"base64":case"boolean":return e.value;default:fc(e)}}function qEy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,OBi(r)]))}function rrC(e){return e.map(t=>OBi(t))}function nrC(e){return Object.fromEntries(e.map(t=>[TEy(t.key),OBi(t.value)]))}function irC(e){return e.type==="discriminated"?qEy(e.value):OBi(e.value)}function arC(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:fc(e)}}function Kdi(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function oPu(e,t){return t??(e?.groupName!=null?Kdi(e.groupName):void 0)}function REy({channel:e,context:t,declarationFile:r}){let n={path:e.path,url:e.servers[0]?.name,auth:!1};e.audiences!=null&&e.audiences.length>0&&(n.audiences=e.audiences),e.summary!=null&&(n["display-name"]=e.summary),e.description!=null&&(n.docs=e.description);let i=Kdi(e.groupName),a={};if(e.handshake.pathParameters.length>0)for(let f of e.handshake.pathParameters)a[f.name]=nPu({pathParameter:f,context:t,fileContainingReference:r,namespace:i});Object.keys(a).length>0&&(n["path-parameters"]=a);let o={};if(e.handshake.queryParameters.length>0)for(let f of e.handshake.queryParameters){let u=aPu({queryParameter:f,context:t,fileContainingReference:r,namespace:i});u!=null&&(o[f.name]=u)}Object.keys(o).length>0&&(n["query-parameters"]=o);let c={};if(e.handshake.headers.length>0)for(let f of e.handshake.headers){let u=JQr({header:f,context:t,fileContainingReference:r,namespace:i});c[f.name]=u}Object.keys(c).length>0&&(n.headers=c),t.builder.addChannel(r,{channel:n});for(let f of e.messages)t.builder.addChannelMessage(r,{messageId:f.name,message:{origin:f.origin,body:SD({schema:f.body,context:t,fileContainingReference:r,namespace:i,declarationDepth:0})}});for(let f of e.examples){let u=BEy({context:t,websocketExample:f});t.builder.addChannelExample(r,{example:u})}}function NEy(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var $di="Base",orC="Default";function YZi(e){return Object.entries(e).reduce((t,[r,n])=>(Ttt(n)?Object.entries(n.urls).forEach(([i,a])=>{t[i]=a}):t[r]=typeof n=="string"?n:n.url,t),{})}function xEy(e){if(e.environmentOverrides!=null){for(let[T,z]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:T,schema:z});e.environmentOverrides["default-environment"]!=null&&e.builder.setDefaultEnvironment(e.environmentOverrides["default-environment"]),e.environmentOverrides["default-url"]!=null&&e.builder.setDefaultUrl(e.environmentOverrides["default-url"]);return}let t={},r=[],n=e.ir.servers.some(T=>NEy(T)),i=e.ir.servers;for(let T of i)if(NEy(T)){let z={urls:{}};for(let[U,R]of Object.entries(T.urls))z.urls[U]=R.url;T.name&&(t[T.name]=z)}else if("url"in T&&T.url){let z=T.audiences?{url:T.url,audiences:T.audiences}:T.url;if(T.name==null){r.push(z);continue}t[T.name]=z}let a={},o={},c=[];for(let T of e.ir.endpoints)for(let z of T.servers){if(z.url==null&&z.name!=null){a[z.name]||(a[z.name]=[]);continue}if(z.url==null)continue;let U=z.audiences?{url:z.url,audiences:z.audiences}:z.url;if(z.name==null){c.push(U);continue}a[z.name]||(a[z.name]=[]),a[z.name]?.push({url:z.url,audiences:z.audiences}),o[z.name]=U}let f={},u=[];for(let T of e.ir.websocketServers){let z=T.audiences?{url:T.url,audiences:T.audiences}:T.url;if(T.name==null){u.push(z);continue}f[T.name]=z}let s=Object.keys(t).length,l=s>0,m=Object.keys(o).length>0,A=Object.keys(a).some(T=>a[T]?.length===0),P=Object.keys(f).length>0;if(!l&&!m&&P&&e.ir.servers.length===0){for(let[T,z]of Object.entries(f))e.builder.addEnvironment({name:T,schema:z});e.builder.setDefaultEnvironment(Object.keys(f)[0]),e.builder.setDefaultUrl($di);return}if(c.length>0&&e.logger.error(`Skipping endpoint level servers ${c.map(T=>typeof T=="string"?T:T.url).join(", ")} because x-fern-server-name was not provided.`),!l){let T=e.ir.servers[0]?.url,z=e.ir.servers[0]?.audiences;if(T!=null){let U=z?{url:T,audiences:z}:T;t[orC]=U}}let C=Object.values(t).map(T=>typeof T=="string"?T:Ttt(T)?Object.values(T.urls)[0]:T.url),M=r.filter(T=>{let z=typeof T=="string"?T:T.url;return!C.includes(z)});if(M.length>0&&e.logger.error(`Skipping top level servers ${M.map(T=>typeof T=="string"?T:T.url).join(", ")} because x-fern-server-name was not provided.`),n){let T=!0;for(let[z,U]of Object.entries(t))if(e.builder.addEnvironment({name:z,schema:U}),T){if(e.builder.setDefaultEnvironment(z),Ttt(U)){let R=Object.keys(U.urls)[0];R&&e.builder.setDefaultUrl(R)}T=!1}return}if(!m&&!A){let T=!0;for(let[z,U]of Object.entries(t))if(T){if(P){let R=typeof U=="string"?U:Ttt(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:z,schema:{urls:{[$di]:R??"",...YZi(f)}}})}else e.builder.addEnvironment({name:z,schema:U});e.builder.setDefaultEnvironment(z),T=!1}else if(P){let R=typeof U=="string"?U:Ttt(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:z,schema:{urls:{[$di]:R??"",...YZi(f)}}})}else e.builder.addEnvironment({name:z,schema:U});P&&e.builder.setDefaultUrl($di)}else if(s===1){let T=Object.keys(t)[0],z=Object.values(t)[0],U=typeof z=="string"?z:Ttt(z)?Object.values(z.urls)[0]:z.url;e.builder.addEnvironment({name:T,schema:{urls:{[$di]:U??"",...YZi(o),...YZi(f)}}}),e.builder.setDefaultEnvironment(T),e.builder.setDefaultUrl($di)}else{let T=new Map;for(let z of e.ir.endpoints)for(let U of z.servers)if(U.url!=null&&U.name!=null){T.has(U.name)||T.set(U.name,new Map);let R=U.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",V=T.get(U.name);V&&V.set(R,U.url)}if(T.size>0){let z=!0;for(let[U,R]of Object.entries(t)){let V=typeof R=="string"?R:Ttt(R)?Object.values(R.urls)[0]:R.url;if(!V)continue;let $=V.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",re={[$di]:V};for(let[Y,te]of T.entries()){let ne=te.get($)||te.get("production")||te.values().next().value;ne&&(re[Y]=ne)}P&&Object.assign(re,YZi(f)),Object.keys(re).length>1?e.builder.addEnvironment({name:U,schema:{urls:re}}):e.builder.addEnvironment({name:U,schema:V}),z&&(e.builder.setDefaultEnvironment(U),z=!1)}T.size>0&&e.builder.setDefaultUrl($di)}else{let z=!0;for(let[U,R]of Object.entries(t)){if(P||Object.keys(o).length>0){let V=typeof R=="string"?R:Ttt(R)?Object.values(R.urls)[0]:R.url;e.builder.addEnvironment({name:U,schema:{urls:{[$di]:V??"",...YZi(o),...YZi(f)}}})}else e.builder.addEnvironment({name:U,schema:R});z&&(e.builder.setDefaultEnvironment(U),z=!1)}}}}var pyf=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},srC=.75,urC=new Set("authorization");function FEy(e){if(e.globalHeaderOverrides!=null){for(let[r,n]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:n});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,n]of Object.entries(t)){let i="optional<string>";if(n.name==null&&n.env==null&&typeof n.schema=="string")i=n.schema;else if(n!=null){let a=n.schema?dWa(n.schema):void 0,o=a!=null?Kdi(a):void 0,c=HP.of("api.yml");i={name:n.name,env:n.env,type:n.schema!=null?v6(SD({schema:n.schema,context:e,fileContainingReference:o?HY(HP.of(hA(o)),c):c,namespace:o,declarationDepth:0}))??"optional<string>":"optional<string>"}}e.builder.addGlobalHeader({name:r,schema:i})}if(e.detectGlobalHeaders){let r={};for(let i of e.ir.endpoints)for(let a of i.headers){if(urC.has(a.name.toLowerCase()))continue;let o=r[a.name];if(o==null){let c=t[a.name],f=JQr({header:{...a,schema:c?.schema??a.schema,name:c?.name??a.name},fileContainingReference:HP.of(sk),context:e,namespace:void 0});o=new pyf(f),r[a.name]=o}o.increment()}let n=e.ir.endpoints.length*srC;for(let[i,a]of Object.entries(r)){let o=t[i],c=a.count===e.ir.endpoints.length,f=a.count>=n;o==null&&(c?e.builder.addGlobalHeader({name:i,schema:a.schema}):f&&e.builder.addGlobalHeader({name:i,schema:mBi(a.schema)}))}}}function zEy(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?dWa(t.schema):void 0,n=r!=null?Kdi(r):void 0,i=JQr({header:{...t,schema:t.schema??xw.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:KT.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0})}),name:t.name??t.header,parameterNameOverride:void 0,description:void 0,availability:void 0,source:void 0},fileContainingReference:HP.of(sk),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:mBi(i)})}}function fPe(e){switch(e.type){case"primitive":return LEy(e.value);case"object":return UEy(e.properties);case"array":return VEy(e.value);case"map":return lrC(e.value);case"oneOf":return frC(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return drC(e.value);case"unknown":return fPe(e.value);default:fc(e)}}function QEy(e){switch(e.type){case"withStreaming":return e.sse?{stream:crC(e.events)}:{stream:VEy(e.events)};case"withoutStreaming":return{body:fPe(e.value)};default:fc(e)}}function LEy(e){switch(e.type){case"int":return e.value;case"int64":return e.value;case"uint":return e.value;case"uint64":return e.value;case"float":return e.value;case"double":return e.value;case"string":return e.value.startsWith("$")?`\\${e.value}`:e.value;case"datetime":try{return!e.value.endsWith("Z")&&!e.value.includes("+")&&(e.value+="Z"),new Date(e.value).toISOString().replace(/\.\d{3}Z$/,"Z")}catch{return"2024-01-15T09:30:00Z"}case"date":return e.value;case"base64":case"boolean":return e.value;default:fc(e)}}function UEy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,fPe(r)]))}function crC(e){return e.map(t=>({event:"",data:fPe(t)}))}function VEy(e){return e.map(t=>fPe(t))}function lrC(e){return Object.fromEntries(e.map(t=>[LEy(t.key),fPe(t.value)]))}function frC(e){return e.type==="discriminated"?UEy(e.value):fPe(e.value)}function drC(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:fc(e)}}function WEy({endpointExample:e,context:t}){let r={};if(e.type!=="full")return e.value;e.name!=null&&(r.name=e.name),e.description!=null&&(r.docs=e.description),e.pathParameters!=null&&e.pathParameters.length>0&&(r["path-parameters"]=prC(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=_rC(e.queryParameters));let n=e.headers!=null&&e.headers.length>0,i=t.builder.getGlobalHeaders(),a=Object.keys(i).length>0,o=new Set(e.headers?.map(c=>c.name)??[]);if(n||a){let c=[];if(e.headers!=null)for(let f of e.headers)f.name!==t.builder.getAuthHeaderName()&&c.push(f);for(let[f,u]of Object.entries(i))if(!o.has(f))if(u!=null&&typeof u=="object"&&u.type!=null){let s=Ok({type:u.type,_default:void 0,validation:void 0,visitor:{primitive:l=>l.toString(),map:l=>l.toString(),list:l=>l,optional:l=>l,nullable:l=>l,set:l=>l,named:l=>l,literal:l=>{if(l.type==="string")return l.string;if(l.type==="boolean")return l.boolean.toString()},unknown:Gc}});s!=null&&c.push({name:f,value:ED.literal(uBi.string(s))})}else c.push({name:f,value:ED.primitive(pO.string(f))});r.headers=hrC({context:t,namedFullExamples:c})}return e.request!=null&&(r.request=fPe(e.request)),e.response!=null&&(r.response=QEy(e.response)),e.codeSamples!=null&&e.codeSamples.length>0&&(r["code-samples"]=e.codeSamples.map(c=>c.type==="language"?{name:c.name??void 0,docs:c.description??void 0,language:c.language,code:c.code,install:c.install??void 0}:{name:c.name??void 0,docs:c.description??void 0,sdk:c.sdk,code:c.code}).filter(qw)),r}function prC(e){let t={};return e.forEach(r=>{let n=fPe(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function _rC(e){let t={};return e.forEach(r=>{let n=fPe(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function hrC({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=fPe(n.value);i!=null&&(r[n.name]=i)}),r}function HEy(e){return Zfe._visit(e,{get:()=>XY.HttpMethodSchema.Get,post:()=>XY.HttpMethodSchema.Post,put:()=>XY.HttpMethodSchema.Put,patch:()=>XY.HttpMethodSchema.Patch,delete:()=>XY.HttpMethodSchema.Delete,head:()=>XY.HttpMethodSchema.Head,options:()=>{throw new Error("OPTIONS is unsupported")},trace:()=>{throw new Error("TRACE is unsupported")},_other:()=>{throw new Error("Unknown http method is unsupported")}})}function GEy(e){return e==="POST"||e==="PUT"||e==="PATCH"}function JEy({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:n}=r.ir,i=[],a=new Set,o=e.path,c=oPu(e.sdkName,e.namespace),f={};for(let M of e.pathParameters)M.parameterNameOverride&&(o=o.replace(M.name,M.parameterNameOverride)),f[M.parameterNameOverride??M.name]=nPu({pathParameter:M,context:r,fileContainingReference:t,namespace:c}),a.add(M.name);let u={};for(let M of e.queryParameters){let T=aPu({queryParameter:M,context:r,fileContainingReference:t,namespace:c});T!=null&&(u[M.name]=T,a.add(M.name))}let s;if(e.pagination!=null)switch(e.pagination.type){case"cursor":s={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":s={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":s={type:"custom",results:e.pagination.results};break;default:fc(e.pagination)}let l={path:o,method:HEy(e.method),auth:Object.keys(e.security).length>0?e.security:void 0,docs:e.description??void 0,pagination:s,source:e.source!=null?Jdi(e.source):void 0};!grC({context:r,request:e.request})&&Object.keys(f).length>0&&(l["path-parameters"]=f),e.summary!=null&&(l["display-name"]=e.summary);let m={},A=r.builder.getGlobalHeaderNames(),P=r.builder.getAuthHeaderName();P!=null&&A.add(P);let C=e.headers.filter(M=>!A.has(M.name));for(let M of C){let T=JQr({header:M,context:r,fileContainingReference:t,namespace:c});m[M.name]=T,a.add(typeof T=="string"?M.name:T.name??M.name)}if(e.request!=null){r.setInState(yse.Request);let M=brC({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.inlinePathParameters&&Object.keys(f).length>0?f:void 0,queryParameters:Object.keys(u).length>0?u:void 0,nonRequestReferencedSchemas:Array.from(n),headers:Object.keys(m).length>0?m:void 0,usedNames:a,namespace:c});l.request=M.value,i=[...i,...M.schemaIdsToExclude??[]],r.unsetInState(yse.Request)}else{let M=r.inlinePathParameters&&Object.keys(f).length>0,T=Object.keys(u).length>0,z=Object.keys(m).length>0,U={};(M||T||z)&&(U.name=e.requestNameOverride??e.generatedRequestName),M&&(U["path-parameters"]=f),T&&(U["query-parameters"]=u),z&&(U.headers=m),Object.keys(U).length>0&&(l.request=U)}if(e.response!=null&&e.response._visit({json:M=>{let T=SD({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l.response={docs:M.description??void 0,type:v6(T)},M.statusCode!=null&&(l.response["status-code"]=M.statusCode),M.responseProperty!=null&&(l.response.property=M.responseProperty)},streamingJson:M=>{let T=SD({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:v6(T),format:"json"}},streamingSse:M=>{let T=SD({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:v6(T),format:"sse"}},file:M=>{l.response={docs:M.description??void 0,type:"file","status-code":M.statusCode}},bytes:M=>{l.response={docs:M.description??void 0,type:"bytes","status-code":M.statusCode}},streamingText:M=>{l["response-stream"]={docs:M.description??void 0,type:"text"}},text:M=>{l.response={docs:M.description??void 0,type:"text","status-code":M.statusCode}},_other:()=>{throw new Error("Unrecognized Response type: "+e.response?.type)}}),r.builder.getEnvironmentType()==="multi"){let M=r.getDefaultServerName(),T=e.servers[0];T==null?M!=null&&(l.url=M):l.url=T.name??void 0}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=zG(e.availability)),Object.entries(e.errors).forEach(([M,T])=>{let z=T.generatedName,U=HP.of(xN);r.builder.enableUniqueErrorsPerEndpoint&&(z=`${e.generatedRequestName}${T.generatedName}`,T.schema!=null&&(T.schema.type!=="reference"&&T.schema.type!=="oneOf"?T.schema.generatedName=`${e.generatedRequestName}${T.schema.generatedName}`:T.schema.type==="oneOf"&&(T.schema.value.generatedName=`${e.generatedRequestName}${T.schema.value.generatedName}`)));let R={"status-code":parseInt(M)},V=mEy({location:KEy,namespaceOverride:c});if(T.schema!=null){let Y=SD({schema:T.schema,context:r,fileContainingReference:V,declarationFile:V,namespace:c,declarationDepth:0});R.type=v6(Y),R.docs=T.description}r.builder.addError(V,{name:z,schema:r.isErrorUnknownSchema(parseInt(M))?{...R,type:"unknown"}:R}),l.errors==null&&(l.errors=[]);let $=r.builder.addImport({file:t,fileToImport:V});l.errors.push($!=null?`${$}.${z}`:z),R.type!=null&&T.examples?.forEach(Y=>{let te={value:fPe(Y.example),name:Y.name,docs:Y.description};r.builder.addErrorExample(V,{name:z,example:te})})}),e.examples.length>0&&(l.examples=yrC({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=vrC({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[_yf,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:i}}function yrC({endpointExamples:e,context:t}){return e.map(r=>{try{return WEy({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function vrC({retries:e}){if(e!=null)switch(e.type){case"disabled":return{disabled:e.value??void 0};default:fc(e)}}function brC({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:a,pathParameters:o,queryParameters:c,nonRequestReferencedSchemas:f,headers:u,usedNames:s,namespace:l}){if(n.type==="json"||n.type==="formUrlEncoded"){let m=n.schema.type==="reference"?n.schema.schema:void 0,A=n.schema.type==="reference"?r.getSchema(n.schema.schema,l):n.schema;if(A?.type!=="object"||m!=null&&f.includes(m)){let z=SD({schema:n.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),U={schemaIdsToExclude:[],value:{body:z}},R=Object.keys(o??{}).length>0,V=Object.keys(c??{}).length>0,$=Object.keys(u??{}).length>0;return R&&(U.value["path-parameters"]=o),V&&(U.value["query-parameters"]=c),$&&(U.value.headers=u),(R||V||$)&&(U.value.name=i??a),n.contentType!=null&&(U.value["content-type"]=n.contentType),n.description!=null&&(U.value.docs=n.description),U}let P=Object.fromEntries(A.properties.filter(z=>z.readonly==null?!0:!(GEy(e.method)&&z.readonly)).map(z=>{let U=SD({schema:z.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:1}),R=z.nameOverride??z.key,V=zG(z.availability);if(!s.has(R)&&z.audiences.length<=0)return s.add(R),z.nameOverride!=null?[z.key,{type:v6(U),docs:pWa(U),name:z.nameOverride,availability:V}]:[z.key,V?{...typeof U=="string"?{type:U}:U,availability:V}:U];let $={type:v6(U),docs:pWa(U)};return s.has(R)&&($.name=z.generatedName),z.audiences.length>0&&($.audiences=z.audiences),V!=null&&($.availability=V),s.add(R),[z.key,$]})),C=A.allOf.map(z=>{let U=SD({schema:xw.reference(z),fileContainingReference:t,context:r,namespace:l,declarationDepth:0});return v6(U)}).filter(z=>z!=="unknown"),M={properties:P};C.length>0&&(M.extends=C),n.additionalProperties&&(M["extra-properties"]=!0);let T={name:i??A.nameOverride??A.generatedName,"path-parameters":o,"query-parameters":c,headers:u,body:M};return n.contentType!=null&&(T["content-type"]=n.contentType),n.description!=null&&(T.docs=n.description),{schemaIdsToExclude:m!=null?[m]:[],value:T}}else if(n.type==="octetStream"){let m={body:"bytes","content-type":n.contentType??u7.APPLICATION_OCTET_STREAM,"query-parameters":c};return c!=null&&(m.name=i??a),n.description!=null&&(m.docs=n.description),{schemaIdsToExclude:[],value:m}}else if(n.type==="multipart"){let m=Object.fromEntries(n.properties.map(A=>{if(A.schema.type==="file"){let P=A.schema.isArray?"list<file>":"file";if(P=A.schema.isOptional?`optional<${P}>`:P,A.description!=null||A.contentType!=null){let C={type:P};if(A.description!=null&&(C.docs=A.description),A.contentType!=null){let M=A.contentType.split(",")[0];C["content-type"]=M}return[A.key,C]}return[A.key,P]}else{let P=SD({schema:A.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(A.contentType||A.exploded||A.encoding){let C=typeof P=="string"?{type:P}:P;A.contentType!=null&&(C["content-type"]=A.contentType),A.encoding==="form"?C.style="form":A.encoding==="json"?C.style="json":A.exploded&&(C.style="exploded"),P=C}return[A.key,P]}}));return{schemaIdsToExclude:n.name==null?[]:[n.name],value:{name:i??n.name??a,"path-parameters":o,"query-parameters":c,headers:u,body:{properties:m},"content-type":u7.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else fc(n)}function grC({context:e,request:t}){if(!e.inlinePathParameters)return!1;if(t==null)return!0;switch(t.type){case"octetStream":return!1;case"multipart":return!0;case"json":return!0;case"formUrlEncoded":return!0;default:fc(t)}}function mrC({location:e,namespaceOverride:t}){return t!=null?{...e,file:HY(HP.of(t),e.file)}:e}function OrC(e){let t=e.namespace,r=e.tags.filter(f=>f!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:HP.of(`${hA(r)}.yml`),endpointId:e.summary!=null?hA(e.summary):hA(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:HP.of(xN),endpointId:hA(e.summary)}:{file:HP.of(xN),endpointId:hA(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:HP.of(xN),endpointId:n};let i=q8o(r),a=q8o(n);if(Foe(i,a))return{file:HP.of("__package__.yml"),endpointId:r};let o=wrC({operationId:n,tag:r,path:e.path,method:e.method});if(o!=null)return o;let c=[];for(let f=0;f<i.length;++f){let u=i[f];if(u!=null&&u===a[f])c.push(u);else{let s=hA(r);return{file:HP.of(`${s}.yml`),endpointId:n,tag:r}}}if(c.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:HP.of(hA(c.join("_"))+".yml"),endpointId:hA(a.slice(c.length).join("_")),tag:r}}function R8o(e){let t=e.tags[0];if(e.sdkName!=null){let r=Zhf({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:HP.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return mrC({namespaceOverride:e.namespace,location:OrC(e)})}function q8o(e){let t;return/^[a-z]+(?:[A-Z][a-z]+)*$/.test(e)?t=e.split(/(?=[A-Z])/):t=e.split(/[^a-zA-Z0-9]+/),t=t.map(r=>r.toLowerCase()),t=yft(t),t}var ArC=new RegExp("[^a-zA-Z0-9{}]+"),PrC=new RegExp("[{}]","g");function wrC({operationId:e,tag:t,path:r,method:n}){let a=`${r.split(ArC).join("_").replaceAll(PrC,"_")}_${n.toLowerCase()}`;if(e.endsWith(a))return{file:HP.of(hA(t)+".yml"),endpointId:hA(e.slice(0,-1*a.length)),tag:t}}function $Ey(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let a of r){let{endpointId:o,file:c,tag:f}=R8o(a),u=c.split(".")[0];u!=null&&t.add(u);let s;if(a.sdkName!=null){let A=e.ir.groups;for(let P of a.sdkName.groupName){let C=typeof P=="string"?P:P.name,M=A[C];if(M==null)break;if(M.summary!=null||M.description!=null){s=A[C];break}}}let l=f==null?void 0:n.tagsById[f];e.setInState(yse.Endpoint),e.setEndpointMethod(a.method);let m=JEy({context:e,endpoint:a,declarationFile:c});e.unsetEndpointMethod(),e.unsetInState(yse.Endpoint),i=[...i,...m.schemaIdsToExclude],e.builder.addEndpoint(c,{name:o,schema:m.value,source:a.source!=null?Jdi(a.source):void 0}),(l?.id!=null||l?.description!=null)&&e.builder.setServiceInfo(c,{"display-name":s?.summary??l?.id,docs:s?.description??l?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}function YEy(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?Kdi(r.groupName):void 0,i=SD({schema:xw.primitive(r),context:e,fileContainingReference:HP.of(xN),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:v6(i),docs:r.description??void 0}})}}function XEy(e){for(let t of e.ir.webhooks){let r=SrC({webhook:t,context:e});if(r==null)continue;let n=oPu(t.sdkName,t.namespace),i={};for(let o of t.headers)i[o.name]=JQr({header:o,context:e,fileContainingReference:r.file,namespace:n});let a={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:i,payload:SD({schema:t.payload,context:e,fileContainingReference:r.file,namespace:n,declarationDepth:0}),examples:t.examples!=null?t.examples.map(o=>({docs:o.description,name:o.name,payload:fPe(o.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function jrC({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:HY(HP.of(t),e.file)}:e}function ErC({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:HP.of(xN),endpointId:n};let i=q8o(r),a=q8o(n);if(Foe(i,a))return{file:HP.of("__package__.yml"),endpointId:r};let o=[];for(let c=0;c<i.length;++c){let f=i[c];if(f!=null&&f===a[c])o.push(f);else{let u=hA(r);return{file:HP.of(`${u}.yml`),endpointId:n,tag:r}}}if(o.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:HP.of(hA(o.join("_"))+".yml"),endpointId:hA(a.slice(o.length).join("_")),tag:r}}function SrC({webhook:e,context:t}){return e.sdkName!=null?{file:gEy({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:jrC({namespaceOverride:e.namespace,location:ErC({webhook:e,context:t})})}var DrC=HP.of(xN);function kEy(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":return ZEy({namespace:e.namespace,groupName:e.groupName});case"oneOf":return ZEy({namespace:e.value.namespace,groupName:e.value.groupName});case"unknown":return DrC;default:fc(e)}}function ZEy({namespace:e,groupName:t}){return e!=null&&t!=null?gBi([{type:"namespace",name:e},...t]):e!=null?gBi([{type:"namespace",name:e}]):gBi(t)}var _yf="external",KEy=HP.of(xN);function eSy({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,a]of Object.entries(e)){if(t.includes(i))continue;let o=kEy(a),c=EEy({schema:a,context:n,declarationFile:o,namespace:r,declarationDepth:0});if(dCi(c.schema)){let f=v6(c.schema);if(f===(c.name??i)||f===`optional<${c.name??i}>`||f===`optional<nullable<${c.name??i}>>`)continue}n.builder.addType(o,{name:c.name??i,schema:c.schema})}}function tSy(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),xEy(e),FEy(e),zEy(e),MEy(e),YEy(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(_yf);let t=$Ey(e),r=t.sdkGroups;e.setInState(yse.Webhook),XEy(e),e.unsetInState(yse.Webhook),e.setInState(yse.Channel);for(let i of Object.values(e.ir.channels)){let a=gBi(i.groupName);REy({channel:i,context:e,declarationFile:a})}e.unsetInState(yse.Channel);let n=CrC({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});eSy({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))eSy({schemas:a,schemaIdsToExclude:n,namespace:i,context:e});return e.ir.tags.orderedTagIds!=null&&e.ir.tags.orderedTagIds.length>0&&e.ir.tags.orderedTagIds.every(a=>r.has(a))&&e.builder.addNavigation({navigation:e.ir.tags.orderedTagIds}),e.builder.build()}function CrC({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return t;let n=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(a=>Object.keys(a))]),i=new Set(t);for(let a of n)r.includes(a)||i.add(a);return Array.from(i)}var N8o=class{context;constructor(t){this.context=t}};var sPu=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[o,c]of Object.entries(n.files)){let f=i!=null?HP.of(`${i}${"/"}${o}`):HP.of(o);t[f]=c}let a=Object.keys(n.directories).sort();for(let o of a){let c=i!=null?`${i}${"/"}${o}`:o,f=n.directories[o];r(f,c)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[HP.of(t[0])]??={};let[r,...n]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(n)}};var XZi=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new sPu,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":n,"display-name":i,docs:a}){let o=this.getOrCreateFile(t);o.service==null&&(o.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(o.service.auth=r),n!=null&&(o.service["base-path"]=n),i!=null&&(o.service["display-name"]=i),a!=null&&(o.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 e8r(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let n of Object.values(this.rootApiFile["auth-schemes"]))rSy(n)&&t.push(n.header);let r=this.getVersionHeader();return r!=null&&t.push(r),new Set(t)}getAuthHeaderName(){if(this.rootApiFile["auth-schemes"]!=null){for(let t of Object.values(this.rootApiFile["auth-schemes"]))if(rSy(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let n=this.getVersionHeader();n!=null&&n===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}getGlobalHeaders(){return this.rootApiFile.headers??{}}addIdempotencyHeader({name:t,schema:r}){this.rootApiFile["idempotency-headers"]==null&&(this.rootApiFile["idempotency-headers"]={}),this.rootApiFile["idempotency-headers"][t]=r}addVariable({name:t,schema:r}){this.rootApiFile.variables==null&&(this.rootApiFile.variables={}),this.rootApiFile.variables[t]=r}addImport({file:t,fileToImport:r,alias:n}){if(t===r)return;let i=n??hA((Ift(r)+"/"+UJi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===HP.of(sk))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=rWs(Ift(x6a.of(`/${t}`)),x6a.of(`/${r}`)),i;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[i]=rWs(Ift(x6a.of(`/${t}`)),x6a.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===HP.of(sk))return;let i=this.getOrCreateFile(t);i.types==null&&(i.types={}),i.types[r]=n}addTypeExample(t,r,n){let i=this.getOrCreateFile(t);i.types==null&&(i.types={});let a=i.types[r];a!=null&&(typeof a=="string"?i.types[r]={type:a,examples:[n]}:(a.examples==null&&(a.examples=[]),a.examples.push(n)))}addError(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.errors==null&&(i.errors={}),i.errors[r]==null?i.errors[r]=n:i.errors[r]?.type!==n.type&&(i.errors[r]={"status-code":n["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:n}){let i=this.getOrCreateFile(t);if(i.errors==null)return;let a=i.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(c=>Foe(c,n))??!1)||a.examples?.push(n)}addEndpoint(t,{name:r,schema:n,source:i}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),i!=null&&(a.service.source=i),a.service.endpoints[r]=n}addWebhook(t,{name:r,schema:n}){let i=this.getOrCreateFile(t);i.webhooks==null&&(i.webhooks={}),i.webhooks[r]=n}addChannel(t,{channel:r}){let n=this.getOrCreateFile(t);n.channel=r;let i=this.basePath;i!=null&&(n.channel.path=HY(i,r.path))}addChannelExample(t,{example:r}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.examples==null&&(n.channel.examples=[]),n.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:n}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.messages[r]=n}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([i,a])=>[i,{...a,path:HY(r,a.path)}]))});for(let i of Object.values(t))i.service!=null&&(i.service={...i.service,endpoints:Object.fromEntries(Object.entries(i.service.endpoints).map(([a,o])=>[a,{...o,path:HY(r,o.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===xN?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 rSy(e){return e?.header!=null}var uPu=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;detectGlobalHeaders;objectQueryParameters;respectReadonlySchemas;respectNullableSchemas;onlyIncludeReferencedSchemas;inlinePathParameters;useBytesForBinaryResponse;respectForwardCompatibleEnums;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;endpointMethod;state=new Set;constructor({taskContext:t,ir:r,options:n,environmentOverrides:i,globalHeaderOverrides:a,authOverrides:o}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=i,this.authOverrides=o,this.globalHeaderOverrides=a,this.detectGlobalHeaders=n?.detectGlobalHeaders??!0,this.objectQueryParameters=n?.objectQueryParameters??!1,this.respectReadonlySchemas=n?.respectReadonlySchemas??!1,this.respectNullableSchemas=n?.respectNullableSchemas??!1,this.onlyIncludeReferencedSchemas=n?.onlyIncludeReferencedSchemas??!1,this.inlinePathParameters=n?.inlinePathParameters??!1,this.useBytesForBinaryResponse=n?.useBytesForBinaryResponse??!1,this.respectForwardCompatibleEnums=n?.respectForwardCompatibleEnums??!1,this.referencedSchemaIds=n?.onlyIncludeReferencedSchemas?new Set:void 0,this.enableUniqueErrorsPerEndpoint=n?.enableUniqueErrorsPerEndpoint??!1,this.builder=new XZi(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let c={};if(!this.enableUniqueErrorsPerEndpoint)for(let f of r.endpoints)for(let[u,s]of Object.entries(f.errors)){let l=parseInt(u),m=c[l];m==null&&s.schema!=null?c[l]=s.schema:m!=null&&s.schema!=null&&Bxe(m,s.schema)||this.unknownSchema.add(l)}}getReferencedSchemaIds(){if(this.referencedSchemaIds!=null)return Array.from(this.referencedSchemaIds)}getSchema(t,r){return r==null?this.ir.groupedSchemas.rootSchemas[t]:this.ir.groupedSchemas.namespacedSchemas[r]?.[t]}getDefaultServerName(){return this.defaultServerName}setDefaultServerName(t){this.defaultServerName=t}isErrorUnknownSchema(t){return this.unknownSchema.has(t)}getEndpointMethod(){return this.endpointMethod}setEndpointMethod(t){this.endpointMethod=t}unsetEndpointMethod(){this.endpointMethod=void 0}isInState(t){return this.state.has(t)}setInState(t){this.state.add(t)}unsetInState(t){this.state.delete(t)}shouldMarkSchemaAsReferenced(){return this.onlyIncludeReferencedSchemas&&this.isInAnyState(yse.Channel,yse.Endpoint,yse.Webhook)}markSchemaAsReferenced(t,r){switch(t.type){case"primitive":return;case"object":this.markObjectSchemaAsReferenced(t,r);return;case"array":this.markSchemaAsReferenced(t.value,r);return;case"map":this.markSchemaAsReferenced(t.value,r);return;case"optional":this.markSchemaAsReferenced(t.value,r);return;case"reference":this.markSchemaIdAsReferenced(t.schema,r);return;case"oneOf":this.markOneofSchemaAsReferenced(t.value,r);return;case"nullable":this.markSchemaAsReferenced(t.value,r);return;case"enum":return;case"literal":return;case"unknown":return;default:fc(t)}}markObjectSchemaAsReferenced(t,r){for(let n of t.allOf)this.markSchemaIdAsReferenced(n.schema,r);for(let n of t.properties)this.markSchemaAsReferenced(n.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let n of Object.values(t.schemas))this.markSchemaAsReferenced(n,r);return;case"undiscriminated":for(let n of t.schemas)this.markSchemaAsReferenced(n,r);return;default:fc(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let n=this.getSchema(t,r);n!=null&&this.markSchemaAsReferenced(n,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}};function hyf(e){let t=new uPu(e);return tSy(t)}var cPu=class{args;constructor(t){this.args=t}convert({context:t,ir:r,settings:n,absoluteFilePath:i}){let a=hyf({taskContext:t,ir:r,options:j8o({overrides:{...n,respectReadonlySchemas:n?.respectReadonlySchemas??this.args.respectReadonlySchemas,respectNullableSchemas:n?.respectNullableSchemas??this.args.respectNullableSchemas,onlyIncludeReferencedSchemas:n?.onlyIncludeReferencedSchemas??this.args.onlyIncludeReferencedSchemas,inlinePathParameters:n?.inlinePathParameters??this.args.inlinePathParameters,objectQueryParameters:n?.objectQueryParameters??this.args.objectQueryParameters,useBytesForBinaryResponse:n?.useBytesForBinaryResponse??this.args.useBytesForBinaryResponse,respectForwardCompatibleEnums:n?.respectForwardCompatibleEnums??this.args.respectForwardCompatibleEnums}}),authOverrides:n?.auth!=null?{auth:n.auth}:this.args.generatorsConfiguration?.api?.auth!=null?{...this.args.generatorsConfiguration.api}:void 0,environmentOverrides:this.args.generatorsConfiguration?.api?.environments!=null?{...this.args.generatorsConfiguration?.api}:void 0,globalHeaderOverrides:this.args.generatorsConfiguration?.api?.headers!=null?{...this.args.generatorsConfiguration?.api}:void 0});return{absoluteFilePath:i??this.args.absoluteFilePath,rootApiFile:{defaultUrl:a.rootApiFile["default-url"],contents:a.rootApiFile,rawContents:Fg.dump(a.rootApiFile)},namedDefinitionFiles:{...fg(a.definitionFiles,o=>({absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Fg.dump(o),contents:o})),[HP.of(xN)]:{absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Fg.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var x8o=class extends iMr{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.converter=new cPu(t)}async getDefinition({context:t,absoluteFilePath:r,relativePathToDependency:n},i){let a=await this.getOpenAPIIr({context:t,relativePathToDependency:n},i);return this.converter.convert({context:t,ir:a,settings:i,absoluteFilePath:r})}async toFernWorkspace({context:t},r){let n=await this.getDefinition({context:t},r);return new yrt({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion})}};var Fve={BEARER_FORMAT:"x-bearer-format",ENUM_VAR_NAMES:"x-enum-varnames",INTERNAL:"x-internal",EXAMPLES:"x-examples",TAGS:"x-tags",REDOCLY_CODE_SAMPLES_KEBAB:"x-code-samples",REDOCLY_CODE_SAMPLES_CAMEL:"x-codeSamples"};var _Wa={of(e){return e}};var nSy={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},yyf={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:nSy,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},mb={SOURCE:_Wa.of("source"),SDK_NAMESPACE:_Wa.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:_Wa.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:_Wa.of("x-fern-sdk-group-name"),REQUEST_NAME_V1:"x-request-name",REQUEST_NAME_V2:"x-fern-request-name",TYPE_NAME:"x-fern-type-name",BOOLEAN_LITERAL:"x-fern-boolean-literal",SERVER_NAME_V1:"x-name",SERVER_NAME_V2:"x-fern-server-name",BASE_PATH:"x-fern-base-path",GROUPS:_Wa.of("x-fern-groups"),OPENAPI_OVERIDES_FILEPATH:"x-fern-overrides-filepath",TYPE_DEFINITION:"x-fern-type",STREAMING:"x-fern-streaming",PAGINATION:"x-fern-pagination",WEBHOOK:"x-fern-webhook",ASYNC_CONFIG:"x-fern-async-config",RETRIES:"x-fern-retries",SDK_VARIABLES:"x-fern-sdk-variables",SDK_VARIABLE:"x-fern-sdk-variable",PARAMETER_NAME:"x-fern-parameter-name",BASIC_AUTH_USERNAME_VARIABLE_NAME:"x-fern-username-variable-name",BASIC_AUTH_PASSWORD_VARIABLE_NAME:"x-fern-password-variable-name",BEARER_TOKEN_VARIABLE_NAME:"x-fern-token-variable-name",HEADER_VARIABLE_NAME:"x-fern-header-variable-name",FERN_ENUM:"x-fern-enum",AUDIENCES:"x-fern-audiences",IGNORE:"x-fern-ignore",AVAILABILITY:"x-fern-availability",RESPONSE_PROPERTY:"x-fern-sdk-return-value",RESOLUTIONS:"x-fern-resolutions",EXAMPLES:"x-fern-examples",FERN_BEARER_TOKEN:"x-fern-bearer",FERN_HEADER_AUTH:"x-fern-header",FERN_BASIC_AUTH:"x-fern-basic",FERN_GLOBAL_HEADERS:"x-fern-global-headers",FERN_IDEMPOTENCY_HEADERS:"x-fern-idempotency-headers",IDEMPOTENT:"x-fern-idempotent",FERN_PROPERTY_NAME:"x-fern-property-name",IS_UNDISCRIMINATED:"x-fern-undiscriminated",FERN_VERSION:"x-fern-version",ENCODING:"x-fern-encoding",TRANSPORT:"x-fern-transport",IS_DISCRIMINATED:"x-fern-discriminated"};var qK={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!0,audiences:void 0,optionalAdditionalProperties:!0,coerceEnumsToLiterals:!0,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,preserveSchemaIds:!1,objectQueryParameters:!1,shouldUseUndiscriminatedUnionsWithLiterals:!1,shouldUseIdiomaticRequestNames:!1,filter:void 0,asyncApiNaming:"v1",exampleGeneration:void 0,defaultFormParameterEncoding:"json",useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,additionalPropertiesDefaultsTo:!1,typeDatesAsStrings:!0,preserveSingleSchemaOneOf:!1,inlineAllOfSchemas:!1,groupMultiApiEnvironments:!1};function b_t({options:e,overrides:t}){return{disableExamples:t?.disableExamples??qK.disableExamples,discriminatedUnionV2:t?.discriminatedUnionV2??e?.discriminatedUnionV2??qK.discriminatedUnionV2,useTitlesAsName:t?.useTitlesAsName??e?.useTitlesAsName??qK.useTitlesAsName,audiences:t?.audiences??e?.audiences??qK.audiences,optionalAdditionalProperties:t?.optionalAdditionalProperties??e?.optionalAdditionalProperties??qK.optionalAdditionalProperties,coerceEnumsToLiterals:t?.coerceEnumsToLiterals??e?.coerceEnumsToLiterals??qK.coerceEnumsToLiterals,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??qK.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??qK.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??qK.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??qK.inlinePathParameters,preserveSchemaIds:t?.preserveSchemaIds??qK.preserveSchemaIds,shouldUseUndiscriminatedUnionsWithLiterals:t?.shouldUseUndiscriminatedUnionsWithLiterals??e?.shouldUseUndiscriminatedUnionsWithLiterals??qK.shouldUseUndiscriminatedUnionsWithLiterals,shouldUseIdiomaticRequestNames:t?.shouldUseIdiomaticRequestNames??e?.shouldUseIdiomaticRequestNames??qK.shouldUseIdiomaticRequestNames,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??qK.objectQueryParameters,filter:t?.filter??e?.filter??qK.filter,asyncApiNaming:t?.asyncApiNaming??e?.asyncApiNaming??qK.asyncApiNaming,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??qK.useBytesForBinaryResponse,exampleGeneration:t?.exampleGeneration??e?.exampleGeneration??void 0,defaultFormParameterEncoding:t?.defaultFormParameterEncoding??e?.defaultFormParameterEncoding??void 0,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??qK.respectForwardCompatibleEnums,additionalPropertiesDefaultsTo:t?.additionalPropertiesDefaultsTo??e?.additionalPropertiesDefaultsTo??qK.additionalPropertiesDefaultsTo,typeDatesAsStrings:t?.typeDatesAsStrings??e?.typeDatesAsStrings??qK.typeDatesAsStrings,preserveSingleSchemaOneOf:t?.preserveSingleSchemaOneOf??e?.preserveSingleSchemaOneOf??qK.preserveSingleSchemaOneOf,inlineAllOfSchemas:t?.inlineAllOfSchemas??e?.inlineAllOfSchemas??qK.inlineAllOfSchemas,groupMultiApiEnvironments:t?.groupMultiApiEnvironments??e?.groupMultiApiEnvironments??qK.groupMultiApiEnvironments}}var iSy={naming:"v1"};function Vy(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function F8o(e,t,r,n,i=[]){try{let a=Vy(e,t);if(a!=null)return r.parse(a)}catch{let o=yft(i).join(" -> ");n.error(`${o.length>0?`${o}: `:""}Failed to parse ${t}`)}}function ZZi(e){let t=Vy(e,"examples");if(t!=null){if(Array.isArray(t))return t;if(typeof t=="object"&&t!==null)return Object.values(t).map(r=>typeof r=="object"&&r!==null&&"value"in r?r.value:r)}return[]}function aSy({schema:e,logger:t}){return Vy(e,mb.ENCODING)??void 0}function oSy(e){return Vy(e,mb.FERN_ENUM)}function sSy({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:a}){let o=Vy(n,mb.SDK_NAMESPACE),c=Vy(n,mb.SDK_GROUP_NAME),f=Vy(n,mb.TYPE_DEFINITION);if(f!=null)return z8o({fernType:f,nameOverride:e,generatedName:t,title:r,description:i,availability:a,namespace:o,groupName:typeof c=="string"?[c]:c})}function z8o({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c}){return Ok({type:e,_default:void 0,validation:void 0,visitor:{primitive:f=>{switch(f.v1){case"BASE_64":return ay.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:M0.base64({example:void 0})});case"BOOLEAN":return ay.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:M0.boolean({default:void 0,example:void 0})});case"DATE":return ay.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:M0.date({example:void 0})});case"DATE_TIME":return ay.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:M0.datetime({example:void 0})});case"FLOAT":return ay.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:M0.float({example:void 0})});case"DOUBLE":return ay.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:M0.double({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT":return ay.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:M0.uint({default:void 0,example:void 0})});case"INTEGER":return ay.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:M0.int({default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0,example:void 0})});case"UINT_64":return ay.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:M0.uint64({default:void 0,example:void 0})});case"LONG":return ay.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:M0.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return ay.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:M0.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:fc(f.v1)}},unknown:()=>ay.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:a,namespace:o,groupName:c}),map:({keyType:f,valueType:u})=>f?.type==="primitive"&&u!=null?ay.map({nameOverride:t,generatedName:r,title:n,key:f,value:u,description:i,availability:a,namespace:o,groupName:c,encoding:void 0,example:void 0,inline:void 0}):void 0,list:f=>f!=null?ay.array({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,optional:f=>f!=null?ay.optional({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,nullable:f=>f!=null?ay.nullable({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,set:f=>f!=null?ay.array({nameOverride:t,generatedName:r,title:n,value:f,description:i,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,literal:f=>ay.literal({nameOverride:t,generatedName:r,title:n,value:f._visit({string:u=>J9.string(u),boolean:u=>J9.boolean(u),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:a,namespace:o,groupName:c}),named:f=>ay.reference({schema:f,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,source:cPe.openapi({file:"<memory>"})})}})}function uSy(e){let t=Vy(e,mb.SOURCE);if(t!=null)return t.endsWith(".proto")?cPe.protobuf({file:t}):cPe.openapi({file:t})}function kZi(e){if(e!=null&&typeof e=="boolean")return e}function c0(e){return e?.$ref!=null}function cSy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:a,availability:o,wrapAsNullable:c,context:f,namespace:u,groupName:s,example:l,encoding:m,source:A}){return i===void 0&&(i=f.options.additionalPropertiesDefaultsTo),typeof i=="boolean"||hWa(i,f.options)?lPu({nameOverride:e,generatedName:t,title:r,wrapAsNullable:c,description:a,availability:o,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:M0.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),namespace:void 0,groupName:void 0},valueSchema:ay.unknown({nameOverride:void 0,generatedName:`${t}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0}),namespace:u,groupName:s,example:l,encoding:m}):lPu({nameOverride:e,generatedName:t,title:r,wrapAsNullable:c,description:a,availability:o,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:M0.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),namespace:void 0,groupName:void 0},valueSchema:lSy(hE(i,f.options.optionalAdditionalProperties?c:!1,f,[...n,"Value"],A,u,void 0,void 0,void 0)),namespace:u,groupName:s,example:l,encoding:m})}function lSy(e){switch(e.type){case"array":case"enum":case"map":case"object":e.inline=!0;break;case"literal":case"primitive":case"reference":case"unknown":break;case"nullable":case"optional":e.inline=!0,e.value=lSy(e.value);break;case"oneOf":e.value.inline=!0;break;default:fc(e)}return e}function lPu({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsNullable:a,description:o,availability:c,namespace:f,groupName:u,example:s,encoding:l}){return a?ay.nullable({nameOverride:e,generatedName:t,title:r,value:ay.map({nameOverride:e,generatedName:t,title:r,description:o,availability:n.availability,key:n,value:i,namespace:f,groupName:u,encoding:l,example:s,inline:void 0}),description:o,availability:c,namespace:f,groupName:u,inline:void 0}):ay.map({nameOverride:e,generatedName:t,title:r,description:o,availability:c,key:n,value:i,namespace:f,groupName:u,encoding:l,example:s,inline:void 0})}function hWa(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:!c0(e)&&Object.keys(e).length===0}function fSy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:a,availability:o,wrapAsNullable:c,context:f,namespace:u,groupName:s,example:l,source:m}){let A=i==null?ay.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:u,groupName:s}):hE(i,!1,f,[...n,"Item"],m,u);return IrC({nameOverride:e,generatedName:t,title:r,namespace:u,groupName:s,itemSchema:A,wrapAsNullable:c,description:a,availability:o,example:l})}function IrC({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsNullable:i,description:a,availability:o,namespace:c,groupName:f,example:u}){return i?ay.nullable({nameOverride:e,generatedName:t,title:r,value:ay.array({nameOverride:e,generatedName:t,title:r,value:n,description:a,availability:o,namespace:c,groupName:f,example:u,inline:void 0}),description:a,availability:o,namespace:c,groupName:f,inline:void 0}):ay.array({nameOverride:e,generatedName:t,title:r,value:n,description:a,availability:o,namespace:c,groupName:f,example:u,inline:void 0})}function dPe(e){switch(Vy(e,mb.AVAILABILITY)){case"deprecated":return Yfe.Deprecated;case"beta":return Yfe.Beta;case"generally-available":return Yfe.GenerallyAvailable;default:break}if(!c0(e)&&e.deprecated)return Yfe.Deprecated}function vyf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:o,required:c,wrapAsNullable:f,discriminator:u,context:s,namespace:l,groupName:m,encoding:A,source:P}){let C=u.propertyName,M=Object.fromEntries(Object.entries(u.mapping??{}).map(([z,U])=>{let R=Ydi({$ref:U},!1,s,[U],A,P,l);return s.markReferencedByDiscriminatedUnion({$ref:U},C,1),[z,R]})),T=Object.entries(i).filter(([z])=>z!==C).map(([z,U])=>{let R=c!=null&&c.includes(z),V=hE(U,!R,s,[...n,z],P,l);return{key:z,schema:V}});return dSy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:f,properties:T,description:a,availability:o,discriminant:C,subtypes:M,namespace:l,groupName:m,source:P})}function byf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:o,required:c,wrapAsNullable:f,discriminant:u,variants:s,context:l,namespace:m,groupName:A,encoding:P,source:C}){let M=Object.fromEntries(Object.entries(s).map(([z,U])=>{if(c0(U)){let R=Ydi(U,!1,l,[U.$ref],P,C,m);return l.markReferencedByDiscriminatedUnion(U,u,1),[z,R]}else{let R=Q8o(U,!1,l,[...n,z],P,C,m,new Set([u]));return[z,R]}})),T=Object.entries(i).filter(([z])=>z!==u).map(([z,U])=>{let R=c!=null&&c.includes(z),V=hE(U,!R,l,[...n,z],C,m);return{key:z,schema:V}});return dSy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:f,properties:T,description:a,availability:o,discriminant:u,subtypes:M,namespace:m,groupName:A,source:C})}function dSy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,properties:i,description:a,availability:o,discriminant:c,subtypes:f,namespace:u,groupName:s,source:l}){return n?ay.nullable({nameOverride:e,generatedName:t,title:r,value:ay.oneOf(VDe.discriminated({description:a,availability:o,discriminantProperty:c,nameOverride:e,generatedName:t,title:r,schemas:f,commonProperties:i,namespace:u,groupName:s,encoding:void 0,source:l,inline:void 0})),namespace:u,groupName:s,description:a,availability:o,inline:void 0}):ay.oneOf(VDe.discriminated({description:a,availability:o,discriminantProperty:c,nameOverride:e,generatedName:t,title:r,schemas:f,commonProperties:i,namespace:u,groupName:s,encoding:void 0,source:l,inline:void 0}))}function pSy(e){if(e.proto!=null)return TVa.protobuf({typeName:e.proto.type})}function ABi({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:a,_default:o,description:c,availability:f,wrapAsNullable:u,namespace:s,groupName:l,context:m,source:A,inline:P}){let C=BrC(i??[]),M=new Set(a),T=Array.from(M).map((U,R)=>{let V=n?.[U],$=C[R],re=lWa.test(U),Y=V?.name??$,te=re?U:fWa(U);return Y!=null&&!lWa.test(Y)&&(m?.logger.warn(`Enum name override ${Y} is not a valid name. Falling back on ${te}.`),Y=void 0),{nameOverride:Y,generatedName:te,value:U,description:V?.description,availability:f,casing:{snake:V?.casing?.snake??void 0,pascal:V?.casing?.pascal??void 0,screamingSnake:V?.casing?.screamingSnake??void 0,camel:V?.casing?.camel??void 0}}}),z=o!=null?T.find(U=>U.value===o):void 0;return MrC({wrapAsNullable:u,nameOverride:e,generatedName:t,title:r,values:T,_default:z,description:c,availability:f,namespace:s,groupName:l,source:A,inline:P})}function MrC({wrapAsNullable:e,nameOverride:t,generatedName:r,title:n,values:i,_default:a,description:o,availability:c,namespace:f,groupName:u,source:s,inline:l}){return e?ay.nullable({nameOverride:t,generatedName:r,title:n,value:ay.enum({nameOverride:t,generatedName:r,title:n,values:i,description:o,default:a,availability:c,example:void 0,namespace:f,groupName:u,source:s,inline:l}),description:o,availability:c,namespace:f,groupName:u,inline:l}):ay.enum({nameOverride:t,generatedName:r,title:n,values:i,description:o,availability:c,default:a,example:void 0,namespace:f,groupName:u,source:s,inline:l})}function BrC(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(n=>n[r]===t[r]);)r++;return e.map(n=>n.substring(r))}function _Sy({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,description:s,availability:l,wrapAsNullable:m,example:A,namespace:P,groupName:C}){return n==="int64"?vse({nameOverride:e,generatedName:t,title:r,primitive:M0.int64({default:i,example:A}),wrapAsNullable:m,description:s,availability:l,namespace:P,groupName:C}):n==="uint32"?vse({nameOverride:e,generatedName:t,title:r,primitive:M0.uint({default:i,example:A}),wrapAsNullable:m,description:s,availability:l,namespace:P,groupName:C}):n==="uint64"?vse({nameOverride:e,generatedName:t,title:r,primitive:M0.uint64({default:i,example:A}),wrapAsNullable:m,description:s,availability:l,namespace:P,groupName:C}):vse({nameOverride:e,generatedName:t,title:r,primitive:M0.int({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,example:A}),wrapAsNullable:m,description:s,availability:l,namespace:P,groupName:C})}function hSy(e){return typeof e=="string"?J9.string(e):typeof e=="boolean"?J9.boolean(e):J9.string(`${e}`)}function ySy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,value:i,description:a,availability:o,namespace:c,groupName:f}){return n?ay.nullable({nameOverride:e,generatedName:t,title:r,value:ay.literal({nameOverride:e,generatedName:t,title:r,value:hSy(i),description:a,availability:o,namespace:c,groupName:f}),description:a,availability:o,namespace:c,groupName:f,inline:void 0}):ay.literal({nameOverride:e,generatedName:t,title:r,value:hSy(i),description:a,availability:o,namespace:c,groupName:f})}function gyf({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,description:s,availability:l,wrapAsNullable:m,example:A,namespace:P,groupName:C}){return n==null||n==="double"?vse({nameOverride:e,generatedName:t,title:r,primitive:M0.double({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,example:A}),wrapAsNullable:m,description:s,availability:l,namespace:P,groupName:C}):n==="float"?vse({nameOverride:e,generatedName:t,title:r,primitive:M0.float({example:A}),wrapAsNullable:m,description:s,availability:l,namespace:P,groupName:C}):n==="int32"?vse({nameOverride:e,generatedName:t,title:r,primitive:M0.int({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:f,multipleOf:u,example:A}),wrapAsNullable:m,description:s,availability:l,namespace:P,groupName:C}):n==="int64"?vse({nameOverride:e,generatedName:t,title:r,primitive:M0.int64({default:i,example:A}),wrapAsNullable:m,description:s,availability:l,namespace:P,groupName:C}):n==="uint32"?vse({nameOverride:e,generatedName:t,title:r,primitive:M0.uint({default:i,example:A}),wrapAsNullable:m,description:s,availability:l,namespace:P,groupName:C}):n==="uint64"?vse({nameOverride:e,generatedName:t,title:r,primitive:M0.uint64({default:i,example:A}),wrapAsNullable:m,description:s,availability:l,namespace:P,groupName:C}):n==="time-delta"?vse({nameOverride:e,generatedName:t,title:r,primitive:M0.float({example:A}),wrapAsNullable:m,description:s,availability:l,namespace:P,groupName:C}):vse({nameOverride:e,generatedName:t,title:r,primitive:M0.float({example:A}),wrapAsNullable:m,description:s,availability:l,namespace:P,groupName:C})}var TrC={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},qrC={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="responses",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},RrC={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="parameters",applyStrategy:e=>{let t=[e[3]??""];return e=e.slice(4),e[0]==="schema"&&(e=e.slice(1)),{refUnderProcessing:e,newBreadcrumbs:t}}},NrC={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},xrC={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},FrC={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},zrC={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},QrC={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function fPu(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],n=[TrC,qrC,RrC,NrC,xrC,FrC,zrC,QrC],i;do{i=t;for(let a of n)if(a.isApplicable(t)){let{refUnderProcessing:o,newBreadcrumbs:c}=a.applyStrategy(t);t=o,r=[...r,...c]}}while(t.join("")!==i.join(""));return r}function bse(e,t){let n=e.map(i=>/^[^a-zA-Z0-9]+$/.test(i)?i:bU(hA(i))).join("");return/^\d/.test(n)?M8o(n)??n:n}function myf(e){let t=e.join("_");return hA(t)}function lz(e){switch(e.type){case"object":return xw.object({allOf:e.allOf,properties:e.properties.map(t=>UrC(t)),allOfPropertyConflicts:e.allOfPropertyConflicts,description:e.description,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,additionalProperties:e.additionalProperties,availability:e.availability,source:e.source,inline:e.inline});case"array":return xw.array({description:e.description,availability:e.availability,value:lz(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"enum":return xw.enum({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,values:e.values,default:e.default,namespace:e.namespace,groupName:e.groupName,source:e.source,inline:e.inline});case"literal":return xw.literal({description:e.description,availability:e.availability,value:e.value,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"nullable":return xw.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:lz(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return xw.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:lz(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return xw.primitive({description:e.description,availability:e.availability,schema:vSy(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return xw.map({description:e.description,availability:e.availability,key:xw.primitive({description:e.key.description,availability:e.key.availability,schema:vSy(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:lz(e.value),generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,inline:e.inline});case"reference":return xw.reference({description:e.description,availability:e.availability,generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,schema:e.schema,namespace:e.namespace,groupName:e.groupName,source:e.source});case"oneOf":return xw.oneOf(LrC(e.value));case"unknown":return xw.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:fc(e)}}function LrC(e){switch(e.type){case"discriminated":return UQr.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:lz(t.schema)})),description:e.description,availability:e.availability,discriminantProperty:e.discriminantProperty,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:Object.fromEntries(Object.entries(e.schemas).map(([t,r])=>[t,lz(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return UQr.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>lz(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:fc(e)}}function vSy(e){switch(e.type){case"string":return KT.string(e);case"base64":return KT.base64();case"boolean":return KT.boolean(e);case"date":return KT.date();case"datetime":return KT.datetime();case"double":return KT.double(e);case"float":return KT.float();case"int":return KT.int(e);case"int64":return KT.int64(e);case"uint":return KT.uint();case"uint64":return KT.uint64();default:fc(e)}}function UrC(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:lz(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function dPu(e,t){return Bxe(lz(e),lz(t))}function bSy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,required:o,wrapAsNullable:c,allOf:f,context:u,propertiesToExclude:s,namespace:l,groupName:m,fullExamples:A,additionalProperties:P,availability:C,source:M}){let T=[...o??[]],z={...i},U=[],R=[];for(let te of f)if(!u.options.inlineAllOfSchemas&&c0(te)){let ne=u.resolveSchemaReference(te);if(ne.discriminator!=null&&ne.discriminator.mapping!=null)continue;if(ne.oneOf!=null||ne.anyOf!=null){let ge=ne.oneOf??ne.anyOf;if(ge!=null){for(let ve of ge){let be=c0(ve)?u.resolveSchemaReference(ve):ve,Me=hE(be,!1,u.DUMMY,n,M,l);Me.type==="object"&&U.push(...Me.properties.map(Be=>Be.schema.type!=="optional"&&Be.schema.type!=="nullable"?{...Be,schema:ay.optional({nameOverride:void 0,generatedName:"",title:void 0,value:Be.schema,description:void 0,availability:Be.availability,namespace:void 0,groupName:void 0,inline:void 0})}:Be))}continue}}let Ae=PBi(te);if(Ae==null)continue;R.push({schemaId:Ae,convertedSchema:Oyf(te,[Ae],M,u.options.preserveSchemaIds),properties:gSy({schema:te,context:u,breadcrumbs:n,source:M,namespace:l})}),u.markSchemaAsReferencedByNonRequest(Ae)}else if(c0(te)){let ne=u.resolveSchemaReference(te),Ae=hE(ne,!1,u,n,M,l);Ae.type==="object"&&U.push(...Ae.properties)}else{let ne=te.required??[];U=U.map(ge=>(ge.schema.type==="optional"||ge.schema.type==="nullable")&&ne.includes(ge.key)?{...ge,schema:ge.schema.value}:ge);let Ae=hE(te,!1,u,n,M,l);Ae.type==="object"&&U.push(...Ae.properties)}let V={};for(let te of R)for(let[ne,Ae]of Object.entries(te.properties)){let ge=V[ne];ge!=null?(ge.schemaIds.push(te.schemaId),ge.schemas.some(be=>dPu(be,Ae))||ge.schemas.push(Ae)):V[ne]={schemaIds:[te.schemaId],schemas:[Ae]}}let $=[];for(let[te,ne]of Object.entries(V))ne.schemaIds.length>1&&$.push({propertyKey:te,allOfSchemaIds:ne.schemaIds,conflictingTypeSignatures:ne.schemas.length>1});let re=Object.fromEntries(Object.entries(z).filter(([te,ne])=>!(!c0(ne)&&ne.type==="null"))),Y=Object.entries(re).map(([te,ne])=>{let Ae=Vy(ne,mb.AUDIENCES)??[],ge=dPe(ne),ve=c0(ne)?!1:ne.readOnly,be=c0(ne)?!1:ne.writeOnly,Me=T.includes(te)&&!ve,Be=Vy(ne,mb.FERN_PROPERTY_NAME),Se=[...n,te],St=myf(Se),_t=Me?hE(ne,!1,u,Se,M,l):ay.optional({nameOverride:e,generatedName:St,title:r,description:void 0,availability:ge,value:hE(ne,!1,u,Se,M,l),namespace:l,groupName:m,inline:void 0}),qe={};for(let De of R){let Qt=De.properties[te];Qt!=null&&!dPu(_t,Qt)?qe[De.schemaId]={differentSchema:!0}:Qt!=null&&(qe[De.schemaId]={differentSchema:!1})}return{key:te,schema:_t,nameOverride:Be,audiences:Ae,conflict:qe,generatedName:myf([...n,te]),availability:ge,readonly:ve,writeonly:be}});return Y.push(...U.map(te=>{let ne=te.conflict;for(let Ae of R){let ge=Ae.properties[te.key];ge!=null&&!dPu(te.schema,ge)?ne[Ae.schemaId]={differentSchema:!0}:ge!=null&&(ne[Ae.schemaId]={differentSchema:!1})}return{...te,conflict:ne}})),VrC({nameOverride:e,generatedName:t,title:r,wrapAsNullable:c,properties:Y.filter(te=>!s.has(te.key)),description:a,allOf:R.map(te=>te.convertedSchema),allOfPropertyConflicts:$,namespace:l,groupName:m,fullExamples:A,additionalProperties:P,availability:C,source:M,context:u})}function VrC({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,properties:i,description:a,allOf:o,allOfPropertyConflicts:c,namespace:f,groupName:u,fullExamples:s,additionalProperties:l,availability:m,source:A,context:P}){return n?ay.nullable({nameOverride:e,generatedName:t,title:r,value:ay.object({description:a,properties:i,nameOverride:e,generatedName:t,title:r,allOf:o,allOfPropertyConflicts:c,namespace:f,groupName:u,fullExamples:s,additionalProperties:hWa(l,P.options),availability:void 0,source:A,inline:void 0}),description:a,availability:m,namespace:f,groupName:u,inline:void 0}):ay.object({description:a,properties:i,nameOverride:e,generatedName:t,title:r,allOf:o,allOfPropertyConflicts:c,namespace:f,groupName:u,fullExamples:s,additionalProperties:hWa(l,P.options),availability:m,source:A,inline:void 0})}function gSy({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let a={},[o,c]=c0(e)?[t.resolveSchemaReference(e),fPu(e.$ref)]:[e,r];for(let f of o.allOf??[])a={...a,...gSy({schema:f,context:t,breadcrumbs:c,source:n,namespace:i})};for(let[f,u]of Object.entries(o.properties??{})){let s=hE(u,!1,t,[...c,f],n,i);a[f]=s}return a}function wBi({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:a,wrapAsNullable:o,context:c,subtypes:f,namespace:u,groupName:s,encoding:l,source:m,subtypePrefixOverrides:A}){let P=GrC({schemas:f}),C=f.flatMap((T,z)=>{if(!c0(T)&&T.enum!=null&&c.options.coerceEnumsToLiterals&&T.type==="string")return T.enum.map(R=>ay.literal({nameOverride:void 0,generatedName:bse([t,R],c.options.preserveSchemaIds),title:void 0,value:J9.string(String(R)),namespace:u,groupName:void 0,description:void 0,availability:R.availability}));let U=P[z];if(A!=null){let R=A[z];R!=null&&"name"in R&&(U=R.name)}return[hE(T,!1,c,[...n,U??`${z}`],m,u)]}),M=WrC(C);return HrC({uniqueSubtypes:M,nameOverride:e,generatedName:t,title:r,wrapAsNullable:o,description:i,availability:a,namespace:u,groupName:s,context:c,encoding:l,source:m})}function WrC(e){let t=[];for(let r=0;r<e.length;++r){let n=e[r],i=!1;for(let a=r+1;a<e.length;++a){let o=e[a];if(n!=null&&o!=null&&Bxe(n,o)){i=!0;break}}n!=null&&!i&&t.push(n)}return t}function HrC({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:n,wrapAsNullable:i,description:a,availability:o,namespace:c,groupName:f,context:u,encoding:s,source:l}){if(Object.entries(e).every(([A,P])=>P.type==="literal")){let A={},P=[];return Object.entries(e).forEach(([C,M])=>{M.type==="literal"&&M.value.type==="string"&&(P.push(M.value.value),M.description!=null&&(A[M.value.value]={description:M.description}))}),ABi({nameOverride:t,generatedName:r,title:n,wrapAsNullable:i,description:a,availability:o,fernEnum:A,enumVarNames:void 0,enumValues:P,_default:void 0,namespace:c,groupName:f,context:u,source:l,inline:void 0})}return e.length===1&&e[0]!=null&&!u.options.preserveSingleSchemaOneOf?e[0]:mSy({nameOverride:t,generatedName:r,title:n,wrapAsNullable:i,description:a,availability:o,subtypes:e,namespace:c,groupName:f,encoding:s,source:l})}function Ayf({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsNullable:a,context:o,namespace:c,groupName:f,discriminator:u,encoding:s,source:l}){let m=Object.entries(u.mapping??{}).map(([C,M],T)=>{let z={$ref:M},U=Ydi(z,!1,o,[M],s,l,c);return o.markSchemaWithDiscriminantValue(z,u.propertyName,C),U.type==="object"&&(U.properties={[u.propertyName]:ay.literal({nameOverride:void 0,generatedName:bse([t,C],o.options.preserveSchemaIds),title:void 0,value:J9.string(C),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...U.properties.filter(R=>R.key!==u.propertyName)}),U}),A=[];for(let C=0;C<m.length;++C){let M=m[C],T=!1;for(let z=C+1;z<m.length;++z){let U=m[z];if(M!=null&&U!=null&&Bxe(M,U)){T=!0;break}}M!=null&&!T&&A.push(M)}if(Object.entries(A).every(([C,M])=>M.type==="literal")){let C={},M=[];return Object.entries(A).forEach(([T,z])=>{z.type==="literal"&&z.value.type==="string"&&(M.push(z.value.value),z.description!=null&&(C[z.value.value]={description:z.description}))}),ABi({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:n,availability:i,fernEnum:C,enumVarNames:void 0,enumValues:M,_default:void 0,namespace:c,groupName:f,context:o,source:l,inline:void 0})}return A.length===1&&A[0]!=null&&!o.options.preserveSingleSchemaOneOf?A[0]:mSy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:n,availability:i,subtypes:A,namespace:c,groupName:f,encoding:s,source:l})}function GrC({schemas:e}){let t={},r=0;for(let a of e){if(!c0(a)){if(a.properties!=null&&Object.entries(a.properties).length>0){let o=Object.keys(a.properties),c={},f=o;for(let[u,s]of Object.entries(t)){let l=nLs(s,o);f=nLs(f,s),c[u]=l}c[r]=f,t=c}}r++}let n=[],i=0;for(let a of e){let o=t[i];if(o!=null&&o.length>0){let c=o.sort();if(c[0]!=null){n.push(c[0]),++i;continue}}c0(a)?n.push(bBi(i)??`${i}`):a.type==="array"||a.type==="boolean"||a.type==="integer"||a.type==="number"||a.type==="string"?n.push(""):n.push(bBi(i)??`${i}`),++i}return n}function mSy({nameOverride:e,generatedName:t,title:r,wrapAsNullable:n,description:i,availability:a,subtypes:o,namespace:c,groupName:f,encoding:u,source:s}){return n?ay.nullable({nameOverride:e,generatedName:t,title:r,value:ay.oneOf(VDe.undiscriminated({description:i,availability:a,nameOverride:e,generatedName:t,title:r,schemas:o,namespace:c,groupName:f,encoding:u,source:s,inline:void 0})),description:i,availability:a,namespace:c,groupName:f,inline:void 0}):ay.oneOf(VDe.undiscriminated({description:i,availability:a,nameOverride:e,generatedName:t,title:r,schemas:o,namespace:c,groupName:f,encoding:u,source:s,inline:void 0}))}function yWa(e){if(e.default!=null&&typeof e.default=="string")return e.default}function pPu({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let n=ZZi(e);for(let i of n??[])if(typeof i=="number")return i;if(r&&typeof r=="number")return r}function OSy({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let n=ZZi(e);for(let i of n??[])if(typeof i=="boolean")return i;if(r&&typeof r=="boolean")return r}function KQr({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let n=ZZi(e);for(let i of n??[])if(typeof i=="string")return i;if(r&&typeof r=="string")return r}function ASy({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let n=ZZi(e);for(let i of n??[])if(Array.isArray(i))return i;if(r&&Array.isArray(r))return r}var eki="#/components/schemas/";function hE(e,t,r,n,i,a,o=!1,c=new Set,f){let u=uSy(e)??i,s=enC({schema:e,logger:r.logger});if(c0(e)){let l=PBi(e);return l!=null?(o?r.markSchemaAsReferencedByRequest(l):r.markSchemaAsReferencedByNonRequest(l),Ydi(e,t,r,n,s,u,a)):Q8o(r.resolveSchemaReference(e),t,r,fPu(e.$ref),s,u,a,c,o,f)}return Q8o(e,t,r,n,s,u,a,c,o,f)}function Ydi(e,t,r,n,i,a,o){let c=e.$ref.includes("properties")?Q8o(r.resolveSchemaReference(e),t,r,n,i,a,o,new Set):ay.reference(Oyf(e,n,a,r.options.preserveSchemaIds));if(t===!1){let f=r.resolveSchemaReference(e);(f.nullable===!0||Array.isArray(f.type)&&f.type.length>=2&&f.type.includes("null"))&&(t=!0)}return t?ay.nullable({title:void 0,nameOverride:void 0,generatedName:bse(n,r.options.preserveSchemaIds),value:c,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0}):c}function JrC(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function Q8o(e,t,r,n,i,a,o,c=new Set,f=!1,u){typeof e=="string"&&(e={type:e});let s=Vy(e,mb.TYPE_NAME)??(r.options.useTitlesAsName?JrC(e.title):void 0),l=Vy(e,mb.SDK_GROUP_NAME)??Vy(e,Fve.TAGS)?.[0],m=(typeof l=="string"?[l]:l)??[];m=r.resolveGroupName(m);let A=bse(n,r.options.preserveSchemaIds),P=e.title,C=e.description,M=dPe(e),T=[];e.example!=null&&T.push({name:void 0,value:e.example,description:void 0});let z=Vy(e,Fve.EXAMPLES);z!=null&&Object.keys(z).length>0&&T.push(...Object.entries(z).map(([V,$])=>({name:$?.summary??V,value:$.value,description:$.description})));let U=ZZi(e);U!=null&&Object.keys(U).length>0&&T.push(...U.map(V=>({name:void 0,value:V,description:void 0})));let R=sSy({schema:e,description:C,title:P,nameOverride:s,generatedName:A,availability:M});if(R!=null)return R;try{if(Array.isArray(e.type)){let $=e.type.indexOf("null"),re=$!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&re)e.type.splice($,1),e.type=e.type[0],e.nullable=!0;else if(re&&(e.type.splice($,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let Y=new Set([...e.oneOf,...e.type]);e.oneOf=[...Y]}}if(!t&&e.nullable===!0&&(t=!0),"const"in e&&(e.enum=[e.const]),e.enum!=null&&(e.type==="string"||e.type==null||e.type==="enum")){if(e.enum=e.enum.filter(re=>re!==null),!yPu(e.enum))return vse({nameOverride:s,generatedName:A,title:P,primitive:M0.string({default:yWa(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:KQr({schema:e,logger:r.logger,fallback:u})}),namespace:o,groupName:m,wrapAsNullable:t,description:C,availability:M});let $=oSy(e);return e.enum.length===1&&e.enum[0]!=null&&$==null?ySy({nameOverride:s,generatedName:A,title:P,wrapAsNullable:t,value:e.enum[0],description:C,availability:M,namespace:o,groupName:m}):ABi({nameOverride:s,generatedName:A,title:P,fernEnum:$,enumVarNames:Vy(e,[Fve.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:C,availability:M,wrapAsNullable:t,namespace:o,groupName:m,context:r,source:a,inline:void 0})}if(yPu(e.type)&&e.type.length>1){let $=e.type.includes("null"),re=e.type.filter(Y=>Y!=="null").map(Y=>({type:Y,nullable:$}));return wBi({nameOverride:s,generatedName:A,title:P,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t,context:r,subtypes:re,namespace:o,groupName:m,encoding:i,source:a})}if(e.type==="boolean"){let $=Vy(e,mb.BOOLEAN_LITERAL);return $!=null?PSy({nameOverride:s,generatedName:A,title:P,literal:J9.boolean($),wrapAsNullable:t,description:C,availability:M,namespace:o,groupName:m}):vse({nameOverride:s,generatedName:A,title:P,primitive:M0.boolean({default:KrC(e.default),example:OSy({schema:e,logger:r.logger,fallback:u})}),wrapAsNullable:t,description:C,availability:M,namespace:o,groupName:m})}if(e.type==="number")return gyf({nameOverride:s,generatedName:A,title:P,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:kZi(e.exclusiveMinimum),exclusiveMaximum:kZi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:C,availability:M,wrapAsNullable:t,example:pPu({schema:e,logger:r.logger,fallback:u}),namespace:o,groupName:m});if(e.type==="integer")return _Sy({nameOverride:s,generatedName:A,title:P,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:kZi(e.exclusiveMinimum),exclusiveMaximum:kZi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:C,availability:M,wrapAsNullable:t,example:pPu({schema:e,logger:r.logger,fallback:u}),namespace:o,groupName:m});if(e.type==="float")return gyf({nameOverride:s,generatedName:A,title:P,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:kZi(e.exclusiveMinimum),exclusiveMaximum:kZi(e.exclusiveMaximum),multipleOf:e.multipleOf,description:C,availability:M,wrapAsNullable:t,example:pPu({schema:e,logger:r.logger,fallback:u}),namespace:o,groupName:m});if(e.type==="string"){if(e.format==="date-time")return vse({nameOverride:s,generatedName:A,title:P,primitive:M0.datetime({example:KQr({schema:e,logger:r.logger,fallback:u})}),wrapAsNullable:t,description:C,availability:M,namespace:o,groupName:m});if(e.format==="date"&&r.options.typeDatesAsStrings===!1)return vse({nameOverride:s,generatedName:A,title:P,primitive:M0.date({example:KQr({schema:e,logger:r.logger,fallback:u})}),wrapAsNullable:t,description:C,availability:M,namespace:o,groupName:m});if(e.format==="json-string")return ay.unknown({nameOverride:s,generatedName:A,title:P,description:C,availability:M,namespace:o,groupName:m,example:void 0});let $=ESy(e,"const");return $!=null?PSy({nameOverride:s,generatedName:A,title:P,literal:J9.string($),wrapAsNullable:t,description:C,availability:M,namespace:o,groupName:m}):vse({nameOverride:s,generatedName:A,title:P,primitive:M0.string({default:yWa(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:KQr({schema:e,logger:r.logger,fallback:u})}),namespace:o,groupName:m,wrapAsNullable:t,description:C,availability:M})}if(e.type==="array")return fSy({nameOverride:s,generatedName:A,title:P,breadcrumbs:n,item:e.items,description:C,availability:M,wrapAsNullable:t,context:r,namespace:o,groupName:m,example:ASy({schema:e,logger:r.logger,fallback:u}),source:a});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&_Pu(e))return cSy({nameOverride:s,generatedName:A,title:P,breadcrumbs:n,additionalProperties:e.additionalProperties,description:C,availability:M,wrapAsNullable:t,context:r,namespace:o,groupName:m,encoding:i,example:e.example,source:a});if(e.oneOf!=null&&e.oneOf.length>0&&Vy(e,mb.IS_DISCRIMINATED)===!1)return wBi({nameOverride:s,generatedName:A,title:P,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t,context:r,subtypes:e.oneOf,namespace:o,groupName:m,encoding:i,source:a});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return r.options.discriminatedUnionV2?Ayf({nameOverride:s,generatedName:A,title:P,description:C,availability:M,wrapAsNullable:t,context:r,namespace:o,groupName:m,discriminator:e.discriminator,encoding:i,source:a}):vyf({nameOverride:s,generatedName:A,title:P,breadcrumbs:n,description:C,availability:M,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,namespace:o,groupName:m,encoding:i,source:a});if(e.oneOf!=null&&e.oneOf.length>0){let $=Vy(e,mb.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return r.options.discriminatedUnionV2||$?Ayf({nameOverride:s,generatedName:A,title:P,description:C,availability:M,wrapAsNullable:t,context:r,namespace:o,groupName:m,discriminator:e.discriminator,encoding:i,source:a}):vyf({nameOverride:s,generatedName:A,title:P,breadcrumbs:n,description:C,availability:M,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,namespace:o,groupName:m,encoding:i,source:a});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(r.options.preserveSingleSchemaOneOf)return wBi({nameOverride:s,generatedName:A,title:P,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t,context:r,subtypes:e.oneOf.filter(Y=>c0(Y)||Y.type!=="null"),encoding:i,namespace:o,groupName:m,source:a});let re=hE(e.oneOf[0],t,r,n,a,o,f);return vWa(re,C,o,m)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let ne=e.oneOf[0],Ae=e.oneOf[1];if(!c0(ne)&&ne.type==="null")return hE(Ae,!0,r,n,a,o);if(!c0(Ae)&&Ae.type==="null")return hE(ne,!0,r,n,a,o)}let re=XrC({schemas:e.oneOf});if(re!=null)return ABi({nameOverride:s,generatedName:A,title:P,fernEnum:void 0,enumVarNames:void 0,enumValues:re,_default:e.default,description:C,availability:M,wrapAsNullable:t,namespace:o,groupName:m,context:r,source:a,inline:void 0});let Y=wSy({schemas:e.oneOf,context:r});if(Y!=null&&!r.options.discriminatedUnionV2&&!$)return byf({nameOverride:s,generatedName:A,title:P,breadcrumbs:n,properties:e.properties??{},required:e.required,description:C,availability:M,wrapAsNullable:t,discriminant:Y.discriminant,variants:Y.schemas,context:r,namespace:o,groupName:m,encoding:i,source:a});let te=e.oneOf.filter(ne=>!c0(ne)&&ne.type==="null").length>0;return wBi({nameOverride:s,generatedName:A,title:P,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t||te,context:r,subtypes:e.oneOf.filter(ne=>c0(ne)||ne.type!=="null"),encoding:i,namespace:o,groupName:m,source:a})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let Y=hE(e.anyOf[0],t,r,n,a,o,f);return vWa(Y,C,o,m)}if(e.anyOf.length===2){let[Y,te]=e.anyOf;if(Y!=null&&te!=null){if(!c0(Y)&&Y.type==="null"){let ne=hE(te,!0,r,n,a,o);return vWa(ne,C,o,m)}else if(!c0(te)&&te.type==="null"){let ne=hE(Y,!0,r,n,a,o);return vWa(ne,C,o,m)}}}let $=wSy({schemas:e.anyOf,context:r});if($!=null&&!r.options.discriminatedUnionV2)return byf({nameOverride:s,generatedName:A,title:P,breadcrumbs:n,properties:e.properties??{},required:e.required,description:C,availability:M,wrapAsNullable:t,discriminant:$.discriminant,variants:$.schemas,context:r,namespace:o,groupName:m,encoding:i,source:a});let re=e.anyOf.filter(Y=>!c0(Y)&&Y.type==="null").length>0;return wBi({nameOverride:s,generatedName:A,title:P,breadcrumbs:n,description:C,availability:M,wrapAsNullable:t||re,context:r,subtypes:e.anyOf.filter(Y=>c0(Y)||Y.type!=="null"),encoding:i,namespace:o,groupName:m,source:a})}if(e.allOf!=null||e.properties!=null){let $=[];for(let Y of e.allOf??[])(c0(Y)||Object.keys(Y).length>0)&&$.push(Y);if((e.properties==null||_Pu(e))&&$.length===1&&$[0]!=null){let Y=hE($[0],t,r,n,a,o,f);return vWa(Y,C,o,m)}let re=$.filter(Y=>{let te=hPu(Y);return te||r.logger.warn(`Skipping non-object allOf element: ${JSON.stringify(Y)}`),te});if((e.properties==null||_Pu(e))&&re.length===1&&re[0]!=null){let Y=hE(re[0],t,r,n,a,o,f);return vWa(Y,C,o,m)}return bSy({nameOverride:s,generatedName:A,title:P,breadcrumbs:n,properties:e.properties??{},description:C,required:e.required,wrapAsNullable:t,allOf:re,context:r,propertiesToExclude:c,namespace:o,groupName:m,fullExamples:T,additionalProperties:e.additionalProperties,availability:M,encoding:i,source:a})}if(e.type==="object"&&$rC(e)&&YrC(e)&&_Pu(e))return lPu({nameOverride:s,generatedName:A,title:P,description:C,availability:M,wrapAsNullable:t,keySchema:{nameOverride:void 0,generatedName:`${A}Key`,title:void 0,description:void 0,availability:void 0,schema:M0.string({default:yWa(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:KQr({schema:e,logger:r.logger,fallback:u})}),namespace:o,groupName:m},valueSchema:ay.unknown({nameOverride:void 0,generatedName:`${A}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:o,groupName:m}),namespace:o,groupName:m,encoding:i,example:e.example});e.type!=null&&r.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${n.join("->")}. Coercing to unknown.`);let V=e.example??e.default;return ay.unknown({nameOverride:s,generatedName:A,title:P,description:C,availability:M,namespace:o,groupName:m,example:V})}catch(V){return r.logger.debug(`Error converting schema: ${V.message}
@@ -3023,7 +3023,7 @@ ${l}`)}async function b8I(e){await QW(void 0,"docker",["pull",e],{all:!0,doNotPi
3023
3023
  `).find(ne=>ne.trim().length>0)||"Custom License";te=te.trim().replace(/^#+\s*/,""),te=te.replace(/[.:;]+$/,"").trim(),U=te}catch{}}}U!=null&&(m={...t,_fernLicenseName:U})}let{snippetPath:P,snippetTemplatePath:C,irPath:M,outputDirectory:T}=l,z=e.outputMode._visit({publish:U=>({...r4v(i,U,e,l),snippetFilepath:P,publishingMetadata:e.publishMetadata}),publishV2:U=>({...r4v(i,U,e,l),snippetFilepath:P,publishingMetadata:e.publishMetadata}),downloadFiles:()=>({mode:eie.FernGeneratorExec.OutputMode.downloadFiles(),path:T,snippetFilepath:P,publishingMetadata:e.publishMetadata}),github:U=>{let R={mode:eie.FernGeneratorExec.OutputMode.github({repoUrl:`https://github.com/${U.owner}/${U.repo}`,version:i,publishInfo:t4v(U.publishInfo),installationToken:void 0}),path:T,publishingMetadata:e.publishMetadata};return a!==void 0&&(R.snippetFilepath=P),o!==void 0&&(R.snippetTemplateFilepath=C),R},githubV2:U=>{let R=U._visit({commitAndRelease:$=>`https://github.com/${$.owner}/${$.repo}`,push:$=>`https://github.com/${$.owner}/${$.repo}`,pullRequest:$=>`https://github.com/${$.owner}/${$.repo}`,_other:()=>{throw new Error("Encountered unknown github mode")}}),V={mode:eie.FernGeneratorExec.OutputMode.github({repoUrl:R,version:i,publishInfo:t4v(U.publishInfo)}),path:T,publishingMetadata:e.publishMetadata};return a!==void 0&&(V.snippetFilepath=P),o!==void 0&&(V.snippetTemplateFilepath=C),V},_other:()=>{throw new Error("Output type did not match any of the types supported by Fern")}});return{irFilepath:M,output:z,publish:void 0,customConfig:m,workspaceName:r,organization:n,environment:eie.FernGeneratorExec.GeneratorEnvironment.local(),dryRun:!1,whitelabel:!1,writeUnitTests:f,generateOauthClients:u,generatePaginatedClients:s,license:A}}function r4v(e,t,r,n){let{outputDirectory:i}=n,a;"registryOverrides"in t?a=t.registryOverrides.maven??t.registryOverrides.npm:a!=null&&(a=t._visit({mavenOverride:c=>c,npmOverride:c=>c,pypiOverride:c=>c,rubyGemsOverride:c=>c,postman:c=>c,nugetOverride:c=>c,_other:()=>{}}));let o="";return r.raw?.github!=null&&(u3o(r.raw.github)?o=r.raw.github.uri:o=r.raw?.github.repository),{mode:eie.FernGeneratorExec.OutputMode.github({repoUrl:o,version:e}),path:i}}var Ut=Symbol(),Hn=Symbol();var o4v={laterVersion:"v2",earlierVersion:"v1",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.0.246",[me.TYPESCRIPT_EXPRESS]:"0.0.264",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Hn,[me.STOPLIGHT]:Hn,[me.OPENAPI_PYTHON_CLIENT]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},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 ft={};mf(ft,{V1:()=>Af3,V10:()=>Mf3,V11:()=>Bf3,V12:()=>Tf3,V13:()=>qf3,V14:()=>Rf3,V15:()=>Nf3,V16:()=>xf3,V17:()=>Ff3,V18:()=>zf3,V19:()=>Qf3,V2:()=>Pf3,V20:()=>Lf3,V21:()=>Uf3,V22:()=>Vf3,V23:()=>DBP.FernIrV23,V24:()=>CBP.FernIrV24,V25:()=>IBP.FernIrV25,V26:()=>MBP.FernIrV26,V27:()=>BBP.FernIrV27,V28:()=>TBP.FernIrV28,V29:()=>qBP.FernIrV29,V3:()=>wf3,V30:()=>RBP.FernIrV30,V31:()=>NBP.FernIrV31,V32:()=>xBP.FernIrV32,V33:()=>FBP.FernIrV33,V34:()=>zBP.FernIrV34,V35:()=>QBP.FernIrV35,V36:()=>LBP.FernIrV36,V37:()=>UBP.FernIrV37,V38:()=>VBP.FernIrV38,V39:()=>WBP.FernIrV39,V4:()=>jf3,V40:()=>HBP.FernIrV40,V41:()=>GBP.FernIrV41,V42:()=>JBP.FernIrV42,V43:()=>KBP.FernIrV43,V44:()=>$BP.FernIrV44,V45:()=>YBP.FernIrV45,V46:()=>XBP.FernIrV46,V47:()=>ZBP.FernIrV47,V48:()=>kBP.FernIrV48,V49:()=>eTP.FernIrV49,V5:()=>Ef3,V50:()=>tTP.FernIrV50,V51:()=>rTP.FernIrV51,V52:()=>nTP.FernIrV52,V53:()=>iTP.FernIrV53,V54:()=>aTP.FernIrV54,V55:()=>oTP.FernIrV55,V56:()=>sTP.FernIrV56,V57:()=>uTP.FernIrV57,V58:()=>cTP.FernIrV58,V59:()=>lTP.FernIrV59,V6:()=>Sf3,V60:()=>op,V7:()=>Df3,V8:()=>Cf3,V9:()=>If3});var Af3=aa(tUv(),1),Pf3=aa(YGv(),1),wf3=aa(zkv(),1),jf3=aa(xob(),1),Ef3=aa(Adb(),1),Sf3=aa(Ibb(),1),Df3=aa(FPb(),1),Cf3=aa(GDb(),1),If3=aa(bRb(),1),Mf3=aa(z6b(),1),Bf3=aa(cLb(),1),Tf3=aa(oJb(),1),qf3=aa(neg(),1),Rf3=aa(esg(),1),Nf3=aa(Xpg(),1),xf3=aa(cmg(),1),Ff3=aa(OEg(),1),zf3=aa(TTg(),1),Qf3=aa(K2g(),1),Lf3=aa(wLg(),1),Uf3=aa(nKg(),1),Vf3=aa(Nt0(),1),DBP=aa(to0(),1),CBP=aa(Fl0(),1),IBP=aa(jh0(),1),MBP=aa(y00(),1),BBP=aa(fw0(),1),TBP=aa(sD0(),1),qBP=aa(nT0(),1),RBP=aa(aF0(),1),NBP=aa(s40(),1),xBP=aa(bL0(),1),FBP=aa(Snd(),1),zBP=aa(LX0(),1),QBP=aa(Nnm(),1),LBP=aa(Mcm(),1),UBP=aa(Dhm(),1),VBP=aa(Dmm(),1),WBP=aa(H1m(),1),HBP=aa(uBm(),1),GBP=aa(SFm(),1),JBP=aa(Y7m(),1),KBP=aa(OVm(),1),$BP=aa(J$m(),1),YBP=aa(qrO(),1),XBP=aa(ScO(),1),ZBP=aa(wyO(),1),kBP=aa(OAO(),1),eTP=aa(ODO(),1),tTP=aa(IRO(),1),rTP=aa($zO(),1),nTP=aa(g9O(),1),iTP=aa(JkO(),1),aTP=aa(CfA(),1),oTP=aa(vAA(),1),sTP=aa(oTA(),1),uTP=aa($HA(),1),cTP=aa(ipP(),1),lTP=aa(SBP(),1);function fTP({inlinedRequest:e,allTypes:t}){let r=new Set,n=t.reduce((i,a)=>({...i,[YRd(a.name)]:a}),{});for(let i of e.extends)dTP({typeName:i,typeNameToDeclaration:n,referencedTypes:r});for(let i of e.properties)aro({reference:i.valueType,typeNameToDeclaration:n,referencedTypes:r});return[...r].reduce((i,a)=>{let o=n[a];if(o==null)throw new Error("Cannot find declaration for ID: "+a);return[...i,o.name]},[])}function aro({reference:e,typeNameToDeclaration:t,referencedTypes:r}){ft.V2.types.TypeReference._visit(e,{primitive:Gc,container:n=>{Wf3({container:n,typeNameToDeclaration:t,referencedTypes:r})},named:n=>{dTP({typeName:n,typeNameToDeclaration:t,referencedTypes:r})},unknown:Gc,void:Gc,_unknown:()=>{throw new Error("Unknown TypeReference: "+e._type)}})}function Wf3({container:e,typeNameToDeclaration:t,referencedTypes:r}){ft.V2.types.ContainerType._visit(e,{list:n=>{aro({reference:n,typeNameToDeclaration:t,referencedTypes:r})},set:n=>{aro({reference:n,typeNameToDeclaration:t,referencedTypes:r})},optional:n=>{aro({reference:n,typeNameToDeclaration:t,referencedTypes:r})},map:({keyType:n,valueType:i})=>{aro({reference:n,typeNameToDeclaration:t,referencedTypes:r}),aro({reference:i,typeNameToDeclaration:t,referencedTypes:r})},literal:Gc,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function dTP({typeName:e,typeNameToDeclaration:t,referencedTypes:r}){let n=YRd(e);r.add(n);let i=t[n];if(i==null)throw new Error("Cannot locate type: "+n);for(let a of i.referencedTypes)r.add(YRd(a))}function YRd(e){return[...e.fernFilepathV2.map(t=>t.unsafeName.originalValue),e.nameV3.unsafeName.originalValue].join(".")}var pTP={laterVersion:"v3",earlierVersion:"v2",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.0.249",[me.TYPESCRIPT_EXPRESS]:"0.0.264",[me.JAVA]:Ut,[me.JAVA_MODEL]:"0.0.134-3-g97d4964",[me.JAVA_SDK]:"0.0.134-3-g97d4964",[me.JAVA_SPRING]:"0.0.134-3-g97d4964",[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Hn,[me.STOPLIGHT]:Hn,[me.OPENAPI_PYTHON_CLIENT]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},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(n=>Hf3(r,n,e.types,i=>{t.push(i)}))}))}}}};function Hf3(e,t,r,n){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:Gf3(t,e,r,n),response:t.response,errors:t.errors,errorsV2:t.errorsV2,auth:t.auth}}function Gf3(e,t,r,n){let i=e.requestBody;return i==null?{docs:void 0,type:ft.V2.types.TypeReference.void(),typeV2:void 0}:ft.V3.services.http.HttpRequestBody._visit(i,{reference:a=>({docs:a.docs,type:a.requestBodyType,typeV2:a.requestBodyType}),inlinedRequestBody:a=>{let o={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},c=ft.V2.types.Type.object({extends:a.extends,properties:a.properties.map(u=>({availability:e.availability,docs:u.docs,name:{originalValue:u.name.name.unsafeName.originalValue,camelCase:u.name.name.unsafeName.camelCase,pascalCase:u.name.name.unsafeName.pascalCase,snakeCase:u.name.name.unsafeName.snakeCase,screamingSnakeCase:u.name.name.unsafeName.screamingSnakeCase,wireValue:u.name.wireValue},nameV2:u.name,valueType:u.valueType}))});n({docs:void 0,availability:e.availability,name:o,shape:c,referencedTypes:fTP({inlinedRequest:a,allTypes:r}),examples:[]});let f=ft.V2.types.TypeReference.named(o);return{docs:void 0,type:f,typeV2:f}},_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+i.type)}})}var yTP={laterVersion:"v4",earlierVersion:"v3",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:"0.0.264",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI]:"0.0.11-4-g1c29f6c",[me.POSTMAN]:"0.0.32-rc0",[me.STOPLIGHT]:Hn,[me.OPENAPI_PYTHON_CLIENT]:Hn,[me.PYTHON_SDK]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},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=>vTP(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(n=>Xf3(n))}))}))}})};function vTP(e){return ft.V4.types.ExampleTypeShape._visit(e,{object:t=>ft.V3.types.ExampleType.object(Jf3(t)),union:t=>ft.V3.types.ExampleType.union($f3(t)),alias:t=>ft.V3.types.ExampleType.alias(Yf3(t)),enum:ft.V3.types.ExampleType.enum,_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function Jf3(e){return{properties:e.properties.map(t=>({wireKey:t.wireKey,value:hMe(t.value),originalTypeDeclaration:t.originalTypeDeclaration}))}}function hMe(e){return ft.V4.types.ExampleTypeReferenceShape._visit(e.shape,{primitive:ft.V3.types.ExampleTypeReference.primitive,container:t=>ft.V3.types.ExampleTypeReference.container(Kf3(t)),named:t=>ft.V3.types.ExampleTypeReference.named(bTP(t)),unknown:ft.V3.types.ExampleTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReference: "+e.shape.type)}})}function Kf3(e){return ft.V4.types.ExampleContainer._visit(e,{list:t=>ft.V3.types.ExampleContainer.list(t.map(hMe)),set:t=>ft.V3.types.ExampleContainer.set(t.map(hMe)),optional:t=>ft.V3.types.ExampleContainer.optional(t!=null?hMe(t):void 0),map:t=>ft.V3.types.ExampleContainer.map(t.map(r=>({key:hMe(r.key),value:hMe(r.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+e.type)}})}function bTP(e){return{typeName:e.typeName,shape:vTP(e.shape)}}function $f3(e){return{wireDiscriminantValue:e.wireDiscriminantValue,properties:ft.V4.types.ExampleSingleUnionTypeProperties._visit(e.properties,{samePropertiesAsObject:t=>ft.V3.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject(bTP(t)),singleProperty:t=>ft.V3.types.ExampleSingleUnionTypeProperties.singleProperty(hMe(t)),noProperties:()=>ft.V3.types.ExampleSingleUnionTypeProperties.noProperties(),_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+e.properties.type)}})}}function Yf3(e){return{value:hMe(e.value)}}function Xf3(e){return{servicePathParameters:e.servicePathParameters.map(t=>_TP(t)),endpointPathParameters:e.servicePathParameters.map(t=>_TP(t)),serviceHeaders:e.serviceHeaders.map(t=>hTP(t)),endpointHeaders:e.endpointHeaders.map(t=>hTP(t)),queryParameters:e.queryParameters.map(t=>Zf3(t)),request:e.request!=null?kf3(e.request):void 0,response:td3(e.response)}}function _TP(e){return{key:e.key,value:hMe(e.value)}}function hTP(e){return{key:e.wireKey,value:hMe(e.value)}}function Zf3(e){return{key:e.wireKey,value:hMe(e.value)}}function kf3(e){return ft.V4.services.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>ft.V3.services.http.ExampleRequestBody.inlinedRequestBody({properties:t.properties.map(r=>ed3(r))}),reference:t=>ft.V3.services.http.ExampleRequestBody.reference(hMe(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function ed3(e){return{wireKey:e.wireKey,value:hMe(e.value),originalTypeDeclaration:e.originalTypeDeclaration}}function td3(e){return ft.V4.services.http.ExampleResponse._visit(e,{ok:t=>ft.V3.services.http.ExampleResponse.ok({body:t.body!=null?hMe(t.body):void 0}),error:t=>ft.V3.services.http.ExampleResponse.error({error:t.error,body:t.body!=null?hMe(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}function gqr(e){return{originalValue:e.originalName,camelCase:e.camelCase.unsafeName,pascalCase:e.pascalCase.unsafeName,snakeCase:e.snakeCase.unsafeName,screamingSnakeCase:e.screamingSnakeCase.unsafeName}}function Xit(e){return{...gqr(e.name),wireValue:e.wireValue}}function Xse(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 Zse(e){return{wireValue:e.wireValue,name:Xse(e.name)}}function oro(e){return ft.V5.types.ContainerType._visit(e,{list:t=>ft.V4.types.ContainerType.list(p$(t)),set:t=>ft.V4.types.ContainerType.set(p$(t)),map:({keyType:t,valueType:r})=>ft.V4.types.ContainerType.map({keyType:p$(t),valueType:p$(r)}),optional:t=>ft.V4.types.ContainerType.optional(p$(t)),literal:t=>ft.V5.types.Literal._visit(t,{string:r=>ft.V4.types.ContainerType.literal(ft.V4.types.Literal.string(r)),_unknown:()=>{throw new Error("Unknown Literal: "+t.type)}}),_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function xva(e){return e.map(t=>gqr(t))}function Fva(e){return e.map(t=>Xse(t))}function Ppe(e){return{fernFilepath:xva(e.fernFilepath),fernFilepathV2:Fva(e.fernFilepath),name:e.name.originalName,nameV2:gqr(e.name),nameV3:Xse(e.name)}}function p$(e){return ft.V5.types.TypeReference._visit(e,{named:t=>ft.V4.types.TypeReference.named(Ppe(t)),container:t=>ft.V4.types.TypeReference.container(oro(t)),primitive:t=>ft.V4.types.TypeReference.primitive(t),unknown:ft.V4.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown TypeReference: "+e._type)}})}function zva(e){return{name:Xit(e.name),nameV2:Zse(e.name),valueType:p$(e.valueType),availability:e.availability,docs:e.docs}}function gTP(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>rd3(t))}}function rd3(e){return ft.V5.auth.AuthScheme._visit(e,{basic:ft.V4.auth.AuthScheme.basic,bearer:ft.V4.auth.AuthScheme.bearer,header:t=>ft.V4.auth.AuthScheme.header(zva(t)),_unknown:()=>{throw new Error("Unknown AuthScheme: "+e._type)}})}function mTP(e){return{docs:e.docs,id:e.id,url:e.url,name:Xse(e.name)}}function OTP({errorDeclaration:e,errorDiscriminationStrategy:t,typeReferenceResolver:r}){let n=e.type!=null?ft.V4.types.Type.alias({aliasOf:p$(e.type),resolvedType:r.resolveTypeReference(e.type)}):void 0;return{docs:e.docs,name:{name:e.name.name.originalName,nameV2:gqr(e.name.name),nameV3:Xse(e.name.name),fernFilepath:xva(e.name.fernFilepath),fernFilepathV2:Fva(e.name.fernFilepath)},discriminantValueV2:Zse(e.discriminantValue),discriminantValueV3:ft.V5.ir.ErrorDiscriminationStrategy._visit(t,{statusCode:ft.V4.errors.ErrorDeclarationDiscriminantValue.statusCode,property:i=>ft.V4.errors.ErrorDeclarationDiscriminantValue.property(Zse(i.contentProperty)),_unknown:()=>{throw new Error("Unknown ErrorDiscriminationStrategy: "+t.type)}}),discriminantValueV4:Zse(e.discriminantValue),type:n??ft.V4.types.Type.alias({aliasOf:ft.V4.types.TypeReference.void(),resolvedType:ft.V4.types.ResolvedTypeReference.void()}),typeV2:n,typeV3:e.type!=null?p$(e.type):e.type,http:{statusCode:e.statusCode},statusCode:e.statusCode}}function yMe(e){return{jsonExample:e.jsonExample,shape:ATP(e.shape)}}function ATP(e){return ft.V5.types.ExampleTypeReferenceShape._visit(e,{primitive:ft.V4.types.ExampleTypeReferenceShape.primitive,container:t=>ft.V4.types.ExampleTypeReferenceShape.container(id3(t)),unknown:ft.V4.types.ExampleTypeReferenceShape.unknown,named:t=>ft.V4.types.ExampleTypeReferenceShape.named(nd3(t)),_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function nd3(e){return{typeName:Ppe(e.typeName),shape:PJu(e.shape)}}function id3(e){return ft.V5.types.ExampleContainer._visit(e,{list:t=>ft.V4.types.ExampleContainer.list(t.map(r=>yMe(r))),set:t=>ft.V4.types.ExampleContainer.set(t.map(r=>yMe(r))),optional:t=>ft.V4.types.ExampleContainer.optional(t!=null?yMe(t):void 0),map:t=>ft.V4.types.ExampleContainer.map(t.map(r=>({key:yMe(r.key),value:yMe(r.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+e.type)}})}function PJu(e){return ft.V5.types.ExampleTypeShape._visit(e,{alias:t=>ft.V4.types.ExampleTypeShape.alias({value:yMe(t.value)}),object:t=>ft.V4.types.ExampleTypeShape.object({properties:t.properties.map(r=>({wireKey:r.wireKey,value:yMe(r.value),originalTypeDeclaration:Ppe(r.originalTypeDeclaration)}))}),union:t=>ft.V4.types.ExampleTypeShape.union({wireDiscriminantValue:t.wireDiscriminantValue,properties:ft.V5.types.ExampleSingleUnionTypeProperties._visit(t.properties,{samePropertiesAsObject:r=>ft.V4.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:Ppe(r.typeName),shape:PJu(r.shape)}),singleProperty:r=>ft.V4.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:r.jsonExample,shape:ATP(r.shape)}),noProperties:ft.V4.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+t.properties.type)}})}),enum:t=>ft.V4.types.ExampleTypeShape.enum({wireValue:t.wireValue}),_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function jTP({service:e,errorResolver:t}){return{docs:e.docs,availability:e.availability,displayName:e.displayName,name:ad3(e.name),basePath:od3(e.basePath),basePathV2:e.basePath,endpoints:e.endpoints.map(r=>sd3({endpoint:r,errorResolver:t})),headers:e.headers.map(r=>zva(r)),pathParameters:e.pathParameters.map(r=>ETP(r))}}function ad3(e){return{name:e.name.pascalCase.unsafeName,fernFilepath:xva(e.fernFilepath),fernFilepathV2:Fva(e.fernFilepath)}}function od3(e){return e.parts.reduce((t,r)=>t+`{${r.pathParameter}}`+r.tail,e.head)}function sd3({endpoint:e,errorResolver:t}){return{docs:e.docs,availability:e.availability,id:e.name.originalName,name:gqr(e.name),nameV2:Xse(e.name),displayName:e.displayName,method:e.method,headers:e.headers.map(r=>zva(r)),path:e.path,pathParameters:e.pathParameters.map(r=>ETP(r)),queryParameters:e.queryParameters.map(r=>ud3(r)),requestBody:e.requestBody!=null?cd3(e.requestBody):void 0,sdkRequest:e.sdkRequest!=null?ld3(e.sdkRequest):void 0,response:fd3(e.response),errors:e.errors.map(r=>dd3(r)),errorsV2:pd3({responseErrors:e.errors,errorResolver:t}),auth:e.auth,examples:e.examples.map(r=>yd3(r))}}function ETP(e){return{docs:e.docs,availability:e.availability,name:gqr(e.name),nameV2:Xse(e.name),valueType:p$(e.valueType)}}function ud3(e){return{docs:e.docs,availability:e.availability,name:Xit(e.name),nameV2:Zse(e.name),valueType:p$(e.valueType),allowMultiple:e.allowMultiple}}function cd3(e){return ft.V5.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V4.services.http.HttpRequestBody.inlinedRequestBody({name:Xse(t.name),extends:t.extends.map(r=>Ppe(r)),properties:t.properties.map(r=>({docs:r.docs,name:Zse(r.name),valueType:p$(r.valueType)}))}),reference:t=>ft.V4.services.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:p$(t.requestBodyType)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+e.type)}})}function ld3(e){return{requestParameterName:Xse(e.requestParameterName),shape:ft.V5.http.SdkRequestShape._visit(e.shape,{justRequestBody:t=>ft.V4.services.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:p$(t.requestBodyType)}),wrapper:t=>ft.V4.services.http.SdkRequestShape.wrapper({wrapperName:Xse(t.wrapperName),bodyKey:Xse(t.bodyKey)}),_unknown:()=>{throw new Error("Unknown SdkRequestShape type: "+e.shape.type)}})}}function fd3(e){let t=e.type!=null?p$(e.type):void 0;return{docs:e.docs,type:t??ft.V4.types.TypeReference.void(),typeV2:t}}function dd3(e){return{docs:e.docs,error:XRd(e.error)}}function pd3({responseErrors:e,errorResolver:t}){return{discriminant:{originalValue:"errorName",camelCase:"errorName",snakeCase:"error_name",pascalCase:"ErrorName",screamingSnakeCase:"ERROR_NAME",wireValue:"errorName"},types:e.map(r=>_d3({responseError:r,errorResolver:t}))}}function _d3({responseError:e,errorResolver:t}){let r=t.getDeclaration(e.error);return{docs:e.docs,discriminantValue:Xit(r.discriminantValue),shape:hd3({responseError:e,declaration:r})}}function hd3({responseError:e,declaration:t}){return t.type==null?ft.V4.services.commons.ResponseErrorShape.noProperties():ft.V4.services.commons.ResponseErrorShape.singleProperty({name:{originalValue:"content",camelCase:"content",snakeCase:"content",pascalCase:"Content",screamingSnakeCase:"CONTENT",wireValue:"content"},error:XRd(e.error)})}function XRd(e){return{name:e.name.originalName,nameV2:gqr(e.name),nameV3:Xse(e.name),fernFilepath:xva(e.fernFilepath),fernFilepathV2:Fva(e.fernFilepath)}}function yd3(e){return{docs:e.docs,name:e.name?.originalName,servicePathParameters:e.servicePathParameters.map(t=>PTP(t)),endpointPathParameters:e.endpointPathParameters.map(t=>PTP(t)),serviceHeaders:e.serviceHeaders.map(t=>wTP(t)),endpointHeaders:e.endpointHeaders.map(t=>wTP(t)),queryParameters:e.queryParameters.map(t=>vd3(t)),request:e.request!=null?bd3(e.request):void 0,response:md3(e.response)}}function PTP(e){return{key:e.key,value:yMe(e.value)}}function wTP(e){return{wireKey:e.wireKey,value:yMe(e.value)}}function vd3(e){return{wireKey:e.wireKey,value:yMe(e.value)}}function bd3(e){return ft.V5.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>ft.V4.services.http.ExampleRequestBody.inlinedRequestBody({jsonExample:t.jsonExample,properties:t.properties.map(r=>gd3(r))}),reference:t=>ft.V4.services.http.ExampleRequestBody.reference(yMe(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function gd3(e){return{wireKey:e.wireKey,value:yMe(e.value),originalTypeDeclaration:e.originalTypeDeclaration!=null?Ppe(e.originalTypeDeclaration):void 0}}function md3(e){return ft.V5.http.ExampleResponse._visit(e,{ok:t=>ft.V4.services.http.ExampleResponse.ok({body:t.body!=null?yMe(t.body):void 0}),error:t=>ft.V4.services.http.ExampleResponse.error({error:XRd(t.error),body:t.body!=null?yMe(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}function STP(e){return{docs:e.docs,availability:e.availability,name:Ppe(e.name),shape:Od3(e.shape),examples:e.examples.map(t=>Ad3(t)),referencedTypes:e.referencedTypes.map(t=>Ppe(t))}}function Od3(e){return ft.V5.types.Type._visit(e,{alias:({aliasOf:t,resolvedType:r})=>ft.V4.types.Type.alias({aliasOf:p$(t),resolvedType:Pd3(r)}),enum:t=>ft.V4.types.Type.enum({values:t.values.map(r=>({docs:r.docs,availability:r.availability,name:Xit(r.name),nameV2:Zse(r.name),value:r.name.wireValue}))}),object:t=>ft.V4.types.Type.object({extends:t.extends.map(r=>Ppe(r)),properties:t.properties.map(r=>({docs:r.docs,availability:r.availability,name:Xit(r.name),nameV2:Zse(r.name),valueType:p$(r.valueType)}))}),union:t=>ft.V4.types.Type.union({discriminant:t.discriminant.wireValue,discriminantV2:Xit(t.discriminant),discriminantV3:Zse(t.discriminant),types:t.types.map(r=>({docs:r.docs,discriminantValue:Xit(r.discriminantValue),discriminantValueV2:Zse(r.discriminantValue),valueType:ft.V5.types.SingleUnionTypeProperties._visit(r.shape,{samePropertiesAsObject:n=>ft.V4.types.TypeReference.named(Ppe(n)),singleProperty:n=>p$(n.type),noProperties:ft.V4.types.TypeReference.void,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+r.shape._type)}}),shape:ft.V5.types.SingleUnionTypeProperties._visit(r.shape,{samePropertiesAsObject:n=>ft.V4.types.SingleUnionTypeProperties.samePropertiesAsObject(Ppe(n)),singleProperty:n=>ft.V4.types.SingleUnionTypeProperties.singleProperty({name:Xit(n.name),nameV2:Zse(n.name),type:p$(n.type)}),noProperties:ft.V4.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+r.shape._type)}})}))}),_unknown:()=>{throw new Error("Unknown shape: "+e._type)}})}function Ad3(e){return{docs:e.docs,jsonExample:e.jsonExample,name:e.name?.originalName,shape:PJu(e.shape)}}function Pd3(e){return ft.V5.types.ResolvedTypeReference._visit(e,{named:t=>ft.V4.types.ResolvedTypeReference.named({name:Ppe(t.name),shape:wd3(t.shape)}),container:t=>ft.V4.types.ResolvedTypeReference.container(oro(t)),primitive:ft.V4.types.ResolvedTypeReference.primitive,unknown:ft.V4.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function wd3(e){return ft.V5.types.ShapeType._visit(e,{enum:()=>ft.V5.types.ShapeType.Enum,object:()=>ft.V5.types.ShapeType.Object,union:()=>ft.V5.types.ShapeType.Union,_unknown:()=>{throw new Error("Unknown ShapeType: "+e)}})}var wJu=class{errors;constructor(t){this.errors=t.errors.reduce((r,n)=>({...r,[DTP(n.name)]:n}),{})}getDeclaration(t){let r=DTP(t),n=this.errors[r];if(n==null)throw new Error("Error does not exist: "+r);return n}};function DTP(e){return`${e.fernFilepath.join("/")}:${e.name.originalName}`}var jJu=class{types;constructor(t){this.types=t.types.reduce((r,n)=>({...r,[CTP(n.name)]:n}),{})}resolveTypeReference(t){return ft.V5.types.TypeReference._visit(t,{container:r=>ft.V4.types.ResolvedTypeReference.container(oro(r)),named:r=>{let n=this.getTypeDeclaration(r);return n.shape._type==="alias"?this.resolveTypeReference(n.shape.aliasOf):ft.V4.types.ResolvedTypeReference.named({name:Ppe(r),shape:jd3(n.shape._type)})},primitive:ft.V4.types.ResolvedTypeReference.primitive,unknown:ft.V4.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown TypeReference: "+t._type)}})}getTypeDeclaration(t){let r=CTP(t),n=this.types[r];if(n==null)throw new Error("Type does not exist: "+n);return n}};function CTP(e){return`${e.fernFilepath.join("/")}:${e.name.originalName}`}function jd3(e){switch(e){case"object":return ft.V4.types.ShapeType.Object;case"union":return ft.V4.types.ShapeType.Union;case"enum":return ft.V4.types.ShapeType.Enum;default:fc(e)}}var ITP={laterVersion:"v5",earlierVersion:"v4",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.0.257-2-g46fe4ff",[me.TYPESCRIPT_EXPRESS]:"0.0.264",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:"0.0.33-9-gf683b5e",[me.PYTHON_PYDANTIC]:"0.0.33-9-gf683b5e",[me.OPENAPI]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Hn,[me.STOPLIGHT]:Hn,[me.OPENAPI_PYTHON_CLIENT]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=new jJu(e),r=new wJu(e);return{apiName:e.apiName.originalName,apiDisplayName:e.apiDisplayName,apiDocs:e.apiDocs,auth:gTP(e.auth),headers:e.headers.map(n=>zva(n)),types:e.types.map(n=>STP(n)),services:{http:e.services.map(n=>jTP({service:n,errorResolver:r})),websocket:[]},errors:e.errors.map(n=>OTP({errorDeclaration:n,errorDiscriminationStrategy:e.errorDiscriminationStrategy,typeReferenceResolver:t})),constants:{errorDiscriminant:"_error",errorInstanceIdKey:"_errorInstanceId",unknownErrorDiscriminantValue:"_unknown"},constantsV2:{errors:{errorInstanceIdKey:Xit(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:Zse(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(n=>mTP(n)),errorDiscriminant:e.errorDiscriminationStrategy.type==="property"?Xse(e.errorDiscriminationStrategy.discriminant.name):void 0,errorDiscriminationStrategy:ft.V5.ir.ErrorDiscriminationStrategy._visit(e.errorDiscriminationStrategy,{statusCode:ft.V4.ir.ErrorDiscriminationStrategy.statusCode,property:n=>ft.V4.ir.ErrorDiscriminationStrategy.property({discriminant:Zse(n.discriminant),contentProperty:Zse(n.contentProperty)}),_unknown:()=>{throw new Error("Unknown ErrorDiscriminationStrategy: "+e.errorDiscriminationStrategy.type)}}),sdkConfig:e.sdkConfig}}};var MTP={laterVersion:"v6",earlierVersion:"v5",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.0.257-4-ge56e5d2",[me.TYPESCRIPT_EXPRESS]:"0.0.264",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:"0.0.35-1-g071a04a",[me.PYTHON_PYDANTIC]:"0.0.35-1-g071a04a",[me.OPENAPI]:"0.0.16-1-ga2c0ada",[me.STOPLIGHT]:Hn,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Hn,[me.OPENAPI_PYTHON_CLIENT]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>({...e,defaultEnvironment:e.environments?.defaultEnvironment,environments:e.environments!=null?ft.V6.environment.Environments._visit(e.environments.environments,{singleBaseUrl:n=>n.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 BTP={laterVersion:"v7",earlierVersion:"v6",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.0.268",[me.TYPESCRIPT_EXPRESS]:"0.0.268",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Hn,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Hn,[me.OPENAPI_PYTHON_CLIENT]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,services:e.services.map(t=>{let r=t.name.fernFilepath[t.name.fernFilepath.length-1],n=r!=null?`${r.pascalCase.safeName}Service`:"Service",i=r!=null?`${r.camelCase.unsafeName}Service`:"Service",a=r!=null?`${r.snakeCase.unsafeName}_service`:"service",o=a.toUpperCase(),c=bU(i);return{...t,name:{name:{originalName:n,camelCase:{safeName:i,unsafeName:i},snakeCase:{safeName:a,unsafeName:a},screamingSnakeCase:{safeName:o,unsafeName:o},pascalCase:{safeName:c,unsafeName:c}},fernFilepath:t.name.fernFilepath}}})})};var RTP={laterVersion:"v8",earlierVersion:"v7",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.0.273-5-g1b00245b",[me.TYPESCRIPT_EXPRESS]:"0.0.273-5-g1b00245b",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:"0.0.45-1-g8bb600f",[me.PYTHON_PYDANTIC]:"0.0.45-1-g8bb600f",[me.OPENAPI_PYTHON_CLIENT]:"0.0.0",[me.OPENAPI]:"0.0.20-1-gbbeb9bd",[me.STOPLIGHT]:Hn,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,auth:Ed3(e.auth),headers:e.headers.map(t=>EJu(t)),types:e.types.map(t=>Sd3(t)),errors:e.errors.map(t=>qd3(t)),services:e.services.map(t=>Rd3(t))})};function ZRd(e){return e.allParts}function Ed3(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:ft.V7.auth.AuthScheme.header(EJu(t)))}}function EJu(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:Xwe(e.valueType)}}function Xwe(e){return ft.V8.types.TypeReference._visit(e,{container:t=>ft.V7.types.TypeReference.container(NTP(t)),named:t=>ft.V7.types.TypeReference.named(mqr(t)),primitive:ft.V7.types.TypeReference.primitive,unknown:ft.V7.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function NTP(e){return ft.V8.types.ContainerType._visit(e,{list:t=>ft.V7.types.ContainerType.list(Xwe(t)),optional:t=>ft.V7.types.ContainerType.optional(Xwe(t)),set:t=>ft.V7.types.ContainerType.set(Xwe(t)),map:({keyType:t,valueType:r})=>ft.V7.types.ContainerType.map({keyType:Xwe(t),valueType:Xwe(r)}),literal:ft.V7.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function mqr(e){return{name:e.name,fernFilepath:ZRd(e.fernFilepath)}}function Sd3(e){return{docs:e.docs,availability:e.availability,name:mqr(e.name),shape:Dd3(e.shape),examples:e.examples.map(t=>Bd3(t)),referencedTypes:e.referencedTypes.map(t=>mqr(t))}}function Dd3(e){return ft.V8.types.Type._visit(e,{alias:t=>ft.V7.types.Type.alias({aliasOf:Xwe(t.aliasOf),resolvedType:Cd3(t.resolvedType)}),enum:ft.V7.types.Type.enum,object:t=>ft.V7.types.Type.object({extends:t.extends.map(r=>mqr(r)),properties:t.properties.map(r=>({docs:r.docs,availability:r.availability,name:r.name,valueType:Xwe(r.valueType)}))}),union:t=>ft.V7.types.Type.union({discriminant:t.discriminant,types:t.types.map(r=>Id3(r))}),_unknown:()=>{throw new Error("Unknown Type shape: "+e._type)}})}function Cd3(e){return ft.V8.types.ResolvedTypeReference._visit(e,{container:t=>ft.V7.types.ResolvedTypeReference.container(NTP(t)),named:t=>ft.V7.types.ResolvedTypeReference.named({name:mqr(t.name),shape:t.shape}),primitive:ft.V7.types.ResolvedTypeReference.primitive,unknown:ft.V7.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function Id3(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:Md3(e.shape)}}function Md3(e){return ft.V8.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>ft.V7.types.SingleUnionTypeProperties.samePropertiesAsObject(mqr(t)),singleProperty:t=>ft.V7.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:Xwe(t.type)}),noProperties:ft.V7.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function Bd3(e){return{jsonExample:e.jsonExample,docs:e.docs,name:e.name,shape:kRd(e.shape)}}function kRd(e){return ft.V8.types.ExampleTypeShape._visit(e,{alias:t=>ft.V7.types.ExampleTypeShape.alias({value:V2e(t.value)}),enum:ft.V7.types.ExampleTypeShape.enum,object:t=>ft.V7.types.ExampleTypeShape.object({properties:t.properties.map(r=>({wireKey:r.wireKey,value:V2e(r.value),originalTypeDeclaration:mqr(r.originalTypeDeclaration)}))}),union:t=>ft.V7.types.ExampleTypeShape.union({wireDiscriminantValue:t.wireDiscriminantValue,properties:Td3(t.properties)}),_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function V2e(e){return{jsonExample:e.jsonExample,shape:xTP(e.shape)}}function xTP(e){return ft.V8.types.ExampleTypeReferenceShape._visit(e,{named:t=>ft.V7.types.ExampleTypeReferenceShape.named({typeName:mqr(t.typeName),shape:kRd(t.shape)}),container:t=>ft.V7.types.ExampleTypeReferenceShape.container(ft.V8.types.ExampleContainer._visit(t,{list:r=>ft.V7.types.ExampleContainer.list(r.map(n=>V2e(n))),set:r=>ft.V7.types.ExampleContainer.set(r.map(n=>V2e(n))),optional:r=>ft.V7.types.ExampleContainer.optional(r!=null?V2e(r):void 0),map:r=>ft.V7.types.ExampleContainer.map(r.map(n=>({key:V2e(n.key),value:V2e(n.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+t.type)}})),primitive:ft.V7.types.ExampleTypeReferenceShape.primitive,unknown:ft.V7.types.ExampleTypeReferenceShape.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function Td3(e){return ft.V8.types.ExampleSingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>ft.V7.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:mqr(t.typeName),shape:kRd(t.shape)}),singleProperty:t=>ft.V7.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:t.jsonExample,shape:xTP(t.shape)}),noProperties:ft.V7.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+e.type)}})}function qd3(e){return{docs:e.docs,name:eNd(e.name),discriminantValue:e.discriminantValue,type:e.type!=null?Xwe(e.type):void 0,statusCode:e.statusCode}}function eNd(e){return{name:e.name,fernFilepath:ZRd(e.fernFilepath)}}function Rd3(e){return{docs:e.docs,availability:e.availability,name:{fernFilepath:ZRd(e.name.fernFilepath)},displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>FTP(t)),headers:e.headers.map(t=>EJu(t)),endpoints:e.endpoints.map(t=>Nd3(t))}}function FTP(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:Xwe(e.valueType)}}function Nd3(e){return{docs:e.docs,availability:e.availability,name:e.name,displayName:e.displayName,errors:e.errors.map(t=>xd3(t)),auth:e.auth,method:e.method,path:e.path,pathParameters:e.pathParameters.map(t=>FTP(t)),sdkRequest:e.sdkRequest!=null?zd3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?Ld3(e.requestBody):void 0,response:Ud3(e.response),headers:e.headers.map(t=>EJu(t)),queryParameters:e.queryParameters.map(t=>Fd3(t)),examples:e.examples.map(t=>Vd3(t))}}function xd3(e){return{docs:e.docs,error:eNd(e.error)}}function Fd3(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:Xwe(e.valueType),allowMultiple:e.allowMultiple}}function zd3(e){return{requestParameterName:e.requestParameterName,shape:Qd3(e.shape)}}function Qd3(e){return ft.V8.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V7.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:Xwe(t.requestBodyType)}),wrapper:ft.V7.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function Ld3(e){return ft.V8.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V7.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends.map(r=>mqr(r)),properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:Xwe(r.valueType)}))}),reference:t=>ft.V7.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:Xwe(t.requestBodyType)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Ud3(e){return{docs:e.docs,type:e.type!=null?Xwe(e.type):void 0}}function Vd3(e){return{name:e.name,docs:e.docs,servicePathParameters:e.servicePathParameters.map(t=>TTP(t)),endpointPathParameters:e.endpointPathParameters.map(t=>TTP(t)),queryParameters:e.queryParameters.map(t=>Wd3(t)),serviceHeaders:e.serviceHeaders.map(t=>qTP(t)),endpointHeaders:e.endpointHeaders.map(t=>qTP(t)),request:e.request!=null?Hd3(e.request):void 0,response:Gd3(e.response)}}function TTP(e){return{key:e.key,value:V2e(e.value)}}function Wd3(e){return{wireKey:e.wireKey,value:V2e(e.value)}}function qTP(e){return{wireKey:e.wireKey,value:V2e(e.value)}}function Hd3(e){return ft.V8.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>ft.V7.http.ExampleRequestBody.inlinedRequestBody({jsonExample:t.jsonExample,properties:t.properties.map(r=>({wireKey:r.wireKey,value:V2e(r.value),originalTypeDeclaration:r.originalTypeDeclaration!=null?mqr(r.originalTypeDeclaration):void 0}))}),reference:t=>ft.V7.http.ExampleRequestBody.reference(V2e(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function Gd3(e){return ft.V8.http.ExampleResponse._visit(e,{ok:t=>ft.V7.http.ExampleResponse.ok({body:t.body!=null?V2e(t.body):void 0}),error:t=>ft.V7.http.ExampleResponse.error({error:eNd(t.error),body:t.body!=null?V2e(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}var zTP={laterVersion:"v9",earlierVersion:"v8",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.3.0-2-g85e8aa08",[me.TYPESCRIPT_EXPRESS]:"0.3.0-2-g85e8aa08",[me.JAVA]:Ut,[me.JAVA_MODEL]:"0.0.134-4-gef1ec4f",[me.JAVA_SDK]:"0.0.134-4-gef1ec4f",[me.JAVA_SPRING]:"0.0.134-4-gef1ec4f",[me.PYTHON_FASTAPI]:"0.0.51-1-g977dd1f",[me.PYTHON_PYDANTIC]:"0.0.51-1-g977dd1f",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Hn,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{for(let[n,i]of Object.entries(e.types))i.shape._type==="union"&&i.shape.baseProperties.length>0&&t.failWithoutThrowing(r!=null?`Type ${i.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()===C9.Failure&&t.failAndThrow(),{...e,types:Object.values(e.types),errors:Object.values(e.errors),services:Object.values(e.services)}}};var QTP={laterVersion:"v10",earlierVersion:"v9",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.STOPLIGHT]:Hn,[me.OPENAPI]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=fg(e.services,r=>({docs:void 0,...r}));for(let r of Object.values(e.subpackages))if(r.docs!=null&&r.service!=null){let n=t[r.service];if(n==null)throw new Error("Service does not exist: "+r.service);n.docs=r.docs}return{...e,services:t}}};var LTP={laterVersion:"v11",earlierVersion:"v10",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.5.0-rc0-1-g83a12940",[me.TYPESCRIPT_EXPRESS]:"0.5.0-rc0-1-g83a12940",[me.JAVA]:Ut,[me.JAVA_MODEL]:"0.0.134-15-ge1ac358",[me.JAVA_SDK]:"0.0.134-15-ge1ac358",[me.JAVA_SPRING]:"0.0.134-15-ge1ac358",[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.STOPLIGHT]:Hn,[me.OPENAPI]:Ut,[me.POSTMAN]:"0.0.40-1-g9aa2117",[me.PYTHON_SDK]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,auth:Jd3(e.auth,t)})};function Jd3(e,t){return{...e,schemes:e.schemes.map(r=>Kd3(r,t))}}function Kd3(e,{taskContext:t,targetGenerator:r}){return ft.V11.auth.AuthScheme._visit(e,{bearer:ft.V10.auth.AuthScheme.bearer,basic:ft.V10.auth.AuthScheme.basic,header:n=>n.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."):ft.V10.auth.AuthScheme.header({docs:n.docs,availability:{status:ft.V10.commons.AvailabilityStatus.GeneralAvailability,message:void 0},name:{name:n.name,wireValue:n.header},valueType:n.valueType}),_unknown:()=>{throw new Error("Unknown auth scheme: "+e._type)}})}var VTP={laterVersion:"v12",earlierVersion:"v11",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.5.0-rc0-6-g80f89f98",[me.TYPESCRIPT_EXPRESS]:"0.5.0-rc0-6-g80f89f98",[me.JAVA]:Ut,[me.JAVA_MODEL]:"0.1.0-1-gdb5c636",[me.JAVA_SDK]:"0.1.0-1-gdb5c636",[me.JAVA_SPRING]:"0.1.0-1-gdb5c636",[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.STOPLIGHT]:"0.0.23-8-g479c860",[me.OPENAPI]:"0.0.22-1-g1c86b58",[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{let n=fg(e.types,i=>({...i,shape:ft.V12.types.Type._visit(i.shape,{union:ft.V11.types.Type.union,enum:ft.V11.types.Type.enum,object:ft.V11.types.Type.object,alias:a=>ft.V11.types.Type.alias({aliasOf:a.aliasOf,resolvedType:ft.V12.types.ResolvedTypeReference._visit(a.resolvedType,{container:ft.V11.types.ResolvedTypeReference.container,primitive:ft.V11.types.ResolvedTypeReference.primitive,named:o=>o.shape==="UNDISCRIMINATED_UNION"?t.failAndThrow(UTP({taskContext:t,targetGenerator:r})):ft.V11.types.ResolvedTypeReference.named({shape:o.shape,name:o.name}),unknown:ft.V11.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Encountered unknown alias")}})}),undiscriminatedUnion:()=>t.failAndThrow(UTP({taskContext:t,targetGenerator:r})),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,types:n,services:fg(e.services,i=>$d3(i,{taskContext:t,targetGenerator:r}))}}};function UTP(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 $d3(e,t){return{...e,endpoints:e.endpoints.map(r=>Yd3(r,t))}}function Yd3(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?ft.V12.http.HttpRequestBody._visit(e.requestBody,{inlinedRequestBody:ft.V11.http.HttpRequestBody.inlinedRequestBody,reference:ft.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 WTP={laterVersion:"v13",earlierVersion:"v12",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,types:fg(e.types,t=>t.shape._type!=="undiscriminatedUnion"?{...t,shape:t.shape}:{...t,shape:ft.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 HTP={laterVersion:"v14",earlierVersion:"v13",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Hn,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=fg(e.types,r=>({...r,shape:ft.V14.types.Type._visit(r.shape,{union:n=>ft.V13.types.Type.union({discriminant:n.discriminant,baseProperties:n.baseProperties.map(i=>({...i,valueType:Iee(i.valueType)})),types:n.types.map(i=>kd3(i))}),enum:ft.V13.types.Type.enum,object:n=>ft.V13.types.Type.object({...n,properties:n.properties.map(i=>({...i,valueType:Iee(i.valueType)}))}),alias:n=>ft.V13.types.Type.alias({aliasOf:Iee(n.aliasOf),resolvedType:tp3(n.resolvedType)}),undiscriminatedUnion:n=>ft.V13.types.Type.undiscriminatedUnion(rp3(n)),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:Xd3(e.auth),headers:e.headers.map(r=>nNd(r)),types:t,services:fg(e.services,r=>np3(r)),errors:fg(e.errors,r=>lp3(r))}}};function Xd3(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:ft.V13.auth.AuthScheme.header(Zd3(t)))}}function Zd3(e){return{docs:e.docs,prefix:e.prefix,name:e.name,valueType:Iee(e.valueType)}}function nNd(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:Iee(e.valueType)}}function Iee(e){return ft.V14.types.TypeReference._visit(e,{container:t=>ft.V13.types.TypeReference.container(GTP(t)),primitive:t=>t==="DATE"?ft.V13.types.TypeReference.primitive(ft.V13.types.PrimitiveType.String):ft.V13.types.TypeReference.primitive(t),named:ft.V13.types.TypeReference.named,unknown:ft.V13.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function GTP(e){return ft.V14.types.ContainerType._visit(e,{list:t=>ft.V13.types.ContainerType.list(Iee(t)),optional:t=>ft.V13.types.ContainerType.optional(Iee(t)),set:t=>ft.V13.types.ContainerType.set(Iee(t)),map:({keyType:t,valueType:r})=>ft.V13.types.ContainerType.map({keyType:Iee(t),valueType:Iee(r)}),literal:ft.V13.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function kd3(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:ep3(e.shape)}}function ep3(e){return ft.V14.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>ft.V13.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>ft.V13.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:Iee(t.type)}),noProperties:ft.V13.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function tp3(e){return ft.V14.types.ResolvedTypeReference._visit(e,{container:t=>ft.V13.types.ResolvedTypeReference.container(GTP(t)),named:ft.V13.types.ResolvedTypeReference.named,primitive:t=>t==="DATE"?ft.V13.types.ResolvedTypeReference.primitive(ft.V13.types.PrimitiveType.String):ft.V13.types.ResolvedTypeReference.primitive(t),unknown:ft.V13.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function rp3(e){return{members:e.members.map(t=>({...t,type:Iee(t.type)}))}}function np3(e){return{availability:e.availability,name:e.name,displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>JTP(t)),headers:e.headers.map(t=>nNd(t)),endpoints:e.endpoints.map(t=>ip3(t))}}function JTP(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:Iee(e.valueType)}}function ip3(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=>JTP(t)),sdkRequest:e.sdkRequest!=null?op3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?up3(e.requestBody):void 0,response:e.response!=null?tNd(e.response):void 0,headers:e.headers.map(t=>nNd(t)),queryParameters:e.queryParameters.map(t=>ap3(t)),examples:e.examples,streamingResponse:e.streamingResponse!=null?rNd(e.streamingResponse):void 0,sdkResponse:e.sdkResponse!=null?cp3(e.sdkResponse):void 0}}function ap3(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:Iee(e.valueType),allowMultiple:e.allowMultiple}}function op3(e){return{requestParameterName:e.requestParameterName,shape:sp3(e.shape)}}function sp3(e){return ft.V14.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V13.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:Iee(t.requestBodyType)}),wrapper:ft.V13.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function up3(e){return ft.V14.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V13.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends,properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:Iee(r.valueType)}))}),reference:t=>ft.V13.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:Iee(t.requestBodyType)}),fileUpload:t=>ft.V13.http.HttpRequestBody.fileUpload({name:t.name,properties:t.properties.map(r=>r.type==="bodyProperty"?{...r,valueType:Iee(r.valueType)}:r)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function tNd(e){return{docs:e.docs,responseBodyType:Iee(e.responseBodyType)}}function rNd(e){return{dataEventType:Iee(e.dataEventType),terminator:e.terminator}}function cp3(e){return ft.V14.http.SdkResponse._visit(e,{streaming:t=>ft.V13.http.SdkResponse.streaming(rNd(t)),nonStreaming:t=>ft.V13.http.SdkResponse.nonStreaming(tNd(t)),maybeStreaming:t=>ft.V13.http.SdkResponse.maybeStreaming({condition:t.condition,nonStreaming:tNd(t.nonStreaming),streaming:rNd(t.streaming)}),_unknown:()=>{throw new Error("Encountered unknown sdk response")}})}function lp3(e){return{docs:e.docs,name:e.name,discriminantValue:e.discriminantValue,type:e.type!=null?Iee(e.type):void 0,statusCode:e.statusCode}}var KTP={laterVersion:"v15",earlierVersion:"v14",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:"0.0.52-3-gd9df38df",[me.PYTHON_PYDANTIC]:"0.0.52-3-gd9df38df",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"0.0.52-3-gd9df38df",[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=fg(e.types,r=>({...r,shape:ft.V15.types.Type._visit(r.shape,{union:n=>ft.V14.types.Type.union({discriminant:n.discriminant,baseProperties:n.baseProperties.map(i=>({...i,valueType:Mee(i.valueType)})),types:n.types.map(i=>pp3(i))}),enum:ft.V14.types.Type.enum,object:n=>ft.V14.types.Type.object({...n,properties:n.properties.map(i=>({...i,valueType:Mee(i.valueType)}))}),alias:n=>ft.V14.types.Type.alias({aliasOf:Mee(n.aliasOf),resolvedType:hp3(n.resolvedType)}),undiscriminatedUnion:n=>ft.V14.types.Type.undiscriminatedUnion(yp3(n)),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:fp3(e.auth),headers:e.headers.map(r=>oNd(r)),types:t,services:fg(e.services,r=>vp3(r)),errors:fg(e.errors,r=>wp3(r))}}};function fp3(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:ft.V14.auth.AuthScheme.header(dp3(t)))}}function dp3(e){return{docs:e.docs,prefix:e.prefix,name:e.name,valueType:Mee(e.valueType)}}function oNd(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:Mee(e.valueType)}}function Mee(e){return ft.V15.types.TypeReference._visit(e,{container:t=>ft.V14.types.TypeReference.container($TP(t)),primitive:t=>t==="BASE_64"?ft.V14.types.TypeReference.primitive(ft.V14.types.PrimitiveType.String):ft.V14.types.TypeReference.primitive(t),named:ft.V14.types.TypeReference.named,unknown:ft.V14.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function $TP(e){return ft.V15.types.ContainerType._visit(e,{list:t=>ft.V14.types.ContainerType.list(Mee(t)),optional:t=>ft.V14.types.ContainerType.optional(Mee(t)),set:t=>ft.V14.types.ContainerType.set(Mee(t)),map:({keyType:t,valueType:r})=>ft.V14.types.ContainerType.map({keyType:Mee(t),valueType:Mee(r)}),literal:ft.V14.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function pp3(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:_p3(e.shape)}}function _p3(e){return ft.V15.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>ft.V14.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>ft.V14.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:Mee(t.type)}),noProperties:ft.V14.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function hp3(e){return ft.V15.types.ResolvedTypeReference._visit(e,{container:t=>ft.V14.types.ResolvedTypeReference.container($TP(t)),named:ft.V14.types.ResolvedTypeReference.named,primitive:t=>t==="BASE_64"?ft.V14.types.ResolvedTypeReference.primitive(ft.V14.types.PrimitiveType.String):ft.V14.types.ResolvedTypeReference.primitive(t),unknown:ft.V14.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function yp3(e){return{members:e.members.map(t=>({...t,type:Mee(t.type)}))}}function vp3(e){return{availability:e.availability,name:e.name,displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>YTP(t)),headers:e.headers.map(t=>oNd(t)),endpoints:e.endpoints.map(t=>bp3(t))}}function YTP(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:Mee(e.valueType)}}function bp3(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=>YTP(t)),sdkRequest:e.sdkRequest!=null?mp3(e.sdkRequest):void 0,requestBody:e.requestBody!=null?Ap3(e.requestBody):void 0,response:e.response!=null?iNd(e.response):void 0,headers:e.headers.map(t=>oNd(t)),queryParameters:e.queryParameters.map(t=>gp3(t)),examples:e.examples,streamingResponse:e.streamingResponse!=null?aNd(e.streamingResponse):void 0,sdkResponse:e.sdkResponse!=null?Pp3(e.sdkResponse):void 0}}function gp3(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:Mee(e.valueType),allowMultiple:e.allowMultiple}}function mp3(e){return{requestParameterName:e.requestParameterName,shape:Op3(e.shape)}}function Op3(e){return ft.V15.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V14.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:Mee(t.requestBodyType)}),wrapper:ft.V14.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function Ap3(e){return ft.V15.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V14.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends,properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:Mee(r.valueType)}))}),reference:t=>ft.V14.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:Mee(t.requestBodyType)}),fileUpload:t=>ft.V14.http.HttpRequestBody.fileUpload({name:t.name,properties:t.properties.map(r=>r.type==="bodyProperty"?{...r,valueType:Mee(r.valueType)}:r)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function iNd(e){return{docs:e.docs,responseBodyType:Mee(e.responseBodyType)}}function aNd(e){return{dataEventType:Mee(e.dataEventType),terminator:e.terminator}}function Pp3(e){return ft.V15.http.SdkResponse._visit(e,{streaming:t=>ft.V14.http.SdkResponse.streaming(aNd(t)),nonStreaming:t=>ft.V14.http.SdkResponse.nonStreaming(iNd(t)),maybeStreaming:t=>ft.V14.http.SdkResponse.maybeStreaming({condition:t.condition,nonStreaming:iNd(t.nonStreaming),streaming:aNd(t.streaming)}),_unknown:()=>{throw new Error("Encountered unknown sdk response")}})}function wp3(e){return{docs:e.docs,name:e.name,discriminantValue:e.discriminantValue,type:e.type!=null?Mee(e.type):void 0,statusCode:e.statusCode}}var XTP={laterVersion:"v16",earlierVersion:"v15",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.5.4-1-g4e69d312",[me.TYPESCRIPT_EXPRESS]:"0.5.4-1-g4e69d312",[me.JAVA]:Ut,[me.JAVA_MODEL]:"0.3.8-rc6-1-gcf4b372",[me.JAVA_SDK]:"0.3.8-rc6-1-gcf4b372",[me.JAVA_SPRING]:"0.3.8-rc6-1-gcf4b372",[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},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:fg(e.services,n=>({...n,pathParameters:sNd(n.pathParameters),endpoints:n.endpoints.map(i=>({...i,allPathParameters:sNd(i.allPathParameters),pathParameters:sNd(i.pathParameters)}))}))}};function sNd(e){return e.map(t=>jp3(t))}function jp3(e){return{...e,availability:{status:ft.V15.commons.AvailabilityStatus.GeneralAvailability,message:void 0}}}var ZTP={laterVersion:"v17",earlierVersion:"v16",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{for(let[n,i]of Object.entries(e.types))if(i.shape._type==="union"&&i.shape.extends.length>0)return t.failAndThrow(r!=null?`Generator ${r.name}@${r.version} does not support union types with extensions. See ${n} in file ${i.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 kTP={laterVersion:"v18",earlierVersion:"v17",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.5.14-1-ga6817141",[me.TYPESCRIPT_EXPRESS]:"0.5.14-1-ga6817141",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:"0.3.0-3-ge125e311",[me.PYTHON_PYDANTIC]:"0.3.0-3-ge125e311",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"0.3.0-3-ge125e311",[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>({...e,services:fg(e.services,n=>{let i=n.endpoints[0]?.baseUrl;return n.endpoints.some(a=>a.baseUrl!==i)?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."):{...n,baseUrl:i}})})};var tqP={laterVersion:"v19",earlierVersion:"v18",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Hn,[me.TYPESCRIPT_BROWSER_SDK]:Hn,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.5.19-1-gef223230",[me.TYPESCRIPT_EXPRESS]:"0.5.19-1-gef223230",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:"0.3.4-rc0-9-ge815162f",[me.PYTHON_PYDANTIC]:"0.3.4-rc0-9-ge815162f",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:"0.0.44-1-gbf4b0f3",[me.PYTHON_SDK]:"0.3.4-rc0-9-ge815162f",[me.GO_FIBER]:Hn,[me.GO_MODEL]:Hn,[me.GO_SDK]:Hn,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:fg(e.services,r=>Ep3(r,t)),types:fg(e.types,r=>Bp3(r,t))})};function Ep3(e,t){return{...e,endpoints:e.endpoints.map(r=>Sp3(r,t))}}function Sp3(e,t){return{...e,examples:e.examples.map(r=>Dp3(r,t))}}function Dp3(e,t){return{docs:e.docs,name:e.name,url:e.url,rootPathParameters:e.rootPathParameters.map(r=>uNd(r,t)),servicePathParameters:e.servicePathParameters.map(r=>uNd(r,t)),endpointPathParameters:e.endpointPathParameters.map(r=>uNd(r,t)),serviceHeaders:e.serviceHeaders.map(r=>eqP(r,t)),endpointHeaders:e.endpointHeaders.map(r=>eqP(r,t)),queryParameters:e.queryParameters.map(r=>Cp3(r,t)),request:e.request!=null?Ip3(e.request,t):void 0,response:Mp3(e.response,t)}}function uNd(e,t){return{key:e.key,value:W2e(e.value,t)}}function eqP(e,t){return{wireKey:e.wireKey,value:W2e(e.value,t)}}function Cp3(e,t){return{wireKey:e.wireKey,value:W2e(e.value,t)}}function Ip3(e,t){return ft.V19.http.ExampleRequestBody._visit(e,{inlinedRequestBody:r=>ft.V18.http.ExampleRequestBody.inlinedRequestBody({jsonExample:r.jsonExample,properties:r.properties.map(n=>({wireKey:n.wireKey,value:W2e(n.value,t),originalTypeDeclaration:n.originalTypeDeclaration}))}),reference:r=>ft.V18.http.ExampleRequestBody.reference(W2e(r,t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function Mp3(e,t){return ft.V19.http.ExampleResponse._visit(e,{ok:r=>ft.V18.http.ExampleResponse.ok({body:r.body!=null?W2e(r.body,t):void 0}),error:r=>ft.V18.http.ExampleResponse.error({error:r.error,body:r.body!=null?W2e(r.body,t):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}function Bp3(e,t){return{...e,examples:e.examples.map(r=>Tp3(r,t))}}function Tp3(e,t){return{...e,shape:cNd(e.shape,t)}}function cNd(e,t){return ft.V19.types.ExampleTypeShape._visit(e,{alias:r=>ft.V18.types.ExampleTypeShape.alias({value:W2e(r.value,t)}),object:r=>ft.V18.types.ExampleTypeShape.object({properties:r.properties.map(n=>({wireKey:n.wireKey,value:W2e(n.value,t),originalTypeDeclaration:n.originalTypeDeclaration}))}),union:r=>ft.V18.types.ExampleTypeShape.union({wireDiscriminantValue:r.wireDiscriminantValue,properties:ft.V19.types.ExampleSingleUnionTypeProperties._visit(r.properties,{singleProperty:n=>ft.V18.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:n.jsonExample,shape:rqP(n.shape,t)}),samePropertiesAsObject:n=>ft.V18.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:n.typeName,shape:cNd(n.shape,t)}),noProperties:ft.V18.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+r.properties.type)}})}),enum:ft.V18.types.ExampleTypeShape.enum,_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function W2e(e,t){return{jsonExample:e.jsonExample,shape:rqP(e.shape,t)}}function rqP(e,t){return ft.V19.types.ExampleTypeReferenceShape._visit(e,{primitive:r=>ft.V18.types.ExampleTypeReferenceShape.primitive(qp3(r,t)),named:r=>ft.V18.types.ExampleTypeReferenceShape.named({typeName:r.typeName,shape:cNd(r.shape,t)}),container:r=>ft.V18.types.ExampleTypeReferenceShape.container(ft.V19.types.ExampleContainer._visit(r,{list:n=>ft.V18.types.ExampleContainer.list(n.map(i=>W2e(i,t))),set:n=>ft.V18.types.ExampleContainer.set(n.map(i=>W2e(i,t))),optional:n=>ft.V18.types.ExampleContainer.optional(n!=null?W2e(n,t):void 0),map:n=>ft.V18.types.ExampleContainer.map(n.map(i=>({key:W2e(i.key,t),value:W2e(i.value,t)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+r.type)}})),unknown:ft.V18.types.ExampleTypeReferenceShape.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function qp3(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 nqP={laterVersion:"v20",earlierVersion:"v19",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.5.26-rc0-3-gdfabd674",[me.TYPESCRIPT_BROWSER_SDK]:"0.5.26-rc0-3-gdfabd674",[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.5.26-rc0-3-gdfabd674",[me.TYPESCRIPT_EXPRESS]:"0.5.20-3-g2505487f",[me.JAVA]:Ut,[me.JAVA_MODEL]:"0.3.10-rc2-1-g1c0d853",[me.JAVA_SDK]:"0.3.10-rc2-1-g1c0d853",[me.JAVA_SPRING]:"0.3.10-rc2-1-g1c0d853",[me.PYTHON_FASTAPI]:"0.3.6-rc1-2-g6050f7f8",[me.PYTHON_PYDANTIC]:"0.3.6-rc1-2-g6050f7f8",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"0.3.6-rc1-2-g6050f7f8",[me.GO_FIBER]:Hn,[me.GO_MODEL]:"0.0.0",[me.GO_SDK]:"0.0.0",[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:fg(e.services,r=>Rp3(r,t))})};function Rp3(e,t){return{...e,endpoints:e.endpoints.map(r=>Np3(r,t))}}function Np3(e,t){return{...e,response:e.response!=null?iqP(e.response,t):void 0,sdkResponse:e.sdkResponse!=null?xp3(e.sdkResponse,t):void 0}}function iqP(e,t){return ft.V20.http.HttpResponse._visit(e,{fileDownload:()=>aqP(t),json:r=>r,_unknown:()=>{throw new Error("Unknown HttpResponse: "+e.type)}})}function xp3(e,t){return ft.V20.http.SdkResponse._visit(e,{fileDownload:()=>aqP(t),streaming:ft.V19.http.SdkResponse.streaming,maybeStreaming:r=>ft.V19.http.SdkResponse.maybeStreaming({condition:r.condition,streaming:r.streaming,nonStreaming:iqP(r.nonStreaming,t)}),json:ft.V19.http.SdkResponse.nonStreaming,_unknown:()=>{throw new Error("Unknown SdkResponse: "+e.type)}})}function aqP({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 oqP={laterVersion:"v21",earlierVersion:"v20",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Hn,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:fg(e.services,r=>Fp3(r,t))})};function Fp3(e,t){return{...e,endpoints:e.endpoints.map(r=>zp3(r,t))}}function zp3(e,t){return{...e,streamingResponse:e.streamingResponse!=null?lNd(e.streamingResponse,t):void 0,sdkResponse:e.sdkResponse!=null?Qp3(e.sdkResponse,t):void 0}}function lNd(e,{taskContext:t,targetGenerator:r}){return{dataEventType:ft.V21.http.StreamingResponseChunkType._visit(e.dataEventType,{json:n=>n,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 Qp3(e,t){return ft.V21.http.SdkResponse._visit(e,{fileDownload:ft.V20.http.SdkResponse.fileDownload,streaming:r=>ft.V20.http.SdkResponse.streaming(lNd(r,t)),maybeStreaming:r=>ft.V20.http.SdkResponse.maybeStreaming({condition:r.condition,streaming:lNd(r.streaming,t),nonStreaming:r.nonStreaming}),json:ft.V20.http.SdkResponse.json,_unknown:()=>{throw new Error("Unknown SdkResponse: "+e.type)}})}var sqP={laterVersion:"v22",earlierVersion:"v21",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:"0.5.0-3-gac7ce7c",[me.GO_MODEL]:"0.0.14-8-g2fa39f7",[me.GO_SDK]:"0.0.14-8-g2fa39f7",[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,services:fg(e.services,t=>Lp3(t))})};function Lp3(e){return{...e,endpoints:e.endpoints.map(t=>Up3(t))}}function Up3(e){return{...e,...e.response!=null?ft.V22.http.HttpResponse._visit(e.response,{json:t=>({response:ft.V21.http.HttpResponse.json(t),streamingResponse:void 0,sdkResponse:ft.V21.http.SdkResponse.json(t)}),fileDownload:t=>({response:ft.V21.http.HttpResponse.fileDownload(t),streamingResponse:void 0,sdkResponse:ft.V21.http.SdkResponse.fileDownload(t)}),streaming:t=>({response:void 0,streamingResponse:t,sdkResponse:ft.V21.http.SdkResponse.streaming(t)}),_unknown:()=>{throw new Error("Unknown HttpResponse: "+e.response?.type)}}):{response:void 0,streamingResponse:void 0,sdkResponse:void 0}}}var lqP={laterVersion:"v23",earlierVersion:"v22",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.7.4-rc3-4-g6cf92f81",[me.TYPESCRIPT_BROWSER_SDK]:"0.7.4-rc3-4-g6cf92f81",[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.7.4-rc3-4-g6cf92f81",[me.TYPESCRIPT_EXPRESS]:"0.7.4-rc3-4-g6cf92f81",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:"0.0.28-3-g112d3dd",[me.STOPLIGHT]:"0.0.28-3-g112d3dd",[me.POSTMAN]:"0.0.44-4-gddab2ae",[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>{let r=[],n={};for(let[i,a]of Object.entries(e.services)){let o=[];for(let c of a.endpoints){let f=Vp3(c);f==null?r.push(c):o.push(f)}n[i]={...a,endpoints:o,headers:a.headers.map(c=>dNd(c)),pathParameters:a.pathParameters.map(c=>SJu(c))}}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(i=>i.name.originalName).join(", ")} will be skipped.`)),{...e,auth:{...e.auth,schemes:e.auth.schemes.map(i=>Hp3(i))},headers:e.headers.map(i=>dNd(i)),types:fg(e.types,i=>Gp3(i)),services:n,errors:fg(e.errors,i=>Zp3(i)),subpackages:e.subpackages,pathParameters:e.pathParameters.map(i=>SJu(i)),variables:e.variables.map(i=>kp3(i))}}};function Vp3(e){let t;if(!(e.requestBody!=null&&(t=Wp3(e.requestBody),t==null)))return{...e,headers:e.headers.map(r=>dNd(r)),pathParameters:e.pathParameters.map(r=>SJu(r)),allPathParameters:e.allPathParameters.map(r=>SJu(r)),queryParameters:e.queryParameters.map(r=>e_3(r)),requestBody:t,sdkRequest:e.sdkRequest!=null?{requestParameterName:e.sdkRequest.requestParameterName,shape:t_3(e.sdkRequest.shape)}:void 0,response:e.response!=null?r_3(e.response):void 0,examples:e.examples.map(r=>n_3(r))}}function Wp3(e){switch(e.type){case"bytes":return;case"fileUpload":return ft.V22.http.HttpRequestBody.fileUpload({...e,properties:e.properties.map(t=>a_3(t))});case"inlinedRequestBody":return ft.V22.http.HttpRequestBody.inlinedRequestBody({...e,properties:e.properties.map(t=>o_3(t))});case"reference":return ft.V22.http.HttpRequestBody.reference({...e,requestBodyType:Bee(e.requestBodyType)});default:fc(e)}}function dNd(e){return{...e,valueType:Bee(e.valueType)}}function Hp3(e){return e._visit({bearer:ft.V22.auth.AuthScheme.bearer,basic:ft.V22.auth.AuthScheme.basic,header:t=>ft.V22.auth.AuthScheme.header({...t,valueType:Bee(t.valueType)}),_other:()=>{throw new Error("Unknown auth scheme: "+e.type)}})}function Gp3(e){return{...e,shape:Jp3(e.shape),examples:e.examples.map(t=>Kp3(t))}}function Jp3(e){return e._visit({alias:t=>ft.V22.types.Type.alias({...t,aliasOf:Bee(t.aliasOf),resolvedType:Yp3(t.resolvedType)}),enum:ft.V22.types.Type.enum,object:t=>ft.V22.types.Type.object({...t,properties:t.properties.map(r=>uqP(r))}),union:t=>ft.V22.types.Type.union({...t,baseProperties:t.baseProperties.map(r=>uqP(r)),types:t.types.map(r=>({...r,shape:Xp3(r.shape)}))}),undiscriminatedUnion:t=>ft.V22.types.Type.undiscriminatedUnion({...t,members:t.members.map(r=>({...r,type:Bee(r.type)}))}),_other:()=>{throw new Error("Unknown type shape: "+e.type)}})}function Kp3(e){return{...e,shape:pNd(e.shape)}}function pNd(e){return e._visit({alias:t=>ft.V22.types.ExampleTypeShape.alias({...t,value:Zit(t.value)}),enum:ft.V22.types.ExampleTypeShape.enum,object:t=>ft.V22.types.ExampleTypeShape.object({...t,properties:t.properties.map(r=>({...r,value:Zit(r.value)}))}),union:t=>ft.V22.types.ExampleTypeShape.union({...t,properties:$p3(t.properties)}),_other:()=>{throw new Error("Unknown example type shape: "+e.type)}})}function Zit(e){return{...e,shape:_Nd(e.shape)}}function _Nd(e){return e._visit({primitive:t=>ft.V22.types.ExampleTypeReferenceShape.primitive(t._visit({integer:ft.V22.types.ExamplePrimitive.integer,double:ft.V22.types.ExamplePrimitive.double,string:ft.V22.types.ExamplePrimitive.string,boolean:ft.V22.types.ExamplePrimitive.boolean,long:ft.V22.types.ExamplePrimitive.long,datetime:r=>ft.V22.types.ExamplePrimitive.datetime(r.toISOString()),date:ft.V22.types.ExamplePrimitive.date,uuid:ft.V22.types.ExamplePrimitive.uuid,_other:()=>{throw new Error("Unknown example primitive: "+t.type)}})),named:t=>ft.V22.types.ExampleTypeReferenceShape.named({...t,shape:pNd(t.shape)}),container:t=>ft.V22.types.ExampleTypeReferenceShape.container(t._visit({list:r=>ft.V22.types.ExampleContainer.list(r.map(n=>Zit(n))),set:r=>ft.V22.types.ExampleContainer.set(r.map(n=>Zit(n))),optional:r=>ft.V22.types.ExampleContainer.optional(r!=null?Zit(r):void 0),map:r=>ft.V22.types.ExampleContainer.map(r.map(n=>({key:Zit(n.key),value:Zit(n.value)}))),_other:()=>{throw new Error("Unknown example container: "+t.type)}})),unknown:ft.V22.types.ExampleTypeReferenceShape.unknown,_other:()=>{throw new Error("Unknown example type reference shape: "+e.type)}})}function $p3(e){return e._visit({singleProperty:t=>ft.V22.types.ExampleSingleUnionTypeProperties.singleProperty({...t,shape:_Nd(t.shape)}),noProperties:ft.V22.types.ExampleSingleUnionTypeProperties.noProperties,samePropertiesAsObject:t=>ft.V22.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...t,shape:pNd(t.shape)}),_other:()=>{throw new Error("Unknown example single union type properties: "+e.type)}})}function Bee(e){return e._visit({container:t=>ft.V22.types.TypeReference.container(fqP(t)),primitive:ft.V22.types.TypeReference.primitive,named:ft.V22.types.TypeReference.named,unknown:ft.V22.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function fqP(e){return e._visit({list:t=>ft.V22.types.ContainerType.list(Bee(t)),set:t=>ft.V22.types.ContainerType.set(Bee(t)),optional:t=>ft.V22.types.ContainerType.optional(Bee(t)),map:t=>ft.V22.types.ContainerType.map({keyType:Bee(t.keyType),valueType:Bee(t.valueType)}),literal:ft.V22.types.ContainerType.literal,_other:()=>{throw new Error("Unknown container type: "+e.type)}})}function Yp3(e){return e._visit({container:t=>ft.V22.types.ResolvedTypeReference.container(fqP(t)),primitive:ft.V22.types.ResolvedTypeReference.primitive,named:ft.V22.types.ResolvedTypeReference.named,unknown:ft.V22.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown resolved type reference: "+e.type)}})}function uqP(e){return{...e,valueType:Bee(e.valueType)}}function Xp3(e){return e._visit({noProperties:ft.V22.types.SingleUnionTypeProperties.noProperties,singleProperty:t=>ft.V22.types.SingleUnionTypeProperties.singleProperty({...t,type:Bee(t.type)}),samePropertiesAsObject:ft.V22.types.SingleUnionTypeProperties.samePropertiesAsObject,_other:()=>{throw new Error("Unknown single union type properties: "+e.propertiesType)}})}function Zp3(e){return{...e,type:e.type!=null?Bee(e.type):void 0}}function kp3(e){return{...e,type:Bee(e.type)}}function SJu(e){return{...e,valueType:Bee(e.valueType)}}function e_3(e){return{...e,valueType:Bee(e.valueType)}}function t_3(e){return e._visit({justRequestBody:t=>ft.V22.http.SdkRequestShape.justRequestBody({...t,requestBodyType:Bee(t.requestBodyType)}),wrapper:ft.V22.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SDK request shape: "+e.type)}})}function r_3(e){return e._visit({json:t=>ft.V22.http.HttpResponse.json({...t,responseBodyType:Bee(t.responseBodyType)}),fileDownload:ft.V22.http.HttpResponse.fileDownload,streaming:t=>ft.V22.http.HttpResponse.streaming({...t,dataEventType:t.dataEventType._visit({json:r=>ft.V22.http.StreamingResponseChunkType.json(Bee(r)),text:ft.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 n_3(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>fNd(t)),servicePathParameters:e.servicePathParameters.map(t=>fNd(t)),endpointPathParameters:e.endpointPathParameters.map(t=>fNd(t)),serviceHeaders:e.serviceHeaders.map(t=>cqP(t)),endpointHeaders:e.endpointHeaders.map(t=>cqP(t)),queryParameters:e.queryParameters.map(t=>i_3(t)),request:e.request!=null?e.request._visit({inlinedRequestBody:t=>ft.V22.http.ExampleRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,value:Zit(r.value)}))}),reference:t=>ft.V22.http.ExampleRequestBody.reference({...t,shape:_Nd(t.shape)}),_other:()=>{throw new Error("Unknown example request body: "+e.request?.type)}}):void 0,response:e.response._visit({ok:t=>ft.V22.http.ExampleResponse.ok({...t,body:t.body!=null?Zit(t.body):void 0}),error:t=>ft.V22.http.ExampleResponse.error({...t,body:t.body!=null?Zit(t.body):void 0}),_other:()=>{throw new Error("Unknown example response: "+e.response.type)}})}}function fNd(e){return{...e,value:Zit(e.value)}}function i_3(e){return{...e,value:Zit(e.value)}}function cqP(e){return{...e,value:Zit(e.value)}}function a_3(e){return e._visit({file:ft.V22.http.FileUploadRequestProperty.file,bodyProperty:t=>ft.V22.http.FileUploadRequestProperty.bodyProperty({...t,valueType:Bee(t.valueType)}),_other:()=>{throw new Error("Unknown file upload request body property: "+e.type)}})}function o_3(e){return{...e,valueType:Bee(e.valueType)}}var Bm={};mf(Bm,{V23:()=>Lg5,V24:()=>Ug5,V25:()=>Vg5,V26:()=>Wg5,V27:()=>Hg5,V28:()=>Gg5,V29:()=>Jg5,V30:()=>Kg5,V31:()=>$g5,V32:()=>Yg5,V33:()=>Xg5,V34:()=>Zg5,V35:()=>kg5,V36:()=>e05,V37:()=>t05,V38:()=>r05,V39:()=>n05,V40:()=>i05,V41:()=>a05,V42:()=>o05,V43:()=>s05,V44:()=>u05,V45:()=>c05,V46:()=>l05,V47:()=>f05,V48:()=>d05,V49:()=>p05,V50:()=>_05,V51:()=>h05,V52:()=>y05,V53:()=>v05,V54:()=>b05,V55:()=>g05,V56:()=>m05,V57:()=>O05,V58:()=>A05,V59:()=>P05,V60:()=>k0});var Lg5=aa(Qc(),1),Ug5=aa(pc(),1),Vg5=aa(rc(),1),Wg5=aa(Hu(),1),Hg5=aa(Ru(),1),Gg5=aa(Nu(),1),Jg5=aa(xu(),1),Kg5=aa(Eu(),1),$g5=aa(Pu(),1),Yg5=aa(su(),1),Xg5=aa(bs(),1),Zg5=aa(ds(),1),kg5=aa(Zo(),1),e05=aa(ko(),1),t05=aa(Yo(),1),r05=aa(Go(),1),n05=aa(Oo(),1),i05=aa(Ao(),1),a05=aa(vo(),1),o05=aa(fo(),1),s05=aa(lo(),1),u05=aa(uo(),1),c05=aa(ro(),1),l05=aa($a(),1),f05=aa(Ja(),1),d05=aa(Wa(),1),p05=aa(Fa(),1),_05=aa(Ra(),1),h05=aa(Da(),1),y05=aa(Pa(),1),v05=aa(Tn(),1),b05=aa(Sw(),1),g05=aa(sw(),1),m05=aa(uw(),1),O05=aa(NP(),1),A05=aa(xP(),1),P05=aa(FP(),1);var Ek1={laterVersion:"v24",earlierVersion:"v23",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V23.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e})};var Sk1={laterVersion:"v25",earlierVersion:"v24",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:"0.4.9-1-ge0997b3",[me.JAVA_SDK]:"0.4.9-1-ge0997b3",[me.JAVA_SPRING]:"0.4.9-1-ge0997b3",[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V24.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:(e,t)=>{let r=[],n=[],i={};for(let[a,o]of Object.entries(e.services)){let c=[];for(let f of o.endpoints){let u;if(f.sdkRequest!=null&&(u=w05(f.sdkRequest),u==null)){r.push(f);continue}if(f.response!=null){let s=f.response._visit({fileDownload:l=>ft.V24.HttpResponse.fileDownload(l),json:l=>ft.V24.HttpResponse.json(l),streaming:l=>ft.V24.HttpResponse.streaming(l),text:()=>(n.push(f),ft.V24.HttpResponse.json({docs:void 0,responseBodyType:ft.V24.TypeReference.unknown()})),_other:()=>{throw new Error("Encountered unknown response type")}});c.push({...f,sdkRequest:u,response:s})}else c.push({...f,sdkRequest:u,response:void 0})}i[a]={...o,endpoints:c}}return n.length>0&&(t.taskContext.logger.warn(`Generator ${t.targetGenerator?.name}@${t.targetGenerator?.version} does not support text/plain responses. `),n.length===1&&n[0]!=null?t.taskContext.logger.warn(`Therefore, endpoint ${n[0].name.originalName} response type will be casted to unknown.`):t.taskContext.logger.warn(`Therefore, endpoints ${n.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:i}}};function w05(e){let t=e.shape;if(t.type==="wrapper")return{shape:ft.V24.SdkRequestShape.wrapper({...t}),requestParameterName:e.requestParameterName};if(t.value.type==="typeReference")return{shape:ft.V24.SdkRequestShape.justRequestBody({...t.value}),requestParameterName:e.requestParameterName}}var Ck1={laterVersion:"v26",earlierVersion:"v25",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:"0.5.0-rc2-16-g4177fafd",[me.PYTHON_PYDANTIC]:"0.5.0-rc2-16-g4177fafd",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"0.5.0-rc2-16-g4177fafd",[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V25.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,C05(r)])),headers:e.headers.map(t=>Ftl(t)),webhookGroups:Object.fromEntries(Object.entries(e.webhookGroups).map(([t,r])=>[t,r.map(n=>j05(n))])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,E05(r)]))})};function j05(e){return{...e,headers:e.headers.map(t=>Ftl(t)),availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function E05(e){return{...e,endpoints:e.endpoints.map(t=>S05(t)),headers:e.headers.map(t=>Ftl(t)),availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function S05(e){return{...e,headers:e.headers.map(t=>Ftl(t)),queryParameters:e.queryParameters.map(t=>D05(t)),availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function Ftl(e){return{...e,availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function D05(e){return{...e,availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function C05(e){return{...e,shape:e.shape._visit({union:t=>ft.V25.Type.union({...t,baseProperties:t.baseProperties.map(r=>Dk1(r))}),object:t=>ft.V25.Type.object({...t,properties:t.properties.map(r=>Dk1(r))}),enum:t=>ft.V25.Type.enum({...t,values:t.values.map(r=>I05(r))}),alias:t=>ft.V25.Type.alias(t),undiscriminatedUnion:t=>ft.V25.Type.undiscriminatedUnion(t),_other:()=>{throw new Error("Encountered unknown shape")}}),availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function Dk1(e){return{...e,availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function I05(e){return{...e,availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}var Ik1={laterVersion:"v27",earlierVersion:"v26",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:"0.6.1-3-g94ee67a",[me.GO_MODEL]:"0.6.1-3-g94ee67a",[me.GO_SDK]:"0.6.1-3-g94ee67a",[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V26.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,M05(r)]))})};function M05(e){return{...e,endpoints:e.endpoints.map(t=>B05(t))}}function B05(e){return{...e,response:e.response!=null?T05(e.response):void 0}}function T05(e){if(e.type!=="json")return e;let t=e.value;return t.type==="response"?ft.V26.HttpResponse.json(t):ft.V26.HttpResponse.json({docs:t.docs,responseBodyType:t.responseBodyType})}var Mk1={laterVersion:"v28",earlierVersion:"v27",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.8.1-1-g0f40bf18",[me.TYPESCRIPT_BROWSER_SDK]:"0.8.1-1-g0f40bf18",[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.8.1-1-g0f40bf18",[me.TYPESCRIPT_EXPRESS]:"0.8.1-1-g0f40bf18",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:"0.9.0-2-g6b0be0e",[me.GO_MODEL]:"0.9.0-2-g6b0be0e",[me.GO_SDK]:"0.9.0-2-g6b0be0e",[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V27.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,auth:um5(e.auth),headers:Qtl(e.headers),types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,pm5(r)])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,V05(r)])),webhookGroups:Object.fromEntries(Object.entries(e.webhookGroups).map(([t,r])=>[t,x05(r)])),errors:Object.fromEntries(Object.entries(e.errors).map(([t,r])=>[t,N05(r)])),pathParameters:ztl(e.pathParameters),variables:q05(e.variables)})};function q05(e){return e.map(t=>R05(t))}function R05(e){return{...e,type:qX(e.type)}}function N05(e){return{...e,type:e.type!=null?qX(e.type):void 0}}function x05(e){return e.map(t=>F05(t))}function F05(e){return{...e,headers:Qtl(e.headers),payload:z05(e.payload)}}function z05(e){switch(e.type){case"inlinedPayload":return ft.V27.WebhookPayload.inlinedPayload(Q05(e));case"reference":return ft.V27.WebhookPayload.reference({...e,payloadType:qX(e.payloadType)})}}function Q05(e){return{...e,properties:L05(e.properties)}}function L05(e){return e.map(t=>U05(t))}function U05(e){return{...e,valueType:qX(e.valueType)}}function V05(e){return{...e,endpoints:W05(e.endpoints),headers:Qtl(e.headers),pathParameters:ztl(e.pathParameters)}}function W05(e){return e.map(t=>H05(t))}function H05(e){return{...e,headers:Qtl(e.headers),pathParameters:ztl(e.pathParameters),allPathParameters:ztl(e.allPathParameters),queryParameters:om5(e.queryParameters),requestBody:e.requestBody!=null?k05(e.requestBody):void 0,sdkRequest:e.sdkRequest!=null?Y05(e.sdkRequest):void 0,response:e.response!=null?G05(e.response):void 0}}function G05(e){switch(e.type){case"json":return ft.V27.HttpResponse.json($05(e.value));case"fileDownload":return ft.V27.HttpResponse.fileDownload(e);case"text":return ft.V27.HttpResponse.text(e);case"streaming":return ft.V27.HttpResponse.streaming(J05(e));default:fc(e)}}function J05(e){return{...e,dataEventType:K05(e.dataEventType)}}function K05(e){switch(e.type){case"json":return ft.V27.StreamingResponseChunkType.json(qX(e.json));case"text":return ft.V27.StreamingResponseChunkType.text();default:fc(e)}}function $05(e){switch(e.type){case"response":return ft.V27.JsonResponse.response({...e,responseBodyType:qX(e.responseBodyType)});case"nestedPropertyAsResponse":return ft.V27.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:qX(e.responseBodyType),responseProperty:e.responseProperty!=null?Rk1(e.responseProperty):void 0});default:fc(e)}}function Y05(e){return{...e,shape:X05(e.shape)}}function X05(e){switch(e.type){case"justRequestBody":return ft.V27.SdkRequestShape.justRequestBody(Z05(e.value));case"wrapper":return ft.V27.SdkRequestShape.wrapper(e);default:fc(e)}}function Z05(e){switch(e.type){case"typeReference":return ft.V27.SdkRequestBodyType.typeReference(Bk1(e));case"bytes":return ft.V27.SdkRequestBodyType.bytes(e);default:fc(e)}}function k05(e){switch(e.type){case"inlinedRequestBody":return ft.V27.HttpRequestBody.inlinedRequestBody(nm5(e));case"reference":return ft.V27.HttpRequestBody.reference(Bk1(e));case"fileUpload":return ft.V27.HttpRequestBody.fileUpload(em5(e));case"bytes":return ft.V27.HttpRequestBody.bytes(e);default:fc(e)}}function em5(e){return{...e,properties:tm5(e.properties)}}function tm5(e){return e.map(t=>rm5(t))}function rm5(e){switch(e.type){case"file":return ft.V27.FileUploadRequestProperty.file(e);case"bodyProperty":return ft.V27.FileUploadRequestProperty.bodyProperty(Tk1(e));default:fc(e)}}function Bk1(e){return{...e,requestBodyType:qX(e.requestBodyType)}}function nm5(e){return{...e,properties:im5(e.properties)}}function im5(e){return e.map(t=>Tk1(t))}function Tk1(e){return{...e,valueType:qX(e.valueType)}}function ztl(e){return e.map(t=>am5(t))}function am5(e){return{...e,valueType:qX(e.valueType)}}function om5(e){return e.map(t=>sm5(t))}function sm5(e){return{...e,valueType:qX(e.valueType)}}function um5(e){return{...e,schemes:cm5(e.schemes)}}function cm5(e){return e.map(t=>lm5(t))}function lm5(e){switch(e.type){case"basic":return ft.V27.AuthScheme.basic(e);case"bearer":return ft.V27.AuthScheme.bearer(e);case"header":return fm5(e);default:fc(e)}}function fm5(e){return ft.V27.AuthScheme.header({...e,valueType:qX(e.valueType)})}function Qtl(e){return e.map(t=>dm5(t))}function dm5(e){return{...e,valueType:qX(e.valueType)}}function pm5(e){return{...e,shape:_m5(e.shape)}}function _m5(e){switch(e.type){case"alias":return ft.V27.Type.alias(hm5(e));case"enum":return ft.V27.Type.enum(e);case"object":return ft.V27.Type.object(ym5(e));case"union":return ft.V27.Type.union(vm5(e));case"undiscriminatedUnion":return ft.V27.Type.undiscriminatedUnion(bm5(e));default:fc(e)}}function hm5(e){return{aliasOf:qX(e.aliasOf),resolvedType:Am5(e.resolvedType)}}function ym5(e){return{...e,properties:qk1(e.properties)}}function vm5(e){return{...e,types:gm5(e.types),baseProperties:qk1(e.baseProperties)}}function bm5(e){return{members:Om5(e.members)}}function qk1(e){return e.map(t=>Rk1(t))}function Rk1(e){return{...e,valueType:qX(e.valueType)}}function gm5(e){return e.map(t=>({...t,shape:mm5(t.shape)}))}function mm5(e){switch(e.propertiesType){case"samePropertiesAsObject":return ft.V27.SingleUnionTypeProperties.samePropertiesAsObject(e);case"singleProperty":return ft.V27.SingleUnionTypeProperties.singleProperty({name:e.name,type:qX(e.type)});case"noProperties":return ft.V27.SingleUnionTypeProperties.noProperties();default:fc(e)}}function Om5(e){return e.map(t=>({...t,type:qX(t.type)}))}function Am5(e){switch(e.type){case"container":return e.container.type==="literal"?e.container.literal.type==="boolean"?ft.V27.ResolvedTypeReference.primitive(ft.V27.PrimitiveType.Boolean):ft.V27.ResolvedTypeReference.container(ft.V27.ContainerType.literal(ft.V27.Literal.string(e.container.literal.string))):ft.V27.ResolvedTypeReference.container(Nk1(e.container));case"named":return ft.V27.ResolvedTypeReference.named(e);case"primitive":return ft.V27.ResolvedTypeReference.primitive(e.primitive);case"unknown":return ft.V27.ResolvedTypeReference.unknown();default:fc(e)}}function qX(e){switch(e.type){case"container":return e.container.type==="literal"?e.container.literal.type==="boolean"?ft.V27.TypeReference.primitive(ft.V27.PrimitiveType.Boolean):ft.V27.TypeReference.container(ft.V27.ContainerType.literal(ft.V27.Literal.string(e.container.literal.string))):ft.V27.TypeReference.container(Nk1(e.container));case"named":return ft.V27.TypeReference.named(e);case"primitive":return ft.V27.TypeReference.primitive(e.primitive);case"unknown":return ft.V27.TypeReference.unknown();default:fc(e)}}function Nk1(e){switch(e.type){case"list":return ft.V27.ContainerType.list(qX(e.list));case"map":return ft.V27.ContainerType.map({keyType:qX(e.keyType),valueType:qX(e.valueType)});case"optional":return ft.V27.ContainerType.optional(qX(e.optional));case"set":return ft.V27.ContainerType.set(qX(e.set));case"literal":if(e.literal.type==="boolean")throw new Error("Internal error; failed to transform boolean literal between IR versions");return ft.V27.ContainerType.literal(ft.V27.Literal.string(e.literal.string));default:fc(e)}}var Fk1={laterVersion:"v29",earlierVersion:"v28",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.8.6-1-g3d8d8591",[me.TYPESCRIPT_BROWSER_SDK]:"0.8.6-1-g3d8d8591",[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.8.6-1-g3d8d8591",[me.TYPESCRIPT_EXPRESS]:"0.8.6-1-g3d8d8591",[me.JAVA]:Ut,[me.JAVA_MODEL]:"0.5.14-1-ge4bcd98",[me.JAVA_SDK]:"0.5.14-1-ge4bcd98",[me.JAVA_SPRING]:"0.5.14-1-ge4bcd98",[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V28.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.keys(e.types).map(t=>[t,Pm5({typeId:t,allTypes:e.types})]))})};function Pm5({typeId:e,allTypes:t}){let r=xk1({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(n=>{let i=xk1({typeId:n,allTypes:t});return{typeId:n,fernFilepath:i.name.fernFilepath,name:i.name.name}})}}function xk1({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 zk1={laterVersion:"v30",earlierVersion:"v29",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:"0.6.5-1-g0ef31b7a",[me.PYTHON_PYDANTIC]:"0.6.5-1-g0ef31b7a",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"0.6.5-1-g0ef31b7a",[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V29.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=new _m_(e);return{...e,types:t.convertTypes(e.types),services:t.convertServices(e.services)}}},_m_=class{ir;constructor(t){this.ir=t}convertTypes(t){return Object.fromEntries(Object.entries(t).map(([r,n])=>[r,this.convertType(n)]))}convertServices(t){return Object.fromEntries(Object.entries(t).map(([r,n])=>[r,this.convertService(n)]))}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 ft.V29.ExampleRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,wireKey:r.name.wireValue,value:this.convertExampleTypeReference(r.value)}))});case"reference":return ft.V29.ExampleRequestBody.reference(this.convertExampleTypeReference(t));default:fc(t)}}convertExampleResponse(t){switch(t.type){case"ok":return ft.V29.ExampleResponse.ok({body:t.body!=null?this.convertExampleTypeReference(t.body):void 0});case"error":return ft.V29.ExampleResponse.error({...t,body:t.body!=null?this.convertExampleTypeReference(t.body):void 0});default:fc(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 ft.V29.ExampleTypeReferenceShape.primitive(this.convertExamplePrimitive(t.primitive));case"container":return ft.V29.ExampleTypeReferenceShape.container(this.convertExampleContainer(t.container));case"named":return ft.V29.ExampleTypeReferenceShape.named(this.convertExampleNamedType(t));case"unknown":return ft.V29.ExampleTypeReferenceShape.unknown(t);default:fc(t)}}convertExamplePrimitive(t){switch(t.type){case"integer":return ft.V29.ExamplePrimitive.integer(t.integer);case"double":return ft.V29.ExamplePrimitive.double(t.double);case"string":return ft.V29.ExamplePrimitive.string(t.string.original);case"boolean":return ft.V29.ExamplePrimitive.boolean(t.boolean);case"long":return ft.V29.ExamplePrimitive.long(t.long);case"datetime":return ft.V29.ExamplePrimitive.datetime(t.datetime);case"date":return ft.V29.ExamplePrimitive.date(t.date);case"uuid":return ft.V29.ExamplePrimitive.uuid(t.uuid);default:fc(t)}}convertExampleContainer(t){switch(t.type){case"list":return ft.V29.ExampleContainer.list(this.convertExampleTypeReferences(t.list));case"set":return ft.V29.ExampleContainer.set(this.convertExampleTypeReferences(t.set));case"optional":return ft.V29.ExampleContainer.optional(t.optional!=null?this.convertExampleTypeReference(t.optional):void 0);case"map":return ft.V29.ExampleContainer.map(this.convertKeyValuePairs(t.map));default:fc(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 ft.V29.ExampleTypeShape.alias({value:this.convertExampleTypeReference(t.value)});case"enum":return ft.V29.ExampleTypeShape.enum({wireValue:t.value.wireValue});case"object":return ft.V29.ExampleTypeShape.object(this.convertExampleObjectType(t));case"union":return ft.V29.ExampleTypeShape.union(this.convertExampleUnionType(t));default:fc(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 ft.V29.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:r,shape:this.convertExampleTypeShape(ft.V30.ExampleTypeShape.object({properties:t.object.properties}))})}case"singleProperty":return ft.V29.ExampleSingleUnionTypeProperties.singleProperty({...t,shape:this.convertExampleTypeReferenceShape(t.shape)});case"noProperties":return ft.V29.ExampleSingleUnionTypeProperties.noProperties();default:fc(t)}}};var Qk1={laterVersion:"v31",earlierVersion:"v30",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.8.8",[me.TYPESCRIPT_BROWSER_SDK]:"0.8.8",[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.8.8",[me.TYPESCRIPT_EXPRESS]:"0.8.8",[me.JAVA]:Ut,[me.JAVA_MODEL]:"0.7.0-rc0",[me.JAVA_SDK]:"0.7.0-rc0",[me.JAVA_SPRING]:"0.7.0-rc0",[me.PYTHON_FASTAPI]:"0.7.5-1-gb54fb677",[me.PYTHON_PYDANTIC]:"0.7.5-1-gb54fb677",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"0.7.5-1-gb54fb677",[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Hn,[me.RUBY_SDK]:Hn,[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.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(n=>({id:n.id,docs:n.docs,availability:n.availability,name:n.name,displayName:n.displayName,method:n.method,headers:n.headers,baseUrl:n.baseUrl,path:n.path,fullPath:n.fullPath,pathParameters:n.pathParameters,allPathParameters:n.allPathParameters,queryParameters:n.queryParameters,requestBody:n.requestBody,sdkRequest:n.sdkRequest,response:n.response,errors:n.errors,auth:n.auth,examples:n.examples})),headers:r.headers,pathParameters:r.pathParameters}]))})};var Uk1={laterVersion:"v32",earlierVersion:"v31",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:"0.9.4-2-g139cf36",[me.GO_MODEL]:"0.9.4-2-g139cf36",[me.GO_SDK]:"0.9.4-2-g139cf36",[me.RUBY_MODEL]:"0.0.0",[me.RUBY_SDK]:"0.0.0",[me.CSHARP_MODEL]:Hn,[me.CSHARP_SDK]:Hn,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V31.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,{...r,examples:Cm5(r.examples)}])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(wm5)}]))})};function TMa({examples:e,convert:t}){let r=[];for(let n of e){let i=t(n);i!=null&&r.push(i)}return r}function wm5(e){return{...e,examples:TMa({examples:e.examples,convert:jm5})}}function jm5(e){let t;if(e.request!=null&&(t=Em5(e.request),t==null))return;let r=Sm5(e.response);if(r!=null)return{...e,rootPathParameters:TMa({examples:e.rootPathParameters,convert:hm_}),endpointPathParameters:TMa({examples:e.endpointPathParameters,convert:hm_}),servicePathParameters:TMa({examples:e.servicePathParameters,convert:hm_}),endpointHeaders:TMa({examples:e.endpointHeaders,convert:Lk1}),serviceHeaders:TMa({examples:e.serviceHeaders,convert:Lk1}),queryParameters:TMa({examples:e.queryParameters,convert:Dm5}),request:t,response:r}}function Em5(e){switch(e.type){case"inlinedRequestBody":{let t=[];for(let r of e.properties){let n=xXe(r.value);n!=null&&t.push({...r,value:n})}return ft.V31.ExampleRequestBody.inlinedRequestBody({...e,properties:t})}case"reference":{let t=ym_(e.shape);return t==null?void 0:ft.V31.ExampleRequestBody.reference({...e,shape:t})}default:fc(e)}}function Sm5(e){switch(e.type){case"ok":{if(e.body==null)return ft.V31.ExampleResponse.ok({body:void 0});let t=xXe(e.body);return t==null?void 0:ft.V31.ExampleResponse.ok({body:t})}case"error":{if(e.body==null)return ft.V31.ExampleResponse.error({...e,body:void 0});let t=xXe(e.body);return t==null?void 0:ft.V31.ExampleResponse.error({...e,body:t})}}}function hm_(e){let t=xXe(e.value);if(t!=null)return{...e,value:t}}function Lk1(e){let t=xXe(e.value);if(t!=null)return{...e,value:t}}function Dm5(e){let t=xXe(e.value);if(t!=null)return{...e,value:t}}function Cm5(e){let t=[];for(let r of e){let n=Im5(r);n!=null&&t.push(n)}return t}function Im5(e){let t=Vk1(e.shape);if(t!=null)return{...e,shape:t}}function Vk1(e){switch(e.type){case"enum":return ft.V31.ExampleTypeShape.enum(e);case"alias":{let t=xXe(e.value);return t==null?void 0:ft.V31.ExampleTypeShape.alias({value:t})}case"object":{let t=[];for(let r of e.properties){let n=xXe(r.value);n!=null&&t.push({...r,value:n})}return ft.V31.ExampleTypeShape.object({properties:t})}case"union":{let t=Mm5(e.singleUnionType);return t==null?void 0:ft.V31.ExampleTypeShape.union({...e,singleUnionType:t})}case"undiscriminatedUnion":return;default:fc(e)}}function xXe(e){let t=ym_(e.shape);if(t!=null)return{shape:t,jsonExample:e.jsonExample}}function Mm5(e){let t=Bm5(e.shape);if(t!=null)return{...e,shape:t}}function Bm5(e){switch(e.type){case"noProperties":return ft.V31.ExampleSingleUnionTypeProperties.noProperties();case"singleProperty":{let t=ym_(e.shape);return t==null?void 0:ft.V31.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:t})}case"samePropertiesAsObject":{let t=[];for(let r of e.object.properties){let n=xXe(r.value);n!=null&&t.push({...r,value:n})}return ft.V31.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:{properties:t}})}default:fc(e)}}function ym_(e){switch(e.type){case"container":{let t=Tm5(e.container);return t==null?void 0:ft.V31.ExampleTypeReferenceShape.container(t)}case"named":{let t=Vk1(e.shape);return t==null?void 0:ft.V31.ExampleTypeReferenceShape.named({...e,shape:t})}case"primitive":return ft.V31.ExampleTypeReferenceShape.primitive(e.primitive);case"unknown":return ft.V31.ExampleTypeReferenceShape.unknown(e.unknown);default:fc(e)}}function Tm5(e){switch(e.type){case"list":{let t=[];for(let r of e.list){let n=xXe(r);n!=null&&t.push(n)}return ft.V31.ExampleContainer.list(t)}case"set":{let t=[];for(let r of e.set){let n=xXe(r);n!=null&&t.push(n)}return ft.V31.ExampleContainer.set(t)}case"map":{let t=[];for(let r of e.map){let n=xXe(r.key),i=xXe(r.value);n!=null&&i!=null&&t.push({key:n,value:i})}return ft.V31.ExampleContainer.map(t)}case"optional":{if(e.optional==null)return ft.V31.ExampleContainer.optional();let t=xXe(e.optional);return t==null?ft.V31.ExampleContainer.optional():ft.V31.ExampleContainer.optional(t)}default:fc(e)}}var Wk1={laterVersion:"v33",earlierVersion:"v32",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.12.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.12.0",[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.12.0",[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:"0.13.0-3-g8c56a41",[me.GO_MODEL]:"0.13.0-3-g8c56a41",[me.GO_SDK]:"0.13.0-3-g8c56a41",[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:"0.0.0",[me.CSHARP_SDK]:"0.0.0",[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V32.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=new vm_(e);return{...e,services:Object.fromEntries(Object.entries(e.services).map(([r,n])=>[r,{...n,endpoints:n.endpoints.map(i=>t.convertEndpoint(i))}]))}}},vm_=class{ir;constructor(t){this.ir=t}convertEndpoint(t){return{...t,queryParameters:t.queryParameters.map(r=>this.isTypeReferenceObject(r.valueType)?{...r,valueType:ft.V33.TypeReference.container(ft.V33.ContainerType.optional(ft.V33.TypeReference.primitive("STRING")))}:r),examples:qm5({examples:t.examples,convert:Rm5})}}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:fc(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:fc(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:fc(r.shape)}}};function qm5({examples:e,convert:t}){let r=[];for(let n of e){let i=t(n);i!=null&&r.push(i)}return r}function Rm5(e){return{...e,queryParameters:e.queryParameters.filter(t=>!bm_(t.value))}}function bm_(e){switch(e.shape.type){case"container":return Nm5(e.shape.container);case"named":return xm5(e.shape);case"primitive":return!1;case"unknown":return!0;default:fc(e.shape)}}function Nm5(e){switch(e.type){case"map":case"list":case"set":return!0;case"optional":return e.optional!=null&&bm_(e.optional);default:fc(e)}}function xm5(e){switch(e.shape.type){case"alias":return bm_(e.shape.value);case"enum":return!1;case"object":case"union":case"undiscriminatedUnion":return!0;default:fc(e.shape)}}var IOo=aa(Snd(),1);var Hk1={laterVersion:"v34",earlierVersion:"v33",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"0.10.4",[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V33.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,n])=>[r,{...n,endpoints:n.endpoints.map(i=>({...i,requestBody:i.requestBody?._visit({inlinedRequestBody:a=>IOo.FernIrV33.HttpRequestBody.inlinedRequestBody(a),reference:a=>IOo.FernIrV33.HttpRequestBody.reference(a),fileUpload:a=>IOo.FernIrV33.HttpRequestBody.fileUpload({...a,properties:a.properties.map(o=>(o.type==="file"&&o.value.type==="fileArray"&&t.taskContext.logger.warn(`${i.method} ${i.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}!`),o.type==="file"?IOo.FernIrV33.FileUploadRequestProperty.file({...o.value}):o))}),bytes:a=>IOo.FernIrV33.HttpRequestBody.bytes(a),_other:a=>{}})}))}]))})};var Gk1={laterVersion:"v35",earlierVersion:"v34",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:"0.18.0",[me.GO_MODEL]:"0.18.0",[me.GO_SDK]:"0.18.0",[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.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(n=>({docs:n.docs,availability:n.availability,id:n.id,name:n.name,displayName:n.displayName,method:n.method,headers:n.headers,baseUrl:n.baseUrl,path:n.path,fullPath:n.fullPath,pathParameters:n.pathParameters,allPathParameters:n.allPathParameters,queryParameters:n.queryParameters,requestBody:n.requestBody,sdkRequest:n.sdkRequest,response:n.response,errors:n.errors,auth:n.auth,idempotent:n.idempotent,examples:n.examples}))}]))})};var Jk1={laterVersion:"v36",earlierVersion:"v35",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"0.11.6",[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V35.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e})};var Kk1={laterVersion:"v37",earlierVersion:"v36",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.13.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.13.0",[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.13.0",[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"0.12.0",[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V36.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,n])=>[r,{...n,endpoints:n.endpoints.map(i=>({...i,examples:i.examples.filter(a=>a.exampleType==="userProvided")}))}]))})};var $k1={laterVersion:"v38",earlierVersion:"v37",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.15.0-rc0",[me.TYPESCRIPT_BROWSER_SDK]:"0.15.0-rc0",[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.15.0-rc0",[me.TYPESCRIPT_EXPRESS]:"0.12.0-rc0",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:"0.9.0-rc0",[me.PYTHON_PYDANTIC]:"0.9.0-rc0",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"1.2.0-rc0",[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V37.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,n])=>[r,{...n,endpoints:n.endpoints.map(i=>({...i,response:i.response?._visit({fileDownload:a=>ft.V37.HttpResponse.fileDownload(a),json:a=>ft.V37.HttpResponse.json(a),streaming:a=>a._visit({json:o=>ft.V37.HttpResponse.streaming({dataEventType:ft.V37.StreamingResponseChunkType.json(o.payload),docs:o.docs,terminator:o.terminator}),sse:()=>{},text:o=>ft.V37.HttpResponse.streaming({dataEventType:ft.V37.StreamingResponseChunkType.text(),docs:o.docs,terminator:void 0}),_other:()=>{}}),text:a=>ft.V37.HttpResponse.text(a),_other:()=>{}})}))}]))})};var Yk1={laterVersion:"v39",earlierVersion:"v38",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:"0.9.0-rc1",[me.PYTHON_PYDANTIC]:"0.9.0-rc1",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"1.4.0-rc1",[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:"0.7.0-rc0",[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V38.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,auth:{...e.auth,schemes:e.auth.schemes.map(r=>Fm5(r))}})};function Fm5(e){switch(e.type){case"basic":return ft.V38.AuthScheme.basic(e);case"bearer":return ft.V38.AuthScheme.bearer(e);case"header":return ft.V38.AuthScheme.header(e);case"oauth":return ft.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:fc(e)}}var Xk1={laterVersion:"v40",earlierVersion:"v39",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:"0.20.0",[me.GO_MODEL]:"0.20.0",[me.GO_SDK]:"0.20.0",[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V39.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e})};var Zk1={laterVersion:"v41",earlierVersion:"v40",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V40.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,errors:Object.fromEntries(Object.entries(e.errors).map(([r,n])=>[r,{name:n.name,discriminantValue:n.discriminantValue,type:n.type,statusCode:n.statusCode,docs:n.docs}]))})};var kk1={laterVersion:"v42",earlierVersion:"v41",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:"0.8.0-rc0",[me.JAVA_SDK]:"0.9.0-rc0",[me.JAVA_SPRING]:"0.8.0-rc0",[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V41.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,auth:{...e.auth,schemes:e.auth.schemes.map(r=>zm5(r))}})};function zm5(e){switch(e.type){case"basic":return ft.V41.AuthScheme.basic(e);case"bearer":return ft.V41.AuthScheme.bearer(e);case"header":return ft.V41.AuthScheme.header(e);case"oauth":return ft.V41.AuthScheme.oauth(Qm5(e));default:fc(e)}}function Qm5(e){switch(e.configuration.type){case"clientCredentials":return{...e,configuration:ft.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:fc(e.configuration.type)}}var eeE={laterVersion:"v43",earlierVersion:"v42",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.17.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.17.0",[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.17.0",[me.TYPESCRIPT_EXPRESS]:"0.13.0",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V42.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,n])=>[r,{...n,endpoints:n.endpoints.map(i=>({...i,response:i.response?.body}))}]))})};var reE={laterVersion:"v44",earlierVersion:"v43",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V43.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([r,n])=>[r,{...n,endpoints:n.endpoints.map(i=>({...i,examples:i.examples.map(a=>Lm5({example:a})).filter(qw)}))}]))})};function Lm5({example:e}){return e._visit({userProvided:t=>ft.V43.HttpEndpointExample.userProvided(teE({example:t})),generated:t=>ft.V43.HttpEndpointExample.generated(teE({example:t})),_other:()=>{}})}function teE({example:e}){return{...e,response:Um5({example:e.response})}}function Um5({example:e}){switch(e.type){case"ok":return Vm5({example:e.value});case"error":return ft.V43.ExampleResponse.error(e);default:fc(e)}}function Vm5({example:e}){switch(e.type){case"body":return ft.V43.ExampleResponse.ok({body:e.value});case"sse":return ft.V43.ExampleResponse.ok({body:void 0});case"stream":return ft.V43.ExampleResponse.ok({body:void 0});default:fc(e)}}var neE={laterVersion:"v45",earlierVersion:"v44",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V44.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=fg(e.types,r=>({...r,shape:ft.V45.types.Type._visit(r.shape,{union:n=>ft.V44.types.Type.union({...n,baseProperties:n.baseProperties.map(i=>({...i,valueType:bQ(i.valueType)})),types:n.types.map(i=>tO5(i))}),enum:ft.V44.types.Type.enum,object:n=>ft.V44.types.Type.object({...n,properties:n.properties.map(i=>({...i,valueType:bQ(i.valueType)}))}),alias:n=>ft.V44.types.Type.alias({aliasOf:bQ(n.aliasOf),resolvedType:nO5(n.resolvedType)}),undiscriminatedUnion:n=>ft.V44.types.Type.undiscriminatedUnion(iO5(n)),_other:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:Ym5(e.auth),headers:e.headers.map(r=>MOo(r)),idempotencyHeaders:e.idempotencyHeaders.map(r=>MOo(r)),types:t,services:fg(e.services,r=>aO5(r)),errors:fg(e.errors,r=>OO5(r)),webhookGroups:fg(e.webhookGroups,r=>Jm5(r)),websocketChannels:fg(e.websocketChannels,r=>Wm5(r)),pathParameters:e.pathParameters.map(r=>aPs(r)),variables:e.variables.map(r=>oO5(r))}}};function Wm5(e){return{...e,headers:e.headers.map(t=>MOo(t)),queryParameters:e.queryParameters.map(t=>oPs(t)),pathParameters:e.pathParameters.map(t=>aPs(t)),messages:e.messages.map(t=>Hm5(t))}}function Hm5(e){return{...e,body:Gm5(e.body)}}function Gm5(e){switch(e.type){case"inlinedBody":return ft.V44.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:bQ(t.valueType)}))});case"reference":return ft.V44.websocket.WebSocketMessageBody.reference({...e,bodyType:bQ(e.bodyType)})}}function Jm5(e){return e.map(t=>Km5(t))}function Km5(e){return{...e,headers:e.headers.map(t=>MOo(t)),payload:$m5(e.payload)}}function $m5(e){switch(e.type){case"reference":return ft.V44.webhooks.WebhookPayload.reference({...e,payloadType:bQ(e.payloadType)});case"inlinedPayload":return ft.V44.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:bQ(t.valueType)}))})}}function Ym5(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return ft.V44.auth.AuthScheme.basic(t);case"bearer":return ft.V44.auth.AuthScheme.bearer(t);case"header":return ft.V44.auth.AuthScheme.header(Xm5(t));case"oauth":return ft.V44.auth.AuthScheme.oauth(Zm5(t))}})}}function Xm5(e){return{...e,valueType:bQ(e.valueType)}}function Zm5(e){return{...e,configuration:ft.V44.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:km5(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?eO5(e.configuration.refreshEndpoint):void 0})}}function km5(e){return{...e,requestProperties:{clientId:Ltl(e.requestProperties.clientId),clientSecret:Ltl(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?Ltl(e.requestProperties.scopes):void 0},responseProperties:{accessToken:QOi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?QOi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?QOi(e.responseProperties.refreshToken):void 0}}}function eO5(e){return{...e,requestProperties:{refreshToken:Ltl(e.requestProperties.refreshToken)},responseProperties:{accessToken:QOi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?QOi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?QOi(e.responseProperties.refreshToken):void 0}}}function MOo(e){return{...e,valueType:bQ(e.valueType)}}function bQ(e){return ft.V45.types.TypeReference._visit(e,{container:t=>ft.V44.types.TypeReference.container(ieE(t)),primitive:t=>t.v1==="BIG_INTEGER"?ft.V44.types.TypeReference.primitive(ft.V44.types.PrimitiveType.String):ft.V44.types.TypeReference.primitive(t.v1),named:ft.V44.types.TypeReference.named,unknown:ft.V44.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function ieE(e){return ft.V45.types.ContainerType._visit(e,{list:t=>ft.V44.types.ContainerType.list(bQ(t)),optional:t=>ft.V44.types.ContainerType.optional(bQ(t)),set:t=>ft.V44.types.ContainerType.set(bQ(t)),map:({keyType:t,valueType:r})=>ft.V44.types.ContainerType.map({keyType:bQ(t),valueType:bQ(r)}),literal:ft.V44.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function tO5(e){return{...e,shape:rO5(e.shape)}}function rO5(e){return ft.V45.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>ft.V44.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>ft.V44.types.SingleUnionTypeProperties.singleProperty({...t,type:bQ(t.type)}),noProperties:ft.V44.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function nO5(e){return ft.V45.types.ResolvedTypeReference._visit(e,{container:t=>ft.V44.types.ResolvedTypeReference.container(ieE(t)),named:ft.V44.types.ResolvedTypeReference.named,primitive:t=>t.v1==="BIG_INTEGER"?ft.V44.types.ResolvedTypeReference.primitive(ft.V44.types.PrimitiveType.String):ft.V44.types.ResolvedTypeReference.primitive(t.v1),unknown:ft.V44.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function iO5(e){return{members:e.members.map(t=>({...t,type:bQ(t.type)}))}}function aO5(e){return{...e,pathParameters:e.pathParameters.map(t=>aPs(t)),headers:e.headers.map(t=>MOo(t)),endpoints:e.endpoints.map(t=>sO5(t))}}function aPs(e){return{...e,valueType:bQ(e.valueType)}}function oO5(e){return{...e,type:bQ(e.type)}}function sO5(e){return{...e,pagination:e.pagination!=null?dO5(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>aPs(t)),pathParameters:e.pathParameters.map(t=>aPs(t)),sdkRequest:e.sdkRequest!=null?yO5(e.sdkRequest):void 0,requestBody:e.requestBody!=null?gO5(e.requestBody):void 0,response:e.response!=null?uO5(e.response):void 0,headers:e.headers.map(t=>MOo(t)),queryParameters:e.queryParameters.map(t=>oPs(t))}}function uO5(e){return{...e,body:e.body!=null?cO5(e.body):void 0}}function cO5(e){switch(e.type){case"json":return ft.V44.http.HttpResponseBody.json(lO5(e.value));case"fileDownload":return ft.V44.http.HttpResponseBody.fileDownload(e);case"text":return ft.V44.http.HttpResponseBody.text(e);case"streaming":return ft.V44.http.HttpResponseBody.streaming(fO5(e.value))}}function lO5(e){switch(e.type){case"response":return ft.V44.http.JsonResponse.response({...e,responseBodyType:bQ(e.responseBodyType)});case"nestedPropertyAsResponse":return ft.V44.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:bQ(e.responseBodyType),responseProperty:e.responseProperty!=null?gm_(e.responseProperty):void 0})}}function fO5(e){switch(e.type){case"json":return ft.V44.http.StreamingResponse.json({...e,payload:bQ(e.payload)});case"text":return ft.V44.http.StreamingResponse.text(e);case"sse":return ft.V44.http.StreamingResponse.sse({...e,payload:bQ(e.payload)})}}function dO5(e){switch(e.type){case"cursor":return ft.V44.http.Pagination.cursor(pO5(e));case"offset":return ft.V44.http.Pagination.offset(_O5(e))}}function pO5(e){return{...e,page:oPs(e.page),next:QOi(e.next),results:QOi(e.results)}}function _O5(e){return{...e,page:oPs(e.page),results:QOi(e.results)}}function Ltl(e){return{...e,property:hO5(e.property)}}function hO5(e){switch(e.type){case"query":return ft.V44.RequestPropertyValue.query(oPs(e));case"body":return ft.V44.RequestPropertyValue.body(gm_(e))}}function QOi(e){return{...e,property:gm_(e.property)}}function gm_(e){return{...e,valueType:bQ(e.valueType)}}function oPs(e){return{...e,valueType:bQ(e.valueType)}}function yO5(e){return{...e,shape:vO5(e.shape)}}function vO5(e){return ft.V45.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V44.http.SdkRequestShape.justRequestBody(bO5(t)),wrapper:ft.V44.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function bO5(e){switch(e.type){case"bytes":return ft.V44.http.SdkRequestBodyType.bytes(e);case"typeReference":return ft.V44.http.SdkRequestBodyType.typeReference({...e,requestBodyType:bQ(e.requestBodyType)})}}function gO5(e){return ft.V45.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V44.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:bQ(r.valueType)}))}),reference:t=>ft.V44.http.HttpRequestBody.reference({...t,requestBodyType:bQ(t.requestBodyType)}),fileUpload:t=>ft.V44.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return ft.V44.http.FileUploadRequestProperty.bodyProperty({...r,valueType:bQ(r.valueType)});case"file":return ft.V44.http.FileUploadRequestProperty.file(mO5(r.value))}})}),bytes:t=>ft.V44.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function mO5(e){switch(e.type){case"file":return ft.V44.http.FileProperty.file(e);case"fileArray":return ft.V44.http.FileProperty.fileArray(e)}}function OO5(e){return{...e,type:e.type!=null?bQ(e.type):void 0}}var oeE={laterVersion:"v46",earlierVersion:"v45",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.21.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.21.0",[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.21.0",[me.TYPESCRIPT_EXPRESS]:"0.16.0",[me.JAVA]:Ut,[me.JAVA_MODEL]:"0.9.0",[me.JAVA_SDK]:"0.10.0",[me.JAVA_SPRING]:"0.9.0",[me.PYTHON_FASTAPI]:"0.10.1",[me.PYTHON_PYDANTIC]:"0.9.1",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"2.9.9",[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V45.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,{...r,examples:AO5(r.examples)}])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(n=>({...n,examples:PO5(n.examples)}))}])),websocketChannels:e.websocketChannels!=null?Object.fromEntries(Object.entries(e.websocketChannels).map(([t,r])=>[t,{...r,examples:wO5(r.examples)}])):void 0,errors:Object.fromEntries(Object.entries(e.errors).map(([t,r])=>[t,{...r,examples:r.examples.map(n=>({...n,shape:ote(n.shape)}))}]))})};function ote(e){return e.shape._visit({container:t=>({...e,shape:t._visit({list:r=>ft.V45.ExampleTypeReferenceShape.container(ft.V45.ExampleContainer.list(r.map(n=>ote(n)))),set:r=>ft.V45.ExampleTypeReferenceShape.container(ft.V45.ExampleContainer.set(r.map(n=>ote(n)))),map:r=>ft.V45.ExampleTypeReferenceShape.container(ft.V45.ExampleContainer.map(r.map(n=>({key:ote(n.key),value:ote(n.value)})))),optional:r=>ft.V45.ExampleTypeReferenceShape.container(ft.V45.ExampleContainer.optional(r!=null?ote(r):void 0)),literal:r=>ft.V45.ExampleTypeReferenceShape.primitive(r._visit({string:n=>ft.V45.ExamplePrimitive.string(n),integer:n=>ft.V45.ExamplePrimitive.integer(n),double:n=>ft.V45.ExamplePrimitive.double(n),long:n=>ft.V45.ExamplePrimitive.long(n),boolean:n=>ft.V45.ExamplePrimitive.boolean(n),datetime:n=>ft.V45.ExamplePrimitive.datetime(n),date:n=>ft.V45.ExamplePrimitive.date(n),uuid:n=>ft.V45.ExamplePrimitive.uuid(n),_other:n=>{throw new Error(`Unexpected value: ${JSON.stringify(n)}`)}})),_other:r=>{throw new Error(`Unexpected value: ${JSON.stringify(r)}`)}})}),named:t=>({...e,shape:ft.V45.ExampleTypeReferenceShape.named({...t,shape:seE(t.shape)})}),primitive:t=>({...e,shape:ft.V45.ExampleTypeReferenceShape.primitive(t._visit({string:r=>ft.V45.ExamplePrimitive.string(r),integer:r=>ft.V45.ExamplePrimitive.integer(r),double:r=>ft.V45.ExamplePrimitive.double(r),long:r=>ft.V45.ExamplePrimitive.long(r),boolean:r=>ft.V45.ExamplePrimitive.boolean(r),datetime:r=>ft.V45.ExamplePrimitive.datetime(r),date:r=>ft.V45.ExamplePrimitive.date(r),uuid:r=>ft.V45.ExamplePrimitive.uuid(r),_other:r=>{throw new Error(`Unexpected value: ${JSON.stringify(r)}`)}}))}),unknown:t=>({...e,shape:ft.V45.ExampleTypeReferenceShape.unknown(t)}),_other:t=>{throw new Error(`Unexpected value: ${JSON.stringify(t)}`)}})}function aeE(e){return{...e,properties:e.properties.map(t=>({...t,value:ote(t.value)}))}}function seE(e){return e.type==="alias"?ft.V45.ExampleTypeShape.alias({value:ote(e.value)}):e.type==="object"?ft.V45.ExampleTypeShape.object(aeE(e)):e.type==="union"?ft.V45.ExampleTypeShape.union({...e,singleUnionType:{...e.singleUnionType,shape:e.singleUnionType.shape._visit({samePropertiesAsObject:t=>ft.V45.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...t,object:aeE(t.object)}),singleProperty:t=>ft.V45.ExampleSingleUnionTypeProperties.singleProperty(ote(t)),noProperties:()=>ft.V45.ExampleSingleUnionTypeProperties.noProperties(),_other:t=>{throw new Error(`Unexpected value: ${JSON.stringify(t)}`)}})}}):e.type==="undiscriminatedUnion"?ft.V45.ExampleTypeShape.undiscriminatedUnion({...e,singleUnionType:ote(e.singleUnionType)}):ft.V45.ExampleTypeShape.enum(e)}function AO5(e){return e.map(t=>({...t,shape:seE(t.shape)}))}function Utl(e){return e.map(t=>({...t,value:ote(t.value)}))}function mm_(e){return e.map(t=>({...t,value:ote(t.value)}))}function ueE(e){return e.map(t=>({...t,value:ote(t.value)}))}function PO5(e){return e.map(t=>{let r={...t,rootPathParameters:Utl(t.rootPathParameters),servicePathParameters:Utl(t.servicePathParameters),endpointPathParameters:Utl(t.endpointPathParameters),serviceHeaders:mm_(t.serviceHeaders),endpointHeaders:mm_(t.endpointHeaders),queryParameters:ueE(t.queryParameters),request:t.request?._visit({inlinedRequestBody:n=>ft.V45.ExampleRequestBody.inlinedRequestBody({...n,properties:n.properties.map(i=>({...i,value:ote(i.value)}))}),reference:n=>ft.V45.ExampleRequestBody.reference(ote(n)),_other:n=>{throw new Error(`Unexpected value: ${JSON.stringify(n)}`)}}),response:t.response._visit({ok:n=>ft.V45.ExampleResponse.ok(n._visit({body:i=>ft.V45.ExampleEndpointSuccessResponse.body(i!=null?ote(i):void 0),stream:i=>ft.V45.ExampleEndpointSuccessResponse.stream(i.map(ote)),sse:i=>ft.V45.ExampleEndpointSuccessResponse.sse(i.map(a=>({...a,data:ote(a.data)}))),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})),error:n=>ft.V45.ExampleResponse.error({...n,body:n.body!=null?ote(n.body):void 0}),_other:n=>{throw new Error(`Unexpected value: ${JSON.stringify(n)}`)}})};return t._visit({userProvided:()=>ft.V45.HttpEndpointExample.userProvided(r),generated:()=>ft.V45.HttpEndpointExample.generated(r),_other:n=>{throw new Error(`Unexpected value: ${JSON.stringify(n)}`)}})})}function wO5(e){return e.map(t=>({...t,pathParameters:Utl(t.pathParameters),headers:mm_(t.headers),queryParameters:ueE(t.queryParameters),messages:t.messages.map(r=>({...r,body:r.body._visit({inlinedBody:n=>ft.V45.ExampleWebSocketMessageBody.inlinedBody({...n,properties:n.properties.map(i=>({...i,value:ote(i.value)}))}),reference:n=>ft.V45.ExampleWebSocketMessageBody.reference(ote(n)),_other:n=>{throw new Error(`Unexpected value: ${JSON.stringify(n)}`)}})}))}))}var ceE={laterVersion:"v47",earlierVersion:"v46",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V46.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>{let n=r.endpoints.map(i=>{let{autogeneratedExamples:a,userSpecifiedExamples:o,...c}=i;return{...c,autogeneratedExamples:void 0,userSpecifiedExamples:void 0,examples:[...i.userSpecifiedExamples.map(u=>{if(u.example!=null)return ft.V46.HttpEndpointExample.userProvided({...u.example,codeSamples:u.codeSamples})}).filter(qw),...i.autogeneratedExamples.map(u=>ft.V46.HttpEndpointExample.generated({...u.example,codeSamples:void 0}))]}});return[t,{...r,endpoints:n}]}))})};var leE={laterVersion:"v48",earlierVersion:"v47",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.29.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.29.0",[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.29.0",[me.TYPESCRIPT_EXPRESS]:"0.17.0",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V47.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=Object.fromEntries(Object.entries(e.services).map(([r,n])=>{let i=n.endpoints.map(a=>({...a,pagination:a.pagination!=null?EO5(a.pagination):void 0}));return[r,{...n,endpoints:i}]}));return{...e,sdkConfig:{...e.sdkConfig,hasPaginatedEndpoints:jO5(t)},services:t}}};function jO5(e){for(let t of Object.values(e))for(let r of t.endpoints)if(r.pagination!=null)return!0;return!1}function EO5(e){switch(e.type){case"cursor":{let t=SO5(e);return t!=null?ft.V47.Pagination.cursor(t):void 0}case"offset":{let t=DO5(e);return t!=null?ft.V47.Pagination.offset(t):void 0}default:fc(e)}}function SO5(e){let t=feE(e.page);if(t!=null)return{...e,page:t}}function DO5(e){if(e.step!=null)return;let t=feE(e.page);if(t!=null)return{...e,page:t}}function feE(e){switch(e.property.type){case"query":return e.property}}var deE={laterVersion:"v49",earlierVersion:"v48",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:"0.11.0-rc0",[me.PYTHON_PYDANTIC]:"0.10.0-rc0",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:"2.11.0-rc0",[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Hn,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V48.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=Object.fromEntries(Object.entries(e.services).map(([r,n])=>{let i=n.endpoints.flatMap(a=>{let o;return a.response?.body!=null&&(o=a.response.body?._visit({json:f=>ft.V48.HttpResponseBody.json({...f}),fileDownload:f=>ft.V48.HttpResponseBody.fileDownload({...f}),text:f=>ft.V48.HttpResponseBody.text({...f}),streaming:f=>ft.V48.HttpResponseBody.streaming({...f}),streamParameter:()=>{},_other:()=>{}}),o==null)?[]:{...a,response:a.response==null?void 0:{statusCode:a.response?.statusCode,body:o}}});return[r,{...n,endpoints:i}]}));return{...e,services:t}}};var peE={laterVersion:"v50",earlierVersion:"v49",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.34.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.34.0",[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:"0.34.0",[me.TYPESCRIPT_EXPRESS]:"0.17.2",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:"0.0.0",[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V49.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=fg(e.types,r=>({...r,shape:ft.V50.types.Type._visit(r.shape,{union:n=>ft.V49.types.Type.union({...n,baseProperties:n.baseProperties.map(i=>({...i,valueType:gQ(i.valueType)})),types:n.types.map(i=>QO5(i))}),enum:ft.V49.types.Type.enum,object:n=>ft.V49.types.Type.object({...n,properties:n.properties.map(i=>({...i,valueType:gQ(i.valueType)}))}),alias:n=>ft.V49.types.Type.alias({aliasOf:gQ(n.aliasOf),resolvedType:UO5(n.resolvedType)}),undiscriminatedUnion:n=>ft.V49.types.Type.undiscriminatedUnion(VO5(n)),_other:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:RO5(e.auth),headers:e.headers.map(r=>BOo(r)),idempotencyHeaders:e.idempotencyHeaders.map(r=>BOo(r)),types:t,services:fg(e.services,r=>WO5(r)),errors:fg(e.errors,r=>oA5(r)),webhookGroups:fg(e.webhookGroups,r=>BO5(r)),websocketChannels:fg(e.websocketChannels,r=>CO5(r)),pathParameters:e.pathParameters.map(r=>sPs(r)),variables:e.variables.map(r=>HO5(r))}}};function CO5(e){return{...e,headers:e.headers.map(t=>BOo(t)),queryParameters:e.queryParameters.map(t=>Am_(t)),pathParameters:e.pathParameters.map(t=>sPs(t)),messages:e.messages.map(t=>IO5(t))}}function IO5(e){return{...e,body:MO5(e.body)}}function MO5(e){switch(e.type){case"inlinedBody":return ft.V49.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:gQ(t.valueType)}))});case"reference":return ft.V49.websocket.WebSocketMessageBody.reference({...e,bodyType:gQ(e.bodyType)})}}function BO5(e){return e.map(t=>TO5(t))}function TO5(e){return{...e,headers:e.headers.map(t=>BOo(t)),payload:qO5(e.payload)}}function qO5(e){switch(e.type){case"reference":return ft.V49.webhooks.WebhookPayload.reference({...e,payloadType:gQ(e.payloadType)});case"inlinedPayload":return ft.V49.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:gQ(t.valueType)}))})}}function RO5(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return ft.V49.auth.AuthScheme.basic(t);case"bearer":return ft.V49.auth.AuthScheme.bearer(t);case"header":return ft.V49.auth.AuthScheme.header(NO5(t));case"oauth":return ft.V49.auth.AuthScheme.oauth(xO5(t))}})}}function NO5(e){return{...e,valueType:gQ(e.valueType)}}function xO5(e){return{...e,configuration:ft.V49.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:FO5(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?zO5(e.configuration.refreshEndpoint):void 0})}}function FO5(e){return{...e,requestProperties:{clientId:xLi(e.requestProperties.clientId),clientSecret:xLi(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?xLi(e.requestProperties.scopes):void 0},responseProperties:{accessToken:LOi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?LOi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?LOi(e.responseProperties.refreshToken):void 0}}}function zO5(e){return{...e,requestProperties:{refreshToken:xLi(e.requestProperties.refreshToken)},responseProperties:{accessToken:LOi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?LOi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?LOi(e.responseProperties.refreshToken):void 0}}}function BOo(e){return{...e,valueType:gQ(e.valueType)}}function gQ(e){return ft.V50.types.TypeReference._visit(e,{container:t=>ft.V49.types.TypeReference.container(_eE(t)),primitive:t=>t.v2?.type==="integer"?ft.V49.types.TypeReference.primitive({v1:t.v1,v2:ft.V49.types.PrimitiveTypeV2.integer(t.v2)}):t.v2?.type==="double"?ft.V49.types.TypeReference.primitive({v1:t.v1,v2:ft.V49.types.PrimitiveTypeV2.double(t.v2)}):t.v2?.type==="string"?ft.V49.types.TypeReference.primitive({v1:t.v1,v2:ft.V49.types.PrimitiveTypeV2.string(t.v2)}):ft.V49.types.TypeReference.primitive({v1:t.v1,v2:void 0}),named:ft.V49.types.TypeReference.named,unknown:ft.V49.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function _eE(e){return ft.V50.types.ContainerType._visit(e,{list:t=>ft.V49.types.ContainerType.list(gQ(t)),optional:t=>ft.V49.types.ContainerType.optional(gQ(t)),set:t=>ft.V49.types.ContainerType.set(gQ(t)),map:({keyType:t,valueType:r})=>ft.V49.types.ContainerType.map({keyType:gQ(t),valueType:gQ(r)}),literal:ft.V49.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function QO5(e){return{...e,shape:LO5(e.shape)}}function LO5(e){return ft.V50.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>ft.V49.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>ft.V49.types.SingleUnionTypeProperties.singleProperty({...t,type:gQ(t.type)}),noProperties:ft.V49.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function UO5(e){return ft.V50.types.ResolvedTypeReference._visit(e,{container:t=>ft.V49.types.ResolvedTypeReference.container(_eE(t)),named:ft.V49.types.ResolvedTypeReference.named,primitive:t=>t.v2?.type==="integer"?ft.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:ft.V49.types.PrimitiveTypeV2.integer(t.v2)}):t.v2?.type==="double"?ft.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:ft.V49.types.PrimitiveTypeV2.double(t.v2)}):t.v2?.type==="string"?ft.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:ft.V49.types.PrimitiveTypeV2.string(t.v2)}):ft.V49.types.ResolvedTypeReference.primitive({v1:t.v1,v2:void 0}),unknown:ft.V49.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function VO5(e){return{members:e.members.map(t=>({...t,type:gQ(t.type)}))}}function WO5(e){return{...e,pathParameters:e.pathParameters.map(t=>sPs(t)),headers:e.headers.map(t=>BOo(t)),endpoints:e.endpoints.map(t=>GO5(t))}}function sPs(e){return{...e,valueType:gQ(e.valueType)}}function HO5(e){return{...e,type:gQ(e.type)}}function GO5(e){return{...e,pagination:e.pagination!=null?XO5(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>sPs(t)),pathParameters:e.pathParameters.map(t=>sPs(t)),sdkRequest:e.sdkRequest!=null?tA5(e.sdkRequest):void 0,requestBody:e.requestBody!=null?iA5(e.requestBody):void 0,response:e.response!=null?JO5(e.response):void 0,headers:e.headers.map(t=>BOo(t)),queryParameters:e.queryParameters.map(t=>Am_(t))}}function JO5(e){return{...e,body:e.body!=null?KO5(e.body):void 0}}function KO5(e){switch(e.type){case"json":return ft.V49.http.HttpResponseBody.json(heE(e.value));case"fileDownload":return ft.V49.http.HttpResponseBody.fileDownload(e);case"text":return ft.V49.http.HttpResponseBody.text(e);case"streaming":return ft.V49.http.HttpResponseBody.streaming(yeE(e.value));case"streamParameter":return ft.V49.http.HttpResponseBody.streamParameter(YO5(e))}}function heE(e){switch(e.type){case"response":return ft.V49.http.JsonResponse.response({...e,responseBodyType:gQ(e.responseBodyType)});case"nestedPropertyAsResponse":return ft.V49.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:gQ(e.responseBodyType),responseProperty:e.responseProperty!=null?Om_(e.responseProperty):void 0})}}function yeE(e){switch(e.type){case"json":return ft.V49.http.StreamingResponse.json({...e,payload:gQ(e.payload)});case"text":return ft.V49.http.StreamingResponse.text(e);case"sse":return ft.V49.http.StreamingResponse.sse({...e,payload:gQ(e.payload)})}}function $O5(e){switch(e.type){case"json":return ft.V49.http.NonStreamHttpResponseBody.json(heE(e.value));case"text":return ft.V49.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return ft.V49.http.NonStreamHttpResponseBody.fileDownload(e)}}function YO5(e){return{nonStreamResponse:$O5(e.nonStreamResponse),streamResponse:yeE(e.streamResponse)}}function XO5(e){switch(e.type){case"cursor":return ft.V49.http.Pagination.cursor(ZO5(e));case"offset":return ft.V49.http.Pagination.offset(kO5(e))}}function ZO5(e){return{...e,page:xLi(e.page),next:LOi(e.next),results:LOi(e.results)}}function kO5(e){return{...e,page:xLi(e.page),results:LOi(e.results),step:e.step!=null?xLi(e.step):void 0}}function xLi(e){return{...e,property:eA5(e.property)}}function eA5(e){switch(e.type){case"query":return ft.V49.RequestPropertyValue.query(Am_(e));case"body":return ft.V49.RequestPropertyValue.body(Om_(e))}}function LOi(e){return{...e,property:Om_(e.property)}}function Om_(e){return{...e,valueType:gQ(e.valueType)}}function Am_(e){return{...e,valueType:gQ(e.valueType)}}function tA5(e){return{...e,streamParameter:e.streamParameter!=null?xLi(e.streamParameter):void 0,shape:rA5(e.shape)}}function rA5(e){return ft.V50.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V49.http.SdkRequestShape.justRequestBody(nA5(t)),wrapper:ft.V49.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function nA5(e){switch(e.type){case"bytes":return ft.V49.http.SdkRequestBodyType.bytes(e);case"typeReference":return ft.V49.http.SdkRequestBodyType.typeReference({...e,requestBodyType:gQ(e.requestBodyType)})}}function iA5(e){return ft.V50.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V49.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:gQ(r.valueType)}))}),reference:t=>ft.V49.http.HttpRequestBody.reference({...t,requestBodyType:gQ(t.requestBodyType)}),fileUpload:t=>ft.V49.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return ft.V49.http.FileUploadRequestProperty.bodyProperty({...r,valueType:gQ(r.valueType)});case"file":return ft.V49.http.FileUploadRequestProperty.file(aA5(r.value))}})}),bytes:t=>ft.V49.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function aA5(e){switch(e.type){case"file":return ft.V49.http.FileProperty.file(e);case"fileArray":return ft.V49.http.FileProperty.fileArray(e)}}function oA5(e){return{...e,type:e.type!=null?gQ(e.type):void 0}}var geE={laterVersion:"v51",earlierVersion:"v50",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:"0.1.2",[me.SWIFT_MODEL]:Ut,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V50.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=fg(e.types,r=>{let n=r.autogeneratedExamples.map(a=>veE(a)),i=r.userProvidedExamples.map(a=>veE(a));return{...r,examples:[...n,...i]}});return{...e,types:t,services:fg(e.services,r=>vA5(r)),errors:fg(e.errors,r=>AA5(r)),webhookGroups:fg(e.webhookGroups,r=>lA5(r)),websocketChannels:fg(e.websocketChannels,r=>sA5(r))}}};function sA5(e){return{...e,examples:e.examples.map(t=>uA5(t))}}function uA5(e){return{...e,pathParameters:e.pathParameters.map(t=>Vtl(t)),headers:e.headers.map(t=>Pm_(t)),queryParameters:e.queryParameters.map(t=>meE(t)),messages:e.messages.map(t=>({...t,body:cA5(t.body)}))}}function meE(e){return{...e,value:Yue(e.value)}}function Pm_(e){return{...e,value:Yue(e.value)}}function Vtl(e){return{...e,value:Yue(e.value)}}function cA5(e){switch(e.type){case"inlinedBody":return ft.V50.ExampleWebSocketMessageBody.inlinedBody(OeE(e));case"reference":return ft.V50.ExampleWebSocketMessageBody.reference(Yue(e))}}function OeE(e){return{...e,properties:e.properties.map(t=>({...t,value:Yue(t.value)}))}}function lA5(e){return e.map(t=>({...t,examples:t.examples?.map(r=>({...r,payload:Yue(r.payload)}))}))}function veE(e){return{...e,shape:AeE(e.shape)}}function wm_(e){switch(e.type){case"primitive":return ft.V50.ExampleTypeReferenceShape.primitive({...e.primitive});case"container":return ft.V50.ExampleTypeReferenceShape.container(fA5(e));case"unknown":return ft.V50.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return ft.V50.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:AeE(e.shape)})}}function fA5(e){switch(e.container.type){case"list":return ft.V50.ExampleContainer.list(e.container.list.map(t=>Yue(t)));case"set":return ft.V50.ExampleContainer.set(e.container.set.map(t=>Yue(t)));case"optional":return ft.V50.ExampleContainer.optional(e.container.optional!=null?Yue(e.container.optional):void 0);case"map":return ft.V50.ExampleContainer.map(e.container.map.map(t=>({key:Yue(t.key),value:Yue(t.value)})));case"literal":return ft.V50.ExampleContainer.literal(e.container.literal)}}function Yue(e){return{...e,shape:wm_(e.shape)}}function AeE(e){switch(e.type){case"object":return ft.V50.ExampleTypeShape.object({properties:e.properties.map(t=>PeE(t))});case"alias":return ft.V50.ExampleTypeShape.alias({value:{...Yue(e.value)}});case"enum":return ft.V50.ExampleTypeShape.enum(e);case"union":return ft.V50.ExampleTypeShape.union(pA5(e));case"undiscriminatedUnion":return ft.V50.ExampleTypeShape.undiscriminatedUnion(dA5(e))}}function dA5(e){return{...e,singleUnionType:Yue(e.singleUnionType)}}function pA5(e){return{...e,singleUnionType:_A5(e.singleUnionType)}}function _A5(e){return{...e,shape:hA5(e.shape)}}function hA5(e){switch(e.type){case"samePropertiesAsObject":return ft.V50.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:yA5(e.object)});case"singleProperty":return ft.V50.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:wm_(e.shape)});case"noProperties":return ft.V50.ExampleSingleUnionTypeProperties.noProperties()}}function yA5(e){return{...e,properties:e.properties.map(t=>PeE(t))}}function PeE(e){return{...e,value:{...e.value,shape:wm_(e.value.shape)}}}function vA5(e){return{...e,endpoints:e.endpoints.map(t=>bA5(t))}}function bA5(e){return{...e,autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:beE(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?beE(t.example):void 0}))}}function beE(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>Vtl(t)),servicePathParameters:e.servicePathParameters.map(t=>Vtl(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Vtl(t)),serviceHeaders:e.serviceHeaders.map(t=>Pm_(t)),endpointHeaders:e.endpointHeaders.map(t=>Pm_(t)),queryParameters:e.queryParameters.map(t=>meE(t)),request:e.request!=null?OA5(e.request):void 0,response:gA5(e.response)}}function gA5(e){switch(e.type){case"error":return ft.V50.ExampleResponse.error({...e,body:e.body!=null?Yue(e.body):void 0});case"ok":return ft.V50.ExampleResponse.ok(mA5(e))}}function mA5(e){switch(e.value.type){case"body":return ft.V50.ExampleEndpointSuccessResponse.body(e.value.value!=null?Yue(e.value.value):void 0);case"stream":return ft.V50.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>Yue(t)));case"sse":return ft.V50.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:Yue(t.data)})))}}function OA5(e){switch(e.type){case"inlinedRequestBody":return ft.V50.ExampleRequestBody.inlinedRequestBody(OeE(e));case"reference":return ft.V50.ExampleRequestBody.reference(Yue(e))}}function AA5(e){return{...e,examples:e.examples.map(t=>({...t,shape:Yue(t.shape)}))}}var EeE={laterVersion:"v52",earlierVersion:"v51",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Ut,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Hn,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V51.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?wA5(e.apiVersion):void 0,auth:BA5(e.auth),headers:e.headers.map(t=>qMa(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>qMa(t)),types:PA5(e.types),services:fg(e.services,t=>VA5(t)),webhookGroups:fg(e.webhookGroups,t=>DA5(t)),websocketChannels:fg(e.websocketChannels,t=>jA5(t)),errors:fg(e.errors,t=>aP5(t)),pathParameters:e.pathParameters.map(t=>uPs(t)),variables:e.variables.map(t=>WA5(t))})};function PA5(e){return fg(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>weE(r)),userProvidedExamples:t.userProvidedExamples.map(r=>weE(r)),shape:ft.V52.types.Type._visit(t.shape,{union:r=>ft.V51.types.Type.union({...r,baseProperties:r.baseProperties.map(n=>({...n,valueType:T6(n.valueType)})),types:r.types.map(n=>zA5(n))}),enum:ft.V51.types.Type.enum,object:r=>ft.V51.types.Type.object({...r,properties:r.properties.map(n=>({...n,valueType:T6(n.valueType)}))}),alias:r=>ft.V51.types.Type.alias({aliasOf:T6(r.aliasOf),resolvedType:LA5(r.resolvedType)}),undiscriminatedUnion:r=>ft.V51.types.Type.undiscriminatedUnion(UA5(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function wA5(e){return ft.V51.ApiVersionScheme.header({...e,header:qMa(e.header)})}function jA5(e){return{...e,headers:e.headers.map(t=>qMa(t)),queryParameters:e.queryParameters.map(t=>Sm_(t)),pathParameters:e.pathParameters.map(t=>uPs(t)),messages:e.messages.map(t=>EA5(t)),examples:e.examples.map(t=>oP5(t))}}function EA5(e){return{...e,body:SA5(e.body)}}function SA5(e){switch(e.type){case"inlinedBody":return ft.V51.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:T6(t.valueType)}))});case"reference":return ft.V51.websocket.WebSocketMessageBody.reference({...e,bodyType:T6(e.bodyType)})}}function DA5(e){return e.map(t=>CA5(t))}function CA5(e){return{...e,headers:e.headers.map(t=>qMa(t)),payload:IA5(e.payload),examples:e.examples!=null?e.examples.map(t=>MA5(t)):void 0}}function IA5(e){switch(e.type){case"reference":return ft.V51.webhooks.WebhookPayload.reference({...e,payloadType:T6(e.payloadType)});case"inlinedPayload":return ft.V51.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:T6(t.valueType)}))})}}function MA5(e){return{...e,payload:Xue(e.payload)}}function BA5(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return ft.V51.auth.AuthScheme.basic(t);case"bearer":return ft.V51.auth.AuthScheme.bearer(t);case"header":return ft.V51.auth.AuthScheme.header(TA5(t));case"oauth":return ft.V51.auth.AuthScheme.oauth(qA5(t))}})}}function TA5(e){return{...e,valueType:T6(e.valueType)}}function qA5(e){return{...e,configuration:ft.V51.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:RA5(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?NA5(e.configuration.refreshEndpoint):void 0})}}function RA5(e){return{...e,requestProperties:{clientId:FLi(e.requestProperties.clientId),clientSecret:FLi(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?FLi(e.requestProperties.scopes):void 0},responseProperties:{accessToken:UOi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?UOi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?UOi(e.responseProperties.refreshToken):void 0}}}function NA5(e){return{...e,requestProperties:{refreshToken:FLi(e.requestProperties.refreshToken)},responseProperties:{accessToken:UOi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?UOi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?UOi(e.responseProperties.refreshToken):void 0}}}function qMa(e){return{...e,valueType:T6(e.valueType)}}function T6(e){return ft.V52.types.TypeReference._visit(e,{container:t=>ft.V51.types.TypeReference.container(DeE(t)),primitive:t=>ft.V51.types.TypeReference.primitive(SeE(t)),named:ft.V51.types.TypeReference.named,unknown:ft.V51.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function SeE(e){return{v1:xA5(e.v1),v2:e.v2!=null?FA5(e.v2):void 0}}function xA5(e){switch(e){case"UINT":return ft.V51.types.PrimitiveTypeV1.Integer;case"UINT_64":return ft.V51.types.PrimitiveTypeV1.Long}return e}function FA5(e){switch(e.type){case"integer":return ft.V51.types.PrimitiveTypeV2.integer(e);case"double":return ft.V51.types.PrimitiveTypeV2.double(e);case"string":return ft.V51.types.PrimitiveTypeV2.string(e);case"boolean":return ft.V51.types.PrimitiveTypeV2.boolean(e);case"long":return ft.V51.types.PrimitiveTypeV2.long(e);case"bigInteger":return ft.V51.types.PrimitiveTypeV2.bigInteger(e);case"uint":return;case"uint64":return;default:fc(e)}}function DeE(e){return ft.V52.types.ContainerType._visit(e,{list:t=>ft.V51.types.ContainerType.list(T6(t)),optional:t=>ft.V51.types.ContainerType.optional(T6(t)),set:t=>ft.V51.types.ContainerType.set(T6(t)),map:({keyType:t,valueType:r})=>ft.V51.types.ContainerType.map({keyType:T6(t),valueType:T6(r)}),literal:ft.V51.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function zA5(e){return{...e,shape:QA5(e.shape)}}function QA5(e){return ft.V52.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>ft.V51.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>ft.V51.types.SingleUnionTypeProperties.singleProperty({...t,type:T6(t.type)}),noProperties:ft.V51.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function LA5(e){return ft.V52.types.ResolvedTypeReference._visit(e,{container:t=>ft.V51.types.ResolvedTypeReference.container(DeE(t)),named:ft.V51.types.ResolvedTypeReference.named,primitive:t=>ft.V51.types.ResolvedTypeReference.primitive(SeE(t)),unknown:ft.V51.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function UA5(e){return{members:e.members.map(t=>({...t,type:T6(t.type)}))}}function VA5(e){return{...e,pathParameters:e.pathParameters.map(t=>uPs(t)),headers:e.headers.map(t=>qMa(t)),endpoints:e.endpoints.map(t=>HA5(t))}}function uPs(e){return{...e,valueType:T6(e.valueType)}}function WA5(e){return{...e,type:T6(e.type)}}function HA5(e){return{...e,pagination:e.pagination!=null?YA5(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>uPs(t)),pathParameters:e.pathParameters.map(t=>uPs(t)),sdkRequest:e.sdkRequest!=null?eP5(e.sdkRequest):void 0,requestBody:e.requestBody!=null?nP5(e.requestBody):void 0,response:e.response!=null?GA5(e.response):void 0,headers:e.headers.map(t=>qMa(t)),queryParameters:e.queryParameters.map(t=>Sm_(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:jeE(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?jeE(t.example):void 0}))}}function GA5(e){return{...e,body:e.body!=null?JA5(e.body):void 0}}function JA5(e){switch(e.type){case"json":return ft.V51.http.HttpResponseBody.json(CeE(e.value));case"fileDownload":return ft.V51.http.HttpResponseBody.fileDownload(e);case"text":return ft.V51.http.HttpResponseBody.text(e);case"streaming":return ft.V51.http.HttpResponseBody.streaming(IeE(e.value));case"streamParameter":return ft.V51.http.HttpResponseBody.streamParameter($A5(e))}}function CeE(e){switch(e.type){case"response":return ft.V51.http.JsonResponse.response({...e,responseBodyType:T6(e.responseBodyType)});case"nestedPropertyAsResponse":return ft.V51.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:T6(e.responseBodyType),responseProperty:e.responseProperty!=null?Em_(e.responseProperty):void 0})}}function IeE(e){switch(e.type){case"json":return ft.V51.http.StreamingResponse.json({...e,payload:T6(e.payload)});case"text":return ft.V51.http.StreamingResponse.text(e);case"sse":return ft.V51.http.StreamingResponse.sse({...e,payload:T6(e.payload)})}}function KA5(e){switch(e.type){case"json":return ft.V51.http.NonStreamHttpResponseBody.json(CeE(e.value));case"text":return ft.V51.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return ft.V51.http.NonStreamHttpResponseBody.fileDownload(e)}}function $A5(e){return{nonStreamResponse:KA5(e.nonStreamResponse),streamResponse:IeE(e.streamResponse)}}function YA5(e){switch(e.type){case"cursor":return ft.V51.http.Pagination.cursor(XA5(e));case"offset":return ft.V51.http.Pagination.offset(ZA5(e))}}function XA5(e){return{...e,page:FLi(e.page),next:UOi(e.next),results:UOi(e.results)}}function ZA5(e){return{...e,page:FLi(e.page),results:UOi(e.results),step:e.step!=null?FLi(e.step):void 0}}function FLi(e){return{...e,property:kA5(e.property)}}function kA5(e){switch(e.type){case"query":return ft.V51.RequestPropertyValue.query(Sm_(e));case"body":return ft.V51.RequestPropertyValue.body(Em_(e))}}function UOi(e){return{...e,property:Em_(e.property)}}function Em_(e){return{...e,valueType:T6(e.valueType)}}function Sm_(e){return{...e,valueType:T6(e.valueType)}}function eP5(e){return{...e,streamParameter:e.streamParameter!=null?FLi(e.streamParameter):void 0,shape:tP5(e.shape)}}function tP5(e){return ft.V52.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V51.http.SdkRequestShape.justRequestBody(rP5(t)),wrapper:ft.V51.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function rP5(e){switch(e.type){case"bytes":return ft.V51.http.SdkRequestBodyType.bytes(e);case"typeReference":return ft.V51.http.SdkRequestBodyType.typeReference({...e,requestBodyType:T6(e.requestBodyType)})}}function nP5(e){return ft.V52.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V51.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:T6(r.valueType)}))}),reference:t=>ft.V51.http.HttpRequestBody.reference({...t,requestBodyType:T6(t.requestBodyType)}),fileUpload:t=>ft.V51.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return ft.V51.http.FileUploadRequestProperty.bodyProperty({...r,valueType:T6(r.valueType)});case"file":return ft.V51.http.FileUploadRequestProperty.file(iP5(r.value))}})}),bytes:t=>ft.V51.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function iP5(e){switch(e.type){case"file":return ft.V51.http.FileProperty.file(e);case"fileArray":return ft.V51.http.FileProperty.fileArray(e)}}function aP5(e){return{...e,type:e.type!=null?T6(e.type):void 0,examples:e.examples.map(t=>({...t,shape:Xue(t.shape)}))}}function oP5(e){return{...e,pathParameters:e.pathParameters.map(t=>Wtl(t)),headers:e.headers.map(t=>jm_(t)),queryParameters:e.queryParameters.map(t=>MeE(t)),messages:e.messages.map(t=>({...t,body:sP5(t.body)}))}}function MeE(e){return{...e,value:Xue(e.value)}}function jm_(e){return{...e,value:Xue(e.value)}}function Wtl(e){return{...e,value:Xue(e.value)}}function sP5(e){switch(e.type){case"inlinedBody":return ft.V51.ExampleWebSocketMessageBody.inlinedBody(BeE(e));case"reference":return ft.V51.ExampleWebSocketMessageBody.reference(Xue(e))}}function BeE(e){return{...e,properties:e.properties.map(t=>({...t,value:Xue(t.value)}))}}function weE(e){return{...e,shape:qeE(e.shape)}}function Dm_(e){switch(e.type){case"primitive":return ft.V51.ExampleTypeReferenceShape.primitive(uP5(e));case"container":return ft.V51.ExampleTypeReferenceShape.container(cP5(e));case"unknown":return ft.V51.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return ft.V51.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:qeE(e.shape)})}}function TeE(e){switch(e.type){case"integer":return ft.V51.ExamplePrimitive.integer(e.integer);case"uint":return ft.V51.ExamplePrimitive.integer(e.uint);case"uint64":return ft.V51.ExamplePrimitive.integer(e.uint64);case"double":return ft.V51.ExamplePrimitive.double(e.double);case"long":return ft.V51.ExamplePrimitive.long(e.long);case"boolean":return ft.V51.ExamplePrimitive.boolean(e.boolean);case"string":return ft.V51.ExamplePrimitive.string(e.string);case"date":return ft.V51.ExamplePrimitive.date(e.date);case"datetime":return ft.V51.ExamplePrimitive.datetime(e.datetime);case"uuid":return ft.V51.ExamplePrimitive.uuid(e.uuid)}}function uP5(e){return TeE(e.primitive)}function cP5(e){switch(e.container.type){case"list":return ft.V51.ExampleContainer.list({list:e.container.list.map(t=>Xue(t)),itemType:T6(e.container.itemType)});case"set":return ft.V51.ExampleContainer.set({set:e.container.set.map(t=>Xue(t)),itemType:T6(e.container.itemType)});case"optional":return ft.V51.ExampleContainer.optional({optional:e.container.optional!=null?Xue(e.container.optional):void 0,valueType:T6(e.container.valueType)});case"map":return ft.V51.ExampleContainer.map({map:e.container.map.map(t=>({key:Xue(t.key),value:Xue(t.value)})),keyType:T6(e.container.keyType),valueType:T6(e.container.valueType)});case"literal":return ft.V51.ExampleContainer.literal({literal:TeE(e.container.literal)})}}function Xue(e){return{...e,shape:Dm_(e.shape)}}function qeE(e){switch(e.type){case"object":return ft.V51.ExampleTypeShape.object({properties:e.properties.map(t=>ReE(t))});case"alias":return ft.V51.ExampleTypeShape.alias({value:{...Xue(e.value)}});case"enum":return ft.V51.ExampleTypeShape.enum(e);case"union":return ft.V51.ExampleTypeShape.union(fP5(e));case"undiscriminatedUnion":return ft.V51.ExampleTypeShape.undiscriminatedUnion(lP5(e))}}function lP5(e){return{...e,singleUnionType:Xue(e.singleUnionType)}}function fP5(e){return{...e,singleUnionType:dP5(e.singleUnionType)}}function dP5(e){return{...e,shape:pP5(e.shape)}}function pP5(e){switch(e.type){case"samePropertiesAsObject":return ft.V51.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:_P5(e.object)});case"singleProperty":return ft.V51.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:Dm_(e.shape)});case"noProperties":return ft.V51.ExampleSingleUnionTypeProperties.noProperties()}}function _P5(e){return{...e,properties:e.properties.map(t=>ReE(t))}}function ReE(e){return{...e,value:{...e.value,shape:Dm_(e.value.shape)}}}function jeE(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>Wtl(t)),servicePathParameters:e.servicePathParameters.map(t=>Wtl(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Wtl(t)),serviceHeaders:e.serviceHeaders.map(t=>jm_(t)),endpointHeaders:e.endpointHeaders.map(t=>jm_(t)),queryParameters:e.queryParameters.map(t=>MeE(t)),request:e.request!=null?vP5(e.request):void 0,response:hP5(e.response)}}function hP5(e){switch(e.type){case"error":return ft.V51.ExampleResponse.error({...e,body:e.body!=null?Xue(e.body):void 0});case"ok":return ft.V51.ExampleResponse.ok(yP5(e))}}function yP5(e){switch(e.value.type){case"body":return ft.V51.ExampleEndpointSuccessResponse.body(e.value.value!=null?Xue(e.value.value):void 0);case"stream":return ft.V51.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>Xue(t)));case"sse":return ft.V51.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:Xue(t.data)})))}}function vP5(e){switch(e.type){case"inlinedRequestBody":return ft.V51.ExampleRequestBody.inlinedRequestBody(BeE(e));case"reference":return ft.V51.ExampleRequestBody.reference(Xue(e))}}var FeE={laterVersion:"v53",earlierVersion:"v52",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.38.0-rc0",[me.TYPESCRIPT_BROWSER_SDK]:"0.38.0-rc0",[me.TYPESCRIPT]:"0.38.0-rc0",[me.TYPESCRIPT_SDK]:"0.38.0-rc0",[me.TYPESCRIPT_EXPRESS]:"0.17.3",[me.JAVA]:Ut,[me.JAVA_MODEL]:"1.3.0",[me.JAVA_SDK]:"2.5.0",[me.JAVA_SPRING]:"1.3.0",[me.PYTHON_FASTAPI]:"1.1.0-rc0",[me.PYTHON_PYDANTIC]:"1.1.0-rc0",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:"0.1.0",[me.STOPLIGHT]:Ut,[me.POSTMAN]:"0.2.0",[me.PYTHON_SDK]:"3.3.0-rc0",[me.GO_FIBER]:"0.23.5",[me.GO_MODEL]:"0.23.5",[me.GO_SDK]:"0.28.3",[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:"0.5.0",[me.SWIFT_MODEL]:Ut,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:"0.1.0",[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V52.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?gP5(e.apiVersion):void 0,auth:SP5(e.auth),headers:e.headers.map(t=>RMa(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>RMa(t)),types:bP5(e.types),services:fg(e.services,t=>FP5(t)),webhookGroups:fg(e.webhookGroups,t=>PP5(t)),websocketChannels:fg(e.websocketChannels,t=>mP5(t)),errors:fg(e.errors,t=>ew5(t)),pathParameters:e.pathParameters.map(t=>cPs(t)),variables:e.variables.map(t=>zP5(t))})};function bP5(e){return fg(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>NeE(r)),userProvidedExamples:t.userProvidedExamples.map(r=>NeE(r)),shape:ft.V53.types.Type._visit(t.shape,{union:r=>ft.V52.types.Type.union({...r,baseProperties:r.baseProperties.map(n=>({...n,valueType:q6(n.valueType)})),types:r.types.map(n=>qP5(n))}),enum:ft.V52.types.Type.enum,object:r=>ft.V52.types.Type.object({...r,properties:r.properties.map(n=>({...n,valueType:q6(n.valueType)}))}),alias:r=>ft.V52.types.Type.alias({aliasOf:q6(r.aliasOf),resolvedType:NP5(r.resolvedType)}),undiscriminatedUnion:r=>ft.V52.types.Type.undiscriminatedUnion(xP5(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function gP5(e){return ft.V52.ApiVersionScheme.header({...e,header:RMa(e.header)})}function mP5(e){return{...e,headers:e.headers.map(t=>RMa(t)),queryParameters:e.queryParameters.map(t=>Mm_(t)),pathParameters:e.pathParameters.map(t=>cPs(t)),messages:e.messages.map(t=>OP5(t)),examples:e.examples.map(t=>tw5(t))}}function OP5(e){return{...e,body:AP5(e.body)}}function AP5(e){switch(e.type){case"inlinedBody":return ft.V52.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:q6(t.valueType)}))});case"reference":return ft.V52.websocket.WebSocketMessageBody.reference({...e,bodyType:q6(e.bodyType)})}}function PP5(e){return e.map(t=>wP5(t))}function wP5(e){return{...e,headers:e.headers.map(t=>RMa(t)),payload:jP5(e.payload),examples:e.examples!=null?e.examples.map(t=>EP5(t)):void 0}}function jP5(e){switch(e.type){case"reference":return ft.V52.webhooks.WebhookPayload.reference({...e,payloadType:q6(e.payloadType)});case"inlinedPayload":return ft.V52.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:q6(t.valueType)}))})}}function EP5(e){return{...e,payload:Zue(e.payload)}}function SP5(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return ft.V52.auth.AuthScheme.basic(t);case"bearer":return ft.V52.auth.AuthScheme.bearer(t);case"header":return ft.V52.auth.AuthScheme.header(DP5(t));case"oauth":return ft.V52.auth.AuthScheme.oauth(CP5(t))}})}}function DP5(e){return{...e,valueType:q6(e.valueType)}}function CP5(e){return{...e,configuration:ft.V52.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:IP5(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?MP5(e.configuration.refreshEndpoint):void 0})}}function IP5(e){return{...e,requestProperties:{clientId:zLi(e.requestProperties.clientId),clientSecret:zLi(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?zLi(e.requestProperties.scopes):void 0},responseProperties:{accessToken:VOi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?VOi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?VOi(e.responseProperties.refreshToken):void 0}}}function MP5(e){return{...e,requestProperties:{refreshToken:zLi(e.requestProperties.refreshToken)},responseProperties:{accessToken:VOi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?VOi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?VOi(e.responseProperties.refreshToken):void 0}}}function RMa(e){return{...e,valueType:q6(e.valueType)}}function q6(e){return ft.V53.types.TypeReference._visit(e,{container:t=>ft.V52.types.TypeReference.container(QeE(t)),primitive:t=>ft.V52.types.TypeReference.primitive(zeE(t)),named:ft.V52.types.TypeReference.named,unknown:ft.V52.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function zeE(e){return{v1:BP5(e.v1),v2:e.v2!=null?TP5(e.v2):void 0}}function BP5(e){switch(e){case"FLOAT":return ft.V52.types.PrimitiveTypeV1.Double}return e}function TP5(e){switch(e.type){case"integer":return ft.V52.types.PrimitiveTypeV2.integer(e);case"double":return ft.V52.types.PrimitiveTypeV2.double(e);case"string":return ft.V52.types.PrimitiveTypeV2.string(e);case"boolean":return ft.V52.types.PrimitiveTypeV2.boolean(e);case"long":return ft.V52.types.PrimitiveTypeV2.long(e);case"bigInteger":return ft.V52.types.PrimitiveTypeV2.bigInteger(e);case"uint":return ft.V52.types.PrimitiveTypeV2.uint();case"uint64":return ft.V52.types.PrimitiveTypeV2.uint64();case"date":return;case"dateTime":return;case"uuid":return;case"base64":return;case"float":return;default:fc(e)}}function QeE(e){return ft.V53.types.ContainerType._visit(e,{list:t=>ft.V52.types.ContainerType.list(q6(t)),optional:t=>ft.V52.types.ContainerType.optional(q6(t)),set:t=>ft.V52.types.ContainerType.set(q6(t)),map:({keyType:t,valueType:r})=>ft.V52.types.ContainerType.map({keyType:q6(t),valueType:q6(r)}),literal:ft.V52.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function qP5(e){return{...e,shape:RP5(e.shape)}}function RP5(e){return ft.V53.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>ft.V52.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>ft.V52.types.SingleUnionTypeProperties.singleProperty({...t,type:q6(t.type)}),noProperties:ft.V52.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function NP5(e){return ft.V53.types.ResolvedTypeReference._visit(e,{container:t=>ft.V52.types.ResolvedTypeReference.container(QeE(t)),named:ft.V52.types.ResolvedTypeReference.named,primitive:t=>ft.V52.types.ResolvedTypeReference.primitive(zeE(t)),unknown:ft.V52.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function xP5(e){return{members:e.members.map(t=>({...t,type:q6(t.type)}))}}function FP5(e){return{...e,pathParameters:e.pathParameters.map(t=>cPs(t)),headers:e.headers.map(t=>RMa(t)),endpoints:e.endpoints.map(t=>QP5(t))}}function cPs(e){return{...e,valueType:q6(e.valueType)}}function zP5(e){return{...e,type:q6(e.type)}}function QP5(e){return{...e,pagination:e.pagination!=null?HP5(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>cPs(t)),pathParameters:e.pathParameters.map(t=>cPs(t)),sdkRequest:e.sdkRequest!=null?$P5(e.sdkRequest):void 0,requestBody:e.requestBody!=null?ZP5(e.requestBody):void 0,response:e.response!=null?LP5(e.response):void 0,headers:e.headers.map(t=>RMa(t)),queryParameters:e.queryParameters.map(t=>Mm_(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:xeE(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?xeE(t.example):void 0}))}}function LP5(e){return{...e,body:e.body!=null?UP5(e.body):void 0}}function UP5(e){switch(e.type){case"json":return ft.V52.http.HttpResponseBody.json(LeE(e.value));case"fileDownload":return ft.V52.http.HttpResponseBody.fileDownload(e);case"text":return ft.V52.http.HttpResponseBody.text(e);case"streaming":return ft.V52.http.HttpResponseBody.streaming(UeE(e.value));case"streamParameter":return ft.V52.http.HttpResponseBody.streamParameter(WP5(e))}}function LeE(e){switch(e.type){case"response":return ft.V52.http.JsonResponse.response({...e,responseBodyType:q6(e.responseBodyType)});case"nestedPropertyAsResponse":return ft.V52.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:q6(e.responseBodyType),responseProperty:e.responseProperty!=null?Im_(e.responseProperty):void 0})}}function UeE(e){switch(e.type){case"json":return ft.V52.http.StreamingResponse.json({...e,payload:q6(e.payload)});case"text":return ft.V52.http.StreamingResponse.text(e);case"sse":return ft.V52.http.StreamingResponse.sse({...e,payload:q6(e.payload)})}}function VP5(e){switch(e.type){case"json":return ft.V52.http.NonStreamHttpResponseBody.json(LeE(e.value));case"text":return ft.V52.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return ft.V52.http.NonStreamHttpResponseBody.fileDownload(e)}}function WP5(e){return{nonStreamResponse:VP5(e.nonStreamResponse),streamResponse:UeE(e.streamResponse)}}function HP5(e){switch(e.type){case"cursor":return ft.V52.http.Pagination.cursor(GP5(e));case"offset":return ft.V52.http.Pagination.offset(JP5(e))}}function GP5(e){return{...e,page:zLi(e.page),next:VOi(e.next),results:VOi(e.results)}}function JP5(e){return{...e,page:zLi(e.page),results:VOi(e.results),step:e.step!=null?zLi(e.step):void 0}}function zLi(e){return{...e,property:KP5(e.property)}}function KP5(e){switch(e.type){case"query":return ft.V52.RequestPropertyValue.query(Mm_(e));case"body":return ft.V52.RequestPropertyValue.body(Im_(e))}}function VOi(e){return{...e,property:Im_(e.property)}}function Im_(e){return{...e,valueType:q6(e.valueType)}}function Mm_(e){return{...e,valueType:q6(e.valueType)}}function $P5(e){return{...e,streamParameter:e.streamParameter!=null?zLi(e.streamParameter):void 0,shape:YP5(e.shape)}}function YP5(e){return ft.V53.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V52.http.SdkRequestShape.justRequestBody(XP5(t)),wrapper:ft.V52.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function XP5(e){switch(e.type){case"bytes":return ft.V52.http.SdkRequestBodyType.bytes(e);case"typeReference":return ft.V52.http.SdkRequestBodyType.typeReference({...e,requestBodyType:q6(e.requestBodyType)})}}function ZP5(e){return ft.V53.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V52.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:q6(r.valueType)}))}),reference:t=>ft.V52.http.HttpRequestBody.reference({...t,requestBodyType:q6(t.requestBodyType)}),fileUpload:t=>ft.V52.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return ft.V52.http.FileUploadRequestProperty.bodyProperty({...r,valueType:q6(r.valueType)});case"file":return ft.V52.http.FileUploadRequestProperty.file(kP5(r.value))}})}),bytes:t=>ft.V52.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function kP5(e){switch(e.type){case"file":return ft.V52.http.FileProperty.file(e);case"fileArray":return ft.V52.http.FileProperty.fileArray(e)}}function ew5(e){return{...e,type:e.type!=null?q6(e.type):void 0,examples:e.examples.map(t=>({...t,shape:Zue(t.shape)}))}}function tw5(e){return{...e,pathParameters:e.pathParameters.map(t=>Htl(t)),headers:e.headers.map(t=>Cm_(t)),queryParameters:e.queryParameters.map(t=>VeE(t)),messages:e.messages.map(t=>({...t,body:rw5(t.body)}))}}function VeE(e){return{...e,value:Zue(e.value)}}function Cm_(e){return{...e,value:Zue(e.value)}}function Htl(e){return{...e,value:Zue(e.value)}}function rw5(e){switch(e.type){case"inlinedBody":return ft.V52.ExampleWebSocketMessageBody.inlinedBody(WeE(e));case"reference":return ft.V52.ExampleWebSocketMessageBody.reference(Zue(e))}}function WeE(e){return{...e,properties:e.properties.map(t=>({...t,value:Zue(t.value)}))}}function NeE(e){return{...e,shape:GeE(e.shape)}}function Bm_(e){switch(e.type){case"primitive":return ft.V52.ExampleTypeReferenceShape.primitive(nw5(e));case"container":return ft.V52.ExampleTypeReferenceShape.container(iw5(e));case"unknown":return ft.V52.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return ft.V52.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:GeE(e.shape)})}}function HeE(e){switch(e.type){case"integer":return ft.V52.ExamplePrimitive.integer(e.integer);case"uint":return ft.V52.ExamplePrimitive.integer(e.uint);case"uint64":return ft.V52.ExamplePrimitive.integer(e.uint64);case"float":return ft.V52.ExamplePrimitive.double(e.float);case"double":return ft.V52.ExamplePrimitive.double(e.double);case"long":return ft.V52.ExamplePrimitive.long(e.long);case"boolean":return ft.V52.ExamplePrimitive.boolean(e.boolean);case"string":return ft.V52.ExamplePrimitive.string(e.string);case"date":return ft.V52.ExamplePrimitive.date(e.date);case"datetime":return ft.V52.ExamplePrimitive.datetime(e.datetime);case"uuid":return ft.V52.ExamplePrimitive.uuid(e.uuid);case"base64":return ft.V52.ExamplePrimitive.string({original:e.base64});case"bigInteger":return ft.V52.ExamplePrimitive.string({original:e.bigInteger})}}function nw5(e){return HeE(e.primitive)}function iw5(e){switch(e.container.type){case"list":return ft.V52.ExampleContainer.list({list:e.container.list.map(t=>Zue(t)),itemType:q6(e.container.itemType)});case"set":return ft.V52.ExampleContainer.set({set:e.container.set.map(t=>Zue(t)),itemType:q6(e.container.itemType)});case"optional":return ft.V52.ExampleContainer.optional({optional:e.container.optional!=null?Zue(e.container.optional):void 0,valueType:q6(e.container.valueType)});case"map":return ft.V52.ExampleContainer.map({map:e.container.map.map(t=>({key:Zue(t.key),value:Zue(t.value)})),keyType:q6(e.container.keyType),valueType:q6(e.container.valueType)});case"literal":return ft.V52.ExampleContainer.literal({literal:HeE(e.container.literal)})}}function Zue(e){return{...e,shape:Bm_(e.shape)}}function GeE(e){switch(e.type){case"object":return ft.V52.ExampleTypeShape.object({properties:e.properties.map(t=>JeE(t))});case"alias":return ft.V52.ExampleTypeShape.alias({value:{...Zue(e.value)}});case"enum":return ft.V52.ExampleTypeShape.enum(e);case"union":return ft.V52.ExampleTypeShape.union(ow5(e));case"undiscriminatedUnion":return ft.V52.ExampleTypeShape.undiscriminatedUnion(aw5(e))}}function aw5(e){return{...e,singleUnionType:Zue(e.singleUnionType)}}function ow5(e){return{...e,singleUnionType:sw5(e.singleUnionType)}}function sw5(e){return{...e,shape:uw5(e.shape)}}function uw5(e){switch(e.type){case"samePropertiesAsObject":return ft.V52.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:cw5(e.object)});case"singleProperty":return ft.V52.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:Bm_(e.shape)});case"noProperties":return ft.V52.ExampleSingleUnionTypeProperties.noProperties()}}function cw5(e){return{...e,properties:e.properties.map(t=>JeE(t))}}function JeE(e){return{...e,value:{...e.value,shape:Bm_(e.value.shape)}}}function xeE(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>Htl(t)),servicePathParameters:e.servicePathParameters.map(t=>Htl(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Htl(t)),serviceHeaders:e.serviceHeaders.map(t=>Cm_(t)),endpointHeaders:e.endpointHeaders.map(t=>Cm_(t)),queryParameters:e.queryParameters.map(t=>VeE(t)),request:e.request!=null?dw5(e.request):void 0,response:lw5(e.response)}}function lw5(e){switch(e.type){case"error":return ft.V52.ExampleResponse.error({...e,body:e.body!=null?Zue(e.body):void 0});case"ok":return ft.V52.ExampleResponse.ok(fw5(e))}}function fw5(e){switch(e.value.type){case"body":return ft.V52.ExampleEndpointSuccessResponse.body(e.value.value!=null?Zue(e.value.value):void 0);case"stream":return ft.V52.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>Zue(t)));case"sse":return ft.V52.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:Zue(t.data)})))}}function dw5(e){switch(e.type){case"inlinedRequestBody":return ft.V52.ExampleRequestBody.inlinedRequestBody(WeE(e));case"reference":return ft.V52.ExampleRequestBody.reference(Zue(e))}}var KeE={laterVersion:"v54",earlierVersion:"v53",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Ut,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Ut,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V53.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:fg(e.services,t=>({...t,endpoints:t.endpoints.map(r=>({...r,response:pw5(r.response)}))}))})};function pw5(e){if(e!=null)return{statusCode:e.statusCode,body:e.body?.type==="bytes"?ft.V53.HttpResponseBody.fileDownload({docs:void 0}):e.body}}var XeE={laterVersion:"v55",earlierVersion:"v54",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.47.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.47.0",[me.TYPESCRIPT]:"0.47.0",[me.TYPESCRIPT_SDK]:"0.47.0",[me.TYPESCRIPT_EXPRESS]:"0.17.7",[me.JAVA]:Ut,[me.JAVA_MODEL]:"1.7.0",[me.JAVA_SDK]:"2.16.0",[me.JAVA_SPRING]:"1.5.0",[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:"1.10.1",[me.SWIFT_MODEL]:Ut,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:"0.3.2",[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V54.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?hw5(e.apiVersion):void 0,auth:Pw5(e.auth),headers:e.headers.map(t=>NMa(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>NMa(t)),types:_w5(e.types),services:fg(e.services,t=>Bw5(t)),webhookGroups:fg(e.webhookGroups,t=>gw5(t)),websocketChannels:fg(e.websocketChannels,t=>yw5(t)),errors:fg(e.errors,t=>Kw5(t)),pathParameters:e.pathParameters.map(t=>lPs(t)),variables:e.variables.map(t=>Tw5(t)),dynamic:e.dynamic!=null?sj5(e.dynamic):void 0})};function _w5(e){return fg(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>$eE(r)),userProvidedExamples:t.userProvidedExamples.map(r=>$eE(r)),shape:ft.V55.types.Type._visit(t.shape,{union:r=>ft.V54.types.Type.union({...r,baseProperties:r.baseProperties.map(n=>({...n,valueType:ET(n.valueType)})),types:r.types.map(n=>Dw5(n))}),enum:ft.V54.types.Type.enum,object:r=>ft.V54.types.Type.object({...r,properties:r.properties.map(n=>({...n,valueType:ET(n.valueType)})),extendedProperties:r.extendedProperties?.map(n=>({...n,valueType:ET(n.valueType)}))}),alias:r=>ft.V54.types.Type.alias({aliasOf:ET(r.aliasOf),resolvedType:Iw5(r.resolvedType)}),undiscriminatedUnion:r=>ft.V54.types.Type.undiscriminatedUnion(Mw5(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function hw5(e){return ft.V54.ApiVersionScheme.header({...e,header:NMa(e.header)})}function yw5(e){return{...e,headers:e.headers.map(t=>NMa(t)),queryParameters:e.queryParameters.map(t=>Rm_(t)),pathParameters:e.pathParameters.map(t=>lPs(t)),messages:e.messages.map(t=>vw5(t)),examples:e.examples.map(t=>$w5(t))}}function vw5(e){return{...e,body:bw5(e.body)}}function bw5(e){switch(e.type){case"inlinedBody":return ft.V54.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:ET(t.valueType)}))});case"reference":return ft.V54.websocket.WebSocketMessageBody.reference({...e,bodyType:ET(e.bodyType)})}}function gw5(e){return e.map(t=>mw5(t))}function mw5(e){return{...e,headers:e.headers.map(t=>NMa(t)),payload:Ow5(e.payload),examples:e.examples!=null?e.examples.map(t=>Aw5(t)):void 0}}function Ow5(e){switch(e.type){case"reference":return ft.V54.webhooks.WebhookPayload.reference({...e,payloadType:ET(e.payloadType)});case"inlinedPayload":return ft.V54.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:ET(t.valueType)}))})}}function Aw5(e){return{...e,payload:rae(e.payload)}}function Pw5(e){return{...e,schemes:e.schemes.map(t=>{switch(t.type){case"basic":return ft.V54.auth.AuthScheme.basic(t);case"bearer":return ft.V54.auth.AuthScheme.bearer(t);case"header":return ft.V54.auth.AuthScheme.header(ww5(t));case"oauth":return ft.V54.auth.AuthScheme.oauth(jw5(t))}})}}function ww5(e){return{...e,valueType:ET(e.valueType)}}function jw5(e){return{...e,configuration:ft.V54.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:Ew5(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?Sw5(e.configuration.refreshEndpoint):void 0})}}function Ew5(e){return{...e,requestProperties:{clientId:QLi(e.requestProperties.clientId),clientSecret:QLi(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?QLi(e.requestProperties.scopes):void 0},responseProperties:{accessToken:hai(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?hai(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?hai(e.responseProperties.refreshToken):void 0}}}function Sw5(e){return{...e,requestProperties:{refreshToken:QLi(e.requestProperties.refreshToken)},responseProperties:{accessToken:hai(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?hai(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?hai(e.responseProperties.refreshToken):void 0}}}function NMa(e){return{...e,valueType:ET(e.valueType)}}function ET(e){return e.type==="container"&&e.container.type==="nullable"?mj5(e.container.nullable):e.type==="container"&&e.container.type==="optional"?gj5(e.container.optional):ft.V55.types.TypeReference._visit(e,{container:t=>ft.V54.types.TypeReference.container(keE(t)),primitive:t=>ft.V54.types.TypeReference.primitive(ZeE(t)),named:ft.V54.types.TypeReference.named,unknown:ft.V54.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function ZeE(e){return{v1:e.v1,v2:e.v2!=null?e.v2:void 0}}function keE(e){return ft.V55.types.ContainerType._visit(e,{list:t=>ft.V54.types.ContainerType.list(ET(t)),optional:t=>ft.V54.types.ContainerType.optional(ET(t)),nullable:t=>ft.V54.types.ContainerType.optional(ET(t)),set:t=>ft.V54.types.ContainerType.set(ET(t)),map:({keyType:t,valueType:r})=>ft.V54.types.ContainerType.map({keyType:ET(t),valueType:ET(r)}),literal:ft.V54.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function Dw5(e){return{...e,shape:Cw5(e.shape)}}function Cw5(e){return ft.V55.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>ft.V54.types.SingleUnionTypeProperties.samePropertiesAsObject(t),singleProperty:t=>ft.V54.types.SingleUnionTypeProperties.singleProperty({...t,type:ET(t.type)}),noProperties:ft.V54.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function Iw5(e){return ft.V55.types.ResolvedTypeReference._visit(e,{container:t=>ft.V54.types.ResolvedTypeReference.container(keE(t)),named:ft.V54.types.ResolvedTypeReference.named,primitive:t=>ft.V54.types.ResolvedTypeReference.primitive(ZeE(t)),unknown:ft.V54.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function Mw5(e){return{members:e.members.map(t=>({...t,type:ET(t.type)}))}}function Bw5(e){return{...e,pathParameters:e.pathParameters.map(t=>lPs(t)),headers:e.headers.map(t=>NMa(t)),endpoints:e.endpoints.map(t=>qw5(t))}}function lPs(e){return{...e,valueType:ET(e.valueType)}}function Tw5(e){return{...e,type:ET(e.type)}}function qw5(e){return{...e,pagination:e.pagination!=null?zw5(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>lPs(t)),pathParameters:e.pathParameters.map(t=>lPs(t)),sdkRequest:e.sdkRequest!=null?Vw5(e.sdkRequest):void 0,requestBody:e.requestBody!=null?Gw5(e.requestBody):void 0,response:e.response!=null?Rw5(e.response):void 0,headers:e.headers.map(t=>NMa(t)),queryParameters:e.queryParameters.map(t=>Rm_(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:YeE(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?YeE(t.example):void 0}))}}function Rw5(e){return{...e,body:e.body!=null?Nw5(e.body):void 0}}function Nw5(e){switch(e.type){case"json":return ft.V54.http.HttpResponseBody.json(etE(e.value));case"fileDownload":return ft.V54.http.HttpResponseBody.fileDownload(e);case"bytes":return ft.V54.http.HttpResponseBody.bytes(e);case"text":return ft.V54.http.HttpResponseBody.text(e);case"streaming":return ft.V54.http.HttpResponseBody.streaming(ttE(e.value));case"streamParameter":return ft.V54.http.HttpResponseBody.streamParameter(Fw5(e));default:fc(e)}}function etE(e){switch(e.type){case"response":return ft.V54.http.JsonResponse.response({...e,responseBodyType:ET(e.responseBodyType)});case"nestedPropertyAsResponse":return ft.V54.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:ET(e.responseBodyType),responseProperty:e.responseProperty!=null?qm_(e.responseProperty):void 0})}}function ttE(e){switch(e.type){case"json":return ft.V54.http.StreamingResponse.json({...e,payload:ET(e.payload)});case"text":return ft.V54.http.StreamingResponse.text(e);case"sse":return ft.V54.http.StreamingResponse.sse({...e,payload:ET(e.payload)})}}function xw5(e){switch(e.type){case"json":return ft.V54.http.NonStreamHttpResponseBody.json(etE(e.value));case"bytes":return ft.V54.http.NonStreamHttpResponseBody.bytes(e);case"text":return ft.V54.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return ft.V54.http.NonStreamHttpResponseBody.fileDownload(e);default:fc(e)}}function Fw5(e){return{nonStreamResponse:xw5(e.nonStreamResponse),streamResponse:ttE(e.streamResponse)}}function zw5(e){switch(e.type){case"cursor":return ft.V54.http.Pagination.cursor(Qw5(e));case"offset":return ft.V54.http.Pagination.offset(Lw5(e))}}function Qw5(e){return{...e,page:QLi(e.page),next:hai(e.next),results:hai(e.results)}}function Lw5(e){return{...e,page:QLi(e.page),results:hai(e.results),step:e.step!=null?QLi(e.step):void 0,hasNextPage:e.hasNextPage!=null?hai(e.hasNextPage):void 0}}function QLi(e){return{...e,property:Uw5(e.property)}}function Uw5(e){switch(e.type){case"query":return ft.V54.RequestPropertyValue.query(Rm_(e));case"body":return ft.V54.RequestPropertyValue.body(qm_(e))}}function hai(e){return{...e,property:qm_(e.property)}}function qm_(e){return{...e,valueType:ET(e.valueType)}}function Rm_(e){return{...e,valueType:ET(e.valueType)}}function Vw5(e){return{...e,streamParameter:e.streamParameter!=null?QLi(e.streamParameter):void 0,shape:Ww5(e.shape)}}function Ww5(e){return ft.V55.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V54.http.SdkRequestShape.justRequestBody(Hw5(t)),wrapper:ft.V54.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function Hw5(e){switch(e.type){case"bytes":return ft.V54.http.SdkRequestBodyType.bytes(e);case"typeReference":return ft.V54.http.SdkRequestBodyType.typeReference({...e,requestBodyType:ET(e.requestBodyType)})}}function Gw5(e){return ft.V55.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V54.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:ET(r.valueType)})),extendedProperties:t.extendedProperties?.map(r=>({...r,valueType:ET(r.valueType)}))}),reference:t=>ft.V54.http.HttpRequestBody.reference({...t,requestBodyType:ET(t.requestBodyType)}),fileUpload:t=>ft.V54.http.HttpRequestBody.fileUpload({...t,properties:t.properties.map(r=>{switch(r.type){case"bodyProperty":return ft.V54.http.FileUploadRequestProperty.bodyProperty({...r,valueType:ET(r.valueType)});case"file":return ft.V54.http.FileUploadRequestProperty.file(Jw5(r.value))}})}),bytes:t=>ft.V54.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Jw5(e){switch(e.type){case"file":return ft.V54.http.FileProperty.file(e);case"fileArray":return ft.V54.http.FileProperty.fileArray(e)}}function Kw5(e){return{...e,type:e.type!=null?ET(e.type):void 0,examples:e.examples.map(t=>({...t,shape:rae(t.shape)}))}}function $w5(e){return{...e,pathParameters:e.pathParameters.map(t=>Gtl(t)),headers:e.headers.map(t=>Tm_(t)),queryParameters:e.queryParameters.map(t=>rtE(t)),messages:e.messages.map(t=>({...t,body:Yw5(t.body)}))}}function rtE(e){return{...e,value:rae(e.value)}}function Tm_(e){return{...e,value:rae(e.value)}}function Gtl(e){return{...e,value:rae(e.value)}}function Yw5(e){switch(e.type){case"inlinedBody":return ft.V54.ExampleWebSocketMessageBody.inlinedBody(ntE(e));case"reference":return ft.V54.ExampleWebSocketMessageBody.reference(rae(e))}}function ntE(e){return{...e,properties:e.properties.map(t=>({...t,value:rae(t.value)}))}}function $eE(e){return{...e,shape:itE(e.shape)}}function Nm_(e){switch(e.type){case"primitive":return ft.V54.ExampleTypeReferenceShape.primitive(Xw5(e));case"container":return ft.V54.ExampleTypeReferenceShape.container(Zw5(e));case"unknown":return ft.V54.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return ft.V54.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:itE(e.shape)})}}function Xw5(e){return e.primitive}function Zw5(e){switch(e.container.type){case"list":return ft.V54.ExampleContainer.list({list:e.container.list.map(t=>rae(t)),itemType:ET(e.container.itemType)});case"set":return ft.V54.ExampleContainer.set({set:e.container.set.map(t=>rae(t)),itemType:ET(e.container.itemType)});case"optional":return ft.V54.ExampleContainer.optional({optional:e.container.optional!=null?rae(e.container.optional):void 0,valueType:ET(e.container.valueType)});case"nullable":return ft.V54.ExampleContainer.optional({optional:e.container.nullable!=null?rae(e.container.nullable):void 0,valueType:ET(e.container.valueType)});case"map":return ft.V54.ExampleContainer.map({map:e.container.map.map(t=>({key:rae(t.key),value:rae(t.value)})),keyType:ET(e.container.keyType),valueType:ET(e.container.valueType)});case"literal":return ft.V54.ExampleContainer.literal({literal:e.container.literal})}}function rae(e){return{...e,shape:Nm_(e.shape)}}function itE(e){switch(e.type){case"object":return ft.V54.ExampleTypeShape.object({properties:e.properties.map(t=>atE(t))});case"alias":return ft.V54.ExampleTypeShape.alias({value:{...rae(e.value)}});case"enum":return ft.V54.ExampleTypeShape.enum(e);case"union":return ft.V54.ExampleTypeShape.union(ej5(e));case"undiscriminatedUnion":return ft.V54.ExampleTypeShape.undiscriminatedUnion(kw5(e))}}function kw5(e){return{...e,singleUnionType:rae(e.singleUnionType)}}function ej5(e){return{...e,singleUnionType:tj5(e.singleUnionType)}}function tj5(e){return{...e,shape:rj5(e.shape)}}function rj5(e){switch(e.type){case"samePropertiesAsObject":return ft.V54.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:nj5(e.object)});case"singleProperty":return ft.V54.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:Nm_(e.shape)});case"noProperties":return ft.V54.ExampleSingleUnionTypeProperties.noProperties()}}function nj5(e){return{...e,properties:e.properties.map(t=>atE(t))}}function atE(e){return{...e,value:{...e.value,shape:Nm_(e.value.shape)}}}function YeE(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>Gtl(t)),servicePathParameters:e.servicePathParameters.map(t=>Gtl(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Gtl(t)),serviceHeaders:e.serviceHeaders.map(t=>Tm_(t)),endpointHeaders:e.endpointHeaders.map(t=>Tm_(t)),queryParameters:e.queryParameters.map(t=>rtE(t)),request:e.request!=null?oj5(e.request):void 0,response:ij5(e.response)}}function ij5(e){switch(e.type){case"error":return ft.V54.ExampleResponse.error({...e,body:e.body!=null?rae(e.body):void 0});case"ok":return ft.V54.ExampleResponse.ok(aj5(e))}}function aj5(e){switch(e.value.type){case"body":return ft.V54.ExampleEndpointSuccessResponse.body(e.value.value!=null?rae(e.value.value):void 0);case"stream":return ft.V54.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>rae(t)));case"sse":return ft.V54.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:rae(t.data)})))}}function oj5(e){switch(e.type){case"inlinedRequestBody":return ft.V54.ExampleRequestBody.inlinedRequestBody(ntE(e));case"reference":return ft.V54.ExampleRequestBody.reference(rae(e))}}function sj5(e){return{...e,types:fg(e.types,t=>uj5(t)),endpoints:fg(e.endpoints,t=>cj5(t)),headers:e.headers?.map(t=>Ijr(t))}}function uj5(e){switch(e.type){case"alias":return ft.V54.dynamic.NamedType.alias({...e,typeReference:yst(e.typeReference)});case"enum":return ft.V54.dynamic.NamedType.enum(e);case"object":return ft.V54.dynamic.NamedType.object({...e,properties:e.properties.map(t=>Ijr(t))});case"discriminatedUnion":return ft.V54.dynamic.NamedType.discriminatedUnion({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,fj5(r)]))});case"undiscriminatedUnion":return ft.V54.dynamic.NamedType.undiscriminatedUnion({...e,types:e.types.map(t=>yst(t))});default:fc(e)}}function cj5(e){return{...e,auth:e.auth!=null?lj5(e.auth):void 0,request:dj5(e.request)}}function lj5(e){switch(e.type){case"basic":return ft.V54.dynamic.Auth.basic(e);case"bearer":return ft.V54.dynamic.Auth.bearer(e);case"header":return ft.V54.dynamic.Auth.header({header:Ijr(e.header)})}}function yst(e){switch(e.type){case"list":return ft.V54.dynamic.TypeReference.list(yst(e.value));case"optional":return Aj5(e.value);case"nullable":return Oj5(e.value);case"map":return ft.V54.dynamic.TypeReference.map({...e,key:yst(e.key),value:yst(e.value)});case"literal":return ft.V54.dynamic.TypeReference.literal(e.value);case"named":return ft.V54.dynamic.TypeReference.named(e.value);case"primitive":return ft.V54.dynamic.TypeReference.primitive(e.value);case"set":return ft.V54.dynamic.TypeReference.set(yst(e.value));case"unknown":return ft.V54.dynamic.TypeReference.unknown();default:fc(e)}}function fj5(e){switch(e.type){case"samePropertiesAsObject":return ft.V54.dynamic.SingleDiscriminatedUnionType.samePropertiesAsObject({...e,properties:e.properties.map(t=>Ijr(t))});case"singleProperty":return ft.V54.dynamic.SingleDiscriminatedUnionType.singleProperty({...e,typeReference:yst(e.typeReference),properties:e.properties?.map(t=>Ijr(t))});case"noProperties":return ft.V54.dynamic.SingleDiscriminatedUnionType.noProperties({...e,properties:e.properties?.map(t=>Ijr(t))});default:fc(e)}}function Ijr(e){return{...e,typeReference:yst(e.typeReference)}}function dj5(e){switch(e.type){case"body":return ft.V54.dynamic.Request.body(pj5(e));case"inlined":return ft.V54.dynamic.Request.inlined(_j5(e));default:fc(e)}}function pj5(e){return{pathParameters:e.pathParameters?.map(t=>Ijr(t)),body:e.body!=null?otE(e.body):void 0}}function _j5(e){return{...e,pathParameters:e.pathParameters?.map(t=>Ijr(t)),queryParameters:e.queryParameters?.map(t=>Ijr(t)),headers:e.headers?.map(t=>Ijr(t)),body:e.body!=null?hj5(e.body):void 0}}function hj5(e){switch(e.type){case"properties":return ft.V54.dynamic.InlinedRequestBody.properties(e.value.map(t=>Ijr(t)));case"referenced":return ft.V54.dynamic.InlinedRequestBody.referenced(yj5(e));case"fileUpload":return ft.V54.dynamic.InlinedRequestBody.fileUpload(vj5(e));default:fc(e)}}function yj5(e){return{...e,bodyType:otE(e.bodyType)}}function otE(e){switch(e.type){case"bytes":return ft.V54.dynamic.ReferencedRequestBodyType.bytes();case"typeReference":return ft.V54.dynamic.ReferencedRequestBodyType.typeReference(yst(e.value));default:fc(e)}}function vj5(e){return{properties:e.properties.map(t=>bj5(t))}}function bj5(e){switch(e.type){case"file":return ft.V54.dynamic.FileUploadRequestBodyProperty.file(e);case"fileArray":return ft.V54.dynamic.FileUploadRequestBodyProperty.fileArray(e);case"bodyProperty":return ft.V54.dynamic.FileUploadRequestBodyProperty.bodyProperty(Ijr(e));default:fc(e)}}function gj5(e){return e.type==="container"&&e.container.type==="nullable"?ft.V54.types.TypeReference.container(ft.V54.types.ContainerType.optional(ET(e.container.nullable))):ft.V54.types.TypeReference.container(ft.V54.types.ContainerType.optional(ET(e)))}function mj5(e){return e.type==="container"&&e.container.type==="optional"?ET(e):ft.V54.types.TypeReference.container(ft.V54.types.ContainerType.optional(ET(e)))}function Oj5(e){return e.type==="optional"?yst(e):ft.V54.dynamic.TypeReference.optional(yst(e))}function Aj5(e){return e.type==="nullable"?ft.V54.dynamic.TypeReference.optional(yst(e.value)):ft.V54.dynamic.TypeReference.optional(yst(e))}var stE={laterVersion:"v56",earlierVersion:"v55",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Ut,[me.TYPESCRIPT_BROWSER_SDK]:Ut,[me.TYPESCRIPT]:Ut,[me.TYPESCRIPT_SDK]:Ut,[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.PYTHON_SDK]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:"0.0.2",[me.CSHARP_SDK]:"1.12.0-rc0",[me.SWIFT_MODEL]:Ut,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:Ut,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V55.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:fg(e.services,t=>Pj5(t))})};function Pj5(e){return{...e,endpoints:e.endpoints.map(t=>wj5(t))}}function wj5(e){return{...e,pagination:jj5(e.pagination)}}function jj5(e){if(e!=null)switch(e.type){case"cursor":return ft.V55.http.Pagination.cursor({next:e.next,page:e.page,results:e.results});case"offset":return ft.V55.http.Pagination.offset({hasNextPage:e.hasNextPage,page:e.page,results:e.results,step:e.step});case"custom":return;default:fc(e)}}var utE={laterVersion:"v57",earlierVersion:"v56",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.49.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.49.0",[me.TYPESCRIPT]:"0.49.0",[me.TYPESCRIPT_SDK]:"0.49.0",[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:"1.8.0",[me.JAVA_SDK]:"2.34.0",[me.JAVA_SPRING]:"1.6.0",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.PYTHON_FASTAPI]:"1.6.3",[me.PYTHON_PYDANTIC]:"1.4.8",[me.PYTHON_SDK]:"4.3.19",[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.GO_FIBER]:"0.23.6",[me.GO_MODEL]:"0.23.6",[me.GO_SDK]:"0.37.0",[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:"1.12.0-rc11",[me.SWIFT_MODEL]:Ut,[me.SWIFT_SDK]:Hn,[me.PHP_MODEL]:Hn,[me.PHP_SDK]:"0.14.1",[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Hn},jsonifyEarlierVersion:e=>Bm.V56.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,dynamic:e.dynamic!=null?Ej5(e.dynamic):void 0})};function Ej5(e){return{...e,endpoints:Sj5(e.endpoints)}}function Sj5(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Dj5(r)]).filter(([t,r])=>r!=null))}function Dj5(e){return{...e,auth:e.auth!=null?Mj5(e.auth):void 0,examples:e.examples!=null?Cj5(e.examples):void 0}}function Cj5(e){return e.map(t=>Ij5(t)).filter(t=>t!=null)}function Ij5(e){return{...e,auth:e.auth!=null?Bj5(e.auth):void 0}}function Mj5(e){switch(e.type){case"basic":return ft.V56.dynamic.Auth.basic(e);case"bearer":return ft.V56.dynamic.Auth.bearer(e);case"header":return ft.V56.dynamic.Auth.header(e);case"oauth":return;default:fc(e)}}function Bj5(e){switch(e.type){case"basic":return ft.V56.dynamic.AuthValues.basic(e);case"bearer":return ft.V56.dynamic.AuthValues.bearer(e);case"header":return ft.V56.dynamic.AuthValues.header(e);case"oauth":return;default:fc(e)}}var ctE={laterVersion:"v58",earlierVersion:"v57",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"1.2.0",[me.TYPESCRIPT_BROWSER_SDK]:"1.2.0",[me.TYPESCRIPT]:"1.2.0",[me.TYPESCRIPT_SDK]:"1.2.0",[me.TYPESCRIPT_EXPRESS]:"0.18.0",[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:"2.36.5",[me.JAVA_SPRING]:"1.6.1",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.PYTHON_FASTAPI]:"1.7.0",[me.PYTHON_PYDANTIC]:"1.5.0",[me.PYTHON_SDK]:"4.21.0",[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:"1.1.0",[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:"1.17.5",[me.SWIFT_MODEL]:Ut,[me.SWIFT_SDK]:"0.1.0",[me.PHP_MODEL]:Ut,[me.PHP_SDK]:"1.15.1",[me.RUST_MODEL]:Hn,[me.RUST_SDK]:"0.0.0"},jsonifyEarlierVersion:e=>Bm.V57.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:e.services!=null?Tj5(e.services):void 0,dynamic:e.dynamic!=null?xj5(e.dynamic):void 0})};function Tj5(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,qj5(r)]))}function qj5(e){return{...e,endpoints:Rj5(e.endpoints)}}function Rj5(e){return e.map(Nj5).filter(t=>t!=null)}function Nj5(e){if(e.method!=="HEAD")return{...e,method:e.method}}function xj5(e){return{...e,endpoints:Fj5(e.endpoints)}}function Fj5(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,zj5(r)]).filter(([t,r])=>r!=null))}function zj5(e){let t=e.location.method;if(t!=="HEAD")return{...e,examples:e.examples!=null?Qj5(e.examples):void 0,location:{...e.location,method:t}}}function Qj5(e){return e.map(t=>Lj5(t)).filter(t=>t!=null)}function Lj5(e){let t=e.endpoint.method;if(t!=="HEAD")return{...e,endpoint:{...e.endpoint,method:t}}}var ltE={laterVersion:"v59",earlierVersion:"v58",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"2.6.8",[me.TYPESCRIPT_BROWSER_SDK]:"2.6.8",[me.TYPESCRIPT]:"2.6.8",[me.TYPESCRIPT_SDK]:"2.6.8",[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:"1.8.1",[me.JAVA_SDK]:"2.43.0",[me.JAVA_SPRING]:"1.8.2",[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.PYTHON_FASTAPI]:"1.8.0",[me.PYTHON_PYDANTIC]:"1.6.0",[me.PYTHON_SDK]:"4.26.0",[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.GO_FIBER]:"0.23.7",[me.GO_MODEL]:"0.23.7",[me.GO_SDK]:"1.7.0",[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:"1.0.0-rc26",[me.CSHARP_MODEL]:"0.0.3",[me.CSHARP_SDK]:"2.2.0",[me.SWIFT_MODEL]:"0.0.1",[me.SWIFT_SDK]:"0.16.0",[me.PHP_MODEL]:Ut,[me.PHP_SDK]:"1.17.0",[me.RUST_MODEL]:Hn,[me.RUST_SDK]:"0.1.1"},jsonifyEarlierVersion:e=>Bm.V58.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,dynamic:e.dynamic!=null?Vj5(e.dynamic):void 0,auth:e.auth!=null?Uj5(e.auth):void 0})};function Uj5(e){return{...e,schemes:e.schemes.filter(t=>t.type!=="inferred")}}function Vj5(e){return{...e,endpoints:Wj5(e.endpoints)}}function Wj5(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Hj5(r)]).filter(([t,r])=>r!=null))}function Hj5(e){return{...e,examples:e.examples!=null?Jj5(e.examples):void 0,auth:Gj5(e.auth)}}function Gj5(e){return e==null?e:e._visit({basic:t=>ft.V58.dynamic.Auth.basic(t),bearer:t=>ft.V58.dynamic.Auth.bearer(t),header:t=>ft.V58.dynamic.Auth.header(t),oauth:t=>ft.V58.dynamic.Auth.oauth(t),inferred:()=>{},_other:()=>{}})}function Jj5(e){return e.map(t=>Kj5(t)).filter(t=>t!=null)}function Kj5(e){return{...e,auth:$j5(e.auth)}}function $j5(e){if(e==null)return e;if(e.type!=="inferred")return e}var ftE={laterVersion:"v60",earlierVersion:"v59",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"2.11.2",[me.TYPESCRIPT_BROWSER_SDK]:"2.11.2",[me.TYPESCRIPT]:"2.11.2",[me.TYPESCRIPT_SDK]:"2.11.2",[me.TYPESCRIPT_EXPRESS]:Ut,[me.JAVA]:Ut,[me.JAVA_MODEL]:Ut,[me.JAVA_SDK]:Ut,[me.JAVA_SPRING]:Ut,[me.OPENAPI_PYTHON_CLIENT]:Ut,[me.OPENAPI]:Ut,[me.PYTHON_FASTAPI]:Ut,[me.PYTHON_PYDANTIC]:Ut,[me.PYTHON_SDK]:Ut,[me.STOPLIGHT]:Ut,[me.POSTMAN]:Ut,[me.GO_FIBER]:Ut,[me.GO_MODEL]:Ut,[me.GO_SDK]:Ut,[me.RUBY_MODEL]:Ut,[me.RUBY_SDK]:Ut,[me.CSHARP_MODEL]:Ut,[me.CSHARP_SDK]:Ut,[me.SWIFT_MODEL]:Ut,[me.SWIFT_SDK]:Ut,[me.PHP_MODEL]:Ut,[me.PHP_SDK]:Ut,[me.RUST_MODEL]:Hn,[me.RUST_SDK]:Ut},jsonifyEarlierVersion:e=>Bm.V59.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:Zj5(e.services),auth:Yj5(e.auth)})};function Yj5(e){return{...e,schemes:Xj5(e.schemes)}}function Xj5(e){return e.map(t=>{switch(t.type){case"bearer":return ft.V59.AuthScheme.bearer({...t});case"basic":return ft.V59.AuthScheme.basic({...t});case"header":return ft.V59.AuthScheme.header({...t});case"oauth":switch(t.configuration.type){case"clientCredentials":return ft.V59.AuthScheme.oauth({...t,configuration:ft.V59.OAuthConfiguration.clientCredentials({...t.configuration,refreshEndpoint:t.configuration.refreshEndpoint?{...t.configuration.refreshEndpoint,responseProperties:{accessToken:xMa(t.configuration.refreshEndpoint.responseProperties.accessToken),expiresIn:TOo(t.configuration.refreshEndpoint.responseProperties.expiresIn),refreshToken:TOo(t.configuration.refreshEndpoint.responseProperties.refreshToken)},requestProperties:{refreshToken:qOo(t.configuration.refreshEndpoint.requestProperties.refreshToken)}}:void 0,tokenEndpoint:{...t.configuration.tokenEndpoint,responseProperties:{accessToken:xMa(t.configuration.tokenEndpoint.responseProperties.accessToken),expiresIn:TOo(t.configuration.tokenEndpoint.responseProperties.expiresIn),refreshToken:TOo(t.configuration.tokenEndpoint.responseProperties.refreshToken)},requestProperties:{clientId:qOo(t.configuration.tokenEndpoint.requestProperties.clientId),clientSecret:qOo(t.configuration.tokenEndpoint.requestProperties.clientSecret),scopes:xm_(t.configuration.tokenEndpoint.requestProperties.scopes),customProperties:t.configuration.tokenEndpoint.requestProperties.customProperties?.map(qOo)}}})});default:fc(t.configuration.type)}break;case"inferred":return ft.V59.AuthScheme.inferred({...t,tokenEndpoint:{...t.tokenEndpoint,expiryProperty:TOo(t.tokenEndpoint.expiryProperty),authenticatedRequestHeaders:t.tokenEndpoint.authenticatedRequestHeaders.map(r=>({...r,responseProperty:xMa(r.responseProperty)}))}});default:fc(t)}})}function Zj5(e){return Object.entries(e).reduce((t,[r,n])=>(t[r]={...n,endpoints:kj5(n.endpoints)},t),{})}function kj5(e){return e.map(t=>({...t,pagination:e15(t.pagination),sdkRequest:t15(t.sdkRequest)}))}function e15(e){if(!e)return e;switch(e.type){case"cursor":return ft.V59.Pagination.cursor({next:xMa(e.next),results:xMa(e.results),page:qOo(e.page)});case"offset":return ft.V59.Pagination.offset({hasNextPage:TOo(e.hasNextPage),results:xMa(e.results),page:qOo(e.page),step:xm_(e.step)});case"custom":return ft.V59.Pagination.custom({results:xMa(e.results)});default:fc(e)}}function xm_(e){if(e)return{propertyPath:e.propertyPath?.map(t=>t.name),property:e.property}}function qOo(e){return{propertyPath:e.propertyPath?.map(t=>t.name),property:e.property}}function TOo(e){if(e)return{propertyPath:e.propertyPath?.map(t=>t.name),property:e.property}}function xMa(e){return{propertyPath:e.propertyPath?.map(t=>t.name),property:e.property}}function t15(e){return e&&{...e,streamParameter:xm_(e.streamParameter)}}function fPs(){return n15}var Jtl=class{migrations;constructor(t){this.migrations=t}withMigration(t){return new Fm_([...this.migrations,t])}},Fm_=class extends Jtl{build(){return new zm_(this.migrations)}},zm_=class{migrations;constructor(t){this.migrations=t}migrateForGenerator({intermediateRepresentation:t,context:r,targetGenerator:n}){return this.migrate({intermediateRepresentation:t,shouldMigrate:i=>this.shouldRunMigration({migration:i,targetGenerator:n}),context:r,targetGenerator:n})}migrateThroughMigration({migration:t,intermediateRepresentation:r,context:n,targetGenerator:i}){return this.migrateThroughVersion({version:t.earlierVersion,intermediateRepresentation:r,context:n,targetGenerator:i})}migrateThroughVersion({version:t,intermediateRepresentation:r,context:n,targetGenerator:i}){let a=!1;if(this.migrations[0]?.laterVersion===t)return{ir:r,jsonify:()=>Promise.resolve().then(()=>k0.IntermediateRepresentation.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}))};let c=this.migrate({intermediateRepresentation:r,shouldMigrate:f=>{let u=f.earlierVersion===t;return a||=u,u||!a},context:n,targetGenerator:i});return a||n.failAndThrow(`IR ${t} does not exist`),c}migrate({intermediateRepresentation:t,shouldMigrate:r,context:n,targetGenerator:i}){let a=t,o=async()=>k0.IntermediateRepresentation.jsonOrThrow(a,{unrecognizedObjectKeys:"strip"});for(let c of this.migrations){if(!r(c))break;n.logger.debug(`Migrating IR from ${c.laterVersion} to ${c.earlierVersion}`),a=c.migrateBackwards(a,{taskContext:n,targetGenerator:i}),o=()=>Promise.resolve().then(()=>c.jsonifyEarlierVersion(a))}return{ir:a,jsonify:o}}shouldRunMigration({migration:t,targetGenerator:r}){let n=t.firstGeneratorVersionToConsumeNewIR[r.name];if(n==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(n){case Ut:return!0;case Hn:throw new Error(`Cannot migrate intermediate representation. Generator was created after intermediate representation ${t.laterVersion}.`)}return Cxe(n,r.version)}getIRVersionForGenerator({targetGenerator:t}){let r=this.migrations[0]?.laterVersion;for(let n of this.migrations)if(this.shouldRunMigration({migration:n,targetGenerator:t}))r=n.earlierVersion;else break;return r}},r15={Builder:new Jtl([])},n15=r15.Builder.withMigration(ftE).withMigration(ltE).withMigration(ctE).withMigration(utE).withMigration(stE).withMigration(XeE).withMigration(KeE).withMigration(FeE).withMigration(EeE).withMigration(geE).withMigration(peE).withMigration(deE).withMigration(leE).withMigration(ceE).withMigration(oeE).withMigration(neE).withMigration(reE).withMigration(eeE).withMigration(kk1).withMigration(Zk1).withMigration(Xk1).withMigration(Yk1).withMigration($k1).withMigration(Kk1).withMigration(Jk1).withMigration(Gk1).withMigration(Hk1).withMigration(Wk1).withMigration(Uk1).withMigration(Qk1).withMigration(zk1).withMigration(Fk1).withMigration(Mk1).withMigration(Ik1).withMigration(Ck1).withMigration(Sk1).withMigration(Ek1).withMigration(lqP).withMigration(sqP).withMigration(oqP).withMigration(nqP).withMigration(tqP).withMigration(kTP).withMigration(ZTP).withMigration(XTP).withMigration(KTP).withMigration(HTP).withMigration(WTP).withMigration(VTP).withMigration(LTP).withMigration(QTP).withMigration(zTP).withMigration(RTP).withMigration(BTP).withMigration(MTP).withMigration(ITP).withMigration(yTP).withMigration(pTP).withMigration(o4v).build();function dPs({intermediateRepresentation:e,context:t,targetGenerator:r}){return fPs().migrateForGenerator({intermediateRepresentation:e,context:t,targetGenerator:r}).jsonify()}function Qm_({intermediateRepresentation:e,context:t,targetGenerator:r,irVersion:n}){return fPs().migrateThroughVersion({version:n,intermediateRepresentation:e,context:t,targetGenerator:r}).jsonify()}function pPs({intermediateRepresentation:e,context:t,version:r}){return fPs().migrateThroughVersion({version:r,intermediateRepresentation:e,context:t}).jsonify()}async function dtE({workspace:e,audiences:t,generatorInvocation:r,context:n,irVersionOverride:i,version:a,packageName:o,sourceConfig:c,includeOptionalRequestPropertyExamples:f,ir:u}){let s=u??VW({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:o,context:n,sourceResolver:new LW(n,e)});c!=null&&(s.sourceConfig=c),n.logger.debug("Generated IR");let l=i!=null?await pPs({intermediateRepresentation:s,context:n,version:i}):await dPs({intermediateRepresentation:s,context:n,targetGenerator:{name:r.name,version:r.version}});return{latest:s,migrated:l}}var ptE=aa($xu(),1),FXe=require("fs/promises"),_tE=aa(eDe(),1),Ktl=class{context;absolutePathToTmpOutputDirectory;absolutePathToTmpSnippetJSON;absolutePathToTmpSnippetTemplatesJSON;absolutePathToLocalSnippetTemplateJSON;absolutePathToLocalOutput;absolutePathToLocalSnippetJSON;constructor({context:t,absolutePathToTmpOutputDirectory:r,absolutePathToTmpSnippetJSON:n,absolutePathToLocalSnippetTemplateJSON:i,absolutePathToLocalOutput:a,absolutePathToLocalSnippetJSON:o,absolutePathToTmpSnippetTemplatesJSON:c}){this.context=t,this.absolutePathToLocalOutput=a,this.absolutePathToTmpOutputDirectory=r,this.absolutePathToTmpSnippetJSON=n,this.absolutePathToLocalSnippetJSON=o,this.absolutePathToLocalSnippetTemplateJSON=i,this.absolutePathToTmpSnippetTemplatesJSON=c}async copyGeneratedFiles(){await this.isFernIgnorePresent()?await this.copyGeneratedFilesWithFernIgnore():await this.copyGeneratedFilesNoFernIgnore(),this.absolutePathToTmpSnippetJSON!=null&&this.absolutePathToLocalSnippetJSON!=null&&await qv(this.absolutePathToTmpSnippetJSON)&&await this.copySnippetJSON({absolutePathToTmpSnippetJSON:this.absolutePathToTmpSnippetJSON,absolutePathToLocalSnippetJSON:this.absolutePathToLocalSnippetJSON}),this.absolutePathToTmpSnippetTemplatesJSON!=null&&this.absolutePathToLocalSnippetTemplateJSON!=null&&await qv(this.absolutePathToTmpSnippetTemplatesJSON)&&await this.copySnippetJSON({absolutePathToTmpSnippetJSON:this.absolutePathToTmpSnippetTemplatesJSON,absolutePathToLocalSnippetJSON:this.absolutePathToLocalSnippetTemplateJSON})}async isFernIgnorePresent(){let t=Q_.of($l(this.absolutePathToLocalOutput,vu.of(rUs)));return await qv(t)}async copyGeneratedFilesWithFernIgnore(){let t=Q_.of((await _tE.default.dir({})).path),r=Q_.of($l(this.absolutePathToLocalOutput,vu.of(rUs))),n=await a15({absolutePathToFernignore:r});await(0,FXe.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","--",...n],t),await this.runGitCommand(["restore","."],t),await(0,FXe.rm)($l(t,vu.of(".git")),{recursive:!0}),await(0,FXe.rm)(this.absolutePathToLocalOutput,{recursive:!0}),await(0,FXe.cp)(t,this.absolutePathToLocalOutput,{recursive:!0})}async copyGeneratedFilesNoFernIgnore(){this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`),await(0,FXe.rm)(this.absolutePathToLocalOutput,{force:!0,recursive:!0}),await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput)}async copyGeneratedFilesToDirectory(t){let[r,...n]=await(0,FXe.readdir)(this.absolutePathToTmpOutputDirectory);if(r!=null)if(this.context.logger.debug(`Copying generated files to ${t}`),r.endsWith(".zip")){await(0,ptE.default)($l(this.absolutePathToTmpOutputDirectory,vu.of(r)),t);for(let i of n)await(0,FXe.cp)($l(this.absolutePathToTmpOutputDirectory,vu.of(i)),$l(t,vu.of(i)),{recursive:!0})}else await(0,FXe.cp)(this.absolutePathToTmpOutputDirectory,t,{recursive:!0})}async copySnippetJSON({absolutePathToTmpSnippetJSON:t,absolutePathToLocalSnippetJSON:r}){this.context.logger.debug(`Copying generated snippets to ${r}`),await(0,FXe.cp)(t,r)}async runGitCommand(t,r){return(await QW(this.context.logger,"git",t,{cwd:r,doNotPipeOutput:!0})).stdout}},i15=/\r?\n/;async function a15({absolutePathToFernignore:e}){let t=(await(0,FXe.readFile)(e)).toString();return[rUs,...t.trim().split(i15).map(r=>{let n=r.indexOf("#");return n!==-1?r.slice(0,n).trim():r.trim()}).filter(r=>r.length>0)]}async function vtE({organization:e,absolutePathToFernConfig:t,workspace:r,generatorInvocation:n,absolutePathToLocalOutput:i,absolutePathToLocalSnippetJSON:a,absolutePathToLocalSnippetTemplateJSON:o,audiences:c,version:f,workspaceTempDir:u,keepDocker:s,context:l,irVersionOverride:m,outputVersionOverride:A,writeUnitTests:P,generateOauthClients:C,generatePaginatedClients:M,includeOptionalRequestPropertyExamples:T,inspect:z,executionEnvironment:U,runner:R,ir:V}){let{latest:$,migrated:re}=await dtE({workspace:r,audiences:c,generatorInvocation:n,context:l,irVersionOverride:m,packageName:MP.getPackageName({generatorInvocation:n}),version:f??A,sourceConfig:s15(r),includeOptionalRequestPropertyExamples:T,ir:V}),Y=await o15({workspaceTempDir:u,filename:Yxf,context:l,ir:re});l.logger.debug("Wrote IR to: "+Y);let te=(0,ROo.join)(u.path,$xf),ne=Q_.of(te);await(0,FMa.writeFile)(te,""),l.logger.debug("Will write config.json to: "+ne);let Ae=(0,ROo.join)(u.path,Kxf),ge=Q_.of(Ae);await(0,FMa.mkdir)(Ae,{recursive:!0}),l.logger.debug("Will write output to: "+ge);let ve;if(a!=null){let qe=(0,ROo.join)(u.path,"snippet.json");ve=Q_.of(qe),await(0,FMa.writeFile)(qe,""),l.logger.debug("Will write snippet.json to: "+ve)}let be;if(o!=null){let qe=(0,ROo.join)(u.path,v8_);be=Q_.of(qe),await(0,FMa.writeFile)(qe,""),l.logger.debug("Will write snippet-templates.json to: "+be)}let Me=U??new tHo({dockerImage:`${n.name}:${n.version}`,keepDocker:s}),Se=Me instanceof tHo?{outputDirectory:Q_.of(a3u),irPath:Q_.of(o3u),configPath:Q_.of(eHo),snippetPath:Q_.of(s3u),snippetTemplatePath:Q_.of(u3u)}:{outputDirectory:ge,configPath:ne,irPath:Y,snippetPath:ve,snippetTemplatePath:be},St=a4v({generatorInvocation:n,customConfig:n.config,workspaceName:r.definition.rootApiFile.contents.name,outputVersion:A,organization:e,absolutePathToSnippet:ve,absolutePathToSnippetTemplates:be,absolutePathToFernConfig:t,writeUnitTests:P,generateOauthClients:C,generatePaginatedClients:M,paths:Se});return await(0,FMa.writeFile)(ne,JSON.stringify(await htE.GeneratorConfig.jsonOrThrow(St),void 0,4)),await Me.execute({generatorName:n.name,irPath:Y,configPath:ne,outputPath:ge,snippetPath:ve,snippetTemplatePath:be,context:l,inspect:z,runner:R}),await new Ktl({context:l,absolutePathToLocalOutput:i,absolutePathToTmpOutputDirectory:ge,absolutePathToLocalSnippetJSON:a,absolutePathToLocalSnippetTemplateJSON:o,absolutePathToTmpSnippetJSON:ve,absolutePathToTmpSnippetTemplatesJSON:be}).copyGeneratedFiles(),{ir:$,generatorConfig:St}}async function o15({ir:e,workspaceTempDir:t,filename:r,context:n}){n.logger.debug("Migrated IR");let i;if(r)i=Q_.of((0,ROo.join)(t.path,r));else{let a=await ytE.default.file({tmpdir:t.path});i=Q_.of(a.path)}return await kSe(i,e,{pretty:!1}),n.logger.debug(`Wrote IR to ${i}`),i}function s15(e){return{sources:e.getSources().map(t=>t.type==="protobuf"?BNe.proto({id:t.id,protoRootUrl:`file:///${u15(t)}`}):BNe.openapi())}}function u15(e){return`${xNv}/${e.id}`}var Lm_=aa(require("os"),1),btE=aa(require("path"),1),gtE=aa(eDe(),1);async function mtE({token:e,projectConfig:t,workspace:r,generatorGroup:n,version:i,keepDocker:a,inspect:o,context:c,runner:f}){let u=await l15();(await Promise.all(n.generators.map(async l=>c.runInteractiveTask({name:l.name},async m=>{l=($=>oSi($,{onError:re=>m.failAndThrow(re)}))(l);let P=await r.toFernWorkspace({context:c},vHa(l)),C=VW({workspace:P,audiences:n.audiences,generationLanguage:l.language,keywords:l.keywords,smartCasing:l.smartCasing,exampleGeneration:{includeOptionalRequestPropertyExamples:!1,disabled:l.disableExamples},readme:l.readme,version:i,packageName:MP.getPackageName({generatorInvocation:l}),context:c,sourceResolver:new LW(c,P)}),M=Ftt({token:e?.value});if(l.absolutePathToLocalOutput==null&&(e=await w8a(),e==null)){m.failWithoutThrowing("Please provide a FERN_TOKEN in your environment.");return}let T=await M.organization.get(QN.OrganizationId(t.organization));if(l.absolutePathToLocalOutput==null&&!T.ok){m.failWithoutThrowing(`Failed to load details for organization ${t.organization}.`);return}T.ok&&(T.body.selfHostedSdKs&&(C.selfHosted=!0),T.body.isWhitelabled&&(C.readmeConfig==null&&(C.readmeConfig=p15),C.readmeConfig.whiteLabel=!0));let z=c15(l),U=f15({generatorInvocation:l,org:T.ok?T.body:void 0,version:i,packageName:z,context:m});U!=null&&(C.publishConfig=U);let R=l.absolutePathToLocalOutput??$l(r.absoluteFilePath,vu.of("sdks"),vu.of(l.language??l.name)),V=l.raw?.snippets?.path!=null?Q_.of($l(r.absoluteFilePath,vu.of(l.raw.snippets.path))):void 0;await vtE({organization:t.organization,absolutePathToFernConfig:t._absolutePath,workspace:P,generatorInvocation:l,absolutePathToLocalOutput:R,absolutePathToLocalSnippetJSON:V,absolutePathToLocalSnippetTemplateJSON:void 0,version:i,audiences:n.audiences,workspaceTempDir:u,keepDocker:a,context:m,irVersionOverride:l.irVersionOverride,outputVersionOverride:void 0,writeUnitTests:T.ok?T?.body.snippetUnitTestsEnabled??!1:!1,generateOauthClients:T.ok?T?.body.oauthClientEnabled??!1:!1,generatePaginatedClients:T.ok?T?.body.paginationEnabled??!1:!1,includeOptionalRequestPropertyExamples:!1,inspect:o,executionEnvironment:void 0,ir:C,runner:f}),m.logger.info(gd.green("Wrote files to "+R))})))).some(l=>!l)&&c.failAndThrow()}function c15(e){return typeof e.raw?.config=="object"&&e.raw?.config!==null?e.raw.config.package_name:void 0}async function l15(){return gtE.default.dir({tmpdir:Lm_.default.platform()==="darwin"?btE.default.join("/private",Lm_.default.tmpdir()):void 0,prefix:"fern"})}function f15({generatorInvocation:e,org:t,version:r,packageName:n,context:i}){if(e.raw?.github!=null&&d15(e.raw.github))return op.PublishingConfig.github({owner:"",repo:"",uri:e.raw.github.uri,token:e.raw.github.token,mode:e.raw.github.mode,target:op.PublishTarget.postman({apiKey:"",workspaceId:"",collectionId:void 0})});if(e.raw?.output?.location==="local-file-system"){let a;if(e.language==="python")a=dDe.pypi({version:r,packageName:n}),i.logger.debug(`Created PyPiPublishTarget: version ${r} package name: ${n}`);else if(e.language==="java"){let o=e.raw?.config,c=(()=>{if(!o||typeof o!="object"||o===null)return;let u=o;if(typeof u.group=="string"&&typeof u.artifact=="string")return{groupId:u.group,artifactId:u.artifact};if(typeof u["package-prefix"]=="string"&&n)return{groupId:u["package-prefix"],artifactId:n};typeof u["package-prefix"]=="string"&&!n&&i.logger.warn("Java generator has package-prefix configured but packageName is missing")})(),f=c?`${c.groupId}:${c.artifactId}`:void 0;if(f){let u=r??"0.0.0";a=dDe.maven({coordinate:f,version:u,usernameEnvironmentVariable:"MAVEN_USERNAME",passwordEnvironmentVariable:"MAVEN_PASSWORD",mavenUrlEnvironmentVariable:"MAVEN_PUBLISH_REGISTRY_URL"}),i.logger.debug(`Created MavenPublishTarget: coordinate ${f} version ${u}`)}else o&&typeof o=="object"&&i.logger.debug("Java generator config provided but could not construct Maven coordinate. Expected either 'group' and 'artifact' or 'package-prefix' with packageName.")}return op.PublishingConfig.filesystem({generateFullProject:t?.selfHostedSdKs??!1,publishTarget:a})}return e.outputMode._visit({downloadFiles:()=>op.PublishingConfig.filesystem({generateFullProject:t?.selfHostedSdKs??!1,publishTarget:void 0}),github:()=>{},githubV2:()=>{},publish:()=>{},publishV2:()=>{},_other:()=>{}})}function d15(e){return e==null?!1:"uri"in e&&"token"in e}var p15={defaultEndpoint:void 0,bannerLink:void 0,introduction:void 0,apiReferenceLink:void 0,apiName:void 0,disabledFeatures:void 0,whiteLabel:void 0,customSections:void 0,features:void 0};var rrl=aa(qCi(),1);var OtE=require("fs"),$tl=require("fs/promises"),AtE=require("stream/promises");async function PtE({snippetsS3PreSignedReadUrl:e,absolutePathToLocalSnippetJSON:t,context:r}){try{await _15({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}),r.logger.info(gd.green(`Downloaded to ${t}`))}catch{r.logger.debug(gd.yellow("Failed to download snippet.json from output."))}}async function _15({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await iX.get(e,{responseType:"stream"});await qv(t)&&await(0,$tl.rm)(t,{recursive:!0}),await(0,$tl.mkdir)(xg(t),{recursive:!0}),await(0,AtE.pipeline)(r.data,(0,OtE.createWriteStream)(t))}var Wm_=aa(Stt(),1);var NOo=aa(qCi(),1);var wtE=aa(wfu(),1),zXe=require("fs/promises");var jtE=require("path"),EtE=aa(oDu(),1),StE=aa(eDe(),1);async function DtE({projectConfig:e,workspace:t,organization:r,intermediateRepresentation:n,generatorInvocation:i,version:a,context:o,shouldLogS3Url:c,token:f,whitelabel:u,irVersionOverride:s,absolutePathToPreview:l}){let m=await h15({projectConfig:e,workspace:t,organization:r,generatorInvocation:i,version:a,context:o,shouldLogS3Url:c,token:f,whitelabel:u,absolutePathToPreview:l});return await y15({intermediateRepresentation:n,job:m,context:o,generatorInvocation:i,irVersionOverride:s}),m}async function h15({projectConfig:e,workspace:t,organization:r,generatorInvocation:n,version:i,context:a,shouldLogS3Url:o,token:c,whitelabel:f,absolutePathToPreview:u}){let s=Ifi({token:c.value}),l={id:n.name,version:n.version,outputMode:n.outputMode,customConfig:n.config,publishMetadata:n.publishMetadata},m;if(n.outputMode.type.startsWith("github"))try{let P=await StE.default.dir(),C=Q_.of(P.path);a.logger.debug(`Writing mock fern definition to ${C}`);let M=$l(C,vu.of(Kye)),T=$l(M,vu.of(kle));await(0,zXe.mkdir)(T,{recursive:!0});let z=$l(T,vu.of(sk));await(0,zXe.writeFile)(z,Fg.dump(t.definition.rootApiFile.contents)),await CtE({absolutePathToDefinitionDirectory:T,definition:t.definition});let U=$l(M,vu.of(QRe));await(0,zXe.writeFile)(U,JSON.stringify(e.rawConfig,void 0,2));try{let $=t.getSources();for(let re of $){let Y=await(0,zXe.readFile)(re.absoluteFilePath),te=(0,jtE.relative)(t.absoluteFilePath,re.absoluteFilePath),ne=$l(M,vu.of(te));await(0,zXe.mkdir)(xg(ne),{recursive:!0}),await(0,zXe.writeFile)(ne,new Uint8Array(Y))}}catch($){a.logger.debug(`Failed to write source files to disk, continuing: ${$}`)}let R=$l(C,vu.of("definition.tgz"));await(0,EtE.create)({file:R,cwd:M},["."]),a.logger.debug("Getting upload URL for Fern definition.");let V=await s.remoteGen.getDefinitionUploadUrl({apiName:t.definition.rootApiFile.contents.name,organizationName:r,version:i});V.ok?(a.logger.debug("Uploading definition..."),await iX.put(V.body.s3Url,await(0,zXe.readFile)(R)),m={definitionS3DownloadUrl:V.body.s3Url,outputPath:".mock",cliVersion:e.version}):V.error.content.reason==="status-code"?a.logger.debug(`Failed with status-code to get upload URL with status code ${V.error.content.statusCode}, continuing: ${V.error.content.body}`):V.error.content.reason==="non-json"?a.logger.debug(`Failed with non-json to get upload URL with status code ${V.error.content.statusCode}, continuing: ${V.error.content.rawBody}`):V.error.content.reason==="unknown"&&a.logger.debug(`Failed to get upload URL as unknown error occurred continuing: ${V.error.content.errorMessage}`)}catch(P){a.logger.debug(`Failed to upload definition to S3, continuing: ${P}`)}let A=await s.remoteGen.createJobV3({apiName:t.definition.rootApiFile.contents.name,version:i,organizationName:r,generators:[l],uploadToS3:b15({outputMode:n.outputMode,generatorInvocation:n,absolutePathToPreview:u,shouldLogS3Url:o}),whitelabel:f,fernDefinitionMetadata:m,preview:u!=null});return A.ok?A.body:v15(A.error)._visit({illegalApiNameError:()=>a.failAndThrow("API name is invalid: "+t.definition.rootApiFile.contents.name),illegalApiVersionError:()=>a.failAndThrow("API version is invalid: "+i),cannotPublishToNpmScope:({validScope:P,invalidScope:C})=>a.failAndThrow(`You do not have permission to publish to ${C} (expected ${P})`),cannotPublishToMavenGroup:({validGroup:P,invalidGroup:C})=>a.failAndThrow(`You do not have permission to publish to ${C} (expected ${P})`),cannotPublishPypiPackage:({validPrefix:P,invalidPackageName:C})=>a.failAndThrow(`You do not have permission to publish to ${C} (expected ${P})`),generatorsDoNotExistError:P=>a.failAndThrow("Generators do not exist: "+P.nonExistentGenerators.map(C=>`${C.id}@${C.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:P=>a.failAndThrow("Failed to create job",P)})}async function CtE({absolutePathToDefinitionDirectory:e,definition:t}){for(let[r,n]of Object.entries(t.namedDefinitionFiles)){let i=$l(e,vu.of(r));await(0,zXe.mkdir)(xg(i),{recursive:!0}),await(0,zXe.writeFile)(i,Fg.dump(n.contents))}for(let[r,n]of Object.entries(t.packageMarkers))if(n.contents.export==null){let i=$l(e,vu.of(r));await(0,zXe.mkdir)(xg(i),{recursive:!0}),await(0,zXe.writeFile)(i,Fg.dump(n.contents))}for(let[r,n]of Object.entries(t.importedDefinitions))await CtE({absolutePathToDefinitionDirectory:$l(e,vu.of(r)),definition:n.definition})}async function y15({intermediateRepresentation:e,generatorInvocation:t,job:r,context:n,irVersionOverride:i}){let a=i==null?await dPs({intermediateRepresentation:e,context:n,targetGenerator:{name:t.name,version:t.version}}):await Qm_({intermediateRepresentation:e,context:n,irVersion:i,targetGenerator:{name:t.name,version:t.version}}),o=new wtE.default,c=await uzl(a,{onWrite:u=>{n.logger.debug("Wrote IR to disk: "+u)}});o.append("file",c);let f=CD(DWl(),`/api/remote-gen/jobs/${r.jobId}/start`);try{await iX.post(f,o,{headers:o.getHeaders(),maxBodyLength:1/0})}catch(u){let s=u instanceof KYh?u.response?.data:u;n.logger.debug(`POST ${f} failed with ${JSON.stringify(u)}`),n.failAndThrow("Failed to start job",s)}}function v15(e){if(e?.reason==="status-code"){let t=e.body;switch(t?._error){case"IllegalApiNameError":return NOo.FernFiddle.remoteGen.createJobV3.Error.illegalApiNameError();case"GeneratorsDoNotExistError":return NOo.FernFiddle.remoteGen.createJobV3.Error.generatorsDoNotExistError(t.body);case"CannotPublishToNpmScope":return NOo.FernFiddle.remoteGen.createJobV3.Error.cannotPublishToNpmScope(t.body);case"CannotPublishToMavenScope":return NOo.FernFiddle.remoteGen.createJobV3.Error.cannotPublishToMavenGroup(t.body);case"InsufficientPermissions":return NOo.FernFiddle.remoteGen.createJobV3.Error.insufficientPermissions(t.body)}}return e}function b15({outputMode:e,generatorInvocation:t,absolutePathToPreview:r,shouldLogS3Url:n}){return e.type==="downloadFiles"||t.absolutePathToLocalSnippets!=null||r!=null||n}function Ytl({apiName:e,organization:t,generatorInvocation:r}){let n=g15(r);return{apiName:e,organization:t,customConfig:r.config,outputConfig:n??od.GeneratorOutputConfig.local()}}function g15(e){let t=e.outputMode;switch(t.type){case"downloadFiles":return od.GeneratorOutputConfig.local();case"publishV2":return m15({publish:t.publishV2,version:e.version});case"githubV2":return O15({github:t.githubV2,language:e.language,version:e.version});case"publish":case"github":return;default:fc(t)}}function m15({publish:e,version:t}){switch(e.type){case"npmOverride":{let r=e.npmOverride;return r==null?void 0:od.GeneratorOutputConfig.publish(od.PublishInfo.npm({version:t,packageName:r.packageName,repoUrl:void 0}))}case"mavenOverride":{let r=e.mavenOverride;return r==null?void 0:od.GeneratorOutputConfig.publish(od.PublishInfo.maven({version:t,coordinate:r.coordinate,repoUrl:void 0}))}case"pypiOverride":{let r=e.pypiOverride;return r==null?void 0:od.GeneratorOutputConfig.publish(od.PublishInfo.pypi({version:t,packageName:r.coordinate,repoUrl:void 0}))}case"rubyGemsOverride":{let r=e.rubyGemsOverride;return r==null?void 0:od.GeneratorOutputConfig.publish(od.PublishInfo.rubygems({version:t,packageName:r.packageName,repoUrl:void 0}))}case"nugetOverride":{let r=e.nugetOverride;return r==null?void 0:od.GeneratorOutputConfig.publish(od.PublishInfo.nuget({version:t,packageName:r.packageName,repoUrl:void 0}))}case"postman":return;default:fc(e)}}function O15({github:e,version:t,language:r}){let n=A15({owner:e.owner,repo:e.repo});if(r===MP.GenerationLanguage.GO)return od.GeneratorOutputConfig.publish(od.PublishInfo.go({version:t,repoUrl:n}));let i=e.publishInfo;if(i!=null)switch(i.type){case"maven":return od.GeneratorOutputConfig.publish(od.PublishInfo.maven({version:t,coordinate:i.coordinate,repoUrl:n}));case"npm":return od.GeneratorOutputConfig.publish(od.PublishInfo.npm({version:t,packageName:i.packageName,repoUrl:n}));case"pypi":return od.GeneratorOutputConfig.publish(od.PublishInfo.pypi({version:t,packageName:i.packageName,repoUrl:n}));case"rubygems":return od.GeneratorOutputConfig.publish(od.PublishInfo.rubygems({version:t,packageName:i.packageName,repoUrl:n}));case"nuget":return od.GeneratorOutputConfig.publish(od.PublishInfo.nuget({version:t,packageName:i.packageName,repoUrl:n}));case"postman":return;default:fc(i)}}function A15({owner:e,repo:t}){return`https://github.com/${e}/${t}`}var ItE=Ifi();var P15=3;function MtE({job:e,taskId:t,taskHandler:r,context:n}){let i=0,a=async()=>{let o=await ItE.remoteGen.getJobStatus(e.jobId);if(o.ok)return o.body[t];n.logger.debug("Failed to get job status.",JSON.stringify(o.error.content))};return new Promise((o,c)=>{f();async function f(){try{let u=await a();if(u==null)i++,i===P15&&n.failAndThrow(`Failed to get job status after ${i} attempts.`),setTimeout(f,2e3+1e3*i);else{i=0;let s=await r.processUpdate(u);r.isFinished?o(s):setTimeout(f,2e3)}}catch(u){c(u)}}})}var RtE=aa($xu(),1),NtE=require("fs"),ktl=require("fs/promises"),Vm_=aa(require("path"),1),xtE=require("stream/promises");var Xtl=aa(qtE(),1);function WOi(e,t,{target:r="stdout",...n}={}){return Xtl.default[r]?PVa.link(e,t):n.fallback===!1?e:typeof n.fallback=="function"?n.fallback(e,t):`${e} (\u200B${t}\u200B)`}WOi.isSupported=Xtl.default.stdout;WOi.stderr=(e,t,r={})=>WOi(e,t,{target:"stderr",...r});WOi.stderr.isSupported=Xtl.default.stderr;var FtE=aa(eDe(),1),Ztl=class{context;generatorInvocation;absolutePathToPreview;lengthOfLastLogs=0;constructor({interactiveTaskContext:t,generatorInvocation:r,absolutePathToPreview:n}){this.context=t,this.generatorInvocation=r,this.absolutePathToPreview=n}async processUpdate(t){t==null&&this.context.failAndThrow("Task is missing on job status");let r=t.packages.map(i=>i.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(i=>`\u25E6 ${i}`).join(`
3024
3024
  `):void 0);for(let i of t.logs.slice(this.lengthOfLastLogs))this.context.logger.log(S15(i.level),i.message);this.lengthOfLastLogs=t.logs.length;let n=i=>{this.context.logger.debug(`Generated files. ${WOi("View here",i,{fallback:(a,o)=>`${a}: ${o}`})}`)};return await t.status._visit({notStarted:Gc,running:Gc,failed:({message:i,s3PreSignedReadUrl:a})=>{a!=null&&n(a),this.context.failAndThrow(i)},finished:async i=>{if(i.s3PreSignedReadUrlV2!=null){n(i.s3PreSignedReadUrlV2);let a=this.getAbsolutePathToLocalOutput();a!=null&&await j15({s3PreSignedReadUrl:i.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=i.createdSnippets!=null?i.createdSnippets:!1,this.#r=i.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?$l(this.absolutePathToPreview,vu.of(Vm_.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 j15({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t,context:r}){try{await E15({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}),r.logger.info(gd.green(`Downloaded to ${t}`))}catch(n){r.failAndThrow("Failed to download files",n)}}async function E15({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await iX.get(e,{responseType:"stream"}),n=await FtE.default.dir({prefix:"fern",unsafeCleanup:!0}),i=Vm_.default.join(n.path,"output.zip");await(0,xtE.pipeline)(r.data,(0,NtE.createWriteStream)(i)),await qv(t)&&await(0,ktl.rm)(t,{recursive:!0}),await(0,ktl.mkdir)(t,{recursive:!0}),await(0,RtE.default)(i,t)}function S15(e){switch(e){case"DEBUG":return E1.Debug;case"INFO":return E1.Info;case"WARN":return E1.Warn;case"ERROR":return E1.Error;default:return E1.Info}}var trl=require("fs/promises"),ztE=aa(eDe(),1),D15="proto.zip",erl=class{sourceTypes;context;sources;constructor(t,r){this.context=t,this.sources=Object.fromEntries(r.map(n=>[n.id,n])),this.sourceTypes=new Set(Object.values(this.sources).map(n=>n.type))}async uploadSources(t){for(let[r,n]of Object.entries(t)){let i=this.getSourceOrThrow(r);await this.uploadSource(i,n.uploadUrl)}return this.convertFdrSourceUploadsToSourceConfig(t)}async uploadSource(t,r){let n=await this.getUploadCommand(t),i=await(0,trl.readFile)(n.absoluteFilePath),a=await fetch(r,{method:"PUT",body:i,headers:{"Content-Type":"application/octet-stream"}});await n.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,trl.unlink)(r)}}}return{absoluteFilePath:t.absoluteFilePath,cleanup:async()=>{}}}async zipSource(t){let r=await ztE.default.dir(),n=$l(Q_.of(r.path),vu.of(D15));return this.context.logger.debug(`Zipping source ${t} into ${n}`),await QW(this.context.logger,"zip",["-r",n,"."],{cwd:t,doNotPipeOutput:!0}),n}convertFdrSourceUploadsToSourceConfig(t){let r=[];for(let[n,i]of Object.entries(t))switch(this.getSourceOrThrow(n).type){case"protobuf":r.push(BNe.proto({id:n,protoRootUrl:i.downloadUrl}));continue;case"openapi":r.push(BNe.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}};async function QtE({projectConfig:e,organization:t,workspace:r,interactiveTaskContext:n,generatorInvocation:i,version:a,audiences:o,shouldLogS3Url:c,token:f,whitelabel:u,irVersionOverride:s,absolutePathToPreview:l,readme:m}){let A=x$i({token:f.value}),P=MP.getPackageName({generatorInvocation:i}),C=l!=null,M=ve=>oSi(ve,{onError:be=>n.failAndThrow(be)},{substituteAsEmpty:C}),T=M(i),z=Ytl({apiName:r.definition.rootApiFile.contents.name,organization:t,generatorInvocation:T}),U=VW({workspace:r,generationLanguage:i.language,keywords:i.keywords,smartCasing:i.smartCasing,exampleGeneration:{disabled:i.disableExamples,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!1},audiences:o,readme:m,packageName:P,version:a??await I15({fdr:A,packageName:P,generatorInvocation:i}),context:n,sourceResolver:new LW(n,r),dynamicGeneratorConfig:z}),R=r.getSources(),V=sCe({ir:U,snippetsConfig:{typescriptSdk:void 0,pythonSdk:void 0,javaSdk:void 0,rubySdk:void 0,goSdk:void 0,csharpSdk:void 0,phpSdk:void 0,swiftSdk:void 0},context:n}),$=await A.api.v1.register.registerApiDefinition({orgId:Wm_.FernRegistry.OrgId(t),apiId:Wm_.FernRegistry.ApiId(U.apiName.originalName),definition:V,sources:R.length>0?M15(R):void 0}),re,Y;$.ok&&(re=$.body.apiDefinitionId,Y=$.body.sources);let te=new erl(n,R);if(Y==null&&te.sourceTypes.has("protobuf")&&($.ok||n.failAndThrow(`Failed to register API definition: ${JSON.stringify($.error.content)}`),n.failAndThrow("Did not successfully upload Protobuf source files.")),Y!=null){n.logger.debug("Uploading source files ...");let ve=await te.uploadSources(Y);n.logger.debug("Setting IR source configuration ..."),U.sourceConfig=ve}let ne=await DtE({projectConfig:e,workspace:r,organization:t,generatorInvocation:T,context:n,version:a,intermediateRepresentation:{...U,fdrApiDefinitionId:re,publishConfig:C15({generatorInvocation:T})},shouldLogS3Url:c,token:f,whitelabel:u!=null?M(u):void 0,irVersionOverride:s,absolutePathToPreview:l});n.logger.debug(`Job ID: ${ne.jobId}`);let Ae=ne.taskIds[0];if(Ae==null){n.failAndThrow("Did not receive a task ID.");return}n.logger.debug(`Task ID: ${Ae}`);let ge=new Ztl({job:ne,taskId:Ae,generatorInvocation:i,interactiveTaskContext:n,absolutePathToPreview:l});return await MtE({job:ne,taskHandler:ge,taskId:Ae,context:n})}function C15({generatorInvocation:e}){return e.outputMode._visit({downloadFiles:()=>{},github:()=>{},githubV2:()=>{},publish:()=>{},publishV2:t=>t._visit({mavenOverride:()=>{},pypiOverride:()=>{},nugetOverride:()=>{},npmOverride:()=>{},rubyGemsOverride:()=>{},postman:r=>{let n;return e.raw?.output?.location==="postman"&&(n=e.raw.output?.["collection-id"]),op.PublishingConfig.direct({target:op.PublishTarget.postman({apiKey:r.apiKey,workspaceId:r.workspaceId,collectionId:n})})},_other:()=>{}}),_other:()=>{}})}async function I15({fdr:e,packageName:t,generatorInvocation:r}){if(r.language==null)return;let n;switch(r.language){case"csharp":n="Csharp";break;case"go":n="Go";break;case"java":n="Java";break;case"python":n="Python";break;case"ruby":n="Ruby";break;case"typescript":n="TypeScript";break;case"php":n="Php";break;case"swift":n="Swift";break;default:return}if(t==null)return;let i=await e.sdks.versions.computeSemanticVersion({githubRepository:r.outputMode.type==="githubV2"?`${r.outputMode.githubV2.owner}/${r.outputMode.githubV2.repo}`:void 0,language:n,package:t});if(i.ok)return i.body.version}function M15(e){return Object.fromEntries(Object.values(e).map(t=>[t.id,{type:t.type==="protobuf"?"proto":t.type}]))}async function Hm_({projectConfig:e,organization:t,workspace:r,context:n,generatorGroup:i,version:a,shouldLogS3Url:o,token:c,whitelabel:f,absolutePathToPreview:u,mode:s}){if(i.generators.length===0)return n.logger.warn("No generators specified."),null;let l=[],m=[];return l.push(...i.generators.map(P=>n.runInteractiveTask({name:P.name},async C=>{let M=vHa(P),T=await r.toFernWorkspace({context:n},M),z=await QtE({projectConfig:e,organization:t,workspace:T,interactiveTaskContext:C,generatorInvocation:{...P,outputMode:P.outputMode._visit({downloadFiles:()=>P.outputMode,github:U=>rrl.FernFiddle.OutputMode.github({...U,makePr:s==="pull-request"}),githubV2:U=>s==="pull-request"?rrl.FernFiddle.OutputMode.githubV2(rrl.FernFiddle.GithubOutputModeV2.pullRequest(U)):P.outputMode,publish:()=>P.outputMode,publishV2:()=>P.outputMode,_other:()=>P.outputMode})},version:a,audiences:i.audiences,shouldLogS3Url:o,token:c,whitelabel:f,readme:P.readme,irVersionOverride:P.irVersionOverride,absolutePathToPreview:u});z!=null&&z.createdSnippets&&(m.push(P),P.absolutePathToLocalSnippets!=null&&z.snippetsS3PreSignedReadUrl!=null&&await PtE({snippetsS3PreSignedReadUrl:z.snippetsS3PreSignedReadUrl,absolutePathToLocalSnippetJSON:P.absolutePathToLocalSnippets,context:C}))}))),(await Promise.all(l)).some(P=>!P)&&n.failAndThrow(),{snippetsProducedBy:m}}var vai=aa(Stt(),1);var TrE=require("fs/promises");var dO_=aa(R7a(),1);var ErE=aa(jrE(),1);var SrE=require("util"),bS5=(0,SrE.promisify)(ErE.default);async function DrE(e,t,r){let n=qRo(e,t),i=[];for(let a of n){let o=await Promise.all(a.map(async c=>{try{let f=await bS5(c);return f==null||f.height==null||f.width==null?void 0:{filePath:c,width:f.width,height:f.height,blurDataUrl:void 0}}catch(f){r.logger.error(`Failed to measure image size for ${c}. ${f?.message}`);return}}));i.push(...o.filter(qw))}return new Map(i.map(a=>[a.filePath,a]))}var gS5=10,CrE=10;async function qrE({token:e,organization:t,docsWorkspace:r,domain:n,customDomains:i,apiWorkspaces:a,ossWorkspaces:o,context:c,preview:f,editThisPage:u,isPrivate:s=!1,disableTemplates:l=!1}){let m=x$i({token:e.value}),A=s?{type:"private",authType:"sso"}:{type:"public"},P,C=i[0]??n,M=mS5(n),T=r.config.experimental?.dynamicSnippets,z=f||T,R=await new uBr(n,r,o,a,c,u,async $=>{let re=new Map($.map(ve=>[ve.absoluteFilePath,ve])),te=$.map(ve=>({...ve,mediaType:dO_.lookup(ve.absoluteFilePath)})).filter(ve=>ve.mediaType!==!1).filter(ve=>u7.parse(ve.mediaType)?.isImage()??!1).map(ve=>ve.absoluteFilePath),ne=await DrE(te,gS5,c),Ae=[];[...ne.values()].forEach(ve=>{let be=re.get(ve.filePath);if(be==null)return;let Me={filePath:vai.FernRegistry.docs.v1.write.FilePath(nWs(be.relativeFilePath)),width:ve.width,height:ve.height,blurDataUrl:ve.blurDataUrl,alt:void 0};Ae.push(Me)});let ge=$.filter(({absoluteFilePath:ve})=>!ne.has(ve)).map(({relativeFilePath:ve})=>nWs(ve));if(f){let ve=await m.docs.v2.write.startDocsPreviewRegister({orgId:vai.FernRegistry.OrgId(t),authConfig:s?{type:"private",authType:"sso"}:{type:"public"},filepaths:ge.map(be=>vai.FernRegistry.docs.v1.write.FilePath(be)),images:Ae,basePath:M});return ve.ok?(C=ve.body.previewUrl,P=ve.body.docsRegistrationId,await IrE(ve.body.uploadUrls,r.absoluteFilePath,c,CrE),MrE(ve.body.uploadUrls,r.absoluteFilePath)):await BrE(ve.error,c)}else{let ve=await m.docs.v2.write.startDocsRegister({domain:n,customDomains:i,authConfig:A,apiId:vai.FernRegistry.ApiId(""),orgId:vai.FernRegistry.OrgId(t),filepaths:ge.map(be=>vai.FernRegistry.docs.v1.write.FilePath(be)),images:Ae});return ve.ok?(P=ve.body.docsRegistrationId,await IrE(ve.body.uploadUrls,r.absoluteFilePath,c,CrE),MrE(ve.body.uploadUrls,r.absoluteFilePath)):BrE(ve.error,c)}},async({ir:$,snippetsConfig:re,playgroundConfig:Y,apiName:te,workspace:ne})=>{let Ae=sCe({ir:$,snippetsConfig:re,playgroundConfig:Y,context:c}),ge;T&&(ge=await OS5({workspace:ne,organization:t,context:c,snippetsConfig:re}));let ve=await m.api.v1.register.registerApiDefinition({orgId:vai.FernRegistry.OrgId(t),apiId:vai.FernRegistry.ApiId($.apiName.originalName),definition:Ae,definitionV2:void 0,dynamicIRs:ge});if(ve.ok)return c.logger.debug(`Registered API Definition ${ve.body.apiDefinitionId}`),ve.body.dynamicIRs&&ge&&await AS5({dynamicIRs:ge,dynamicIRUploadUrls:ve.body.dynamicIRs,context:c,apiId:ve.body.apiDefinitionId}),ve.body.apiDefinitionId;switch(ve.error.error){case"UnauthorizedError":case"UserNotInOrgError":return c.failAndThrow("You do not have permissions to register the docs. Reach out to support@buildwithfern.com");default:return te!=null?c.failAndThrow(`Failed to publish docs because API definition (${te}) could not be uploaded. Please contact support@buildwithfern.com
3025
3025
  ${JSON.stringify(ve.error)}`):c.failAndThrow(`Failed to publish docs because API definition could not be uploaded. Please contact support@buildwithfern.com
3026
- ${JSON.stringify(ve.error)}`)}}).resolve();if(P==null)return c.failAndThrow("Failed to publish docs.","Docs registration ID is missing.");c.logger.debug("Publishing docs...");let V=await m.docs.v2.write.finishDocsRegister(vai.FernRegistry.docs.v1.write.DocsRegistrationId(P),{docsDefinition:R});if(V.ok){let $=uCe(C),re=WOi($,$);c.logger.info(gd.green(`Published docs to ${re}`))}else switch(V.error.error){case"UnauthorizedError":case"UserNotInOrgError":return c.failAndThrow("Insufficient permissions. Failed to publish docs to "+n);case"DocsRegistrationIdNotFound":return c.failAndThrow("Failed to publish docs to "+n,`Docs registration ID ${P} does not exist.`);default:return c.failAndThrow("Failed to publish docs to "+n,V.error)}}async function IrE(e,t,r,n){let i=Date.now(),a=Object.keys(e).length;r.logger.debug(`Start uploading ${a} files...`);let o=qRo(Object.entries(e),n),c=0;for(let u of o){await Promise.all(u.map(async([l,{uploadUrl:m}])=>{let A=vu.of(l),P=Zj(t,A);try{let C=dO_.lookup(P);await iX.put(m,await(0,TrE.readFile)(P),{headers:{"Content-Type":C===!1?"application/octet-stream":C,"Cache-Control":"public, max-age=31536000, immutable"}})}catch(C){r.failAndThrow(`Failed to upload ${P}`,C)}}));let s=Date.now();c+=u.length,r.logger.debug(`Uploaded ${c}/${a} files in ${s-i}ms`)}let f=Date.now();r.logger.debug(`Finished uploading ${a} files in ${f-i}ms`)}function MrE(e,t){let r=[];for(let[n,i]of Object.entries(e)){let a=vu.of(n),o=Zj(t,a);r.push({relativeFilePath:a,absoluteFilePath:o,fileId:i.fileId})}return r}async function BrE(e,t){switch(await t.instrumentPostHogEvent({command:"docs-generation",properties:{error:JSON.stringify(e)}}),e.error){case"InvalidCustomDomainError":return t.failAndThrow("Your docs domain should end with docs.buildwithfern.com");case"InvalidDomainError":return t.failAndThrow("Please make sure that none of your custom domains are not overlapping (i.e. one is a substring of another)");case"UnauthorizedError":return t.failAndThrow("Please make sure that your FERN_TOKEN is set.");case"UserNotInOrgError":return t.failAndThrow("Please verify if you have access to the organization you are trying to publish the docs to. If you are not a member of the organization, please reach out to the organization owner.");case"UnavailableError":return t.failAndThrow("Failed to publish docs. Please try again later or reach out to Fern support at support@buildwithfern.com.");default:return t.failAndThrow("Failed to publish docs.",e)}}function mS5(e){try{return new URL(uCe(e)).pathname}catch{return}}async function OS5({workspace:e,organization:t,context:r,snippetsConfig:n}){let i={};if(!e)return;let a={typescript:n.typescriptSdk?.package,python:n.pythonSdk?.package,java:n.javaSdk?.coordinate,go:n.goSdk?.githubRepo,csharp:n.csharpSdk?.package,ruby:n.rubySdk?.gem,php:n.phpSdk?.package,swift:n.swiftSdk?.package,rust:void 0};if(e.generatorsConfiguration?.groups)for(let o of e.generatorsConfiguration.groups)for(let c of o.generators){let f=Ytl({apiName:e.workspaceName??"",organization:t,generatorInvocation:c}),u="";if(f?.outputConfig.type==="publish")switch(f.outputConfig.value.type){case"npm":case"nuget":case"pypi":case"rubygems":u=f.outputConfig.value.packageName;break;case"maven":u=f.outputConfig.value.coordinate;break;case"go":u=f.outputConfig.value.repoUrl;break}if(c.language==="php"&&c.config&&typeof c.config=="object"&&"packageName"in c.config&&(u=c.config.packageName??""),!!c.language&&c.language&&a[c.language]===u){let s=VW({workspace:e,generationLanguage:c.language,keywords:void 0,smartCasing:c.smartCasing,exampleGeneration:{disabled:!0,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},audiences:{type:"all"},readme:void 0,packageName:u,version:void 0,context:r,sourceResolver:new LW(r,e),dynamicGeneratorConfig:f}),l=BVo({ir:s,disableExamples:!0,smartCasing:c.smartCasing,generationLanguage:c.language,generatorConfig:f});l?i[c.language]={dynamicIR:l}:r.logger.debug(`Failed to create dynamic IR for ${c.language}`)}}if(Object.keys(i).length>0)return i}async function AS5({dynamicIRs:e,dynamicIRUploadUrls:t,context:r,apiId:n}){if(Object.keys(t).length>0)for(let[i,a]of Object.entries(t)){let o=e[i]?.dynamicIR;o?(await fetch(a.uploadUrl,{method:"PUT",body:JSON.stringify(o),headers:{"Content-Type":"application/octet-stream","Content-Length":JSON.stringify(o).length.toString()}})).ok?r.logger.debug(`Uploaded dynamic IR for ${n}:${i}`):r.logger.warn(`Failed to upload dynamic IR for ${n}:${i}`):r.logger.warn(`Could not find matching dynamic IR to upload for ${n}:${i}`)}}async function pO_({organization:e,apiWorkspaces:t,ossWorkspaces:r,docsWorkspace:n,context:i,token:a,instanceUrl:o,preview:c,disableTemplates:f}){let u=n.config.instances;if(n.config=oSi(n.config,{onError:m=>i.failAndThrow(m)},{substituteAsEmpty:c}),u.length===0){i.failAndThrow("No instances specified in docs.yml! Cannot register docs.");return}if(u.length>1&&o==null){i.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${u[0]?.url})`);return}let s=u.find(m=>m.url===o)??u[0];if(s==null){i.failAndThrow(`No docs instance with url ${o}. Failed to register.`);return}let l=[];s.customDomain!=null&&(typeof s.customDomain=="string"?l.push(s.customDomain):Array.isArray(s.customDomain)&&l.push(...s.customDomain)),await i.runInteractiveTask({name:s.url},async()=>{await qrE({docsWorkspace:n,customDomains:l,domain:s.url,token:a,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:c,editThisPage:s.editThisPage,isPrivate:s.private,disableTemplates:f})})}var RnE=aa(qCi(),1);var I_e={RequestReference:"requestReference",InlinedRequestProperty:"inlinedRequestProperty",Response:"response",StreamingResponse:"streamingResponse"};function mQ(e,t){return r=>{r!=null&&e.docs?.(r,[...t,"docs"])}}function Mjr({example:e,visitor:t,nodePath:r}){if(typeof e=="string")e.startsWith("$")&&t.exampleTypeReference?.(e,r);else if(wq(e))for(let n of Object.values(e))Mjr({example:n,visitor:t,nodePath:r});else if(Array.isArray(e))for(let n of e)Mjr({example:n,visitor:t,nodePath:r})}function pxr(e){return(t,r,{_default:n,validation:i,location:a}={})=>{e.typeReference?.({typeReference:t,_default:n,validation:i,location:a,nodePath:r},r)}}function RrE({service:e,visitor:t,nodePath:r}){t.httpService?.(e,r),jR(e,{url:n=>{t.serviceBaseUrl?.(n,[...r,"url"])},"base-path":Gc,"display-name":Gc,availability:Gc,headers:n=>{NrE({headers:n,visitor:t,nodePath:[...r,"headers"]})},audiences:Gc,auth:Gc,"path-parameters":n=>{yPs({pathParameters:n,visitor:t,nodePath:[...r,"path-parameters"]})},endpoints:n=>{for(let[i,a]of Object.entries(n)){let o=[...r,"endpoints",i];PS5({endpointId:i,endpoint:a,service:e,visitor:t,nodePathForEndpoint:o})}},idempotent:Gc,transport:Gc,source:Gc})}function PS5({endpointId:e,endpoint:t,service:r,visitor:n,nodePathForEndpoint:i}){let a=pxr(n);n.httpEndpoint?.({endpointId:e,endpoint:t,service:r},i),jR(t,{docs:mQ(n,i),"display-name":Gc,availability:Gc,"base-path":Gc,path:Gc,idempotent:Gc,url:o=>{n.endpointBaseUrl?.({baseUrl:o,service:r},[...i,"url"])},"path-parameters":o=>{yPs({pathParameters:o,visitor:n,nodePath:[...i,"path-parameters"]})},request:o=>{if(o==null)return;let c=[...i,"request"];if(typeof o=="string"){a(o,c,{location:"requestReference"});return}jR(o,{name:Gc,docs:mQ(n,c),"path-parameters":f=>{yPs({pathParameters:f,visitor:n,nodePath:[...c,"path-parameters"]})},"query-parameters":f=>{if(f!=null)for(let[u,s]of Object.entries(f)){let l=[...c,"query-parameters",u];n.queryParameter?.({queryParameterKey:u,queryParameter:s},l),typeof s=="string"?a(s,l):jR(s,{name:Gc,docs:mQ(n,l),availability:Gc,type:m=>{a(m,[...l,"type"],{_default:s.default,validation:s.validation})},"allow-multiple":Gc,audiences:Gc,encoding:Gc,default:Gc,validation:Gc})}},"content-type":Gc,headers:f=>{NrE({headers:f,visitor:n,nodePath:[...c,"headers"]})},body:f=>{if(f==null)return;let u=[...c,"body"];typeof f=="string"?a(f,u,{location:"requestReference"}):PU(f)?(n.typeDeclaration?.({typeName:{isInlined:!0,location:"inlinedRequest"},declaration:f},u),jR(f,{extends:s=>{if(s==null)return;let l=typeof s=="string"?[s]:s;for(let m of l){let A=[...u,"extends",m];n.extension?.(m,A),a(m,A)}},properties:s=>{if(s!=null)for(let[l,m]of Object.entries(s)){let A=[...u,"properties",l];typeof m=="string"?a(m,A,{location:I_e.InlinedRequestProperty}):jR(m,{name:Gc,docs:mQ(n,A),availability:Gc,type:P=>{a(P,[...A,"type"],{location:I_e.InlinedRequestProperty,_default:m.default,validation:m.validation})},style:Gc,"content-type":Gc,audiences:Gc,encoding:Gc,default:Gc,validation:Gc})}},"extra-properties":Gc})):(mQ(n,u)(f.docs),a(f.type,u))}})},audiences:Gc,method:Gc,auth:Gc,"stream-condition":o=>{n.streamCondition?.({streamCondition:o,endpoint:t},[...i,"stream-condition"])},"response-stream":o=>{o!=null&&(typeof o=="string"?a(o,[...i,"response-stream"],{location:I_e.StreamingResponse}):a(o.type,[...i,"response-stream"],{location:I_e.StreamingResponse}))},response:o=>{if(o==null)return;let c=[...i,"response"];typeof o=="string"?a(o,c,{location:I_e.Response}):jR(o,{docs:mQ(n,c),type:f=>{f!=null&&a(f,[...c,"type"],{location:I_e.Response})},property:Gc,"status-code":Gc})},errors:o=>{if(o!=null)for(let c of o){let f=[...i,"errors",typeof c=="string"?c:c.error];typeof c=="string"?n.errorReference?.(c,f):jR(c,{docs:mQ(n,f),error:u=>{n.errorReference?.(u,[...f,"error"])}})}},examples:o=>{if(o!=null)for(let[c,f]of o.entries())wS5({nodePathForExample:[...i,{key:"examples",arrayIndex:c}],visitor:n,service:r,endpoint:t,example:f})},pagination:Gc,source:Gc,transport:Gc,retries:Gc})}function wS5({nodePathForExample:e,visitor:t,service:r,endpoint:n,example:i}){if(i.headers==null&&i["path-parameters"]==null&&i["query-parameters"]==null&&i.request==null&&i.response==null&&i["code-samples"]!=null)return;t.exampleHttpEndpointCall?.({service:r,endpoint:n,example:i},e);let a=[...e,"headers"];if(t.exampleHeaders?.({service:r,endpoint:n,examples:i.headers},a),i.headers!=null)for(let s of Object.values(i.headers))Mjr({example:s,visitor:t,nodePath:a});let o=[...e,"path-parameters"];if(t.examplePathParameters?.({service:r,endpoint:n,examples:i["path-parameters"]},o),i["path-parameters"]!=null)for(let s of Object.values(i["path-parameters"]))Mjr({example:s,visitor:t,nodePath:o});let c=[...e,"query-parameters"];if(t.exampleQueryParameters?.({service:r,endpoint:n,examples:i["query-parameters"]},c),i["query-parameters"]!=null)for(let s of Object.values(i["query-parameters"]))Mjr({example:s,visitor:t,nodePath:c});let f=[...e,"request"];t.exampleRequest?.({service:r,endpoint:n,example:i.request},f),i.request!=null&&Mjr({example:i.request,visitor:t,nodePath:f});let u=[...e,"response"];if(t.exampleResponse?.({service:r,endpoint:n,example:i.response},u),i.response!=null&&p$i(n,i.response,{body:s=>{s.body!=null&&Mjr({example:s.body,visitor:t,nodePath:u}),s.error!=null&&t.errorReference?.(s.error,[...u,"error"])},stream:s=>{for(let l of s.stream)Mjr({example:l,visitor:t,nodePath:u})},events:s=>{for(let{data:l}of s.stream)Mjr({example:l,visitor:t,nodePath:u})}}),i["code-samples"]!=null)for(let[s,l]of i["code-samples"].entries())t.exampleCodeSample?.({service:r,endpoint:n,example:i,sample:l},[...e,{key:"code-samples",arrayIndex:s}])}function yPs({pathParameters:e,visitor:t,nodePath:r}){if(e==null)return;let n=pxr(t);for(let[i,a]of Object.entries(e)){let o=[...r,i];t.pathParameter?.({pathParameterKey:i,pathParameter:a},o),D7a(a)?typeof a=="string"?t.variableReference?.(a,o):jR(a,{docs:mQ(t,o),variable:c=>t.variableReference?.(c,[...o,"variable"]),availability:Gc}):typeof a=="string"?n(a,o):jR(a,{docs:mQ(t,o),type:c=>{n(c,[...o,"type"],{_default:a.default,validation:a.validation})},availability:Gc,encoding:Gc,default:Gc,validation:Gc,name:Gc,audiences:Gc})}}function NrE({headers:e,visitor:t,nodePath:r}){if(e==null)return;let n=pxr(t);for(let[i,a]of Object.entries(e)){let o=[...r,i];t.header?.({headerKey:i,header:a},o),typeof a=="string"?n(a,o):jR(a,{name:Gc,availability:Gc,type:c=>{n(c,o,{_default:a.default,validation:a.validation})},docs:mQ(t,o),audiences:Gc,encoding:Gc,env:Gc,default:Gc,validation:Gc})}}function xrE({typeDeclarations:e,visitor:t,nodePath:r}){if(e!=null)for(let[n,i]of Object.entries(e)){let a=[...r,n];t.typeName?.(n,a),_O_({typeName:n,declaration:i,visitor:t,nodePathForType:a})}}function _O_({typeName:e,declaration:t,visitor:r,nodePathForType:n}){let i=pxr(r);r.typeDeclaration?.({typeName:{isInlined:!1,name:e},declaration:t,nodePath:n},n);let a=o=>{if(o!=null)for(let[c,f]of o.entries()){let u=[...n,{key:"examples",arrayIndex:c}];r.exampleType?.({typeName:e,typeDeclaration:t,example:f},u),Mjr({example:f.value,nodePath:u,visitor:r})}};Ak(t,{alias:o=>{typeof o=="string"?i(o,n):jR(o,{type:c=>{i(c,[...n,"type"])},docs:mQ(r,n),availability:Gc,audiences:Gc,examples:a,validation:Gc,encoding:Gc,source:Gc,inline:Gc})},object:o=>{jR(o,{docs:mQ(r,n),extends:c=>{if(c==null)return;let f=typeof c=="string"?[c]:c;for(let u of f){let s=[...n,"extends",u];r.extension?.(u,s),i(u,s)}},properties:c=>{if(c!=null)for(let[f,u]of Object.entries(c)){let s=[...n,"properties",f];typeof u=="string"?i(u,s):jR(u,{name:Gc,docs:mQ(r,s),availability:Gc,type:l=>{i(l,[...s,"type"],{_default:u.default,validation:u.validation})},audiences:Gc,encoding:Gc,default:Gc,validation:Gc,access:Gc})}},"extra-properties":Gc,availability:Gc,audiences:Gc,encoding:Gc,source:Gc,examples:a,inline:Gc})},discriminatedUnion:o=>{jR(o,{docs:mQ(r,n),discriminant:Gc,extends:c=>{if(c==null)return;let f=typeof c=="string"?[c]:c;for(let u of f){let s=[...n,"extends",u];r.extension?.(u,s),i(u,s)}},union:c=>{for(let[f,u]of Object.entries(c)){let s=[...n,"union",f];typeof u=="string"?i(u,s):jR(u,{docs:mQ(r,s),name:Gc,key:Gc,type:l=>{typeof l=="string"&&i(l,[...n,"type"])},"display-name":Gc,availability:Gc})}},"base-properties":Gc,availability:Gc,audiences:Gc,encoding:Gc,source:Gc,examples:a,inline:Gc})},undiscriminatedUnion:o=>{jR(o,{docs:mQ(r,n),discriminated:Gc,union:c=>{for(let[f,u]of c.entries()){let s=[...n,`union[${f}]`];typeof u!="string"&&jR(u,{docs:mQ(r,s),type:l=>{i(l,[...n,"type"])},"display-name":Gc,validation:Gc})}},availability:Gc,audiences:Gc,encoding:Gc,source:Gc,examples:a,inline:Gc})},enum:o=>{jR(o,{docs:mQ(r,n),enum:c=>{for(let f of c){let u=[...n,typeof f=="string"?f:f.name??f.value];typeof f!="string"&&jR(f,{docs:mQ(r,u),name:Gc,value:Gc,casing:Gc})}},availability:Gc,audiences:Gc,default:Gc,encoding:Gc,source:Gc,examples:a,inline:Gc})}})}function FrE({errorDeclarations:e,visitor:t,nodePath:r}){if(e!=null)for(let[n,i]of Object.entries(e)){let a=[...r,n];t.errorDeclaration?.({errorName:n,declaration:i},a),jS5({errorName:n,declaration:i,visitor:t,nodePathForError:a})}}function jS5({errorName:e,declaration:t,visitor:r,nodePathForError:n}){let i=pxr(r);typeof t=="string"?i(t,n):jR(t,{docs:mQ(r,n),"status-code":Gc,type:a=>{if(a==null)return;let o=[...n,"type"];typeof a=="string"?i(a,o):_O_({typeName:e,declaration:a,visitor:r,nodePathForType:o})},examples:a=>{if(a!=null)for(let o of a){let c=[...n,"type"];r.exampleError?.({errorName:e,declaration:t,example:o},c)}}})}function zrE({imports:e,visitor:t,nodePath:r}){if(e!=null)for(let[n,i]of Object.entries(e))t.import?.({importPath:i,importedAs:n},[...r,n])}function QrE({webhook:e,visitor:t,nodePathForWebhook:r}){let n=pxr(t);jR(e,{"display-name":Gc,method:Gc,examples:Gc,headers:i=>{ES5({headers:i,visitor:t,nodePath:[...r,"headers"]})},payload:i=>{let a=[...r,"payload"];if(typeof i=="string"){n(i,a,{location:"requestReference"});return}if(SS5(i)){n(i.type,[...a,"type"],{location:"requestReference"});return}let o=[...a];t.typeDeclaration?.({typeName:{isInlined:!0,location:"inlinedRequest"},declaration:i},o),jR(i,{name:Gc,extends:c=>{if(c==null)return;let f=typeof c=="string"?[c]:c;for(let u of f){let s=[...o,"extends",u];t.extension?.(u,s),n(u,s)}},properties:c=>{if(c!=null)for(let[f,u]of Object.entries(c)){let s=[...o,"properties",f];typeof u=="string"?n(u,s,{location:I_e.InlinedRequestProperty}):jR(u,{name:Gc,docs:mQ(t,s),availability:Gc,type:l=>{n(l,[...s,"type"],{_default:u.default,validation:u.validation,location:I_e.InlinedRequestProperty})},audiences:Gc,encoding:Gc,default:Gc,validation:Gc,access:Gc})}}})},audiences:Gc,availability:Gc,docs:mQ(t,r)})}function ES5({headers:e,visitor:t,nodePath:r}){if(e==null)return;let n=pxr(t);for(let[i,a]of Object.entries(e)){let o=[...r,i];t.header?.({headerKey:i,header:a},o),typeof a=="string"?n(a,o):jR(a,{name:Gc,availability:Gc,type:c=>{n(c,o,{_default:a.default,validation:a.validation})},docs:mQ(t,o),audiences:Gc,encoding:Gc,env:Gc,default:Gc,validation:Gc})}}function SS5(e){return e.type!=null}function h0e(e,t){jR(e,{docs:mQ(t,[]),imports:r=>{zrE({imports:r,visitor:t,nodePath:["imports"]})},types:r=>{xrE({typeDeclarations:r,visitor:t,nodePath:["types"]})},service:r=>{r!=null&&RrE({service:r,visitor:t,nodePath:["service"]})},webhooks:r=>{for(let[n,i]of Object.entries(r??{}))QrE({webhook:i,visitor:t,nodePathForWebhook:["webhooks",n]})},channel:Gc,errors:r=>{FrE({errorDeclarations:r,visitor:t,nodePath:["errors"]})}})}function hO_(e,t){jR(e,{docs:Gc,imports:Gc,types:Gc,service:Gc,webhooks:Gc,errors:Gc,channel:Gc,export:r=>{t.export?.(typeof r=="string"?r:r?.dependency,["export"])},navigation:r=>{t.navigation?.(r,["navigation"])}})}function yO_(e,t){t.file?.(e,[]),jR(e,{version:Gc,product:Gc,name:Gc,"default-url":Gc,"display-name":Gc,imports:Gc,auth:Gc,"idempotency-headers":Gc,"auth-schemes":r=>Object.entries(r??{}).map(([n,i])=>{rUl(i)&&t.oauth?.({name:n,oauth:i},["auth-scheme",n])}),pagination:Gc,"default-environment":r=>{t.defaultEnvironment?.(r,["default-environment"])},docs:Gc,headers:Gc,environments:r=>{if(r!=null)for(let[n,i]of Object.entries(r))t.environment?.({environmentId:n,environment:i},["environments",n])},"error-discrimination":r=>{t.errorDiscrimination?.(r,["error-discrimination"])},audiences:Gc,errors:r=>{if(r!=null)for(let n of r)t.errorReference?.(n,["errors",n])},"base-path":Gc,"path-parameters":r=>{yPs({pathParameters:r,visitor:t,nodePath:["path-parameters"]})},variables:r=>{if(r!=null)for(let[n,i]of Object.entries(r))t.variableDeclaration?.({variableId:n,variable:i},["variables",n])}})}var Trl=new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$");function LrE({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let o=(c,f)=>{for(let u of r){let s=u.definitionFile?.[a];if(s!=null){let l=s(c,{relativeFilepath:e,contents:t});n(l.map(m=>({severity:m.severity,relativeFilepath:e,nodePath:f,message:m.message})))}}};return{[a]:o}}return{...i("docs"),...i("import"),...i("typeReference"),...i("typeDeclaration"),...i("typeName"),...i("httpService"),...i("httpEndpoint"),...i("pathParameter"),...i("queryParameter"),...i("streamCondition"),...i("header"),...i("errorDeclaration"),...i("errorReference"),...i("exampleType"),...i("exampleTypeReference"),...i("exampleHttpEndpointCall"),...i("exampleCodeSample"),...i("exampleHeaders"),...i("examplePathParameters"),...i("exampleQueryParameters"),...i("exampleRequest"),...i("exampleResponse"),...i("variableReference"),...i("extension"),...i("serviceBaseUrl"),...i("endpointBaseUrl"),...i("exampleError")}}function UrE({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let o=(c,f)=>{for(let u of r){let s=u.packageMarker?.[a];if(s!=null){let l=s(c,{relativeFilepath:e,contents:t});n(l.map(m=>({severity:m.severity,relativeFilepath:e,nodePath:f,message:m.message})))}}};return{[a]:o}}return{...i("export"),...i("navigation")}}function VrE({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let o=(c,f)=>{for(let u of r){let s=u.rootApiFile?.[a];if(s!=null){let l=s(c,{relativeFilepath:e,contents:t});n(l.map(m=>({severity:m.severity,relativeFilepath:e,nodePath:f,message:m.message})))}}};return{[a]:o}}return{...i("file"),...i("oauth"),...i("defaultEnvironment"),...i("environment"),...i("errorDiscrimination"),...i("errorReference"),...i("variableDeclaration"),...i("variableReference"),...i("pathParameter")}}var vO_={name:"content-type-only-for-multipart",DISABLE_RULE:!1,create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{if(e.request==null)return[];if(d$i(e.request)!=null)return[];if(typeof e.request!="string"&&e.request.body!=null&&PU(e.request.body)){let r=[];for(let[n,i]of Object.entries(e.request.body.properties??{}))typeof i!="string"&&i["content-type"]!=null&&r.push({severity:"fatal",message:`${n} has content-type, but the request is not multipart`});return r}return[]}}})};var _F=LDe({generationLanguage:void 0,keywords:void 0,smartCasing:!1});var bO_={name:"exploded-form-data-is-array",create:({workspace:e})=>{let t=new GN(e);return{definitionFile:{httpEndpoint:({endpoint:r},{relativeFilepath:n,contents:i})=>{if(r.request==null||typeof r.request=="string"||r.request?.body==null||typeof r.request.body=="string")return[];if(!DS5(r.request.body))return[];let a=[];for(let[o,c]of Object.entries(r.request.body.properties??{})){if(typeof c=="string"||c.style!=="exploded")continue;let f=wS({relativeFilepath:n,definitionFile:i,casingsGenerator:_F,rootApiFile:e.definition.rootApiFile.contents}),u=t.resolveType({type:c.type,file:f});if(u==null)return[];WrE(u)||a.push({message:`${o} is exploded and must be a list. Did you mean list<${c.type}>?`,severity:"error"})}return a}}}}};function WrE(e){return e._type!=="container"?!1:e.container._type==="list"?!0:e.container._type==="optional"||e.container._type==="nullable"?WrE(e.container.itemType):!1}function DS5(e){return e?.properties!=null}var gO_={name:"import-file-exists",create:({workspace:e})=>{let t=Object.keys(hpi(e.definition)),r=new Set;return t.forEach(n=>{let i=$l(e.definition.absoluteFilePath,vu.of(n));r.add(i)}),{definitionFile:{import:({importedAs:n,importPath:i},{relativeFilepath:a})=>{let o=[],c=$l(e.definition.absoluteFilePath,xg(a),vu.of(i));return r.has(c)||o.push({severity:"fatal",message:`Import ${gd.bold(n)} points to non-existent path ${gd.bold(i)}.`}),o}}}}};function qrl(e){return e.definition.rootApiFile.contents.environments==null?[]:Object.values(e.definition.rootApiFile.contents.environments).reduce((t,r)=>{if(Ttt(r))for(let n of Object.keys(r.urls))t.includes(n)||t.push(n);return t},[])}var mO_={name:"matching-environment-urls",create:({workspace:e})=>{let t=qrl(e);return t.length===0?{}:{rootApiFile:{environment:({environmentId:r,environment:n})=>{let i=[],a=o=>{i.push({severity:"fatal",message:`Environment ${r} is missing URL for ${gd.bold(o)}`})};return e8r(n,{singleBaseUrl:()=>{for(let o of t)a(o)},multipleBaseUrls:o=>{for(let c of t)o.urls[c]==null&&a(c)}}),i}}}}};var OO_={name:"no-circular-imports",DISABLE_RULE:!0,create:({workspace:e})=>{let t=CS5(e.definition.namedDefinitionFiles);return{definitionFile:{import:({importPath:r},{relativeFilepath:n})=>{let i=t[n];if(i==null)return[];let a=pqi({referencedIn:n,importPath:vu.of(r)});return i.filter(({chainWithoutStartingFilepath:c})=>c.length===0||c[0]===a).map(c=>({severity:"fatal",message:c.chainWithoutStartingFilepath.length===0?"A file cannot import itself":`Circular import detected: ${[c.startingFilepath,...c.chainWithoutStartingFilepath,c.startingFilepath].join(" -> ")}`}))}}}}};function CS5(e){let t={};for(let r of gCr(e))t[r]=HrE(r,[r],e);return t}function HrE(e,t,r){let n=[],i=r[e];if(i==null)return[];if(i.contents.imports!=null)for(let a of Object.values(i.contents.imports)){let o=pqi({referencedIn:e,importPath:vu.of(a)});t.includes(o)?t[0]===o&&t[0]===IS5(t)&&n.push({startingFilepath:o,chainWithoutStartingFilepath:t.slice(1)}):n.push(...HrE(o,[...t,o],r))}return n}function IS5(e){return e.reduce((t,r)=>r<t?r:t)}var Rrl=class{workspace;typeResolver;constructor(t){this.workspace=t,this.typeResolver=new GN(t)}isTypeComplex(t,r){let n=wS({relativeFilepath:r.relativeFilepath,definitionFile:r.contents,casingsGenerator:_F,rootApiFile:this.workspace.definition.rootApiFile.contents}),i=this.typeResolver.resolveType({type:t,file:n});if(i==null)return;let a=new Set;return this.isResolvedReferenceComplex({type:i,file:n,visited:a})}isResolvedReferenceComplex({type:t,file:r,visited:n}){switch(t._type){case"container":return this.isResolvedContainerComplex({type:t.container,file:r,visited:n});case"named":return this.isNamedTypeComplex({type:t,file:r,visited:n});case"primitive":return!1;case"unknown":return!0;default:fc(t)}}isResolvedContainerComplex({type:t,file:r,visited:n}){switch(t._type){case"literal":return!1;case"map":return(this.isResolvedReferenceComplex({type:t.keyType,file:r,visited:n})||this.isResolvedReferenceComplex({type:t.valueType,file:r,visited:n}))&&!(t.keyType._type==="primitive"&&t.keyType.primitive.v1==="STRING"&&t.valueType._type==="unknown");case"optional":case"nullable":case"list":case"set":return this.isResolvedReferenceComplex({type:t.itemType,file:r,visited:n});default:fc(t)}}isNamedTypeComplex({type:t,file:r,visited:n}){if(n.has(t.rawName))return!1;if(n.add(t.rawName),pCi(t.declaration))return!0;if(sIr(t.declaration))return!1;if(Wx(t.declaration))return this.objectHasComplexProperties({typeName:t.rawName,objectDeclaration:t.declaration,file:r,visited:n});if(C7a(t.declaration)){for(let i of t.declaration.union){let a=typeof i=="string"?i:i.type,o=this.isTypeComplex(a,{contents:r.definitionFile,relativeFilepath:r.relativeFilepath});if(o!=null&&o)return!0}return!1}fc(t.declaration)}objectHasComplexProperties({typeName:t,objectDeclaration:r,file:n,visited:i}){return oBr({typeName:t,objectDeclaration:r,typeResolver:this.typeResolver,definitionFile:n.definitionFile,workspace:this.workspace,filepathOfDeclaration:n.relativeFilepath,smartCasing:!1}).some(o=>this.isComplex({type:o.resolvedPropertyType,file:n,visited:i}))}isComplex({type:t,file:r,visited:n}){switch(t._type){case"named":return this.isNamedTypeComplex({type:t,file:r,visited:n});case"primitive":case"unknown":return!1;case"container":return this.isComplexContainer({type:t.container,file:r,visited:n});default:fc(t)}}isComplexContainer({type:t,file:r,visited:n}){switch(t._type){case"literal":return!1;case"map":return this.isComplex({type:t.keyType,file:r,visited:n})||this.isComplex({type:t.valueType,file:r,visited:n});case"optional":case"nullable":case"list":case"set":return this.isComplex({type:t.itemType,file:r,visited:n});default:fc(t)}}};var AO_={name:"no-complex-query-params",create:({workspace:e})=>{let t=new Rrl(e);return{definitionFile:{queryParameter:({queryParameter:r},n)=>{let i=typeof r=="string"?r:r.type,a=t.isTypeComplex(i,n);return a!=null&&a?[{severity:"fatal",message:`${i} is not a valid type for a query parameter`}]:[]}}}}};var PO_={name:"no-conflicting-endpoint-parameters",create:()=>({definitionFile:{pathParameter:({pathParameterKey:e})=>e===Gqu?[{severity:"fatal",message:`Path parameter ${gd.bold(e)} is not suitable for code generation, because it can conflict with the request body parameter.`}]:[]}})};function vPs({service:e,endpoint:t}){return e["base-path"]+t.path}var Nrl=class{root=new wO_;registerEndpoint(t){this.root.insert(this.getPathPartsForEndpoint(t),t)}getConflictingEndpoints(t){return this.root.getMatchingEndpoints(this.getPathPartsForEndpoint(t)).filter(r=>!(r.relativeFilepath===t.relativeFilepath&&r.endpointId===t.endpointId)&&r.endpoint.method===t.endpoint.method)}getPathPartsForEndpoint(t){return vPs({service:t.service,endpoint:t.endpoint}).split("/").filter(r=>r.length>0)}},wO_=class e{childPaths={};childPathParam;endpointsThatEndWithThisNode=[];insert(t,r){let[n,...i]=t;if(n==null){this.endpointsThatEndWithThisNode.push(r);return}(this.isPathParam(n)?this.childPathParam??=new e:this.childPaths[n]??=new e).insert(i,r)}getMatchingEndpoints(t){let[r,...n]=t;if(r==null)return this.endpointsThatEndWithThisNode;let i=[];if(this.isPathParam(r))i.push(...Object.values(this.childPaths).flatMap(a=>a.getMatchingEndpoints(n)));else{let a=this.childPaths[r];a!=null&&i.push(...a.getMatchingEndpoints(n))}return this.childPathParam!=null&&i.push(...this.childPathParam.getMatchingEndpoints(n)),i}isPathParam(t){return t.startsWith("{")&&t.endsWith("}")}};var jO_={name:"no-conflicting-endpoint-paths",create:({workspace:e})=>{let t=new Nrl;return Vk(e,(r,n)=>{h0e(n,{httpEndpoint:({service:i,endpointId:a,endpoint:o})=>{t.registerEndpoint({service:i,endpointId:a,endpoint:o,relativeFilepath:r})}})}),{definitionFile:{httpEndpoint:({service:r,endpoint:n,endpointId:i},{relativeFilepath:a})=>{let o=t.getConflictingEndpoints({service:r,endpointId:i,endpoint:n,relativeFilepath:a});return o.length===0?[]:[{severity:"warning",message:[`Endpoint path ${vPs({service:r,endpoint:n})} conflicts with other endpoints:`,...o.map(c=>` - ${c.relativeFilepath} -> ${c.endpointId} ${gd.dim(vPs({service:c.service,endpoint:c.endpoint}))}`)].join(`
3026
+ ${JSON.stringify(ve.error)}`)}}).resolve();if(P==null)return c.failAndThrow("Failed to publish docs.","Docs registration ID is missing.");c.logger.debug("Publishing docs...");let V=await m.docs.v2.write.finishDocsRegister(vai.FernRegistry.docs.v1.write.DocsRegistrationId(P),{docsDefinition:R});if(V.ok){let $=uCe(C),re=WOi($,$);c.logger.info(gd.green(`Published docs to ${re}`))}else switch(V.error.error){case"UnauthorizedError":case"UserNotInOrgError":return c.failAndThrow("Insufficient permissions. Failed to publish docs to "+n);case"DocsRegistrationIdNotFound":return c.failAndThrow("Failed to publish docs to "+n,`Docs registration ID ${P} does not exist.`);default:return c.failAndThrow("Failed to publish docs to "+n,V.error)}}async function IrE(e,t,r,n){let i=Date.now(),a=Object.keys(e).length;r.logger.debug(`Start uploading ${a} files...`);let o=qRo(Object.entries(e),n),c=0;for(let u of o){await Promise.all(u.map(async([l,{uploadUrl:m}])=>{let A=vu.of(l),P=Zj(t,A);try{let C=dO_.lookup(P);await iX.put(m,await(0,TrE.readFile)(P),{headers:{"Content-Type":C===!1?"application/octet-stream":C,"Cache-Control":"public, max-age=31536000, immutable"}})}catch(C){r.failAndThrow(`Failed to upload ${P}`,C)}}));let s=Date.now();c+=u.length,r.logger.debug(`Uploaded ${c}/${a} files in ${s-i}ms`)}let f=Date.now();r.logger.debug(`Finished uploading ${a} files in ${f-i}ms`)}function MrE(e,t){let r=[];for(let[n,i]of Object.entries(e)){let a=vu.of(n),o=Zj(t,a);r.push({relativeFilePath:a,absoluteFilePath:o,fileId:i.fileId})}return r}async function BrE(e,t){switch(await t.instrumentPostHogEvent({command:"docs-generation",properties:{error:JSON.stringify(e)}}),e.error){case"InvalidCustomDomainError":return t.failAndThrow("Your docs domain should end with docs.buildwithfern.com");case"InvalidDomainError":return t.failAndThrow("Please make sure that none of your custom domains are not overlapping (i.e. one is a substring of another)");case"UnauthorizedError":return t.failAndThrow("Please make sure that your FERN_TOKEN is set.");case"UserNotInOrgError":return t.failAndThrow("Please verify if you have access to the organization you are trying to publish the docs to. If you are not a member of the organization, please reach out to the organization owner.");case"UnavailableError":return t.failAndThrow("Failed to publish docs. Please try again later or reach out to Fern support at support@buildwithfern.com.");default:return t.failAndThrow("Failed to publish docs.",e)}}function mS5(e){try{return new URL(uCe(e)).pathname}catch{return}}async function OS5({workspace:e,organization:t,context:r,snippetsConfig:n}){let i={};if(!e)return;let a={typescript:n.typescriptSdk?.package,python:n.pythonSdk?.package,java:n.javaSdk?.coordinate,go:n.goSdk?.githubRepo,csharp:n.csharpSdk?.package,ruby:n.rubySdk?.gem,php:n.phpSdk?.package,swift:n.swiftSdk?.package,rust:void 0};if(e.generatorsConfiguration?.groups)for(let o of e.generatorsConfiguration.groups)for(let c of o.generators){let f=Ytl({apiName:e.workspaceName??"",organization:t,generatorInvocation:c}),u="";if(f?.outputConfig.type==="publish")switch(f.outputConfig.value.type){case"npm":case"nuget":case"pypi":case"rubygems":u=f.outputConfig.value.packageName;break;case"maven":u=f.outputConfig.value.coordinate;break;case"go":u=f.outputConfig.value.repoUrl;break}if(c.language==="php"&&c.config&&typeof c.config=="object"&&"packageName"in c.config&&(u=c.config.packageName??""),!!c.language&&c.language&&a[c.language]===u){let s=VW({workspace:e,generationLanguage:c.language,keywords:void 0,smartCasing:c.smartCasing,exampleGeneration:{disabled:!0,skipAutogenerationIfManualExamplesExist:!0,skipErrorAutogenerationIfManualErrorExamplesExist:!0},audiences:{type:"all"},readme:void 0,packageName:u,version:void 0,context:r,sourceResolver:new LW(r,e),dynamicGeneratorConfig:f}),l=BVo({ir:s,disableExamples:!0,smartCasing:c.smartCasing,generationLanguage:c.language,generatorConfig:f});l?i[c.language]={dynamicIR:l}:r.logger.debug(`Failed to create dynamic IR for ${c.language}`)}}for(let[o,c]of Object.entries(a))o&&c&&!Object.keys(i).includes(o)&&(r.logger.warn(),r.logger.warn(`Failed to upload ${o} SDK snippets because of unknown package \`${c}\`.`),r.logger.warn(`Please make sure your ${e.workspaceName?`${e.workspaceName}/`:""}generators.yml has a generator that publishes a ${c} package.`),r.logger.warn());if(Object.keys(i).length>0)return i}async function AS5({dynamicIRs:e,dynamicIRUploadUrls:t,context:r,apiId:n}){if(Object.keys(t).length>0)for(let[i,a]of Object.entries(t)){let o=e[i]?.dynamicIR;o?(await fetch(a.uploadUrl,{method:"PUT",body:JSON.stringify(o),headers:{"Content-Type":"application/octet-stream","Content-Length":JSON.stringify(o).length.toString()}})).ok?r.logger.debug(`Uploaded dynamic IR for ${n}:${i}`):r.logger.warn(`Failed to upload dynamic IR for ${n}:${i}`):r.logger.warn(`Could not find matching dynamic IR to upload for ${n}:${i}`)}}async function pO_({organization:e,apiWorkspaces:t,ossWorkspaces:r,docsWorkspace:n,context:i,token:a,instanceUrl:o,preview:c,disableTemplates:f}){let u=n.config.instances;if(n.config=oSi(n.config,{onError:m=>i.failAndThrow(m)},{substituteAsEmpty:c}),u.length===0){i.failAndThrow("No instances specified in docs.yml! Cannot register docs.");return}if(u.length>1&&o==null){i.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${u[0]?.url})`);return}let s=u.find(m=>m.url===o)??u[0];if(s==null){i.failAndThrow(`No docs instance with url ${o}. Failed to register.`);return}let l=[];s.customDomain!=null&&(typeof s.customDomain=="string"?l.push(s.customDomain):Array.isArray(s.customDomain)&&l.push(...s.customDomain)),await i.runInteractiveTask({name:s.url},async()=>{await qrE({docsWorkspace:n,customDomains:l,domain:s.url,token:a,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:c,editThisPage:s.editThisPage,isPrivate:s.private,disableTemplates:f})})}var RnE=aa(qCi(),1);var I_e={RequestReference:"requestReference",InlinedRequestProperty:"inlinedRequestProperty",Response:"response",StreamingResponse:"streamingResponse"};function mQ(e,t){return r=>{r!=null&&e.docs?.(r,[...t,"docs"])}}function Mjr({example:e,visitor:t,nodePath:r}){if(typeof e=="string")e.startsWith("$")&&t.exampleTypeReference?.(e,r);else if(wq(e))for(let n of Object.values(e))Mjr({example:n,visitor:t,nodePath:r});else if(Array.isArray(e))for(let n of e)Mjr({example:n,visitor:t,nodePath:r})}function pxr(e){return(t,r,{_default:n,validation:i,location:a}={})=>{e.typeReference?.({typeReference:t,_default:n,validation:i,location:a,nodePath:r},r)}}function RrE({service:e,visitor:t,nodePath:r}){t.httpService?.(e,r),jR(e,{url:n=>{t.serviceBaseUrl?.(n,[...r,"url"])},"base-path":Gc,"display-name":Gc,availability:Gc,headers:n=>{NrE({headers:n,visitor:t,nodePath:[...r,"headers"]})},audiences:Gc,auth:Gc,"path-parameters":n=>{yPs({pathParameters:n,visitor:t,nodePath:[...r,"path-parameters"]})},endpoints:n=>{for(let[i,a]of Object.entries(n)){let o=[...r,"endpoints",i];PS5({endpointId:i,endpoint:a,service:e,visitor:t,nodePathForEndpoint:o})}},idempotent:Gc,transport:Gc,source:Gc})}function PS5({endpointId:e,endpoint:t,service:r,visitor:n,nodePathForEndpoint:i}){let a=pxr(n);n.httpEndpoint?.({endpointId:e,endpoint:t,service:r},i),jR(t,{docs:mQ(n,i),"display-name":Gc,availability:Gc,"base-path":Gc,path:Gc,idempotent:Gc,url:o=>{n.endpointBaseUrl?.({baseUrl:o,service:r},[...i,"url"])},"path-parameters":o=>{yPs({pathParameters:o,visitor:n,nodePath:[...i,"path-parameters"]})},request:o=>{if(o==null)return;let c=[...i,"request"];if(typeof o=="string"){a(o,c,{location:"requestReference"});return}jR(o,{name:Gc,docs:mQ(n,c),"path-parameters":f=>{yPs({pathParameters:f,visitor:n,nodePath:[...c,"path-parameters"]})},"query-parameters":f=>{if(f!=null)for(let[u,s]of Object.entries(f)){let l=[...c,"query-parameters",u];n.queryParameter?.({queryParameterKey:u,queryParameter:s},l),typeof s=="string"?a(s,l):jR(s,{name:Gc,docs:mQ(n,l),availability:Gc,type:m=>{a(m,[...l,"type"],{_default:s.default,validation:s.validation})},"allow-multiple":Gc,audiences:Gc,encoding:Gc,default:Gc,validation:Gc})}},"content-type":Gc,headers:f=>{NrE({headers:f,visitor:n,nodePath:[...c,"headers"]})},body:f=>{if(f==null)return;let u=[...c,"body"];typeof f=="string"?a(f,u,{location:"requestReference"}):PU(f)?(n.typeDeclaration?.({typeName:{isInlined:!0,location:"inlinedRequest"},declaration:f},u),jR(f,{extends:s=>{if(s==null)return;let l=typeof s=="string"?[s]:s;for(let m of l){let A=[...u,"extends",m];n.extension?.(m,A),a(m,A)}},properties:s=>{if(s!=null)for(let[l,m]of Object.entries(s)){let A=[...u,"properties",l];typeof m=="string"?a(m,A,{location:I_e.InlinedRequestProperty}):jR(m,{name:Gc,docs:mQ(n,A),availability:Gc,type:P=>{a(P,[...A,"type"],{location:I_e.InlinedRequestProperty,_default:m.default,validation:m.validation})},style:Gc,"content-type":Gc,audiences:Gc,encoding:Gc,default:Gc,validation:Gc})}},"extra-properties":Gc})):(mQ(n,u)(f.docs),a(f.type,u))}})},audiences:Gc,method:Gc,auth:Gc,"stream-condition":o=>{n.streamCondition?.({streamCondition:o,endpoint:t},[...i,"stream-condition"])},"response-stream":o=>{o!=null&&(typeof o=="string"?a(o,[...i,"response-stream"],{location:I_e.StreamingResponse}):a(o.type,[...i,"response-stream"],{location:I_e.StreamingResponse}))},response:o=>{if(o==null)return;let c=[...i,"response"];typeof o=="string"?a(o,c,{location:I_e.Response}):jR(o,{docs:mQ(n,c),type:f=>{f!=null&&a(f,[...c,"type"],{location:I_e.Response})},property:Gc,"status-code":Gc})},errors:o=>{if(o!=null)for(let c of o){let f=[...i,"errors",typeof c=="string"?c:c.error];typeof c=="string"?n.errorReference?.(c,f):jR(c,{docs:mQ(n,f),error:u=>{n.errorReference?.(u,[...f,"error"])}})}},examples:o=>{if(o!=null)for(let[c,f]of o.entries())wS5({nodePathForExample:[...i,{key:"examples",arrayIndex:c}],visitor:n,service:r,endpoint:t,example:f})},pagination:Gc,source:Gc,transport:Gc,retries:Gc})}function wS5({nodePathForExample:e,visitor:t,service:r,endpoint:n,example:i}){if(i.headers==null&&i["path-parameters"]==null&&i["query-parameters"]==null&&i.request==null&&i.response==null&&i["code-samples"]!=null)return;t.exampleHttpEndpointCall?.({service:r,endpoint:n,example:i},e);let a=[...e,"headers"];if(t.exampleHeaders?.({service:r,endpoint:n,examples:i.headers},a),i.headers!=null)for(let s of Object.values(i.headers))Mjr({example:s,visitor:t,nodePath:a});let o=[...e,"path-parameters"];if(t.examplePathParameters?.({service:r,endpoint:n,examples:i["path-parameters"]},o),i["path-parameters"]!=null)for(let s of Object.values(i["path-parameters"]))Mjr({example:s,visitor:t,nodePath:o});let c=[...e,"query-parameters"];if(t.exampleQueryParameters?.({service:r,endpoint:n,examples:i["query-parameters"]},c),i["query-parameters"]!=null)for(let s of Object.values(i["query-parameters"]))Mjr({example:s,visitor:t,nodePath:c});let f=[...e,"request"];t.exampleRequest?.({service:r,endpoint:n,example:i.request},f),i.request!=null&&Mjr({example:i.request,visitor:t,nodePath:f});let u=[...e,"response"];if(t.exampleResponse?.({service:r,endpoint:n,example:i.response},u),i.response!=null&&p$i(n,i.response,{body:s=>{s.body!=null&&Mjr({example:s.body,visitor:t,nodePath:u}),s.error!=null&&t.errorReference?.(s.error,[...u,"error"])},stream:s=>{for(let l of s.stream)Mjr({example:l,visitor:t,nodePath:u})},events:s=>{for(let{data:l}of s.stream)Mjr({example:l,visitor:t,nodePath:u})}}),i["code-samples"]!=null)for(let[s,l]of i["code-samples"].entries())t.exampleCodeSample?.({service:r,endpoint:n,example:i,sample:l},[...e,{key:"code-samples",arrayIndex:s}])}function yPs({pathParameters:e,visitor:t,nodePath:r}){if(e==null)return;let n=pxr(t);for(let[i,a]of Object.entries(e)){let o=[...r,i];t.pathParameter?.({pathParameterKey:i,pathParameter:a},o),D7a(a)?typeof a=="string"?t.variableReference?.(a,o):jR(a,{docs:mQ(t,o),variable:c=>t.variableReference?.(c,[...o,"variable"]),availability:Gc}):typeof a=="string"?n(a,o):jR(a,{docs:mQ(t,o),type:c=>{n(c,[...o,"type"],{_default:a.default,validation:a.validation})},availability:Gc,encoding:Gc,default:Gc,validation:Gc,name:Gc,audiences:Gc})}}function NrE({headers:e,visitor:t,nodePath:r}){if(e==null)return;let n=pxr(t);for(let[i,a]of Object.entries(e)){let o=[...r,i];t.header?.({headerKey:i,header:a},o),typeof a=="string"?n(a,o):jR(a,{name:Gc,availability:Gc,type:c=>{n(c,o,{_default:a.default,validation:a.validation})},docs:mQ(t,o),audiences:Gc,encoding:Gc,env:Gc,default:Gc,validation:Gc})}}function xrE({typeDeclarations:e,visitor:t,nodePath:r}){if(e!=null)for(let[n,i]of Object.entries(e)){let a=[...r,n];t.typeName?.(n,a),_O_({typeName:n,declaration:i,visitor:t,nodePathForType:a})}}function _O_({typeName:e,declaration:t,visitor:r,nodePathForType:n}){let i=pxr(r);r.typeDeclaration?.({typeName:{isInlined:!1,name:e},declaration:t,nodePath:n},n);let a=o=>{if(o!=null)for(let[c,f]of o.entries()){let u=[...n,{key:"examples",arrayIndex:c}];r.exampleType?.({typeName:e,typeDeclaration:t,example:f},u),Mjr({example:f.value,nodePath:u,visitor:r})}};Ak(t,{alias:o=>{typeof o=="string"?i(o,n):jR(o,{type:c=>{i(c,[...n,"type"])},docs:mQ(r,n),availability:Gc,audiences:Gc,examples:a,validation:Gc,encoding:Gc,source:Gc,inline:Gc})},object:o=>{jR(o,{docs:mQ(r,n),extends:c=>{if(c==null)return;let f=typeof c=="string"?[c]:c;for(let u of f){let s=[...n,"extends",u];r.extension?.(u,s),i(u,s)}},properties:c=>{if(c!=null)for(let[f,u]of Object.entries(c)){let s=[...n,"properties",f];typeof u=="string"?i(u,s):jR(u,{name:Gc,docs:mQ(r,s),availability:Gc,type:l=>{i(l,[...s,"type"],{_default:u.default,validation:u.validation})},audiences:Gc,encoding:Gc,default:Gc,validation:Gc,access:Gc})}},"extra-properties":Gc,availability:Gc,audiences:Gc,encoding:Gc,source:Gc,examples:a,inline:Gc})},discriminatedUnion:o=>{jR(o,{docs:mQ(r,n),discriminant:Gc,extends:c=>{if(c==null)return;let f=typeof c=="string"?[c]:c;for(let u of f){let s=[...n,"extends",u];r.extension?.(u,s),i(u,s)}},union:c=>{for(let[f,u]of Object.entries(c)){let s=[...n,"union",f];typeof u=="string"?i(u,s):jR(u,{docs:mQ(r,s),name:Gc,key:Gc,type:l=>{typeof l=="string"&&i(l,[...n,"type"])},"display-name":Gc,availability:Gc})}},"base-properties":Gc,availability:Gc,audiences:Gc,encoding:Gc,source:Gc,examples:a,inline:Gc})},undiscriminatedUnion:o=>{jR(o,{docs:mQ(r,n),discriminated:Gc,union:c=>{for(let[f,u]of c.entries()){let s=[...n,`union[${f}]`];typeof u!="string"&&jR(u,{docs:mQ(r,s),type:l=>{i(l,[...n,"type"])},"display-name":Gc,validation:Gc})}},availability:Gc,audiences:Gc,encoding:Gc,source:Gc,examples:a,inline:Gc})},enum:o=>{jR(o,{docs:mQ(r,n),enum:c=>{for(let f of c){let u=[...n,typeof f=="string"?f:f.name??f.value];typeof f!="string"&&jR(f,{docs:mQ(r,u),name:Gc,value:Gc,casing:Gc})}},availability:Gc,audiences:Gc,default:Gc,encoding:Gc,source:Gc,examples:a,inline:Gc})}})}function FrE({errorDeclarations:e,visitor:t,nodePath:r}){if(e!=null)for(let[n,i]of Object.entries(e)){let a=[...r,n];t.errorDeclaration?.({errorName:n,declaration:i},a),jS5({errorName:n,declaration:i,visitor:t,nodePathForError:a})}}function jS5({errorName:e,declaration:t,visitor:r,nodePathForError:n}){let i=pxr(r);typeof t=="string"?i(t,n):jR(t,{docs:mQ(r,n),"status-code":Gc,type:a=>{if(a==null)return;let o=[...n,"type"];typeof a=="string"?i(a,o):_O_({typeName:e,declaration:a,visitor:r,nodePathForType:o})},examples:a=>{if(a!=null)for(let o of a){let c=[...n,"type"];r.exampleError?.({errorName:e,declaration:t,example:o},c)}}})}function zrE({imports:e,visitor:t,nodePath:r}){if(e!=null)for(let[n,i]of Object.entries(e))t.import?.({importPath:i,importedAs:n},[...r,n])}function QrE({webhook:e,visitor:t,nodePathForWebhook:r}){let n=pxr(t);jR(e,{"display-name":Gc,method:Gc,examples:Gc,headers:i=>{ES5({headers:i,visitor:t,nodePath:[...r,"headers"]})},payload:i=>{let a=[...r,"payload"];if(typeof i=="string"){n(i,a,{location:"requestReference"});return}if(SS5(i)){n(i.type,[...a,"type"],{location:"requestReference"});return}let o=[...a];t.typeDeclaration?.({typeName:{isInlined:!0,location:"inlinedRequest"},declaration:i},o),jR(i,{name:Gc,extends:c=>{if(c==null)return;let f=typeof c=="string"?[c]:c;for(let u of f){let s=[...o,"extends",u];t.extension?.(u,s),n(u,s)}},properties:c=>{if(c!=null)for(let[f,u]of Object.entries(c)){let s=[...o,"properties",f];typeof u=="string"?n(u,s,{location:I_e.InlinedRequestProperty}):jR(u,{name:Gc,docs:mQ(t,s),availability:Gc,type:l=>{n(l,[...s,"type"],{_default:u.default,validation:u.validation,location:I_e.InlinedRequestProperty})},audiences:Gc,encoding:Gc,default:Gc,validation:Gc,access:Gc})}}})},audiences:Gc,availability:Gc,docs:mQ(t,r)})}function ES5({headers:e,visitor:t,nodePath:r}){if(e==null)return;let n=pxr(t);for(let[i,a]of Object.entries(e)){let o=[...r,i];t.header?.({headerKey:i,header:a},o),typeof a=="string"?n(a,o):jR(a,{name:Gc,availability:Gc,type:c=>{n(c,o,{_default:a.default,validation:a.validation})},docs:mQ(t,o),audiences:Gc,encoding:Gc,env:Gc,default:Gc,validation:Gc})}}function SS5(e){return e.type!=null}function h0e(e,t){jR(e,{docs:mQ(t,[]),imports:r=>{zrE({imports:r,visitor:t,nodePath:["imports"]})},types:r=>{xrE({typeDeclarations:r,visitor:t,nodePath:["types"]})},service:r=>{r!=null&&RrE({service:r,visitor:t,nodePath:["service"]})},webhooks:r=>{for(let[n,i]of Object.entries(r??{}))QrE({webhook:i,visitor:t,nodePathForWebhook:["webhooks",n]})},channel:Gc,errors:r=>{FrE({errorDeclarations:r,visitor:t,nodePath:["errors"]})}})}function hO_(e,t){jR(e,{docs:Gc,imports:Gc,types:Gc,service:Gc,webhooks:Gc,errors:Gc,channel:Gc,export:r=>{t.export?.(typeof r=="string"?r:r?.dependency,["export"])},navigation:r=>{t.navigation?.(r,["navigation"])}})}function yO_(e,t){t.file?.(e,[]),jR(e,{version:Gc,product:Gc,name:Gc,"default-url":Gc,"display-name":Gc,imports:Gc,auth:Gc,"idempotency-headers":Gc,"auth-schemes":r=>Object.entries(r??{}).map(([n,i])=>{rUl(i)&&t.oauth?.({name:n,oauth:i},["auth-scheme",n])}),pagination:Gc,"default-environment":r=>{t.defaultEnvironment?.(r,["default-environment"])},docs:Gc,headers:Gc,environments:r=>{if(r!=null)for(let[n,i]of Object.entries(r))t.environment?.({environmentId:n,environment:i},["environments",n])},"error-discrimination":r=>{t.errorDiscrimination?.(r,["error-discrimination"])},audiences:Gc,errors:r=>{if(r!=null)for(let n of r)t.errorReference?.(n,["errors",n])},"base-path":Gc,"path-parameters":r=>{yPs({pathParameters:r,visitor:t,nodePath:["path-parameters"]})},variables:r=>{if(r!=null)for(let[n,i]of Object.entries(r))t.variableDeclaration?.({variableId:n,variable:i},["variables",n])}})}var Trl=new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$");function LrE({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let o=(c,f)=>{for(let u of r){let s=u.definitionFile?.[a];if(s!=null){let l=s(c,{relativeFilepath:e,contents:t});n(l.map(m=>({severity:m.severity,relativeFilepath:e,nodePath:f,message:m.message})))}}};return{[a]:o}}return{...i("docs"),...i("import"),...i("typeReference"),...i("typeDeclaration"),...i("typeName"),...i("httpService"),...i("httpEndpoint"),...i("pathParameter"),...i("queryParameter"),...i("streamCondition"),...i("header"),...i("errorDeclaration"),...i("errorReference"),...i("exampleType"),...i("exampleTypeReference"),...i("exampleHttpEndpointCall"),...i("exampleCodeSample"),...i("exampleHeaders"),...i("examplePathParameters"),...i("exampleQueryParameters"),...i("exampleRequest"),...i("exampleResponse"),...i("variableReference"),...i("extension"),...i("serviceBaseUrl"),...i("endpointBaseUrl"),...i("exampleError")}}function UrE({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let o=(c,f)=>{for(let u of r){let s=u.packageMarker?.[a];if(s!=null){let l=s(c,{relativeFilepath:e,contents:t});n(l.map(m=>({severity:m.severity,relativeFilepath:e,nodePath:f,message:m.message})))}}};return{[a]:o}}return{...i("export"),...i("navigation")}}function VrE({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let o=(c,f)=>{for(let u of r){let s=u.rootApiFile?.[a];if(s!=null){let l=s(c,{relativeFilepath:e,contents:t});n(l.map(m=>({severity:m.severity,relativeFilepath:e,nodePath:f,message:m.message})))}}};return{[a]:o}}return{...i("file"),...i("oauth"),...i("defaultEnvironment"),...i("environment"),...i("errorDiscrimination"),...i("errorReference"),...i("variableDeclaration"),...i("variableReference"),...i("pathParameter")}}var vO_={name:"content-type-only-for-multipart",DISABLE_RULE:!1,create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{if(e.request==null)return[];if(d$i(e.request)!=null)return[];if(typeof e.request!="string"&&e.request.body!=null&&PU(e.request.body)){let r=[];for(let[n,i]of Object.entries(e.request.body.properties??{}))typeof i!="string"&&i["content-type"]!=null&&r.push({severity:"fatal",message:`${n} has content-type, but the request is not multipart`});return r}return[]}}})};var _F=LDe({generationLanguage:void 0,keywords:void 0,smartCasing:!1});var bO_={name:"exploded-form-data-is-array",create:({workspace:e})=>{let t=new GN(e);return{definitionFile:{httpEndpoint:({endpoint:r},{relativeFilepath:n,contents:i})=>{if(r.request==null||typeof r.request=="string"||r.request?.body==null||typeof r.request.body=="string")return[];if(!DS5(r.request.body))return[];let a=[];for(let[o,c]of Object.entries(r.request.body.properties??{})){if(typeof c=="string"||c.style!=="exploded")continue;let f=wS({relativeFilepath:n,definitionFile:i,casingsGenerator:_F,rootApiFile:e.definition.rootApiFile.contents}),u=t.resolveType({type:c.type,file:f});if(u==null)return[];WrE(u)||a.push({message:`${o} is exploded and must be a list. Did you mean list<${c.type}>?`,severity:"error"})}return a}}}}};function WrE(e){return e._type!=="container"?!1:e.container._type==="list"?!0:e.container._type==="optional"||e.container._type==="nullable"?WrE(e.container.itemType):!1}function DS5(e){return e?.properties!=null}var gO_={name:"import-file-exists",create:({workspace:e})=>{let t=Object.keys(hpi(e.definition)),r=new Set;return t.forEach(n=>{let i=$l(e.definition.absoluteFilePath,vu.of(n));r.add(i)}),{definitionFile:{import:({importedAs:n,importPath:i},{relativeFilepath:a})=>{let o=[],c=$l(e.definition.absoluteFilePath,xg(a),vu.of(i));return r.has(c)||o.push({severity:"fatal",message:`Import ${gd.bold(n)} points to non-existent path ${gd.bold(i)}.`}),o}}}}};function qrl(e){return e.definition.rootApiFile.contents.environments==null?[]:Object.values(e.definition.rootApiFile.contents.environments).reduce((t,r)=>{if(Ttt(r))for(let n of Object.keys(r.urls))t.includes(n)||t.push(n);return t},[])}var mO_={name:"matching-environment-urls",create:({workspace:e})=>{let t=qrl(e);return t.length===0?{}:{rootApiFile:{environment:({environmentId:r,environment:n})=>{let i=[],a=o=>{i.push({severity:"fatal",message:`Environment ${r} is missing URL for ${gd.bold(o)}`})};return e8r(n,{singleBaseUrl:()=>{for(let o of t)a(o)},multipleBaseUrls:o=>{for(let c of t)o.urls[c]==null&&a(c)}}),i}}}}};var OO_={name:"no-circular-imports",DISABLE_RULE:!0,create:({workspace:e})=>{let t=CS5(e.definition.namedDefinitionFiles);return{definitionFile:{import:({importPath:r},{relativeFilepath:n})=>{let i=t[n];if(i==null)return[];let a=pqi({referencedIn:n,importPath:vu.of(r)});return i.filter(({chainWithoutStartingFilepath:c})=>c.length===0||c[0]===a).map(c=>({severity:"fatal",message:c.chainWithoutStartingFilepath.length===0?"A file cannot import itself":`Circular import detected: ${[c.startingFilepath,...c.chainWithoutStartingFilepath,c.startingFilepath].join(" -> ")}`}))}}}}};function CS5(e){let t={};for(let r of gCr(e))t[r]=HrE(r,[r],e);return t}function HrE(e,t,r){let n=[],i=r[e];if(i==null)return[];if(i.contents.imports!=null)for(let a of Object.values(i.contents.imports)){let o=pqi({referencedIn:e,importPath:vu.of(a)});t.includes(o)?t[0]===o&&t[0]===IS5(t)&&n.push({startingFilepath:o,chainWithoutStartingFilepath:t.slice(1)}):n.push(...HrE(o,[...t,o],r))}return n}function IS5(e){return e.reduce((t,r)=>r<t?r:t)}var Rrl=class{workspace;typeResolver;constructor(t){this.workspace=t,this.typeResolver=new GN(t)}isTypeComplex(t,r){let n=wS({relativeFilepath:r.relativeFilepath,definitionFile:r.contents,casingsGenerator:_F,rootApiFile:this.workspace.definition.rootApiFile.contents}),i=this.typeResolver.resolveType({type:t,file:n});if(i==null)return;let a=new Set;return this.isResolvedReferenceComplex({type:i,file:n,visited:a})}isResolvedReferenceComplex({type:t,file:r,visited:n}){switch(t._type){case"container":return this.isResolvedContainerComplex({type:t.container,file:r,visited:n});case"named":return this.isNamedTypeComplex({type:t,file:r,visited:n});case"primitive":return!1;case"unknown":return!0;default:fc(t)}}isResolvedContainerComplex({type:t,file:r,visited:n}){switch(t._type){case"literal":return!1;case"map":return(this.isResolvedReferenceComplex({type:t.keyType,file:r,visited:n})||this.isResolvedReferenceComplex({type:t.valueType,file:r,visited:n}))&&!(t.keyType._type==="primitive"&&t.keyType.primitive.v1==="STRING"&&t.valueType._type==="unknown");case"optional":case"nullable":case"list":case"set":return this.isResolvedReferenceComplex({type:t.itemType,file:r,visited:n});default:fc(t)}}isNamedTypeComplex({type:t,file:r,visited:n}){if(n.has(t.rawName))return!1;if(n.add(t.rawName),pCi(t.declaration))return!0;if(sIr(t.declaration))return!1;if(Wx(t.declaration))return this.objectHasComplexProperties({typeName:t.rawName,objectDeclaration:t.declaration,file:r,visited:n});if(C7a(t.declaration)){for(let i of t.declaration.union){let a=typeof i=="string"?i:i.type,o=this.isTypeComplex(a,{contents:r.definitionFile,relativeFilepath:r.relativeFilepath});if(o!=null&&o)return!0}return!1}fc(t.declaration)}objectHasComplexProperties({typeName:t,objectDeclaration:r,file:n,visited:i}){return oBr({typeName:t,objectDeclaration:r,typeResolver:this.typeResolver,definitionFile:n.definitionFile,workspace:this.workspace,filepathOfDeclaration:n.relativeFilepath,smartCasing:!1}).some(o=>this.isComplex({type:o.resolvedPropertyType,file:n,visited:i}))}isComplex({type:t,file:r,visited:n}){switch(t._type){case"named":return this.isNamedTypeComplex({type:t,file:r,visited:n});case"primitive":case"unknown":return!1;case"container":return this.isComplexContainer({type:t.container,file:r,visited:n});default:fc(t)}}isComplexContainer({type:t,file:r,visited:n}){switch(t._type){case"literal":return!1;case"map":return this.isComplex({type:t.keyType,file:r,visited:n})||this.isComplex({type:t.valueType,file:r,visited:n});case"optional":case"nullable":case"list":case"set":return this.isComplex({type:t.itemType,file:r,visited:n});default:fc(t)}}};var AO_={name:"no-complex-query-params",create:({workspace:e})=>{let t=new Rrl(e);return{definitionFile:{queryParameter:({queryParameter:r},n)=>{let i=typeof r=="string"?r:r.type,a=t.isTypeComplex(i,n);return a!=null&&a?[{severity:"fatal",message:`${i} is not a valid type for a query parameter`}]:[]}}}}};var PO_={name:"no-conflicting-endpoint-parameters",create:()=>({definitionFile:{pathParameter:({pathParameterKey:e})=>e===Gqu?[{severity:"fatal",message:`Path parameter ${gd.bold(e)} is not suitable for code generation, because it can conflict with the request body parameter.`}]:[]}})};function vPs({service:e,endpoint:t}){return e["base-path"]+t.path}var Nrl=class{root=new wO_;registerEndpoint(t){this.root.insert(this.getPathPartsForEndpoint(t),t)}getConflictingEndpoints(t){return this.root.getMatchingEndpoints(this.getPathPartsForEndpoint(t)).filter(r=>!(r.relativeFilepath===t.relativeFilepath&&r.endpointId===t.endpointId)&&r.endpoint.method===t.endpoint.method)}getPathPartsForEndpoint(t){return vPs({service:t.service,endpoint:t.endpoint}).split("/").filter(r=>r.length>0)}},wO_=class e{childPaths={};childPathParam;endpointsThatEndWithThisNode=[];insert(t,r){let[n,...i]=t;if(n==null){this.endpointsThatEndWithThisNode.push(r);return}(this.isPathParam(n)?this.childPathParam??=new e:this.childPaths[n]??=new e).insert(i,r)}getMatchingEndpoints(t){let[r,...n]=t;if(r==null)return this.endpointsThatEndWithThisNode;let i=[];if(this.isPathParam(r))i.push(...Object.values(this.childPaths).flatMap(a=>a.getMatchingEndpoints(n)));else{let a=this.childPaths[r];a!=null&&i.push(...a.getMatchingEndpoints(n))}return this.childPathParam!=null&&i.push(...this.childPathParam.getMatchingEndpoints(n)),i}isPathParam(t){return t.startsWith("{")&&t.endsWith("}")}};var jO_={name:"no-conflicting-endpoint-paths",create:({workspace:e})=>{let t=new Nrl;return Vk(e,(r,n)=>{h0e(n,{httpEndpoint:({service:i,endpointId:a,endpoint:o})=>{t.registerEndpoint({service:i,endpointId:a,endpoint:o,relativeFilepath:r})}})}),{definitionFile:{httpEndpoint:({service:r,endpoint:n,endpointId:i},{relativeFilepath:a})=>{let o=t.getConflictingEndpoints({service:r,endpointId:i,endpoint:n,relativeFilepath:a});return o.length===0?[]:[{severity:"warning",message:[`Endpoint path ${vPs({service:r,endpoint:n})} conflicts with other endpoints:`,...o.map(c=>` - ${c.relativeFilepath} -> ${c.endpointId} ${gd.dim(vPs({service:c.service,endpoint:c.endpoint}))}`)].join(`
3027
3027
  `)}]}}}}};var EO_={name:"no-conflicting-request-wrapper-properties",create:({workspace:e})=>({definitionFile:{httpEndpoint:({endpoint:t,service:r},{contents:n,relativeFilepath:i})=>{let a=MS5({endpoint:t,service:r,relativeFilepath:i,definitionFile:n,workspace:e}),o=[];for(let[c,f]of Object.entries(a))f.length<=1||o.push({severity:"fatal",message:`Multiple request properties have the name ${gd.bold(c)}. This is not suitable for code generation. Use the "name" property to deconflict.
3028
3028
  `+f.map(u=>` - ${BS5(u)}`).join(`
3029
3029
  `)});return o}}})};function MS5({endpoint:e,service:t,relativeFilepath:r,definitionFile:n,workspace:i}){let a={},o=(c,f)=>{(a[c]??=[]).push(f)};if(e.request!=null&&typeof e.request!="string"&&e.request.body!=null&&!PU(e.request.body)&&Jqu({request:e.request,file:wS({relativeFilepath:r,definitionFile:n,casingsGenerator:_F,rootApiFile:i.definition.rootApiFile.contents}),typeResolver:new GN(i)})&&o(DVo,{type:"referenced-body",propertyName:DVo}),t.headers!=null)for(let[c,f]of Object.entries(t.headers))o(SUr({headerKey:c,header:f}).name,{type:"service-header",headerKey:c,header:f});if(e.request!=null&&typeof e.request!="string"){if(e.request.headers!=null)for(let[c,f]of Object.entries(e.request.headers))o(SUr({headerKey:c,header:f}).name,{type:"endpoint-header",headerKey:c,header:f});if(e.request["query-parameters"]!=null)for(let[c,f]of Object.entries(e.request["query-parameters"]))o(Z_i({queryParameterKey:c,queryParameter:f}).name,{type:"endpoint-query-parameter",queryParameterKey:c,queryParameter:f});if(e.request.body!=null&&PU(e.request.body)){let c=oBr({typeName:void 0,objectDeclaration:{extends:e.request.body.extends,properties:e.request.body.properties??{}},filepathOfDeclaration:r,definitionFile:n,workspace:i,typeResolver:new GN(i),smartCasing:!1});for(let f of c)o(f.name,{type:"inlined-body",property:f})}}return a}function BS5(e){switch(e.type){case"service-header":return`Service header "${e.headerKey}"`;case"endpoint-header":return`Endpoint header "${e.headerKey}"`;case"endpoint-query-parameter":return`Query Parameter "${e.queryParameterKey}"`;case"inlined-body":return`Body property: ${WJa({property:e.property,prefixBreadcrumbs:["<Request Body>"]})}`;case"referenced-body":return`Body property "${e.propertyName}"`;default:fc(e)}}var SO_=aa(require("path"),1);var DO_={name:"no-duplicate-declarations",create:({workspace:e,logger:t})=>{let r=TS5(e),n={},i=({declaredName:a,relativeFilepath:o})=>{let c=SO_.default.dirname(o),f=r[c]?.[a];if(f==null)return t.error(`Could not find declarations for name: ${a}. This is an error in the Fern validator.`),[];let u=n[c]??=new Set;if(!u.has(a))return u.add(a),[];let s=f.indexOf(o);return f.filter((m,A)=>A!==s).map(m=>({severity:"fatal",message:`${a} is already declared in ${m===o?"this file":m}`}))};return{definitionFile:{typeName:(a,{relativeFilepath:o})=>i({declaredName:a,relativeFilepath:o}),errorDeclaration:({errorName:a},{relativeFilepath:o})=>i({declaredName:a,relativeFilepath:o}),httpEndpoint:({endpoint:a},{relativeFilepath:o})=>typeof a.request!="string"&&a.request?.name!=null?i({declaredName:a.request.name,relativeFilepath:o}):[]}}}};function TS5(e){let t={};return Vk(e,(r,n)=>{let i=SO_.default.dirname(r),a=t[i]??={},o=c=>{(a[c]??=[]).push(r)};h0e(n,{typeName:c=>{o(c)},errorDeclaration:({errorName:c})=>{o(c)},httpEndpoint:({endpoint:c})=>{typeof c.request!="string"&&c.request?.name!=null&&o(c.request.name)}})}),t}function bPs(e){let t=new Set,r=new Set,n=[];for(let i of e)t.has(i)&&!r.has(i)&&(r.add(i),n.push(i)),t.add(i);return n}var CO_={name:"no-duplicate-enum-values",create:()=>({definitionFile:{typeDeclaration:({declaration:e})=>sIr(e)?bPs(e.enum.map(r=>typeof r=="string"?r:r.value)).map(r=>({severity:"fatal",message:`Duplicated enum value: ${gd.bold(r)}.`})):[]}})};var IO_={name:"no-duplicate-example-names",create:()=>({definitionFile:{typeDeclaration:({declaration:e})=>{if(typeof e=="string"||e.examples==null)return[];let t=e.examples.map(r=>r.name).filter(qw);return bPs(t).map(r=>({severity:"fatal",message:`Duplicate example name: ${r}`}))},httpEndpoint:({endpoint:e})=>{if(e.examples==null)return[];let t=e.examples.map(r=>r.name).filter(qw);return bPs(t).map(r=>({severity:"fatal",message:`Duplicate example name: ${r}`}))}}})};function GrE(e){if(!e.isInlined)return e.name;switch(e.location){case"inlinedRequest":return"<Inlined Request>";default:fc(e.location)}}var MO_={name:"no-duplicate-field-names",create:({workspace:e})=>{let t=new GN(e);return{definitionFile:{typeDeclaration:({typeName:r,declaration:n},{relativeFilepath:i,contents:a})=>{let o=[];return Ak(n,{alias:hft,enum:c=>{let f=JrE(c.enum,u=>$Ja(u).name);for(let u of f)o.push({severity:"fatal",message:`Name "${u}" is used by multiple values.`})},object:c=>{let f=GrE(r),u=oBr({typeName:f,objectDeclaration:c,filepathOfDeclaration:i,definitionFile:a,workspace:e,typeResolver:t,smartCasing:!1}),s=vFl(u,l=>l.name);for(let[l,m]of Object.entries(s))if(m.length>1){let A=[`Object has multiple properties named "${l}":`,...m.map(P=>` - ${WJa({property:P,prefixBreadcrumbs:[f]})}`)].join(`