fern-api 0.86.1 → 0.86.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.cjs +5 -5
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -2161,7 +2161,7 @@ ${_0y.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&$hf(th
|
|
|
2161
2161
|
`+hsa.default.red(">> ")+t),this.screen.render(r,n)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?hsa.default.cyan(P0y(t,this.opt.mask)):hsa.default.italic(hsa.default.dim("[hidden]")):this.opt.mask?P0y(t,this.opt.mask):hsa.default.italic(hsa.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 m1s=fa(rse(),1);var Pmy=fa(Iyf(),1),b1s=require("child_process"),AZa=require("fs"),v1s=fa(require("path"),1),wmy=fa(require("os"),1),jmy=require("crypto"),_vf=fa(Omy(),1);var _1s=class extends Error{originalError;constructor(t){super(`Failed to create temporary file. ${t.message}`),this.originalError=t}};var _Jo=class extends Error{originalError;constructor(t){super(`Failed to launch editor. ${t.message}`),this.originalError=t}};var h1s=class extends Error{originalError;constructor(t){super(`Failed to read temporary file. ${t.message}`),this.originalError=t}};var y1s=class extends Error{originalError;constructor(t){super(`Failed to remove temporary file. ${t.message}`),this.originalError=t}};function g1s(e="",t,r){let n=new hvf(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 Amy(e){return e?e.replace(/[^a-zA-Z0-9_.-]/g,"_"):""}function ttC(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 hvf=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=ttC(t).map(i=>i.replace("\\ "," ")),n=r.shift();this.editor={args:r,bin:n}}createTemporaryFile(){try{let t=this.fileOptions.dir??wmy.default.tmpdir(),r=(0,jmy.randomUUID)(),n=Amy(this.fileOptions.prefix),i=Amy(this.fileOptions.postfix),a=`${n}${r}${i}`,o=v1s.default.resolve(t,a),c=v1s.default.resolve(t)+v1s.default.sep;if(!o.startsWith(c))throw new Error("Resolved temporary file escaped the base directory");this.tempFile=o;let d={encoding:"utf8",flag:"wx"};Object.prototype.hasOwnProperty.call(this.fileOptions,"mode")&&(d.mode=this.fileOptions.mode),(0,AZa.writeFileSync)(this.tempFile,this.text,d)}catch(t){throw new _1s(t)}}readTemporaryFile(){try{let t=(0,AZa.readFileSync)(this.tempFile);if(t.length===0)this.text="";else{let r=(0,Pmy.detect)(t)??"utf8";_vf.default.encodingExists(r)||(r="utf8"),this.text=_vf.default.decode(t,r)}}catch(t){throw new h1s(t)}}removeTemporaryFile(){try{(0,AZa.unlinkSync)(this.tempFile)}catch(t){throw new y1s(t)}}launchEditor(){try{let t=(0,b1s.spawnSync)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"});this.lastExitStatus=t.status??0}catch(t){throw new _Jo(t)}}launchEditorAsync(t){try{(0,b1s.spawn)(this.editor.bin,this.editor.args.concat([this.tempFile]),{stdio:"inherit"}).on("exit",n=>{this.lastExitStatus=n,setImmediate(t)})}catch(r){throw new _Jo(r)}}};var Emy=fa(wnt(),1);var hJo=class extends nse{_run(t){this.done=t,this.editorResult=new Emy.Subject;let r=Nbe(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"?m1s.default.dim("Received"):m1s.default.dim("Press <enter> to launch your preferred editor."),t&&(r=m1s.default.red(">> ")+t),this.screen.render(n,r)}startExternalEditor(){this.rl.pause(),g1s(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 Mmy=require("stream");var Cmy=fa(require("readline"),1),Imy=fa(Dmy(),1),gsa=class{constructor(t){this.rl||=Cmy.default.createInterface(ntC(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 ntC(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 Imy.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var yJo=class extends gsa{constructor(t={}){super(t),this.log=new Mmy.Writable({write:(r,n,i)=>{this.writeLog(r),i()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return kGo(this.rl,this.bottomBar.split(`
|
|
2162
2162
|
`).length),this}updateBottomBar(t){return kGo(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+`
|
|
2163
2163
|
`}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&&Ujs(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var W6=fa(wnt(),1),qmy=fa(mGo(),1);var O1s=fa(wnt(),1),Bmy=fa(mGo(),1),A1s=function(e,t,r){return typeof e[t]!="function"?(0,O1s.of)(e):(0,O1s.from)((0,Bmy.default)(e[t])(r).then(n=>(e[t]=n,e)))};var Tmy={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}},PZa=class extends gsa{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,W6.from)(t):(0,W6.isObservable)(t)?n=t:Object.values(t).every(i=>typeof i=="object"&&!Array.isArray(i)&&i!=null)?n=(0,W6.from)(Object.entries(t).map(([i,a])=>({name:i,...a}))):n=(0,W6.from)([t]),this.process=n.pipe((0,W6.concatMap)(this.processQuestion.bind(this)),(0,W6.publish)()),this.process.connect(),this.process.pipe((0,W6.reduce)((i,a)=>(Tmy.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,W6.defer)(()=>(0,W6.of)(t).pipe((0,W6.concatMap)(this.setDefaultType.bind(this)),(0,W6.concatMap)(this.filterIfRunnable.bind(this)),(0,W6.concatMap)(()=>A1s(t,"message",this.answers)),(0,W6.concatMap)(()=>A1s(t,"default",this.answers)),(0,W6.concatMap)(()=>A1s(t,"choices",this.answers)),(0,W6.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,W6.defer)(()=>(0,W6.from)(this.activePrompt.run().then(n=>({name:t.name,answer:n}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,W6.defer)(()=>(0,W6.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&Tmy.get(this.answers,t.name)!==void 0)return W6.EMPTY;if(t.when===!1)return W6.EMPTY;if(typeof t.when!="function")return(0,W6.of)(t);let{answers:r}=this;return(0,W6.defer)(()=>(0,W6.from)((0,qmy.default)(t.when)(r).then(n=>{if(n)return t})).pipe((0,W6.filter)(n=>n!=null)))}};function Rmy(e){let t=function(r,n){let i;try{i=new PZa(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",tJo),this.registerPrompt("input",_sa),this.registerPrompt("number",rJo),this.registerPrompt("confirm",nJo),this.registerPrompt("rawlist",iJo),this.registerPrompt("expand",aJo),this.registerPrompt("checkbox",oJo),this.registerPrompt("password",uJo),this.registerPrompt("editor",hJo)},t.restoreDefaultPrompts(),t}var vvf=Rmy();function atC(e,t){vvf.registerPrompt(e,t)}function otC(){vvf.restoreDefaultPrompts()}var utC={prompt:vvf,ui:{BottomBar:yJo,Prompt:PZa},createPromptModule:Rmy,registerPrompt:atC,restoreDefaultPrompts:otC,Separator:Rxe},P1s=utC;var NZa=require("path"),OAy=require("fs"),AAy=require("readline"),GOy="posthog-node";function KnC(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[G1s.POSTHOG_ID_TAG];if(c===void 0)return a;let d=e.options.host??"https://us.i.posthog.com",s=new URL(`/project/${e.apiKey}/person/${c}`,d).toString();a.tags["PostHog Person URL"]=s;let u=a.exception?.values||[],l=u.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:u[0]?.value||a.message,$exception_type:u[0]?.type,$exception_personURL:s,$exception_level:a.level,$exception_list:l,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:u[0]?.value||a.message,$sentry_exception_type:u[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 G1s=class{constructor(t,r,n,i){this.name=GOy,this.name=GOy,this.setupOnce=function(a,o){let c=o()?.getClient()?.getDsn()?.projectId;a(KnC(t,{organization:r,projectId:c,prefix:n,severityAllowList:i}))}}};G1s.POSTHOG_ID_TAG="posthog_distinct_id";var L1s="0123456789abcdef",J1s=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+=L1s.charAt(this.bytes[r]>>>4),t+=L1s.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+=L1s.charAt(this.bytes[r]>>>4),t+=L1s.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}},abf=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??$nC()}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 J1s.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,J1s.ofInner(t)}},$nC=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),JOy,obf=()=>YnC().toString(),YnC=()=>(JOy||(JOy=new abf)).generate();function XnC(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 ZnC(e,t){global.process.on("uncaughtException",XnC(e,t))}function knC(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var U1s,KOy,V1s;function eiC(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return V1s&&r.length===KOy||(KOy=r.length,V1s=r.reduce((n,i)=>{U1s||(U1s={});let a=U1s[i];if(a)n[a[0]]=a[1];else{let o=e(i);for(let c=o.length-1;c>=0;c--){let s=o[c]?.filename,u=t[i];if(s&&u){n[s]=u,U1s[i]=[s,u];break}}}return n},{})),V1s}function tiC(e){return typeof Event<"u"&&PAy(e,Event)}function riC(e){return wAy(e,"Object")}function _bf(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return PAy(e,Error)}}function PAy(e,t){try{return e instanceof t}catch{return!1}}function niC(e){return wAy(e,"ErrorEvent")}function wAy(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function iiC(e,t,r,n){let a=n&&n.mechanism||{handled:!0,type:"generic"},o=jAy(a,r,n);return{$exception_list:await Promise.all(o.map(async s=>{let u=await fiC(e,t,s);return u.value=u.value||"",u.type=u.type||"Error",u.mechanism=a,u}))}}function jAy(e,t,r){let n=aiC(e,t,r);return n.cause?[n,...jAy(e,n.cause,r)]:[n]}function aiC(e,t,r){if(_bf(t))return t;if(e.synthetic=!0,riC(t)){let i=oiC(t);if(i)return i;let a=uiC(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 oiC(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(_bf(r))return r}}function uiC(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=ciC(e);if(niC(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=siC(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function siC(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function ciC(e,t=40){let r=Object.keys(liC(e));r.sort();let n=r[0];if(!n)return"[object has no keys]";if(n.length>=t)return $Oy(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:$Oy(a,t)}return""}function $Oy(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function liC(e){return _bf(e)?{message:e.message,name:e.name,stack:e.stack,...YOy(e)}:tiC(e)?{type:e.type,target:XOy(e.target),currentTarget:XOy(e.currentTarget),...YOy(e)}:e}function YOy(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 XOy(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function fiC(e,t,r){let n={type:r.name||r.constructor.name,value:r.message},i=diC(e,r);for(let a of t)i=await a(i);return i.length&&(n.stacktrace={frames:i,type:"raw"}),n}function diC(e,t){return piC(e(t.stack||"",1),e)}function piC(e,t){let r=eiC(t);return e.forEach(n=>{n.filename&&(n.chunk_id=r[n.filename])}),e}var _iC=2e3,TZa=class e{static async captureException(t,r,n,i,a){let o={...a};i||(o.$process_person_profile=!1);let c=await iiC(this.stackParser,this.frameModifiers,r,n);t.capture({event:"$exception",distinctId:i||obf(),properties:{...c,...o}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(ZnC(this.onException.bind(this),this.onFatalError.bind(this)),knC(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(_iC)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function hiC(e=process.argv[1]?(0,NZa.dirname)(process.argv[1]):process.cwd(),t=NZa.sep==="\\"){let r=t?ZOy(e):e;return n=>{if(!n)return;let i=t?ZOy(n):n,{dir:a,base:o,ext:c}=NZa.posix.parse(i);(c===".js"||c===".mjs"||c===".cjs")&&(o=o.slice(0,c.length*-1));let d=decodeURIComponent(o);a||(a=".");let s=a.lastIndexOf("/node_modules");if(s>-1)return`${a.slice(s+14).replace(/\//g,".")}:${d}`;if(a.startsWith(r)){let u=a.slice(r.length+1).replace(/\//g,".");return u?`${u}:${d}`:d}return d}}function ZOy(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var K1s=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)}}},H1s=new K1s(25),EAy=new K1s(20),hbf=7,yiC=1e3,viC=1e4;async function biC(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"||AiC(o)||PiC(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(EAy.get(i))continue;let a=t[i];if(!a)continue;a.sort((d,s)=>d-s);let o=jiC(a);if(o.every(d=>wiC(i,d)))continue;let c=EiC(H1s,i,{});n.push(giC(i,o,c))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&miC(e,H1s),H1s.reduce(),e}function giC(e,t,r){return new Promise(n=>{let i=(0,OAy.createReadStream)(e),a=(0,AAy.createInterface)({input:i});function o(){i.destroy(),n()}let c=0,d=0,s=t[d];if(s===void 0){o();return}let u=s[0],l=s[1];function m(){EAy.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<u)&&(r[c]=SiC(A,0),c>=l)){if(d===t.length-1){a.close(),a.removeAllListeners();return}d++;let P=t[d];if(P===void 0){a.close(),a.removeAllListeners();return}u=P[0],l=P[1]}})})}function miC(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;OiC(r.lineno,r,n)}}function OiC(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let i=SAy(e);i<e;i++){let a=r[i];if(a===void 0){kOy(t);return}t.pre_context.push(a)}if(r[e]===void 0){kOy(t);return}t.context_line=r[e];let n=DAy(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 kOy(e){delete e.pre_context,delete e.context_line,delete e.post_context}function AiC(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function PiC(e){return e.lineno!==void 0&&e.lineno>viC||e.colno!==void 0&&e.colno>yiC}function wiC(e,t){let r=H1s.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 jiC(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let n=eAy(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+hbf:(i.push(n),n=eAy(a)),t++}return i}function eAy(e){return[SAy(e),DAy(e)]}function SAy(e){return Math.max(1,e-hbf)}function DAy(e){return e+hbf}function EiC(e,t,r){let n=e.get(t);return n===void 0?(e.set(t,r),r):n}function SiC(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 DiC="4.18.0",Qxe;(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"})(Qxe||(Qxe={}));var tAy;(function(e){e.Left="left",e.Right="right",e.Center="center"})(tAy||(tAy={}));var rAy;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(rAy||(rAy={}));var nAy;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(nAy||(nAy={}));var iAy;(function(e){e.Html="html",e.Text="text"})(iAy||(iAy={}));var aAy;(function(e){e.Number="number",e.Emoji="emoji"})(aAy||(aAy={}));var oAy;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(oAy||(oAy={}));var uAy;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(uAy||(uAy={}));var sAy;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(sAy||(sAy={}));var cAy;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(cAy||(cAy={}));var CiC=e=>{if("flags"in e){let t=MiC(e.flags),r=BiC(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([i,a])=>[i,CAy(a)])),n=Object.fromEntries(Object.entries(t).map(([i,a])=>[i,IiC(i,a,r[i])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:n}}};function IiC(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 MiC=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,ybf(r)]).filter(([,t])=>t!==void 0)),BiC=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?CAy(n):void 0]}))},ybf=e=>e===void 0?void 0:e.variant??e.enabled,CAy=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},TiC=1,qiC=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"]),RiC="utf8";function NiC(e,t){if(!e||typeof e!="string"||FiC(e))throw new Error(t)}function FiC(e){return e.trim().length===0}function xiC(e){return e?.replace(/\/+$/,"")}async function ziC(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 lAy(){return new Date().getTime()}function nbf(){return new Date().toISOString()}function $1s(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function QiC(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function LiC(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 UiC(e,t=0,r){let n=LiC(e);return r?.has(n)?!1:parseInt(n,16)/4294967295<t}function fAy(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var EJo=String.fromCharCode,dAy="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",W1s={};function ViC(e,t){if(!W1s[e]){W1s[e]={};for(let r=0;r<e.length;r++)W1s[e][e.charAt(r)]=r}return W1s[e][t]}var MZa={compressToBase64:function(e){if(e==null)return"";let t=MZa._compress(e,6,function(r){return dAy.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:MZa._decompress(e.length,32,function(t){return ViC(dAy,e.charAt(t))})},compress:function(e){return MZa._compress(e,16,function(t){return EJo(t)})},_compress:function(e,t,r){if(e==null)return"";let n={},i={},a=[],o,c,d="",s="",u="",l=2,m=3,A=2,P=0,C=0,M;for(M=0;M<e.length;M+=1)if(d=e.charAt(M),Object.prototype.hasOwnProperty.call(n,d)||(n[d]=m++,i[d]=!0),s=u+d,Object.prototype.hasOwnProperty.call(n,s))u=s;else{if(Object.prototype.hasOwnProperty.call(i,u)){if(u.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=u.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=u.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[u]}else for(c=n[u],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[s]=m++,u=String(d)}if(u!==""){if(Object.prototype.hasOwnProperty.call(i,u)){if(u.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=u.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=u.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[u]}else for(c=n[u],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:MZa._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,d=3,s="",u,l,m,A,P,C,M;for(u=0;u<3;u+=1)n[u]=u;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=EJo(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=EJo(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,d),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++]=EJo(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++]=EJo(m),M=c-1,o--;break;case 2:return i.join("")}if(o==0&&(o=Math.pow(2,d),d++),n[M])s=n[M];else if(M===c)s=l+l.charAt(0);else return null;i.push(s),n[c++]=l+s.charAt(0),o--,l=s,o==0&&(o=Math.pow(2,d),d++)}}},ubf=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)}},qZa=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()}},SJo=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function pAy(e){if(e instanceof qZa){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 ibf(e){return typeof e=="object"&&(e instanceof qZa||e instanceof SJo)}function _Ay(e){return typeof e=="object"&&e instanceof qZa&&e.status===413}var sbf;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(sbf||(sbf={}));var cbf=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new ubf,this._isInitialized=!1,NiC(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=xiC(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:ibf},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(Qxe.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(Qxe.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(Qxe.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=obf();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=UiC(this.apiKey,TiC,qiC)?`${this.host}/flags/?v=2`:`${this.host}/decide/?v=4`,d={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,d,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(s=>s.json()).then(s=>CiC(s)).catch(s=>{this._events.emit("error",s)})}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 d=ybf(c.response);return d===void 0&&(d=!1),{response:d,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 d=c[t];return d===void 0?null:d}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 d=await this.getDecide(t,r,n,i,c);if(d!==void 0)return d.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"),d.quotaLimited?.includes(sbf.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:d?.requestId}):d}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(Qxe.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(Qxe.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(Qxe.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(Qxe.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(Qxe.Queue,a),this._events.emit(t,i),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=$1s(()=>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:nbf()};this.historicalMigration&&(i.historical_migration=!0);let a=JSON.stringify(i),o=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${lAy()}&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(MZa.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(o,c)}catch(d){this._events.emit("error",d)}}prepareMessage(t,r,n){let i={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:n?.timestamp?n?.timestamp:nbf(),uuid:n?.uuid?n.uuid:obf()};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 pAy(t)})}async flush(){let t=fAy([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),fAy([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(Qxe.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(Qxe.Queue)||[]).slice(i.length);this.setPersistedProperty(Qxe.Queue,A),t=A},c={api_key:this.apiKey,batch:a,sent_at:nbf()};this.historicalMigration&&(c.historical_migration=!0);let d=JSON.stringify(c),s=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${lAy()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,u=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(MZa.compressToBase64(d))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:d},l={retryCheck:m=>_Ay(m)?!1:ibf(m)};try{await this.fetchWithRetry(s,u,l)}catch(m){if(_Ay(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 SJo||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(s){let u=new AbortController;return setTimeout(()=>u.abort(),s),u.signal});let o=r.body?r.body:"",c=-1;try{c=Buffer.byteLength(o,RiC)}catch{c=new TextEncoder().encode(o).length}return await ziC(async()=>{let d=null;try{d=await this.fetch(t,{signal:AbortSignal.timeout(i??this.requestTimeout),...r})}catch(u){throw new SJo(u)}if(!(r.mode==="no-cors")&&(d.status<200||d.status>=400))throw new qZa(d,c);return d},{...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(Qxe.Queue)||[]).length===0||(await this.flush(),r)););}catch(i){if(!ibf(i))throw i;await pAy(i)}};return Promise.race([new Promise((i,a)=>{$1s(()=>{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}},lbf=QiC();if(!lbf){let e=HOy();lbf=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 IAy=lbf,Y1s=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()}},MAy=new Y1s(async()=>{try{return await import("crypto")}catch{return}});async function WiC(){return await MAy.getValue()}var HiC=new Y1s(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await MAy.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function GiC(){return await HiC.getValue()}async function JiC(e){let t=await WiC();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await GiC();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 KiC=60*1e3,$iC=1152921504606847e3,YiC=["is_not"],BZa=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)}},fbf=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||IAy,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 d of this.featureFlags)if(t===d.key){c=d;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(d){d instanceof ise?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${d}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return 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 d=>{try{let s=await this.computeFlagLocally(d,t,r,n,i);a[d.key]=s;let u=await this.computeFeatureFlagPayloadLocally(d.key,s);u&&(o[d.key]=u)}catch(s){s instanceof ise||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),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 d=this.groupTypeMapping[String(c)];if(!d)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(!(d in n))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[d];return await this.matchFeatureFlagProperties(t,n[d],s)}else return await this.matchFeatureFlagProperties(t,r,i)}async matchFeatureFlagProperties(t,r,n){let i=t.filters||{},a=i.groups||[],o=!1,c,d=[...a].sort((s,u)=>{let l=!!s.variant,m=!!u.variant;return l&&m?0:l?-1:m?1:0});for(let s of d)try{if(await this.isConditionMatch(t,r,s,n)){let u=s.variant,l=i.multivariate?.variants||[];u&&l.some(m=>m.key===u)?c=u:c=await this.getMatchingVariant(t,r)||!0;break}}catch(u){if(u instanceof ise)o=!0;else throw u}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 d=c.type,s=!1;if(d==="cohort"?s=TAy(c,i,this.cohorts,this.debugMode):s=BAy(c,i,o),!s)return!1}if(a==null)return!0}return!(a!=null&&await hAy(t.key,r)>a/100)}async getMatchingVariant(t,r){let n=await hAy(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(KiC,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 BZa(`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 BZa(`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 BZa(`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 BZa&&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=$1s(()=>{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=$1s(()=>{a.abort()},this.timeout),n.signal=a.signal}try{return this.fetch(r,n)}finally{clearTimeout(i)}}};async function hAy(e,t,r=""){let n=await JiC(`${e}.${t}${r}`);return parseInt(n.slice(0,15),16)/$iC}function BAy(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&&!YiC.includes(a))return r&&r(`Property ${n} cannot have a value of null/undefined with the ${a} operator`),!1;function c(s,u){return Array.isArray(s)?s.map(l=>String(l).toLowerCase()).includes(String(u).toLowerCase()):String(s).toLowerCase()===String(u).toLowerCase()}function d(s,u,l){if(l==="gt")return s>u;if(l==="gte")return s>=u;if(l==="lt")return s<u;if(l==="lte")return s<=u;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 yAy(String(i))&&String(o).match(String(i))!==null;case"not_regex":return yAy(String(i))&&String(o).match(String(i))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof i=="number"?i:null;if(typeof i=="string")try{s=parseFloat(i)}catch{}return s!=null&&o!=null?typeof o=="string"?d(o,String(i),a):d(o,s,a):d(String(o),String(i),a)}case"is_date_after":case"is_date_before":{let s=XiC(String(i));if(s==null&&(s=vAy(i)),s==null)throw new ise(`Invalid date: ${i}`);let u=vAy(o);return["is_date_before"].includes(a)?u<s:u>s}default:throw new ise(`Unknown operator: ${a}`)}}function TAy(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 qAy(a,t,r,n)}function qAy(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 d=qAy(c,t,r,n);if(i==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof ise)n&&console.debug(`Failed to compute property ${c} locally: ${d}`),o=!0;else throw d}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 d;c.type==="cohort"?d=TAy(c,t,r,n):d=BAy(c,t);let s=c.negation||!1;if(i==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof ise)n&&console.debug(`Failed to compute property ${c} locally: ${d}`),o=!0;else throw d}if(o)throw new ise("can't match cohort without a given cohort property value");return i==="AND"}}function yAy(e){try{return new RegExp(e),!0}catch{return!1}}function vAy(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 XiC(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 dbf=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},ZiC=100,bAy=30*1e3,kiC=50*1e3,pbf=class extends cbf{constructor(t,r={}){if(super(t,r),this._memoryStorage=new dbf,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,ZiC):bAy,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 fbf({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 TZa(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||kiC}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):IAy(t,r)}getLibraryVersion(){return DiC}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:d,uuid:s}=t,u=A=>{super.captureStateless(r,n,A,{timestamp:c,disableGeoip:d,uuid:s})},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,d);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:d,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=>{u({...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:d,uuid:s}=t,u=A=>super.captureStatelessImmediate(r,n,A,{timestamp:c,disableGeoip:d,uuid:s}),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,d);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:d,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=>{u({...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=bAy){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:d,groupProperties:s}=n||{},u=this.addLocalPersonAndGroupProperties(r,i,d,s);d=u.allPersonProperties,s=u.allGroupProperties,o==null&&(o=!1),c==null&&(c=!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,i,d,s),m=l!==void 0,A,P;if(!m&&!o){let M=await super.getFeatureFlagDetailStateless(t,r,i,d,s,a);if(M===void 0)return;P=M.response,l=ybf(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:d,personProperties:s,groupProperties:u}=i||{},l=this.addLocalPersonAndGroupProperties(r,a,s,u);s=l.allPersonProperties,u=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),d==null&&(d=!0),c==null&&(c=!1),!(m!==void 0)&&!c&&(m=await super.getFeatureFlagPayloadStateless(t,r,a,s,u,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||{},d=this.addLocalPersonAndGroupProperties(t,n,o,c);o=d.allPersonProperties,c=d.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,n,o,c),u={},l={},m=!0;if(s&&(u=s.response,l=s.payloads,m=s.fallbackToDecide),m&&!a){let A=await super.getFeatureFlagsAndPayloadsStateless(t,n,o,c,i);u={...u,...A.flags||{}},l={...l,...A.payloads||{}}}return{featureFlags:u,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");TZa.captureException(this,t,{syntheticException:i},r,n)}},gAy=/\(error: (.*)\)/,RAy=50,NAy="?";function eaC(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return n=>{let i=n.match(r);if(i){let a,o,c,d,s;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))}d=void 0}o&&(d=a,s=o),o==="<anonymous>"&&(s=void 0,c=void 0),c===void 0&&(s=s||NAy,c=d?`${d}.${s}`:s);let u=i[2]?.startsWith("file://")?i[2].slice(7):i[2],l=i[5]==="native";return u?.match(/\/[A-Z]:/)&&(u=u.slice(1)),!u&&i[5]&&!l&&(u=i[5]),{filename:u?decodeURI(u):void 0,module:e?e(u):void 0,function:c,lineno:mAy(i[3]),colno:mAy(i[4]),in_app:taC(u||"",l),platform:"node:javascript"}}if(n.match(t))return{filename:n,platform:"node:javascript"}}}function taC(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 mAy(e){return parseInt(e||"",10)||void 0}function raC(e){return[90,eaC(e)]}function naC(e){let r=[raC(e)].sort((n,i)=>n[0]-i[0]).map(n=>n[1]);return(n,i=0)=>{let a=[],o=n.split(`
|
|
2164
|
-
`);for(let c=i;c<o.length;c++){let d=o[c];if(d.length>1024)continue;let s=gAy.test(d)?d.replace(gAy,"$1"):d;if(!s.match(/\S*Error: /)){for(let u of r){let l=u(s);if(l){a.push(l);break}}if(a.length>=RAy)break}}return iaC(a)}}function iaC(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,RAy).map(r=>({...r,filename:r.filename||aaC(t).filename,function:r.function||NAy}))}function aaC(e){return e[e.length-1]||{}}TZa.stackParser=naC(hiC());TZa.frameModifiers=[biC];var RZa=class extends pbf{getLibraryId(){return"posthog-node"}};var X1s=class{posthog;constructor({posthogApiKey:t}){this.posthog=new RZa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.86.1",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var DJo=class{async sendEvent(){}async identify(){}async flush(){}};var FZa=require("fs/promises"),QAy=require("os"),LAy=require("path");var FAy=fa(require("crypto")),k1s=new Uint8Array(256),Z1s=k1s.length;function vbf(){return Z1s>k1s.length-16&&(FAy.default.randomFillSync(k1s),Z1s=0),k1s.slice(Z1s,Z1s+=16)}var xbe=[];for(let e=0;e<256;++e)xbe.push((e+256).toString(16).slice(1));function xAy(e,t=0){return xbe[e[t+0]]+xbe[e[t+1]]+xbe[e[t+2]]+xbe[e[t+3]]+"-"+xbe[e[t+4]]+xbe[e[t+5]]+"-"+xbe[e[t+6]]+xbe[e[t+7]]+"-"+xbe[e[t+8]]+xbe[e[t+9]]+"-"+xbe[e[t+10]]+xbe[e[t+11]]+xbe[e[t+12]]+xbe[e[t+13]]+xbe[e[t+14]]+xbe[e[t+15]]}var zAy=fa(require("crypto")),bbf={randomUUID:zAy.default.randomUUID};function oaC(e,t,r){if(bbf.randomUUID&&!t&&!e)return bbf.randomUUID();e=e||{};let n=e.random||(e.rng||vbf)();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 xAy(n)}var Aht=oaC;var uaC="id",saC=".fern",CJo=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new RZa(r),this.userId=t==null?void 0:Blf(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.86.1",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Jl(x_.of((0,QAy.homedir)()),ys.of(saC),ys.of(uaC));await Tv(t)||(await(0,FZa.mkdir)((0,LAy.dirname)(t),{recursive:!0}),await(0,FZa.writeFile)(t,Aht())),this.persistedDistinctId=(await(0,FZa.readFile)(t)).toString()}return this.persistedDistinctId}};var gbf;async function xZa(){return gbf==null&&(gbf=await caC()),gbf}async function caC(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new DJo;let r=await sms();return r!=null?new CJo({token:r,posthogApiKey:e}):await xYa()!=null?new X1s({posthogApiKey:e}):new CJo({token:void 0,posthogApiKey:e})}catch{return new DJo}}function IJo(e,t){return function(){return e.apply(t,arguments)}}var{toString:laC}=Object.prototype,{getPrototypeOf:Obf}=Object,{iterator:tEs,toStringTag:VAy}=Symbol,rEs=(e=>t=>{let r=laC.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),eqr=e=>(e=e.toLowerCase(),t=>rEs(t)===e),nEs=e=>t=>typeof t===e,{isArray:QZa}=Array,zZa=nEs("undefined");function MJo(e){return e!==null&&!zZa(e)&&e.constructor!==null&&!zZa(e.constructor)&&Lxe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var WAy=eqr("ArrayBuffer");function faC(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&WAy(e.buffer),t}var daC=nEs("string"),Lxe=nEs("function"),HAy=nEs("number"),BJo=e=>e!==null&&typeof e=="object",paC=e=>e===!0||e===!1,eEs=e=>{if(rEs(e)!=="object")return!1;let t=Obf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(VAy in e)&&!(tEs in e)},_aC=e=>{if(!BJo(e)||MJo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},haC=eqr("Date"),yaC=eqr("File"),vaC=eqr("Blob"),baC=eqr("FileList"),gaC=e=>BJo(e)&&Lxe(e.pipe),maC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Lxe(e.append)&&((t=rEs(e))==="formdata"||t==="object"&&Lxe(e.toString)&&e.toString()==="[object FormData]"))},OaC=eqr("URLSearchParams"),[AaC,PaC,waC,jaC]=["ReadableStream","Request","Response","Headers"].map(eqr),EaC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function TJo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),QZa(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(MJo(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 GAy(e,t){if(MJo(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 jsa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,JAy=e=>!zZa(e)&&e!==jsa;function mbf(){let{caseless:e,skipUndefined:t}=JAy(this)&&this||{},r={},n=(i,a)=>{let o=e&&GAy(r,a)||a;eEs(r[o])&&eEs(i)?r[o]=mbf(r[o],i):eEs(i)?r[o]=mbf({},i):QZa(i)?r[o]=i.slice():(!t||!zZa(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&TJo(arguments[i],n);return r}var SaC=(e,t,r,{allOwnKeys:n}={})=>(TJo(t,(i,a)=>{r&&Lxe(i)?e[a]=IJo(i,r):e[a]=i},{allOwnKeys:n}),e),DaC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),CaC=(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)},IaC=(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&&Obf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},MaC=(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},BaC=e=>{if(!e)return null;if(QZa(e))return e;let t=e.length;if(!HAy(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},TaC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Obf(Uint8Array)),qaC=(e,t)=>{let n=(e&&e[tEs]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},RaC=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},NaC=eqr("HTMLFormElement"),FaC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),UAy=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),xaC=eqr("RegExp"),KAy=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};TJo(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},zaC=e=>{KAy(e,(t,r)=>{if(Lxe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(Lxe(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+"'")})}})},QaC=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return QZa(e)?n(e):n(String(e).split(t)),r},LaC=()=>{},UaC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function VaC(e){return!!(e&&Lxe(e.append)&&e[VAy]==="FormData"&&e[tEs])}var WaC=e=>{let t=new Array(10),r=(n,i)=>{if(BJo(n)){if(t.indexOf(n)>=0)return;if(MJo(n))return n;if(!("toJSON"in n)){t[i]=n;let a=QZa(n)?[]:{};return TJo(n,(o,c)=>{let d=r(o,i+1);!zZa(d)&&(a[c]=d)}),t[i]=void 0,a}}return n};return r(e,0)},HaC=eqr("AsyncFunction"),GaC=e=>e&&(BJo(e)||Lxe(e))&&Lxe(e.then)&&Lxe(e.catch),$Ay=((e,t)=>e?setImmediate:t?((r,n)=>(jsa.addEventListener("message",({source:i,data:a})=>{i===jsa&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),jsa.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Lxe(jsa.postMessage)),JaC=typeof queueMicrotask<"u"?queueMicrotask.bind(jsa):typeof process<"u"&&process.nextTick||$Ay,KaC=e=>e!=null&&Lxe(e[tEs]),Yf={isArray:QZa,isArrayBuffer:WAy,isBuffer:MJo,isFormData:maC,isArrayBufferView:faC,isString:daC,isNumber:HAy,isBoolean:paC,isObject:BJo,isPlainObject:eEs,isEmptyObject:_aC,isReadableStream:AaC,isRequest:PaC,isResponse:waC,isHeaders:jaC,isUndefined:zZa,isDate:haC,isFile:yaC,isBlob:vaC,isRegExp:xaC,isFunction:Lxe,isStream:gaC,isURLSearchParams:OaC,isTypedArray:TaC,isFileList:baC,forEach:TJo,merge:mbf,extend:SaC,trim:EaC,stripBOM:DaC,inherits:CaC,toFlatObject:IaC,kindOf:rEs,kindOfTest:eqr,endsWith:MaC,toArray:BaC,forEachEntry:qaC,matchAll:RaC,isHTMLForm:NaC,hasOwnProperty:UAy,hasOwnProp:UAy,reduceDescriptors:KAy,freezeMethods:zaC,toObjectSet:QaC,toCamelCase:FaC,noop:LaC,toFiniteNumber:UaC,findKey:GAy,global:jsa,isContextDefined:JAy,isSpecCompliantForm:VaC,toJSONObject:WaC,isAsyncFn:HaC,isThenable:GaC,setImmediate:$Ay,asap:JaC,isIterable:KaC};function LZa(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)}Yf.inherits(LZa,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:Yf.toJSONObject(this.config),code:this.code,status:this.status}}});var YAy=LZa.prototype,XAy={};["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=>{XAy[e]={value:e}});Object.defineProperties(LZa,XAy);Object.defineProperty(YAy,"isAxiosError",{value:!0});LZa.from=(e,t,r,n,i,a)=>{let o=Object.create(YAy);Yf.toFlatObject(e,o,function(u){return u!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return LZa.call(o,c,d,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 jm=LZa;var ZAy=fa(E1s(),1),iEs=ZAy.default;function Abf(e){return Yf.isPlainObject(e)||Yf.isArray(e)}function ePy(e){return Yf.endsWith(e,"[]")?e.slice(0,-2):e}function kAy(e,t,r){return e?e.concat(t).map(function(i,a){return i=ePy(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function $aC(e){return Yf.isArray(e)&&!e.some(Abf)}var YaC=Yf.toFlatObject(Yf,{},null,function(t){return/^is[A-Z]/.test(t)});function XaC(e,t,r){if(!Yf.isObject(e))throw new TypeError("target must be an object");t=t||new(iEs||FormData),r=Yf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,M){return!Yf.isUndefined(M[C])});let n=r.metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&Yf.isSpecCompliantForm(t);if(!Yf.isFunction(i))throw new TypeError("visitor must be a function");function s(P){if(P===null)return"";if(Yf.isDate(P))return P.toISOString();if(Yf.isBoolean(P))return P.toString();if(!d&&Yf.isBlob(P))throw new jm("Blob is not supported. Use a Buffer instead.");return Yf.isArrayBuffer(P)||Yf.isTypedArray(P)?d&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function u(P,C,M){let T=P;if(P&&!M&&typeof P=="object"){if(Yf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if(Yf.isArray(P)&&$aC(P)||(Yf.isFileList(P)||Yf.endsWith(C,"[]"))&&(T=Yf.toArray(P)))return C=ePy(C),T.forEach(function(U,R){!(Yf.isUndefined(U)||U===null)&&t.append(o===!0?kAy([C],R,a):o===null?C:C+"[]",s(U))}),!1}return Abf(P)?!0:(t.append(kAy(M,C,a),s(P)),!1)}let l=[],m=Object.assign(YaC,{defaultVisitor:u,convertValue:s,isVisitable:Abf});function A(P,C){if(!Yf.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),Yf.forEach(P,function(T,z){(!(Yf.isUndefined(T)||T===null)&&i.call(t,T,Yf.isString(z)?z.trim():z,C,m))===!0&&A(T,C?C.concat(z):[z])}),l.pop()}}if(!Yf.isObject(e))throw new TypeError("data must be an object");return A(e),t}var v4i=XaC;function tPy(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function rPy(e,t){this._pairs=[],e&&v4i(e,this,t)}var nPy=rPy.prototype;nPy.append=function(t,r){this._pairs.push([t,r])};nPy.toString=function(t){let r=t?function(n){return t.call(this,n,tPy)}:tPy;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var iPy=rPy;function ZaC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Esa(e,t,r){if(!t)return e;let n=r&&r.encode||ZaC;Yf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Yf.isURLSearchParams(t)?t.toString():new iPy(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var Pbf=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){Yf.forEach(this.handlers,function(n){n!==null&&t(n)})}},wbf=Pbf;var UZa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var sPy=fa(require("crypto"),1);var aPy=fa(require("url"),1),oPy=aPy.default.URLSearchParams;var jbf="abcdefghijklmnopqrstuvwxyz",uPy="0123456789",cPy={DIGIT:uPy,ALPHA:jbf,ALPHA_DIGIT:jbf+jbf.toUpperCase()+uPy},kaC=(e=16,t=cPy.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);sPy.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},lPy={isNode:!0,classes:{URLSearchParams:oPy,FormData:iEs,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:cPy,generateString:kaC,protocols:["http","https","file","data"]};var Dbf={};lf(Dbf,{hasBrowserEnv:()=>Sbf,hasStandardBrowserEnv:()=>eoC,hasStandardBrowserWebWorkerEnv:()=>toC,navigator:()=>Ebf,origin:()=>roC});var Sbf=typeof window<"u"&&typeof document<"u",Ebf=typeof navigator=="object"&&navigator||void 0,eoC=Sbf&&(!Ebf||["ReactNative","NativeScript","NS"].indexOf(Ebf.product)<0),toC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",roC=Sbf&&window.location.href||"http://localhost";var V2={...Dbf,...lPy};function Cbf(e,t){return v4i(e,new V2.classes.URLSearchParams,{visitor:function(r,n,i,a){return V2.isNode&&Yf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function noC(e){return Yf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function ioC(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 aoC(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),d=a>=r.length;return o=!o&&Yf.isArray(i)?i.length:o,d?(Yf.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!Yf.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&Yf.isArray(i[o])&&(i[o]=ioC(i[o])),!c)}if(Yf.isFormData(e)&&Yf.isFunction(e.entries)){let r={};return Yf.forEachEntry(e,(n,i)=>{t(noC(n),i,r,0)}),r}return null}var aEs=aoC;function ooC(e,t,r){if(Yf.isString(e))try{return(t||JSON.parse)(e),Yf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Ibf={transitional:UZa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Yf.isObject(t);if(a&&Yf.isHTMLForm(t)&&(t=new FormData(t)),Yf.isFormData(t))return i?JSON.stringify(aEs(t)):t;if(Yf.isArrayBuffer(t)||Yf.isBuffer(t)||Yf.isStream(t)||Yf.isFile(t)||Yf.isBlob(t)||Yf.isReadableStream(t))return t;if(Yf.isArrayBufferView(t))return t.buffer;if(Yf.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 Cbf(t,this.formSerializer).toString();if((c=Yf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return v4i(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),ooC(t)):t}],transformResponse:[function(t){let r=this.transitional||Ibf.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Yf.isResponse(t)||Yf.isReadableStream(t))return t;if(t&&Yf.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"?jm.from(c,jm.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:V2.classes.FormData,Blob:V2.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Yf.forEach(["delete","get","head","post","put","patch"],e=>{Ibf.headers[e]={}});var VZa=Ibf;var uoC=Yf.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"]),fPy=e=>{let t={},r,n,i;return e&&e.split(`
|
|
2164
|
+
`);for(let c=i;c<o.length;c++){let d=o[c];if(d.length>1024)continue;let s=gAy.test(d)?d.replace(gAy,"$1"):d;if(!s.match(/\S*Error: /)){for(let u of r){let l=u(s);if(l){a.push(l);break}}if(a.length>=RAy)break}}return iaC(a)}}function iaC(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,RAy).map(r=>({...r,filename:r.filename||aaC(t).filename,function:r.function||NAy}))}function aaC(e){return e[e.length-1]||{}}TZa.stackParser=naC(hiC());TZa.frameModifiers=[biC];var RZa=class extends pbf{getLibraryId(){return"posthog-node"}};var X1s=class{posthog;constructor({posthogApiKey:t}){this.posthog=new RZa(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.86.2",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var DJo=class{async sendEvent(){}async identify(){}async flush(){}};var FZa=require("fs/promises"),QAy=require("os"),LAy=require("path");var FAy=fa(require("crypto")),k1s=new Uint8Array(256),Z1s=k1s.length;function vbf(){return Z1s>k1s.length-16&&(FAy.default.randomFillSync(k1s),Z1s=0),k1s.slice(Z1s,Z1s+=16)}var xbe=[];for(let e=0;e<256;++e)xbe.push((e+256).toString(16).slice(1));function xAy(e,t=0){return xbe[e[t+0]]+xbe[e[t+1]]+xbe[e[t+2]]+xbe[e[t+3]]+"-"+xbe[e[t+4]]+xbe[e[t+5]]+"-"+xbe[e[t+6]]+xbe[e[t+7]]+"-"+xbe[e[t+8]]+xbe[e[t+9]]+"-"+xbe[e[t+10]]+xbe[e[t+11]]+xbe[e[t+12]]+xbe[e[t+13]]+xbe[e[t+14]]+xbe[e[t+15]]}var zAy=fa(require("crypto")),bbf={randomUUID:zAy.default.randomUUID};function oaC(e,t,r){if(bbf.randomUUID&&!t&&!e)return bbf.randomUUID();e=e||{};let n=e.random||(e.rng||vbf)();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 xAy(n)}var Aht=oaC;var uaC="id",saC=".fern",CJo=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new RZa(r),this.userId=t==null?void 0:Blf(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.86.2",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Jl(x_.of((0,QAy.homedir)()),ys.of(saC),ys.of(uaC));await Tv(t)||(await(0,FZa.mkdir)((0,LAy.dirname)(t),{recursive:!0}),await(0,FZa.writeFile)(t,Aht())),this.persistedDistinctId=(await(0,FZa.readFile)(t)).toString()}return this.persistedDistinctId}};var gbf;async function xZa(){return gbf==null&&(gbf=await caC()),gbf}async function caC(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new DJo;let r=await sms();return r!=null?new CJo({token:r,posthogApiKey:e}):await xYa()!=null?new X1s({posthogApiKey:e}):new CJo({token:void 0,posthogApiKey:e})}catch{return new DJo}}function IJo(e,t){return function(){return e.apply(t,arguments)}}var{toString:laC}=Object.prototype,{getPrototypeOf:Obf}=Object,{iterator:tEs,toStringTag:VAy}=Symbol,rEs=(e=>t=>{let r=laC.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),eqr=e=>(e=e.toLowerCase(),t=>rEs(t)===e),nEs=e=>t=>typeof t===e,{isArray:QZa}=Array,zZa=nEs("undefined");function MJo(e){return e!==null&&!zZa(e)&&e.constructor!==null&&!zZa(e.constructor)&&Lxe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var WAy=eqr("ArrayBuffer");function faC(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&WAy(e.buffer),t}var daC=nEs("string"),Lxe=nEs("function"),HAy=nEs("number"),BJo=e=>e!==null&&typeof e=="object",paC=e=>e===!0||e===!1,eEs=e=>{if(rEs(e)!=="object")return!1;let t=Obf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(VAy in e)&&!(tEs in e)},_aC=e=>{if(!BJo(e)||MJo(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},haC=eqr("Date"),yaC=eqr("File"),vaC=eqr("Blob"),baC=eqr("FileList"),gaC=e=>BJo(e)&&Lxe(e.pipe),maC=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||Lxe(e.append)&&((t=rEs(e))==="formdata"||t==="object"&&Lxe(e.toString)&&e.toString()==="[object FormData]"))},OaC=eqr("URLSearchParams"),[AaC,PaC,waC,jaC]=["ReadableStream","Request","Response","Headers"].map(eqr),EaC=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function TJo(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),QZa(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(MJo(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 GAy(e,t){if(MJo(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 jsa=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,JAy=e=>!zZa(e)&&e!==jsa;function mbf(){let{caseless:e,skipUndefined:t}=JAy(this)&&this||{},r={},n=(i,a)=>{let o=e&&GAy(r,a)||a;eEs(r[o])&&eEs(i)?r[o]=mbf(r[o],i):eEs(i)?r[o]=mbf({},i):QZa(i)?r[o]=i.slice():(!t||!zZa(i))&&(r[o]=i)};for(let i=0,a=arguments.length;i<a;i++)arguments[i]&&TJo(arguments[i],n);return r}var SaC=(e,t,r,{allOwnKeys:n}={})=>(TJo(t,(i,a)=>{r&&Lxe(i)?e[a]=IJo(i,r):e[a]=i},{allOwnKeys:n}),e),DaC=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),CaC=(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)},IaC=(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&&Obf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},MaC=(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},BaC=e=>{if(!e)return null;if(QZa(e))return e;let t=e.length;if(!HAy(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},TaC=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Obf(Uint8Array)),qaC=(e,t)=>{let n=(e&&e[tEs]).call(e),i;for(;(i=n.next())&&!i.done;){let a=i.value;t.call(e,a[0],a[1])}},RaC=(e,t)=>{let r,n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},NaC=eqr("HTMLFormElement"),FaC=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),UAy=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),xaC=eqr("RegExp"),KAy=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),n={};TJo(r,(i,a)=>{let o;(o=t(i,a,e))!==!1&&(n[a]=o||i)}),Object.defineProperties(e,n)},zaC=e=>{KAy(e,(t,r)=>{if(Lxe(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let n=e[r];if(Lxe(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+"'")})}})},QaC=(e,t)=>{let r={},n=i=>{i.forEach(a=>{r[a]=!0})};return QZa(e)?n(e):n(String(e).split(t)),r},LaC=()=>{},UaC=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function VaC(e){return!!(e&&Lxe(e.append)&&e[VAy]==="FormData"&&e[tEs])}var WaC=e=>{let t=new Array(10),r=(n,i)=>{if(BJo(n)){if(t.indexOf(n)>=0)return;if(MJo(n))return n;if(!("toJSON"in n)){t[i]=n;let a=QZa(n)?[]:{};return TJo(n,(o,c)=>{let d=r(o,i+1);!zZa(d)&&(a[c]=d)}),t[i]=void 0,a}}return n};return r(e,0)},HaC=eqr("AsyncFunction"),GaC=e=>e&&(BJo(e)||Lxe(e))&&Lxe(e.then)&&Lxe(e.catch),$Ay=((e,t)=>e?setImmediate:t?((r,n)=>(jsa.addEventListener("message",({source:i,data:a})=>{i===jsa&&a===r&&n.length&&n.shift()()},!1),i=>{n.push(i),jsa.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",Lxe(jsa.postMessage)),JaC=typeof queueMicrotask<"u"?queueMicrotask.bind(jsa):typeof process<"u"&&process.nextTick||$Ay,KaC=e=>e!=null&&Lxe(e[tEs]),Yf={isArray:QZa,isArrayBuffer:WAy,isBuffer:MJo,isFormData:maC,isArrayBufferView:faC,isString:daC,isNumber:HAy,isBoolean:paC,isObject:BJo,isPlainObject:eEs,isEmptyObject:_aC,isReadableStream:AaC,isRequest:PaC,isResponse:waC,isHeaders:jaC,isUndefined:zZa,isDate:haC,isFile:yaC,isBlob:vaC,isRegExp:xaC,isFunction:Lxe,isStream:gaC,isURLSearchParams:OaC,isTypedArray:TaC,isFileList:baC,forEach:TJo,merge:mbf,extend:SaC,trim:EaC,stripBOM:DaC,inherits:CaC,toFlatObject:IaC,kindOf:rEs,kindOfTest:eqr,endsWith:MaC,toArray:BaC,forEachEntry:qaC,matchAll:RaC,isHTMLForm:NaC,hasOwnProperty:UAy,hasOwnProp:UAy,reduceDescriptors:KAy,freezeMethods:zaC,toObjectSet:QaC,toCamelCase:FaC,noop:LaC,toFiniteNumber:UaC,findKey:GAy,global:jsa,isContextDefined:JAy,isSpecCompliantForm:VaC,toJSONObject:WaC,isAsyncFn:HaC,isThenable:GaC,setImmediate:$Ay,asap:JaC,isIterable:KaC};function LZa(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)}Yf.inherits(LZa,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:Yf.toJSONObject(this.config),code:this.code,status:this.status}}});var YAy=LZa.prototype,XAy={};["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=>{XAy[e]={value:e}});Object.defineProperties(LZa,XAy);Object.defineProperty(YAy,"isAxiosError",{value:!0});LZa.from=(e,t,r,n,i,a)=>{let o=Object.create(YAy);Yf.toFlatObject(e,o,function(u){return u!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return LZa.call(o,c,d,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 jm=LZa;var ZAy=fa(E1s(),1),iEs=ZAy.default;function Abf(e){return Yf.isPlainObject(e)||Yf.isArray(e)}function ePy(e){return Yf.endsWith(e,"[]")?e.slice(0,-2):e}function kAy(e,t,r){return e?e.concat(t).map(function(i,a){return i=ePy(i),!r&&a?"["+i+"]":i}).join(r?".":""):t}function $aC(e){return Yf.isArray(e)&&!e.some(Abf)}var YaC=Yf.toFlatObject(Yf,{},null,function(t){return/^is[A-Z]/.test(t)});function XaC(e,t,r){if(!Yf.isObject(e))throw new TypeError("target must be an object");t=t||new(iEs||FormData),r=Yf.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(C,M){return!Yf.isUndefined(M[C])});let n=r.metaTokens,i=r.visitor||u,a=r.dots,o=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&Yf.isSpecCompliantForm(t);if(!Yf.isFunction(i))throw new TypeError("visitor must be a function");function s(P){if(P===null)return"";if(Yf.isDate(P))return P.toISOString();if(Yf.isBoolean(P))return P.toString();if(!d&&Yf.isBlob(P))throw new jm("Blob is not supported. Use a Buffer instead.");return Yf.isArrayBuffer(P)||Yf.isTypedArray(P)?d&&typeof Blob=="function"?new Blob([P]):Buffer.from(P):P}function u(P,C,M){let T=P;if(P&&!M&&typeof P=="object"){if(Yf.endsWith(C,"{}"))C=n?C:C.slice(0,-2),P=JSON.stringify(P);else if(Yf.isArray(P)&&$aC(P)||(Yf.isFileList(P)||Yf.endsWith(C,"[]"))&&(T=Yf.toArray(P)))return C=ePy(C),T.forEach(function(U,R){!(Yf.isUndefined(U)||U===null)&&t.append(o===!0?kAy([C],R,a):o===null?C:C+"[]",s(U))}),!1}return Abf(P)?!0:(t.append(kAy(M,C,a),s(P)),!1)}let l=[],m=Object.assign(YaC,{defaultVisitor:u,convertValue:s,isVisitable:Abf});function A(P,C){if(!Yf.isUndefined(P)){if(l.indexOf(P)!==-1)throw Error("Circular reference detected in "+C.join("."));l.push(P),Yf.forEach(P,function(T,z){(!(Yf.isUndefined(T)||T===null)&&i.call(t,T,Yf.isString(z)?z.trim():z,C,m))===!0&&A(T,C?C.concat(z):[z])}),l.pop()}}if(!Yf.isObject(e))throw new TypeError("data must be an object");return A(e),t}var v4i=XaC;function tPy(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function rPy(e,t){this._pairs=[],e&&v4i(e,this,t)}var nPy=rPy.prototype;nPy.append=function(t,r){this._pairs.push([t,r])};nPy.toString=function(t){let r=t?function(n){return t.call(this,n,tPy)}:tPy;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};var iPy=rPy;function ZaC(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Esa(e,t,r){if(!t)return e;let n=r&&r.encode||ZaC;Yf.isFunction(r)&&(r={serialize:r});let i=r&&r.serialize,a;if(i?a=i(t,r):a=Yf.isURLSearchParams(t)?t.toString():new iPy(t,r).toString(n),a){let o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var Pbf=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){Yf.forEach(this.handlers,function(n){n!==null&&t(n)})}},wbf=Pbf;var UZa={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var sPy=fa(require("crypto"),1);var aPy=fa(require("url"),1),oPy=aPy.default.URLSearchParams;var jbf="abcdefghijklmnopqrstuvwxyz",uPy="0123456789",cPy={DIGIT:uPy,ALPHA:jbf,ALPHA_DIGIT:jbf+jbf.toUpperCase()+uPy},kaC=(e=16,t=cPy.ALPHA_DIGIT)=>{let r="",{length:n}=t,i=new Uint32Array(e);sPy.default.randomFillSync(i);for(let a=0;a<e;a++)r+=t[i[a]%n];return r},lPy={isNode:!0,classes:{URLSearchParams:oPy,FormData:iEs,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:cPy,generateString:kaC,protocols:["http","https","file","data"]};var Dbf={};lf(Dbf,{hasBrowserEnv:()=>Sbf,hasStandardBrowserEnv:()=>eoC,hasStandardBrowserWebWorkerEnv:()=>toC,navigator:()=>Ebf,origin:()=>roC});var Sbf=typeof window<"u"&&typeof document<"u",Ebf=typeof navigator=="object"&&navigator||void 0,eoC=Sbf&&(!Ebf||["ReactNative","NativeScript","NS"].indexOf(Ebf.product)<0),toC=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",roC=Sbf&&window.location.href||"http://localhost";var V2={...Dbf,...lPy};function Cbf(e,t){return v4i(e,new V2.classes.URLSearchParams,{visitor:function(r,n,i,a){return V2.isNode&&Yf.isBuffer(r)?(this.append(n,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function noC(e){return Yf.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function ioC(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 aoC(e){function t(r,n,i,a){let o=r[a++];if(o==="__proto__")return!0;let c=Number.isFinite(+o),d=a>=r.length;return o=!o&&Yf.isArray(i)?i.length:o,d?(Yf.hasOwnProp(i,o)?i[o]=[i[o],n]:i[o]=n,!c):((!i[o]||!Yf.isObject(i[o]))&&(i[o]=[]),t(r,n,i[o],a)&&Yf.isArray(i[o])&&(i[o]=ioC(i[o])),!c)}if(Yf.isFormData(e)&&Yf.isFunction(e.entries)){let r={};return Yf.forEachEntry(e,(n,i)=>{t(noC(n),i,r,0)}),r}return null}var aEs=aoC;function ooC(e,t,r){if(Yf.isString(e))try{return(t||JSON.parse)(e),Yf.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}var Ibf={transitional:UZa,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let n=r.getContentType()||"",i=n.indexOf("application/json")>-1,a=Yf.isObject(t);if(a&&Yf.isHTMLForm(t)&&(t=new FormData(t)),Yf.isFormData(t))return i?JSON.stringify(aEs(t)):t;if(Yf.isArrayBuffer(t)||Yf.isBuffer(t)||Yf.isStream(t)||Yf.isFile(t)||Yf.isBlob(t)||Yf.isReadableStream(t))return t;if(Yf.isArrayBufferView(t))return t.buffer;if(Yf.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 Cbf(t,this.formSerializer).toString();if((c=Yf.isFileList(t))||n.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return v4i(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||i?(r.setContentType("application/json",!1),ooC(t)):t}],transformResponse:[function(t){let r=this.transitional||Ibf.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(Yf.isResponse(t)||Yf.isReadableStream(t))return t;if(t&&Yf.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"?jm.from(c,jm.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:V2.classes.FormData,Blob:V2.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Yf.forEach(["delete","get","head","post","put","patch"],e=>{Ibf.headers[e]={}});var VZa=Ibf;var uoC=Yf.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"]),fPy=e=>{let t={},r,n,i;return e&&e.split(`
|
|
2165
2165
|
`).forEach(function(o){i=o.indexOf(":"),r=o.substring(0,i).trim().toLowerCase(),n=o.substring(i+1).trim(),!(!r||t[r]&&uoC[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t};var dPy=Symbol("internals");function qJo(e){return e&&String(e).trim().toLowerCase()}function oEs(e){return e===!1||e==null?e:Yf.isArray(e)?e.map(oEs):String(e)}function soC(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 coC=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Mbf(e,t,r,n,i){if(Yf.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!Yf.isString(t)){if(Yf.isString(n))return t.indexOf(n)!==-1;if(Yf.isRegExp(n))return n.test(t)}}function loC(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function foC(e,t){let r=Yf.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 WZa=class{constructor(t){t&&this.set(t)}set(t,r,n){let i=this;function a(c,d,s){let u=qJo(d);if(!u)throw new Error("header name must be a non-empty string");let l=Yf.findKey(i,u);(!l||i[l]===void 0||s===!0||s===void 0&&i[l]!==!1)&&(i[l||d]=oEs(c))}let o=(c,d)=>Yf.forEach(c,(s,u)=>a(s,u,d));if(Yf.isPlainObject(t)||t instanceof this.constructor)o(t,r);else if(Yf.isString(t)&&(t=t.trim())&&!coC(t))o(fPy(t),r);else if(Yf.isObject(t)&&Yf.isIterable(t)){let c={},d,s;for(let u of t){if(!Yf.isArray(u))throw TypeError("Object iterator must return a key-value pair");c[s=u[0]]=(d=c[s])?Yf.isArray(d)?[...d,u[1]]:[d,u[1]]:u[1]}o(c,r)}else t!=null&&a(r,t,n);return this}get(t,r){if(t=qJo(t),t){let n=Yf.findKey(this,t);if(n){let i=this[n];if(!r)return i;if(r===!0)return soC(i);if(Yf.isFunction(r))return r.call(this,i,n);if(Yf.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=qJo(t),t){let n=Yf.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Mbf(this,this[n],n,r)))}return!1}delete(t,r){let n=this,i=!1;function a(o){if(o=qJo(o),o){let c=Yf.findKey(n,o);c&&(!r||Mbf(n,n[c],c,r))&&(delete n[c],i=!0)}}return Yf.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||Mbf(this,this[a],a,t,!0))&&(delete this[a],i=!0)}return i}normalize(t){let r=this,n={};return Yf.forEach(this,(i,a)=>{let o=Yf.findKey(n,a);if(o){r[o]=oEs(i),delete r[a];return}let c=t?loC(a):String(a).trim();c!==a&&delete r[a],r[c]=oEs(i),n[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return Yf.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&Yf.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(`
|
|
2166
2166
|
`)}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[dPy]=this[dPy]={accessors:{}}).accessors,i=this.prototype;function a(o){let c=qJo(o);n[c]||(foC(i,o),n[c]=!0)}return Yf.isArray(t)?t.forEach(a):a(t),this}};WZa.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);Yf.reduceDescriptors(WZa.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});Yf.freezeMethods(WZa);var w$=WZa;function RJo(e,t){let r=this||VZa,n=t||r,i=w$.from(n.headers),a=n.data;return Yf.forEach(e,function(c){a=c.call(r,a,i.normalize(),t?t.status:void 0)}),i.normalize(),a}function NJo(e){return!!(e&&e.__CANCEL__)}function pPy(e,t,r){jm.call(this,e??"canceled",jm.ERR_CANCELED,t,r),this.name="CanceledError"}Yf.inherits(pPy,jm,{__CANCEL__:!0});var Ent=pPy;function O9r(e,t,r){let n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new jm("Request failed with status code "+r.status,[jm.ERR_BAD_REQUEST,jm.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function Bbf(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Tbf(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ssa(e,t,r){let n=!Bbf(t);return e&&(n||r==!1)?Tbf(e,t):t}var CPy=fa(S1s(),1),IPy=fa(require("http"),1),MPy=fa(require("https"),1),BPy=fa(require("util"),1),TPy=fa(qvf(),1),dAi=fa(require("zlib"),1);var Dsa="1.12.2";function FJo(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var doC=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function qbf(e,t,r){let n=r&&r.Blob||V2.classes.Blob,i=FJo(e);if(t===void 0&&n&&(t=!0),i==="data"){e=i.length?e.slice(i.length+1):e;let a=doC.exec(e);if(!a)throw new jm("Invalid URL",jm.ERR_INVALID_URL);let o=a[1],c=a[2],d=a[3],s=Buffer.from(decodeURIComponent(d),c?"base64":"utf8");if(t){if(!n)throw new jm("Blob is not supported",jm.ERR_NOT_SUPPORT);return new n([s],{type:o})}return s}throw new jm("Unsupported protocol "+i,jm.ERR_NOT_SUPPORT)}var Isa=fa(require("stream"),1);var _Py=fa(require("stream"),1);var Rbf=Symbol("internals"),Nbf=class extends _Py.default.Transform{constructor(t){t=Yf.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(n,i)=>!Yf.isUndefined(i[n])),super({readableHighWaterMark:t.chunkSize});let r=this[Rbf]={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[Rbf];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,n){let i=this[Rbf],a=i.maxRate,o=this.readableHighWaterMark,c=i.timeWindow,d=1e3/c,s=a/d,u=i.minChunkSize!==!1?Math.max(i.minChunkSize,s*.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=s-i.bytes,i.bytes=z<0?-z:0,U=0),z=s-i.bytes}if(a){if(z<=0)return setTimeout(()=>{P(null,A)},c-U);z<T&&(T=z)}T&&C>T&&C-T>u&&(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)})}},Fbf=Nbf;var qPy=require("events");var yPy=fa(require("util"),1),vPy=require("stream");var{asyncIterator:hPy}=Symbol,poC=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[hPy]?yield*e[hPy]():yield e},uEs=poC;var _oC=V2.ALPHABET.ALPHA_DIGIT+"-_",xJo=typeof TextEncoder=="function"?new TextEncoder:new yPy.default.TextEncoder,Csa=`\r
|
|
2167
2167
|
`,hoC=xJo.encode(Csa),yoC=2,xbf=class{constructor(t,r){let{escapeName:n}=this.constructor,i=Yf.isString(r),a=`Content-Disposition: form-data; name="${n(t)}"${!i&&r.name?`; filename="${n(r.name)}"`:""}${Csa}`;i?r=xJo.encode(String(r).replace(/\r?\n|\r\n?/g,Csa)):a+=`Content-Type: ${r.type||"application/octet-stream"}${Csa}`,this.headers=xJo.encode(a+Csa),this.contentLength=i?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+yoC,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;Yf.isTypedArray(t)?yield t:yield*uEs(t),yield hoC}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},voC=(e,t,r)=>{let{tag:n="form-data-boundary",size:i=25,boundary:a=n+"-"+V2.generateString(i,_oC)}=r||{};if(!Yf.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=xJo.encode("--"+a+Csa),c=xJo.encode("--"+a+"--"+Csa),d=c.byteLength,s=Array.from(e.entries()).map(([l,m])=>{let A=new xbf(l,m);return d+=A.size,A});d+=o.byteLength*s.length,d=Yf.toFiniteNumber(d);let u={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(d)&&(u["Content-Length"]=d),t&&t(u),vPy.Readable.from((async function*(){for(let l of s)yield o,yield*l.encode();yield c})())},bPy=voC;var gPy=fa(require("stream"),1),zbf=class extends gPy.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)}},mPy=zbf;var boC=(e,t)=>Yf.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,OPy=boC;function goC(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(d){let s=Date.now(),u=n[a];o||(o=s),r[i]=d,n[i]=s;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),s-o<t)return;let A=u&&s-u;return A?Math.round(m*1e3/A):void 0}}var APy=goC;function moC(e,t){let r=0,n=1e3/t,i,a,o=(s,u=Date.now())=>{r=u,i=null,a&&(clearTimeout(a),a=null),e(...s)};return[(...s)=>{let u=Date.now(),l=u-r;l>=n?o(s,u):(i=s,a||(a=setTimeout(()=>{a=null,o(i)},n-l)))},()=>i&&o(i)]}var PPy=moC;var fAi=(e,t,r=3)=>{let n=0,i=APy(50,250);return PPy(a=>{let o=a.loaded,c=a.lengthComputable?a.total:void 0,d=o-n,s=i(d),u=o<=c;n=o;let l={loaded:o,total:c,progress:c?o/c:void 0,bytes:d,rate:s||void 0,estimated:s&&c&&u?(c-o)/s:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},r)},HZa=(e,t)=>{let r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},GZa=e=>(...t)=>Yf.asap(()=>e(...t));function Qbf(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,d=o-1,s=m=>m>=2&&n.charCodeAt(m-2)===37&&n.charCodeAt(m-1)===51&&(n.charCodeAt(m)===68||n.charCodeAt(m)===100);d>=0&&(n.charCodeAt(d)===61?(c++,d--):s(d)&&(c++,d-=3)),c===1&&d>=0&&(n.charCodeAt(d)===61||s(d))&&c++;let l=Math.floor(a/4)*3-(c||0);return l>0?l:0}return Buffer.byteLength(n,"utf8")}var wPy={flush:dAi.default.constants.Z_SYNC_FLUSH,finishFlush:dAi.default.constants.Z_SYNC_FLUSH},OoC={flush:dAi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:dAi.default.constants.BROTLI_OPERATION_FLUSH},jPy=Yf.isFunction(dAi.default.createBrotliDecompress),{http:AoC,https:PoC}=TPy.default,woC=/https:?/,EPy=V2.protocols.map(e=>e+":"),SPy=(e,[t,r])=>(e.on("end",r).on("error",r),t);function joC(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function RPy(e,t,r){let n=t;if(!n&&n!==!1){let i=CPy.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){RPy(a,t,a.href)}}var EoC=typeof process<"u"&&Yf.kindOf(process)==="process",SoC=e=>new Promise((t,r)=>{let n,i,a=(d,s)=>{i||(i=!0,n&&n(d,s))},o=d=>{a(d),t(d)},c=d=>{a(d,!0),r(d)};e(o,c,d=>n=d).catch(c)}),DoC=({address:e,family:t})=>{if(!Yf.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},DPy=(e,t)=>DoC(Yf.isObject(e)?e:{address:e,family:t}),NPy=EoC&&function(t){return SoC(async function(n,i,a){let{data:o,lookup:c,family:d}=t,{responseType:s,responseEncoding:u}=t,l=t.method.toUpperCase(),m,A=!1,P;if(c){let Se=OPy(c,St=>Yf.isArray(St)?St:[St]);c=(St,yt,Re)=>{Se(St,yt,(De,Lt,Xe)=>{if(De)return Re(De);let Yt=Yf.isArray(Lt)?Lt.map(Mt=>DPy(Mt)):[DPy(Lt,Xe)];yt.all?Re(De,Yt):Re(De,Yt[0].address,Yt[0].family)})}}let C=new qPy.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 Ent(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=Ssa(t.baseURL,t.url,t.allowAbsoluteUrls),U=new URL(z,V2.hasBrowserEnv?V2.origin:void 0),R=U.protocol||EPy[0];if(R==="data:"){if(t.maxContentLength>-1){let St=String(t.url||z||"");if(Qbf(St)>t.maxContentLength)return i(new jm("maxContentLength size of "+t.maxContentLength+" exceeded",jm.ERR_BAD_RESPONSE,t))}let Se;if(l!=="GET")return O9r(n,i,{status:405,statusText:"method not allowed",headers:{},config:t});try{Se=qbf(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(St){throw jm.from(St,jm.ERR_BAD_REQUEST,t)}return s==="text"?(Se=Se.toString(u),(!u||u==="utf8")&&(Se=Yf.stripBOM(Se))):s==="stream"&&(Se=Isa.default.Readable.from(Se)),O9r(n,i,{data:Se,status:200,statusText:"OK",headers:new w$,config:t})}if(EPy.indexOf(R)===-1)return i(new jm("Unsupported protocol "+R,jm.ERR_BAD_REQUEST,t));let V=w$.from(t.headers).normalize();V.set("User-Agent","axios/"+Dsa,!1);let{onUploadProgress:$,onDownloadProgress:re}=t,Y=t.maxRate,te,ne;if(Yf.isSpecCompliantForm(o)){let Se=V.getContentType(/boundary=([-_\w\d]{10,70})/i);o=bPy(o,St=>{V.set(St)},{tag:`axios-${Dsa}-boundary`,boundary:Se&&Se[1]||void 0})}else if(Yf.isFormData(o)&&Yf.isFunction(o.getHeaders)){if(V.set(o.getHeaders()),!V.hasContentLength())try{let Se=await BPy.default.promisify(o.getLength).call(o);Number.isFinite(Se)&&Se>=0&&V.setContentLength(Se)}catch{}}else if(Yf.isBlob(o)||Yf.isFile(o))o.size&&V.setContentType(o.type||"application/octet-stream"),V.setContentLength(o.size||0),o=Isa.default.Readable.from(uEs(o));else if(o&&!Yf.isStream(o)){if(!Buffer.isBuffer(o))if(Yf.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else if(Yf.isString(o))o=Buffer.from(o,"utf-8");else return i(new jm("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",jm.ERR_BAD_REQUEST,t));if(V.setContentLength(o.length,!1),t.maxBodyLength>-1&&o.length>t.maxBodyLength)return i(new jm("Request body larger than maxBodyLength limit",jm.ERR_BAD_REQUEST,t))}let Oe=Yf.toFiniteNumber(V.getContentLength());Yf.isArray(Y)?(te=Y[0],ne=Y[1]):te=ne=Y,o&&($||te)&&(Yf.isStream(o)||(o=Isa.default.Readable.from(o,{objectMode:!1})),o=Isa.default.pipeline([o,new Fbf({maxRate:Yf.toFiniteNumber(te)})],Yf.noop),$&&o.on("progress",SPy(o,HZa(Oe,fAi(GZa($),!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=Esa(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"+(jPy?", br":""),!1);let be={path:ve,method:l,headers:V.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:ge,protocol:R,family:d,beforeRedirect:joC,beforeRedirects:{}};!Yf.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,RPy(be,t.proxy,R+"//"+U.hostname+(U.port?":"+U.port:"")+be.path));let Me,Be=woC.test(be.protocol);if(be.agent=Be?t.httpsAgent:t.httpAgent,t.transport?Me=t.transport:t.maxRedirects===0?Me=Be?MPy.default:IPy.default:(t.maxRedirects&&(be.maxRedirects=t.maxRedirects),t.beforeRedirect&&(be.beforeRedirects.config=t.beforeRedirect),Me=Be?PoC:AoC),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 yt=[St],Re=+St.headers["content-length"];if(re||ne){let Mt=new Fbf({maxRate:Yf.toFiniteNumber(ne)});re&&Mt.on("progress",SPy(Mt,HZa(Re,fAi(GZa(re),!0,3)))),yt.push(Mt)}let De=St,Lt=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":yt.push(dAi.default.createUnzip(wPy)),delete St.headers["content-encoding"];break;case"deflate":yt.push(new mPy),yt.push(dAi.default.createUnzip(wPy)),delete St.headers["content-encoding"];break;case"br":jPy&&(yt.push(dAi.default.createBrotliDecompress(OoC)),delete St.headers["content-encoding"])}De=yt.length>1?Isa.default.pipeline(yt,Yf.noop):yt[0];let Xe=Isa.default.finished(De,()=>{Xe(),M()}),Yt={status:St.statusCode,statusText:St.statusMessage,headers:new w$(St.headers),config:t,request:Lt};if(s==="stream")Yt.data=De,O9r(n,i,Yt);else{let Mt=[],Ke=0;De.on("data",function(sr){Mt.push(sr),Ke+=sr.length,t.maxContentLength>-1&&Ke>t.maxContentLength&&(A=!0,De.destroy(),i(new jm("maxContentLength size of "+t.maxContentLength+" exceeded",jm.ERR_BAD_RESPONSE,t,Lt)))}),De.on("aborted",function(){if(A)return;let sr=new jm("stream has been aborted",jm.ERR_BAD_RESPONSE,t,Lt);De.destroy(sr),i(sr)}),De.on("error",function(sr){P.destroyed||i(jm.from(sr,null,t,Lt))}),De.on("end",function(){try{let sr=Mt.length===1?Mt[0]:Buffer.concat(Mt);s!=="arraybuffer"&&(sr=sr.toString(u),(!u||u==="utf8")&&(sr=Yf.stripBOM(sr))),Yt.data=sr}catch(sr){return i(jm.from(sr,null,t,Yt.request,Yt))}O9r(n,i,Yt)})}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(jm.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 jm("error trying to parse `config.timeout` to int",jm.ERR_BAD_OPTION_VALUE,t,P));return}P.setTimeout(Se,function(){if(m)return;let yt=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",Re=t.transitional||UZa;t.timeoutErrorMessage&&(yt=t.timeoutErrorMessage),i(new jm(yt,Re.clarifyTimeoutError?jm.ETIMEDOUT:jm.ECONNABORTED,t,P)),T()})}if(Yf.isStream(o)){let Se=!1,St=!1;o.on("end",()=>{Se=!0}),o.once("error",yt=>{St=!0,P.destroy(yt)}),o.on("close",()=>{!Se&&!St&&T(new Ent("Request stream has been aborted",t,P))}),o.pipe(P)}else P.end(o)})};var FPy=V2.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,V2.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(V2.origin),V2.navigator&&/(msie|trident)/i.test(V2.navigator.userAgent)):()=>!0;var xPy=V2.hasStandardBrowserEnv?{write(e,t,r,n,i,a){let o=[e+"="+encodeURIComponent(t)];Yf.isNumber(r)&&o.push("expires="+new Date(r).toGMTString()),Yf.isString(n)&&o.push("path="+n),Yf.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 zPy=e=>e instanceof w$?{...e}:e;function tqr(e,t){t=t||{};let r={};function n(s,u,l,m){return Yf.isPlainObject(s)&&Yf.isPlainObject(u)?Yf.merge.call({caseless:m},s,u):Yf.isPlainObject(u)?Yf.merge({},u):Yf.isArray(u)?u.slice():u}function i(s,u,l,m){if(Yf.isUndefined(u)){if(!Yf.isUndefined(s))return n(void 0,s,l,m)}else return n(s,u,l,m)}function a(s,u){if(!Yf.isUndefined(u))return n(void 0,u)}function o(s,u){if(Yf.isUndefined(u)){if(!Yf.isUndefined(s))return n(void 0,s)}else return n(void 0,u)}function c(s,u,l){if(l in t)return n(s,u);if(l in e)return n(void 0,s)}let d={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:(s,u,l)=>i(zPy(s),zPy(u),l,!0)};return Yf.forEach(Object.keys({...e,...t}),function(u){let l=d[u]||i,m=l(e[u],t[u],u);Yf.isUndefined(m)&&l!==c||(r[u]=m)}),r}var sEs=e=>{let t=tqr({},e),{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:a,headers:o,auth:c}=t;if(t.headers=o=w$.from(o),t.url=Esa(Ssa(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&o.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),Yf.isFormData(r)){if(V2.hasStandardBrowserEnv||V2.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(Yf.isFunction(r.getHeaders)){let d=r.getHeaders(),s=["content-type","content-length"];Object.entries(d).forEach(([u,l])=>{s.includes(u.toLowerCase())&&o.set(u,l)})}}if(V2.hasStandardBrowserEnv&&(n&&Yf.isFunction(n)&&(n=n(t)),n||n!==!1&&FPy(t.url))){let d=i&&a&&xPy.read(a);d&&o.set(i,d)}return t};var CoC=typeof XMLHttpRequest<"u",QPy=CoC&&function(e){return new Promise(function(r,n){let i=sEs(e),a=i.data,o=w$.from(i.headers).normalize(),{responseType:c,onUploadProgress:d,onDownloadProgress:s}=i,u,l,m,A,P;function C(){A&&A(),P&&P(),i.cancelToken&&i.cancelToken.unsubscribe(u),i.signal&&i.signal.removeEventListener("abort",u)}let M=new XMLHttpRequest;M.open(i.method.toUpperCase(),i.url,!0),M.timeout=i.timeout;function T(){if(!M)return;let U=w$.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};O9r(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 jm("Request aborted",jm.ECONNABORTED,e,M)),M=null)},M.onerror=function(R){let V=R&&R.message?R.message:"Network Error",$=new jm(V,jm.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||UZa;i.timeoutErrorMessage&&(R=i.timeoutErrorMessage),n(new jm(R,V.clarifyTimeoutError?jm.ETIMEDOUT:jm.ECONNABORTED,e,M)),M=null},a===void 0&&o.setContentType(null),"setRequestHeader"in M&&Yf.forEach(o.toJSON(),function(R,V){M.setRequestHeader(V,R)}),Yf.isUndefined(i.withCredentials)||(M.withCredentials=!!i.withCredentials),c&&c!=="json"&&(M.responseType=i.responseType),s&&([m,P]=fAi(s,!0),M.addEventListener("progress",m)),d&&M.upload&&([l,A]=fAi(d),M.upload.addEventListener("progress",l),M.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(u=U=>{M&&(n(!U||U.type?new Ent(null,e,M):U),M.abort(),M=null)},i.cancelToken&&i.cancelToken.subscribe(u),i.signal&&(i.signal.aborted?u():i.signal.addEventListener("abort",u)));let z=FJo(i.url);if(z&&V2.protocols.indexOf(z)===-1){n(new jm("Unsupported protocol "+z+":",jm.ERR_BAD_REQUEST,e));return}M.send(a||null)})};var IoC=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i,a=function(s){if(!i){i=!0,c();let u=s instanceof Error?s:this.reason;n.abort(u instanceof jm?u:new Ent(u instanceof Error?u.message:u))}},o=t&&setTimeout(()=>{o=null,a(new jm(`timeout ${t} of ms exceeded`,jm.ETIMEDOUT))},t),c=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(s=>{s.unsubscribe?s.unsubscribe(a):s.removeEventListener("abort",a)}),e=null)};e.forEach(s=>s.addEventListener("abort",a));let{signal:d}=n;return d.unsubscribe=()=>Yf.asap(c),d}},LPy=IoC;var MoC=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},BoC=async function*(e,t){for await(let r of ToC(e))yield*MoC(r,t)},ToC=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()}},Lbf=(e,t,r,n)=>{let i=BoC(e,t),a=0,o,c=d=>{o||(o=!0,n&&n(d))};return new ReadableStream({async pull(d){try{let{done:s,value:u}=await i.next();if(s){c(),d.close();return}let l=u.byteLength;if(r){let m=a+=l;r(m)}d.enqueue(new Uint8Array(u))}catch(s){throw c(s),s}},cancel(d){return c(d),i.return()}},{highWaterMark:2})};var UPy=64*1024,{isFunction:cEs}=Yf,qoC=(({Request:e,Response:t})=>({Request:e,Response:t}))(Yf.global),{ReadableStream:VPy,TextEncoder:WPy}=Yf.global,HPy=(e,...t)=>{try{return!!e(...t)}catch{return!1}},RoC=e=>{e=Yf.merge.call({skipUndefined:!0},qoC,e);let{fetch:t,Request:r,Response:n}=e,i=t?cEs(t):typeof fetch=="function",a=cEs(r),o=cEs(n);if(!i)return!1;let c=i&&cEs(VPy),d=i&&(typeof WPy=="function"?(P=>C=>P.encode(C))(new WPy):async P=>new Uint8Array(await new r(P).arrayBuffer())),s=a&&c&&HPy(()=>{let P=!1,C=new r(V2.origin,{body:new VPy,method:"POST",get duplex(){return P=!0,"half"}}).headers.has("Content-Type");return P&&!C}),u=o&&c&&HPy(()=>Yf.isReadableStream(new n("").body)),l={stream:u&&(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 jm(`Response type '${P}' is not supported`,jm.ERR_NOT_SUPPORT,M)})});let m=async P=>{if(P==null)return 0;if(Yf.isBlob(P))return P.size;if(Yf.isSpecCompliantForm(P))return(await new r(V2.origin,{method:"POST",body:P}).arrayBuffer()).byteLength;if(Yf.isArrayBufferView(P)||Yf.isArrayBuffer(P))return P.byteLength;if(Yf.isURLSearchParams(P)&&(P=P+""),Yf.isString(P))return(await d(P)).byteLength},A=async(P,C)=>{let M=Yf.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}=sEs(P),Oe=t||fetch;re=re?(re+"").toLowerCase():"text";let ge=LPy([z,U&&U.toAbortSignal()],R),ve=null,be=ge&&ge.unsubscribe&&(()=>{ge.unsubscribe()}),Me;try{if($&&s&&M!=="get"&&M!=="head"&&(Me=await A(Y,T))!==0){let De=new r(C,{method:"POST",body:T,duplex:"half"}),Lt;if(Yf.isFormData(T)&&(Lt=De.headers.get("content-type"))&&Y.setContentType(Lt),De.body){let[Xe,Yt]=HZa(Me,fAi(GZa($)));T=Lbf(De.body,UPy,Xe,Yt)}}Yf.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?Oe(ve,ne):Oe(C,Se)),yt=u&&(re==="stream"||re==="response");if(u&&(V||yt&&be)){let De={};["status","statusText","headers"].forEach(Mt=>{De[Mt]=St[Mt]});let Lt=Yf.toFiniteNumber(St.headers.get("content-length")),[Xe,Yt]=V&&HZa(Lt,fAi(GZa(V),!0))||[];St=new n(Lbf(St.body,UPy,Xe,()=>{Yt&&Yt(),be&&be()}),De)}re=re||"text";let Re=await l[Yf.findKey(l,re)||"text"](St,P);return!yt&&be&&be(),await new Promise((De,Lt)=>{O9r(De,Lt,{data:Re,headers:w$.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 jm("Network Error",jm.ERR_NETWORK,P,ve),{cause:Be.cause||Be}):jm.from(Be,Be&&Be.code,P,ve)}}},NoC=new Map,Ubf=e=>{let t=e?e.env:{},{fetch:r,Request:n,Response:i}=t,a=[n,i,r],o=a.length,c=o,d,s,u=NoC;for(;c--;)d=a[c],s=u.get(d),s===void 0&&u.set(d,s=c?new Map:RoC(t)),u=s;return s},qM9=Ubf();var Vbf={http:NPy,xhr:QPy,fetch:{get:Ubf}};Yf.forEach(Vbf,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var GPy=e=>`- ${e}`,xoC=e=>Yf.isFunction(e)||e===null||e===!1,lEs={getAdapter:(e,t)=>{e=Yf.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,!xoC(n)&&(i=Vbf[(c=String(n)).toLowerCase()],i===void 0))throw new jm(`Unknown adapter '${c}'`);if(i&&(Yf.isFunction(i)||(i=i.get(t))))break;a[c||"#"+o]=i}if(!i){let o=Object.entries(a).map(([d,s])=>`adapter ${d} `+(s===!1?"is not supported by the environment":"is not available in the build")),c=r?o.length>1?`since :
|
|
@@ -2262,7 +2262,7 @@ errors:
|
|
|
2262
2262
|
status-code: 404
|
|
2263
2263
|
type: MovieId
|
|
2264
2264
|
`;async function sEy({directoryOfWorkspace:e,cliVersion:t,context:r}){await Tv(e)||await(0,E4i.mkdir)(e),await lEy({filepath:Jl(e,ys.of(b$)),cliVersion:t,context:r});let n=Jl(e,ys.of(oie));await X_C({directoryOfDefinition:n})}async function cEy({directoryOfWorkspace:e,openAPIFilePath:t,cliVersion:r,context:n}){await Tv(e)||await(0,E4i.mkdir)(e),await lEy({filepath:Jl(e,ys.of(b$)),cliVersion:r,context:n,apiConfiguration:{specs:[{openapi:l5(e,t)}]}})}async function $_C({cliVersion:e,context:t,apiConfiguration:r}){let n="fernapi/fern-typescript-sdk",i=sWo[n],a=i.version,o=await yLr({cliVersion:e,generatorName:n,channel:void 0});o!=null?a=o:t.logger.debug(`Failed to get latest version for ${n} that is compatible with CLI ${e}, falling back to preset version ${a}`);let c={"default-group":R9o,groups:{[R9o]:{generators:[{name:n,...i,version:a}]}}};return r!=null&&(c.api=r),c}async function lEy({filepath:e,cliVersion:t,context:r,apiConfiguration:n}){await(0,E4i.writeFile)(e,`# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json
|
|
2265
|
-
`+Vg.dump(await $_C({cliVersion:t,context:r,apiConfiguration:n}),{sortKeys:(i,a)=>i==="api"?-1:a==="api"?1:i.localeCompare(a)}))}var Y_C={name:"api","error-discrimination":{strategy:"status-code"}};async function X_C({directoryOfDefinition:e}){await(0,E4i.mkdir)(e),await(0,E4i.writeFile)(Jl(e,ys.of(aee)),Vg.dump(Y_C));let t=Jl(e,ys.of("imdb.yml"));await(0,E4i.writeFile)(t,await tKo({fileContents:uEy}))}async function j0f({organization:e,versionOfCli:t,openApiPath:r,context:n}){let{absolutePathToFernDirectory:i}=await PEs({organization:e,versionOfCli:t,taskContext:n}),a=await Z_C({absolutePathToFernDirectory:i,taskContext:n});r!=null?(await cEy({directoryOfWorkspace:a,openAPIFilePath:r,cliVersion:t,context:n}),n.logger.info(bd.green("Created new API: ./"+fEy.default.relative(process.cwd(),a)))):(await sEy({directoryOfWorkspace:a,cliVersion:t,context:n}),n.logger.info(bd.green("Created new fern folder")))}async function Z_C({absolutePathToFernDirectory:e,taskContext:t}){if(await k_C({absolutePathToFernDirectory:e})){let i=0,a=Jl(e,ys.of(Vmi)),o=Jl(a,ys.of(`${OXl}`));for(;await Tv(o);)o=Jl(a,ys.of(`${OXl}${++i}`));return o}if(await ehC({absolutePathToFernDirectory:e})){t.logger.info("Creating workspaces to support multiple API Definitions.");let i=Jl(e,ys.of(Vmi),ys.of("api")),a=Jl(e,ys.of(oie)),o=Jl(i,ys.of(oie));await(0,P0f.mkdir)(i,{recursive:!0}),await w0f.default.move(a,o);let c=Jl(e,ys.of(b$)),d=Jl(i,ys.of(b$));await w0f.default.move(c,d);let s=Jl(e,ys.of(Vmi),ys.of("api1"));return await(0,P0f.mkdir)(o,{recursive:!0}),s}return e}async function k_C({absolutePathToFernDirectory:e}){let t=Jl(e,ys.of(Vmi));return await Tv(t)}async function ehC({absolutePathToFernDirectory:e}){let t=Jl(e,ys.of(oie));return await Tv(t)}var pEy=require("fs/promises");var dEy=fa(a9o(),1);function E0f(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,dEy.default)(e,{special:thC}).replace(/V\s(\d)/g,"V$1")}var thC=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];async function S0f({organization:e,taskContext:t,versionOfCli:r}){let n=await PEs({organization:e,versionOfCli:r,taskContext:t});if(n.absolutePathToFernDirectory){let i=Jl(n.absolutePathToFernDirectory,ys.of(Urt));if(await Tv(i)){t.logger.info(bd.yellow(`Docs configuration already exists at: ${i}`));return}else try{await(0,pEy.writeFile)(i,Vg.dump(
|
|
2265
|
+
`+Vg.dump(await $_C({cliVersion:t,context:r,apiConfiguration:n}),{sortKeys:(i,a)=>i==="api"?-1:a==="api"?1:i.localeCompare(a)}))}var Y_C={name:"api","error-discrimination":{strategy:"status-code"}};async function X_C({directoryOfDefinition:e}){await(0,E4i.mkdir)(e),await(0,E4i.writeFile)(Jl(e,ys.of(aee)),Vg.dump(Y_C));let t=Jl(e,ys.of("imdb.yml"));await(0,E4i.writeFile)(t,await tKo({fileContents:uEy}))}async function j0f({organization:e,versionOfCli:t,openApiPath:r,context:n}){let{absolutePathToFernDirectory:i}=await PEs({organization:e,versionOfCli:t,taskContext:n}),a=await Z_C({absolutePathToFernDirectory:i,taskContext:n});r!=null?(await cEy({directoryOfWorkspace:a,openAPIFilePath:r,cliVersion:t,context:n}),n.logger.info(bd.green("Created new API: ./"+fEy.default.relative(process.cwd(),a)))):(await sEy({directoryOfWorkspace:a,cliVersion:t,context:n}),n.logger.info(bd.green("Created new fern folder")))}async function Z_C({absolutePathToFernDirectory:e,taskContext:t}){if(await k_C({absolutePathToFernDirectory:e})){let i=0,a=Jl(e,ys.of(Vmi)),o=Jl(a,ys.of(`${OXl}`));for(;await Tv(o);)o=Jl(a,ys.of(`${OXl}${++i}`));return o}if(await ehC({absolutePathToFernDirectory:e})){t.logger.info("Creating workspaces to support multiple API Definitions.");let i=Jl(e,ys.of(Vmi),ys.of("api")),a=Jl(e,ys.of(oie)),o=Jl(i,ys.of(oie));await(0,P0f.mkdir)(i,{recursive:!0}),await w0f.default.move(a,o);let c=Jl(e,ys.of(b$)),d=Jl(i,ys.of(b$));await w0f.default.move(c,d);let s=Jl(e,ys.of(Vmi),ys.of("api1"));return await(0,P0f.mkdir)(o,{recursive:!0}),s}return e}async function k_C({absolutePathToFernDirectory:e}){let t=Jl(e,ys.of(Vmi));return await Tv(t)}async function ehC({absolutePathToFernDirectory:e}){let t=Jl(e,ys.of(oie));return await Tv(t)}var pEy=require("fs/promises");var dEy=fa(a9o(),1);function E0f(e){return e=e.replace(/([a-z])([A-Z])/g,"$1 $2"),e=e.replace(/_/g," "),e=e.replace(/-/g," "),(0,dEy.default)(e,{special:thC}).replace(/V\s(\d)/g,"V$1")}var thC=["PII","PHI","PCI","GDPR","CCPA","HIPAA","COPPA","FERPA","GLBA","SOX","FISMA","NIST","CIS","ISO","IEC","ITAR","EAR","CMMC","CUI","CDI","FTC","FCC","SEC","FINRA","XSS","CSRF","SSRF","XSRF","TLS","SSL","SSH","API","OAuth","OAuth1","OAuth1.0","OAuth2","OAuth2.0","SAML","OpenID","OpenID Connect","CAPTCHA","reCAPTCHA","2FA","MFA","OTP","TOTP","HOTP","U2F","FIDO","FIDO2","PKI","HMAC","AES","RSA","SHA","MD5","BCrypt","PBKDF2","Argon2","SCrypt","JWT","JWE","JWS","JWK","JWA","JOSE","SKU","SKUs","UPC","EAN","ISBN","ASIN","MPN","MSRP","MAP","RRP","MSRP","AM","PM","UTC","GMT","PST","PDT","EST","EDT","CST","CDT","MST","MDT","USA","UK","EU","UAE","APAC","EMEA","LATAM","ANZ","SEA","MEA","MENA","NATO","NA","SA","CA","EU","AU","NZ","JP","KR","CN","HK","TW","SG","MY","TH","ID","PH","VN","IN","PK","BD","LK","NP","MM","KH","LA","MM","BT","MV","USD","EUR","GBP","JPY","CNY","RUB","INR","AUD","CAD","CHF","SGD","MYR","THB","IDR","KRW","PHP","VND","HKD","TWD","MXN","BRL","ARS","CLP","COP","PEN","ZAR","NGN","EGP","AED","SAR","ILS","TRY","SEK","NOK","DKK","ISK","HUF","PLN","CZK","RON","BGN","API","APIs","SDK","SDKs","AI","OCR","REST","SOAP","JSON","XML","HTTP","HTTPS","URI","URL","CRUD","RESTful","KYB","KYC","AML","HTML","CSS","JS","SQL","DB","UI","UX","SaaS","PaaS","IaaS","IP","TCP","UDP","DNS","FTP","SMTP","IMAP","POP3","CSV","MVC","MVP","MVVM","DOM","SPA","SSR","CSR","DDoS","CDN","IoT","ML","DL","NLP","CLI","GUI","BI","ETL","RDBMS","NoSQL","IDE","CMS","CCPA","POSIX","ABI","API","AST","COBOL","DDL","DML","NN","CNN","RNN","LSTM","GRU","ANN","GAN","RL","DL","ML","NLP","NLG","NLU","BERT","GPT","SVM","PCA","AI","CV","TF","TTS","ASR","HMM","DNN","MLP","RBM","CRF","PDF","PDFs","RTF","TXT","XLS","XLSX","PPT","JPG","JPEG","PNG","GIF","GIFs","SVG","TIFF","BMP","ICO","PSD","WebP","AVIF","HEIF","HEIC","EPS","MP3","WAV","AIFF","FLAC","WMA","AAC","OGG","AVI","WMV","MOV","M4V","MP4","MPG","MPEG","FLV","SWF","MKV","WebM","GCP","AWS","VM","VPC","S3","EC2","DynamoDB","CosmosDB","BigQuery","CI/CD","SOC1","SOC2","SOC3","PCI DSS","WAF","IAM","SDN","MPLS","BGP","Vue.js","Node.js",".NET"];async function S0f({organization:e,taskContext:t,versionOfCli:r}){let n=await PEs({organization:e,versionOfCli:r,taskContext:t});if(n.absolutePathToFernDirectory){let i=Jl(n.absolutePathToFernDirectory,ys.of(Urt));if(await Tv(i)){t.logger.info(bd.yellow(`Docs configuration already exists at: ${i}`));return}else try{let a=rhC(n.organization),o={...a,"ai-search":a.aiSearch};delete o.aiSearch,await(0,pEy.writeFile)(i,Vg.dump(o)),t.logger.info(bd.green("Created docs configuration"));return}catch(a){let o=a instanceof Error?a.message:String(a);throw t.logger.debug(`Encountered an error while writing docs configuration: ${o}`),t.logger.error(bd.red("Failed to write docs configuration")),a}}}function rhC(e){return{instances:[{url:`https://${e}.docs.buildwithfern.com`}],title:`${E0f(e)} | Documentation`,navigation:[{api:"API Reference",paginated:!0}],colors:{accentPrimary:"#ffffff",background:"#000000"},aiSearch:{location:["docs"]}}}var rKo={searchbarPlacement:"header",pageWidth:"full",tabsPlacement:"header"};var Nsa=class{context;constructor({context:t}){this.context=t}};var GEs=class{};var jht=require("fs/promises");var Fsa=class extends GEs{openApiSpecs={};nonTabbedNavigation=new C0f;tabbedNavigation={};markdownPages={};assets={};docsYml={instances:[]};generatorsYml={api:{specs:[]}};addOpenAPI({relativePathToOpenAPI:t,absolutePathToOpenAPI:r}){this.openApiSpecs[t]=r}addMarkdownPage({frontmatter:t,markdown:r,relativeFilePathFromDocsYml:n}){this.markdownPages[n]={markdown:r,frontmatter:t}}addAsset({absoluteFilePathToAsset:t,relativeFilePathFromDocsYml:r}){this.assets[r]={absoluteFilePathToAsset:t}}getNavigationBuilder(t){if(t!=null){let r=this.tabbedNavigation[t.tabId];return r==null&&(r=new D0f(t.tabId,t.tabConfig),this.tabbedNavigation[t.tabId]=r),r}return this.nonTabbedNavigation}addVersion({versionConfig:t,navigation:r}){throw new Error("Method not implemented.")}addNavbarLink({link:t}){this.docsYml.navbarLinks==null&&(this.docsYml.navbarLinks=[t]),this.docsYml.navbarLinks.push(t)}setTitle({title:t}){this.docsYml.title=t}setFavicon({favicon:t}){this.docsYml.favicon=t}setLogo({logo:t}){this.docsYml.logo=t}setColors({colors:t}){this.docsYml.colors=t}setLayout({layout:t}){this.docsYml.layout=t}async build({outputDirectory:t}){let r=Jl(t,ys.of(kve));if(await(0,jht.mkdir)(r,{recursive:!0}),Object.keys(this.tabbedNavigation).length>0){this.docsYml.tabs=Object.fromEntries(Object.entries(this.tabbedNavigation).map(([i,a])=>[a.tabId,a.tabConfig]));let n=[];Object.entries(this.tabbedNavigation).forEach(([i,a])=>{let o={tab:a.tabId,...a.items.length>0?{layout:a.items}:{}};n.push(o)}),this.docsYml.navigation=n}else this.nonTabbedNavigation!=null&&(this.docsYml.navigation=this.nonTabbedNavigation.items);Object.entries(this.openApiSpecs).length>0&&this.generatorsYml?.api!=null&&(typeof this.generatorsYml.api!="string"&&(this.generatorsYml.api={specs:Object.entries(this.openApiSpecs).map(([n])=>({openapi:n}))}),await(0,jht.writeFile)(Jl(r,ys.of(b$)),Vg.dump(GP.serialization.GeneratorsConfigurationSchema.jsonOrThrow(this.generatorsYml))),await Promise.all(Object.entries(this.openApiSpecs).map(async([n,i])=>{let a=Jl(r,ys.of(n));await(0,jht.mkdir)(Ug(a),{recursive:!0}),await(0,jht.cp)(i,a)}))),await(0,jht.writeFile)(Jl(r,ys.of(Urt)),Vg.dump(mFe.RawSchemas.Serializer.DocsConfiguration.jsonOrThrow(this.docsYml,{omitUndefined:!0}))),await Promise.all(Object.entries(this.markdownPages).map(async([n,i])=>{let a=Jl(r,ys.of(n));await(0,jht.mkdir)(Ug(a),{recursive:!0});let o=Object.keys(i.frontmatter).length>0?`---
|
|
2266
2266
|
${Vg.dump(JSON.parse(JSON.stringify(i.frontmatter)))}---
|
|
2267
2267
|
|
|
2268
2268
|
`:"";await(0,jht.writeFile)(a,`${o}${i.markdown}`)})),await Promise.all(Object.entries(this.assets).map(async([n,i])=>{let a=Jl(r,ys.of(n));await(0,jht.mkdir)(Ug(a),{recursive:!0}),await(0,jht.cp)(i.absoluteFilePathToAsset,a)}))}setInstance({companyName:t}){let n=`https://${t.toLowerCase().replace(" ","-")}.docs.buildwithfern.com`;return this.docsYml.instances.push({url:n}),n}},D0f=class{tabId;tabConfig;items=[];constructor(t,r){this.tabId=t,this.tabConfig=r}addItem({item:t}){this.items.push(t)}},C0f=class{items=[];addItem({item:t}){this.items.push(t)}};var LDy=require("fs/promises");function _Ey(e){return{accentPrimary:{dark:e.dark??e.primary,light:e.light??e.primary},background:{dark:e.background?.dark,light:e.background?.light}}}var hEy=28;function yEy({logo:e,builder:t,absolutePathToMintJson:r}){if(e==null)return;if(typeof e=="string"){let a=ys.of(pPe(e));return t.addAsset({absoluteFilePathToAsset:Jl(Ug(r),a),relativeFilePathFromDocsYml:a}),{light:a,dark:a,height:hEy}}let n=ys.of(pPe(e.light));t.addAsset({absoluteFilePathToAsset:Jl(Ug(r),n),relativeFilePathFromDocsYml:n});let i=ys.of(pPe(e.dark));return t.addAsset({absoluteFilePathToAsset:Jl(Ug(r),i),relativeFilePathFromDocsYml:i}),{light:n,dark:i,href:e.href,height:hEy}}var qDy=fa(lnt(),1),RDy=require("fs/promises"),NDy=fa(rqr(),1);async function FDy({absolutePathToMintJson:e,absoluteFilepathToMarkdown:t,relativeFilepathFromRoot:r,builder:n}){let i=await(0,RDy.readFile)(t,"utf-8"),{data:a,content:o}=_bC(i),c=r.replace(/\.(md|mdx)$/,""),d=ybC({absolutePathToMintJson:e,absoluteFilepathToMarkdown:t,content:o,builder:n});return{mintlifyFrontmatter:a,relativeFilepathFromRoot:r,sidebarTitle:a.sidebarTitle??a.title??"Introduction",frontmatter:{"max-toc-depth":void 0,title:a.title,subtitle:a.description,layout:a.mode!=null?"reference":void 0,image:a["og:image"],slug:qDy.FernRegistry.navigation.latest.Slug(c),headline:void 0,description:void 0,"edit-this-page-url":void 0,"hide-toc":void 0,"hide-feedback":void 0,"no-image-zoom":void 0,"force-toc":void 0,"hide-nav-links":void 0,breadcrumb:void 0,excerpt:void 0,"canonical-url":void 0,"og:site_name":void 0,"og:title":void 0,"og:description":void 0,"og:url":void 0,"og:image":void 0,"og:image:width":void 0,"og:image:height":void 0,"og:locale":void 0,"og:logo":void 0,"twitter:title":void 0,"twitter:description":void 0,"twitter:handle":void 0,"twitter:image":void 0,"twitter:site":void 0,"twitter:url":void 0,"twitter:card":void 0,noindex:void 0,nofollow:void 0,"jsonld:breadcrumb":void 0,logo:void 0,keywords:void 0,tags:void 0},content:d}}function _bC(e){let{data:t,content:r}=(0,NDy.default)(e);return{data:t,content:r}}function hbC(e){return e.startsWith("http:")||e.startsWith("https:")||e.startsWith("mailto:")||e.startsWith("tel:")}function ybC({absolutePathToMintJson:e,absoluteFilepathToMarkdown:t,content:r,builder:n}){return r.replaceAll(/src=["']([^"']+)["']/g,(a,o)=>{if(hbC(o))return a;if(o.startsWith("/")){let c=ys.of(o.substring(1)),d=Jl(Ug(e),c);return n.addAsset({absoluteFilePathToAsset:d,relativeFilePathFromDocsYml:c}),`src="${c}"`}return a})}async function G0f({absolutePathToMintJson:e,item:t,builder:r,context:n}){return{section:t.group,contents:(await Promise.all(t.pages.map(async a=>{if(typeof a=="string"){let o=ys.of(a.endsWith("mdx")?a:`${a}.mdx`),c=Jl(Ug(e),o);if(!await Tv(c))return;let s=await FDy({absolutePathToMintJson:e,relativeFilepathFromRoot:o,absoluteFilepathToMarkdown:c,builder:r});return s.mintlifyFrontmatter.openapi!=null?void 0:(r.addMarkdownPage({frontmatter:s.frontmatter,markdown:s.content,relativeFilePathFromDocsYml:o}),{page:s.sidebarTitle??"",icon:s.mintlifyFrontmatter.icon,path:o})}else return await G0f({absolutePathToMintJson:e,item:a,builder:r,context:n})}))).filter(Zw)}}function xDy(e){return e.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function zDy({mintItem:e}){let t=QDy({item:e});if(t!=null)return vbC({path:t})}function QDy({item:e}){for(let t of e.pages){if(typeof t=="string")return t;{let r=QDy({item:t});if(r!=null)return r}}}function vbC({path:e}){return e.split("/")[0]}var iSs=class extends Nsa{documentationTab=void 0;tabUrlToInfo={};async import({args:t,builder:r}){let n=await(0,LDy.readFile)(t.absolutePathToMintJson,"utf-8"),i=JSON.parse(n);r.setTitle({title:i.name});let a=ys.of(i.favicon.substring(1));r.setFavicon({favicon:a}),r.addAsset({absoluteFilePathToAsset:Jl(Ug(t.absolutePathToMintJson),a),relativeFilePathFromDocsYml:a});let o=yEy({logo:i.logo,builder:r,absolutePathToMintJson:t.absolutePathToMintJson});o!=null&&r.setLogo({logo:o}),this.context.logger.debug("Converted logo");let c=_Ey(i.colors);if(c!=null&&r.setColors({colors:c}),this.context.logger.debug("Converted color configuration"),r.setLayout({layout:rKo}),i.tabs!=null)for(let s of i.tabs??[])this.tabUrlToInfo[s.url]={name:s.name,url:s.url,navigationBuilder:r.getNavigationBuilder({tabId:s.url,tabConfig:{slug:s.url,displayName:s.name}})};else if(i.anchors!=null)for(let s of i.anchors)"url"in s&&s.url!=null&&s.url.startsWith("https://")?this.tabUrlToInfo[s.url]={name:s.name,url:s.url,navigationBuilder:r.getNavigationBuilder({tabId:s.name,tabConfig:{href:s.url,displayName:s.name}})}:"url"in s&&s.url!=null&&(this.tabUrlToInfo[s.url]={name:s.name,url:s.url,navigationBuilder:r.getNavigationBuilder({tabId:s.url,tabConfig:{slug:s.url,displayName:s.name}})});for(let s of i.navigation){let u=await G0f({absolutePathToMintJson:t.absolutePathToMintJson,item:s,builder:r,context:this.context}),l=await this.getNavigationBuilder({mintItem:s,builder:r});u!=null&&l.addItem({item:u})}if(this.context.logger.debug("Converted navigation"),typeof i.openapi=="string"){let s=Jl(Ug(t.absolutePathToMintJson),ys.of(pPe(i.openapi)));r.addOpenAPI({relativePathToOpenAPI:ys.of(pPe(i.openapi)),absolutePathToOpenAPI:s})}else if(i.openapi!=null)for(let s of i.openapi){let u=Jl(Ug(t.absolutePathToMintJson),ys.of(pPe(s)));r.addOpenAPI({relativePathToOpenAPI:ys.of(pPe(s)),absolutePathToOpenAPI:u})}else if(i.anchors!=null){for(let s of i.anchors)if("openapi"in s&&s.openapi!=null){let u=Jl(Ug(t.absolutePathToMintJson),ys.of(pPe(s.openapi)));r.addOpenAPI({relativePathToOpenAPI:ys.of(pPe(s.openapi)),absolutePathToOpenAPI:u})}}this.context.logger.debug("Imported OpenAPI specs");let d=r.setInstance({companyName:xDy(i.name)});this.context.logger.debug(`Added instance ${d} to docs.yml`)}async getNavigationBuilder({mintItem:t,builder:r}){if(Object.keys(this.tabUrlToInfo).length>0){let n=zDy({mintItem:t});return n==null?this.context.failAndThrow(`Failed to assign navigation item to a tab group: ${t.group}`):(this.tabUrlToInfo[n]??this.getDefaultDocumentationTab(r)).navigationBuilder}return r.getNavigationBuilder()}getDefaultDocumentationTab(t){return this.documentationTab==null&&(this.documentationTab={name:"Documentation",url:"documentation",navigationBuilder:t.getNavigationBuilder({tabId:"documentation",tabConfig:{displayName:"Documentation",slug:"documentation"}})}),this.documentationTab}};var UDy=require("fs/promises");async function J0f({absolutePathToMintJson:e,outputPath:t,taskContext:r,versionOfCli:n,organization:i}){let a=new iSs({context:r}),o=new Fsa;await a.import({args:{absolutePathToMintJson:e},builder:o}),await o.build({outputDirectory:t}),await(0,UDy.writeFile)(Jl(x_.of(t),ys.of(kve),ys.of(vFe)),JSON.stringify({version:n,organization:i},void 0,4))}var K0f=async({pathToMintJson:e,taskContext:t,versionOfCli:r,organization:n})=>{if(!e?.includes("mint.json")){t.failAndThrow("Provide a path to a mint.json file");return}let i;if(zaa(e)){t.failAndThrow("Clone the repo locally and run this command again by referencing the path to the local mint.json file");return}else i=x_.of(A1(yV(),e));if(!await Tv(i)||!i){t.failAndThrow(`${i} does not exist`);return}let o=x_.of(yV());await J0f({absolutePathToMintJson:i,outputPath:o,taskContext:t,versionOfCli:r,organization:n})};var Eht=(function(e){if(e==null)return ObC;if(typeof e=="function")return aSs(e);if(typeof e=="object")return Array.isArray(e)?bbC(e):gbC(e);if(typeof e=="string")return mbC(e);throw new Error("Expected function, string, or object as test")});function bbC(e){let t=[],r=-1;for(;++r<e.length;)t[r]=Eht(e[r]);return aSs(n);function n(...i){let a=-1;for(;++a<t.length;)if(t[a].apply(this,i))return!0;return!1}}function gbC(e){let t=e;return aSs(r);function r(n){let i=n,a;for(a in e)if(i[a]!==t[a])return!1;return!0}}function mbC(e){return aSs(t);function t(r){return r&&r.type===e}}function aSs(e){return t;function t(r,n,i){return!!(AbC(r)&&e.call(this,r,typeof n=="number"?n:void 0,i||void 0))}}function ObC(){return!0}function AbC(e){return e!==null&&typeof e=="object"&&"type"in e}function VDy(e){return"\x1B[33m"+e+"\x1B[39m"}var WDy=[],am=!0,fT=!1,Mnt="skip";function Hsa(e,t,r,n){let i;typeof t=="function"&&typeof r!="function"?(n=r,r=t):i=t;let a=Eht(i),o=n?-1:1;c(e,void 0,[])();function c(d,s,u){let l=d&&typeof d=="object"?d:{};if(typeof l.type=="string"){let A=typeof l.tagName=="string"?l.tagName:typeof l.name=="string"?l.name:void 0;Object.defineProperty(m,"name",{value:"node ("+VDy(d.type+(A?"<"+A+">":""))+")"})}return m;function m(){let A=WDy,P,C,M;if((!t||a(d,s,u[u.length-1]||void 0))&&(A=PbC(r(d,u)),A[0]===fT))return A;if("children"in d&&d.children){let T=d;if(T.children&&A[0]!==Mnt)for(C=(n?T.children.length:-1)+o,M=u.concat(T);C>-1&&C<T.children.length;){let z=T.children[C];if(P=c(z,C,M)(),P[0]===fT)return P;C=typeof P[1]=="number"?P[1]:C+o}}return A}}}function PbC(e){return Array.isArray(e)?e:typeof e=="number"?[am,e]:e==null?WDy:[e]}function qv(e,t,r,n){let i,a,o;typeof t=="function"&&typeof r!="function"?(a=void 0,o=t,i=r):(a=t,o=r,i=n),Hsa(e,a,c,i);function c(d,s){let u=s[s.length-1],l=u?u.children.indexOf(d):void 0;return o(d,l,u)}}var wbC=rl.array(rl.string());function oSs(e){rl.number().parse(e)}function gka(e){if(e===void 0||e==null)throw new Error("Value is nullable.")}function HDy(e){wbC.parse(e)}var C2i=require("fs/promises");async function GDy(e){let t="";return qv(e,"element",function(r){return r.tagName==="link"&&Array.isArray(r.properties.rel)&&r.properties.rel.includes("icon")?(t=r.properties.href,fT):am}),t}function Sht(e,t={delete:!0,nodeType:void 0,tagName:void 0}){let r="";return e?(qv(e,t.nodeType?t.nodeType:e,function(n){return t.tagName&&n.type==="element"&&n.tagName!==t.tagName?am:(qv(n,"text",function(i,a,o){r+=i.value,t.delete&&o&&typeof a=="number"&&o.children.splice(a,1)}),fT)}),t.escaped?r.trim().replace(/"/g,'\\"'):r.trim()):r}function JDy(e){let t;return qv(e,"heading",function(r,n,i){return t=r,i&&typeof n=="number"&&i.children.splice(n,1),fT}),Sht(t,{delete:!0,escaped:!0})}function KDy(e){let t;return qv(e,"paragraph",function(r,n,i){return typeof n!="number"||n!==0||!i||i.type!=="root"?fT:(t=r,typeof n=="number"&&i.children.splice(n,1),fT)}),Sht(t,{delete:!0,escaped:!0})}function $Dy(e){e.startsWith("http")&&(e=new URL(e).pathname);let r=(e.split("/").at(-1)??"").split("-").flatMap(n=>n.split("_"));return r.forEach((n,i)=>{r[i]=n[0]?`${n[0].toUpperCase()}${n.substring(1)}`:n}),r.join(" ")}async function YDy(e){let t="ENTER TITLE HERE",r;if(qv(e,"element",function(a){return a.tagName!=="title"?am:(qv(a,"text",function(o){return r=o.value,fT}),r?fT:am)}),!r)return t;let n=r,i="";return n.includes("|")?i=(n.split("|").at(-1)??"").trim():n.includes("\u2013")?i=(n.split("\u2013").at(-1)??"").trim():n.includes("-")?i=(n.split("-").at(-1)??"").trim():i=n.trim(),i||t}function mka(e,t){let r=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,i=r.indexOf(t);for(;i!==-1;)n++,i=r.indexOf(t,i+t.length);return n}var jee=C4i(/[A-Za-z]/),nZ=C4i(/[\dA-Za-z]/),XDy=C4i(/[#-'*+\--9=?A-Z^-~]/);function Gsa(e){return e!==null&&(e<32||e===127)}var fKo=C4i(/\d/),ZDy=C4i(/[\dA-Fa-f]/),kDy=C4i(/[!-/:-@[-`{-~]/);function Wb(e){return e!==null&&e<-2}function sI(e){return e!==null&&(e<0||e===32)}function lj(e){return e===-2||e===-1||e===32}var Jsa=C4i(/\p{P}|\p{S}/u),ose=C4i(/\s/);function C4i(e){return t;function t(r){return r!==null&&r>-1&&e.test(String.fromCharCode(r))}}function $0f(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function Y0f(e,t,r){let i=Eht((r||{}).ignore||[]),a=jbC(t),o=-1;for(;++o<a.length;)Hsa(e,"text",c);function c(s,u){let l=-1,m;for(;++l<u.length;){let A=u[l],P=m?m.children:void 0;if(i(A,P?P.indexOf(A):void 0,m))return;m=A}if(m)return d(s,u)}function d(s,u){let l=u[u.length-1],m=a[o][0],A=a[o][1],P=0,M=l.children.indexOf(s),T=!1,z=[];m.lastIndex=0;let U=m.exec(s.value);for(;U;){let R=U.index,V={index:U.index,input:U.input,stack:[...u,s]},$=A(...U,V);if(typeof $=="string"&&($=$.length>0?{type:"text",value:$}:void 0),$===!1?m.lastIndex=R+1:(P!==R&&z.push({type:"text",value:s.value.slice(P,R)}),Array.isArray($)?z.push(...$):$&&z.push($),P=R+U[0].length,T=!0),!m.global)break;U=m.exec(s.value)}return T?(P<s.value.length&&z.push({type:"text",value:s.value.slice(P)}),l.children.splice(M,1,...z)):z=[s],M+z.length}}function jbC(e){let t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");let r=!e[0]||Array.isArray(e[0])?e:[e],n=-1;for(;++n<r.length;){let i=r[n];t.push([EbC(i[0]),SbC(i[1])])}return t}function EbC(e){return typeof e=="string"?new RegExp($0f(e),"g"):e}function SbC(e){return typeof e=="function"?e:function(){return e}}var X0f="phrasing",Z0f=["autolink","link","image","label"];function emf(){return{transforms:[TbC],enter:{literalAutolink:DbC,literalAutolinkEmail:k0f,literalAutolinkHttp:k0f,literalAutolinkWww:k0f},exit:{literalAutolink:BbC,literalAutolinkEmail:MbC,literalAutolinkHttp:CbC,literalAutolinkWww:IbC}}}function tmf(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:X0f,notInConstruct:Z0f},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:X0f,notInConstruct:Z0f},{character:":",before:"[ps]",after:"\\/",inConstruct:X0f,notInConstruct:Z0f}]}}function DbC(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function k0f(e){this.config.enter.autolinkProtocol.call(this,e)}function CbC(e){this.config.exit.autolinkProtocol.call(this,e)}function IbC(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function MbC(e){this.config.exit.autolinkEmail.call(this,e)}function BbC(e){this.exit(e)}function TbC(e){Y0f(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,qbC],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,RbC]],{ignore:["link","linkReference"]})}function qbC(e,t,r,n,i){let a="";if(!eCy(i)||(/^w/i.test(t)&&(r=t+r,t="",a="http://"),!NbC(r)))return!1;let o=FbC(r+n);if(!o[0])return!1;let c={type:"link",title:null,url:a+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[c,{type:"text",value:o[1]}]:c}function RbC(e,t,r,n){return!eCy(n,!0)||/[-\d_]$/.test(r)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+r,children:[{type:"text",value:t+"@"+r}]}}function NbC(e){let t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function FbC(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let r=t[0],n=r.indexOf(")"),i=mka(e,"("),a=mka(e,")");for(;n!==-1&&i>a;)e+=r.slice(0,n+1),r=r.slice(n+1),n=r.indexOf(")"),a++;return[e,r]}function eCy(e,t){let r=e.input.charCodeAt(e.index-1);return(e.index===0||ose(r)||Jsa(r))&&(!t||r!==47)}function KPe(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}tCy.peek=GbC;function xbC(){this.buffer()}function zbC(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function QbC(){this.buffer()}function LbC(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function UbC(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=KPe(this.sliceSerialize(e)).toLowerCase(),r.label=t}function VbC(e){this.exit(e)}function WbC(e){let t=this.resume(),r=this.stack[this.stack.length-1];r.type,r.identifier=KPe(this.sliceSerialize(e)).toLowerCase(),r.label=t}function HbC(e){this.exit(e)}function GbC(){return"["}function tCy(e,t,r,n){let i=r.createTracker(n),a=i.move("[^"),o=r.enter("footnoteReference"),c=r.enter("reference");return a+=i.move(r.safe(r.associationId(e),{after:"]",before:a})),c(),o(),a+=i.move("]"),a}function rmf(){return{enter:{gfmFootnoteCallString:xbC,gfmFootnoteCall:zbC,gfmFootnoteDefinitionLabelString:QbC,gfmFootnoteDefinition:LbC},exit:{gfmFootnoteCallString:UbC,gfmFootnoteCall:VbC,gfmFootnoteDefinitionLabelString:WbC,gfmFootnoteDefinition:HbC}}}function nmf(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:r,footnoteReference:tCy},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function r(n,i,a,o){let c=a.createTracker(o),d=c.move("[^"),s=a.enter("footnoteDefinition"),u=a.enter("label");return d+=c.move(a.safe(a.associationId(n),{before:d,after:"]"})),u(),d+=c.move("]:"),n.children&&n.children.length>0&&(c.shift(4),d+=c.move((t?`
|
|
@@ -2402,7 +2402,7 @@ ${R}${z}${V}${Rro}`});function SRs({message:e,error:t,logger:r,logLevel:n=K1.Err
|
|
|
2402
2402
|
Run ${bd.cyan("fern generator upgrade")} to upgrade your generators.`),i.length>2&&(r+=`
|
|
2403
2403
|
Run ${bd.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),KZa(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function YMf({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:n=!0}){if(!QVy(e))return;let i=t??"",a=e.filter(c=>c.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let o=a.sort((c,d)=>c.generatorName.localeCompare(d.generatorName)||c.currentVersion.localeCompare(d.currentVersion));for(let c of o)i+=`
|
|
2404
2404
|
${await jQC(c.generatorName)} (${c.apiName!=null?"API: "+c.apiName+", ":""}Group: ${c.generatorGroup}) `+bd.dim(c.currentVersion)+bd.reset(" \u2192 ")+bd.green(c.latestVersion);return i+=`
|
|
2405
|
-
`,n?KZa(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function jQC(e){let r=await new zVy.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 EQC({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await UVy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,u,l)=>{c.versions[s]==null&&(c.versions[s]={});let m=nzi(u.name,l),A=await yLr({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:l});A!=null&&(c.versions[s][u.name]={previousVersion:u.version,latestVersion:A})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await UVy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,d,s,u)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][d]==null&&(o.versions[c][d]={});let l=nzi(s.name,u),m=await yLr({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:u});m!=null&&(o.versions[c][d][s.name]={previousVersion:s.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function UVy({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 BTr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let d of c.groups)if(!(i!=null&&d.groupName!==i))for(let s of d.generators)n!=null&&s.name!==n||await r(a.workspaceName,d.groupName,s,o)}})}))}function VVy(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 d=i3e(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:d,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function MRs({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await EQC({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[d,s]of Object.entries(c.versions))o.push(...VVy(s,d,t.logger));else o.push(...VVy(c.versions,void 0,t.logger))}return o}var EXo=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 zro=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var XMf=(()=>{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})(),WVy=typeof globalThis.AbortController=="function",HVy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",GVy=typeof globalThis.ReadableStream=="function",JVy=typeof globalThis.FormData=="function",BRs=["get","post","put","patch","head","delete"],SQC=()=>{};SQC();var KVy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},TRs=2147483647,$Vy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,qRs=Symbol("stop"),YVy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},XVy={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 DQC=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=$Vy,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},ZVy=(e,t,r)=>{let n,i=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),n){i+=n.byteLength;let c=t===0?0:i/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,i),transferredBytes:i},n)}n=a},flush(){n&&(i+=n.byteLength,r?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},n))}}))},kVy=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(ZVy(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},eWy=(e,t,r)=>{if(!e.body)return e;let n=DQC(r??e.body);return new Request(e,{duplex:"half",body:ZVy(e.body,n,t)})};var Qro=e=>e!==null&&typeof e=="object";var SXo=(...e)=>{for(let t of e)if((!Qro(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return eBf({},...e)},ZMf=(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 RRs(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:eBf(e[r]??[],t[r]??[])}var kMf=(e={},t={})=>({beforeRequest:RRs(e,t,"beforeRequest"),beforeRetry:RRs(e,t,"beforeRetry"),afterResponse:RRs(e,t,"afterResponse"),beforeError:RRs(e,t,"beforeError")}),eBf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(Qro(i)){for(let[a,o]of Object.entries(i))Qro(o)&&a in t&&(o=eBf(t[a],o)),t={...t,[a]:o};Qro(i.hooks)&&(n=kMf(n,i.hooks),t.hooks=n),Qro(i.headers)&&(r=ZMf(r,i.headers),t.headers=r)}return t};var rWy=e=>BRs.includes(e)?e.toUpperCase():e,CQC=["get","put","head","delete","options","trace"],IQC=[408,413,429,500,502,503,504],MQC=[413,429,503],tWy={limit:2,methods:CQC,statusCodes:IQC,afterStatusCodes:MQC,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},nWy=(e={})=>{if(typeof e=="number")return{...tWy,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{...tWy,...e}};async function tBf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new zro(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function rBf(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 iWy=(e,t)=>{let r={};for(let n in t)!(n in XVy)&&!(n in YVy)&&!(n in e)&&(r[n]=t[n]);return r},aWy=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 DXo=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>TRs)throw new RangeError(`The \`timeout\` option cannot be greater than ${TRs}`);await Promise.resolve();let c=await n._fetch();for(let d of n._options.hooks.afterResponse){let s=await d(n.request,n._options,n._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let d=new EXo(c,n.request,n._options);for(let s of n._options.hooks.beforeError)d=await s(d);throw d}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!GVy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return kVy(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{let c=n._originalRequest,d=[];c&&!c.bodyUsed&&d.push(c.body?.cancel()),n.request.bodyUsed||d.push(n.request.body?.cancel()),await Promise.all(d)});for(let[c,d]of Object.entries(KVy))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||d);let s=await o;if(c==="json"){if(s.status===204)return"";let u=await s.text();return u===""?"":r.parseJson?r.parseJson(u):JSON.parse(u)}return s[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;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:ZMf(this._input.headers,r.headers),hooks:kMf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:rWy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:nWy(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(WVy&&HVy){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(XMf&&(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),aWy(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);(JVy&&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(!XMf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=eWy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof zro)throw t;if(t instanceof EXo){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),TRs);if(this._retryCount<1)throw r;await rBf(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})===qRs)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=iWy(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):tBf(this._originalRequest,t,this.abortController,this._options)}};var nBf=e=>{let t=(r,n)=>DXo.create(r,SXo(e,n));for(let r of BRs)t[r]=(n,i)=>DXo.create(n,SXo(e,i,{method:r}));return t.create=r=>nBf(SXo(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),nBf(SXo(e,r))),t.stop=qRs,t},BQC=nBf(),oWy=BQC;var CWy=fa(DWy(),1);function sBf(e){let t=(0,CWy.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var PHy=fa(AHy(),1),wHy=fa(_5r(),1),OBf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},ABf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function PBf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??sBf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,PHy.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,c&&(d.authorization=`${c.type} ${c.token}`);let s;try{s=await oWy(o,{headers:d,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new OBf(e):l}if(t.allVersions)return s;let u=new ABf(e,r);if(s["dist-tags"][r]){let{time:l}=s;s=s.versions[s["dist-tags"][r]],s.time=l}else if(r){let l=!!s.versions[r];if(n&&!l)for(let[A,P]of Object.entries(s.versions))P.deprecated&&delete s.versions[A];if(!l){let A=Object.keys(s.versions);if(r=wHy.default.maxSatisfying(A,r),!r)throw u}let{time:m}=s;if(s=s.versions[r],s.time=m,!s)throw u}return s}async function qXo(e,t){let{version:r}=await PBf(e.toLowerCase(),t);return r}async function L2i({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:qXo(e.packageName,{version:t?"prerelease":"latest"})}var jHy=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],JRs=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=K1.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new IRs(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.86.1"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${bd.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new zue}failWithoutThrowing(t,r){this.didSucceed=!1,SRs({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await xZa()).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 LVy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
2405
|
+
`,n?KZa(i,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):i}async function jQC(e){let r=await new zVy.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 EQC({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await UVy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,u,l)=>{c.versions[s]==null&&(c.versions[s]={});let m=nzi(u.name,l),A=await yLr({generatorName:m,cliVersion:e.environment.packageVersion,currentGeneratorVersion:u.version,channel:i,includeMajor:a,context:l});A!=null&&(c.versions[s][u.name]={previousVersion:u.version,latestVersion:A})},generatorFilter:r,groupFilter:n}),c}let o={type:"multiApi",versions:{}};return await UVy({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,d,s,u)=>{if(c==null)return;o.versions[c]==null&&(o.versions[c]={}),o.versions[c][d]==null&&(o.versions[c][d]={});let l=nzi(s.name,u),m=await yLr({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:i,includeMajor:a,context:u});m!=null&&(o.versions[c][d][s.name]={previousVersion:s.version,latestVersion:m})},generatorFilter:r,groupFilter:n}),o}async function UVy({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 BTr({absolutePathToWorkspace:a.absoluteFilePath,context:o});if(!(c==null||c.groups==null)){for(let d of c.groups)if(!(i!=null&&d.groupName!==i))for(let s of d.generators)n!=null&&s.name!==n||await r(a.workspaceName,d.groupName,s,o)}})}))}function VVy(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 d=i3e(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),n.push({generatorName:o,generatorGroup:i,apiName:t,isUpgradeAvailable:d,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return n}async function MRs({project:e,cliContext:t,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a}){let o=[];if(e!=null){let c=await EQC({cliContext:t,project:e,generatorFilter:r,groupFilter:n,channel:i,includeMajor:a});if(c.type==="multiApi")for(let[d,s]of Object.entries(c.versions))o.push(...VVy(s,d,t.logger));else o.push(...VVy(c.versions,void 0,t.logger))}return o}var EXo=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 zro=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var XMf=(()=>{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})(),WVy=typeof globalThis.AbortController=="function",HVy=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",GVy=typeof globalThis.ReadableStream=="function",JVy=typeof globalThis.FormData=="function",BRs=["get","post","put","patch","head","delete"],SQC=()=>{};SQC();var KVy={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},TRs=2147483647,$Vy=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,qRs=Symbol("stop"),YVy={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},XVy={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 DQC=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,n]of e)t+=$Vy,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},ZVy=(e,t,r)=>{let n,i=0;return e.pipeThrough(new TransformStream({transform(a,o){if(o.enqueue(a),n){i+=n.byteLength;let c=t===0?0:i/t;c>=1&&(c=1-Number.EPSILON),r?.({percent:c,totalBytes:Math.max(t,i),transferredBytes:i},n)}n=a},flush(){n&&(i+=n.byteLength,r?.({percent:1,totalBytes:Math.max(t,i),transferredBytes:i},n))}}))},kVy=(e,t)=>{if(!e.body)return e;if(e.status===204)return new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers});let r=Number(e.headers.get("content-length"))||0;return new Response(ZVy(e.body,r,t),{status:e.status,statusText:e.statusText,headers:e.headers})},eWy=(e,t,r)=>{if(!e.body)return e;let n=DQC(r??e.body);return new Request(e,{duplex:"half",body:ZVy(e.body,n,t)})};var Qro=e=>e!==null&&typeof e=="object";var SXo=(...e)=>{for(let t of e)if((!Qro(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return eBf({},...e)},ZMf=(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 RRs(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:eBf(e[r]??[],t[r]??[])}var kMf=(e={},t={})=>({beforeRequest:RRs(e,t,"beforeRequest"),beforeRetry:RRs(e,t,"beforeRetry"),afterResponse:RRs(e,t,"afterResponse"),beforeError:RRs(e,t,"beforeError")}),eBf=(...e)=>{let t={},r={},n={};for(let i of e)if(Array.isArray(i))Array.isArray(t)||(t=[]),t=[...t,...i];else if(Qro(i)){for(let[a,o]of Object.entries(i))Qro(o)&&a in t&&(o=eBf(t[a],o)),t={...t,[a]:o};Qro(i.hooks)&&(n=kMf(n,i.hooks),t.hooks=n),Qro(i.headers)&&(r=ZMf(r,i.headers),t.headers=r)}return t};var rWy=e=>BRs.includes(e)?e.toUpperCase():e,CQC=["get","put","head","delete","options","trace"],IQC=[408,413,429,500,502,503,504],MQC=[413,429,503],tWy={limit:2,methods:CQC,statusCodes:IQC,afterStatusCodes:MQC,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},nWy=(e={})=>{if(typeof e=="number")return{...tWy,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{...tWy,...e}};async function tBf(e,t,r,n){return new Promise((i,a)=>{let o=setTimeout(()=>{r&&r.abort(),a(new zro(e))},n.timeout);n.fetch(e,t).then(i).catch(a).then(()=>{clearTimeout(o)})})}async function rBf(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 iWy=(e,t)=>{let r={};for(let n in t)!(n in XVy)&&!(n in YVy)&&!(n in e)&&(r[n]=t[n]);return r},aWy=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 DXo=class e{static create(t,r){let n=new e(t,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>TRs)throw new RangeError(`The \`timeout\` option cannot be greater than ${TRs}`);await Promise.resolve();let c=await n._fetch();for(let d of n._options.hooks.afterResponse){let s=await d(n.request,n._options,n._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(n._decorateResponse(c),!c.ok&&n._options.throwHttpErrors){let d=new EXo(c,n.request,n._options);for(let s of n._options.hooks.beforeError)d=await s(d);throw d}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!GVy)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return kVy(c.clone(),n._options.onDownloadProgress)}return c},o=(n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i()).finally(async()=>{let c=n._originalRequest,d=[];c&&!c.bodyUsed&&d.push(c.body?.cancel()),n.request.bodyUsed||d.push(n.request.body?.cancel()),await Promise.all(d)});for(let[c,d]of Object.entries(KVy))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(o[c]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||d);let s=await o;if(c==="json"){if(s.status===204)return"";let u=await s.text();return u===""?"":r.parseJson?r.parseJson(u):JSON.parse(u)}return s[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;_originalRequest;constructor(t,r={}){if(this._input=t,this._options={...r,headers:ZMf(this._input.headers,r.headers),hooks:kMf({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:rWy(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:nWy(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(WVy&&HVy){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(XMf&&(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),aWy(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);(JVy&&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(!XMf)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=eWy(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof zro)throw t;if(t instanceof EXo){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),TRs);if(this._retryCount<1)throw r;await rBf(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})===qRs)return;return this._retry(t)}}async _fetch(){for(let r of this._options.hooks.beforeRequest){let n=await r(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=iWy(this.request,this._options);return this._originalRequest=this.request,this.request=this._originalRequest.clone(),this._options.timeout===!1?this._options.fetch(this._originalRequest,t):tBf(this._originalRequest,t,this.abortController,this._options)}};var nBf=e=>{let t=(r,n)=>DXo.create(r,SXo(e,n));for(let r of BRs)t[r]=(n,i)=>DXo.create(n,SXo(e,i,{method:r}));return t.create=r=>nBf(SXo(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),nBf(SXo(e,r))),t.stop=qRs,t},BQC=nBf(),oWy=BQC;var CWy=fa(DWy(),1);function sBf(e){let t=(0,CWy.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var PHy=fa(AHy(),1),wHy=fa(_5r(),1),OBf=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},ABf=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function PBf(e,t={}){let{version:r="latest"}=t,{omitDeprecated:n=!0}=t,i=e.split("/")[0],a=t.registryUrl??sBf(i),o=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,PHy.default)(a.toString(),{recursive:!0}),d={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};t.fullMetadata&&delete d.accept,c&&(d.authorization=`${c.type} ${c.token}`);let s;try{s=await oWy(o,{headers:d,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new OBf(e):l}if(t.allVersions)return s;let u=new ABf(e,r);if(s["dist-tags"][r]){let{time:l}=s;s=s.versions[s["dist-tags"][r]],s.time=l}else if(r){let l=!!s.versions[r];if(n&&!l)for(let[A,P]of Object.entries(s.versions))P.deprecated&&delete s.versions[A];if(!l){let A=Object.keys(s.versions);if(r=wHy.default.maxSatisfying(A,r),!r)throw u}let{time:m}=s;if(s=s.versions[r],s.time=m,!s)throw u}return s}async function qXo(e,t){let{version:r}=await PBf(e.toLowerCase(),t);return r}async function L2i({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:qXo(e.packageName,{version:t?"prerelease":"latest"})}var jHy=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],JRs=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=K1.Info;isLocal;constructor(t,r,{isLocal:n}){this.ttyAwareLogger=new IRs(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.86.2"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${bd.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new zue}failWithoutThrowing(t,r){this.didSucceed=!1,SRs({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await xZa()).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 LVy({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
|
|
2406
2406
|
`)||(r+=`
|
|
2407
2407
|
`),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=i$l(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 mXo(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 zue}finally{n.finish()}return i}async instrumentPostHogEvent(t){this.isLocal||(await xZa()).sendEvent(t)}logger=M5r((t,...r)=>this.log(t,...r));stderr=M5r((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=EHy(t.type==="docs"?"docs":t.workspaceName??"api"),n=1+(this.longestWorkspaceName!=null?EHy(this.longestWorkspaceName):r).length,i=r.padEnd(n),a=jHy[this.numTasks++%jHy.length],o=bd.hex(a)(i);return{...this.constructTaskInit(),logPrefix:o}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===vV.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=>v3i.indexOf(i.level)>=v3i.indexOf(this.logLevel));this.ttyAwareLogger.log(n,{includeDebugInfo:this.logLevel===K1.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 L2i({cliEnvironment:this.environment,includePreReleases:t}),n=i3e(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(n?"Upgrade available.":"No upgrade available."));let i={isUpgradeAvailable:n,latestVersion:r},a=await MRs({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:i,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await RMf({message:t,default:r})}async getInput(t){return await NMf({message:t.message,default:t.default})}};function EHy(e){return`[${e}]:`}var jqr=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 knt=class extends jqr{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 Eqr={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!1,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,wrapReferencesToNullableInOptional:!0,coerceOptionalSchemasToNullable:!0};function RXo({options:e,overrides:t}){return{enableUniqueErrorsPerEndpoint:t?.enableUniqueErrorsPerEndpoint??e?.enableUniqueErrorsPerEndpoint??Eqr.enableUniqueErrorsPerEndpoint,detectGlobalHeaders:t?.detectGlobalHeaders??e?.detectGlobalHeaders??Eqr.detectGlobalHeaders,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??Eqr.objectQueryParameters,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??Eqr.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??Eqr.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??Eqr.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??Eqr.inlinePathParameters,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??Eqr.useBytesForBinaryResponse,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??Eqr.respectForwardCompatibleEnums,wrapReferencesToNullableInOptional:t?.wrapReferencesToNullableInOptional??e?.wrapReferencesToNullableInOptional??Eqr.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:t?.coerceOptionalSchemasToNullable??e?.coerceOptionalSchemasToNullable??Eqr.coerceOptionalSchemasToNullable}}var bwe={openapi:e=>({...e,type:"openapi",_visit:function(t){return bwe._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return bwe._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 Jro={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return Jro._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var Hde={basic:e=>({...e,type:"basic",_visit:function(t){return Hde._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return Hde._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return Hde._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return Hde._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return Hde._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 AS={primitive:e=>({value:e,type:"primitive",_visit:function(t){return AS._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return AS._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return AS._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return AS._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return AS._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return AS._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return AS._visit(this,t)}}),null:e=>({...e,type:"null",_visit:function(t){return AS._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return AS._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"null":return t.null(e);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var wO={int:e=>({value:e,type:"int",_visit:function(t){return wO._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return wO._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return wO._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return wO._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return wO._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return wO._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return wO._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return wO._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return wO._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return wO._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return wO._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 U2i={boolean:e=>({value:e,type:"boolean",_visit:function(t){return U2i._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return U2i._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 V2i={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return V2i._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return V2i._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 KRs={};lf(KRs,{Availability:()=>Gde,CustomCodeSample:()=>hVr,EndpointExample:()=>_yt,EndpointResponseExample:()=>hyt,HttpMethod:()=>Kde,LiteralSchemaValue:()=>NV,MultipartRequestPropertyEncoding:()=>EBf,MultipartSchema:()=>yVr,OneOfSchema:()=>vVr,Pagination:()=>eit,PrimitiveSchemaValue:()=>Oq,Request:()=>Sqr,Response:()=>Wbe,RetriesConfiguration:()=>NXo,Schema:()=>kj,SupportedSdkLanguage:()=>Jde,WebhookHttpMethod:()=>jBf,WebsocketMessageOrigin:()=>wBf});var wBf={Client:"client",Server:"server",_visit:(e,t)=>{switch(e){case wBf.Client:return t.client();case wBf.Server:return t.server();default:return t._other()}}};var jBf={Get:"GET",Post:"POST",_visit:(e,t)=>{switch(e){case jBf.Get:return t.get();case jBf.Post:return t.post();default:return t._other()}}};var Gde={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case Gde.GenerallyAvailable:return t.generallyAvailable();case Gde.Beta:return t.beta();case Gde.Deprecated:return t.deprecated();default:return t._other()}}};var NXo={disabled:e=>({value:e,type:"disabled",_visit:function(t){return NXo._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"disabled":return t.disabled(e.value);default:return t._other(e)}}};var eit={cursor:e=>({...e,type:"cursor",_visit:function(t){return eit._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return eit._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return eit._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 hVr={language:e=>({...e,type:"language",_visit:function(t){return hVr._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return hVr._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 Jde={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 Jde.Curl:return t.curl();case Jde.Python:return t.python();case Jde.Javascript:return t.javascript();case Jde.Typescript:return t.typescript();case Jde.Go:return t.go();case Jde.Ruby:return t.ruby();case Jde.Csharp:return t.csharp();case Jde.Java:return t.java();case Jde.Js:return t.js();case Jde.Node:return t.node();case Jde.Ts:return t.ts();case Jde.Nodets:return t.nodets();case Jde.Golang:return t.golang();case Jde.Dotnet:return t.dotnet();case Jde.Jvm:return t.jvm();default:return t._other()}}};var _yt={unknown:e=>({value:e,type:"unknown",_visit:function(t){return _yt._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return _yt._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 hyt={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return hyt._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return hyt._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 Kde={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case Kde.Get:return t.get();case Kde.Post:return t.post();case Kde.Put:return t.put();case Kde.Patch:return t.patch();case Kde.Delete:return t.delete();case Kde.Head:return t.head();case Kde.Options:return t.options();case Kde.Trace:return t.trace();default:return t._other()}}};var Sqr={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return Sqr._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return Sqr._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Sqr._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return Sqr._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 EBf={Json:"json",Form:"form",_visit:(e,t)=>{switch(e){case EBf.Json:return t.json();case EBf.Form:return t.form();default:return t._other()}}};var yVr={file:e=>({...e,type:"file",_visit:function(t){return yVr._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return yVr._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 Wbe={file:e=>({...e,type:"file",_visit:function(t){return Wbe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Wbe._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return Wbe._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return Wbe._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return Wbe._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return Wbe._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return Wbe._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 kj={primitive:e=>({...e,type:"primitive",_visit:function(t){return kj._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return kj._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return kj._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return kj._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return kj._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return kj._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return kj._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return kj._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return kj._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return kj._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return kj._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 Oq={int:e=>({...e,type:"int",_visit:function(t){return Oq._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return Oq._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return Oq._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return Oq._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return Oq._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return Oq._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return Oq._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return Oq._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return Oq._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return Oq._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return Oq._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 NV={boolean:e=>({value:e,type:"boolean",_visit:function(t){return NV._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return NV._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 vVr={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return vVr._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return vVr._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 lIe={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return lIe._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return lIe._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return lIe._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return lIe._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 XL={file:e=>({...e,type:"file",_visit:function(t){return XL._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return XL._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return XL._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return XL._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return XL._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return XL._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return XL._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 Oh={primitive:e=>({...e,type:"primitive",_visit:function(t){return Oh._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Oh._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Oh._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Oh._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Oh._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Oh._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Oh._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Oh._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Oh._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Oh._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Oh._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 tit={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return tit._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return tit._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 L0={int:e=>({...e,type:"int",_visit:function(t){return L0._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return L0._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return L0._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return L0._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return L0._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return L0._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return L0._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return L0._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return L0._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return L0._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return L0._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 Mj={};lf(Mj,{AllOfPropertyConflict:()=>gno,ArraySchema:()=>fFs,ArraySchemaWithExample:()=>UFs,Availability:()=>iNs,Base64WithExample:()=>FFs,BasicSecurityScheme:()=>oNs,BearerSecurityScheme:()=>uNs,BooleanSchema:()=>aFs,BooleanWithExample:()=>xFs,BytesResponse:()=>cno,CasingOverrides:()=>lNs,CommonProperty:()=>gFs,CommonPropertyWithExample:()=>XFs,CursorPagination:()=>UNs,CustomCodeSample:()=>QNs,CustomCodeSampleLanguage:()=>FNs,CustomCodeSampleSdk:()=>zNs,CustomPagination:()=>WNs,DateWithExample:()=>NFs,DatetimeWithExample:()=>RFs,DiscriminatedOneOfSchema:()=>vFs,DiscriminatedOneOfSchemaWithExample:()=>$Fs,DoubleSchema:()=>nFs,DoubleWithExample:()=>TFs,Encoding:()=>nNs,Endpoint:()=>HNs,EndpointExample:()=>pno,EndpointResponseExample:()=>NNs,EndpointSdkName:()=>mVr,EndpointSecurity:()=>tno,EndpointWithExample:()=>rGy,EnumSchema:()=>Zro,EnumSchemaWithExample:()=>QFs,EnumValue:()=>G2i,ErrorExample:()=>MNs,FernExample:()=>TNs,FileResponse:()=>uno,FileSchema:()=>PNs,FloatWithExample:()=>BFs,FormUrlEncodedRequest:()=>DNs,FullEndpointExample:()=>LNs,FullExample:()=>b5,FullObjectExample:()=>bNs,FullOneOfExample:()=>mNs,GlobalHeader:()=>uFs,Header:()=>K2i,HeaderExample:()=>dno,HeaderSecurityScheme:()=>sNs,HeaderWithExample:()=>X2i,HttpEndpointServer:()=>lno,HttpError:()=>BNs,HttpErrorWithExample:()=>SFs,HttpMethod:()=>rno,IdempotencyHeader:()=>sFs,Int64WithExample:()=>CFs,IntSchema:()=>tFs,IntWithExample:()=>DFs,JsonRequest:()=>SNs,JsonRequestWithExample:()=>PFs,JsonResponse:()=>sno,JsonResponseWithExample:()=>Ano,KeyValuePair:()=>gNs,LiteralExample:()=>yNs,LiteralSchema:()=>bno,LiteralSchemaValue:()=>cFs,LongSchema:()=>rFs,MapSchema:()=>dFs,MapSchemaWithExample:()=>VFs,MultipartRequest:()=>ono,MultipartRequestProperty:()=>ENs,MultipartRequestPropertyEncoding:()=>jNs,MultipartSchema:()=>wNs,NamedFullExample:()=>vyt,Namespace:()=>fNs,NamespaceId:()=>hNs,NullExample:()=>vNs,NullableSchema:()=>_Fs,NullableSchemaWithExample:()=>HFs,OauthSecurityScheme:()=>pNs,ObjectProperty:()=>yFs,ObjectPropertyConflictInfo:()=>mno,ObjectPropertyWithExample:()=>KFs,ObjectSchema:()=>lFs,ObjectSchemaWithExample:()=>GFs,OctetStreamRequest:()=>ano,OffsetPagination:()=>VNs,OneOfSchema:()=>hFs,OneOfSchemaWithExample:()=>JFs,OpenApiIntermediateRepresentation:()=>eGy,OpenApiSource:()=>kRs,OptionalSchema:()=>pFs,OptionalSchemaWithExample:()=>WFs,Pagination:()=>_no,ParseFormUrlEncodedRequest:()=>wFs,ParseMultipartRequest:()=>AFs,ParseOctetStreamRequest:()=>OFs,PathParameter:()=>nno,PathParameterExample:()=>qNs,PathParameterWithExample:()=>mFs,PrimitiveExample:()=>eno,PrimitiveSchema:()=>Y2i,PrimitiveSchemaValue:()=>oFs,PrimitiveSchemaValueWithExample:()=>zFs,PrimitiveSchemaWithExample:()=>Pno,PropertyKey:()=>kro,ProtobufEncoding:()=>rNs,ProtobufSource:()=>eNs,QueryParameter:()=>ino,QueryParameterExample:()=>fno,QueryParameterWithExample:()=>Ono,QuerySecurityScheme:()=>cNs,ReferencedSchema:()=>OVr,Request:()=>CNs,RequestWithExample:()=>jFs,Response:()=>INs,ResponseWithExample:()=>EFs,RetriesConfiguration:()=>hno,Schema:()=>EI,SchemaId:()=>fIe,SchemaWithExample:()=>J6,Schemas:()=>eFs,SdkGroup:()=>dNs,SdkGroupInfo:()=>ONs,SdkGroupName:()=>J2i,SecurityScheme:()=>_Ns,SecuritySchemeId:()=>Xro,Server:()=>QXo,Source:()=>tNs,StatusCode:()=>bVr,StreamingResponseExample:()=>RNs,StringSchema:()=>iFs,StringSchemaWithExample:()=>qFs,SupportedSdkLanguage:()=>xNs,Tag:()=>aNs,TagId:()=>dIe,Tags:()=>ANs,TextResponse:()=>$2i,Uint64WithExample:()=>MFs,UintWithExample:()=>IFs,UnDiscriminatedOneOfSchema:()=>bFs,UnDiscriminatedOneOfSchemaWithExample:()=>YFs,UnknownSchemaWithExample:()=>LFs,Webhook:()=>GNs,WebhookExampleCall:()=>vno,WebhookHttpMethod:()=>yno,WebhookWithExample:()=>nGy,WebsocketChannel:()=>kNs,WebsocketHandshake:()=>JNs,WebsocketHandshakeWithExample:()=>tGy,WebsocketMessageExample:()=>XNs,WebsocketMessageOrigin:()=>KNs,WebsocketMessageSchema:()=>$Ns,WebsocketServer:()=>YNs,WebsocketSessionExample:()=>ZNs,WithAvailability:()=>RP,WithDescription:()=>tv,WithEncoding:()=>o3e,WithInline:()=>G6,WithName:()=>fD,WithNamespace:()=>PS,WithSdkGroupName:()=>PM,WithSdkMethodName:()=>gVr,WithSource:()=>eP,WithStatusCode:()=>yyt,WithTitle:()=>AM,commons:()=>MBf,example:()=>BBf,finalIr:()=>TBf,parseIr:()=>qBf});var MBf={};lf(MBf,{BasicSecurityScheme:()=>oNs,BearerSecurityScheme:()=>uNs,Encoding:()=>nNs,HeaderSecurityScheme:()=>sNs,Namespace:()=>fNs,NamespaceId:()=>hNs,OauthSecurityScheme:()=>pNs,OpenApiSource:()=>kRs,ProtobufEncoding:()=>rNs,ProtobufSource:()=>eNs,QuerySecurityScheme:()=>cNs,SchemaId:()=>fIe,SdkGroup:()=>dNs,SdkGroupName:()=>J2i,SecurityScheme:()=>_Ns,SecuritySchemeId:()=>Xro,Server:()=>QXo,Source:()=>tNs,StatusCode:()=>bVr,Tag:()=>aNs,TagId:()=>dIe,WithAvailability:()=>RP,WithDescription:()=>tv,WithEncoding:()=>o3e,WithInline:()=>G6,WithName:()=>fD,WithNamespace:()=>PS,WithSdkGroupName:()=>PM,WithSdkMethodName:()=>gVr,WithSource:()=>eP,WithStatusCode:()=>yyt,WithTitle:()=>AM});var Gr={};lf(Gr,{JsonError:()=>Kro,ParseError:()=>$ro,any:()=>LHy,bigint:()=>DHy,boolean:()=>UHy,booleanLiteral:()=>QHy,date:()=>CHy,discriminant:()=>XHy,enum_:()=>YRs,getObjectLikeUtils:()=>Dqr,getObjectUtils:()=>Vla,getSchemaUtils:()=>v5,isProperty:()=>H2i,lazy:()=>IHy,lazyObject:()=>FHy,list:()=>ZRs,number:()=>VHy,object:()=>XRs,objectWithoutOptionalProperties:()=>NHy,optional:()=>SBf,property:()=>BHy,record:()=>JHy,set:()=>KHy,string:()=>WHy,stringLiteral:()=>zHy,transform:()=>DBf,undiscriminatedUnion:()=>YHy,union:()=>kHy,unknown:()=>HHy,withParsedProperties:()=>IBf});var Aq={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 K2(e,t){return`Expected ${t}. Received ${xLC(e)}.`}function xLC(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 $de(e){return{...e,json:SHy(e.json),parse:SHy(e.parse)}}function SHy(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(`
|
|
2408
2408
|
`)),{ok:!0,value:t}):n}}function $Rs(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var Kro=class e extends Error{errors;constructor(t){super(t.map($Rs).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var $ro=class e extends Error{errors;constructor(t){super(t.map($Rs).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function v5(e){return{optional:()=>SBf(e),transform:t=>DBf(e,t),parseOrThrow:(t,r)=>{let n=e.parse(t,r);if(n.ok)return n.value;throw new $ro(n.errors)},jsonOrThrow:(t,r)=>{let n=e.json(t,r);if(n.ok)return n.value;throw new Kro(n.errors)}}}function SBf(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:()=>Aq.OPTIONAL};return{...t,...v5(t)}}function DBf(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,...v5(r)}}function DHy(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:K2(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:K2(t,"bigint")}]},getType:()=>Aq.BIGINT};return{...$de(e),...v5(e)}}var zLC=/^([+-]?\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 CHy(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:K2(t,"string")}]}:zLC.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:K2(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:K2(t,"Date object")}]},getType:()=>Aq.DATE};return{...$de(e),...v5(e)}}function gwe(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...$de(r),...v5(r)}}}function YRs(e){let t=new Set(e);return gwe(Aq.ENUM,(n,{allowUnrecognizedEnumValues:i,breadcrumbsPrefix:a=[]}={})=>typeof n!="string"?{ok:!1,errors:[{path:a,message:K2(n,"string")}]}:!t.has(n)&&!i?{ok:!1,errors:[{path:a,message:K2(n,"enum")}]}:{ok:!0,value:n})()}function IHy(e){let t=CBf(e);return{...t,...v5(t)}}function CBf(e){return{parse:(t,r)=>Yro(e).parse(t,r),json:(t,r)=>Yro(e).json(t,r),getType:()=>Yro(e).getType()}}function Yro(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function FXo(e){return Object.entries(e)}function xXo(e,t){let r=new Set(t);return Object.entries(e).reduce((n,[i,a])=>(r.has(i)&&(n[i]=a),n),{})}function W2i(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 zXo(e){return Object.keys(e)}function MHy(e,t){let r=[],n=[];for(let i of e)t(i)?r.push(i):n.push(i);return[r,n]}function Dqr(e){return{withParsedProperties:t=>IBf(e,t)}}function IBf(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,[d,s])=>({...c,[d]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...o}}},json:(n,i)=>{if(!W2i(n))return{ok:!1,errors:[{path:i?.breadcrumbsPrefix??[],message:K2(n,"object")}]};let a=new Set(Object.keys(t)),o=xXo(n,Object.keys(n).filter(c=>!a.has(c)));return e.json(o,i)},getType:()=>e.getType()};return{...r,...v5(r),...Dqr(r)}}function BHy(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function H2i(e){return e.isProperty}function XRs(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,n])=>H2i(n)?n.rawKey:r),_getParsedProperties:()=>zXo(e),parse:(r,n)=>{let i={},a=[];for(let[o,c]of FXo(e)){let d=H2i(c)?c.rawKey:o,s=H2i(c)?c.valueSchema:c,u={rawKey:d,parsedKey:o,valueSchema:s};i[d]=u,RHy(s)&&a.push(d)}return THy({value:r,requiredKeys:a,getProperty:o=>{let c=i[o];if(c!=null)return{transformedKey:c.parsedKey,transform:d=>c.valueSchema.parse(d,{...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 FXo(e)){let c=H2i(o)?o.valueSchema:o;RHy(c)&&i.push(a)}return THy({value:r,requiredKeys:i,getProperty:a=>{let o=e[a];if(o!=null)return H2i(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:()=>Aq.OBJECT};return{...$de(t),...v5(t),...Dqr(t),...Vla(t)}}function THy({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:n="fail",skipValidation:i=!1,breadcrumbsPrefix:a=[]}){if(!W2i(e))return{ok:!1,errors:[{path:a,message:K2(e,"object")}]};let o=new Set(t),c=[],d={};for(let[s,u]of Object.entries(e)){let l=r(s);if(l!=null){o.delete(s);let m=l.transform(u);m.ok?d[l.transformedKey]=m.value:(d[s]=u,c.push(...m.errors))}else switch(n){case"fail":c.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":d[s]=u;break}}return c.push(...t.filter(s=>o.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),c.length===0||i?{ok:!0,value:d}:{ok:!1,errors:c}}function Vla(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(n,i)=>qHy({extensionKeys:t._getRawProperties(),value:n,transformBase:a=>e.parse(a,i),transformExtension:a=>t.parse(a,i)}),json:(n,i)=>qHy({extensionKeys:t._getParsedProperties(),value:n,transformBase:a=>e.json(a,i),transformExtension:a=>t.json(a,i)}),getType:()=>Aq.OBJECT};return{...r,...v5(r),...Dqr(r),...Vla(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:()=>Aq.OBJECT};return{...t,...v5(t),...Dqr(t),...Vla(t)}}}}function qHy({extensionKeys:e,value:t,transformBase:r,transformExtension:n}){let i=new Set(e),[a,o]=MHy(zXo(t),s=>i.has(s)),c=r(xXo(t,o)),d=n(xXo(t,a));return c.ok&&d.ok?{ok:!0,value:{...c.value,...d.value}}:{ok:!1,errors:[...c.ok?[]:c.errors,...d.ok?[]:d.errors]}}function RHy(e){return!QLC(e)}function QLC(e){switch(e.getType()){case Aq.ANY:case Aq.UNKNOWN:case Aq.OPTIONAL:return!0;default:return!1}}function NHy(e){return XRs(e)}function FHy(e){let t={...CBf(e),_getRawProperties:()=>Yro(e)._getRawProperties(),_getParsedProperties:()=>Yro(e)._getParsedProperties()};return{...t,...v5(t),...Dqr(t),...Vla(t)}}function ZRs(e){let t={parse:(r,n)=>xHy(r,(i,a)=>e.parse(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,n)=>xHy(r,(i,a)=>e.json(i,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>Aq.LIST};return{...$de(t),...v5(t)}}function xHy(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:K2(e,"list"),path:[]}]}}function zHy(e){return gwe(Aq.STRING_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:K2(r,`"${e}"`)}]})()}function QHy(e){return gwe(Aq.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:n=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:K2(r,`${e.toString()}`)}]})()}var LHy=gwe(Aq.ANY,e=>({ok:!0,value:e}));var UHy=gwe(Aq.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:K2(e,"boolean")}]});var VHy=gwe(Aq.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:K2(e,"number")}]});var WHy=gwe(Aq.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:K2(e,"string")}]});var HHy=gwe(Aq.UNKNOWN,e=>({ok:!0,value:e}));function JHy(e,t){let r={parse:(n,i)=>GHy({value:n,isKeyNumeric:e.getType()===Aq.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)=>GHy({value:n,isKeyNumeric:e.getType()===Aq.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:()=>Aq.RECORD};return{...$de(r),...v5(r)}}function GHy({value:e,isKeyNumeric:t,transformKey:r,transformValue:n,breadcrumbsPrefix:i=[]}){return W2i(e)?FXo(e).reduce((a,[o,c])=>{if(c==null)return a;let d=a,s=o;if(t){let A=o.length>0?Number(o):NaN;isNaN(A)||(s=A)}let u=r(s),l=n(c,s);if(d.ok&&u.ok&&l.ok)return{ok:!0,value:{...d.value,[u.value]:l.value}};let m=[];return d.ok||m.push(...d.errors),u.ok||m.push(...u.errors),l.ok||m.push(...l.errors),{ok:!1,errors:m}},{ok:!0,value:{}}):{ok:!1,errors:[{path:i,message:K2(e,"object")}]}}function KHy(e){let t=ZRs(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:K2(n,"Set")}]},getType:()=>Aq.SET};return{...$de(r),...v5(r)}}function YHy(e){let t={parse:(r,n)=>$Hy((i,a)=>i.parse(r,a),e,n),json:(r,n)=>$Hy((i,a)=>i.json(r,a),e,n),getType:()=>Aq.UNDISCRIMINATED_UNION};return{...$de(t),...v5(t)}}function $Hy(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 XHy(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function kHy(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,i=YRs(zXo(t)),a={parse:(o,c)=>ZHy({value:o,discriminant:r,transformedDiscriminant:n,transformDiscriminantValue:d=>i.parse(d,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.parse(d,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),json:(o,c)=>ZHy({value:o,discriminant:n,transformedDiscriminant:r,transformDiscriminantValue:d=>i.json(d,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],n]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.json(d,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>Aq.UNION};return{...$de(a),...v5(a),...Dqr(a)}}function ZHy({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:n,getAdditionalPropertiesSchema:i,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:o,breadcrumbsPrefix:c=[]}){if(!W2i(e))return{ok:!1,errors:[{path:c,message:K2(e,"object")}]};let{[t]:d,...s}=e;if(d==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let u=n(d);if(!u.ok)return{ok:!1,errors:u.errors};let l=i(u.value);if(l==null)return a?{ok:!0,value:{[r]:u.value,...s}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let m=o(s,l);return m.ok?{ok:!0,value:{[r]:d,...m.value}}:m}var AM=Gr.objectWithoutOptionalProperties({title:Gr.string().optional()});var kRs=Gr.objectWithoutOptionalProperties({file:Gr.string()});var eNs=Gr.objectWithoutOptionalProperties({file:Gr.string()});var tNs=Gr.union("type",{openapi:kRs,protobuf:eNs}).transform({transform:e=>{switch(e.type){case"openapi":return bwe.openapi(e);case"protobuf":return bwe.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var eP=Gr.objectWithoutOptionalProperties({source:tNs.optional()});var rNs=Gr.objectWithoutOptionalProperties({typeName:Gr.string()});var nNs=Gr.union("type",{protobuf:rNs}).transform({transform:e=>{switch(e.type){case"protobuf":return Jro.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var o3e=Gr.objectWithoutOptionalProperties({encoding:nNs.optional()});var tv=Gr.objectWithoutOptionalProperties({description:Gr.string().optional()});var iNs=Gr.enum_(["GenerallyAvailable","Beta","Deprecated"]);var RP=Gr.objectWithoutOptionalProperties({availability:iNs.optional()});var bVr=Gr.number();var yyt=Gr.objectWithoutOptionalProperties({statusCode:bVr.optional()});var fD=Gr.objectWithoutOptionalProperties({nameOverride:Gr.string().optional(),generatedName:Gr.string()});var G6=Gr.objectWithoutOptionalProperties({inline:Gr.boolean().optional()});var fIe=Gr.string();var dIe=Gr.string();var aNs=Gr.objectWithoutOptionalProperties({id:dIe}).extend(tv);var Xro=Gr.string();var oNs=Gr.objectWithoutOptionalProperties({usernameVariableName:Gr.string().optional(),usernameEnvVar:Gr.string().optional(),passwordVariableName:Gr.string().optional(),passwordEnvVar:Gr.string().optional()});var uNs=Gr.objectWithoutOptionalProperties({tokenVariableName:Gr.string().optional(),tokenEnvVar:Gr.string().optional()});var sNs=Gr.objectWithoutOptionalProperties({headerName:Gr.string(),prefix:Gr.string().optional(),headerVariableName:Gr.string().optional(),headerEnvVar:Gr.string().optional()});var cNs=Gr.objectWithoutOptionalProperties({queryParameterName:Gr.string()});var lNs=Gr.objectWithoutOptionalProperties({snake:Gr.string().optional(),camel:Gr.string().optional(),screamingSnake:Gr.string().optional(),pascal:Gr.string().optional()});var G2i=Gr.objectWithoutOptionalProperties({nameOverride:Gr.string().optional(),generatedName:Gr.string(),value:Gr.string(),casing:lNs.optional()}).extend(tv).extend(RP);var fNs=Gr.objectWithoutOptionalProperties({type:Gr.stringLiteral("namespace"),name:Gr.string()});var dNs=Gr.undiscriminatedUnion([Gr.string(),fNs]);var J2i=Gr.list(dNs);var PM=Gr.objectWithoutOptionalProperties({groupName:J2i.optional()});var PS=Gr.objectWithoutOptionalProperties({namespace:Gr.string().optional()});var Zro=Gr.objectWithoutOptionalProperties({default:G2i.optional(),values:Gr.list(G2i)}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(eP).extend(AM).extend(G6);var pNs=Gr.objectWithoutOptionalProperties({scopesEnum:Zro.optional()});var _Ns=Gr.union("type",{basic:oNs,bearer:uNs,header:sNs,query:cNs,oauth:pNs}).transform({transform:e=>{switch(e.type){case"basic":return Hde.basic(e);case"bearer":return Hde.bearer(e);case"header":return Hde.header(e);case"query":return Hde.query(e);case"oauth":return Hde.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var QXo=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),url:Gr.string(),audiences:Gr.list(Gr.string()).optional()}).extend(tv);var hNs=Gr.string();var gVr=Gr.objectWithoutOptionalProperties({sdkMethodName:Gr.string().optional()});var BBf={};lf(BBf,{FullExample:()=>b5,FullObjectExample:()=>bNs,FullOneOfExample:()=>mNs,KeyValuePair:()=>gNs,LiteralExample:()=>yNs,NullExample:()=>vNs,PrimitiveExample:()=>eno,PropertyKey:()=>kro});var kro=Gr.string();var eno=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 wO.int(e.value);case"int64":return wO.int64(e.value);case"uint":return wO.uint(e.value);case"uint64":return wO.uint64(e.value);case"float":return wO.float(e.value);case"double":return wO.double(e.value);case"string":return wO.string(e.value);case"datetime":return wO.datetime(e.value);case"date":return wO.date(e.value);case"base64":return wO.base64(e.value);case"boolean":return wO.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var yNs=Gr.union("type",{boolean:Gr.object({value:Gr.boolean()}),string:Gr.object({value:Gr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return U2i.boolean(e.value);case"string":return U2i.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var vNs=Gr.objectWithoutOptionalProperties({});var b5=Gr.union("type",{primitive:Gr.object({value:eno}),object:Gr.lazyObject(()=>bNs),array:Gr.object({value:Gr.list(Gr.lazy(()=>b5))}),map:Gr.object({value:Gr.list(Gr.lazyObject(()=>gNs))}),enum:Gr.object({value:Gr.string()}),literal:Gr.object({value:yNs}),oneOf:Gr.object({value:Gr.lazy(()=>mNs)}),null:vNs,unknown:Gr.object({value:Gr.lazy(()=>b5)})}).transform({transform:e=>{switch(e.type){case"primitive":return AS.primitive(e.value);case"object":return AS.object(e);case"array":return AS.array(e.value);case"map":return AS.map(e.value);case"enum":return AS.enum(e.value);case"literal":return AS.literal(e.value);case"oneOf":return AS.oneOf(e.value);case"null":return AS.null(e);case"unknown":return AS.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var bNs=Gr.objectWithoutOptionalProperties({properties:Gr.record(kro,Gr.lazy(()=>b5))});var gNs=Gr.objectWithoutOptionalProperties({key:eno,value:Gr.lazy(()=>b5)});var mNs=Gr.union("type",{discriminated:Gr.object({value:Gr.record(kro,Gr.lazy(()=>b5))}),undiscriminated:Gr.object({value:Gr.lazy(()=>b5)})}).transform({transform:e=>{switch(e.type){case"discriminated":return V2i.discriminated(e.value);case"undiscriminated":return V2i.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var TBf={};lf(TBf,{AllOfPropertyConflict:()=>gno,ArraySchema:()=>fFs,Availability:()=>iNs,BooleanSchema:()=>aFs,BytesResponse:()=>cno,CasingOverrides:()=>lNs,CommonProperty:()=>gFs,CursorPagination:()=>UNs,CustomCodeSample:()=>QNs,CustomCodeSampleLanguage:()=>FNs,CustomCodeSampleSdk:()=>zNs,CustomPagination:()=>WNs,DiscriminatedOneOfSchema:()=>vFs,DoubleSchema:()=>nFs,Endpoint:()=>HNs,EndpointExample:()=>pno,EndpointResponseExample:()=>NNs,EndpointSdkName:()=>mVr,EndpointSecurity:()=>tno,EnumSchema:()=>Zro,EnumValue:()=>G2i,ErrorExample:()=>MNs,FernExample:()=>TNs,FileResponse:()=>uno,FileSchema:()=>PNs,FormUrlEncodedRequest:()=>DNs,FullEndpointExample:()=>LNs,GlobalHeader:()=>uFs,Header:()=>K2i,HeaderExample:()=>dno,HttpEndpointServer:()=>lno,HttpError:()=>BNs,HttpMethod:()=>rno,IdempotencyHeader:()=>sFs,IntSchema:()=>tFs,JsonRequest:()=>SNs,JsonResponse:()=>sno,LiteralSchema:()=>bno,LiteralSchemaValue:()=>cFs,LongSchema:()=>rFs,MapSchema:()=>dFs,MultipartRequest:()=>ono,MultipartRequestProperty:()=>ENs,MultipartRequestPropertyEncoding:()=>jNs,MultipartSchema:()=>wNs,NullableSchema:()=>_Fs,ObjectProperty:()=>yFs,ObjectPropertyConflictInfo:()=>mno,ObjectSchema:()=>lFs,OctetStreamRequest:()=>ano,OffsetPagination:()=>VNs,OneOfSchema:()=>hFs,OpenApiIntermediateRepresentation:()=>eGy,OptionalSchema:()=>pFs,Pagination:()=>_no,PathParameter:()=>nno,PathParameterExample:()=>qNs,PrimitiveSchema:()=>Y2i,PrimitiveSchemaValue:()=>oFs,QueryParameter:()=>ino,QueryParameterExample:()=>fno,ReferencedSchema:()=>OVr,Request:()=>CNs,Response:()=>INs,RetriesConfiguration:()=>hno,Schema:()=>EI,Schemas:()=>eFs,SdkGroupInfo:()=>ONs,StreamingResponseExample:()=>RNs,StringSchema:()=>iFs,SupportedSdkLanguage:()=>xNs,Tags:()=>ANs,TextResponse:()=>$2i,UnDiscriminatedOneOfSchema:()=>bFs,Webhook:()=>GNs,WebhookExampleCall:()=>vno,WebhookHttpMethod:()=>yno,WebsocketChannel:()=>kNs,WebsocketHandshake:()=>JNs,WebsocketMessageExample:()=>XNs,WebsocketMessageOrigin:()=>KNs,WebsocketMessageSchema:()=>$Ns,WebsocketServer:()=>YNs,WebsocketSessionExample:()=>ZNs});var ONs=Gr.objectWithoutOptionalProperties({summary:Gr.string().optional(),description:Gr.string().optional()});var ANs=Gr.objectWithoutOptionalProperties({tagsById:Gr.record(dIe,aNs),orderedTagIds:Gr.list(dIe).optional()});var tno=Gr.list(Gr.record(Xro,Gr.list(Gr.string())));var rno=Gr.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var nno=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>EI),variableReference:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(tv).extend(RP).extend(eP);var ino=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>EI),parameterNameOverride:Gr.string().optional()}).extend(tv).extend(RP).extend(eP);var K2i=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>EI),env:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(tv).extend(RP).extend(eP);var mVr=Gr.objectWithoutOptionalProperties({groupName:J2i,methodName:Gr.string()});var ano=Gr.objectWithoutOptionalProperties({contentType:Gr.string().optional()}).extend(tv).extend(eP);var PNs=Gr.objectWithoutOptionalProperties({isOptional:Gr.boolean(),isArray:Gr.boolean()}).extend(tv);var wNs=Gr.union("type",{file:PNs,json:Gr.object({value:Gr.lazy(()=>EI)})}).transform({transform:e=>{switch(e.type){case"file":return yVr.file(e);case"json":return yVr.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var jNs=Gr.enum_(["json","form"]);var ENs=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:wNs,contentType:Gr.string().optional(),exploded:Gr.boolean().optional(),encoding:jNs.optional()}).extend(tv);var ono=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),properties:Gr.list(ENs)}).extend(tv).extend(eP);var SNs=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>EI),contentType:Gr.string().optional(),additionalProperties:Gr.boolean()}).extend(tv).extend(eP);var DNs=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>EI),contentType:Gr.string().optional(),additionalProperties:Gr.boolean()}).extend(tv).extend(eP);var CNs=Gr.union("type",{octetStream:ano,multipart:ono,json:SNs,formUrlEncoded:DNs}).transform({transform:e=>{switch(e.type){case"octetStream":return Sqr.octetStream(e);case"multipart":return Sqr.multipart(e);case"json":return Sqr.json(e);case"formUrlEncoded":return Sqr.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var uno=Gr.objectWithoutOptionalProperties({}).extend(tv).extend(eP).extend(yyt);var sno=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>EI),responseProperty:Gr.string().optional()}).extend(tv).extend(eP).extend(yyt);var $2i=Gr.objectWithoutOptionalProperties({}).extend(tv).extend(eP).extend(yyt);var cno=Gr.objectWithoutOptionalProperties({}).extend(tv).extend(eP).extend(yyt);var INs=Gr.union("type",{file:uno,json:sno,text:$2i,bytes:cno,streamingSse:sno,streamingText:$2i,streamingJson:sno}).transform({transform:e=>{switch(e.type){case"file":return Wbe.file(e);case"json":return Wbe.json(e);case"text":return Wbe.text(e);case"bytes":return Wbe.bytes(e);case"streamingSse":return Wbe.streamingSse(e);case"streamingText":return Wbe.streamingText(e);case"streamingJson":return Wbe.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var MNs=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),description:Gr.string().optional(),example:Gr.lazy(()=>b5)});var BNs=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>EI).optional(),examples:Gr.list(MNs).optional()}).extend(tv).extend(fD).extend(eP);var lno=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),url:Gr.string().optional(),audiences:Gr.list(Gr.string()).optional()});var TNs=Gr.unknown();var qNs=Gr.objectWithoutOptionalProperties({name:Gr.string(),parameterNameOverride:Gr.string().optional(),value:Gr.lazy(()=>b5)});var fno=Gr.objectWithoutOptionalProperties({name:Gr.string(),value:Gr.lazy(()=>b5)});var dno=Gr.objectWithoutOptionalProperties({name:Gr.string(),value:Gr.lazy(()=>b5)});var RNs=Gr.objectWithoutOptionalProperties({sse:Gr.boolean(),events:Gr.list(Gr.lazy(()=>b5))});var NNs=Gr.union("type",{withStreaming:RNs,withoutStreaming:Gr.object({value:Gr.lazy(()=>b5)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return hyt.withStreaming(e);case"withoutStreaming":return hyt.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var FNs=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),language:Gr.string(),code:Gr.string(),install:Gr.string().optional()}).extend(tv);var xNs=Gr.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var zNs=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),sdk:xNs,code:Gr.string()}).extend(tv);var QNs=Gr.union("type",{language:FNs,sdk:zNs}).transform({transform:e=>{switch(e.type){case"language":return hVr.language(e);case"sdk":return hVr.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var LNs=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),pathParameters:Gr.list(qNs).optional(),queryParameters:Gr.list(fno).optional(),headers:Gr.list(dno).optional(),request:Gr.lazy(()=>b5).optional(),response:NNs.optional(),codeSamples:Gr.list(QNs)}).extend(tv);var pno=Gr.union("type",{unknown:Gr.object({value:TNs}),full:LNs}).transform({transform:e=>{switch(e.type){case"unknown":return _yt.unknown(e.value);case"full":return _yt.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var UNs=Gr.objectWithoutOptionalProperties({cursor:Gr.string(),nextCursor:Gr.property("next_cursor",Gr.string()),results:Gr.string()});var VNs=Gr.objectWithoutOptionalProperties({offset:Gr.string(),results:Gr.string(),step:Gr.string().optional(),hasNextPage:Gr.string().optional()});var WNs=Gr.objectWithoutOptionalProperties({results:Gr.string()});var _no=Gr.union("type",{cursor:UNs,offset:VNs,custom:WNs}).transform({transform:e=>{switch(e.type){case"cursor":return eit.cursor(e);case"offset":return eit.offset(e);case"custom":return eit.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var hno=Gr.union("type",{disabled:Gr.object({value:Gr.boolean().optional()})}).transform({transform:e=>{switch(e.type){case"disabled":return NXo.disabled(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var HNs=Gr.objectWithoutOptionalProperties({authed:Gr.boolean(),security:tno,internal:Gr.boolean().optional(),idempotent:Gr.boolean().optional(),method:rno,audiences:Gr.list(Gr.string()),path:Gr.string(),summary:Gr.string().optional(),operationId:Gr.string().optional(),tags:Gr.list(dIe),pathParameters:Gr.list(nno),queryParameters:Gr.list(ino),headers:Gr.list(K2i),sdkName:mVr.optional(),generatedRequestName:Gr.string(),requestNameOverride:Gr.string().optional(),request:CNs.optional(),response:INs.optional(),errors:Gr.record(bVr,BNs),servers:Gr.list(lno),examples:Gr.list(pno),pagination:_no.optional(),retries:hno.optional()}).extend(tv).extend(RP).extend(eP).extend(PS);var yno=Gr.enum_(["GET","POST"]);var vno=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),payload:Gr.lazy(()=>b5)}).extend(tv);var GNs=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),sdkName:mVr.optional(),method:yno,summary:Gr.string().optional(),operationId:Gr.string(),tags:Gr.list(dIe),headers:Gr.list(K2i),generatedPayloadName:Gr.string(),payload:Gr.lazy(()=>EI),examples:Gr.list(vno)}).extend(tv).extend(eP).extend(PS);var JNs=Gr.objectWithoutOptionalProperties({queryParameters:Gr.list(ino),headers:Gr.list(K2i),pathParameters:Gr.list(nno)});var KNs=Gr.enum_(["client","server"]);var $Ns=Gr.objectWithoutOptionalProperties({name:Gr.string(),origin:KNs,body:Gr.lazy(()=>EI)});var YNs=Gr.objectWithoutOptionalProperties({name:Gr.string(),url:Gr.string()});var XNs=Gr.objectWithoutOptionalProperties({messageType:Gr.string(),payload:Gr.lazy(()=>b5)}).extend(tv);var ZNs=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),queryParameters:Gr.list(fno).optional(),headers:Gr.list(dno).optional(),messages:Gr.list(XNs)}).extend(tv);var kNs=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),path:Gr.string(),groupName:J2i,summary:Gr.string().optional(),handshake:JNs,messages:Gr.list($Ns),servers:Gr.list(YNs),examples:Gr.list(ZNs)}).extend(tv).extend(eP);var eFs=Gr.objectWithoutOptionalProperties({rootSchemas:Gr.record(fIe,Gr.lazy(()=>EI)),namespacedSchemas:Gr.record(hNs,Gr.record(fIe,Gr.lazy(()=>EI)))});var tFs=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 rFs=Gr.objectWithoutOptionalProperties({default:Gr.number().optional()});var nFs=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 iFs=Gr.objectWithoutOptionalProperties({default:Gr.string().optional(),pattern:Gr.string().optional(),format:Gr.string().optional(),minLength:Gr.number().optional(),maxLength:Gr.number().optional()});var aFs=Gr.objectWithoutOptionalProperties({default:Gr.boolean().optional()});var oFs=Gr.union("type",{int:tFs,int64:rFs,uint:Gr.object({}),uint64:Gr.object({}),float:Gr.object({}),double:nFs,string:iFs,datetime:Gr.object({}),date:Gr.object({}),base64:Gr.object({}),boolean:aFs}).transform({transform:e=>{switch(e.type){case"int":return Oq.int(e);case"int64":return Oq.int64(e);case"uint":return Oq.uint();case"uint64":return Oq.uint64();case"float":return Oq.float();case"double":return Oq.double(e);case"string":return Oq.string(e);case"datetime":return Oq.datetime();case"date":return Oq.date();case"base64":return Oq.base64();case"boolean":return Oq.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var Y2i=Gr.objectWithoutOptionalProperties({schema:oFs}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(AM);var uFs=Gr.objectWithoutOptionalProperties({header:Gr.string(),name:Gr.string().optional(),optional:Gr.boolean().optional(),env:Gr.string().optional(),schema:Gr.lazy(()=>EI).optional()});var sFs=Gr.objectWithoutOptionalProperties({header:Gr.string(),name:Gr.string().optional(),env:Gr.string().optional(),schema:Gr.lazy(()=>EI).optional()});var eGy=Gr.objectWithoutOptionalProperties({apiVersion:Gr.unknown().optional(),title:Gr.string().optional(),description:Gr.string().optional(),basePath:Gr.string().optional(),servers:Gr.list(QXo),websocketServers:Gr.list(QXo),groups:Gr.record(Gr.string(),ONs),tags:ANs,hasEndpointsMarkedInternal:Gr.boolean(),endpoints:Gr.list(HNs),webhooks:Gr.list(GNs),channels:Gr.record(Gr.string(),kNs),groupedSchemas:eFs,variables:Gr.record(Gr.string(),Y2i),nonRequestReferencedSchemas:Gr.set(fIe),securitySchemes:Gr.record(Xro,_Ns),globalHeaders:Gr.list(uFs).optional(),idempotencyHeaders:Gr.list(sFs).optional()});var OVr=Gr.objectWithoutOptionalProperties({schema:fIe}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(eP).extend(AM);var cFs=Gr.union("type",{boolean:Gr.object({value:Gr.boolean()}),string:Gr.object({value:Gr.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return NV.boolean(e.value);case"string":return NV.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var bno=Gr.objectWithoutOptionalProperties({value:cFs}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(AM);var EI=Gr.union("type",{primitive:Y2i,object:Gr.lazyObject(()=>lFs),array:Gr.lazyObject(()=>fFs),map:Gr.lazyObject(()=>dFs),optional:Gr.lazyObject(()=>pFs),enum:Zro,reference:OVr,literal:bno,oneOf:Gr.object({value:Gr.lazy(()=>hFs)}),nullable:Gr.lazyObject(()=>_Fs),unknown:fD}).transform({transform:e=>{switch(e.type){case"primitive":return kj.primitive(e);case"object":return kj.object(e);case"array":return kj.array(e);case"map":return kj.map(e);case"optional":return kj.optional(e);case"enum":return kj.enum(e);case"reference":return kj.reference(e);case"literal":return kj.literal(e);case"oneOf":return kj.oneOf(e.value);case"nullable":return kj.nullable(e);case"unknown":return kj.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var gno=Gr.objectWithoutOptionalProperties({propertyKey:Gr.string(),allOfSchemaIds:Gr.list(fIe),conflictingTypeSignatures:Gr.boolean()});var lFs=Gr.objectWithoutOptionalProperties({allOf:Gr.list(OVr),properties:Gr.list(Gr.lazyObject(()=>yFs)),allOfPropertyConflicts:Gr.list(gno),additionalProperties:Gr.boolean()}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(eP).extend(AM).extend(G6);var mno=Gr.objectWithoutOptionalProperties({differentSchema:Gr.boolean()});var yFs=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>EI),readonly:Gr.boolean().optional(),writeonly:Gr.boolean().optional(),conflict:Gr.record(fIe,mno),generatedName:Gr.string(),nameOverride:Gr.string().optional(),audiences:Gr.list(Gr.string())}).extend(RP);var fFs=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>EI)}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(AM).extend(G6);var dFs=Gr.objectWithoutOptionalProperties({key:Y2i,value:Gr.lazy(()=>EI)}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(o3e).extend(AM).extend(G6);var pFs=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>EI)}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(AM).extend(G6);var _Fs=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>EI)}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(AM).extend(G6);var hFs=Gr.union("type",{discriminated:Gr.lazyObject(()=>vFs),undiscriminated:Gr.lazyObject(()=>bFs)}).transform({transform:e=>{switch(e.type){case"discriminated":return vVr.discriminated(e);case"undiscriminated":return vVr.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var vFs=Gr.objectWithoutOptionalProperties({discriminantProperty:Gr.string(),commonProperties:Gr.list(Gr.lazyObject(()=>gFs)),schemas:Gr.record(Gr.string(),Gr.lazy(()=>EI))}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(o3e).extend(eP).extend(AM).extend(G6);var gFs=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>EI)});var bFs=Gr.objectWithoutOptionalProperties({schemas:Gr.list(Gr.lazy(()=>EI))}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(o3e).extend(eP).extend(AM).extend(G6);var qBf={};lf(qBf,{ArraySchemaWithExample:()=>UFs,Base64WithExample:()=>FFs,BooleanWithExample:()=>xFs,CommonPropertyWithExample:()=>XFs,DateWithExample:()=>NFs,DatetimeWithExample:()=>RFs,DiscriminatedOneOfSchemaWithExample:()=>$Fs,DoubleWithExample:()=>TFs,EndpointWithExample:()=>rGy,EnumSchemaWithExample:()=>QFs,FloatWithExample:()=>BFs,HeaderWithExample:()=>X2i,HttpErrorWithExample:()=>SFs,Int64WithExample:()=>CFs,IntWithExample:()=>DFs,JsonRequestWithExample:()=>PFs,JsonResponseWithExample:()=>Ano,MapSchemaWithExample:()=>VFs,NamedFullExample:()=>vyt,NullableSchemaWithExample:()=>HFs,ObjectPropertyWithExample:()=>KFs,ObjectSchemaWithExample:()=>GFs,OneOfSchemaWithExample:()=>JFs,OptionalSchemaWithExample:()=>WFs,ParseFormUrlEncodedRequest:()=>wFs,ParseMultipartRequest:()=>AFs,ParseOctetStreamRequest:()=>OFs,PathParameterWithExample:()=>mFs,PrimitiveSchemaValueWithExample:()=>zFs,PrimitiveSchemaWithExample:()=>Pno,QueryParameterWithExample:()=>Ono,RequestWithExample:()=>jFs,ResponseWithExample:()=>EFs,SchemaWithExample:()=>J6,StringSchemaWithExample:()=>qFs,Uint64WithExample:()=>MFs,UintWithExample:()=>IFs,UnDiscriminatedOneOfSchemaWithExample:()=>YFs,UnknownSchemaWithExample:()=>LFs,WebhookWithExample:()=>nGy,WebsocketHandshakeWithExample:()=>tGy});var vyt=Gr.objectWithoutOptionalProperties({name:Gr.string().optional(),value:Gr.unknown()}).extend(tv);var Ono=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>J6),parameterNameOverride:Gr.string().optional()}).extend(tv).extend(RP).extend(eP);var X2i=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>J6),env:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(tv).extend(RP).extend(eP);var tGy=Gr.objectWithoutOptionalProperties({queryParameters:Gr.list(Ono),headers:Gr.list(X2i)});var mFs=Gr.objectWithoutOptionalProperties({name:Gr.string(),schema:Gr.lazy(()=>J6),variableReference:Gr.string().optional(),parameterNameOverride:Gr.string().optional()}).extend(tv).extend(RP).extend(eP);var OFs=Gr.objectWithoutOptionalProperties({}).extend(ano).extend(gVr);var AFs=Gr.objectWithoutOptionalProperties({}).extend(ono).extend(gVr);var PFs=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>J6),contentType:Gr.string().optional(),fullExamples:Gr.list(vyt).optional(),additionalProperties:Gr.boolean()}).extend(tv).extend(eP).extend(gVr);var wFs=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>J6),contentType:Gr.string().optional(),fullExamples:Gr.list(vyt).optional(),additionalProperties:Gr.boolean()}).extend(tv).extend(eP).extend(gVr);var jFs=Gr.union("type",{octetStream:OFs,multipart:AFs,json:PFs,formUrlEncoded:wFs}).transform({transform:e=>{switch(e.type){case"octetStream":return lIe.octetStream(e);case"multipart":return lIe.multipart(e);case"json":return lIe.json(e);case"formUrlEncoded":return lIe.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var Ano=Gr.objectWithoutOptionalProperties({schema:Gr.lazy(()=>J6),responseProperty:Gr.string().optional(),fullExamples:Gr.list(vyt).optional()}).extend(tv).extend(eP).extend(yyt);var EFs=Gr.union("type",{file:uno,json:Ano,text:$2i,bytes:cno,streamingSse:Ano,streamingText:$2i,streamingJson:Ano}).transform({transform:e=>{switch(e.type){case"file":return XL.file(e);case"json":return XL.json(e);case"text":return XL.text(e);case"bytes":return XL.bytes(e);case"streamingSse":return XL.streamingSse(e);case"streamingText":return XL.streamingText(e);case"streamingJson":return XL.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var SFs=Gr.objectWithoutOptionalProperties({statusCode:bVr,schema:Gr.lazy(()=>J6),fullExamples:Gr.list(vyt).optional()}).extend(tv).extend(fD).extend(eP);var rGy=Gr.objectWithoutOptionalProperties({authed:Gr.boolean(),security:tno,internal:Gr.boolean().optional(),idempotent:Gr.boolean().optional(),method:rno,audiences:Gr.list(Gr.string()),path:Gr.string(),summary:Gr.string().optional(),operationId:Gr.string().optional(),tags:Gr.list(dIe),pathParameters:Gr.list(mFs),queryParameters:Gr.list(Ono),headers:Gr.list(X2i),sdkName:mVr.optional(),generatedRequestName:Gr.string(),requestNameOverride:Gr.string().optional(),request:jFs.optional(),response:EFs.optional(),errors:Gr.record(bVr,SFs),servers:Gr.list(lno),examples:Gr.list(pno),pagination:_no.optional(),retries:hno.optional()}).extend(tv).extend(RP).extend(eP).extend(PS);var nGy=Gr.objectWithoutOptionalProperties({audiences:Gr.list(Gr.string()),sdkName:mVr.optional(),method:yno,summary:Gr.string().optional(),operationId:Gr.string(),tags:Gr.list(dIe),headers:Gr.list(X2i),generatedPayloadName:Gr.string(),payload:Gr.lazy(()=>J6),examples:Gr.list(vno)}).extend(tv).extend(eP).extend(PS);var DFs=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 CFs=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var IFs=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var MFs=Gr.objectWithoutOptionalProperties({default:Gr.number().optional(),example:Gr.number().optional()});var BFs=Gr.objectWithoutOptionalProperties({example:Gr.number().optional()});var TFs=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 qFs=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 RFs=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var NFs=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var FFs=Gr.objectWithoutOptionalProperties({example:Gr.string().optional()});var xFs=Gr.objectWithoutOptionalProperties({default:Gr.boolean().optional(),example:Gr.boolean().optional()});var zFs=Gr.union("type",{int:DFs,int64:CFs,uint:IFs,uint64:MFs,float:BFs,double:TFs,string:qFs,datetime:RFs,date:NFs,base64:FFs,boolean:xFs}).transform({transform:e=>{switch(e.type){case"int":return L0.int(e);case"int64":return L0.int64(e);case"uint":return L0.uint(e);case"uint64":return L0.uint64(e);case"float":return L0.float(e);case"double":return L0.double(e);case"string":return L0.string(e);case"datetime":return L0.datetime(e);case"date":return L0.date(e);case"base64":return L0.base64(e);case"boolean":return L0.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var Pno=Gr.objectWithoutOptionalProperties({schema:zFs}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(AM);var QFs=Gr.objectWithoutOptionalProperties({default:G2i.optional(),values:Gr.list(G2i),example:Gr.string().optional()}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(eP).extend(AM).extend(G6);var LFs=Gr.objectWithoutOptionalProperties({example:Gr.unknown()}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(AM);var J6=Gr.union("type",{primitive:Pno,object:Gr.lazyObject(()=>GFs),array:Gr.lazyObject(()=>UFs),map:Gr.lazyObject(()=>VFs),optional:Gr.lazyObject(()=>WFs),enum:QFs,reference:OVr,literal:bno,oneOf:Gr.object({value:Gr.lazy(()=>JFs)}),nullable:Gr.lazyObject(()=>HFs),unknown:LFs}).transform({transform:e=>{switch(e.type){case"primitive":return Oh.primitive(e);case"object":return Oh.object(e);case"array":return Oh.array(e);case"map":return Oh.map(e);case"optional":return Oh.optional(e);case"enum":return Oh.enum(e);case"reference":return Oh.reference(e);case"literal":return Oh.literal(e);case"oneOf":return Oh.oneOf(e.value);case"nullable":return Oh.nullable(e);case"unknown":return Oh.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var UFs=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>J6),example:Gr.list(Gr.unknown()).optional()}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(AM).extend(G6);var VFs=Gr.objectWithoutOptionalProperties({key:Pno,value:Gr.lazy(()=>J6),example:Gr.unknown().optional()}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(o3e).extend(AM).extend(G6);var WFs=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>J6)}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(AM).extend(G6);var HFs=Gr.objectWithoutOptionalProperties({value:Gr.lazy(()=>J6)}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(AM).extend(G6);var GFs=Gr.objectWithoutOptionalProperties({allOf:Gr.list(OVr),properties:Gr.list(Gr.lazyObject(()=>KFs)),allOfPropertyConflicts:Gr.list(gno),fullExamples:Gr.list(vyt).optional(),additionalProperties:Gr.boolean()}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(eP).extend(AM).extend(G6);var KFs=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>J6),readonly:Gr.boolean().optional(),writeonly:Gr.boolean().optional(),audiences:Gr.list(Gr.string()),conflict:Gr.record(fIe,mno),nameOverride:Gr.string().optional(),generatedName:Gr.string()}).extend(RP);var JFs=Gr.union("type",{discriminated:Gr.lazyObject(()=>$Fs),undiscriminated:Gr.lazyObject(()=>YFs)}).transform({transform:e=>{switch(e.type){case"discriminated":return tit.discriminated(e);case"undiscriminated":return tit.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var $Fs=Gr.objectWithoutOptionalProperties({discriminantProperty:Gr.string(),commonProperties:Gr.list(Gr.lazyObject(()=>XFs)),schemas:Gr.record(Gr.string(),Gr.lazy(()=>J6))}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(o3e).extend(eP).extend(AM).extend(G6);var XFs=Gr.objectWithoutOptionalProperties({key:Gr.string(),schema:Gr.lazy(()=>J6)});var YFs=Gr.objectWithoutOptionalProperties({schemas:Gr.list(Gr.lazy(()=>J6))}).extend(PM).extend(PS).extend(fD).extend(tv).extend(RP).extend(o3e).extend(eP).extend(AM).extend(G6);var iGy=/^(\d+)/,wno=/^[a-zA-Z][a-zA-Z0-9_]*$/,aGy={"<":"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 Z2i(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_${Z2i(c)}`}let i=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[i]}_thousand`:`${t[i]}_thousand_${Z2i(a)}`}function LXo(e){let t=e.match(iGy);if(t&&t[0]!=null){let r=t[0],n=e.substring(r.length),i=parseFloat(r);if(!isNaN(i)&&isFinite(i)){let a=Z2i(i);return n.length>0?`${a}_${n}`:a}}}function jno(e){let t=LXo(e),r=aGy[e];return t!=null?n9(CA(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":n9(CA(e)))}function u3e(e,t){return e.type==="primitive"&&t.type==="primitive"?oGy(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?LLC(e.values,t.values):e.type==="array"&&t.type==="array"?u3e(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"?u3e(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?ULC(e.value,t.value):e.type==="object"&&t.type==="object"?VLC(e,t):e.type==="map"&&t.type==="map"?oGy(e.key.schema,t.key.schema)&&u3e(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function oGy(e,t){return e.type===t.type}function LLC(e,t){let r=new Set(...e.map(i=>i.value)),n=new Set(...t.map(i=>i.value));return xue(r,n)}function ULC(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:u3e(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:u3e(r,i)}):!1}function VLC(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:u3e(a,i.schema)})}function RJ(e){switch(e){case Gde.Deprecated:return"deprecated";case Gde.Beta:return"pre-release";case Gde.GenerallyAvailable:return"generally-available";default:return}}function WLC(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 uGy(e){let t=e?WLC(e):void 0;if(t==null||t.length===0)return vaa;let r=[];for(let[n,i]of t.entries())if(typeof i=="string")r.push(CA(i));else if(typeof i=="object")switch(i.type){case"namespace":{n<t.length-1?r.push(CA(i.name)):r.push(i.name,vaa);break}default:tc(i.type)}else tc(i);return r.join("/")}function k2i(e){return ow.of(`${uGy(e)}.yml`)}function RBf({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?vaa:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(n=>typeof n=="string"||n.type!=="namespace")]:r=e.groupName,uGy(r))}function sGy({sdkName:e,namespaceOverride:t}){return ow.of(`${RBf({sdkName:e,namespaceOverride:t})}.yml`)}function cGy({location:e,namespaceOverride:t}){return t!=null?VX(ow.of(t),e):e}function ZFs(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:tc(e.type)}}function Eno(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:tc(e)}}function K6(e){return typeof e=="string"?e:e.type}function Sno(e){if(typeof e!="string")return e.docs}function UXo(e){if(typeof e!="string")return e.default}function NBf(e){if(typeof e!="string")return e.validation}function fGy(e){let t=K6(e);return t.startsWith("nullable<")||t.startsWith("optional<nullable<")?e:typeof e=="string"?lGy(e):{...e,type:lGy(e.type)}}function lGy(e){return e.startsWith("nullable<")||e.startsWith("optional<nullable<")?e:e.startsWith("optional<")?e.replace("optional<","optional<nullable<")+">":`nullable<${e}>`}function Wla(e){return K6(e).startsWith("optional<")?e:typeof e=="string"?dGy(e):{...e,type:dGy(e.type)}}function dGy(e){return e.startsWith("optional<")?e:`optional<${e}>`}var HLC=-2147483648,GLC=2147483647,JLC=-17976931348623157e292,KLC=17976931348623157e292;function kD({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 kFs(e);case"array":return zBf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"map":return QBf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"reference":return xBf({schema:e,fileContainingReference:t,context:n,namespace:i});case"unknown":return UBf();case"optional":return exs({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"nullable":return LBf({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"enum":return nUC({schema:e,fileContainingReference:t,context:n,declarationFile:r,declarationDepth:a});case"literal":return e.value,VBf(e);case"object":return iUC({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});case"oneOf":return aUC({schema:e.value,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});default:tc(e)}}function kFs(e){switch(e.schema.type){case"string":return XLC({description:e.description,schema:e.schema});case"int":return ZLC({description:e.description,schema:e.schema});case"float":return kLC({description:e.description,schema:e.schema});case"double":return eUC({description:e.description,schema:e.schema});case"boolean":return $LC({description:e.description,schema:e.schema});case"int64":return YLC({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:RJ(e.availability)}:{}}}function $LC({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 YLC({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 XLC({description:e,schema:t}){let r="string",n=tUC(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 ZLC({description:e,schema:t}){let r="integer",n=pGy(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 kLC({description:e,schema:t}){let r="float";if(e==null)return r;let n={type:r};return e!=null&&(n.docs=e),n}function eUC({description:e,schema:t}){let r="double",n=pGy(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 tUC(e){if(e==null)return;let{format:t,pattern:r,minLength:n,maxLength:i}=e,a=rUC(t);if(!(a==null&&r==null&&n==null&&i==null))return{format:a,pattern:r,minLength:n,maxLength:i}}function rUC(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 pGy(e,t){if(e==null)return;let{minimum:r,maximum:n,multipleOf:i}=e,{exclusiveMinimum:a,exclusiveMaximum:o}=e;if(r=FBf(r,t),n=FBf(n,t),i=FBf(i,t),!(r==null&&n==null&&a==null&&o==null&&i==null))return{min:r,max:n,exclusiveMin:a,exclusiveMax:o,multipleOf:i}}function FBf(e,t){if(e===void 0)return;let[r,n]=t==="integer"?[HLC,GLC]:[JLC,KLC];return e<r||e>n?void 0:e}function xBf({schema:e,fileContainingReference:t,context:r,namespace:n}){let i=r.getSchema(e.schema,n);if(i==null)return"unknown";let a=oUC(i)??e.schema,o=Eno(i),c=uUC(i),s=txs({context:r,fileContainingReference:t,declarationFile:k2i(o),type:a});return i.type==="nullable"&&(s=r.wrapReferencesToNullableInOptional?`optional<${s}>`:`nullable<${s}>`),i.type==="optional"&&!s.startsWith("optional<")&&(s=`optional<${s}>`),e.description==null&&c==null?s:{type:s,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:RJ(e.availability)}:{}}}function zBf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=kD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=`list<${K6(o)}>`;return e.description==null&&e.title==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:RJ(e.availability)}:{},type:c}}function QBf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=kFs(e.key),c=kD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),d=e.encoding!=null?ZFs(e.encoding):void 0,s=`map<${K6(o)}, ${K6(c)}>`;if(e.description==null&&d==null&&e.title==null)return s;let u={type:s};return e.description!=null&&(u.docs=e.description),e.encoding!=null&&(u.encoding=d),e.availability!=null&&(u.availability=RJ(e.availability)),u}function LBf({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){if(!n.respectNullableSchemas)return exs({schema:e,fileContainingReference:t,context:n,declarationFile:r,namespace:i,declarationDepth:a});let o=kD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=K6(o),d=Sno(o),s=UXo(o),u=NBf(o),l=fGy(c);if(n.wrapReferencesToNullableInOptional&&(l=Wla(l)),e.availability==null&&e.description==null&&d==null&&s==null&&u==null&&e.title==null)return l;let m=typeof l=="string"?{type:l}:l;return(e.description!=null||d!=null)&&(m.docs=e.description??d),s!=null&&(m.default=s),u!=null&&(m.validation=u),e.availability!=null&&(m.availability=RJ(e.availability)),m}function exs({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=kD({schema:e.value,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}),c=K6(o),d=Sno(o),s=UXo(o),u=NBf(o),l=Wla(c);if(e.availability==null&&e.description==null&&d==null&&s==null&&u==null&&e.title==null)return l;let m=typeof l=="string"?{type:l}:l;return(e.description!=null||d!=null)&&(m.docs=e.description??d),s!=null&&(m.default=s),u!=null&&(m.validation=u),e.availability!=null&&(m.availability=RJ(e.availability)),m}function UBf(){return"unknown"}function VBf(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:tc(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:RJ(e.availability)}:{}}}function nUC({schema:e,fileContainingReference:t,declarationFile:r,context:n,declarationDepth:i}){let a=VXo(e,i),o=e.nameOverride??e.generatedName;n.builder.addType(r,{name:o,schema:a.schema});let c=txs({type:o,fileContainingReference:t,declarationFile:r,context:n});if(e.description==null&&e.default==null&&e.title==null)return c;let d={type:c};return e.description!=null&&(d.docs=e.description),e.default!=null&&(d.default=e.default.value),e.availability!=null&&(d.availability=RJ(e.availability)),d}function iUC({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=WBf({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 d=txs({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?d:{type:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:RJ(e.availability)}:{}}}function aUC({schema:e,fileContainingReference:t,declarationFile:r,context:n,namespace:i,declarationDepth:a}){let o=HBf({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 d=txs({type:c,fileContainingReference:t,declarationFile:r,context:n});return e.description==null&&e.title==null?d:{...e.title!=null?{"display-name":e.title}:{},type:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:RJ(e.availability)}:{}}}function txs({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 oUC(e){return kj._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 uUC(e){return kj._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 hse;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(hse||(hse={}));function fPi(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:tc(e)}}function hGy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a;switch(e.type){case"primitive":a=lUC(e);break;case"array":a=sUC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"map":a=cUC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"reference":a=fUC({schema:e,context:t,declarationFile:r,namespace:n});break;case"unknown":a=pUC(e.nameOverride,e.generatedName);break;case"optional":a=yGy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"nullable":a=dUC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"enum":a=VXo(e,i);break;case"literal":a=_UC(e,e.nameOverride,e.generatedName);break;case"object":a=WBf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;case"oneOf":a=HBf({schema:e.value,context:t,declarationFile:r,namespace:n,declarationDepth:i});break;default:tc(e)}return a}function WBf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=t.isInState(hse.Request)&&t.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),o=!1,c={},d=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])=>{GBf({property:A.key,schemaId:R,context:t,namespace:n}).forEach($=>{d.add($)})})}let P=kD({schema:A.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}),C=A.audiences,M=A.nameOverride,T=RJ(A.availability),z=bUC(A);c[A.key]=vUC({typeReference:P,audiences:C,name:M,availability:T,propertyAccess:z})}let s=new Set;for(let A of e.allOfPropertyConflicts)A.allOfSchemaIds.forEach(P=>d.add(P)),A.conflictingTypeSignatures&&s.add(A.propertyKey);let u=[];for(let A of e.allOf){let P=vGy({schema:A.schema,context:t,namespace:n});if(P==null||d.has(A.schema)||d.has(P))continue;let C=kD({schema:kj.reference(A),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});u.push(K6(C))}for(let A of d){let P=JBf(t,A,n);for(let C of P.properties)c[C.key]==null&&(s.has(C.key)&&(c[C.key]="unknown"),c[C.key]=kD({schema:C.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1}));for(let C of P.allOf){if(d.has(C.schema))continue;let M=kD({schema:kj.reference(C),context:t,fileContainingReference:r,namespace:n,declarationDepth:i+1});u.push(K6(M))}}let l={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([A,P])=>yUC(A)?[A,typeof P=="string"?{type:P,name:`_${A}`}:{...P,name:`_${A}`}]:[A,P]))};u.length>0&&(l.extends=u),e.additionalProperties&&(l["extra-properties"]=!0),e.availability!=null&&(l.availability=RJ(e.availability)),e.source!=null&&(l.source=fPi(e.source)),l.inline=KBf(e,i);let m=e.nameOverride??e.generatedName;return{name:o&&t.respectReadonlySchemas&&!a?`${m}Read`:m,schema:l}}function GBf({property:e,schemaId:t,context:r,namespace:n}){let i=r.getSchema(t,n);if(i==null)return[];if(i.type==="reference")return GBf({property:e,schemaId:i.schema,context:r,namespace:n});if(i.type==="object"){let{properties:a,allOf:o}=JBf(r,t,n),c=a.some(s=>s.key===e),d=[...o.flatMap(s=>GBf({property:e,context:r,schemaId:s.schema,namespace:n}))];if(c||d.length>0)return[t,...d]}return[]}function JBf(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 JBf(e,n.schema,r);throw new Error(`Cannot getAllProperties for a non-object schema. schemaId=${t}, type=${n.type}`)}function sUC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:zBf({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function cUC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:QBf({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:n,declarationDepth:i})}}function lUC(e){let t=kFs(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 _Gy(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function VXo(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||_Gy(a.casing)))return o;let d={value:a.value};if(o!==c&&(d.name=o),a.description!=null&&(d.docs=a.description),a.casing!=null&&!_Gy(a.casing)){let s={},u=!1;a.casing.camel!=null&&(s.camel=a.casing.camel,u=!0),a.casing.screamingSnake!=null&&(s["screaming-snake"]=a.casing.screamingSnake,u=!0),a.casing.snake!=null&&(s.snake=a.casing.snake,u=!0),a.casing.pascal!=null&&(s.pascal=a.casing.pascal,u=!0),u&&(d.casing=s)}return d})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=KBf(e,t);let n=new Set,i={...r,enum:[],source:e.source!=null?fPi(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 fUC({schema:e,context:t,declarationFile:r,namespace:n}){return{name:e.nameOverride??e.generatedName,schema:xBf({schema:e,context:t,fileContainingReference:r,namespace:n})}}function dUC({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return t.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:LBf({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}:yGy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i})}function yGy({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){return{name:e.nameOverride??e.generatedName,schema:exs({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:n,declarationDepth:i})}}function pUC(e,t){return{name:e??t,schema:UBf()}}function _UC(e,t,r){return{name:t??r,schema:VBf(e)}}function HBf({schema:e,context:t,declarationFile:r,namespace:n,declarationDepth:i}){let a=e.encoding!=null?ZFs(e.encoding):void 0;if(e.type==="discriminated"){let c={};for(let s of e.commonProperties)c[s.key]=kD({schema:s.schema,fileContainingReference:r,context:t,namespace:n,declarationDepth:i+1});let d={};for(let[s,u]of Object.entries(e.schemas))d[s]=kD({schema:u,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?RJ(e.availability):void 0,union:d,encoding:a,source:e.source!=null?fPi(e.source):void 0}}}let o=[];for(let c of e.schemas)o.push(kD({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?fPi(e.source):void 0,inline:KBf(e,i)}}}var hUC=/^[0-9]/;function yUC(e){return hUC.test(e)}function vGy({schema:e,context:t,namespace:r}){let n=t.getSchema(e,r);if(n!=null)return n.type==="reference"?vGy({context:t,schema:n.schema,namespace:r}):e}function vUC({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 KBf(e,t){return e.inline===!0||t>0?!0:void 0}function bUC(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return $X.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return $X.ObjectPropertyAccess.WriteOnly}}function bGy(e){let t=e.replace(/^x-|^X-/,"");return CA(t)}var gGy="BasicAuthScheme",rxs="BearerAuthScheme";function mGy(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:gGy,schema:i}),t||(e.builder.setAuth(gGy),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:rxs,schema:i}),t||(e.builder.setAuth(rxs),t=!0)}else if(n.type==="header")if(t)e.builder.addGlobalHeader({name:n.headerName,schema:{type:"string",name:n.headerVariableName??bGy(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:rxs,schema:i}),t||(e.builder.setAuth(rxs),t=!0),n.scopesEnum!=null&&n.scopesEnum.values.length>0&&e.builder.addType(ow.of("__package__.yml"),{name:"OauthScope",schema:VXo(n.scopesEnum,0).schema})}}function AVr({header:e,context:t,fileContainingReference:r,namespace:n}){let i=kD({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),a=K6(i),o=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:CA(o);if(e.description==null&&e.name===c&&e.env==null&&e.availability==null)return a;let d={type:a};return c!==e.name&&(d.name=c),e.description!=null&&(d.docs=e.description),e.env!=null&&(d.env=e.env),e.availability!=null&&(d.availability=RJ(e.availability)),d}function nxs({pathParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=kD({schema:e.schema,context:t,fileContainingReference:r,namespace:n,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return K6(i);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:K6(i)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=RJ(e.availability)),a}function axs({queryParameter:e,context:t,fileContainingReference:r,namespace:n}){let i=$Bf({schema:e.schema,context:t,fileContainingReference:r,namespace:n});if(i==null)return;let a=K6(i.value),o=UXo(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=RJ(e.availability)),gUC(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 $Bf({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:kD({schema:kj.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:ow.of(pF),fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(i.type==="oneOf"&&i.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,d]of Object.entries(i.value.schemas))d.type==="primitive"&&d.schema.type==="string"&&(o=!0),d.type==="literal"&&d.value.type==="string"&&(wno.test(d.value.value)?a.push(d.value.value):a.push({value:d.value.value,name:jno(d.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,d]=i.value.schemas;if(c!=null&&d!=null&&ixs({array:c,primitive:d}))return{value:kD({schema:kj.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:d,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&&d!=null&&ixs({array:c,primitive:d}))return{value:kD({schema:kj.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,d]of Object.entries(i.value.schemas))return $Bf({schema:d,context:t,fileContainingReference:r,namespace:n})}else if(t.objectQueryParameters)return{value:kD({schema:e,context:t,fileContainingReference:r,declarationFile:ow.of(pF),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){let i=e.type==="optional"?kj.optional:kj.nullable;if(e.value.type==="reference"){let a=t.getSchema(e.value.schema,n);if(a==null)return;if(a.type==="array")return{value:kD({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:a.value,description:e.description??a.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:ow.of(pF),namespace:n,declarationDepth:0}),allowMultiple:!0};if(t.objectQueryParameters)return{value:kD({schema:e,context:t,fileContainingReference:r,declarationFile:ow.of(pF),namespace:n,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:kD({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let a=[],o=!1;for(let[c,d]of Object.entries(e.value.value.schemas))d.type==="primitive"&&d.schema.type==="string"&&(o=!0),d.type==="literal"&&d.value.type==="string"&&(wno.test(d.value.value)?a.push(d.value.value):a.push({value:d.value.value,name:jno(d.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:`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[c,d]=e.value.value.schemas;if(c!=null&&d!=null&&ixs({array:c,primitive:d}))return{value:kD({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:d,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(c!=null&&d!=null&&ixs({array:d,primitive:c}))return{value:kD({schema:i({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(t.objectQueryParameters)return{value:kD({schema:e,context:t,fileContainingReference:r,declarationFile:ow.of(pF),namespace:n,declarationDepth:0}),allowMultiple:!1};for(let[c,d]of Object.entries(e.value.value.schemas))return $Bf({schema:i({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:d,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:kD({schema:e,context:t,fileContainingReference:r,declarationFile:ow.of(pF),namespace:n,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:kD({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:kD({schema:kj.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:kD({schema:e,context:t,fileContainingReference:r,namespace:n,declarationDepth:0}),allowMultiple:!1}}function ixs({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function gUC(e){return e.type!=null}function OGy({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"]=mUC(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=OUC({context:t,namedFullExamples:e.headers}));for(let n of e.messages){let i=e7i(n.payload);i!=null&&r.messages.push({type:n.messageType,body:i})}return r}function mUC(e){let t={};return e.forEach(r=>{let n=e7i(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function OUC({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),n={};return t.forEach(i=>{let a=e7i(i.value);r.has(i.name)||a!=null&&(n[i.name]=a)}),n}function e7i(e){switch(e.type){case"primitive":return AGy(e.value);case"object":return PGy(e.properties);case"array":return AUC(e.value);case"map":return PUC(e.value);case"oneOf":return wUC(e.value);case"enum":return e.value;case"literal":return jUC(e.value);case"unknown":return e7i(e.value);case"null":return null;default:tc(e)}}function AGy(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:tc(e)}}function PGy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,e7i(r)]))}function AUC(e){return e.map(t=>e7i(t))}function PUC(e){return Object.fromEntries(e.map(t=>[AGy(t.key),e7i(t.value)]))}function wUC(e){return e.type==="discriminated"?PGy(e.value):e7i(e.value)}function jUC(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:tc(e)}}function dPi(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function oxs(e,t){return t??(e?.groupName!=null?dPi(e.groupName):void 0)}function wGy({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=dPi(e.groupName),a={};if(e.handshake.pathParameters.length>0)for(let d of e.handshake.pathParameters)a[d.name]=nxs({pathParameter:d,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 d of e.handshake.queryParameters){let s=axs({queryParameter:d,context:t,fileContainingReference:r,namespace:i});s!=null&&(o[d.name]=s)}Object.keys(o).length>0&&(n["query-parameters"]=o);let c={};if(e.handshake.headers.length>0)for(let d of e.handshake.headers){let s=AVr({header:d,context:t,fileContainingReference:r,namespace:i});c[d.name]=s}Object.keys(c).length>0&&(n.headers=c),t.builder.addChannel(r,{channel:n});for(let d of e.messages)t.builder.addChannelMessage(r,{messageId:d.name,message:{origin:d.origin,body:kD({schema:d.body,context:t,fileContainingReference:r,namespace:i,declarationDepth:0})}});for(let d of e.examples){let s=OGy({context:t,websocketExample:d});t.builder.addChannelExample(r,{example:s})}}function jGy(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var pPi="Base",EUC="Default";function Hla(e){return Object.entries(e).reduce((t,[r,n])=>(vnt(n)?Object.entries(n.urls).forEach(([i,a])=>{t[i]=a}):t[r]=typeof n=="string"?n:n.url,t),{})}function EGy(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=>jGy(T)),i=e.ir.servers;for(let T of i)if(jGy(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 d={},s=[];for(let T of e.ir.websocketServers){let z=T.audiences?{url:T.url,audiences:T.audiences}:T.url;if(T.name==null){s.push(z);continue}d[T.name]=z}let u=Object.keys(t).length,l=u>0,m=Object.keys(o).length>0,A=Object.keys(a).some(T=>a[T]?.length===0),P=Object.keys(d).length>0;if(!l&&!m&&P&&e.ir.servers.length===0){for(let[T,z]of Object.entries(d))e.builder.addEnvironment({name:T,schema:z});e.builder.setDefaultEnvironment(Object.keys(d)[0]),e.builder.setDefaultUrl(pPi);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[EUC]=U}}let C=Object.values(t).map(T=>typeof T=="string"?T:vnt(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),vnt(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:vnt(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:z,schema:{urls:{[pPi]:R??"",...Hla(d)}}})}else e.builder.addEnvironment({name:z,schema:U});e.builder.setDefaultEnvironment(z),T=!1}else if(P){let R=typeof U=="string"?U:vnt(U)?Object.values(U.urls)[0]:U.url;e.builder.addEnvironment({name:z,schema:{urls:{[pPi]:R??"",...Hla(d)}}})}else e.builder.addEnvironment({name:z,schema:U});P&&e.builder.setDefaultUrl(pPi)}else if(u===1){let T=Object.keys(t)[0],z=Object.values(t)[0],U=typeof z=="string"?z:vnt(z)?Object.values(z.urls)[0]:z.url;e.builder.addEnvironment({name:T,schema:{urls:{[pPi]:U??"",...Hla(o),...Hla(d)}}}),e.builder.setDefaultEnvironment(T),e.builder.setDefaultUrl(pPi)}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:vnt(R)?Object.values(R.urls)[0]:R.url;if(!V)continue;let $=V.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",re={[pPi]: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,Hla(d)),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(pPi)}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:vnt(R)?Object.values(R.urls)[0]:R.url;e.builder.addEnvironment({name:U,schema:{urls:{[pPi]:V??"",...Hla(o),...Hla(d)}}})}else e.builder.addEnvironment({name:U,schema:R});z&&(e.builder.setDefaultEnvironment(U),z=!1)}}}}var YBf=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},SUC=.75,DUC=new Set("authorization");function SGy(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?Eno(n.schema):void 0,o=a!=null?dPi(a):void 0,c=ow.of("api.yml");i={name:n.name,env:n.env,type:n.schema!=null?K6(kD({schema:n.schema,context:e,fileContainingReference:o?VX(ow.of(CA(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(DUC.has(a.name.toLowerCase()))continue;let o=r[a.name];if(o==null){let c=t[a.name],d=AVr({header:{...a,schema:c?.schema??a.schema,name:c?.name??a.name},fileContainingReference:ow.of(aee),context:e,namespace:void 0});o=new YBf(d),r[a.name]=o}o.increment()}let n=e.ir.endpoints.length*SUC;for(let[i,a]of Object.entries(r)){let o=t[i],c=a.count===e.ir.endpoints.length,d=a.count>=n;o==null&&(c?e.builder.addGlobalHeader({name:i,schema:a.schema}):d&&e.builder.addGlobalHeader({name:i,schema:Wla(a.schema)}))}}}function DGy(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?Eno(t.schema):void 0,n=r!=null?dPi(r):void 0,i=AVr({header:{...t,schema:t.schema??kj.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:Oq.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:ow.of(aee),context:e,namespace:n});e.builder.addIdempotencyHeader({name:t.header,schema:Wla(i)})}}function mwe(e){switch(e.type){case"primitive":return IGy(e.value);case"object":return MGy(e.properties);case"array":return BGy(e.value);case"map":return IUC(e.value);case"oneOf":return MUC(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return BUC(e.value);case"unknown":return mwe(e.value);case"null":return null;default:tc(e)}}function CGy(e){switch(e.type){case"withStreaming":return e.sse?{stream:CUC(e.events)}:{stream:BGy(e.events)};case"withoutStreaming":return{body:mwe(e.value)};default:tc(e)}}function IGy(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:tc(e)}}function MGy(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,mwe(r)]))}function CUC(e){return e.map(t=>({event:"",data:mwe(t)}))}function BGy(e){return e.map(t=>mwe(t))}function IUC(e){return Object.fromEntries(e.map(t=>[IGy(t.key),mwe(t.value)]))}function MUC(e){return e.type==="discriminated"?MGy(e.value):mwe(e.value)}function BUC(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:tc(e)}}function TGy({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"]=TUC(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=qUC(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 d of e.headers)d.name!==t.builder.getAuthHeaderName()&&c.push(d);for(let[d,s]of Object.entries(i))if(!o.has(d))if(s!=null&&typeof s=="object"&&s.type!=null){let u=gee({type:s.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:Hc}});u!=null&&c.push({name:d,value:AS.literal(U2i.string(u))})}else c.push({name:d,value:AS.primitive(wO.string(d))});r.headers=RUC({context:t,namedFullExamples:c})}return e.request!=null&&(r.request=mwe(e.request)),e.response!=null&&(r.response=CGy(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(Zw)),r}function TUC(e){let t={};return e.forEach(r=>{let n=mwe(r.value);n!=null&&(t[r.parameterNameOverride??r.name]=n)}),t}function qUC(e){let t={};return e.forEach(r=>{let n=mwe(r.value);Array.isArray(n)?t[r.name]=n[0]:n!=null&&(t[r.name]=n)}),t}function RUC({context:e,namedFullExamples:t}){let r={};return t.forEach(n=>{let i=mwe(n.value);i!=null&&(r[n.name]=i)}),r}function qGy(e){return Kde._visit(e,{get:()=>$X.HttpMethodSchema.Get,post:()=>$X.HttpMethodSchema.Post,put:()=>$X.HttpMethodSchema.Put,patch:()=>$X.HttpMethodSchema.Patch,delete:()=>$X.HttpMethodSchema.Delete,head:()=>$X.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 RGy(e){return e==="POST"||e==="PUT"||e==="PATCH"}function NGy({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:n}=r.ir,i=[],a=new Set,o=e.path,c=oxs(e.sdkName,e.namespace),d={};for(let M of e.pathParameters)M.parameterNameOverride&&(o=o.replace(M.name,M.parameterNameOverride)),d[M.parameterNameOverride??M.name]=nxs({pathParameter:M,context:r,fileContainingReference:t,namespace:c}),a.add(M.name);let s={};for(let M of e.queryParameters){let T=axs({queryParameter:M,context:r,fileContainingReference:t,namespace:c});T!=null&&(s[M.name]=T,a.add(M.name))}let u;if(e.pagination!=null)switch(e.pagination.type){case"cursor":u={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":u={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":u={type:"custom",results:e.pagination.results};break;default:tc(e.pagination)}let l={path:o,method:qGy(e.method),auth:Object.keys(e.security).length>0?e.security:void 0,docs:e.description??void 0,pagination:u,source:e.source!=null?fPi(e.source):void 0};!zUC({context:r,request:e.request})&&Object.keys(d).length>0&&(l["path-parameters"]=d),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=AVr({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(hse.Request);let M=xUC({endpoint:e,context:r,declarationFile:t,request:e.request,generatedRequestName:e.generatedRequestName,requestNameOverride:e.requestNameOverride??void 0,pathParameters:r.inlinePathParameters&&Object.keys(d).length>0?d:void 0,queryParameters:Object.keys(s).length>0?s: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(hse.Request)}else{let M=r.inlinePathParameters&&Object.keys(d).length>0,T=Object.keys(s).length>0,z=Object.keys(m).length>0,U={};(M||T||z)&&(U.name=e.requestNameOverride??e.generatedRequestName),M&&(U["path-parameters"]=d),T&&(U["query-parameters"]=s),z&&(U.headers=m),Object.keys(U).length>0&&(l.request=U)}if(e.response!=null&&e.response._visit({json:M=>{let T=kD({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l.response={docs:M.description??void 0,type:K6(T)},M.statusCode!=null&&(l.response["status-code"]=M.statusCode),M.responseProperty!=null&&(l.response.property=M.responseProperty)},streamingJson:M=>{let T=kD({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:K6(T),format:"json"}},streamingSse:M=>{let T=kD({schema:M.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:M.description??void 0,type:K6(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=RJ(e.availability)),Object.entries(e.errors).forEach(([M,T])=>{let z=T.generatedName,U=ow.of(pF);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=cGy({location:FGy,namespaceOverride:c});if(T.schema!=null){let Y=kD({schema:T.schema,context:r,fileContainingReference:V,declarationFile:V,namespace:c,declarationDepth:0});R.type=K6(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:mwe(Y.example),name:Y.name,docs:Y.description};r.builder.addErrorExample(V,{name:z,example:te})})}),e.examples.length>0&&(l.examples=NUC({endpointExamples:e.examples,context:r})),e.retries!=null&&(l.retries=FUC({retries:e.retries})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[XBf,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:i}}function NUC({endpointExamples:e,context:t}){return e.map(r=>{try{return TGy({endpointExample:r,context:t})}catch(n){throw console.error(`Error building endpoint example: ${n}`),n}})}function FUC({retries:e}){if(e!=null)switch(e.type){case"disabled":return{disabled:e.value??void 0};default:tc(e)}}function xUC({endpoint:e,declarationFile:t,context:r,request:n,requestNameOverride:i,generatedRequestName:a,pathParameters:o,queryParameters:c,nonRequestReferencedSchemas:d,headers:s,usedNames:u,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&&d.includes(m)){let z=kD({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(s??{}).length>0;return R&&(U.value["path-parameters"]=o),V&&(U.value["query-parameters"]=c),$&&(U.value.headers=s),(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:!(RGy(e.method)&&z.readonly)).map(z=>{let U=kD({schema:z.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:1}),R=z.nameOverride??z.key,V=RJ(z.availability);if(!u.has(R)&&z.audiences.length<=0)return u.add(R),z.nameOverride!=null?[z.key,{type:K6(U),docs:Sno(U),name:z.nameOverride,availability:V}]:[z.key,V?{...typeof U=="string"?{type:U}:U,availability:V}:U];let $={type:K6(U),docs:Sno(U)};return u.has(R)&&($.name=z.generatedName),z.audiences.length>0&&($.audiences=z.audiences),V!=null&&($.availability=V),u.add(R),[z.key,$]})),C=A.allOf.map(z=>{let U=kD({schema:kj.reference(z),fileContainingReference:t,context:r,namespace:l,declarationDepth:0});return K6(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:s,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??z7.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=kD({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:s,body:{properties:m},"content-type":z7.MULTIPART_FORM_DATA,...n.description?{docs:n.description}:{}}}}else tc(n)}function zUC({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:tc(t)}}function QUC({location:e,namespaceOverride:t}){return t!=null?{...e,file:VX(ow.of(t),e.file)}:e}function LUC(e){let t=e.namespace,r=e.tags.filter(d=>d!==t)[0],n=e.operationId;if(n==null)return r!=null?{file:ow.of(`${CA(r)}.yml`),endpointId:e.summary!=null?CA(e.summary):CA(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:ow.of(pF),endpointId:CA(e.summary)}:{file:ow.of(pF),endpointId:CA(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:ow.of(pF),endpointId:n};let i=WXo(r),a=WXo(n);if(xue(i,a))return{file:ow.of("__package__.yml"),endpointId:r};let o=WUC({operationId:n,tag:r,path:e.path,method:e.method});if(o!=null)return o;let c=[];for(let d=0;d<i.length;++d){let s=i[d];if(s!=null&&s===a[d])c.push(s);else{let u=CA(r);return{file:ow.of(`${u}.yml`),endpointId:n,tag:r}}}if(c.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:ow.of(CA(c.join("_"))+".yml"),endpointId:CA(a.slice(c.length).join("_")),tag:r}}function HXo(e){let t=e.tags[0];if(e.sdkName!=null){let r=RBf({sdkName:e.sdkName,namespaceOverride:e.namespace}),n=`${r}.yml`,i=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:ow.of(n),endpointId:e.sdkName.methodName,tag:i?t:void 0}}return QUC({namespaceOverride:e.namespace,location:LUC(e)})}function WXo(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=_pt(t),t}var UUC=new RegExp("[^a-zA-Z0-9{}]+"),VUC=new RegExp("[{}]","g");function WUC({operationId:e,tag:t,path:r,method:n}){let a=`${r.split(UUC).join("_").replaceAll(VUC,"_")}_${n.toLowerCase()}`;if(e.endsWith(a))return{file:ow.of(CA(t)+".yml"),endpointId:CA(e.slice(0,-1*a.length)),tag:t}}function xGy(e){let t=new Set,{endpoints:r,tags:n}=e.ir,i=[];for(let a of r){let{endpointId:o,file:c,tag:d}=HXo(a),s=c.split(".")[0];s!=null&&t.add(s);let u;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){u=A[C];break}}}let l=d==null?void 0:n.tagsById[d];e.setInState(hse.Endpoint),e.setEndpointMethod(a.method);let m=NGy({context:e,endpoint:a,declarationFile:c});e.unsetEndpointMethod(),e.unsetInState(hse.Endpoint),i=[...i,...m.schemaIdsToExclude],e.builder.addEndpoint(c,{name:o,schema:m.value,source:a.source!=null?fPi(a.source):void 0}),(l?.id!=null||l?.description!=null)&&e.builder.setServiceInfo(c,{"display-name":u?.summary??l?.id,docs:u?.description??l?.description??void 0})}return{schemaIdsToExclude:i,sdkGroups:t}}function zGy(e){for(let[t,r]of Object.entries(e.ir.variables)){let n=r.groupName!=null?dPi(r.groupName):void 0,i=kD({schema:kj.primitive(r),context:e,fileContainingReference:ow.of(pF),namespace:n,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:K6(i),docs:r.description??void 0}})}}function QGy(e){for(let t of e.ir.webhooks){let r=JUC({webhook:t,context:e});if(r==null)continue;let n=oxs(t.sdkName,t.namespace),i={};for(let o of t.headers)i[o.name]=AVr({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:kD({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:mwe(o.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function HUC({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:VX(ow.of(t),e.file)}:e}function GUC({webhook:e,context:t}){let r=e.tags[0],n=e.operationId;if(r==null)return{file:ow.of(pF),endpointId:n};let i=WXo(r),a=WXo(n);if(xue(i,a))return{file:ow.of("__package__.yml"),endpointId:r};let o=[];for(let c=0;c<i.length;++c){let d=i[c];if(d!=null&&d===a[c])o.push(d);else{let s=CA(r);return{file:ow.of(`${s}.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:ow.of(CA(o.join("_"))+".yml"),endpointId:CA(a.slice(o.length).join("_")),tag:r}}function JUC({webhook:e,context:t}){return e.sdkName!=null?{file:sGy({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:HUC({namespaceOverride:e.namespace,location:GUC({webhook:e,context:t})})}var KUC=ow.of(pF);function UGy(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":return LGy({namespace:e.namespace,groupName:e.groupName});case"oneOf":return LGy({namespace:e.value.namespace,groupName:e.value.groupName});case"unknown":return KUC;default:tc(e)}}function LGy({namespace:e,groupName:t}){return e!=null&&t!=null?k2i([{type:"namespace",name:e},...t]):e!=null?k2i([{type:"namespace",name:e}]):k2i(t)}var XBf="external",FGy=ow.of(pF);function VGy({schemas:e,schemaIdsToExclude:t,namespace:r,context:n}){for(let[i,a]of Object.entries(e)){if(t.includes(i))continue;let o=UGy(a),c=hGy({schema:a,context:n,declarationFile:o,namespace:r,declarationDepth:0});if(Jzi(c.schema)){let d=K6(c.schema);if(d===(c.name??i)||d===`optional<${c.name??i}>`||d===`nullable<${c.name??i}>`||d===`optional<nullable<${c.name??i}>>`)continue}n.builder.addType(o,{name:c.name??i,schema:c.schema})}}function WGy(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),EGy(e),SGy(e),DGy(e),mGy(e),zGy(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(XBf);let t=xGy(e),r=t.sdkGroups;e.setInState(hse.Webhook),QGy(e),e.unsetInState(hse.Webhook),e.setInState(hse.Channel);for(let i of Object.values(e.ir.channels)){let a=k2i(i.groupName);wGy({channel:i,context:e,declarationFile:a})}e.unsetInState(hse.Channel);let n=$UC({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});VGy({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:n,namespace:void 0,context:e});for(let[i,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))VGy({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 $UC({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 GXo=class{context;constructor(t){this.context=t}};var uxs=class e{files={};directories={};getAllFiles(){let t={},r=(n,i)=>{for(let[o,c]of Object.entries(n.files)){let d=i!=null?ow.of(`${i}${"/"}${o}`):ow.of(o);t[d]=c}let a=Object.keys(n.directories).sort();for(let o of a){let c=i!=null?`${i}${"/"}${o}`:o,d=n.directories[o];r(d,c)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[ow.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 Gla=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new uxs,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 MLr(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"]))HGy(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(HGy(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??CA((Dpt(r)+"/"+xaa(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===ow.of(aee))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[i]=xas(Dpt(iJa.of(`/${t}`)),iJa.of(`/${r}`)),i;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[i]=xas(Dpt(iJa.of(`/${t}`)),iJa.of(`/${r}`)),i}addType(t,{name:r,schema:n}){if(t===ow.of(aee))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=>xue(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=VX(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:VX(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:VX(r,o.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===pF?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 HGy(e){return e?.header!=null}var sxs=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;detectGlobalHeaders;objectQueryParameters;respectReadonlySchemas;respectNullableSchemas;onlyIncludeReferencedSchemas;inlinePathParameters;useBytesForBinaryResponse;respectForwardCompatibleEnums;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;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.wrapReferencesToNullableInOptional=n?.wrapReferencesToNullableInOptional??!0,this.coerceOptionalSchemasToNullable=n?.coerceOptionalSchemasToNullable??!0,this.builder=new Gla(this.enableUniqueErrorsPerEndpoint),r.title!=null&&this.builder.setDisplayName({displayName:r.title});let c={};if(!this.enableUniqueErrorsPerEndpoint)for(let d of r.endpoints)for(let[s,u]of Object.entries(d.errors)){let l=parseInt(s),m=c[l];m==null&&u.schema!=null?c[l]=u.schema:m!=null&&u.schema!=null&&u3e(m,u.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(hse.Channel,hse.Endpoint,hse.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:tc(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:tc(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 ZBf(e){let t=new sxs(e);return WGy(t)}var cxs=class{args;constructor(t){this.args=t}convert({context:t,ir:r,settings:n,absoluteFilePath:i}){let a=ZBf({taskContext:t,ir:r,options:RXo({overrides:{...n,respectReadonlySchemas:n?.respectReadonlySchemas??this.args.respectReadonlySchemas,respectNullableSchemas:n?.respectNullableSchemas??this.args.respectNullableSchemas,wrapReferencesToNullableInOptional:n?.wrapReferencesToNullableInOptional??this.args.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:n?.coerceOptionalSchemasToNullable??this.args.coerceOptionalSchemasToNullable,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:Vg.dump(a.rootApiFile)},namedDefinitionFiles:{...yg(a.definitionFiles,o=>({absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Vg.dump(o),contents:o})),[ow.of(pF)]:{absoluteFilepath:i??this.args.absoluteFilePath,rawContents:Vg.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var JXo=class extends jqr{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;wrapReferencesToNullableInOptional;coerceOptionalSchemasToNullable;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;resolveAliases;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.wrapReferencesToNullableInOptional=t.wrapReferencesToNullableInOptional,this.coerceOptionalSchemasToNullable=t.coerceOptionalSchemasToNullable,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.resolveAliases=t.resolveAliases,this.converter=new cxs(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 knt({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:n,cliVersion:this.cliVersion})}};var Hbe={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 Dno={of(e){return e}};var GGy={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},kBf={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:GGy,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},wb={SOURCE:Dno.of("source"),SDK_NAMESPACE:Dno.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:Dno.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:Dno.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:Dno.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 FV={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,resolveAliases:!1,groupMultiApiEnvironments:!1,wrapReferencesToNullableInOptional:!0,coerceOptionalSchemasToNullable:!0};function byt({options:e,overrides:t}){return{disableExamples:t?.disableExamples??FV.disableExamples,discriminatedUnionV2:t?.discriminatedUnionV2??e?.discriminatedUnionV2??FV.discriminatedUnionV2,useTitlesAsName:t?.useTitlesAsName??e?.useTitlesAsName??FV.useTitlesAsName,audiences:t?.audiences??e?.audiences??FV.audiences,optionalAdditionalProperties:t?.optionalAdditionalProperties??e?.optionalAdditionalProperties??FV.optionalAdditionalProperties,coerceEnumsToLiterals:t?.coerceEnumsToLiterals??e?.coerceEnumsToLiterals??FV.coerceEnumsToLiterals,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??FV.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??FV.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??FV.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??FV.inlinePathParameters,preserveSchemaIds:t?.preserveSchemaIds??FV.preserveSchemaIds,shouldUseUndiscriminatedUnionsWithLiterals:t?.shouldUseUndiscriminatedUnionsWithLiterals??e?.shouldUseUndiscriminatedUnionsWithLiterals??FV.shouldUseUndiscriminatedUnionsWithLiterals,shouldUseIdiomaticRequestNames:t?.shouldUseIdiomaticRequestNames??e?.shouldUseIdiomaticRequestNames??FV.shouldUseIdiomaticRequestNames,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??FV.objectQueryParameters,filter:t?.filter??e?.filter??FV.filter,asyncApiNaming:t?.asyncApiNaming??e?.asyncApiNaming??FV.asyncApiNaming,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??FV.useBytesForBinaryResponse,exampleGeneration:t?.exampleGeneration??e?.exampleGeneration??void 0,defaultFormParameterEncoding:t?.defaultFormParameterEncoding??e?.defaultFormParameterEncoding??void 0,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??FV.respectForwardCompatibleEnums,additionalPropertiesDefaultsTo:t?.additionalPropertiesDefaultsTo??e?.additionalPropertiesDefaultsTo??FV.additionalPropertiesDefaultsTo,typeDatesAsStrings:t?.typeDatesAsStrings??e?.typeDatesAsStrings??FV.typeDatesAsStrings,preserveSingleSchemaOneOf:t?.preserveSingleSchemaOneOf??e?.preserveSingleSchemaOneOf??FV.preserveSingleSchemaOneOf,inlineAllOfSchemas:t?.inlineAllOfSchemas??e?.inlineAllOfSchemas??FV.inlineAllOfSchemas,resolveAliases:t?.resolveAliases??e?.resolveAliases??FV.resolveAliases,groupMultiApiEnvironments:t?.groupMultiApiEnvironments??e?.groupMultiApiEnvironments??FV.groupMultiApiEnvironments,wrapReferencesToNullableInOptional:t?.wrapReferencesToNullableInOptional??e?.wrapReferencesToNullableInOptional??FV.wrapReferencesToNullableInOptional,coerceOptionalSchemasToNullable:t?.coerceOptionalSchemasToNullable??e?.coerceOptionalSchemasToNullable??FV.coerceOptionalSchemasToNullable}}var JGy={naming:"v1"};function Jy(e,t){let r=Array.isArray(t)?t:[t];for(let n of r){let i=e[n];if(i!=null)return i}}function KXo(e,t,r,n,i=[]){try{let a=Jy(e,t);if(a!=null)return r.parse(a)}catch{let o=_pt(i).join(" -> ");n.error(`${o.length>0?`${o}: `:""}Failed to parse ${t}`)}}function Jla(e){let t=Jy(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 KGy({schema:e,logger:t}){return Jy(e,wb.ENCODING)??void 0}function $Gy(e){return Jy(e,wb.FERN_ENUM)}function YGy({nameOverride:e,generatedName:t,title:r,schema:n,description:i,availability:a}){let o=Jy(n,wb.SDK_NAMESPACE),c=Jy(n,wb.SDK_GROUP_NAME),d=Jy(n,wb.TYPE_DEFINITION);if(d!=null)return $Xo({fernType:d,nameOverride:e,generatedName:t,title:r,description:i,availability:a,namespace:o,groupName:typeof c=="string"?[c]:c})}function $Xo({fernType:e,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c}){return gee({type:e,_default:void 0,validation:void 0,visitor:{primitive:d=>{switch(d.v1){case"BASE_64":return Oh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:L0.base64({example:void 0})});case"BOOLEAN":return Oh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:L0.boolean({default:void 0,example:void 0})});case"DATE":return Oh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:L0.date({example:void 0})});case"DATE_TIME":return Oh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:L0.datetime({example:void 0})});case"FLOAT":return Oh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:L0.float({example:void 0})});case"DOUBLE":return Oh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:L0.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 Oh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:L0.uint({default:void 0,example:void 0})});case"INTEGER":return Oh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:L0.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 Oh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:L0.uint64({default:void 0,example:void 0})});case"LONG":return Oh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:L0.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return Oh.primitive({nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,schema:L0.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:tc(d.v1)}},unknown:()=>Oh.unknown({nameOverride:t,generatedName:r,title:n,example:void 0,description:i,availability:a,namespace:o,groupName:c}),map:({keyType:d,valueType:s})=>d?.type==="primitive"&&s!=null?Oh.map({nameOverride:t,generatedName:r,title:n,key:d,value:s,description:i,availability:a,namespace:o,groupName:c,encoding:void 0,example:void 0,inline:void 0}):void 0,list:d=>d!=null?Oh.array({nameOverride:t,generatedName:r,title:n,value:d,description:i,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,optional:d=>d!=null?Oh.optional({nameOverride:t,generatedName:r,title:n,value:d,description:i,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,nullable:d=>d!=null?Oh.nullable({nameOverride:t,generatedName:r,title:n,value:d,description:i,availability:a,namespace:o,groupName:c,inline:void 0}):void 0,set:d=>d!=null?Oh.array({nameOverride:t,generatedName:r,title:n,value:d,description:i,availability:a,namespace:o,groupName:c,example:void 0,inline:void 0}):void 0,literal:d=>Oh.literal({nameOverride:t,generatedName:r,title:n,value:d._visit({string:s=>NV.string(s),boolean:s=>NV.boolean(s),_other:()=>{throw new Error("Unexpected literal type")}}),description:i,availability:a,namespace:o,groupName:c}),named:d=>Oh.reference({schema:d,nameOverride:t,generatedName:r,title:n,description:i,availability:a,namespace:o,groupName:c,source:bwe.openapi({file:"<memory>"})})}})}function XGy(e){let t=Jy(e,wb.SOURCE);if(t!=null)return t.endsWith(".proto")?bwe.protobuf({file:t}):bwe.openapi({file:t})}function Kla(e){if(e!=null&&typeof e=="boolean")return e}function Xg(e){return e?.$ref!=null}function ZGy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,additionalProperties:i,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:d,context:s,namespace:u,groupName:l,example:m,encoding:A,source:P}){return i===void 0&&(i=s.options.additionalPropertiesDefaultsTo),eTf({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:d,description:a,availability:o,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:L0.string({default:void 0,pattern:void 0,format:void 0,minLength:void 0,maxLength:void 0,example:void 0}),namespace:void 0,groupName:void 0},valueSchema:typeof i=="boolean"||YXo(i,s.options)?Oh.unknown({...YUC(i),generatedName:`${t}Value`}):kGy(wS(i,!1,s.options.optionalAdditionalProperties?d:!1,s,[...n,"Value"],P,u,void 0,void 0,void 0)),namespace:u,groupName:l,example:m,encoding:A})}function kGy(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=kGy(e.value);break;case"oneOf":e.value.inline=!0;break;default:tc(e)}return e}function eTf({nameOverride:e,generatedName:t,title:r,keySchema:n,valueSchema:i,wrapAsOptional:a,wrapAsNullable:o,description:c,availability:d,namespace:s,groupName:u,example:l,encoding:m}){let A=Oh.map({nameOverride:e,generatedName:t,title:r,description:c,availability:d,key:n,value:i,namespace:s,groupName:u,encoding:m,example:l,inline:void 0});return o&&(A=Oh.nullable({nameOverride:e,generatedName:t,title:r,value:A,description:c,availability:d,namespace:s,groupName:u,inline:void 0})),a&&(A=Oh.optional({nameOverride:e,generatedName:t,title:r,value:A,description:c,availability:d,namespace:s,groupName:u,inline:void 0})),A}function YXo(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:!(Xg(e)||"type"in e&&e.type!=null||"oneOf"in e&&e.oneOf!=null||"anyOf"in e&&e.anyOf!=null||"allOf"in e&&e.allOf!=null||"enum"in e&&e.enum!=null)}function YUC(e){let t={nameOverride:void 0,generatedName:"",title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0};return e==null||typeof e=="boolean"||Xg(e)||typeof e!="object"||(e.title!=null&&(t.title=e.title),e.description!=null&&(t.description=e.description)),t}function eJy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,item:i,description:a,availability:o,wrapAsOptional:c,wrapAsNullable:d,context:s,namespace:u,groupName:l,example:m,source:A}){let P=i==null?Oh.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:u,groupName:l}):wS(i,!1,!1,s,[...n,"Item"],A,u);return XUC({nameOverride:e,generatedName:t,title:r,namespace:u,groupName:l,itemSchema:P,wrapAsOptional:c,wrapAsNullable:d,description:a,availability:o,example:m})}function XUC({nameOverride:e,generatedName:t,title:r,itemSchema:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,namespace:d,groupName:s,example:u}){let l=Oh.array({nameOverride:e,generatedName:t,title:r,value:n,description:o,availability:c,namespace:d,groupName:s,example:u,inline:void 0});return a&&(l=Oh.nullable({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:d,groupName:s,inline:void 0})),i&&(l=Oh.optional({nameOverride:e,generatedName:t,title:r,value:l,description:o,availability:c,namespace:d,groupName:s,inline:void 0})),l}function Owe(e){switch(Jy(e,wb.AVAILABILITY)){case"deprecated":return Gde.Deprecated;case"beta":return Gde.Beta;case"generally-available":return Gde.GenerallyAvailable;default:break}if(!Xg(e)&&e.deprecated)return Gde.Deprecated}function tTf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:o,required:c,wrapAsOptional:d,wrapAsNullable:s,discriminator:u,context:l,namespace:m,groupName:A,encoding:P,source:C}){let M=u.propertyName,T=Object.fromEntries(Object.entries(u.mapping??{}).map(([U,R])=>{let V=_Pi({$ref:R},!1,!1,l,[R],P,C,m);return l.markReferencedByDiscriminatedUnion({$ref:R},M,1),[U,V]})),z=Object.entries(i).filter(([U])=>U!==M).map(([U,R])=>{let V=c!=null&&c.includes(U),[$,re]=l.options.coerceOptionalSchemasToNullable?[!1,!V]:[!V,!1],Y=wS(R,$,re,l,[...n,U],C,m);return{key:U,schema:Y}});return tJy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:d,wrapAsNullable:s,properties:z,description:a,availability:o,discriminant:M,subtypes:T,namespace:m,groupName:A,source:C})}function rTf({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,availability:o,required:c,wrapAsOptional:d,wrapAsNullable:s,discriminant:u,variants:l,context:m,namespace:A,groupName:P,encoding:C,source:M}){let T=Object.fromEntries(Object.entries(l).map(([U,R])=>{if(Xg(R)){let V=_Pi(R,!1,!1,m,[R.$ref],C,M,A);return m.markReferencedByDiscriminatedUnion(R,u,1),[U,V]}else{let V=Cno(R,!1,!1,m,[...n,U],C,M,A,new Set([u]));return[U,V]}})),z=Object.entries(i).filter(([U])=>U!==u).map(([U,R])=>{let V=c!=null&&c.includes(U),[$,re]=m.options.coerceOptionalSchemasToNullable?[!1,!V]:[!V,!1],Y=wS(R,$,re,m,[...n,U],M,A);return{key:U,schema:Y}});return tJy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:d,wrapAsNullable:s,properties:z,description:a,availability:o,discriminant:u,subtypes:T,namespace:A,groupName:P,source:M})}function tJy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:a,description:o,availability:c,discriminant:d,subtypes:s,namespace:u,groupName:l,source:m}){let A=Oh.oneOf(tit.discriminated({description:o,availability:c,discriminantProperty:d,nameOverride:e,generatedName:t,title:r,schemas:s,commonProperties:a,namespace:u,groupName:l,encoding:void 0,source:m,inline:void 0}));return i&&(A=Oh.nullable({nameOverride:e,generatedName:t,title:r,value:A,namespace:u,groupName:l,description:o,availability:c,inline:void 0})),n&&(A=Oh.optional({nameOverride:e,generatedName:t,title:r,value:A,namespace:u,groupName:l,description:o,availability:c,inline:void 0})),A}function rJy(e){if(e.proto!=null)return Jro.protobuf({typeName:e.proto.type})}function t7i({nameOverride:e,generatedName:t,title:r,fernEnum:n,enumVarNames:i,enumValues:a,_default:o,description:c,availability:d,wrapAsOptional:s,wrapAsNullable:u,namespace:l,groupName:m,context:A,source:P,inline:C}){let M=kUC(i??[]),T=new Set(a),z=Array.from(T).map((R,V)=>{let $=n?.[R],re=M[V],Y=wno.test(R),te=$?.name??re,ne=Y?R:jno(R);return te!=null&&!wno.test(te)&&(A?.logger.warn(`Enum name override ${te} is not a valid name. Falling back on ${ne}.`),te=void 0),{nameOverride:te,generatedName:ne,value:R,description:$?.description,availability:d,casing:{snake:$?.casing?.snake??void 0,pascal:$?.casing?.pascal??void 0,screamingSnake:$?.casing?.screamingSnake??void 0,camel:$?.casing?.camel??void 0}}}),U=o!=null?z.find(R=>R.value===o):void 0;return ZUC({wrapAsOptional:s,wrapAsNullable:u,nameOverride:e,generatedName:t,title:r,values:z,_default:U,description:c,availability:d,namespace:l,groupName:m,source:P,inline:C})}function ZUC({wrapAsOptional:e,wrapAsNullable:t,nameOverride:r,generatedName:n,title:i,values:a,_default:o,description:c,availability:d,namespace:s,groupName:u,source:l,inline:m}){let A=Oh.enum({nameOverride:r,generatedName:n,title:i,values:a,description:c,availability:d,default:o,example:void 0,namespace:s,groupName:u,source:l,inline:m});return t&&(A=Oh.nullable({nameOverride:r,generatedName:n,title:i,value:A,description:c,availability:d,namespace:s,groupName:u,inline:m})),e&&(A=Oh.optional({nameOverride:r,generatedName:n,title:i,value:A,description:c,availability:d,namespace:s,groupName:u,inline:m})),A}function kUC(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 nJy({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,description:u,availability:l,wrapAsOptional:m,wrapAsNullable:A,example:P,namespace:C,groupName:M}){return n==="int64"?yse({nameOverride:e,generatedName:t,title:r,primitive:L0.int64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:M}):n==="uint32"?yse({nameOverride:e,generatedName:t,title:r,primitive:L0.uint({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:M}):n==="uint64"?yse({nameOverride:e,generatedName:t,title:r,primitive:L0.uint64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:M}):yse({nameOverride:e,generatedName:t,title:r,primitive:L0.int({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:M})}function e9C(e){return typeof e=="string"?NV.string(e):typeof e=="boolean"?NV.boolean(e):NV.string(`${e}`)}function iJy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,value:a,description:o,availability:c,namespace:d,groupName:s}){let u=Oh.literal({nameOverride:e,generatedName:t,title:r,value:e9C(a),description:o,availability:c,namespace:d,groupName:s});return i&&(u=Oh.nullable({nameOverride:e,generatedName:t,title:r,value:u,description:o,availability:c,namespace:d,groupName:s,inline:void 0})),n&&(u=Oh.optional({nameOverride:e,generatedName:t,title:r,value:u,description:o,availability:c,namespace:d,groupName:s,inline:void 0})),u}function nTf({nameOverride:e,generatedName:t,title:r,format:n,_default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,description:u,availability:l,wrapAsOptional:m,wrapAsNullable:A,example:P,namespace:C,groupName:M}){return n==null||n==="double"?yse({nameOverride:e,generatedName:t,title:r,primitive:L0.double({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:M}):n==="float"?yse({nameOverride:e,generatedName:t,title:r,primitive:L0.float({example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:M}):n==="int32"?yse({nameOverride:e,generatedName:t,title:r,primitive:L0.int({default:i,minimum:a,maximum:o,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:M}):n==="int64"?yse({nameOverride:e,generatedName:t,title:r,primitive:L0.int64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:M}):n==="uint32"?yse({nameOverride:e,generatedName:t,title:r,primitive:L0.uint({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:M}):n==="uint64"?yse({nameOverride:e,generatedName:t,title:r,primitive:L0.uint64({default:i,example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:M}):n==="time-delta"?yse({nameOverride:e,generatedName:t,title:r,primitive:L0.float({example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:M}):yse({nameOverride:e,generatedName:t,title:r,primitive:L0.float({example:P}),wrapAsOptional:m,wrapAsNullable:A,description:u,availability:l,namespace:C,groupName:M})}var t9C={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},r9C={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}}},n9C={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}}},i9C={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},a9C={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},o9C={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},u9C={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},s9C={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function XXo(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],n=[t9C,r9C,n9C,i9C,a9C,o9C,u9C,s9C],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 Nie(e,t){let n=e.map(i=>/^[^a-zA-Z0-9]+$/.test(i)?i:n9(CA(i))).join("");return/^\d/.test(n)?LXo(n)??n:n}function aJy(e){let t=e.join("_");return CA(t)}function L4(e){switch(e.type){case"object":return kj.object({allOf:e.allOf,properties:e.properties.map(t=>l9C(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 kj.array({description:e.description,availability:e.availability,value:L4(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"enum":return kj.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 kj.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 kj.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:L4(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return kj.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:L4(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return kj.primitive({description:e.description,availability:e.availability,schema:oJy(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return kj.map({description:e.description,availability:e.availability,key:kj.primitive({description:e.key.description,availability:e.key.availability,schema:oJy(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:L4(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 kj.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 kj.oneOf(c9C(e.value));case"unknown":return kj.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:tc(e)}}function c9C(e){switch(e.type){case"discriminated":return vVr.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:L4(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,L4(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return vVr.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>L4(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:tc(e)}}function oJy(e){switch(e.type){case"string":return Oq.string(e);case"base64":return Oq.base64();case"boolean":return Oq.boolean(e);case"date":return Oq.date();case"datetime":return Oq.datetime();case"double":return Oq.double(e);case"float":return Oq.float();case"int":return Oq.int(e);case"int64":return Oq.int64(e);case"uint":return Oq.uint();case"uint64":return Oq.uint64();default:tc(e)}}function l9C(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:L4(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function lxs(e,t){return u3e(L4(e),L4(t))}function uJy({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,properties:i,description:a,required:o,wrapAsOptional:c,wrapAsNullable:d,allOf:s,context:u,propertiesToExclude:l,namespace:m,groupName:A,fullExamples:P,additionalProperties:C,availability:M,source:T}){let z=[...o??[]],U={...i},R=[],V=[];for(let ne of s)if(!u.options.inlineAllOfSchemas&&Xg(ne)){let Oe=u.resolveSchemaReference(ne);if(Oe.discriminator!=null&&Oe.discriminator.mapping!=null)continue;if(Oe.oneOf!=null||Oe.anyOf!=null){let ve=Oe.oneOf??Oe.anyOf;if(ve!=null){for(let be of ve){let Me=Xg(be)?u.resolveSchemaReference(be):be,Be=wS(Me,!1,!1,u.DUMMY,n,T,m);Be.type==="object"&&R.push(...Be.properties.map(Se=>Se.schema.type!=="optional"&&Se.schema.type!=="nullable"?{...Se,schema:Oh.optional({nameOverride:void 0,generatedName:"",title:void 0,value:Se.schema,description:void 0,availability:Se.availability,namespace:void 0,groupName:void 0,inline:void 0})}:Se))}continue}}let ge=r7i(ne);if(ge==null)continue;V.push({schemaId:ge,convertedSchema:iTf(ne,[ge],T,u.options.preserveSchemaIds),properties:sJy({schema:ne,context:u,breadcrumbs:n,source:T,namespace:m})}),u.markSchemaAsReferencedByNonRequest(ge)}else if(Xg(ne)){let Oe=u.resolveSchemaReference(ne),ge=wS(Oe,!1,!1,u,n,T,m);ge.type==="object"&&R.push(...ge.properties)}else{let Oe=ne.required??[];R=R.map(ve=>(ve.schema.type==="optional"||ve.schema.type==="nullable")&&Oe.includes(ve.key)?{...ve,schema:ve.schema.value}:ve);let ge=wS(ne,!1,!1,u,n,T,m);ge.type==="object"&&R.push(...ge.properties)}let $={};for(let ne of V)for(let[Oe,ge]of Object.entries(ne.properties)){let ve=$[Oe];ve!=null?(ve.schemaIds.push(ne.schemaId),ve.schemas.some(Me=>lxs(Me,ge))||ve.schemas.push(ge)):$[Oe]={schemaIds:[ne.schemaId],schemas:[ge]}}let re=[];for(let[ne,Oe]of Object.entries($))Oe.schemaIds.length>1&&re.push({propertyKey:ne,allOfSchemaIds:Oe.schemaIds,conflictingTypeSignatures:Oe.schemas.length>1});let Y=Object.fromEntries(Object.entries(U).filter(([ne,Oe])=>!(!Xg(Oe)&&Oe.type==="null"))),te=Object.entries(Y).map(([ne,Oe])=>{let ge=Jy(Oe,wb.AUDIENCES)??[],ve=Owe(Oe),be=Xg(Oe)?!1:Oe.readOnly,Me=Xg(Oe)?!1:Oe.writeOnly,Se=!(z.includes(ne)&&!be),St=Jy(Oe,wb.FERN_PROPERTY_NAME),yt=[...n,ne],Re=aJy(yt),De=wS(Oe,Se,!1,u,yt,T,m),Lt={};for(let Xe of V){let Yt=Xe.properties[ne];Yt!=null&&!lxs(De,Yt)?Lt[Xe.schemaId]={differentSchema:!0}:Yt!=null&&(Lt[Xe.schemaId]={differentSchema:!1})}return{key:ne,schema:De,nameOverride:St,audiences:ge,conflict:Lt,generatedName:Re,availability:ve,readonly:be,writeonly:Me}});return te.push(...R.map(ne=>{let Oe=ne.conflict;for(let ge of V){let ve=ge.properties[ne.key];ve!=null&&!lxs(ne.schema,ve)?Oe[ge.schemaId]={differentSchema:!0}:ve!=null&&(Oe[ge.schemaId]={differentSchema:!1})}return{...ne,conflict:Oe}})),f9C({nameOverride:e,generatedName:t,title:r,wrapAsOptional:c,wrapAsNullable:d,properties:te.filter(ne=>!l.has(ne.key)),description:a,allOf:V.map(ne=>ne.convertedSchema),allOfPropertyConflicts:re,namespace:m,groupName:A,fullExamples:P,additionalProperties:C,availability:M,source:T,context:u})}function f9C({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,properties:a,description:o,allOf:c,allOfPropertyConflicts:d,namespace:s,groupName:u,fullExamples:l,additionalProperties:m,availability:A,source:P,context:C}){let M=Oh.object({description:o,properties:a,nameOverride:e,generatedName:t,title:r,allOf:c,allOfPropertyConflicts:d,namespace:s,groupName:u,fullExamples:l,additionalProperties:YXo(m,C.options),availability:A,source:P,inline:void 0});return i&&(M=Oh.nullable({nameOverride:e,generatedName:t,title:r,value:M,description:o,availability:A,namespace:s,groupName:u,inline:void 0})),n&&(M=Oh.optional({nameOverride:e,generatedName:t,title:r,value:M,description:o,availability:A,namespace:s,groupName:u,inline:void 0})),M}function sJy({schema:e,context:t,breadcrumbs:r,source:n,namespace:i}){let a={},[o,c]=Xg(e)?[t.resolveSchemaReference(e),XXo(e.$ref)]:[e,r];for(let d of o.allOf??[])a={...a,...sJy({schema:d,context:t,breadcrumbs:c,source:n,namespace:i})};for(let[d,s]of Object.entries(o.properties??{})){let u=wS(s,!1,!1,t,[...c,d],n,i);a[d]=u}return a}function n7i({nameOverride:e,generatedName:t,title:r,breadcrumbs:n,description:i,availability:a,wrapAsOptional:o,wrapAsNullable:c,context:d,subtypes:s,namespace:u,groupName:l,encoding:m,source:A,subtypePrefixOverrides:P}){let C=_9C({schemas:s}),M=s.flatMap((z,U)=>{if(!Xg(z)&&z.enum!=null&&d.options.coerceEnumsToLiterals&&z.type==="string")return z.enum.map(V=>Oh.literal({nameOverride:void 0,generatedName:Nie([t,V],d.options.preserveSchemaIds),title:void 0,value:NV.string(String(V)),namespace:u,groupName:void 0,description:void 0,availability:V.availability}));let R=C[U];if(P!=null){let V=P[U];V!=null&&"name"in V&&(R=V.name)}return[wS(z,!1,!1,d,[...n,R??`${U}`],A,u)]}),T=d9C(M);return p9C({uniqueSubtypes:T,nameOverride:e,generatedName:t,title:r,wrapAsOptional:o,wrapAsNullable:c,description:i,availability:a,namespace:u,groupName:l,context:d,encoding:m,source:A})}function d9C(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&&u3e(n,o)){i=!0;break}}n!=null&&!i&&t.push(n)}return t}function p9C({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,namespace:d,groupName:s,context:u,encoding:l,source:m}){if(Object.entries(e).every(([P,C])=>C.type==="literal")){let P={},C=[];return Object.entries(e).forEach(([M,T])=>{T.type==="literal"&&T.value.type==="string"&&(C.push(T.value.value),T.description!=null&&(P[T.value.value]={description:T.description}))}),t7i({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,fernEnum:P,enumVarNames:void 0,enumValues:C,_default:void 0,namespace:d,groupName:s,context:u,source:m,inline:void 0})}if(e.length===1&&e[0]!=null&&!u.options.preserveSingleSchemaOneOf){let P=e[0];return a&&(P=Oh.nullable({nameOverride:t,generatedName:r,title:n,value:P,description:o,availability:c,namespace:d,groupName:s,inline:void 0})),i&&(P=Oh.optional({nameOverride:t,generatedName:r,title:n,value:P,description:o,availability:c,namespace:d,groupName:s,inline:void 0})),P}return cJy({nameOverride:t,generatedName:r,title:n,wrapAsOptional:i,wrapAsNullable:a,description:o,availability:c,subtypes:e,namespace:d,groupName:s,encoding:l,source:m})}function aTf({nameOverride:e,generatedName:t,title:r,description:n,availability:i,wrapAsOptional:a,wrapAsNullable:o,context:c,namespace:d,groupName:s,discriminator:u,encoding:l,source:m}){let A=Object.entries(u.mapping??{}).map(([M,T],z)=>{let U={$ref:T},R=_Pi(U,!1,!1,c,[T],l,m,d);return c.markSchemaWithDiscriminantValue(U,u.propertyName,M),R.type==="object"&&(R.properties={[u.propertyName]:Oh.literal({nameOverride:void 0,generatedName:Nie([t,M],c.options.preserveSchemaIds),title:void 0,value:NV.string(M),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...R.properties.filter(V=>V.key!==u.propertyName)}),R}),P=[];for(let M=0;M<A.length;++M){let T=A[M],z=!1;for(let U=M+1;U<A.length;++U){let R=A[U];if(T!=null&&R!=null&&u3e(T,R)){z=!0;break}}T!=null&&!z&&P.push(T)}if(Object.entries(P).every(([M,T])=>T.type==="literal")){let M={},T=[];return Object.entries(P).forEach(([z,U])=>{U.type==="literal"&&U.value.type==="string"&&(T.push(U.value.value),U.description!=null&&(M[U.value.value]={description:U.description}))}),t7i({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:n,availability:i,fernEnum:M,enumVarNames:void 0,enumValues:T,_default:void 0,namespace:d,groupName:s,context:c,source:m,inline:void 0})}return P.length===1&&P[0]!=null&&!c.options.preserveSingleSchemaOneOf?P[0]:cJy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:a,wrapAsNullable:o,description:n,availability:i,subtypes:P,namespace:d,groupName:s,encoding:l,source:m})}function _9C({schemas:e}){let t={},r=0;for(let a of e){if(!Xg(a)){if(a.properties!=null&&Object.entries(a.properties).length>0){let o=Object.keys(a.properties),c={},d=o;for(let[s,u]of Object.entries(t)){let l=Sts(u,o);d=Sts(d,u),c[s]=l}c[r]=d,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}}Xg(a)?n.push(Z2i(i)??`${i}`):a.type==="array"||a.type==="boolean"||a.type==="integer"||a.type==="number"||a.type==="string"?n.push(""):n.push(Z2i(i)??`${i}`),++i}return n}function cJy({nameOverride:e,generatedName:t,title:r,wrapAsOptional:n,wrapAsNullable:i,description:a,availability:o,subtypes:c,namespace:d,groupName:s,encoding:u,source:l}){let m=Oh.oneOf(tit.undiscriminated({description:a,availability:o,nameOverride:e,generatedName:t,title:r,schemas:c,namespace:d,groupName:s,encoding:u,source:l,inline:void 0}));return i&&(m=Oh.nullable({nameOverride:e,generatedName:t,title:r,value:m,description:a,availability:o,namespace:d,groupName:s,inline:void 0})),n&&(m=Oh.optional({nameOverride:e,generatedName:t,title:r,value:m,description:a,availability:o,namespace:d,groupName:s,inline:void 0})),m}function Ino(e){if(e.default!=null&&typeof e.default=="string")return e.default}function fxs({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let n=Jla(e);for(let i of n??[])if(typeof i=="number")return i;if(r&&typeof r=="number")return r}function lJy({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let n=Jla(e);for(let i of n??[])if(typeof i=="boolean")return i;if(r&&typeof r=="boolean")return r}function PVr({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let n=Jla(e);for(let i of n??[])if(typeof i=="string")return i;if(r&&typeof r=="string")return r}function fJy({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let n=Jla(e);for(let i of n??[])if(Array.isArray(i))return i;if(r&&Array.isArray(r))return r}var $la="#/components/schemas/";function _Jy(e,t){let r=Xg(e)?t.resolveSchemaReference(e):e;switch(r.type){case"boolean":case"number":case"string":case"integer":return!0;case"array":return _Jy(r.items,t);case"object":return!1;case void 0:return!1;default:return t.logger.warn("Unhandled schema type. Will not inline this schema",JSON.stringify(r)),!1}}function h9C(e,t,r){return r.options.resolveAliases?typeof r.options.resolveAliases=="object"&&r.options.resolveAliases.except?.includes(e)?!1:_Jy(t,r):!1}function wS(e,t,r,n,i,a,o,c=!1,d=new Set,s){let u=XGy(e)??a,l=P9C({schema:e,logger:n.logger});if(Xg(e)){let m=r7i(e);return m!=null?h9C(m,e,n)?Cno(n.resolveSchemaReference(e),t,r,n,XXo(e.$ref),l,u,o,d,c,s):(c?n.markSchemaAsReferencedByRequest(m):n.markSchemaAsReferencedByNonRequest(m),_Pi(e,t,r,n,i,l,u,o)):Cno(n.resolveSchemaReference(e),t,r,n,XXo(e.$ref),l,u,o,d,c,s)}return Cno(e,t,r,n,i,l,u,o,d,c,s)}function _Pi(e,t,r,n,i,a,o,c){let d=e.$ref.includes("properties")?Cno(n.resolveSchemaReference(e),t,r,n,i,a,o,c,new Set):Oh.reference(iTf(e,i,o,n.options.preserveSchemaIds));if(r===!1){let s=n.resolveSchemaReference(e);(s.nullable===!0||Array.isArray(s.type)&&s.type.length>=2&&s.type.includes("null"))&&(r=!0)}return r&&(d=Oh.nullable({title:void 0,nameOverride:void 0,generatedName:Nie(i,n.options.preserveSchemaIds),value:d,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),t&&(d=Oh.optional({title:void 0,nameOverride:void 0,generatedName:Nie(i,n.options.preserveSchemaIds),value:d,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0})),d}function y9C(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function Cno(e,t,r,n,i,a,o,c,d=new Set,s=!1,u){typeof e=="string"&&(e={type:e});let l=Jy(e,wb.TYPE_NAME)??(n.options.useTitlesAsName?y9C(e.title):void 0),m=Jy(e,wb.SDK_GROUP_NAME)??Jy(e,Hbe.TAGS)?.[0],A=(typeof m=="string"?[m]:m)??[];A=n.resolveGroupName(A);let P=Nie(i,n.options.preserveSchemaIds),C=e.title,M=e.description,T=Owe(e),z=[];e.example!=null&&z.push({name:void 0,value:e.example,description:void 0});let U=Jy(e,Hbe.EXAMPLES);U!=null&&Object.keys(U).length>0&&z.push(...Object.entries(U).map(([$,re])=>({name:re?.summary??$,value:re.value,description:re.description})));let R=Jla(e);R!=null&&Object.keys(R).length>0&&z.push(...R.map($=>({name:void 0,value:$,description:void 0})));let V=YGy({schema:e,description:M,title:C,nameOverride:l,generatedName:P,availability:T});if(V!=null){let $=V;return r&&($=Oh.nullable({availability:T,namespace:c,groupName:A,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:$})),t&&($=Oh.optional({availability:T,namespace:c,groupName:A,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:$})),$}try{if(Array.isArray(e.type)){let Y=e.type.indexOf("null"),te=Y!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&te)e.type.splice(Y,1),e.type=e.type[0],e.nullable=!0;else if(te&&(e.type.splice(Y,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let ne=new Set([...e.oneOf,...e.type]);e.oneOf=[...ne]}}if(r=r||e.nullable===!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(te=>te!==null),!_xs(e.enum))return yse({nameOverride:l,generatedName:P,title:C,primitive:L0.string({default:Ino(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:PVr({schema:e,logger:n.logger,fallback:u})}),namespace:c,groupName:A,wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T});let Y=$Gy(e);return e.enum.length===1&&e.enum[0]!=null&&Y==null?iJy({nameOverride:l,generatedName:P,title:C,wrapAsOptional:t,wrapAsNullable:r,value:e.enum[0],description:M,availability:T,namespace:c,groupName:A}):t7i({nameOverride:l,generatedName:P,title:C,fernEnum:Y,enumVarNames:Jy(e,[Hbe.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:A,context:n,source:o,inline:void 0})}if(_xs(e.type)&&e.type.length>1){let Y=e.type.includes("null"),te=e.type.filter(ne=>ne!=="null").map(ne=>({type:ne,nullable:Y}));return n7i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:te,namespace:c,groupName:A,encoding:a,source:o})}if(e.type==="boolean"){let Y=Jy(e,wb.BOOLEAN_LITERAL);return Y!=null?dJy({nameOverride:l,generatedName:P,title:C,literal:NV.boolean(Y),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:A}):yse({nameOverride:l,generatedName:P,title:C,primitive:L0.boolean({default:v9C(e.default),example:lJy({schema:e,logger:n.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:A})}if(e.type==="number")return nTf({nameOverride:l,generatedName:P,title:C,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Kla(e.exclusiveMinimum),exclusiveMaximum:Kla(e.exclusiveMaximum),multipleOf:e.multipleOf,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:fxs({schema:e,logger:n.logger,fallback:u}),namespace:c,groupName:A});if(e.type==="integer")return nJy({nameOverride:l,generatedName:P,title:C,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Kla(e.exclusiveMinimum),exclusiveMaximum:Kla(e.exclusiveMaximum),multipleOf:e.multipleOf,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:fxs({schema:e,logger:n.logger,fallback:u}),namespace:c,groupName:A});if(e.type==="float")return nTf({nameOverride:l,generatedName:P,title:C,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Kla(e.exclusiveMinimum),exclusiveMaximum:Kla(e.exclusiveMaximum),multipleOf:e.multipleOf,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,example:fxs({schema:e,logger:n.logger,fallback:u}),namespace:c,groupName:A});if(e.type==="string"){if(e.format==="date-time")return yse({nameOverride:l,generatedName:P,title:C,primitive:L0.datetime({example:PVr({schema:e,logger:n.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:A});if(e.format==="date"&&n.options.typeDatesAsStrings===!1)return yse({nameOverride:l,generatedName:P,title:C,primitive:L0.date({example:PVr({schema:e,logger:n.logger,fallback:u})}),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:A});if(e.format==="json-string"){let te=Oh.unknown({nameOverride:l,generatedName:P,title:C,description:M,availability:T,namespace:c,groupName:A,example:void 0});return r&&(te=Oh.nullable({availability:T,namespace:c,groupName:A,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:te})),t&&(te=Oh.optional({availability:T,namespace:c,groupName:A,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:te})),te}let Y=yJy(e,"const");return Y!=null?dJy({nameOverride:l,generatedName:P,title:C,literal:NV.string(Y),wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T,namespace:c,groupName:A}):yse({nameOverride:l,generatedName:P,title:C,primitive:L0.string({default:Ino(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:PVr({schema:e,logger:n.logger,fallback:u})}),namespace:c,groupName:A,wrapAsOptional:t,wrapAsNullable:r,description:M,availability:T})}if(e.type==="array")return eJy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,item:e.items,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,example:fJy({schema:e,logger:n.logger,fallback:u}),source:o});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&dxs(e))return ZGy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,additionalProperties:e.additionalProperties,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,encoding:a,example:e.example,source:o});if(e.oneOf!=null&&e.oneOf.length>0&&Jy(e,wb.IS_DISCRIMINATED)===!1)return n7i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf,namespace:c,groupName:A,encoding:a,source:o});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return n.options.discriminatedUnionV2?aTf({nameOverride:l,generatedName:P,title:C,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,discriminator:e.discriminator,encoding:a,source:o}):tTf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,encoding:a,source:o});if(e.oneOf!=null&&e.oneOf.length>0){let Y=Jy(e,wb.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return n.options.discriminatedUnionV2||Y?aTf({nameOverride:l,generatedName:P,title:C,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,discriminator:e.discriminator,encoding:a,source:o}):tTf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsOptional:t,wrapAsNullable:r,context:n,namespace:c,groupName:A,encoding:a,source:o});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(n.options.preserveSingleSchemaOneOf)return n7i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,context:n,subtypes:e.oneOf.filter(ne=>Xg(ne)||ne.type!=="null"),encoding:a,namespace:c,groupName:A,source:o});let te=wS(e.oneOf[0],t,r,n,i,o,c,s);return Mno(te,M,c,A)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let ge=e.oneOf[0],ve=e.oneOf[1];if(!Xg(ge)&&ge.type==="null")return wS(ve,!1,!0,n,i,o,c);if(!Xg(ve)&&ve.type==="null")return wS(ge,!1,!0,n,i,o,c)}let te=m9C({schemas:e.oneOf});if(te!=null)return t7i({nameOverride:l,generatedName:P,title:C,fernEnum:void 0,enumVarNames:void 0,enumValues:te,_default:e.default,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,namespace:c,groupName:A,context:n,source:o,inline:void 0});let ne=pJy({schemas:e.oneOf,context:n});if(ne!=null&&!n.options.discriminatedUnionV2&&!Y)return rTf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},required:e.required,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,discriminant:ne.discriminant,variants:ne.schemas,context:n,namespace:c,groupName:A,encoding:a,source:o});let Oe=e.oneOf.filter(ge=>!Xg(ge)&&ge.type==="null").length>0;return n7i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r||Oe,context:n,subtypes:e.oneOf.filter(ge=>Xg(ge)||ge.type!=="null"),encoding:a,namespace:c,groupName:A,source:o})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let ne=wS(e.anyOf[0],t,r,n,i,o,c,s);return Mno(ne,M,c,A)}if(e.anyOf.length===2){let[ne,Oe]=e.anyOf;if(ne!=null&&Oe!=null){if(!Xg(ne)&&ne.type==="null"){let ge=wS(Oe,!1,!0,n,i,o,c);return Mno(ge,M,c,A)}else if(!Xg(Oe)&&Oe.type==="null"){let ge=wS(ne,!1,!0,n,i,o,c);return Mno(ge,M,c,A)}}}let Y=pJy({schemas:e.anyOf,context:n});if(Y!=null&&!n.options.discriminatedUnionV2)return rTf({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},required:e.required,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,discriminant:Y.discriminant,variants:Y.schemas,context:n,namespace:c,groupName:A,encoding:a,source:o});let te=e.anyOf.filter(ne=>!Xg(ne)&&ne.type==="null").length>0;return n7i({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r||te,context:n,subtypes:e.anyOf.filter(ne=>Xg(ne)||ne.type!=="null"),encoding:a,namespace:c,groupName:A,source:o})}if(e.allOf!=null||e.properties!=null){let Y=[];for(let ne of e.allOf??[])(Xg(ne)||Object.keys(ne).length>0)&&Y.push(ne);if((e.properties==null||dxs(e))&&Y.length===1&&Y[0]!=null){let ne=wS(Y[0],t,r,n,i,o,c,s);return Mno(ne,M,c,A)}let te=Y.filter(ne=>{let Oe=pxs(ne);return Oe||n.logger.warn(`Skipping non-object allOf element: ${JSON.stringify(ne)}`),Oe});if((e.properties==null||dxs(e))&&te.length===1&&te[0]!=null){let ne=wS(te[0],t,r,n,i,o,c,s);return Mno(ne,M,c,A)}return uJy({nameOverride:l,generatedName:P,title:C,breadcrumbs:i,properties:e.properties??{},description:M,required:e.required,wrapAsOptional:t,wrapAsNullable:r,allOf:te,context:n,propertiesToExclude:d,namespace:c,groupName:A,fullExamples:z,additionalProperties:e.additionalProperties,availability:T,encoding:a,source:o})}if(e.type==="object"&&b9C(e)&&g9C(e)&&dxs(e))return eTf({nameOverride:l,generatedName:P,title:C,description:M,availability:T,wrapAsOptional:t,wrapAsNullable:r,keySchema:{nameOverride:void 0,generatedName:`${P}Key`,title:void 0,description:void 0,availability:void 0,schema:L0.string({default:Ino(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:PVr({schema:e,logger:n.logger,fallback:u})}),namespace:c,groupName:A},valueSchema:Oh.unknown({nameOverride:void 0,generatedName:`${P}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:c,groupName:A}),namespace:c,groupName:A,encoding:a,example:e.example});e.type!=null&&n.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${i.join("->")}. Coercing to unknown.`);let $=e.example??e.default,re=Oh.unknown({nameOverride:l,generatedName:P,title:C,description:M,availability:T,namespace:c,groupName:A,example:$});return r&&(re=Oh.nullable({availability:T,namespace:c,groupName:A,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:re})),t&&(re=Oh.optional({availability:T,namespace:c,groupName:A,description:M,generatedName:P,inline:void 0,nameOverride:l,title:C,value:re})),re}catch($){return n.logger.debug(`Error converting schema: ${$.message}
|
|
@@ -3029,14 +3029,14 @@ More information: https://mdxjs.com/docs/troubleshooting-mdx`);return i.stack=""
|
|
|
3029
3029
|
`)}`})}catch(i){return n.trace(`Markdown parse failed with error: ${i instanceof Error?i.message:String(i)}`),{type:"failure",message:i instanceof Error?i.message:void 0}}}var gtb=require("fs/promises"),mtb=fa(rqr(),1);var Otb={name:"valid-markdown-file-references",create:e=>({filepath:async({absoluteFilepath:t})=>{if(!t.endsWith(".md")&&!t.endsWith(".mdx"))return[];try{let r=await(0,gtb.readFile)(t,"utf-8"),{content:n}=(0,mtb.default)(r,{}),i=E8i(n),a=[];return qv(i,o=>{if(o.type==="link"){let c=I5s({href:yit(o.url),metadata:{absolutePathToFernFolder:t,absolutePathToMarkdownFile:t},markdownFilesToPathName:{}});if(c?.type==="missing-reference")try{let d=kBr(x_.of(c.path));a.push({severity:"error",message:d?`File ${c.href} does not exit`:`File ${c.href} exists but is not specified in docs.yml`})}catch{}}}),a}catch{return[]}}})};var Rtb=require("crypto"),lKf=fa(require("path"),1);var Atb=require("fs"),QGs=class{parse({absoluteFilePath:t}){let r=(0,Atb.readFileSync)(t,"utf-8"),n=r.match(/option\s+csharp_namespace\s*=\s*"([^"]+)";/),i=r.match(/package\s+([a-zA-Z_][\w.]*);/),a=r.match(/service\s+([a-zA-Z_]\w*)\s*{/);return{csharpNamespace:n?.[1],packageName:i?.[1],serviceName:a?.[1]}}};var LGs=class{context;workspace;sourceCache;constructor(t,r){this.context=t,this.workspace=r,this.sourceCache=new Map}resolveSourceOrThrow({source:t,relativeFilepath:r}){let n=this.resolveSource({source:t});if(n==null){if(gLr(t))throw new Error(`Cannot resolve source ${t.proto} from file ${r}`);this.context.logger.warn(`Cannot resolve source ${t.openapi} from file ${r}`)}return n}resolveSource({source:t}){return gLr(t)?this.resolveProtobufSource({source:t}):this.resolveOpenAPISource({source:t})}resolveProtobufSource({source:t}){let r=Jl(this.workspace.absoluteFilePath,ys.of(t.proto));if(this.sourceCache.has(r))return this.sourceCache.get(r);if(!kBr(r))return;let i=new QGs().parse({absoluteFilePath:r}),a={type:"protobuf",absoluteFilePath:r,relativeFilePath:ys.of(t.proto),csharpNamespace:i.csharpNamespace,packageName:i.packageName,serviceName:i.serviceName};return this.sourceCache.set(r,a),a}resolveOpenAPISource({source:t}){let r=Jl(this.workspace.absoluteFilePath,ys.of(t.openapi));if(this.sourceCache.has(r))return this.sourceCache.get(r);if(!kBr(r))return;let n={type:"openapi",absoluteFilePath:r,relativeFilePath:ys.of(t.openapi)};return this.sourceCache.set(r,n),n}};function kDM(e){for(var t=[],r=0;r<e.length;){var n=e[r];if(n==="*"||n==="+"||n==="?"){t.push({type:"MODIFIER",index:r,value:e[r++]});continue}if(n==="\\"){t.push({type:"ESCAPED_CHAR",index:r++,value:e[r++]});continue}if(n==="{"){t.push({type:"OPEN",index:r,value:e[r++]});continue}if(n==="}"){t.push({type:"CLOSE",index:r,value:e[r++]});continue}if(n===":"){for(var i="",a=r+1;a<e.length;){var o=e.charCodeAt(a);if(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122||o===95){i+=e[a++];continue}break}if(!i)throw new TypeError("Missing parameter name at ".concat(r));t.push({type:"NAME",index:r,value:i}),r=a;continue}if(n==="("){var c=1,d="",a=r+1;if(e[a]==="?")throw new TypeError('Pattern cannot start with "?" at '.concat(a));for(;a<e.length;){if(e[a]==="\\"){d+=e[a++]+e[a++];continue}if(e[a]===")"){if(c--,c===0){a++;break}}else if(e[a]==="("&&(c++,e[a+1]!=="?"))throw new TypeError("Capturing groups are not allowed at ".concat(a));d+=e[a++]}if(c)throw new TypeError("Unbalanced pattern at ".concat(r));if(!d)throw new TypeError("Missing pattern at ".concat(r));t.push({type:"PATTERN",index:r,value:d}),r=a;continue}t.push({type:"CHAR",index:r,value:e[r++]})}return t.push({type:"END",index:r,value:""}),t}function Ptb(e,t){t===void 0&&(t={});for(var r=kDM(e),n=t.prefixes,i=n===void 0?"./":n,a=t.delimiter,o=a===void 0?"/#?":a,c=[],d=0,s=0,u="",l=function(te){if(s<r.length&&r[s].type===te)return r[s++].value},m=function(te){var ne=l(te);if(ne!==void 0)return ne;var Oe=r[s],ge=Oe.type,ve=Oe.index;throw new TypeError("Unexpected ".concat(ge," at ").concat(ve,", expected ").concat(te))},A=function(){for(var te="",ne;ne=l("CHAR")||l("ESCAPED_CHAR");)te+=ne;return te},P=function(te){for(var ne=0,Oe=o;ne<Oe.length;ne++){var ge=Oe[ne];if(te.indexOf(ge)>-1)return!0}return!1},C=function(te){var ne=c[c.length-1],Oe=te||(ne&&typeof ne=="string"?ne:"");if(ne&&!Oe)throw new TypeError('Must have text between two parameters, missing text after "'.concat(ne.name,'"'));return!Oe||P(Oe)?"[^".concat(j5i(o),"]+?"):"(?:(?!".concat(j5i(Oe),")[^").concat(j5i(o),"])+?")};s<r.length;){var M=l("CHAR"),T=l("NAME"),z=l("PATTERN");if(T||z){var U=M||"";i.indexOf(U)===-1&&(u+=U,U=""),u&&(c.push(u),u=""),c.push({name:T||d++,prefix:U,suffix:"",pattern:z||C(U),modifier:l("MODIFIER")||""});continue}var R=M||l("ESCAPED_CHAR");if(R){u+=R;continue}u&&(c.push(u),u="");var V=l("OPEN");if(V){var U=A(),$=l("NAME")||"",re=l("PATTERN")||"",Y=A();m("CLOSE"),c.push({name:$||(re?d++:""),pattern:$&&!re?C(U):re,prefix:U,suffix:Y,modifier:l("MODIFIER")||""});continue}m("END")}return c}function wtb(e,t){return eCM(Ptb(e,t),t)}function eCM(e,t){t===void 0&&(t={});var r=nKf(t),n=t.encode,i=n===void 0?function(d){return d}:n,a=t.validate,o=a===void 0?!0:a,c=e.map(function(d){if(typeof d=="object")return new RegExp("^(?:".concat(d.pattern,")$"),r)});return function(d){for(var s="",u=0;u<e.length;u++){var l=e[u];if(typeof l=="string"){s+=l;continue}var m=d?d[l.name]:void 0,A=l.modifier==="?"||l.modifier==="*",P=l.modifier==="*"||l.modifier==="+";if(Array.isArray(m)){if(!P)throw new TypeError('Expected "'.concat(l.name,'" to not repeat, but got an array'));if(m.length===0){if(A)continue;throw new TypeError('Expected "'.concat(l.name,'" to not be empty'))}for(var C=0;C<m.length;C++){var M=i(m[C],l);if(o&&!c[u].test(M))throw new TypeError('Expected all "'.concat(l.name,'" to match "').concat(l.pattern,'", but got "').concat(M,'"'));s+=l.prefix+M+l.suffix}continue}if(typeof m=="string"||typeof m=="number"){var M=i(String(m),l);if(o&&!c[u].test(M))throw new TypeError('Expected "'.concat(l.name,'" to match "').concat(l.pattern,'", but got "').concat(M,'"'));s+=l.prefix+M+l.suffix;continue}if(!A){var T=P?"an array":"a string";throw new TypeError('Expected "'.concat(l.name,'" to be ').concat(T))}}return s}}function jtb(e,t){var r=[],n=Etb(e,r,t);return tCM(n,r,t)}function tCM(e,t,r){r===void 0&&(r={});var n=r.decode,i=n===void 0?function(a){return a}:n;return function(a){var o=e.exec(a);if(!o)return!1;for(var c=o[0],d=o.index,s=Object.create(null),u=function(m){if(o[m]===void 0)return"continue";var A=t[m-1];A.modifier==="*"||A.modifier==="+"?s[A.name]=o[m].split(A.prefix+A.suffix).map(function(P){return i(P,A)}):s[A.name]=i(o[m],A)},l=1;l<o.length;l++)u(l);return{path:c,index:d,params:s}}}function j5i(e){return e.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}function nKf(e){return e&&e.sensitive?"":"i"}function rCM(e,t){if(!t)return e;for(var r=/\((?:\?<(.*?)>)?(?!\?)/g,n=0,i=r.exec(e.source);i;)t.push({name:i[1]||n++,prefix:"",suffix:"",modifier:"",pattern:""}),i=r.exec(e.source);return e}function nCM(e,t,r){var n=e.map(function(i){return Etb(i,t,r).source});return new RegExp("(?:".concat(n.join("|"),")"),nKf(r))}function iCM(e,t,r){return aCM(Ptb(e,r),t,r)}function aCM(e,t,r){r===void 0&&(r={});for(var n=r.strict,i=n===void 0?!1:n,a=r.start,o=a===void 0?!0:a,c=r.end,d=c===void 0?!0:c,s=r.encode,u=s===void 0?function(ne){return ne}:s,l=r.delimiter,m=l===void 0?"/#?":l,A=r.endsWith,P=A===void 0?"":A,C="[".concat(j5i(P),"]|$"),M="[".concat(j5i(m),"]"),T=o?"^":"",z=0,U=e;z<U.length;z++){var R=U[z];if(typeof R=="string")T+=j5i(u(R));else{var V=j5i(u(R.prefix)),$=j5i(u(R.suffix));if(R.pattern)if(t&&t.push(R),V||$)if(R.modifier==="+"||R.modifier==="*"){var re=R.modifier==="*"?"?":"";T+="(?:".concat(V,"((?:").concat(R.pattern,")(?:").concat($).concat(V,"(?:").concat(R.pattern,"))*)").concat($,")").concat(re)}else T+="(?:".concat(V,"(").concat(R.pattern,")").concat($,")").concat(R.modifier);else{if(R.modifier==="+"||R.modifier==="*")throw new TypeError('Can not repeat "'.concat(R.name,'" without a prefix and suffix'));T+="(".concat(R.pattern,")").concat(R.modifier)}else T+="(?:".concat(V).concat($,")").concat(R.modifier)}}if(d)i||(T+="".concat(M,"?")),T+=r.endsWith?"(?=".concat(C,")"):"$";else{var Y=e[e.length-1],te=typeof Y=="string"?M.indexOf(Y[Y.length-1])>-1:Y===void 0;i||(T+="(?:".concat(M,"(?=").concat(C,"))?")),te||(T+="(?=".concat(M,"|").concat(C,")"))}return new RegExp(T,nKf(r))}function Etb(e,t,r){return e instanceof RegExp?rCM(e,t):Array.isArray(e)?nCM(e,t,r):iCM(e,t,r)}uI();function Stb(e){return e.split(/[?#]/)[0]??""}function f_a(e){return e.startsWith("/")?e.slice(1):e}function iKf(e){return e.startsWith("/")?e:`/${e}`}function UGs(e){return e.endsWith("/")?e.slice(0,-1):e}function Dtb(e){let t=[];return e.config.instances.forEach(r=>{t.push(r.url),typeof r.customDomain=="string"?t.push(r.customDomain):Array.isArray(r.customDomain)&&t.push(...r.customDomain)}),t}function Ctb(e){let t=new URL(Hwe(e));return{domain:t.host,basePath:t.pathname==="/"||t.pathname===""?void 0:t.pathname}}function oCM(e,t){if(e===t)return{params:{},path:t,index:0};try{return jtb(e)(t)}catch(r){return console.error(r,{pattern:e,path:t}),!1}}function uCM(e,t){try{return wtb(e)(t.params)}catch(r){return console.error(r,{match:t,destination:e}),e}}function Itb(e,t,r=[]){for(let n of r){let i=UGs(sCM(n.source,t.basePath)),a=oCM(i,e);if(a){let o=uCM(n.destination,a);if(!o.startsWith("/"))try{new URL(o)}catch{console.error("Invalid redirect destination:",o);return}return{redirect:{destination:encodeURI(o),permanent:n.permanent??!1}}}}}function sCM(e,t){return t==null||e.startsWith(t)?e:jD(t,e)}async function uKf({pathname:e,markdown:t,absoluteFilepath:r,workspaceAbsoluteFilePath:n,pageSlugs:i,absoluteFilePathsToSlugs:a,redirects:o=[],baseUrl:c}){e=UGs(e);let d=r!=null?a.get(r)??[]:[];if(e.trim()==="")return!0;if(e=oKf(e),e.startsWith("/")){let u=oKf(aKf(e,c,o));for(let m=0;m<5;++m){let A=oKf(aKf(u,c,o));if(u===A)break;u=A}if(t&&i.has(f_a(u)))return!0;let l=Jl(n,ys.of(f_a(e)));return await Tv(l,"file")?!0:d.map(m=>iKf(m))}if(r!=null){if(e==="."){let l=Ug(r);if(await Tv(l,"directory"))return!0}let u=Jl(Ug(r),ys.of(e));if(await Tv(u,"file"))return!0}if(!t)return d.map(u=>iKf(u));let s=[];for(let u of d){let l=new URL(`/${u}`,Hwe(c.domain)),m=aKf(new URL(e,l).pathname,c,o);i.has(f_a(m))||s.push(u)}return s.length>0?s:!0}function aKf(e,t,r){let n=Itb(e,t,r);return n==null?e:n.redirect.destination}function oKf(e){let t=e.indexOf("#");return t===-1?e:e.substring(0,t)}var Mtb=require("fs");var cCM=["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"];function lCM({readFile:e=r=>(0,Mtb.readFileSync)(r,"utf-8"),...t}){let r=new Set,n=[t],i=[],a=[],o=1e3,c=0;do{if(c++,c>o)throw new Error("Infinite loop detected while collecting links and sources");let d=n.shift();if(d==null)break;let{content:s,absoluteFilepath:u}=d;if(u!=null){if(r.has(u))throw new Error(`Circular import detected: ${u}`);r.add(u)}let l=E8i(s),m=iso(l,{allowDangerousHtml:!0,passThrough:[...cCM]});qv(m,A=>{if(A.type==="mdxjsEsm"&&u!=null)return A.data?.estree&&Vie(A.data.estree,{enter:C=>{if(C.type==="ImportDeclaration"&&C.source.type==="Literal"&&typeof C.source.value=="string"){let M=ys.of(C.source.value),T=A1(Ug(u),M);(T.endsWith(".mdx")||T.endsWith(".md"))&&n.push({content:e(T),absoluteFilepath:T})}}}),"skip";if(A.type==="element"){let C=A.properties.href;typeof C=="string"&&i.push({href:C,sourceFilepath:u,position:A.position});let M=A.properties.src;typeof M=="string"&&a.push({src:M,sourceFilepath:u,position:A.position})}function P(C,M){Gao(C,{src:T=>{let z=ZPi(T.value);typeof z=="string"&&a.push({src:z,sourceFilepath:u,position:M})},href:T=>{let z=ZPi(T.value);typeof z=="string"&&i.push({href:z,sourceFilepath:u,position:M})}})}if(A.type==="mdxJsxFlowElement"||A.type==="mdxJsxTextElement"){let C=g8i(A.attributes.filter(kPi).find(T=>T.name==="href")?.value),M=g8i(A.attributes.filter(kPi).find(T=>T.name==="src")?.value);if(A.name==="Markdown"){if(u&&typeof M=="string"){let T=A1(Ug(u),M);n.push({content:e(T),absoluteFilepath:T})}return"skip"}typeof C=="string"&&i.push({href:C,sourceFilepath:u,position:A.position}),typeof M=="string"&&a.push({src:M,sourceFilepath:u,position:A.position}),A.attributes.forEach(T=>{T.type==="mdxJsxAttribute"&&typeof T.value!="string"&&T.value!=null&&T.value.data?.estree?P(T.value.data.estree,T.position):T.type==="mdxJsxExpressionAttribute"&&T.data?.estree&&P(T.data.estree,T.position)})}(A.type==="mdxFlowExpression"||A.type==="mdxTextExpression")&&A.data?.estree&&P(A.data.estree,A.position)})}while(n.length>0);return{links:i,sources:a}}function Btb({content:e,absoluteFilepath:t}){try{return lCM({content:e,absoluteFilepath:t})}catch{return{links:[],sources:[]}}}var Ttb=/^(?:[a-z+]+:)/gi;function fCM(e){let t=/^---\n([\s\S]*?)\n---/,r=e.match(t);return r?(r[0].match(/\n/g)||[]).length+1:0}function sKf(e,t){return e&&{...e,start:{...e.start,line:e.start.line+t},end:{...e.end,line:e.end.line+t}}}function cKf(e,{absoluteFilepath:t,instanceUrls:r}){let n=[],i=[],a=fCM(e),{links:o,sources:c}=Btb({content:e,absoluteFilepath:t});return o.forEach(d=>{if(d.href.trimStart().match(Ttb)){if(!d.href.trimStart().startsWith("http"))return;try{let u=new URL(d.href);if(!r.some(l=>d.href.includes(l)))return;i.push({pathname:u.pathname,sourceFilepath:d.sourceFilepath,position:sKf(d.position,a),markdown:!0})}catch{n.push({severity:"warning",message:`Invalid URL: ${d.href}`})}return}let s=Stb(d.href);s.trim()!==""&&i.push({pathname:s,sourceFilepath:d.sourceFilepath,position:sKf(d.position,a),markdown:!0})}),c.forEach(d=>{if(d.src.match(Ttb))try{new URL(d.src)}catch{n.push({severity:"warning",message:`Invalid URL: ${d.src}`});return}else i.push({pathname:d.src,sourceFilepath:d.sourceFilepath,position:sKf(d.position,a),markdown:!1})}),{pathnamesToCheck:i,violations:n}}var cau=kZl({logger:M5r(Hc)}),E5i={name:"valid-markdown-links",create:async({workspace:e,apiWorkspaces:t,ossWorkspaces:r})=>{let n=Dtb(e),i=n[0]??"http://localhost",a=Ctb(n[0]??"http://localhost"),c=await new MRr(i,e,r,t,cau).resolve();if(!c.config.root)throw new Error("Root node not found");let d=Ol.migrate.FernNavigationV1ToLatest.create().root(c.config.root),s=Ol.NodeCollector.collect(d),u=new Set,l=new Map,m=[];s.slugMap.forEach((P,C)=>{if(u.add(C),P==null||!Ol.isPage(P))return;Ol.isApiLeaf(P)&&m.push(P);let M=Ol.getPageId(P);if(M==null)return;let T=Jl(e.absoluteFilePath,ys.of(M)),z=l.get(T)??[];z.push(C),l.set(T,z)});let A=["/llms-full.txt","/llms.txt"];for(let P of A){let C=a.basePath?`${f_a(a.basePath)}${P}`:f_a(P);u.add(C)}return{markdownPage:async({content:P,absoluteFilepath:C})=>{let M=l.get(C);if(!M||M.length===0)return[];let{pathnamesToCheck:T,violations:z}=cKf(P,{absoluteFilepath:C,instanceUrls:n}),U=await Promise.all(T.map(async R=>{let V=await uKf({pathname:R.pathname,markdown:R.markdown,absoluteFilepath:C,workspaceAbsoluteFilePath:e.absoluteFilePath,pageSlugs:u,absoluteFilePathsToSlugs:l,redirects:e.config.redirects,baseUrl:a});return V===!0?[]:V.map($=>{let[re,Y]=qtb({pathnameToCheck:R,targetPathname:$,absoluteFilepathToWorkspace:e.absoluteFilePath});return{name:E5i.name,severity:"error",message:re,relativeFilepath:Y}})}));return[...z,...U.flat()]},apiSection:async({workspace:P,config:C})=>{let M=await P.toFernWorkspace({context:cau},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1}),T=qH({workspace:M,audiences:C.audiences?{type:"select",audiences:C.audiences}:{type:"all"},generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!1},readme:void 0,version:void 0,packageName:void 0,context:cau,sourceResolver:new LGs(cau,M)}),z=dCM($nu({ir:T,apiDefinitionId:(0,Rtb.randomUUID)(),context:cau})),U=[];for(let R of m){let V=await pCM(Moo.prune(z,R));for(let $ of V){let{pathnamesToCheck:re,violations:Y}=cKf($,{instanceUrls:n});U.push(...Y);let te=await Promise.all(re.map(async ne=>{let Oe=await uKf({pathname:ne.pathname,markdown:ne.markdown,workspaceAbsoluteFilePath:e.absoluteFilePath,pageSlugs:u,absoluteFilePathsToSlugs:l,redirects:e.config.redirects,baseUrl:a});return Oe===!0?[]:Oe.map(ge=>{let[ve,be]=qtb({pathnameToCheck:ne,targetPathname:ge,absoluteFilepathToWorkspace:e.absoluteFilePath});return{name:E5i.name,severity:"error",message:ve,relFilepath:be}})}));U.push(...te.flat())}}return U}}}};function qtb({pathnameToCheck:e,targetPathname:t,absoluteFilepathToWorkspace:r}){let n=`${t} links to non-existent page ${bd.bold(e.pathname)}`,{position:i,sourceFilepath:a}=e;if(a==null||i==null)return[n,ys.of("")];n=`broken link to ${bd.bold(e.pathname)}`,e.pathname.length>0&&!lKf.default.isAbsolute(e.pathname)&&(n+=` (resolved path: ${lKf.default.join(t,e.pathname)})`);let o=l5(r,a);return n+=`
|
|
3030
3030
|
fix here: ${o}:${i.start.line}:${i.start.column}`,[n,o]}function dCM(e){return Moo.ApiDefinitionV1ToLatest.from(e,{useJavaScriptAsTypeScript:!1,alwaysEnableJavaScriptFetch:!1,usesApplicationJsonInFormDataValue:!1}).migrate()}async function pCM(e){let t=[];return Moo.Transformer.descriptions(r=>(typeof r=="string"&&t.push(r),r)).apiDefinition(e),t}var VGs={name:"validate-product-file",create:()=>({productFile:async({path:e,content:t})=>{let r=await fGs({value:t});return r.type==="success"?[]:[{severity:"fatal",message:`${r.message}`}]}})};var WGs={name:"validate-version-file",create:()=>({versionFile:async({path:e,content:t})=>{let r=await lGs({value:t});return r.type==="success"?[]:[{severity:"fatal",message:`${r.message}`}]}})};function Ntb({relativeFilepath:e,allRuleVisitors:t,addViolations:r}){function n(i){let a=async(o,c)=>{for(let d of t){let s=d[i];if(s!=null){let u=await s(o);r(u.map(l=>({name:l.name,severity:l.severity,relativeFilepath:l.relativeFilepath??ys.of(""),nodePath:c,message:l.message})))}}};return{[i]:a}}return{...n("file"),...n("filepath"),...n("markdownPage"),...n("versionFile"),...n("apiSection"),...n("permissions"),...n("productFile")}}var Ftb=[pGs,_Gs,WGs,VGs,wJf,E5i,OGs,hGs,jJf,AGs];function xtb(e){if(!e)return Ftb;let t=new Set(e);return Ftb.filter(r=>!t.has(r.name))}async function fau(e,t,r,n,i,a){let o=i?[E5i]:xtb(a);return _CM({workspace:e,rules:o,context:t,apiWorkspaces:r,ossWorkspaces:n})}async function _CM({workspace:e,rules:t,context:r,apiWorkspaces:n,ossWorkspaces:i}){let a=[],o=await Promise.all(t.map(d=>d.create({workspace:e,apiWorkspaces:n,ossWorkspaces:i,logger:r.logger}))),c=Ntb({relativeFilepath:ys.of(Urt),allRuleVisitors:o,addViolations:d=>{a.push(...d)}});return await bkv({contents:e.config,visitor:c,absoluteFilepathToConfiguration:Jl(e.absoluteFilePath,ys.of(Urt)),absolutePathToFernFolder:e.absoluteFilePath,context:r,apiWorkspaces:n}),a}function uso({context:e,violations:t,logWarnings:r,logSummary:n=!0,logBreadcrumbs:i=!0,elapsedMillis:a=0}){let o=[],c={};for(let u of t){let l=JSON.stringify(u.nodePath),m=c[l]??[];m.some(P=>P.message===u.message&&P.nodePath.length===u.nodePath.length&&P.nodePath.every((C,M)=>Lrt(C,u.nodePath[M]))&&P.relativeFilepath===u.relativeFilepath&&P.severity===u.severity)||(o.push(u),c[l]=[...m,u])}t=o;let d=mCM(t),s=hCM(t);for(let u of Array.from(s.keys()).sort()){let l=s.get(u);if(l){let m=l[0]?.relativeFilepath??"";yCM({logWarnings:r,logBreadcrumbs:i,configRelativeFilepath:m,nodePath:u,violations:l,context:e})}}return n&&gCM({context:e,stats:d,logWarnings:r,elapsedMillis:a}),{hasErrors:d.numFatal>0}}function hCM(e){let t={};for(let r of e){let n=JSON.stringify(r.nodePath),i=t[n]??[];t[n]=[...i,r]}return new Map(Object.entries(t).map(([r,n])=>[JSON.parse(r),n]))}function yCM({logWarnings:e,logBreadcrumbs:t,configRelativeFilepath:r,nodePath:n,violations:i,context:a}){let o=vCM(i);if(o==="warning"&&!e)return;let c="",d=i.map(s=>s.severity==="warning"&&!e?null:(c===""&&(c=s.relativeFilepath),s.message)).filter(s=>s!=null).join(`
|
|
3031
3031
|
`);a.logger.log(bCM(o),Syt({breadcrumbs:t?[r,...n.map(s=>{let u=typeof s=="string"?s:s.key;return typeof s!="string"&&s.arrayIndex!=null&&(u+=`[${s.arrayIndex}]`),u})]:[],title:c,subtitle:d})+`
|
|
3032
|
-
`)}function vCM(e){return e.some(t=>t.severity==="fatal")?"fatal":e.some(t=>t.severity==="error")?"error":"warning"}function bCM(e){switch(e){case"fatal":return K1.Error;case"error":return K1.Error;case"warning":return K1.Warn;default:tc(e)}}function gCM({stats:e,context:t,logWarnings:r,elapsedMillis:n=0}){let{numFatal:i,numErrors:a,numWarnings:o}=e,c=n>0?` in ${(n/1e3).toFixed(3)} seconds.`:".",d=`Found ${i+a} errors and ${o} warnings`+c;!r&&o>0&&(d+=" Run fern check --warnings to print out the warnings not shown."),i+a>0?t.logger.error(d):o>0?t.logger.warn(d):t.logger.info(bd.green("\u2713 All checks passed"))}function mCM(e){let t=0,r=0,n=0;for(let i of e)switch(i.severity){case"fatal":t+=1;continue;case"error":r+=1;continue;case"warning":n+=1;continue;default:tc(i.severity)}return{numFatal:t,numErrors:r,numWarnings:n}}async function sso({workspace:e,apiWorkspaces:t,ossWorkspaces:r,context:n,logWarnings:i,errorOnBrokenLinks:a,logSummary:o=!0,excludeRules:c}){let d=performance.now(),s=await fau(e,n,t,r,!1,c),u=performance.now()-d,{hasErrors:l}=uso({violations:s,context:n,logWarnings:i,logSummary:o,logBreadcrumbs:!1,elapsedMillis:u});return a&&(l=l||s.some(m=>m.name==="valid-markdown-links")),{hasErrors:l}}async function HGs({workspace:e,apiWorkspaces:t,ossWorkspaces:r,context:n,logWarnings:i,errorOnBrokenLinks:a,excludeRules:o}){let{hasErrors:c}=await sso({workspace:e,context:n,logWarnings:i,apiWorkspaces:t,ossWorkspaces:r,errorOnBrokenLinks:a,excludeRules:o});c&&n.failAndThrow()}async function ztb({loadProject:e,cliContext:t,port:r,bundlePath:n,brokenLinks:i,legacyPreview:a,backendPort:o}){let c=await e(),d=c.docsWorkspaces;d!=null&&(a&&(await t.instrumentPostHogEvent({orgId:c.config.organization,command:"fern docs dev --legacy"}),await t.runTaskForWorkspace(d,async s=>{s.logger.info(`Starting server on port ${r}`),await bJf({initialProject:c,reloadProject:e,validateProject:async u=>{let l=u.docsWorkspaces;if(l==null)return;let m=i?[]:["valid-markdown-links"],A=l.config.experimental?.openapiParserV3;A==null||A?await sso({workspace:l,context:s,logWarnings:!0,logSummary:!1,apiWorkspaces:[],ossWorkspaces:await age(u),excludeRules:m}):await sso({workspace:l,context:s,logWarnings:!0,logSummary:!1,apiWorkspaces:u.apiWorkspaces,ossWorkspaces:await age(u),excludeRules:m})},context:s,port:r,bundlePath:n})})),await t.instrumentPostHogEvent({orgId:c.config.organization,command:"fern docs dev --beta"}),await t.runTaskForWorkspace(d,async s=>{s.logger.info(`Starting server on port ${r}`),await yJf({initialProject:c,reloadProject:e,validateProject:async u=>{let l=u.docsWorkspaces;if(l==null)return;let m=i?[]:["valid-markdown-links"],A=l.config.experimental?.openapiParserV3;A==null||A?await sso({workspace:l,context:s,logWarnings:!0,logSummary:!1,apiWorkspaces:[],ossWorkspaces:await age(u),excludeRules:m}):await sso({workspace:l,context:s,logWarnings:!0,logSummary:!1,apiWorkspaces:u.apiWorkspaces,ossWorkspaces:await age(u),excludeRules:m})},context:s,port:r,bundlePath:n,backendPort:o})}))}var YGs=require("fs/promises");var d_a=fa(b8s(),1);uI();function Qtb(e,t){let r=e.shape,n=e.docs??void 0;return{openApiSchema:xE._visit(r,{alias:a=>OCM({aliasTypeDeclaration:a,docs:n}),enum:a=>ACM({enumTypeDeclaration:a,docs:n}),object:a=>{let o=e.userProvidedExamples[0],c=o==null?SCM(t,e.name):void 0,d=o==null&&c==null?DCM(t,e.name):void 0;return JGs({properties:a.properties.map(s=>{let u;return o!=null&&o.shape.type==="object"?u=o.shape.properties.find(l=>l.name.wireValue===s.name.wireValue):c!=null?c.type==="reference"&&c.shape.type==="named"&&c.shape.shape.type==="object"&&(u=c.shape.shape.properties.find(l=>l.name.wireValue===s.name.wireValue)):d!=null&&d.type==="body"&&d.value?.shape.type==="named"&&d.value.shape.shape.type==="object"&&(u=d.value.shape.shape.properties.find(l=>l.name.wireValue===s.name.wireValue)),{docs:s.docs??void 0,name:s.name,valueType:s.valueType,example:u}}),extensions:a.extends,docs:n})},union:a=>PCM({unionTypeDeclaration:a,docs:n}),undiscriminatedUnion:a=>wCM({undiscriminatedUnionDeclaration:a,docs:n}),_other:()=>{throw new Error("Encountered unknown type: "+r.type)}}),schemaName:Ltb(e.name)}}function OCM({aliasTypeDeclaration:e,docs:t}){return{...Zee(e.aliasOf),description:t}}function ACM({enumTypeDeclaration:e,docs:t}){return{type:"string",enum:e.values.map(r=>r.name.wireValue),description:t}}function PCM({unionTypeDeclaration:e,docs:t}){let n={oneOf:e.types.map(i=>{let a={[e.discriminant.wireValue]:{type:"string",enum:[i.discriminantValue.wireValue]}};return _de._visit(i.shape,{noProperties:()=>({type:"object",properties:a,required:[e.discriminant.wireValue]}),singleProperty:o=>({type:"object",properties:{...a,[o.name.wireValue]:Zee(o.type)},required:[e.discriminant.wireValue]}),samePropertiesAsObject:o=>({type:"object",allOf:[{type:"object",properties:a},{$ref:GGs(o)}],required:[e.discriminant.wireValue]}),_other:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+i.shape.propertiesType)}})}),description:t};return e.baseProperties.length>0&&(n.properties=e.baseProperties.reduce((i,a)=>(i[a.name.wireValue]={description:a.docs??void 0,...Zee(a.valueType)},a.valueType.type==="container"&&a.valueType.container.type==="optional"||(n.required=[...n.required??[],a.name.wireValue]),i),{})),n}function wCM({undiscriminatedUnionDeclaration:e,docs:t}){return{oneOf:e.members.map(r=>({description:r.docs??void 0,...Zee(r.type)})),description:t}}function Zee(e){return mh._visit(e,{container:t=>ECM(t),named:t=>({$ref:GGs(t)}),primitive:t=>jCM(t),unknown:()=>({}),_other:()=>{throw new Error("Encountered unknown typeReference: "+e.type)}})}function jCM(e){return e.v2==null?JP._visit(e.v1,{boolean:()=>({type:"boolean"}),dateTime:()=>({type:"string",format:"date-time"}),double:()=>({type:"number",format:"double"}),integer:()=>({type:"integer"}),long:()=>({type:"integer",format:"int64"}),string:()=>({type:"string"}),uuid:()=>({type:"string",format:"uuid"}),date:()=>({type:"string",format:"date"}),base64:()=>({type:"string",format:"byte"}),uint:()=>({type:"integer",format:"int64"}),uint64:()=>({type:"integer",format:"int64"}),float:()=>({type:"number",format:"float"}),bigInteger:()=>({type:"integer",format:"bigint"}),_other:()=>{throw new Error("Encountered unknown primitiveType: "+e.v1)}})??{}:Yg._visit(e.v2,{boolean:()=>({type:"boolean"}),dateTime:()=>({type:"string",format:"date-time"}),double:()=>({type:"number",format:"double"}),integer:()=>({type:"integer"}),long:()=>({type:"integer",format:"int64"}),string:t=>{let r={type:"string"};return t.validation?.format!=null&&(r.format=t.validation.format),t.validation?.pattern!=null&&(r.pattern=t.validation.pattern),r},uuid:()=>({type:"string",format:"uuid"}),date:()=>({type:"string",format:"date"}),base64:()=>({type:"string",format:"byte"}),uint:()=>({type:"integer",format:"int64"}),uint64:()=>({type:"integer",format:"int64"}),float:()=>({type:"number",format:"float"}),bigInteger:()=>({type:"integer",format:"bigint"}),_other:()=>{throw new Error("Encountered unknown primitiveType: "+e.v2)}})}function ECM(e){return Iw._visit(e,{list:t=>({type:"array",items:Zee(t)}),set:t=>({type:"array",items:Zee(t)}),map:t=>t.keyType.type==="primitive"&&t.keyType.primitive.v1==="STRING"&&t.valueType.type==="unknown"?{type:"object",additionalProperties:!0}:{type:"object",additionalProperties:Zee(t.valueType)},optional:t=>({...Zee(t),nullable:!0}),nullable:t=>({...Zee(t),nullable:!0}),literal:t=>t._visit({boolean:r=>({type:"boolean",const:r}),string:r=>({type:"string",const:r}),_other:()=>({})}),_other:()=>{throw new Error("Encountered unknown containerType: "+e.type)}})}function GGs(e){return`#/components/schemas/${Ltb(e)}`}function Ltb(e){return[...e.fernFilepath.packagePath.map(t=>t.originalName),e.name.originalName].join("")}function SCM(e,t){for(let r of Object.values(e.services))for(let n of r.endpoints)if(!(n.userSpecifiedExamples.length<=0)&&n.requestBody?.type==="reference"&&n.requestBody.requestBodyType.type==="named"&&CCM(n.requestBody.requestBodyType,t))return n.userSpecifiedExamples[0]?.example?.request??void 0}function DCM(e,t){for(let r of Object.values(e.services))for(let n of r.endpoints)if(!(n.userSpecifiedExamples.length<=0||n.response?.body?.type!=="json")&&n.response.body.value.responseBodyType.type==="named"&&n.response.body.value.responseBodyType.typeId===t.typeId){let i=n.userSpecifiedExamples.find(a=>a.example?.response.type==="ok");if(i!=null&&i.example?.response.type==="ok")return i.example.response.value}}function CCM(e,t){return xue(e.fernFilepath,t.fernFilepath)&&xue(e.name,t.name)}function JGs({docs:e,properties:t,extensions:r}){let n={},i=[];t.forEach(o=>{let c=Zee(o.valueType),d;(o.example!=null&&o.valueType.type==="primitive"||o.example!=null&&o.valueType.type==="container"&&o.valueType.container.type==="list"&&o.valueType.container.list.type==="primitive")&&(d=o.example.value.jsonExample),n[o.name.wireValue]={...c,description:o.docs??void 0,example:d},o.valueType.type==="container"&&o.valueType.container.type==="optional"||i.push(o.name.wireValue)});let a={type:"object",description:e,properties:n};return i.length>0&&(a.required=i),r.length>0&&(a.allOf=r.map(o=>({$ref:GGs(o)}))),a}function Utb({ir:e,httpServices:t,typesByName:r,errorsByName:n,errorDiscriminationStrategy:i,security:a,environments:o,mode:c}){let d={};return t.forEach(s=>{s.endpoints.forEach(u=>{let{fullPath:l,convertedHttpMethod:m,operationObject:A}=ICM({ir:e,httpEndpoint:u,httpService:s,typesByName:r,errorsByName:n,errorDiscriminationStrategy:i,security:a,environments:o,mode:c}),P=d[l]??={};if(P[m]!=null)throw new Error(`Duplicate ${m} endpoint at ${l}`);P[m]=A})}),d}function ICM({httpEndpoint:e,httpService:t,typesByName:r,errorsByName:n,errorDiscriminationStrategy:i,security:a,environments:o,mode:c,ir:d}){let s=jD(d.basePath!=null?dKf(d.basePath):"",dKf(t.basePath),dKf(e.path));s=s.startsWith("/")?s:`/${s}`;let u=MCM(e.method),l=d.pathParameters.map(U=>fKf({pathParameter:U,examples:e.userSpecifiedExamples.map(R=>R.example).filter(Zw)??[]})),m=t.pathParameters.map(U=>fKf({pathParameter:U,examples:e.userSpecifiedExamples.map(R=>R.example).filter(Zw)??[]})),A=e.pathParameters.map(U=>fKf({pathParameter:U,examples:e.userSpecifiedExamples.map(R=>R.example).filter(Zw)??[]})),P=e.queryParameters.map(U=>NCM({queryParameter:U,typesByName:r,examples:e.userSpecifiedExamples.map(R=>R.example).filter(Zw)??[]})),C=e.headers.map(U=>FCM({httpHeader:U,typesByName:r,examples:e.userSpecifiedExamples.map(R=>R.example).filter(Zw)??[]})),M=[...l,...m,...A,...P,...C],T=c==="stoplight"?t.displayName??t.name.fernFilepath.allParts.map(U=>U.originalName).join(" "):t.name.fernFilepath.allParts.map(U=>U.pascalCase.unsafeName).join(""),z={description:e.docs??void 0,operationId:[...t.name.fernFilepath.allParts.map(U=>U.camelCase.unsafeName),e.name.originalName].join("_"),tags:[T],parameters:M,responses:TCM({httpResponse:e.response,responseErrors:e.errors,errorsByName:n,errorDiscriminationStrategy:i,examples:e.userSpecifiedExamples.map(U=>U.example).filter(Zw)??[]}),summary:e.displayName??void 0};if(e.baseUrl!=null){let U=e.baseUrl;if(o?.environments.type!=="multipleBaseUrls")throw new Error("baseUrl is defined environments are not multipleBaseUrls");z.servers=o.environments.environments.map(R=>{let V=R.urls[U];if(V==null)throw new Error("No URL defined for "+U);let $={url:V};return R.docs!=null&&($.description=R.docs),$})}return e.auth&&(z.security=a),e.requestBody!=null&&(z.requestBody=BCM({httpRequest:e.requestBody,typesByName:r,examples:e.userSpecifiedExamples.map(U=>U.example).filter(Zw)??[]})),{fullPath:s,convertedHttpMethod:u,operationObject:z}}function MCM(e){return c9._visit(e,{get:()=>d_a.OpenAPIV3.HttpMethods.GET,post:()=>d_a.OpenAPIV3.HttpMethods.POST,put:()=>d_a.OpenAPIV3.HttpMethods.PUT,patch:()=>d_a.OpenAPIV3.HttpMethods.PATCH,delete:()=>d_a.OpenAPIV3.HttpMethods.DELETE,head:()=>d_a.OpenAPIV3.HttpMethods.HEAD,_other:()=>{throw new Error("Encountered unknown http method: "+e)}})}function BCM({httpRequest:e,typesByName:t,examples:r}){let n={};for(let i of r)i.request!=null&&(i.name&&i.name.originalName!==""?n[i.name.originalName]={value:i.request.jsonExample}:n[`Example${Q7(n)+1}`]={value:i.request.jsonExample});return F2._visit(e,{inlinedRequestBody:i=>{let a={schema:JGs({docs:void 0,properties:i.properties.map(o=>{let c;return r.length>0&&r[0]?.request?.type==="inlinedRequestBody"&&(c=r[0]?.request.properties.find(d=>d.name.wireValue===o.name.wireValue)),{docs:o.docs??void 0,name:o.name,valueType:o.valueType,example:c}}),extensions:i.extends})};return Q7(n)>0&&(a.examples=n),{required:!0,content:{"application/json":a}}},reference:i=>{let a={schema:Zee(i.requestBodyType)};return Q7(n)>0&&(a.examples=n),{description:i.docs??void 0,required:KGs({typeReference:i.requestBodyType,typesByName:t}),content:{"application/json":a}}},fileUpload:i=>({required:!0,content:{"multipart/form-data":{schema:{type:"object",properties:i.properties.reduce((a,o)=>(vie._visit(o,{file:c=>{a[c.key.wireValue]={type:"string",format:"binary"}},bodyProperty:c=>{a[c.name.wireValue]={description:c.docs??void 0,...Zee(c.valueType)}},_other:()=>{throw new Error("Unknown FileUploadRequestProperty: "+o.type)}}),{...a}),{})}}}}),bytes:()=>{throw new Error("bytes is not supported")},_other:()=>{throw new Error("Unknown HttpRequestBody type: "+e.type)}})}function TCM({httpResponse:e,responseErrors:t,errorsByName:r,errorDiscriminationStrategy:n,examples:i}){let a={};if(e?.body?.type==="json"){let o={schema:Zee(e.body.value.responseBodyType)},c={};for(let d of i)d.response.type==="ok"&&d.response.value.type==="body"&&d.response.value.value!=null&&(d.name&&d.name.originalName!==""?c[d.name.originalName]={value:d.response.value.value.jsonExample}:c[`Example${Q7(c)+1}`]={value:d.response.value.value.jsonExample});Q7(c)>0&&(o.examples=c),a[String(e.statusCode??200)]={description:e.body.value.docs??"",content:{"application/json":o}}}else a[204]={description:""};return _nt._visit(n,{statusCode:()=>{for(let o of t){let c=r[$Gs(o.error)];if(c==null)throw new Error("Encountered undefined error declaration: "+o.error.name.originalName);let d={description:o.docs??""};if(c.type!=null){let s={schema:Zee(c.type)},u={};for(let l of i)l.response.type==="error"&&l.response.body!=null&&xue(o.error,l.response.error)&&(l.name&&l.name.originalName!==""?u[l.name.originalName]={value:l.response.body.jsonExample}:u[`Example${Q7(u)+1}`]={value:l.response.body.jsonExample});Q7(u)>0&&(s.examples=u),d.content={"application/json":s}}a[c.statusCode]=d}},property:o=>{let c=RCM({responseErrors:t,errorsByName:r});for(let d of Object.keys(c)){let s=c[d];if(s==null||s.length===0)continue;let u={schema:{oneOf:s.map(m=>qCM({errorInfo:m,property:o}))}},l={};for(let m of i)if(m.response.type==="error"&&m.response.body!=null){let A=m.response.error;s.some(P=>xue(P.errorDeclaration.name,A))&&(m.name&&m.name.originalName!==""?l[m.name.originalName]={value:m.response.body.jsonExample}:l[`Example${Q7(l)+1}`]={value:m.response.body.jsonExample})}Q7(l)>0&&(u.examples=l),a[d]={description:"",content:{"application/json":u}}}},_other:()=>{throw new Error("Unknown error discrimination strategy: "+n.type)}}),a}function qCM({errorInfo:e,property:t}){let r=e.errorDeclaration.discriminantValue.wireValue,n=e.responseError.docs??void 0,i={[t.discriminant.wireValue]:{type:"string",enum:[r]}};return e.errorDeclaration.type!=null&&(i[t.contentProperty.wireValue]=Zee(e.errorDeclaration.type)),{type:"object",description:n,properties:i}}function RCM({responseErrors:e,errorsByName:t}){let r={};for(let n of e){let i=t[$Gs(n.error)];if(i==null)throw new Error("Encountered undefined error declaration: "+n.error.name.originalName);let a=i.statusCode,o=r[a];o==null?r[a]=[{responseError:n,errorDeclaration:i}]:o.push({responseError:n,errorDeclaration:i})}return r}function fKf({pathParameter:e,examples:t}){let r={name:e.name.originalName,in:"path",description:e.docs??void 0,required:!0,schema:Zee(e.valueType)},n={};for(let i of t){let a=[...i.rootPathParameters,...i.servicePathParameters,...i.endpointPathParameters].find(o=>o.name.originalName===e.name.originalName);a!=null&&(i.name&&i.name.originalName!==""?n[i.name.originalName]={value:a.value.jsonExample}:n[`Example${Q7(n)+1}`]={value:a.value.jsonExample},r.example==null&&(r.example=a.value.jsonExample))}return Q7(n)>0&&(r.examples=n),r}function NCM({queryParameter:e,typesByName:t,examples:r}){let n={name:e.name.wireValue,in:"query",description:e.docs??void 0,required:KGs({typeReference:e.valueType,typesByName:t}),schema:e.allowMultiple?Zee(mh.container(Iw.list(e.valueType))):Zee(e.valueType)},i={};for(let a of r){let o=a.queryParameters.find(c=>c.name.wireValue===e.name.wireValue);o!=null&&(a.name&&a.name.originalName!==""?i[a.name.originalName]={value:o.value.jsonExample}:i[`Example${Q7(i)+1}`]={value:o.value.jsonExample},n.example==null&&(n.example=o.value.jsonExample))}return Q7(i)>0&&(n.examples=i),n}function FCM({httpHeader:e,typesByName:t,examples:r}){let n={name:e.name.wireValue,in:"header",description:e.docs??void 0,required:KGs({typeReference:e.valueType,typesByName:t}),schema:Zee(e.valueType)},i={};for(let a of r){let o=[...a.serviceHeaders,...a.endpointHeaders].find(c=>c.name.wireValue===e.name.wireValue);o!=null&&(a.name&&a.name.originalName!==""?i[a.name.originalName]={value:o.value.jsonExample}:i[`Example${Q7(i)+1}`]={value:o.value.jsonExample},n.example==null&&(n.example=o.value.jsonExample))}return Q7(i)>0&&(n.examples=i),n}function dKf(e){let t=e.head;for(let r of e.parts)t+=`{${r.pathParameter}}${r.tail}`;return t}function KGs({typeReference:e,typesByName:t}){if(e.type==="container"&&e.container.type==="optional")return!1;if(e.type==="named"){let r=pKf(e),n=t[r];if(n==null)throw new Error("Encountered non-existent type: "+e.name.originalName);if(n.shape.type==="alias")return KGs({typeReference:n.shape.aliasOf,typesByName:t})}return!0}function Vtb(e){return TPe._visit(e.requirement,{all:()=>[e.schemes.reduce((t,r)=>({...t,[_Kf(r)]:[]}),{})],any:()=>e.schemes.map(t=>({[_Kf(t)]:[]})),_other:()=>{throw new Error("Unknown auth scheme requirement: "+e.requirement)}})}function Wtb(e){let t={};for(let r of e.schemes){let n=N2._visit(r,{bearer:()=>({type:"http",scheme:"bearer"}),basic:()=>({type:"http",scheme:"basic"}),header:i=>({type:"apiKey",in:"header",name:i.name.wireValue}),oauth:()=>({type:"http",scheme:"bearer"}),inferred:()=>{},_other:()=>{throw new Error("Unknown auth scheme: "+r.type)}});n&&(t[_Kf(r)]=n)}return t}function _Kf(e){return N2._visit(e,{bearer:()=>"BearerAuth",inferred:()=>"InferredAuth",basic:()=>"BasicAuth",oauth:()=>"BearerAuth",header:t=>`${t.name.name.pascalCase.unsafeName}Auth`,_other:()=>{throw new Error("Unknown auth scheme: "+e.type)}})}function Htb({apiName:e,ir:t,mode:r}){let n={},i={};Object.values(t.types).forEach(u=>{let l=Qtb(u,t);n[l.schemaName]={title:l.schemaName,...l.openApiSchema},i[pKf(u.name)]=u});let a={};Object.values(t.errors).forEach(u=>{a[$Gs(u.name)]=u});let o=Vtb(t.auth),c=Utb({ir:t,httpServices:Object.values(t.services),typesByName:i,errorsByName:a,errorDiscriminationStrategy:t.errorDiscriminationStrategy,security:o,environments:t.environments??void 0,mode:r}),d={title:t.apiDisplayName??e,version:""};t.apiDocs!=null&&(d.description=t.apiDocs);let s={openapi:"3.0.1",info:d,paths:c,components:{schemas:n,securitySchemes:Wtb(t.auth)}};return t.environments!=null&&t.environments.environments.type==="singleBaseUrl"&&(s.servers=t.environments.environments.environments.map(u=>({url:u.url,description:u.docs!=null?`${u.name.originalName} (${u.docs})`:u.name.originalName}))),s}function pKf(e){return[...e.fernFilepath.allParts.map(t=>t.originalName),e.name.originalName].join("-")}function $Gs(e){return[...e.fernFilepath.allParts.map(t=>t.originalName),e.name.originalName].join("-")}async function Gtb({project:e,cliContext:t,outputPath:r}){await Promise.all(e.apiWorkspaces.map(async n=>{await t.runTaskForWorkspace(n,async i=>{let a=await n.toFernWorkspace({context:i}),o=qH({workspace:a,audiences:{type:"all"},generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!0},readme:void 0,version:void 0,packageName:void 0,context:i,sourceResolver:new BH(i,a)}),c=Htb({apiName:n.workspaceName??"api",ir:o,mode:"openapi"});await(0,YGs.mkdir)(Ug(r),{recursive:!0}),await(0,YGs.writeFile)(r,r.endsWith(".json")?JSON.stringify(c,void 0,2):Vg.dump(c))})}))}async function Jtb({project:e,cliContext:t,shouldFix:r}){await Promise.all(e.apiWorkspaces.map(async n=>{n instanceof B$||await t.runTaskForWorkspace(n,async i=>{await A0f({workspace:await n.toFernWorkspace({context:i}),context:i,shouldFix:r})})}))}var Ktb="group";var $tb=".preview",Ytb="approved-output-directories",Xtb=".fern";var nrb=require("fs/promises");var ktb=require("fs/promises");var Ztb=require("os");function dau(){return Jl(x_.of((0,Ztb.homedir)()),ys.of(Xtb),ys.of(Ytb))}async function erb(){let e=dau();if(!await Tv(e))return[];let r=await(0,ktb.readFile)(e,{encoding:"utf-8"});return JSON.parse(r)}var XGs=require("fs/promises"),trb=fa(require("path"),1);async function rrb(e){await(0,XGs.mkdir)(trb.default.dirname(dau()),{recursive:!0}),await(0,XGs.writeFile)(dau(),JSON.stringify(e,null,2))}async function irb(e,t,r){if(!e||mZl()||r)return{shouldProceed:!0};let n=await erb();return n?.includes(e)?{shouldProceed:!0}:await Tv(e)?(await(0,nrb.readdir)(e)).length===0?{shouldProceed:!0}:await t.confirmPrompt(`Directory ${e} contains existing files that may be overwritten. Continue?`,!1)?(await rrb([...n??[],e]),{shouldProceed:!0}):{shouldProceed:!1}:{shouldProceed:!0}}var arb=require("fs/promises"),orb=fa(OCe(),1);async function hKf({logger:e,imageName:t,args:r=[],binds:n=[],envVars:i={},ports:a={},writeLogsToFile:o=!0,removeAfterCompletion:c=!1,runner:d}){let s=()=>xCM({logger:e,imageName:t,args:r,binds:n,envVars:i,ports:a,removeAfterCompletion:c,writeLogsToFile:o,runner:d});try{await s()}catch(u){if(u instanceof Error&&u.message.includes("No such image"))await zCM(t),await s();else throw u}}async function xCM({logger:e,imageName:t,args:r,binds:n,envVars:i={},ports:a={},removeAfterCompletion:o,writeLogsToFile:c,runner:d}){let s=["run","--user","root",...n.flatMap(P=>["-v",P]),...Object.entries(i).flatMap(([P,C])=>["-e",`${P}="${C}"`]),...Object.entries(a).flatMap(([P,C])=>["-p",`${P}:${C}`]),o?"--rm":"",t,...r].filter(Boolean),{stdout:u,stderr:l,exitCode:m}=await MH(e,d??"docker",s,{reject:!1,all:!0,doNotPipeOutput:!0}),A=u+l;if(c){let P=await orb.default.file();await(0,arb.writeFile)(P.path,A),e.info(`Generator logs here: ${P.path}`)}if(m!==0)throw new Error(`Docker exited with code ${m}.
|
|
3032
|
+
`)}function vCM(e){return e.some(t=>t.severity==="fatal")?"fatal":e.some(t=>t.severity==="error")?"error":"warning"}function bCM(e){switch(e){case"fatal":return K1.Error;case"error":return K1.Error;case"warning":return K1.Warn;default:tc(e)}}function gCM({stats:e,context:t,logWarnings:r,elapsedMillis:n=0}){let{numFatal:i,numErrors:a,numWarnings:o}=e,c=n>0?` in ${(n/1e3).toFixed(3)} seconds.`:".",d=`Found ${i+a} errors and ${o} warnings`+c;!r&&o>0&&(d+=" Run fern check --warnings to print out the warnings not shown."),i+a>0?t.logger.error(d):o>0?t.logger.warn(d):t.logger.info(bd.green("\u2713 All checks passed"))}function mCM(e){let t=0,r=0,n=0;for(let i of e)switch(i.severity){case"fatal":t+=1;continue;case"error":r+=1;continue;case"warning":n+=1;continue;default:tc(i.severity)}return{numFatal:t,numErrors:r,numWarnings:n}}async function sso({workspace:e,apiWorkspaces:t,ossWorkspaces:r,context:n,logWarnings:i,errorOnBrokenLinks:a,logSummary:o=!0,excludeRules:c}){let d=performance.now(),s=await fau(e,n,t,r,!1,c),u=performance.now()-d,{hasErrors:l}=uso({violations:s,context:n,logWarnings:i,logSummary:o,logBreadcrumbs:!1,elapsedMillis:u});return a&&(l=l||s.some(m=>m.name==="valid-markdown-links")),{hasErrors:l}}async function HGs({workspace:e,apiWorkspaces:t,ossWorkspaces:r,context:n,logWarnings:i,errorOnBrokenLinks:a,excludeRules:o}){let{hasErrors:c}=await sso({workspace:e,context:n,logWarnings:i,apiWorkspaces:t,ossWorkspaces:r,errorOnBrokenLinks:a,excludeRules:o});c&&n.failAndThrow()}async function ztb({loadProject:e,cliContext:t,port:r,bundlePath:n,brokenLinks:i,legacyPreview:a,backendPort:o}){let c=await e(),d=c.docsWorkspaces;d!=null&&(a&&(await t.instrumentPostHogEvent({orgId:c.config.organization,command:"fern docs dev --legacy"}),await t.runTaskForWorkspace(d,async s=>{s.logger.info(`Starting server on port ${r}`),await bJf({initialProject:c,reloadProject:e,validateProject:async u=>{let l=u.docsWorkspaces;if(l==null)return;let m=i?[]:["valid-markdown-links"],A=l.config.experimental?.openapiParserV3;A==null||A?await sso({workspace:l,context:s,logWarnings:!0,logSummary:!1,apiWorkspaces:[],ossWorkspaces:await age(u),excludeRules:m}):await sso({workspace:l,context:s,logWarnings:!0,logSummary:!1,apiWorkspaces:u.apiWorkspaces,ossWorkspaces:await age(u),excludeRules:m})},context:s,port:r,bundlePath:n})})),await t.instrumentPostHogEvent({orgId:c.config.organization,command:"fern docs dev --beta"}),await t.runTaskForWorkspace(d,async s=>{s.logger.info(`Starting server on port ${r}`),await yJf({initialProject:c,reloadProject:e,validateProject:async u=>{let l=u.docsWorkspaces;if(l==null)return;let m=i?[]:["valid-markdown-links"],A=l.config.experimental?.openapiParserV3;A==null||A?await sso({workspace:l,context:s,logWarnings:!0,logSummary:!1,apiWorkspaces:[],ossWorkspaces:await age(u),excludeRules:m}):await sso({workspace:l,context:s,logWarnings:!0,logSummary:!1,apiWorkspaces:u.apiWorkspaces,ossWorkspaces:await age(u),excludeRules:m})},context:s,port:r,bundlePath:n,backendPort:o})}))}var YGs=require("fs/promises");var d_a=fa(b8s(),1);uI();function Qtb(e,t){let r=e.shape,n=e.docs??void 0;return{openApiSchema:xE._visit(r,{alias:a=>OCM({aliasTypeDeclaration:a,docs:n}),enum:a=>ACM({enumTypeDeclaration:a,docs:n}),object:a=>{let o=e.userProvidedExamples[0],c=o==null?SCM(t,e.name):void 0,d=o==null&&c==null?DCM(t,e.name):void 0;return JGs({properties:a.properties.map(s=>{let u;return o!=null&&o.shape.type==="object"?u=o.shape.properties.find(l=>l.name.wireValue===s.name.wireValue):c!=null?c.type==="reference"&&c.shape.type==="named"&&c.shape.shape.type==="object"&&(u=c.shape.shape.properties.find(l=>l.name.wireValue===s.name.wireValue)):d!=null&&d.type==="body"&&d.value?.shape.type==="named"&&d.value.shape.shape.type==="object"&&(u=d.value.shape.shape.properties.find(l=>l.name.wireValue===s.name.wireValue)),{docs:s.docs??void 0,name:s.name,valueType:s.valueType,example:u}}),extensions:a.extends,docs:n})},union:a=>PCM({unionTypeDeclaration:a,docs:n}),undiscriminatedUnion:a=>wCM({undiscriminatedUnionDeclaration:a,docs:n}),_other:()=>{throw new Error("Encountered unknown type: "+r.type)}}),schemaName:Ltb(e.name)}}function OCM({aliasTypeDeclaration:e,docs:t}){return{...Zee(e.aliasOf),description:t}}function ACM({enumTypeDeclaration:e,docs:t}){return{type:"string",enum:e.values.map(r=>r.name.wireValue),description:t}}function PCM({unionTypeDeclaration:e,docs:t}){let n={oneOf:e.types.map(i=>{let a={[e.discriminant.wireValue]:{type:"string",enum:[i.discriminantValue.wireValue]}};return _de._visit(i.shape,{noProperties:()=>({type:"object",properties:a,required:[e.discriminant.wireValue]}),singleProperty:o=>({type:"object",properties:{...a,[o.name.wireValue]:Zee(o.type)},required:[e.discriminant.wireValue]}),samePropertiesAsObject:o=>({type:"object",allOf:[{type:"object",properties:a},{$ref:GGs(o)}],required:[e.discriminant.wireValue]}),_other:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+i.shape.propertiesType)}})}),description:t};return e.baseProperties.length>0&&(n.properties=e.baseProperties.reduce((i,a)=>(i[a.name.wireValue]={description:a.docs??void 0,...Zee(a.valueType)},a.valueType.type==="container"&&a.valueType.container.type==="optional"||(n.required=[...n.required??[],a.name.wireValue]),i),{})),n}function wCM({undiscriminatedUnionDeclaration:e,docs:t}){return{oneOf:e.members.map(r=>({description:r.docs??void 0,...Zee(r.type)})),description:t}}function Zee(e){return mh._visit(e,{container:t=>ECM(t),named:t=>({$ref:GGs(t)}),primitive:t=>jCM(t),unknown:()=>({}),_other:()=>{throw new Error("Encountered unknown typeReference: "+e.type)}})}function jCM(e){return e.v2==null?JP._visit(e.v1,{boolean:()=>({type:"boolean"}),dateTime:()=>({type:"string",format:"date-time"}),double:()=>({type:"number",format:"double"}),integer:()=>({type:"integer"}),long:()=>({type:"integer",format:"int64"}),string:()=>({type:"string"}),uuid:()=>({type:"string",format:"uuid"}),date:()=>({type:"string",format:"date"}),base64:()=>({type:"string",format:"byte"}),uint:()=>({type:"integer",format:"int64"}),uint64:()=>({type:"integer",format:"int64"}),float:()=>({type:"number",format:"float"}),bigInteger:()=>({type:"integer",format:"bigint"}),_other:()=>{throw new Error("Encountered unknown primitiveType: "+e.v1)}})??{}:Yg._visit(e.v2,{boolean:()=>({type:"boolean"}),dateTime:()=>({type:"string",format:"date-time"}),double:()=>({type:"number",format:"double"}),integer:()=>({type:"integer"}),long:()=>({type:"integer",format:"int64"}),string:t=>{let r={type:"string"};return t.validation?.format!=null&&(r.format=t.validation.format),t.validation?.pattern!=null&&(r.pattern=t.validation.pattern),r},uuid:()=>({type:"string",format:"uuid"}),date:()=>({type:"string",format:"date"}),base64:()=>({type:"string",format:"byte"}),uint:()=>({type:"integer",format:"int64"}),uint64:()=>({type:"integer",format:"int64"}),float:()=>({type:"number",format:"float"}),bigInteger:()=>({type:"integer",format:"bigint"}),_other:()=>{throw new Error("Encountered unknown primitiveType: "+e.v2)}})}function ECM(e){return Iw._visit(e,{list:t=>({type:"array",items:Zee(t)}),set:t=>({type:"array",items:Zee(t)}),map:t=>t.keyType.type==="primitive"&&t.keyType.primitive.v1==="STRING"&&t.valueType.type==="unknown"?{type:"object",additionalProperties:!0}:{type:"object",additionalProperties:Zee(t.valueType)},optional:t=>({...Zee(t),nullable:!0}),nullable:t=>({...Zee(t),nullable:!0}),literal:t=>t._visit({boolean:r=>({type:"boolean",const:r}),string:r=>({type:"string",const:r}),_other:()=>({})}),_other:()=>{throw new Error("Encountered unknown containerType: "+e.type)}})}function GGs(e){return`#/components/schemas/${Ltb(e)}`}function Ltb(e){return[...e.fernFilepath.packagePath.map(t=>t.originalName),e.name.originalName].join("")}function SCM(e,t){for(let r of Object.values(e.services))for(let n of r.endpoints)if(!(n.userSpecifiedExamples.length<=0)&&n.requestBody?.type==="reference"&&n.requestBody.requestBodyType.type==="named"&&CCM(n.requestBody.requestBodyType,t))return n.userSpecifiedExamples[0]?.example?.request??void 0}function DCM(e,t){for(let r of Object.values(e.services))for(let n of r.endpoints)if(!(n.userSpecifiedExamples.length<=0||n.response?.body?.type!=="json")&&n.response.body.value.responseBodyType.type==="named"&&n.response.body.value.responseBodyType.typeId===t.typeId){let i=n.userSpecifiedExamples.find(a=>a.example?.response.type==="ok");if(i!=null&&i.example?.response.type==="ok")return i.example.response.value}}function CCM(e,t){return xue(e.fernFilepath,t.fernFilepath)&&xue(e.name,t.name)}function JGs({docs:e,properties:t,extensions:r}){let n={},i=[];t.forEach(o=>{let c=Zee(o.valueType),d;(o.example!=null&&o.valueType.type==="primitive"||o.example!=null&&o.valueType.type==="container"&&o.valueType.container.type==="list"&&o.valueType.container.list.type==="primitive")&&(d=o.example.value.jsonExample),n[o.name.wireValue]={...c,description:o.docs??void 0,example:d},o.valueType.type==="container"&&o.valueType.container.type==="optional"||i.push(o.name.wireValue)});let a={type:"object",description:e,properties:n};return i.length>0&&(a.required=i),r.length>0&&(a.allOf=r.map(o=>({$ref:GGs(o)}))),a}function Utb({ir:e,httpServices:t,typesByName:r,errorsByName:n,errorDiscriminationStrategy:i,security:a,environments:o,mode:c}){let d={};return t.forEach(s=>{s.endpoints.forEach(u=>{let{fullPath:l,convertedHttpMethod:m,operationObject:A}=ICM({ir:e,httpEndpoint:u,httpService:s,typesByName:r,errorsByName:n,errorDiscriminationStrategy:i,security:a,environments:o,mode:c}),P=d[l]??={};if(P[m]!=null)throw new Error(`Duplicate ${m} endpoint at ${l}`);P[m]=A})}),d}function ICM({httpEndpoint:e,httpService:t,typesByName:r,errorsByName:n,errorDiscriminationStrategy:i,security:a,environments:o,mode:c,ir:d}){let s=jD(d.basePath!=null?dKf(d.basePath):"",dKf(t.basePath),dKf(e.path));s=s.startsWith("/")?s:`/${s}`;let u=MCM(e.method),l=d.pathParameters.map(U=>fKf({pathParameter:U,examples:e.userSpecifiedExamples.map(R=>R.example).filter(Zw)??[]})),m=t.pathParameters.map(U=>fKf({pathParameter:U,examples:e.userSpecifiedExamples.map(R=>R.example).filter(Zw)??[]})),A=e.pathParameters.map(U=>fKf({pathParameter:U,examples:e.userSpecifiedExamples.map(R=>R.example).filter(Zw)??[]})),P=e.queryParameters.map(U=>NCM({queryParameter:U,typesByName:r,examples:e.userSpecifiedExamples.map(R=>R.example).filter(Zw)??[]})),C=e.headers.map(U=>FCM({httpHeader:U,typesByName:r,examples:e.userSpecifiedExamples.map(R=>R.example).filter(Zw)??[]})),M=[...l,...m,...A,...P,...C],T=c==="stoplight"?t.displayName??t.name.fernFilepath.allParts.map(U=>U.originalName).join(" "):t.name.fernFilepath.allParts.map(U=>U.pascalCase.unsafeName).join(""),z={description:e.docs??void 0,operationId:[...t.name.fernFilepath.allParts.map(U=>U.camelCase.unsafeName),e.name.originalName].join("_"),tags:[T],parameters:M,responses:TCM({httpResponse:e.response,responseErrors:e.errors,errorsByName:n,errorDiscriminationStrategy:i,examples:e.userSpecifiedExamples.map(U=>U.example).filter(Zw)??[]}),summary:e.displayName??void 0};if(e.baseUrl!=null){let U=e.baseUrl;if(o?.environments.type!=="multipleBaseUrls")throw new Error("baseUrl is defined environments are not multipleBaseUrls");z.servers=o.environments.environments.map(R=>{let V=R.urls[U];if(V==null)throw new Error("No URL defined for "+U);let $={url:V};return R.docs!=null&&($.description=R.docs),$})}return e.auth&&(z.security=a),e.requestBody!=null&&(z.requestBody=BCM({httpRequest:e.requestBody,typesByName:r,examples:e.userSpecifiedExamples.map(U=>U.example).filter(Zw)??[]})),{fullPath:s,convertedHttpMethod:u,operationObject:z}}function MCM(e){return c9._visit(e,{get:()=>d_a.OpenAPIV3.HttpMethods.GET,post:()=>d_a.OpenAPIV3.HttpMethods.POST,put:()=>d_a.OpenAPIV3.HttpMethods.PUT,patch:()=>d_a.OpenAPIV3.HttpMethods.PATCH,delete:()=>d_a.OpenAPIV3.HttpMethods.DELETE,head:()=>d_a.OpenAPIV3.HttpMethods.HEAD,_other:()=>{throw new Error("Encountered unknown http method: "+e)}})}function BCM({httpRequest:e,typesByName:t,examples:r}){let n={};for(let i of r)i.request!=null&&(i.name&&i.name.originalName!==""?n[i.name.originalName]={value:i.request.jsonExample}:n[`Example${Q7(n)+1}`]={value:i.request.jsonExample});return F2._visit(e,{inlinedRequestBody:i=>{let a={schema:JGs({docs:void 0,properties:i.properties.map(o=>{let c;return r.length>0&&r[0]?.request?.type==="inlinedRequestBody"&&(c=r[0]?.request.properties.find(d=>d.name.wireValue===o.name.wireValue)),{docs:o.docs??void 0,name:o.name,valueType:o.valueType,example:c}}),extensions:i.extends})};return Q7(n)>0&&(a.examples=n),{required:!0,content:{"application/json":a}}},reference:i=>{let a={schema:Zee(i.requestBodyType)};return Q7(n)>0&&(a.examples=n),{description:i.docs??void 0,required:KGs({typeReference:i.requestBodyType,typesByName:t}),content:{"application/json":a}}},fileUpload:i=>({required:!0,content:{"multipart/form-data":{schema:{type:"object",properties:i.properties.reduce((a,o)=>(vie._visit(o,{file:c=>{a[c.key.wireValue]={type:"string",format:"binary"}},bodyProperty:c=>{a[c.name.wireValue]={description:c.docs??void 0,...Zee(c.valueType)}},_other:()=>{throw new Error("Unknown FileUploadRequestProperty: "+o.type)}}),{...a}),{})}}}}),bytes:()=>{throw new Error("bytes is not supported")},_other:()=>{throw new Error("Unknown HttpRequestBody type: "+e.type)}})}function TCM({httpResponse:e,responseErrors:t,errorsByName:r,errorDiscriminationStrategy:n,examples:i}){let a={};if(e?.body?.type==="json"){let o={schema:Zee(e.body.value.responseBodyType)},c={};for(let d of i)d.response.type==="ok"&&d.response.value.type==="body"&&d.response.value.value!=null&&(d.name&&d.name.originalName!==""?c[d.name.originalName]={value:d.response.value.value.jsonExample}:c[`Example${Q7(c)+1}`]={value:d.response.value.value.jsonExample});Q7(c)>0&&(o.examples=c),a[String(e.statusCode??200)]={description:e.body.value.docs??"",content:{"application/json":o}}}else a[204]={description:""};return _nt._visit(n,{statusCode:()=>{for(let o of t){let c=r[$Gs(o.error)];if(c==null)throw new Error("Encountered undefined error declaration: "+o.error.name.originalName);let d={description:o.docs??""};if(c.type!=null){let s={schema:Zee(c.type)},u={};for(let l of i)l.response.type==="error"&&l.response.body!=null&&xue(o.error,l.response.error)&&(l.name&&l.name.originalName!==""?u[l.name.originalName]={value:l.response.body.jsonExample}:u[`Example${Q7(u)+1}`]={value:l.response.body.jsonExample});Q7(u)>0&&(s.examples=u),d.content={"application/json":s}}a[c.statusCode]=d}},property:o=>{let c=RCM({responseErrors:t,errorsByName:r});for(let d of Object.keys(c)){let s=c[d];if(s==null||s.length===0)continue;let u={schema:{oneOf:s.map(m=>qCM({errorInfo:m,property:o}))}},l={};for(let m of i)if(m.response.type==="error"&&m.response.body!=null){let A=m.response.error;s.some(P=>xue(P.errorDeclaration.name,A))&&(m.name&&m.name.originalName!==""?l[m.name.originalName]={value:m.response.body.jsonExample}:l[`Example${Q7(l)+1}`]={value:m.response.body.jsonExample})}Q7(l)>0&&(u.examples=l),a[d]={description:"",content:{"application/json":u}}}},_other:()=>{throw new Error("Unknown error discrimination strategy: "+n.type)}}),a}function qCM({errorInfo:e,property:t}){let r=e.errorDeclaration.discriminantValue.wireValue,n=e.responseError.docs??void 0,i={[t.discriminant.wireValue]:{type:"string",enum:[r]}};return e.errorDeclaration.type!=null&&(i[t.contentProperty.wireValue]=Zee(e.errorDeclaration.type)),{type:"object",description:n,properties:i}}function RCM({responseErrors:e,errorsByName:t}){let r={};for(let n of e){let i=t[$Gs(n.error)];if(i==null)throw new Error("Encountered undefined error declaration: "+n.error.name.originalName);let a=i.statusCode,o=r[a];o==null?r[a]=[{responseError:n,errorDeclaration:i}]:o.push({responseError:n,errorDeclaration:i})}return r}function fKf({pathParameter:e,examples:t}){let r={name:e.name.originalName,in:"path",description:e.docs??void 0,required:!0,schema:Zee(e.valueType)},n={};for(let i of t){let a=[...i.rootPathParameters,...i.servicePathParameters,...i.endpointPathParameters].find(o=>o.name.originalName===e.name.originalName);a!=null&&(i.name&&i.name.originalName!==""?n[i.name.originalName]={value:a.value.jsonExample}:n[`Example${Q7(n)+1}`]={value:a.value.jsonExample},r.example==null&&(r.example=a.value.jsonExample))}return Q7(n)>0&&(r.examples=n),r}function NCM({queryParameter:e,typesByName:t,examples:r}){let n={name:e.name.wireValue,in:"query",description:e.docs??void 0,required:KGs({typeReference:e.valueType,typesByName:t}),schema:e.allowMultiple?Zee(mh.container(Iw.list(e.valueType))):Zee(e.valueType)},i={};for(let a of r){let o=a.queryParameters.find(c=>c.name.wireValue===e.name.wireValue);o!=null&&(a.name&&a.name.originalName!==""?i[a.name.originalName]={value:o.value.jsonExample}:i[`Example${Q7(i)+1}`]={value:o.value.jsonExample},n.example==null&&(n.example=o.value.jsonExample))}return Q7(i)>0&&(n.examples=i),n}function FCM({httpHeader:e,typesByName:t,examples:r}){let n={name:e.name.wireValue,in:"header",description:e.docs??void 0,required:KGs({typeReference:e.valueType,typesByName:t}),schema:Zee(e.valueType)},i={};for(let a of r){let o=[...a.serviceHeaders,...a.endpointHeaders].find(c=>c.name.wireValue===e.name.wireValue);o!=null&&(a.name&&a.name.originalName!==""?i[a.name.originalName]={value:o.value.jsonExample}:i[`Example${Q7(i)+1}`]={value:o.value.jsonExample},n.example==null&&(n.example=o.value.jsonExample))}return Q7(i)>0&&(n.examples=i),n}function dKf(e){let t=e.head;for(let r of e.parts)t+=`{${r.pathParameter}}${r.tail}`;return t}function KGs({typeReference:e,typesByName:t}){if(e.type==="container"&&e.container.type==="optional")return!1;if(e.type==="named"){let r=pKf(e),n=t[r];if(n==null)throw new Error("Encountered non-existent type: "+e.name.originalName);if(n.shape.type==="alias")return KGs({typeReference:n.shape.aliasOf,typesByName:t})}return!0}function Vtb(e){return TPe._visit(e.requirement,{all:()=>[e.schemes.reduce((t,r)=>({...t,[_Kf(r)]:[]}),{})],any:()=>e.schemes.map(t=>({[_Kf(t)]:[]})),_other:()=>{throw new Error("Unknown auth scheme requirement: "+e.requirement)}})}function Wtb(e){let t={};for(let r of e.schemes){let n=N2._visit(r,{bearer:()=>({type:"http",scheme:"bearer"}),basic:()=>({type:"http",scheme:"basic"}),header:i=>({type:"apiKey",in:"header",name:i.name.wireValue}),oauth:()=>({type:"http",scheme:"bearer"}),inferred:()=>{},_other:()=>{throw new Error("Unknown auth scheme: "+r.type)}});n&&(t[_Kf(r)]=n)}return t}function _Kf(e){return N2._visit(e,{bearer:()=>"BearerAuth",inferred:()=>"InferredAuth",basic:()=>"BasicAuth",oauth:()=>"BearerAuth",header:t=>`${t.name.name.pascalCase.unsafeName}Auth`,_other:()=>{throw new Error("Unknown auth scheme: "+e.type)}})}function Htb({apiName:e,ir:t,mode:r}){let n={},i={};Object.values(t.types).forEach(u=>{let l=Qtb(u,t);n[l.schemaName]={title:l.schemaName,...l.openApiSchema},i[pKf(u.name)]=u});let a={};Object.values(t.errors).forEach(u=>{a[$Gs(u.name)]=u});let o=Vtb(t.auth),c=Utb({ir:t,httpServices:Object.values(t.services),typesByName:i,errorsByName:a,errorDiscriminationStrategy:t.errorDiscriminationStrategy,security:o,environments:t.environments??void 0,mode:r}),d={title:t.apiDisplayName??e,version:""};t.apiDocs!=null&&(d.description=t.apiDocs);let s={openapi:"3.0.1",info:d,paths:c,components:{schemas:n,securitySchemes:Wtb(t.auth)}};return t.environments!=null&&t.environments.environments.type==="singleBaseUrl"&&(s.servers=t.environments.environments.environments.map(u=>({url:u.url,description:u.docs!=null?`${u.name.originalName} (${u.docs})`:u.name.originalName}))),s}function pKf(e){return[...e.fernFilepath.allParts.map(t=>t.originalName),e.name.originalName].join("-")}function $Gs(e){return[...e.fernFilepath.allParts.map(t=>t.originalName),e.name.originalName].join("-")}async function Gtb({project:e,cliContext:t,outputPath:r}){await Promise.all(e.apiWorkspaces.map(async n=>{await t.runTaskForWorkspace(n,async i=>{let a=await n.toFernWorkspace({context:i}),o=qH({workspace:a,audiences:{type:"all"},generationLanguage:void 0,keywords:void 0,smartCasing:!1,exampleGeneration:{disabled:!0},readme:void 0,version:void 0,packageName:void 0,context:i,sourceResolver:new BH(i,a)}),c=Htb({apiName:n.workspaceName??"api",ir:o,mode:"openapi"});await(0,YGs.mkdir)(Ug(r),{recursive:!0}),await(0,YGs.writeFile)(r,r.endsWith(".json")?JSON.stringify(c,void 0,2):Vg.dump(c))})}))}async function Jtb({project:e,cliContext:t,shouldFix:r}){await Promise.all(e.apiWorkspaces.map(async n=>{n instanceof B$||await t.runTaskForWorkspace(n,async i=>{await A0f({workspace:await n.toFernWorkspace({context:i}),context:i,shouldFix:r})})}))}var Ktb="group";var $tb=".preview",Ytb="approved-output-directories",Xtb=".fern";var nrb=require("fs/promises");var ktb=require("fs/promises");var Ztb=require("os");function dau(){return Jl(x_.of((0,Ztb.homedir)()),ys.of(Xtb),ys.of(Ytb))}async function erb(){let e=dau();if(!await Tv(e))return[];let r=await(0,ktb.readFile)(e,{encoding:"utf-8"});return JSON.parse(r)}var XGs=require("fs/promises"),trb=fa(require("path"),1);async function rrb(e){await(0,XGs.mkdir)(trb.default.dirname(dau()),{recursive:!0}),await(0,XGs.writeFile)(dau(),JSON.stringify(e,null,2))}async function irb(e,t,r){if(!e||mZl()||r)return{shouldProceed:!0};let n=await erb();return n?.includes(e)?{shouldProceed:!0}:await Tv(e)?(await(0,nrb.readdir)(e)).length===0?{shouldProceed:!0}:await t.confirmPrompt(`Directory ${e} contains existing files that may be overwritten. Continue?`,!1)?(await rrb([...n??[],e]),{shouldProceed:!0}):{shouldProceed:!1}:{shouldProceed:!0}}var arb=require("fs/promises"),orb=fa(OCe(),1);async function hKf({logger:e,imageName:t,args:r=[],binds:n=[],envVars:i={},ports:a={},writeLogsToFile:o=!0,removeAfterCompletion:c=!1,runner:d}){let s=()=>xCM({logger:e,imageName:t,args:r,binds:n,envVars:i,ports:a,removeAfterCompletion:c,writeLogsToFile:o,runner:d});try{await s()}catch(u){if(u instanceof Error&&u.message.includes("No such image"))await zCM(t),await s();else throw u}}async function xCM({logger:e,imageName:t,args:r,binds:n,envVars:i={},ports:a={},removeAfterCompletion:o,writeLogsToFile:c,runner:d}){process.env.FERN_STACK_TRACK&&(i.FERN_STACK_TRACK="true");let s=["run","--user","root",...n.flatMap(P=>["-v",P]),...Object.entries(i).flatMap(([P,C])=>["-e",`${P}="${C}"`]),...Object.entries(a).flatMap(([P,C])=>["-p",`${P}:${C}`]),o?"--rm":"",t,...r].filter(Boolean),{stdout:u,stderr:l,exitCode:m}=await MH(e,d??"docker",s,{reject:!1,all:!0,doNotPipeOutput:!0}),A=u+l;if(c){let P=await orb.default.file();await(0,arb.writeFile)(P.path,A),e.info(`Generator logs here: ${P.path}`)}if(m!==0)throw new Error(`Docker exited with code ${m}.
|
|
3033
3033
|
${u}
|
|
3034
3034
|
${l}`)}async function zCM(e){await MH(void 0,"docker",["pull",e],{all:!0,doNotPipeOutput:!0})}var S5i=fa(require("path"),1),p_a="/fern",yKf="output",vKf="config.json",bKf="ir.json",QCM="snippet.json",LCM="snippet-templates.json",UCM="generators",VCM="sources",ZGs=S5i.default.join(p_a,yKf),pau=S5i.default.join(p_a,vKf),kGs=S5i.default.join(p_a,bKf),eJs=S5i.default.join(p_a,QCM),tJs=S5i.default.join(p_a,LCM),aiH=S5i.default.join(p_a,UCM),urb=S5i.default.join(p_a,VCM),rJs="9229";var _au=class{dockerImage;keepDocker;constructor({dockerImage:t,keepDocker:r}){this.dockerImage=t,this.keepDocker=r}async execute({generatorName:t,irPath:r,configPath:n,outputPath:i,snippetPath:a,snippetTemplatePath:o,licenseFilePath:c,context:d,inspect:s,runner:u}){d.logger.info(`Executing generator ${t} using Docker image: ${this.dockerImage}`);let l=[`${n}:${pau}:ro`,`${r}:${kGs}:ro`,`${i}:${ZGs}`];a&&l.push(`${a}:${eJs}`),o&&l.push(`${o}:${tJs}`),c&&l.push(`${c}:/tmp/LICENSE:ro`);let m={},A={};s&&(m.NODE_OPTIONS=`--inspect-brk=0.0.0.0:${rJs}`,A[rJs]=rJs),await hKf({logger:d.logger,imageName:this.dockerImage,args:[pau],binds:l,envVars:m,ports:A,removeAfterCompletion:!this.keepDocker,runner:u})}};var jUE=fa(qb(),1),a8a=require("fs/promises"),Wqo=fa(require("path"),1),Vqo=require("path"),EUE=fa(OCe(),1);var Ssb=fa(mI(),1),Kwe=fa(wsb(),1),Uit=fa(JQ(),1),Dsb=fa(require("fs"),1),V5i=fa(require("path"),1),ixM="0.0.1";function F$f(e){if(e.raw?.github!=null&&typeof e.raw.github=="object"&&"license"in e.raw.github){let t=e.raw.github;if(t.license!=null){if(typeof t.license=="string")return{type:"basic",value:t.license};if(typeof t.license=="object"&&"custom"in t.license)return{type:"custom",value:t.license.custom}}}if(e.raw?.metadata?.license!=null){let t=e.raw.metadata.license;if(typeof t=="string")return{type:"basic",value:t};if(typeof t=="object"&&"custom"in t)return{type:"custom",value:t.custom}}}function axM(e,t){let r=F$f(e);if(r!=null){if(r.type==="basic"){if(r.value==="MIT"||r.value==="Apache-2.0")return Kwe.FernGeneratorExec.LicenseConfig.basic({id:r.value==="MIT"?Kwe.FernGeneratorExec.LicenseId.Mit:Kwe.FernGeneratorExec.LicenseId.Apache2})}else if(r.type==="custom")return Kwe.FernGeneratorExec.LicenseConfig.custom({filename:V5i.basename(r.value)})}}function jsb(e){return e!=null?Ssb.GithubPublishInfo._visit(e,{npm:t=>Kwe.FernGeneratorExec.GithubPublishInfo.npm({registryUrl:t.registryUrl,packageName:t.packageName,tokenEnvironmentVariable:(0,Uit.EnvironmentVariable)(t.token??"")}),maven:t=>Kwe.FernGeneratorExec.GithubPublishInfo.maven({registryUrl:t.registryUrl,coordinate:t.coordinate,usernameEnvironmentVariable:(0,Uit.EnvironmentVariable)(t.credentials?.username??""),passwordEnvironmentVariable:(0,Uit.EnvironmentVariable)(t.credentials?.password??""),signature:t.signature!=null?{keyIdEnvironmentVariable:(0,Uit.EnvironmentVariable)(t.signature.keyId??""),passwordEnvironmentVariable:(0,Uit.EnvironmentVariable)(t.signature.password??""),secretKeyEnvironmentVariable:(0,Uit.EnvironmentVariable)(t.signature.secretKey??"")}:void 0}),pypi:t=>Kwe.FernGeneratorExec.GithubPublishInfo.pypi({registryUrl:t.registryUrl,packageName:t.packageName,usernameEnvironmentVariable:(0,Uit.EnvironmentVariable)(t.credentials?.username??""),passwordEnvironmentVariable:(0,Uit.EnvironmentVariable)(t.credentials?.password??"")}),rubygems:t=>Kwe.FernGeneratorExec.GithubPublishInfo.rubygems({registryUrl:t.registryUrl,packageName:t.packageName,apiKeyEnvironmentVariable:(0,Uit.EnvironmentVariable)(t.apiKey??"")}),postman:t=>Kwe.FernGeneratorExec.GithubPublishInfo.postman({apiKeyEnvironmentVariable:(0,Uit.EnvironmentVariable)(t.apiKey??""),workspaceIdEnvironmentVariable:(0,Uit.EnvironmentVariable)(t.workspaceId??"")}),nuget:t=>Kwe.FernGeneratorExec.GithubPublishInfo.nuget({registryUrl:t.registryUrl,packageName:t.packageName,apiKeyEnvironmentVariable:(0,Uit.EnvironmentVariable)(t.apiKey??"")}),_other:()=>{}}):void 0}function Csb({generatorInvocation:e,customConfig:t,workspaceName:r,organization:n,outputVersion:i=ixM,absolutePathToSnippet:a,absolutePathToSnippetTemplates:o,absolutePathToFernConfig:c,writeUnitTests:d,generateOauthClients:s,generatePaginatedClients:u,paths:l}){let m=t,A=axM(e,c);if(A!=null&&A.type==="custom"){let U;if(e.raw?.github!=null&&typeof e.raw.github=="object"&&"license"in e.raw.github){let R=e.raw.github;if(R.license!=null&&typeof R.license=="object"&&"custom"in R.license){let V=R.license.custom;try{let $=c?V5i.dirname(c):process.cwd(),re=V5i.isAbsolute(V)?V:V5i.resolve($,V),te=Dsb.readFileSync(re,"utf-8").split(`
|
|
3035
3035
|
`).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=>({...Esb(i,U,e,l),snippetFilepath:P,publishingMetadata:e.publishMetadata}),publishV2:U=>({...Esb(i,U,e,l),snippetFilepath:P,publishingMetadata:e.publishMetadata}),downloadFiles:()=>({mode:Kwe.FernGeneratorExec.OutputMode.downloadFiles(),path:T,snippetFilepath:P,publishingMetadata:e.publishMetadata}),github:U=>{let R={mode:Kwe.FernGeneratorExec.OutputMode.github({repoUrl:`https://github.com/${U.owner}/${U.repo}`,version:i,publishInfo:jsb(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:Kwe.FernGeneratorExec.OutputMode.github({repoUrl:R,version:i,publishInfo:jsb(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:Kwe.FernGeneratorExec.GeneratorEnvironment.local(),dryRun:!1,whitelabel:!1,writeUnitTests:d,generateOauthClients:s,generatePaginatedClients:u,license:A}}function Esb(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&&(mHo(r.raw.github)?o=r.raw.github.uri:o=r.raw?.github.repository),{mode:Kwe.FernGeneratorExec.OutputMode.github({repoUrl:o,version:e}),path:i}}var zt=Symbol(),Xn=Symbol();var Isb={laterVersion:"v2",earlierVersion:"v1",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.0.246",[me.TYPESCRIPT_EXPRESS]:"0.0.264",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:Xn,[me.STOPLIGHT]:Xn,[me.OPENAPI_PYTHON_CLIENT]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},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={};lf(ft,{V1:()=>H6z,V10:()=>e4z,V11:()=>t4z,V12:()=>r4z,V13:()=>n4z,V14:()=>i4z,V15:()=>a4z,V16:()=>o4z,V17:()=>u4z,V18:()=>s4z,V19:()=>c4z,V2:()=>G6z,V20:()=>l4z,V21:()=>f4z,V22:()=>d4z,V23:()=>N0w.FernIrV23,V24:()=>F0w.FernIrV24,V25:()=>x0w.FernIrV25,V26:()=>z0w.FernIrV26,V27:()=>Q0w.FernIrV27,V28:()=>L0w.FernIrV28,V29:()=>U0w.FernIrV29,V3:()=>J6z,V30:()=>V0w.FernIrV30,V31:()=>W0w.FernIrV31,V32:()=>H0w.FernIrV32,V33:()=>G0w.FernIrV33,V34:()=>J0w.FernIrV34,V35:()=>K0w.FernIrV35,V36:()=>$0w.FernIrV36,V37:()=>Y0w.FernIrV37,V38:()=>X0w.FernIrV38,V39:()=>Z0w.FernIrV39,V4:()=>K6z,V40:()=>k0w.FernIrV40,V41:()=>emw.FernIrV41,V42:()=>tmw.FernIrV42,V43:()=>rmw.FernIrV43,V44:()=>nmw.FernIrV44,V45:()=>imw.FernIrV45,V46:()=>amw.FernIrV46,V47:()=>omw.FernIrV47,V48:()=>umw.FernIrV48,V49:()=>smw.FernIrV49,V5:()=>$6z,V50:()=>cmw.FernIrV50,V51:()=>lmw.FernIrV51,V52:()=>fmw.FernIrV52,V53:()=>dmw.FernIrV53,V54:()=>pmw.FernIrV54,V55:()=>_mw.FernIrV55,V56:()=>hmw.FernIrV56,V57:()=>ymw.FernIrV57,V58:()=>vmw.FernIrV58,V59:()=>bmw.FernIrV59,V6:()=>Y6z,V60:()=>gmw.FernIrV60,V61:()=>Jd,V7:()=>X6z,V8:()=>Z6z,V9:()=>k6z});var H6z=fa(j_b(),1),G6z=fa(m0b(),1),J6z=fa(c1b(),1),K6z=fa(uBb(),1),$6z=fa(GFb(),1),Y6z=fa(e7b(),1),X6z=fa(s9b(),1),Z6z=fa(yKb(),1),k6z=fa(Ueg(),1),e4z=fa(cug(),1),t4z=fa(Tpg(),1),r4z=fa(I0g(),1),n4z=fa(S1g(),1),i4z=fa(wBg(),1),a4z=fa(O3g(),1),o4z=fa(T5g(),1),u4z=fa(HHg(),1),s4z=fa(nkg(),1),c4z=fa(bo0(),1),l4z=fa(Kp0(),1),f4z=fa(Sm0(),1),d4z=fa(oS0(),1),N0w=fa(jM0(),1),F0w=fa(sN0(),1),x0w=fa($z0(),1),z0w=fa(Q80(),1),Q0w=fa(R90(),1),L0w=fa(MJ0(),1),U0w=fa(SZ0(),1),V0w=fa(Cnm(),1),W0w=fa(Msm(),1),H0w=fa(Upm(),1),G0w=fa(Ymd(),1),J0w=fa(fwm(),1),K0w=fa(oCm(),1),$0w=fa(tRm(),1),Y0w=fa(Zzm(),1),X0w=fa(Z5m(),1),Z0w=fa(hHm(),1),k0w=fa(BXm(),1),emw=fa(XnO(),1),tmw=fa(mlO(),1),rmw=fa(HyO(),1),nmw=fa(vAO(),1),imw=fa(iDO(),1),amw=fa(XqO(),1),omw=fa(K6O(),1),umw=fa(HLO(),1),smw=fa(HJO(),1),cmw=fa(etA(),1),lmw=fa(gsA(),1),fmw=fa(VhA(),1),dmw=fa(v1A(),1),pmw=fa(kNA(),1),_mw=fa(LLA(),1),hmw=fa(IZA(),1),ymw=fa(ggP(),1),vmw=fa(DxP(),1),bmw=fa(XXP(),1),gmw=fa(R0w(),1);function mmw({inlinedRequest:e,allTypes:t}){let r=new Set,n=t.reduce((i,a)=>({...i,[Ftp(a.name)]:a}),{});for(let i of e.extends)Omw({typeName:i,typeNameToDeclaration:n,referencedTypes:r});for(let i of e.properties)pyo({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 pyo({reference:e,typeNameToDeclaration:t,referencedTypes:r}){ft.V2.types.TypeReference._visit(e,{primitive:Hc,container:n=>{p4z({container:n,typeNameToDeclaration:t,referencedTypes:r})},named:n=>{Omw({typeName:n,typeNameToDeclaration:t,referencedTypes:r})},unknown:Hc,void:Hc,_unknown:()=>{throw new Error("Unknown TypeReference: "+e._type)}})}function p4z({container:e,typeNameToDeclaration:t,referencedTypes:r}){ft.V2.types.ContainerType._visit(e,{list:n=>{pyo({reference:n,typeNameToDeclaration:t,referencedTypes:r})},set:n=>{pyo({reference:n,typeNameToDeclaration:t,referencedTypes:r})},optional:n=>{pyo({reference:n,typeNameToDeclaration:t,referencedTypes:r})},map:({keyType:n,valueType:i})=>{pyo({reference:n,typeNameToDeclaration:t,referencedTypes:r}),pyo({reference:i,typeNameToDeclaration:t,referencedTypes:r})},literal:Hc,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function Omw({typeName:e,typeNameToDeclaration:t,referencedTypes:r}){let n=Ftp(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(Ftp(a))}function Ftp(e){return[...e.fernFilepathV2.map(t=>t.unsafeName.originalValue),e.nameV3.unsafeName.originalValue].join(".")}var Amw={laterVersion:"v3",earlierVersion:"v2",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.0.249",[me.TYPESCRIPT_EXPRESS]:"0.0.264",[me.JAVA]:zt,[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]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:Xn,[me.STOPLIGHT]:Xn,[me.OPENAPI_PYTHON_CLIENT]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},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=>_4z(r,n,e.types,i=>{t.push(i)}))}))}}}};function _4z(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:h4z(t,e,r,n),response:t.response,errors:t.errors,errorsV2:t.errorsV2,auth:t.auth}}function h4z(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(s=>({availability:e.availability,docs:s.docs,name:{originalValue:s.name.name.unsafeName.originalValue,camelCase:s.name.name.unsafeName.camelCase,pascalCase:s.name.name.unsafeName.pascalCase,snakeCase:s.name.name.unsafeName.snakeCase,screamingSnakeCase:s.name.name.unsafeName.screamingSnakeCase,wireValue:s.name.wireValue},nameV2:s.name,valueType:s.valueType}))});n({docs:void 0,availability:e.availability,name:o,shape:c,referencedTypes:mmw({inlinedRequest:a,allTypes:r}),examples:[]});let d=ft.V2.types.TypeReference.named(o);return{docs:void 0,type:d,typeV2:d}},_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+i.type)}})}var jmw={laterVersion:"v4",earlierVersion:"v3",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:"0.0.264",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI]:"0.0.11-4-g1c29f6c",[me.POSTMAN]:"0.0.32-rc0",[me.STOPLIGHT]:Xn,[me.OPENAPI_PYTHON_CLIENT]:Xn,[me.PYTHON_SDK]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},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=>Emw(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=>m4z(n))}))}))}})};function Emw(e){return ft.V4.types.ExampleTypeShape._visit(e,{object:t=>ft.V3.types.ExampleType.object(y4z(t)),union:t=>ft.V3.types.ExampleType.union(b4z(t)),alias:t=>ft.V3.types.ExampleType.alias(g4z(t)),enum:ft.V3.types.ExampleType.enum,_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function y4z(e){return{properties:e.properties.map(t=>({wireKey:t.wireKey,value:VBe(t.value),originalTypeDeclaration:t.originalTypeDeclaration}))}}function VBe(e){return ft.V4.types.ExampleTypeReferenceShape._visit(e.shape,{primitive:ft.V3.types.ExampleTypeReference.primitive,container:t=>ft.V3.types.ExampleTypeReference.container(v4z(t)),named:t=>ft.V3.types.ExampleTypeReference.named(Smw(t)),unknown:ft.V3.types.ExampleTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ExampleTypeReference: "+e.shape.type)}})}function v4z(e){return ft.V4.types.ExampleContainer._visit(e,{list:t=>ft.V3.types.ExampleContainer.list(t.map(VBe)),set:t=>ft.V3.types.ExampleContainer.set(t.map(VBe)),optional:t=>ft.V3.types.ExampleContainer.optional(t!=null?VBe(t):void 0),map:t=>ft.V3.types.ExampleContainer.map(t.map(r=>({key:VBe(r.key),value:VBe(r.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+e.type)}})}function Smw(e){return{typeName:e.typeName,shape:Emw(e.shape)}}function b4z(e){return{wireDiscriminantValue:e.wireDiscriminantValue,properties:ft.V4.types.ExampleSingleUnionTypeProperties._visit(e.properties,{samePropertiesAsObject:t=>ft.V3.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject(Smw(t)),singleProperty:t=>ft.V3.types.ExampleSingleUnionTypeProperties.singleProperty(VBe(t)),noProperties:()=>ft.V3.types.ExampleSingleUnionTypeProperties.noProperties(),_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+e.properties.type)}})}}function g4z(e){return{value:VBe(e.value)}}function m4z(e){return{servicePathParameters:e.servicePathParameters.map(t=>Pmw(t)),endpointPathParameters:e.servicePathParameters.map(t=>Pmw(t)),serviceHeaders:e.serviceHeaders.map(t=>wmw(t)),endpointHeaders:e.endpointHeaders.map(t=>wmw(t)),queryParameters:e.queryParameters.map(t=>O4z(t)),request:e.request!=null?A4z(e.request):void 0,response:w4z(e.response)}}function Pmw(e){return{key:e.key,value:VBe(e.value)}}function wmw(e){return{key:e.wireKey,value:VBe(e.value)}}function O4z(e){return{key:e.wireKey,value:VBe(e.value)}}function A4z(e){return ft.V4.services.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>ft.V3.services.http.ExampleRequestBody.inlinedRequestBody({properties:t.properties.map(r=>P4z(r))}),reference:t=>ft.V3.services.http.ExampleRequestBody.reference(VBe(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function P4z(e){return{wireKey:e.wireKey,value:VBe(e.value),originalTypeDeclaration:e.originalTypeDeclaration}}function w4z(e){return ft.V4.services.http.ExampleResponse._visit(e,{ok:t=>ft.V3.services.http.ExampleResponse.ok({body:t.body!=null?VBe(t.body):void 0}),error:t=>ft.V3.services.http.ExampleResponse.error({error:t.error,body:t.body!=null?VBe(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}function YFr(e){return{originalValue:e.originalName,camelCase:e.camelCase.unsafeName,pascalCase:e.pascalCase.unsafeName,snakeCase:e.snakeCase.unsafeName,screamingSnakeCase:e.screamingSnakeCase.unsafeName}}function Kot(e){return{...YFr(e.name),wireValue:e.wireValue}}function $se(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 Yse(e){return{wireValue:e.wireValue,name:$se(e.name)}}function _yo(e){return ft.V5.types.ContainerType._visit(e,{list:t=>ft.V4.types.ContainerType.list(fY(t)),set:t=>ft.V4.types.ContainerType.set(fY(t)),map:({keyType:t,valueType:r})=>ft.V4.types.ContainerType.map({keyType:fY(t),valueType:fY(r)}),optional:t=>ft.V4.types.ContainerType.optional(fY(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 iCa(e){return e.map(t=>YFr(t))}function aCa(e){return e.map(t=>$se(t))}function D_e(e){return{fernFilepath:iCa(e.fernFilepath),fernFilepathV2:aCa(e.fernFilepath),name:e.name.originalName,nameV2:YFr(e.name),nameV3:$se(e.name)}}function fY(e){return ft.V5.types.TypeReference._visit(e,{named:t=>ft.V4.types.TypeReference.named(D_e(t)),container:t=>ft.V4.types.TypeReference.container(_yo(t)),primitive:t=>ft.V4.types.TypeReference.primitive(t),unknown:ft.V4.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown TypeReference: "+e._type)}})}function oCa(e){return{name:Kot(e.name),nameV2:Yse(e.name),valueType:fY(e.valueType),availability:e.availability,docs:e.docs}}function Dmw(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>j4z(t))}}function j4z(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(oCa(t)),_unknown:()=>{throw new Error("Unknown AuthScheme: "+e._type)}})}function Cmw(e){return{docs:e.docs,id:e.id,url:e.url,name:$se(e.name)}}function Imw({errorDeclaration:e,errorDiscriminationStrategy:t,typeReferenceResolver:r}){let n=e.type!=null?ft.V4.types.Type.alias({aliasOf:fY(e.type),resolvedType:r.resolveTypeReference(e.type)}):void 0;return{docs:e.docs,name:{name:e.name.name.originalName,nameV2:YFr(e.name.name),nameV3:$se(e.name.name),fernFilepath:iCa(e.name.fernFilepath),fernFilepathV2:aCa(e.name.fernFilepath)},discriminantValueV2:Yse(e.discriminantValue),discriminantValueV3:ft.V5.ir.ErrorDiscriminationStrategy._visit(t,{statusCode:ft.V4.errors.ErrorDeclarationDiscriminantValue.statusCode,property:i=>ft.V4.errors.ErrorDeclarationDiscriminantValue.property(Yse(i.contentProperty)),_unknown:()=>{throw new Error("Unknown ErrorDiscriminationStrategy: "+t.type)}}),discriminantValueV4:Yse(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?fY(e.type):e.type,http:{statusCode:e.statusCode},statusCode:e.statusCode}}function WBe(e){return{jsonExample:e.jsonExample,shape:Mmw(e.shape)}}function Mmw(e){return ft.V5.types.ExampleTypeReferenceShape._visit(e,{primitive:ft.V4.types.ExampleTypeReferenceShape.primitive,container:t=>ft.V4.types.ExampleTypeReferenceShape.container(S4z(t)),unknown:ft.V4.types.ExampleTypeReferenceShape.unknown,named:t=>ft.V4.types.ExampleTypeReferenceShape.named(E4z(t)),_unknown:()=>{throw new Error("Unknown ExampleTypeReferenceShape: "+e.type)}})}function E4z(e){return{typeName:D_e(e.typeName),shape:Ufc(e.shape)}}function S4z(e){return ft.V5.types.ExampleContainer._visit(e,{list:t=>ft.V4.types.ExampleContainer.list(t.map(r=>WBe(r))),set:t=>ft.V4.types.ExampleContainer.set(t.map(r=>WBe(r))),optional:t=>ft.V4.types.ExampleContainer.optional(t!=null?WBe(t):void 0),map:t=>ft.V4.types.ExampleContainer.map(t.map(r=>({key:WBe(r.key),value:WBe(r.value)}))),_unknown:()=>{throw new Error("Unknown ExampleContainer: "+e.type)}})}function Ufc(e){return ft.V5.types.ExampleTypeShape._visit(e,{alias:t=>ft.V4.types.ExampleTypeShape.alias({value:WBe(t.value)}),object:t=>ft.V4.types.ExampleTypeShape.object({properties:t.properties.map(r=>({wireKey:r.wireKey,value:WBe(r.value),originalTypeDeclaration:D_e(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:D_e(r.typeName),shape:Ufc(r.shape)}),singleProperty:r=>ft.V4.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:r.jsonExample,shape:Mmw(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 qmw({service:e,errorResolver:t}){return{docs:e.docs,availability:e.availability,displayName:e.displayName,name:D4z(e.name),basePath:C4z(e.basePath),basePathV2:e.basePath,endpoints:e.endpoints.map(r=>I4z({endpoint:r,errorResolver:t})),headers:e.headers.map(r=>oCa(r)),pathParameters:e.pathParameters.map(r=>Rmw(r))}}function D4z(e){return{name:e.name.pascalCase.unsafeName,fernFilepath:iCa(e.fernFilepath),fernFilepathV2:aCa(e.fernFilepath)}}function C4z(e){return e.parts.reduce((t,r)=>t+`{${r.pathParameter}}`+r.tail,e.head)}function I4z({endpoint:e,errorResolver:t}){return{docs:e.docs,availability:e.availability,id:e.name.originalName,name:YFr(e.name),nameV2:$se(e.name),displayName:e.displayName,method:e.method,headers:e.headers.map(r=>oCa(r)),path:e.path,pathParameters:e.pathParameters.map(r=>Rmw(r)),queryParameters:e.queryParameters.map(r=>M4z(r)),requestBody:e.requestBody!=null?B4z(e.requestBody):void 0,sdkRequest:e.sdkRequest!=null?T4z(e.sdkRequest):void 0,response:q4z(e.response),errors:e.errors.map(r=>R4z(r)),errorsV2:N4z({responseErrors:e.errors,errorResolver:t}),auth:e.auth,examples:e.examples.map(r=>z4z(r))}}function Rmw(e){return{docs:e.docs,availability:e.availability,name:YFr(e.name),nameV2:$se(e.name),valueType:fY(e.valueType)}}function M4z(e){return{docs:e.docs,availability:e.availability,name:Kot(e.name),nameV2:Yse(e.name),valueType:fY(e.valueType),allowMultiple:e.allowMultiple}}function B4z(e){return ft.V5.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V4.services.http.HttpRequestBody.inlinedRequestBody({name:$se(t.name),extends:t.extends.map(r=>D_e(r)),properties:t.properties.map(r=>({docs:r.docs,name:Yse(r.name),valueType:fY(r.valueType)}))}),reference:t=>ft.V4.services.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:fY(t.requestBodyType)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody type: "+e.type)}})}function T4z(e){return{requestParameterName:$se(e.requestParameterName),shape:ft.V5.http.SdkRequestShape._visit(e.shape,{justRequestBody:t=>ft.V4.services.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:fY(t.requestBodyType)}),wrapper:t=>ft.V4.services.http.SdkRequestShape.wrapper({wrapperName:$se(t.wrapperName),bodyKey:$se(t.bodyKey)}),_unknown:()=>{throw new Error("Unknown SdkRequestShape type: "+e.shape.type)}})}}function q4z(e){let t=e.type!=null?fY(e.type):void 0;return{docs:e.docs,type:t??ft.V4.types.TypeReference.void(),typeV2:t}}function R4z(e){return{docs:e.docs,error:xtp(e.error)}}function N4z({responseErrors:e,errorResolver:t}){return{discriminant:{originalValue:"errorName",camelCase:"errorName",snakeCase:"error_name",pascalCase:"ErrorName",screamingSnakeCase:"ERROR_NAME",wireValue:"errorName"},types:e.map(r=>F4z({responseError:r,errorResolver:t}))}}function F4z({responseError:e,errorResolver:t}){let r=t.getDeclaration(e.error);return{docs:e.docs,discriminantValue:Kot(r.discriminantValue),shape:x4z({responseError:e,declaration:r})}}function x4z({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:xtp(e.error)})}function xtp(e){return{name:e.name.originalName,nameV2:YFr(e.name),nameV3:$se(e.name),fernFilepath:iCa(e.fernFilepath),fernFilepathV2:aCa(e.fernFilepath)}}function z4z(e){return{docs:e.docs,name:e.name?.originalName,servicePathParameters:e.servicePathParameters.map(t=>Bmw(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Bmw(t)),serviceHeaders:e.serviceHeaders.map(t=>Tmw(t)),endpointHeaders:e.endpointHeaders.map(t=>Tmw(t)),queryParameters:e.queryParameters.map(t=>Q4z(t)),request:e.request!=null?L4z(e.request):void 0,response:V4z(e.response)}}function Bmw(e){return{key:e.key,value:WBe(e.value)}}function Tmw(e){return{wireKey:e.wireKey,value:WBe(e.value)}}function Q4z(e){return{wireKey:e.wireKey,value:WBe(e.value)}}function L4z(e){return ft.V5.http.ExampleRequestBody._visit(e,{inlinedRequestBody:t=>ft.V4.services.http.ExampleRequestBody.inlinedRequestBody({jsonExample:t.jsonExample,properties:t.properties.map(r=>U4z(r))}),reference:t=>ft.V4.services.http.ExampleRequestBody.reference(WBe(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function U4z(e){return{wireKey:e.wireKey,value:WBe(e.value),originalTypeDeclaration:e.originalTypeDeclaration!=null?D_e(e.originalTypeDeclaration):void 0}}function V4z(e){return ft.V5.http.ExampleResponse._visit(e,{ok:t=>ft.V4.services.http.ExampleResponse.ok({body:t.body!=null?WBe(t.body):void 0}),error:t=>ft.V4.services.http.ExampleResponse.error({error:xtp(t.error),body:t.body!=null?WBe(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}function Nmw(e){return{docs:e.docs,availability:e.availability,name:D_e(e.name),shape:W4z(e.shape),examples:e.examples.map(t=>H4z(t)),referencedTypes:e.referencedTypes.map(t=>D_e(t))}}function W4z(e){return ft.V5.types.Type._visit(e,{alias:({aliasOf:t,resolvedType:r})=>ft.V4.types.Type.alias({aliasOf:fY(t),resolvedType:G4z(r)}),enum:t=>ft.V4.types.Type.enum({values:t.values.map(r=>({docs:r.docs,availability:r.availability,name:Kot(r.name),nameV2:Yse(r.name),value:r.name.wireValue}))}),object:t=>ft.V4.types.Type.object({extends:t.extends.map(r=>D_e(r)),properties:t.properties.map(r=>({docs:r.docs,availability:r.availability,name:Kot(r.name),nameV2:Yse(r.name),valueType:fY(r.valueType)}))}),union:t=>ft.V4.types.Type.union({discriminant:t.discriminant.wireValue,discriminantV2:Kot(t.discriminant),discriminantV3:Yse(t.discriminant),types:t.types.map(r=>({docs:r.docs,discriminantValue:Kot(r.discriminantValue),discriminantValueV2:Yse(r.discriminantValue),valueType:ft.V5.types.SingleUnionTypeProperties._visit(r.shape,{samePropertiesAsObject:n=>ft.V4.types.TypeReference.named(D_e(n)),singleProperty:n=>fY(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(D_e(n)),singleProperty:n=>ft.V4.types.SingleUnionTypeProperties.singleProperty({name:Kot(n.name),nameV2:Yse(n.name),type:fY(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 H4z(e){return{docs:e.docs,jsonExample:e.jsonExample,name:e.name?.originalName,shape:Ufc(e.shape)}}function G4z(e){return ft.V5.types.ResolvedTypeReference._visit(e,{named:t=>ft.V4.types.ResolvedTypeReference.named({name:D_e(t.name),shape:J4z(t.shape)}),container:t=>ft.V4.types.ResolvedTypeReference.container(_yo(t)),primitive:ft.V4.types.ResolvedTypeReference.primitive,unknown:ft.V4.types.ResolvedTypeReference.unknown,_unknown:()=>{throw new Error("Unknown ResolvedTypeReference: "+e._type)}})}function J4z(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 Vfc=class{errors;constructor(t){this.errors=t.errors.reduce((r,n)=>({...r,[Fmw(n.name)]:n}),{})}getDeclaration(t){let r=Fmw(t),n=this.errors[r];if(n==null)throw new Error("Error does not exist: "+r);return n}};function Fmw(e){return`${e.fernFilepath.join("/")}:${e.name.originalName}`}var Wfc=class{types;constructor(t){this.types=t.types.reduce((r,n)=>({...r,[xmw(n.name)]:n}),{})}resolveTypeReference(t){return ft.V5.types.TypeReference._visit(t,{container:r=>ft.V4.types.ResolvedTypeReference.container(_yo(r)),named:r=>{let n=this.getTypeDeclaration(r);return n.shape._type==="alias"?this.resolveTypeReference(n.shape.aliasOf):ft.V4.types.ResolvedTypeReference.named({name:D_e(r),shape:K4z(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=xmw(t),n=this.types[r];if(n==null)throw new Error("Type does not exist: "+n);return n}};function xmw(e){return`${e.fernFilepath.join("/")}:${e.name.originalName}`}function K4z(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:tc(e)}}var zmw={laterVersion:"v5",earlierVersion:"v4",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.0.257-2-g46fe4ff",[me.TYPESCRIPT_EXPRESS]:"0.0.264",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:"0.0.33-9-gf683b5e",[me.PYTHON_PYDANTIC]:"0.0.33-9-gf683b5e",[me.OPENAPI]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:Xn,[me.STOPLIGHT]:Xn,[me.OPENAPI_PYTHON_CLIENT]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=new Wfc(e),r=new Vfc(e);return{apiName:e.apiName.originalName,apiDisplayName:e.apiDisplayName,apiDocs:e.apiDocs,auth:Dmw(e.auth),headers:e.headers.map(n=>oCa(n)),types:e.types.map(n=>Nmw(n)),services:{http:e.services.map(n=>qmw({service:n,errorResolver:r})),websocket:[]},errors:e.errors.map(n=>Imw({errorDeclaration:n,errorDiscriminationStrategy:e.errorDiscriminationStrategy,typeReferenceResolver:t})),constants:{errorDiscriminant:"_error",errorInstanceIdKey:"_errorInstanceId",unknownErrorDiscriminantValue:"_unknown"},constantsV2:{errors:{errorInstanceIdKey:Kot(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:Yse(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=>Cmw(n)),errorDiscriminant:e.errorDiscriminationStrategy.type==="property"?$se(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:Yse(n.discriminant),contentProperty:Yse(n.contentProperty)}),_unknown:()=>{throw new Error("Unknown ErrorDiscriminationStrategy: "+e.errorDiscriminationStrategy.type)}}),sdkConfig:e.sdkConfig}}};var Qmw={laterVersion:"v6",earlierVersion:"v5",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.0.257-4-ge56e5d2",[me.TYPESCRIPT_EXPRESS]:"0.0.264",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[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]:Xn,[me.POSTMAN]:zt,[me.PYTHON_SDK]:Xn,[me.OPENAPI_PYTHON_CLIENT]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},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 Lmw={laterVersion:"v7",earlierVersion:"v6",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.0.268",[me.TYPESCRIPT_EXPRESS]:"0.0.268",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:Xn,[me.POSTMAN]:zt,[me.PYTHON_SDK]:Xn,[me.OPENAPI_PYTHON_CLIENT]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},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=n9(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 Wmw={laterVersion:"v8",earlierVersion:"v7",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.0.273-5-g1b00245b",[me.TYPESCRIPT_EXPRESS]:"0.0.273-5-g1b00245b",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[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]:Xn,[me.POSTMAN]:zt,[me.PYTHON_SDK]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,auth:$4z(e.auth),headers:e.headers.map(t=>Hfc(t)),types:e.types.map(t=>Y4z(t)),errors:e.errors.map(t=>n2z(t)),services:e.services.map(t=>i2z(t))})};function ztp(e){return e.allParts}function $4z(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:ft.V7.auth.AuthScheme.header(Hfc(t)))}}function Hfc(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:b1e(e.valueType)}}function b1e(e){return ft.V8.types.TypeReference._visit(e,{container:t=>ft.V7.types.TypeReference.container(Hmw(t)),named:t=>ft.V7.types.TypeReference.named(XFr(t)),primitive:ft.V7.types.TypeReference.primitive,unknown:ft.V7.types.TypeReference.unknown,_unknown:()=>{throw new Error("Unknown type reference: "+e._type)}})}function Hmw(e){return ft.V8.types.ContainerType._visit(e,{list:t=>ft.V7.types.ContainerType.list(b1e(t)),optional:t=>ft.V7.types.ContainerType.optional(b1e(t)),set:t=>ft.V7.types.ContainerType.set(b1e(t)),map:({keyType:t,valueType:r})=>ft.V7.types.ContainerType.map({keyType:b1e(t),valueType:b1e(r)}),literal:ft.V7.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function XFr(e){return{name:e.name,fernFilepath:ztp(e.fernFilepath)}}function Y4z(e){return{docs:e.docs,availability:e.availability,name:XFr(e.name),shape:X4z(e.shape),examples:e.examples.map(t=>t2z(t)),referencedTypes:e.referencedTypes.map(t=>XFr(t))}}function X4z(e){return ft.V8.types.Type._visit(e,{alias:t=>ft.V7.types.Type.alias({aliasOf:b1e(t.aliasOf),resolvedType:Z4z(t.resolvedType)}),enum:ft.V7.types.Type.enum,object:t=>ft.V7.types.Type.object({extends:t.extends.map(r=>XFr(r)),properties:t.properties.map(r=>({docs:r.docs,availability:r.availability,name:r.name,valueType:b1e(r.valueType)}))}),union:t=>ft.V7.types.Type.union({discriminant:t.discriminant,types:t.types.map(r=>k4z(r))}),_unknown:()=>{throw new Error("Unknown Type shape: "+e._type)}})}function Z4z(e){return ft.V8.types.ResolvedTypeReference._visit(e,{container:t=>ft.V7.types.ResolvedTypeReference.container(Hmw(t)),named:t=>ft.V7.types.ResolvedTypeReference.named({name:XFr(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 k4z(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:e2z(e.shape)}}function e2z(e){return ft.V8.types.SingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>ft.V7.types.SingleUnionTypeProperties.samePropertiesAsObject(XFr(t)),singleProperty:t=>ft.V7.types.SingleUnionTypeProperties.singleProperty({name:t.name,type:b1e(t.type)}),noProperties:ft.V7.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function t2z(e){return{jsonExample:e.jsonExample,docs:e.docs,name:e.name,shape:Qtp(e.shape)}}function Qtp(e){return ft.V8.types.ExampleTypeShape._visit(e,{alias:t=>ft.V7.types.ExampleTypeShape.alias({value:j4e(t.value)}),enum:ft.V7.types.ExampleTypeShape.enum,object:t=>ft.V7.types.ExampleTypeShape.object({properties:t.properties.map(r=>({wireKey:r.wireKey,value:j4e(r.value),originalTypeDeclaration:XFr(r.originalTypeDeclaration)}))}),union:t=>ft.V7.types.ExampleTypeShape.union({wireDiscriminantValue:t.wireDiscriminantValue,properties:r2z(t.properties)}),_unknown:()=>{throw new Error("Unknown ExampleTypeShape: "+e.type)}})}function j4e(e){return{jsonExample:e.jsonExample,shape:Gmw(e.shape)}}function Gmw(e){return ft.V8.types.ExampleTypeReferenceShape._visit(e,{named:t=>ft.V7.types.ExampleTypeReferenceShape.named({typeName:XFr(t.typeName),shape:Qtp(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=>j4e(n))),set:r=>ft.V7.types.ExampleContainer.set(r.map(n=>j4e(n))),optional:r=>ft.V7.types.ExampleContainer.optional(r!=null?j4e(r):void 0),map:r=>ft.V7.types.ExampleContainer.map(r.map(n=>({key:j4e(n.key),value:j4e(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 r2z(e){return ft.V8.types.ExampleSingleUnionTypeProperties._visit(e,{samePropertiesAsObject:t=>ft.V7.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:XFr(t.typeName),shape:Qtp(t.shape)}),singleProperty:t=>ft.V7.types.ExampleSingleUnionTypeProperties.singleProperty({jsonExample:t.jsonExample,shape:Gmw(t.shape)}),noProperties:ft.V7.types.ExampleSingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown ExampleSingleUnionTypeProperties: "+e.type)}})}function n2z(e){return{docs:e.docs,name:Ltp(e.name),discriminantValue:e.discriminantValue,type:e.type!=null?b1e(e.type):void 0,statusCode:e.statusCode}}function Ltp(e){return{name:e.name,fernFilepath:ztp(e.fernFilepath)}}function i2z(e){return{docs:e.docs,availability:e.availability,name:{fernFilepath:ztp(e.name.fernFilepath)},displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>Jmw(t)),headers:e.headers.map(t=>Hfc(t)),endpoints:e.endpoints.map(t=>a2z(t))}}function Jmw(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:b1e(e.valueType)}}function a2z(e){return{docs:e.docs,availability:e.availability,name:e.name,displayName:e.displayName,errors:e.errors.map(t=>o2z(t)),auth:e.auth,method:e.method,path:e.path,pathParameters:e.pathParameters.map(t=>Jmw(t)),sdkRequest:e.sdkRequest!=null?s2z(e.sdkRequest):void 0,requestBody:e.requestBody!=null?l2z(e.requestBody):void 0,response:f2z(e.response),headers:e.headers.map(t=>Hfc(t)),queryParameters:e.queryParameters.map(t=>u2z(t)),examples:e.examples.map(t=>d2z(t))}}function o2z(e){return{docs:e.docs,error:Ltp(e.error)}}function u2z(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:b1e(e.valueType),allowMultiple:e.allowMultiple}}function s2z(e){return{requestParameterName:e.requestParameterName,shape:c2z(e.shape)}}function c2z(e){return ft.V8.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V7.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:b1e(t.requestBodyType)}),wrapper:ft.V7.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function l2z(e){return ft.V8.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V7.http.HttpRequestBody.inlinedRequestBody({name:t.name,extends:t.extends.map(r=>XFr(r)),properties:t.properties.map(r=>({docs:r.docs,name:r.name,valueType:b1e(r.valueType)}))}),reference:t=>ft.V7.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:b1e(t.requestBodyType)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function f2z(e){return{docs:e.docs,type:e.type!=null?b1e(e.type):void 0}}function d2z(e){return{name:e.name,docs:e.docs,servicePathParameters:e.servicePathParameters.map(t=>Umw(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Umw(t)),queryParameters:e.queryParameters.map(t=>p2z(t)),serviceHeaders:e.serviceHeaders.map(t=>Vmw(t)),endpointHeaders:e.endpointHeaders.map(t=>Vmw(t)),request:e.request!=null?_2z(e.request):void 0,response:h2z(e.response)}}function Umw(e){return{key:e.key,value:j4e(e.value)}}function p2z(e){return{wireKey:e.wireKey,value:j4e(e.value)}}function Vmw(e){return{wireKey:e.wireKey,value:j4e(e.value)}}function _2z(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:j4e(r.value),originalTypeDeclaration:r.originalTypeDeclaration!=null?XFr(r.originalTypeDeclaration):void 0}))}),reference:t=>ft.V7.http.ExampleRequestBody.reference(j4e(t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function h2z(e){return ft.V8.http.ExampleResponse._visit(e,{ok:t=>ft.V7.http.ExampleResponse.ok({body:t.body!=null?j4e(t.body):void 0}),error:t=>ft.V7.http.ExampleResponse.error({error:Ltp(t.error),body:t.body!=null?j4e(t.body):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}var Kmw={laterVersion:"v9",earlierVersion:"v8",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.3.0-2-g85e8aa08",[me.TYPESCRIPT_EXPRESS]:"0.3.0-2-g85e8aa08",[me.JAVA]:zt,[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]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:Xn,[me.POSTMAN]:zt,[me.PYTHON_SDK]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},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()===vV.Failure&&t.failAndThrow(),{...e,types:Object.values(e.types),errors:Object.values(e.errors),services:Object.values(e.services)}}};var $mw={laterVersion:"v10",earlierVersion:"v9",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.STOPLIGHT]:Xn,[me.OPENAPI]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=yg(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 Ymw={laterVersion:"v11",earlierVersion:"v10",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.5.0-rc0-1-g83a12940",[me.TYPESCRIPT_EXPRESS]:"0.5.0-rc0-1-g83a12940",[me.JAVA]:zt,[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]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.STOPLIGHT]:Xn,[me.OPENAPI]:zt,[me.POSTMAN]:"0.0.40-1-g9aa2117",[me.PYTHON_SDK]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,auth:y2z(e.auth,t)})};function y2z(e,t){return{...e,schemes:e.schemes.map(r=>v2z(r,t))}}function v2z(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 Zmw={laterVersion:"v12",earlierVersion:"v11",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.5.0-rc0-6-g80f89f98",[me.TYPESCRIPT_EXPRESS]:"0.5.0-rc0-6-g80f89f98",[me.JAVA]:zt,[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]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.STOPLIGHT]:"0.0.23-8-g479c860",[me.OPENAPI]:"0.0.22-1-g1c86b58",[me.POSTMAN]:zt,[me.PYTHON_SDK]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>{let n=yg(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(Xmw({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(Xmw({taskContext:t,targetGenerator:r})),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,types:n,services:yg(e.services,i=>b2z(i,{taskContext:t,targetGenerator:r}))}}};function Xmw(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 b2z(e,t){return{...e,endpoints:e.endpoints.map(r=>g2z(r,t))}}function g2z(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 kmw={laterVersion:"v13",earlierVersion:"v12",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,types:yg(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 eOw={laterVersion:"v14",earlierVersion:"v13",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:Xn,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=yg(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:Dte(i.valueType)})),types:n.types.map(i=>A2z(i))}),enum:ft.V13.types.Type.enum,object:n=>ft.V13.types.Type.object({...n,properties:n.properties.map(i=>({...i,valueType:Dte(i.valueType)}))}),alias:n=>ft.V13.types.Type.alias({aliasOf:Dte(n.aliasOf),resolvedType:w2z(n.resolvedType)}),undiscriminatedUnion:n=>ft.V13.types.Type.undiscriminatedUnion(j2z(n)),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:m2z(e.auth),headers:e.headers.map(r=>Wtp(r)),types:t,services:yg(e.services,r=>E2z(r)),errors:yg(e.errors,r=>T2z(r))}}};function m2z(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:ft.V13.auth.AuthScheme.header(O2z(t)))}}function O2z(e){return{docs:e.docs,prefix:e.prefix,name:e.name,valueType:Dte(e.valueType)}}function Wtp(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:Dte(e.valueType)}}function Dte(e){return ft.V14.types.TypeReference._visit(e,{container:t=>ft.V13.types.TypeReference.container(tOw(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 tOw(e){return ft.V14.types.ContainerType._visit(e,{list:t=>ft.V13.types.ContainerType.list(Dte(t)),optional:t=>ft.V13.types.ContainerType.optional(Dte(t)),set:t=>ft.V13.types.ContainerType.set(Dte(t)),map:({keyType:t,valueType:r})=>ft.V13.types.ContainerType.map({keyType:Dte(t),valueType:Dte(r)}),literal:ft.V13.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function A2z(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:P2z(e.shape)}}function P2z(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:Dte(t.type)}),noProperties:ft.V13.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function w2z(e){return ft.V14.types.ResolvedTypeReference._visit(e,{container:t=>ft.V13.types.ResolvedTypeReference.container(tOw(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 j2z(e){return{members:e.members.map(t=>({...t,type:Dte(t.type)}))}}function E2z(e){return{availability:e.availability,name:e.name,displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>rOw(t)),headers:e.headers.map(t=>Wtp(t)),endpoints:e.endpoints.map(t=>S2z(t))}}function rOw(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:Dte(e.valueType)}}function S2z(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=>rOw(t)),sdkRequest:e.sdkRequest!=null?C2z(e.sdkRequest):void 0,requestBody:e.requestBody!=null?M2z(e.requestBody):void 0,response:e.response!=null?Utp(e.response):void 0,headers:e.headers.map(t=>Wtp(t)),queryParameters:e.queryParameters.map(t=>D2z(t)),examples:e.examples,streamingResponse:e.streamingResponse!=null?Vtp(e.streamingResponse):void 0,sdkResponse:e.sdkResponse!=null?B2z(e.sdkResponse):void 0}}function D2z(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:Dte(e.valueType),allowMultiple:e.allowMultiple}}function C2z(e){return{requestParameterName:e.requestParameterName,shape:I2z(e.shape)}}function I2z(e){return ft.V14.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V13.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:Dte(t.requestBodyType)}),wrapper:ft.V13.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function M2z(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:Dte(r.valueType)}))}),reference:t=>ft.V13.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:Dte(t.requestBodyType)}),fileUpload:t=>ft.V13.http.HttpRequestBody.fileUpload({name:t.name,properties:t.properties.map(r=>r.type==="bodyProperty"?{...r,valueType:Dte(r.valueType)}:r)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Utp(e){return{docs:e.docs,responseBodyType:Dte(e.responseBodyType)}}function Vtp(e){return{dataEventType:Dte(e.dataEventType),terminator:e.terminator}}function B2z(e){return ft.V14.http.SdkResponse._visit(e,{streaming:t=>ft.V13.http.SdkResponse.streaming(Vtp(t)),nonStreaming:t=>ft.V13.http.SdkResponse.nonStreaming(Utp(t)),maybeStreaming:t=>ft.V13.http.SdkResponse.maybeStreaming({condition:t.condition,nonStreaming:Utp(t.nonStreaming),streaming:Vtp(t.streaming)}),_unknown:()=>{throw new Error("Encountered unknown sdk response")}})}function T2z(e){return{docs:e.docs,name:e.name,discriminantValue:e.discriminantValue,type:e.type!=null?Dte(e.type):void 0,statusCode:e.statusCode}}var nOw={laterVersion:"v15",earlierVersion:"v14",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:"0.0.52-3-gd9df38df",[me.PYTHON_PYDANTIC]:"0.0.52-3-gd9df38df",[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"0.0.52-3-gd9df38df",[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>{let t=yg(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:Cte(i.valueType)})),types:n.types.map(i=>N2z(i))}),enum:ft.V14.types.Type.enum,object:n=>ft.V14.types.Type.object({...n,properties:n.properties.map(i=>({...i,valueType:Cte(i.valueType)}))}),alias:n=>ft.V14.types.Type.alias({aliasOf:Cte(n.aliasOf),resolvedType:x2z(n.resolvedType)}),undiscriminatedUnion:n=>ft.V14.types.Type.undiscriminatedUnion(z2z(n)),_unknown:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:q2z(e.auth),headers:e.headers.map(r=>Jtp(r)),types:t,services:yg(e.services,r=>Q2z(r)),errors:yg(e.errors,r=>J2z(r))}}};function q2z(e){return{docs:e.docs,requirement:e.requirement,schemes:e.schemes.map(t=>t._type!=="header"?t:ft.V14.auth.AuthScheme.header(R2z(t)))}}function R2z(e){return{docs:e.docs,prefix:e.prefix,name:e.name,valueType:Cte(e.valueType)}}function Jtp(e){return{docs:e.docs,availability:e.availability,name:e.name,valueType:Cte(e.valueType)}}function Cte(e){return ft.V15.types.TypeReference._visit(e,{container:t=>ft.V14.types.TypeReference.container(iOw(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 iOw(e){return ft.V15.types.ContainerType._visit(e,{list:t=>ft.V14.types.ContainerType.list(Cte(t)),optional:t=>ft.V14.types.ContainerType.optional(Cte(t)),set:t=>ft.V14.types.ContainerType.set(Cte(t)),map:({keyType:t,valueType:r})=>ft.V14.types.ContainerType.map({keyType:Cte(t),valueType:Cte(r)}),literal:ft.V14.types.ContainerType.literal,_unknown:()=>{throw new Error("Unknown ContainerType: "+e._type)}})}function N2z(e){return{docs:e.docs,discriminantValue:e.discriminantValue,shape:F2z(e.shape)}}function F2z(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:Cte(t.type)}),noProperties:ft.V14.types.SingleUnionTypeProperties.noProperties,_unknown:()=>{throw new Error("Unknown SingleUnionTypeProperties: "+e._type)}})}function x2z(e){return ft.V15.types.ResolvedTypeReference._visit(e,{container:t=>ft.V14.types.ResolvedTypeReference.container(iOw(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 z2z(e){return{members:e.members.map(t=>({...t,type:Cte(t.type)}))}}function Q2z(e){return{availability:e.availability,name:e.name,displayName:e.displayName,basePath:e.basePath,baseUrl:e.baseUrl,pathParameters:e.pathParameters.map(t=>aOw(t)),headers:e.headers.map(t=>Jtp(t)),endpoints:e.endpoints.map(t=>L2z(t))}}function aOw(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:Cte(e.valueType)}}function L2z(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=>aOw(t)),sdkRequest:e.sdkRequest!=null?V2z(e.sdkRequest):void 0,requestBody:e.requestBody!=null?H2z(e.requestBody):void 0,response:e.response!=null?Htp(e.response):void 0,headers:e.headers.map(t=>Jtp(t)),queryParameters:e.queryParameters.map(t=>U2z(t)),examples:e.examples,streamingResponse:e.streamingResponse!=null?Gtp(e.streamingResponse):void 0,sdkResponse:e.sdkResponse!=null?G2z(e.sdkResponse):void 0}}function U2z(e){return{availability:e.availability,docs:e.docs,name:e.name,valueType:Cte(e.valueType),allowMultiple:e.allowMultiple}}function V2z(e){return{requestParameterName:e.requestParameterName,shape:W2z(e.shape)}}function W2z(e){return ft.V15.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V14.http.SdkRequestShape.justRequestBody({docs:t.docs,requestBodyType:Cte(t.requestBodyType)}),wrapper:ft.V14.http.SdkRequestShape.wrapper,_unknown:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function H2z(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:Cte(r.valueType)}))}),reference:t=>ft.V14.http.HttpRequestBody.reference({docs:t.docs,requestBodyType:Cte(t.requestBodyType)}),fileUpload:t=>ft.V14.http.HttpRequestBody.fileUpload({name:t.name,properties:t.properties.map(r=>r.type==="bodyProperty"?{...r,valueType:Cte(r.valueType)}:r)}),_unknown:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function Htp(e){return{docs:e.docs,responseBodyType:Cte(e.responseBodyType)}}function Gtp(e){return{dataEventType:Cte(e.dataEventType),terminator:e.terminator}}function G2z(e){return ft.V15.http.SdkResponse._visit(e,{streaming:t=>ft.V14.http.SdkResponse.streaming(Gtp(t)),nonStreaming:t=>ft.V14.http.SdkResponse.nonStreaming(Htp(t)),maybeStreaming:t=>ft.V14.http.SdkResponse.maybeStreaming({condition:t.condition,nonStreaming:Htp(t.nonStreaming),streaming:Gtp(t.streaming)}),_unknown:()=>{throw new Error("Encountered unknown sdk response")}})}function J2z(e){return{docs:e.docs,name:e.name,discriminantValue:e.discriminantValue,type:e.type!=null?Cte(e.type):void 0,statusCode:e.statusCode}}var oOw={laterVersion:"v16",earlierVersion:"v15",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.5.4-1-g4e69d312",[me.TYPESCRIPT_EXPRESS]:"0.5.4-1-g4e69d312",[me.JAVA]:zt,[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]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},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:yg(e.services,n=>({...n,pathParameters:Ktp(n.pathParameters),endpoints:n.endpoints.map(i=>({...i,allPathParameters:Ktp(i.allPathParameters),pathParameters:Ktp(i.pathParameters)}))}))}};function Ktp(e){return e.map(t=>K2z(t))}function K2z(e){return{...e,availability:{status:ft.V15.commons.AvailabilityStatus.GeneralAvailability,message:void 0}}}var uOw={laterVersion:"v17",earlierVersion:"v16",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},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 sOw={laterVersion:"v18",earlierVersion:"v17",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.5.14-1-ga6817141",[me.TYPESCRIPT_EXPRESS]:"0.5.14-1-ga6817141",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:"0.3.0-3-ge125e311",[me.PYTHON_PYDANTIC]:"0.3.0-3-ge125e311",[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"0.3.0-3-ge125e311",[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,{taskContext:t,targetGenerator:r})=>({...e,services:yg(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 lOw={laterVersion:"v19",earlierVersion:"v18",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:Xn,[me.TYPESCRIPT_BROWSER_SDK]:Xn,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.5.19-1-gef223230",[me.TYPESCRIPT_EXPRESS]:"0.5.19-1-gef223230",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:"0.3.4-rc0-9-ge815162f",[me.PYTHON_PYDANTIC]:"0.3.4-rc0-9-ge815162f",[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:"0.0.44-1-gbf4b0f3",[me.PYTHON_SDK]:"0.3.4-rc0-9-ge815162f",[me.GO_FIBER]:Xn,[me.GO_MODEL]:Xn,[me.GO_SDK]:Xn,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:yg(e.services,r=>$2z(r,t)),types:yg(e.types,r=>t7z(r,t))})};function $2z(e,t){return{...e,endpoints:e.endpoints.map(r=>Y2z(r,t))}}function Y2z(e,t){return{...e,examples:e.examples.map(r=>X2z(r,t))}}function X2z(e,t){return{docs:e.docs,name:e.name,url:e.url,rootPathParameters:e.rootPathParameters.map(r=>$tp(r,t)),servicePathParameters:e.servicePathParameters.map(r=>$tp(r,t)),endpointPathParameters:e.endpointPathParameters.map(r=>$tp(r,t)),serviceHeaders:e.serviceHeaders.map(r=>cOw(r,t)),endpointHeaders:e.endpointHeaders.map(r=>cOw(r,t)),queryParameters:e.queryParameters.map(r=>Z2z(r,t)),request:e.request!=null?k2z(e.request,t):void 0,response:e7z(e.response,t)}}function $tp(e,t){return{key:e.key,value:E4e(e.value,t)}}function cOw(e,t){return{wireKey:e.wireKey,value:E4e(e.value,t)}}function Z2z(e,t){return{wireKey:e.wireKey,value:E4e(e.value,t)}}function k2z(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:E4e(n.value,t),originalTypeDeclaration:n.originalTypeDeclaration}))}),reference:r=>ft.V18.http.ExampleRequestBody.reference(E4e(r,t)),_unknown:()=>{throw new Error("Unknown ExampleRequestBody: "+e.type)}})}function e7z(e,t){return ft.V19.http.ExampleResponse._visit(e,{ok:r=>ft.V18.http.ExampleResponse.ok({body:r.body!=null?E4e(r.body,t):void 0}),error:r=>ft.V18.http.ExampleResponse.error({error:r.error,body:r.body!=null?E4e(r.body,t):void 0}),_unknown:()=>{throw new Error("Unknown ExampleResponse: "+e.type)}})}function t7z(e,t){return{...e,examples:e.examples.map(r=>r7z(r,t))}}function r7z(e,t){return{...e,shape:Ytp(e.shape,t)}}function Ytp(e,t){return ft.V19.types.ExampleTypeShape._visit(e,{alias:r=>ft.V18.types.ExampleTypeShape.alias({value:E4e(r.value,t)}),object:r=>ft.V18.types.ExampleTypeShape.object({properties:r.properties.map(n=>({wireKey:n.wireKey,value:E4e(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:fOw(n.shape,t)}),samePropertiesAsObject:n=>ft.V18.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({typeName:n.typeName,shape:Ytp(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 E4e(e,t){return{jsonExample:e.jsonExample,shape:fOw(e.shape,t)}}function fOw(e,t){return ft.V19.types.ExampleTypeReferenceShape._visit(e,{primitive:r=>ft.V18.types.ExampleTypeReferenceShape.primitive(n7z(r,t)),named:r=>ft.V18.types.ExampleTypeReferenceShape.named({typeName:r.typeName,shape:Ytp(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=>E4e(i,t))),set:n=>ft.V18.types.ExampleContainer.set(n.map(i=>E4e(i,t))),optional:n=>ft.V18.types.ExampleContainer.optional(n!=null?E4e(n,t):void 0),map:n=>ft.V18.types.ExampleContainer.map(n.map(i=>({key:E4e(i.key,t),value:E4e(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 n7z(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 dOw={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]:zt,[me.TYPESCRIPT_SDK]:"0.5.26-rc0-3-gdfabd674",[me.TYPESCRIPT_EXPRESS]:"0.5.20-3-g2505487f",[me.JAVA]:zt,[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]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"0.3.6-rc1-2-g6050f7f8",[me.GO_FIBER]:Xn,[me.GO_MODEL]:"0.0.0",[me.GO_SDK]:"0.0.0",[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:yg(e.services,r=>i7z(r,t))})};function i7z(e,t){return{...e,endpoints:e.endpoints.map(r=>a7z(r,t))}}function a7z(e,t){return{...e,response:e.response!=null?pOw(e.response,t):void 0,sdkResponse:e.sdkResponse!=null?o7z(e.sdkResponse,t):void 0}}function pOw(e,t){return ft.V20.http.HttpResponse._visit(e,{fileDownload:()=>_Ow(t),json:r=>r,_unknown:()=>{throw new Error("Unknown HttpResponse: "+e.type)}})}function o7z(e,t){return ft.V20.http.SdkResponse._visit(e,{fileDownload:()=>_Ow(t),streaming:ft.V19.http.SdkResponse.streaming,maybeStreaming:r=>ft.V19.http.SdkResponse.maybeStreaming({condition:r.condition,streaming:r.streaming,nonStreaming:pOw(r.nonStreaming,t)}),json:ft.V19.http.SdkResponse.nonStreaming,_unknown:()=>{throw new Error("Unknown SdkResponse: "+e.type)}})}function _Ow({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 hOw={laterVersion:"v21",earlierVersion:"v20",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:Xn,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:(e,t)=>({...e,services:yg(e.services,r=>u7z(r,t))})};function u7z(e,t){return{...e,endpoints:e.endpoints.map(r=>s7z(r,t))}}function s7z(e,t){return{...e,streamingResponse:e.streamingResponse!=null?Xtp(e.streamingResponse,t):void 0,sdkResponse:e.sdkResponse!=null?c7z(e.sdkResponse,t):void 0}}function Xtp(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 c7z(e,t){return ft.V21.http.SdkResponse._visit(e,{fileDownload:ft.V20.http.SdkResponse.fileDownload,streaming:r=>ft.V20.http.SdkResponse.streaming(Xtp(r,t)),maybeStreaming:r=>ft.V20.http.SdkResponse.maybeStreaming({condition:r.condition,streaming:Xtp(r.streaming,t),nonStreaming:r.nonStreaming}),json:ft.V20.http.SdkResponse.json,_unknown:()=>{throw new Error("Unknown SdkResponse: "+e.type)}})}var yOw={laterVersion:"v22",earlierVersion:"v21",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[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]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>e,migrateBackwards:e=>({...e,services:yg(e.services,t=>l7z(t))})};function l7z(e){return{...e,endpoints:e.endpoints.map(t=>f7z(t))}}function f7z(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 gOw={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]:zt,[me.TYPESCRIPT_SDK]:"0.7.4-rc3-4-g6cf92f81",[me.TYPESCRIPT_EXPRESS]:"0.7.4-rc3-4-g6cf92f81",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:"0.0.28-3-g112d3dd",[me.STOPLIGHT]:"0.0.28-3-g112d3dd",[me.POSTMAN]:"0.0.44-4-gddab2ae",[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},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 d=d7z(c);d==null?r.push(c):o.push(d)}n[i]={...a,endpoints:o,headers:a.headers.map(c=>ktp(c)),pathParameters:a.pathParameters.map(c=>Gfc(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=>_7z(i))},headers:e.headers.map(i=>ktp(i)),types:yg(e.types,i=>h7z(i)),services:n,errors:yg(e.errors,i=>O7z(i)),subpackages:e.subpackages,pathParameters:e.pathParameters.map(i=>Gfc(i)),variables:e.variables.map(i=>A7z(i))}}};function d7z(e){let t;if(!(e.requestBody!=null&&(t=p7z(e.requestBody),t==null)))return{...e,headers:e.headers.map(r=>ktp(r)),pathParameters:e.pathParameters.map(r=>Gfc(r)),allPathParameters:e.allPathParameters.map(r=>Gfc(r)),queryParameters:e.queryParameters.map(r=>P7z(r)),requestBody:t,sdkRequest:e.sdkRequest!=null?{requestParameterName:e.sdkRequest.requestParameterName,shape:w7z(e.sdkRequest.shape)}:void 0,response:e.response!=null?j7z(e.response):void 0,examples:e.examples.map(r=>E7z(r))}}function p7z(e){switch(e.type){case"bytes":return;case"fileUpload":return ft.V22.http.HttpRequestBody.fileUpload({...e,properties:e.properties.map(t=>D7z(t))});case"inlinedRequestBody":return ft.V22.http.HttpRequestBody.inlinedRequestBody({...e,properties:e.properties.map(t=>C7z(t))});case"reference":return ft.V22.http.HttpRequestBody.reference({...e,requestBodyType:Ite(e.requestBodyType)});default:tc(e)}}function ktp(e){return{...e,valueType:Ite(e.valueType)}}function _7z(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:Ite(t.valueType)}),_other:()=>{throw new Error("Unknown auth scheme: "+e.type)}})}function h7z(e){return{...e,shape:y7z(e.shape),examples:e.examples.map(t=>v7z(t))}}function y7z(e){return e._visit({alias:t=>ft.V22.types.Type.alias({...t,aliasOf:Ite(t.aliasOf),resolvedType:g7z(t.resolvedType)}),enum:ft.V22.types.Type.enum,object:t=>ft.V22.types.Type.object({...t,properties:t.properties.map(r=>vOw(r))}),union:t=>ft.V22.types.Type.union({...t,baseProperties:t.baseProperties.map(r=>vOw(r)),types:t.types.map(r=>({...r,shape:m7z(r.shape)}))}),undiscriminatedUnion:t=>ft.V22.types.Type.undiscriminatedUnion({...t,members:t.members.map(r=>({...r,type:Ite(r.type)}))}),_other:()=>{throw new Error("Unknown type shape: "+e.type)}})}function v7z(e){return{...e,shape:erp(e.shape)}}function erp(e){return e._visit({alias:t=>ft.V22.types.ExampleTypeShape.alias({...t,value:$ot(t.value)}),enum:ft.V22.types.ExampleTypeShape.enum,object:t=>ft.V22.types.ExampleTypeShape.object({...t,properties:t.properties.map(r=>({...r,value:$ot(r.value)}))}),union:t=>ft.V22.types.ExampleTypeShape.union({...t,properties:b7z(t.properties)}),_other:()=>{throw new Error("Unknown example type shape: "+e.type)}})}function $ot(e){return{...e,shape:trp(e.shape)}}function trp(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:erp(t.shape)}),container:t=>ft.V22.types.ExampleTypeReferenceShape.container(t._visit({list:r=>ft.V22.types.ExampleContainer.list(r.map(n=>$ot(n))),set:r=>ft.V22.types.ExampleContainer.set(r.map(n=>$ot(n))),optional:r=>ft.V22.types.ExampleContainer.optional(r!=null?$ot(r):void 0),map:r=>ft.V22.types.ExampleContainer.map(r.map(n=>({key:$ot(n.key),value:$ot(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 b7z(e){return e._visit({singleProperty:t=>ft.V22.types.ExampleSingleUnionTypeProperties.singleProperty({...t,shape:trp(t.shape)}),noProperties:ft.V22.types.ExampleSingleUnionTypeProperties.noProperties,samePropertiesAsObject:t=>ft.V22.types.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...t,shape:erp(t.shape)}),_other:()=>{throw new Error("Unknown example single union type properties: "+e.type)}})}function Ite(e){return e._visit({container:t=>ft.V22.types.TypeReference.container(mOw(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 mOw(e){return e._visit({list:t=>ft.V22.types.ContainerType.list(Ite(t)),set:t=>ft.V22.types.ContainerType.set(Ite(t)),optional:t=>ft.V22.types.ContainerType.optional(Ite(t)),map:t=>ft.V22.types.ContainerType.map({keyType:Ite(t.keyType),valueType:Ite(t.valueType)}),literal:ft.V22.types.ContainerType.literal,_other:()=>{throw new Error("Unknown container type: "+e.type)}})}function g7z(e){return e._visit({container:t=>ft.V22.types.ResolvedTypeReference.container(mOw(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 vOw(e){return{...e,valueType:Ite(e.valueType)}}function m7z(e){return e._visit({noProperties:ft.V22.types.SingleUnionTypeProperties.noProperties,singleProperty:t=>ft.V22.types.SingleUnionTypeProperties.singleProperty({...t,type:Ite(t.type)}),samePropertiesAsObject:ft.V22.types.SingleUnionTypeProperties.samePropertiesAsObject,_other:()=>{throw new Error("Unknown single union type properties: "+e.propertiesType)}})}function O7z(e){return{...e,type:e.type!=null?Ite(e.type):void 0}}function A7z(e){return{...e,type:Ite(e.type)}}function Gfc(e){return{...e,valueType:Ite(e.valueType)}}function P7z(e){return{...e,valueType:Ite(e.valueType)}}function w7z(e){return e._visit({justRequestBody:t=>ft.V22.http.SdkRequestShape.justRequestBody({...t,requestBodyType:Ite(t.requestBodyType)}),wrapper:ft.V22.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SDK request shape: "+e.type)}})}function j7z(e){return e._visit({json:t=>ft.V22.http.HttpResponse.json({...t,responseBodyType:Ite(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(Ite(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 E7z(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>Ztp(t)),servicePathParameters:e.servicePathParameters.map(t=>Ztp(t)),endpointPathParameters:e.endpointPathParameters.map(t=>Ztp(t)),serviceHeaders:e.serviceHeaders.map(t=>bOw(t)),endpointHeaders:e.endpointHeaders.map(t=>bOw(t)),queryParameters:e.queryParameters.map(t=>S7z(t)),request:e.request!=null?e.request._visit({inlinedRequestBody:t=>ft.V22.http.ExampleRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,value:$ot(r.value)}))}),reference:t=>ft.V22.http.ExampleRequestBody.reference({...t,shape:trp(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?$ot(t.body):void 0}),error:t=>ft.V22.http.ExampleResponse.error({...t,body:t.body!=null?$ot(t.body):void 0}),_other:()=>{throw new Error("Unknown example response: "+e.response.type)}})}}function Ztp(e){return{...e,value:$ot(e.value)}}function S7z(e){return{...e,value:$ot(e.value)}}function bOw(e){return{...e,value:$ot(e.value)}}function D7z(e){return e._visit({file:ft.V22.http.FileUploadRequestProperty.file,bodyProperty:t=>ft.V22.http.FileUploadRequestProperty.bodyProperty({...t,valueType:Ite(t.valueType)}),_other:()=>{throw new Error("Unknown file upload request body property: "+e.type)}})}function C7z(e){return{...e,valueType:Ite(e.valueType)}}var Om={};lf(Om,{V23:()=>l9Q,V24:()=>f9Q,V25:()=>d9Q,V26:()=>p9Q,V27:()=>_9Q,V28:()=>h9Q,V29:()=>y9Q,V30:()=>v9Q,V31:()=>b9Q,V32:()=>g9Q,V33:()=>m9Q,V34:()=>O9Q,V35:()=>A9Q,V36:()=>P9Q,V37:()=>w9Q,V38:()=>j9Q,V39:()=>E9Q,V40:()=>S9Q,V41:()=>D9Q,V42:()=>C9Q,V43:()=>I9Q,V44:()=>M9Q,V45:()=>B9Q,V46:()=>T9Q,V47:()=>q9Q,V48:()=>R9Q,V49:()=>N9Q,V50:()=>F9Q,V51:()=>x9Q,V52:()=>z9Q,V53:()=>Q9Q,V54:()=>L9Q,V55:()=>U9Q,V56:()=>V9Q,V57:()=>W9Q,V58:()=>H9Q,V59:()=>G9Q,V60:()=>J9Q,V61:()=>Z0});var l9Q=fa(Lc(),1),f9Q=fa(_c(),1),d9Q=fa(ic(),1),p9Q=fa(Gs(),1),_9Q=fa(Ns(),1),h9Q=fa(Fs(),1),y9Q=fa(xs(),1),v9Q=fa(Ss(),1),b9Q=fa(ws(),1),g9Q=fa(ss(),1),m9Q=fa(gu(),1),O9Q=fa(pu(),1),A9Q=fa(ko(),1),P9Q=fa(eu(),1),w9Q=fa(Xo(),1),j9Q=fa(Jo(),1),E9Q=fa(Po(),1),S9Q=fa(wo(),1),D9Q=fa(vo(),1),C9Q=fa(fo(),1),I9Q=fa(lo(),1),M9Q=fa(so(),1),B9Q=fa(ro(),1),T9Q=fa($a(),1),q9Q=fa(Ka(),1),R9Q=fa(Ha(),1),N9Q=fa(za(),1),F9Q=fa(Ra(),1),x9Q=fa(Ca(),1),z9Q=fa(wa(),1),Q9Q=fa(Tn(),1),L9Q=fa(Vw(),1),U9Q=fa(Aw(),1),V9Q=fa(Pw(),1),W9Q=fa(XP(),1),H9Q=fa(ZP(),1),G9Q=fa(kP(),1),J9Q=fa(OP(),1);var qQE={laterVersion:"v24",earlierVersion:"v23",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V23.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e})};var RQE={laterVersion:"v25",earlierVersion:"v24",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[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]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.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 d of o.endpoints){let s;if(d.sdkRequest!=null&&(s=K9Q(d.sdkRequest),s==null)){r.push(d);continue}if(d.response!=null){let u=d.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(d),ft.V24.HttpResponse.json({docs:void 0,responseBodyType:ft.V24.TypeReference.unknown()})),_other:()=>{throw new Error("Encountered unknown response type")}});c.push({...d,sdkRequest:s,response:u})}else c.push({...d,sdkRequest:s,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 K9Q(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 FQE={laterVersion:"v26",earlierVersion:"v25",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:"0.5.0-rc2-16-g4177fafd",[me.PYTHON_PYDANTIC]:"0.5.0-rc2-16-g4177fafd",[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"0.5.0-rc2-16-g4177fafd",[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V25.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,k9Q(r)])),headers:e.headers.map(t=>n0l(t)),webhookGroups:Object.fromEntries(Object.entries(e.webhookGroups).map(([t,r])=>[t,r.map(n=>$9Q(n))])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,Y9Q(r)]))})};function $9Q(e){return{...e,headers:e.headers.map(t=>n0l(t)),availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function Y9Q(e){return{...e,endpoints:e.endpoints.map(t=>X9Q(t)),headers:e.headers.map(t=>n0l(t)),availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function X9Q(e){return{...e,headers:e.headers.map(t=>n0l(t)),queryParameters:e.queryParameters.map(t=>Z9Q(t)),availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function n0l(e){return{...e,availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function Z9Q(e){return{...e,availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function k9Q(e){return{...e,shape:e.shape._visit({union:t=>ft.V25.Type.union({...t,baseProperties:t.baseProperties.map(r=>NQE(r))}),object:t=>ft.V25.Type.object({...t,properties:t.properties.map(r=>NQE(r))}),enum:t=>ft.V25.Type.enum({...t,values:t.values.map(r=>eVQ(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 NQE(e){return{...e,availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}function eVQ(e){return{...e,availability:e.availability==null?{status:ft.V25.AvailabilityStatus.GeneralAvailability,message:void 0}:e.availability}}var xQE={laterVersion:"v27",earlierVersion:"v26",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[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]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V26.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,tVQ(r)]))})};function tVQ(e){return{...e,endpoints:e.endpoints.map(t=>rVQ(t))}}function rVQ(e){return{...e,response:e.response!=null?nVQ(e.response):void 0}}function nVQ(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 zQE={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]:zt,[me.TYPESCRIPT_SDK]:"0.8.1-1-g0f40bf18",[me.TYPESCRIPT_EXPRESS]:"0.8.1-1-g0f40bf18",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[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]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V27.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip"}),migrateBackwards:e=>({...e,auth:BVQ(e.auth),headers:a0l(e.headers),types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,FVQ(r)])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,pVQ(r)])),webhookGroups:Object.fromEntries(Object.entries(e.webhookGroups).map(([t,r])=>[t,uVQ(r)])),errors:Object.fromEntries(Object.entries(e.errors).map(([t,r])=>[t,oVQ(r)])),pathParameters:i0l(e.pathParameters),variables:iVQ(e.variables)})};function iVQ(e){return e.map(t=>aVQ(t))}function aVQ(e){return{...e,type:BZ(e.type)}}function oVQ(e){return{...e,type:e.type!=null?BZ(e.type):void 0}}function uVQ(e){return e.map(t=>sVQ(t))}function sVQ(e){return{...e,headers:a0l(e.headers),payload:cVQ(e.payload)}}function cVQ(e){switch(e.type){case"inlinedPayload":return ft.V27.WebhookPayload.inlinedPayload(lVQ(e));case"reference":return ft.V27.WebhookPayload.reference({...e,payloadType:BZ(e.payloadType)})}}function lVQ(e){return{...e,properties:fVQ(e.properties)}}function fVQ(e){return e.map(t=>dVQ(t))}function dVQ(e){return{...e,valueType:BZ(e.valueType)}}function pVQ(e){return{...e,endpoints:_VQ(e.endpoints),headers:a0l(e.headers),pathParameters:i0l(e.pathParameters)}}function _VQ(e){return e.map(t=>hVQ(t))}function hVQ(e){return{...e,headers:a0l(e.headers),pathParameters:i0l(e.pathParameters),allPathParameters:i0l(e.allPathParameters),queryParameters:IVQ(e.queryParameters),requestBody:e.requestBody!=null?PVQ(e.requestBody):void 0,sdkRequest:e.sdkRequest!=null?mVQ(e.sdkRequest):void 0,response:e.response!=null?yVQ(e.response):void 0}}function yVQ(e){switch(e.type){case"json":return ft.V27.HttpResponse.json(gVQ(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(vVQ(e));default:tc(e)}}function vVQ(e){return{...e,dataEventType:bVQ(e.dataEventType)}}function bVQ(e){switch(e.type){case"json":return ft.V27.StreamingResponseChunkType.json(BZ(e.json));case"text":return ft.V27.StreamingResponseChunkType.text();default:tc(e)}}function gVQ(e){switch(e.type){case"response":return ft.V27.JsonResponse.response({...e,responseBodyType:BZ(e.responseBodyType)});case"nestedPropertyAsResponse":return ft.V27.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:BZ(e.responseBodyType),responseProperty:e.responseProperty!=null?VQE(e.responseProperty):void 0});default:tc(e)}}function mVQ(e){return{...e,shape:OVQ(e.shape)}}function OVQ(e){switch(e.type){case"justRequestBody":return ft.V27.SdkRequestShape.justRequestBody(AVQ(e.value));case"wrapper":return ft.V27.SdkRequestShape.wrapper(e);default:tc(e)}}function AVQ(e){switch(e.type){case"typeReference":return ft.V27.SdkRequestBodyType.typeReference(QQE(e));case"bytes":return ft.V27.SdkRequestBodyType.bytes(e);default:tc(e)}}function PVQ(e){switch(e.type){case"inlinedRequestBody":return ft.V27.HttpRequestBody.inlinedRequestBody(SVQ(e));case"reference":return ft.V27.HttpRequestBody.reference(QQE(e));case"fileUpload":return ft.V27.HttpRequestBody.fileUpload(wVQ(e));case"bytes":return ft.V27.HttpRequestBody.bytes(e);default:tc(e)}}function wVQ(e){return{...e,properties:jVQ(e.properties)}}function jVQ(e){return e.map(t=>EVQ(t))}function EVQ(e){switch(e.type){case"file":return ft.V27.FileUploadRequestProperty.file(e);case"bodyProperty":return ft.V27.FileUploadRequestProperty.bodyProperty(LQE(e));default:tc(e)}}function QQE(e){return{...e,requestBodyType:BZ(e.requestBodyType)}}function SVQ(e){return{...e,properties:DVQ(e.properties)}}function DVQ(e){return e.map(t=>LQE(t))}function LQE(e){return{...e,valueType:BZ(e.valueType)}}function i0l(e){return e.map(t=>CVQ(t))}function CVQ(e){return{...e,valueType:BZ(e.valueType)}}function IVQ(e){return e.map(t=>MVQ(t))}function MVQ(e){return{...e,valueType:BZ(e.valueType)}}function BVQ(e){return{...e,schemes:TVQ(e.schemes)}}function TVQ(e){return e.map(t=>qVQ(t))}function qVQ(e){switch(e.type){case"basic":return ft.V27.AuthScheme.basic(e);case"bearer":return ft.V27.AuthScheme.bearer(e);case"header":return RVQ(e);default:tc(e)}}function RVQ(e){return ft.V27.AuthScheme.header({...e,valueType:BZ(e.valueType)})}function a0l(e){return e.map(t=>NVQ(t))}function NVQ(e){return{...e,valueType:BZ(e.valueType)}}function FVQ(e){return{...e,shape:xVQ(e.shape)}}function xVQ(e){switch(e.type){case"alias":return ft.V27.Type.alias(zVQ(e));case"enum":return ft.V27.Type.enum(e);case"object":return ft.V27.Type.object(QVQ(e));case"union":return ft.V27.Type.union(LVQ(e));case"undiscriminatedUnion":return ft.V27.Type.undiscriminatedUnion(UVQ(e));default:tc(e)}}function zVQ(e){return{aliasOf:BZ(e.aliasOf),resolvedType:GVQ(e.resolvedType)}}function QVQ(e){return{...e,properties:UQE(e.properties)}}function LVQ(e){return{...e,types:VVQ(e.types),baseProperties:UQE(e.baseProperties)}}function UVQ(e){return{members:HVQ(e.members)}}function UQE(e){return e.map(t=>VQE(t))}function VQE(e){return{...e,valueType:BZ(e.valueType)}}function VVQ(e){return e.map(t=>({...t,shape:WVQ(t.shape)}))}function WVQ(e){switch(e.propertiesType){case"samePropertiesAsObject":return ft.V27.SingleUnionTypeProperties.samePropertiesAsObject(e);case"singleProperty":return ft.V27.SingleUnionTypeProperties.singleProperty({name:e.name,type:BZ(e.type)});case"noProperties":return ft.V27.SingleUnionTypeProperties.noProperties();default:tc(e)}}function HVQ(e){return e.map(t=>({...t,type:BZ(t.type)}))}function GVQ(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(WQE(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:tc(e)}}function BZ(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(WQE(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:tc(e)}}function WQE(e){switch(e.type){case"list":return ft.V27.ContainerType.list(BZ(e.list));case"map":return ft.V27.ContainerType.map({keyType:BZ(e.keyType),valueType:BZ(e.valueType)});case"optional":return ft.V27.ContainerType.optional(BZ(e.optional));case"set":return ft.V27.ContainerType.set(BZ(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:tc(e)}}var GQE={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]:zt,[me.TYPESCRIPT_SDK]:"0.8.6-1-g3d8d8591",[me.TYPESCRIPT_EXPRESS]:"0.8.6-1-g3d8d8591",[me.JAVA]:zt,[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]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V28.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.keys(e.types).map(t=>[t,JVQ({typeId:t,allTypes:e.types})]))})};function JVQ({typeId:e,allTypes:t}){let r=HQE({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=HQE({typeId:n,allTypes:t});return{typeId:n,fernFilepath:i.name.fernFilepath,name:i.name.name}})}}function HQE({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 JQE={laterVersion:"v30",earlierVersion:"v29",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:"0.6.5-1-g0ef31b7a",[me.PYTHON_PYDANTIC]:"0.6.5-1-g0ef31b7a",[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"0.6.5-1-g0ef31b7a",[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V29.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=new tQ_(e);return{...e,types:t.convertTypes(e.types),services:t.convertServices(e.services)}}},tQ_=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:tc(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:tc(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:tc(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:tc(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:tc(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:tc(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:tc(t)}}};var KQE={laterVersion:"v31",earlierVersion:"v30",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.8.8",[me.TYPESCRIPT_BROWSER_SDK]:"0.8.8",[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.8.8",[me.TYPESCRIPT_EXPRESS]:"0.8.8",[me.JAVA]:zt,[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]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"0.7.5-1-gb54fb677",[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:Xn,[me.RUBY_SDK]:Xn,[me.CSHARP_MODEL]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.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 YQE={laterVersion:"v32",earlierVersion:"v31",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[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]:Xn,[me.CSHARP_SDK]:Xn,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V31.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,{...r,examples:kVQ(r.examples)}])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(KVQ)}]))})};function e8a({examples:e,convert:t}){let r=[];for(let n of e){let i=t(n);i!=null&&r.push(i)}return r}function KVQ(e){return{...e,examples:e8a({examples:e.examples,convert:$VQ})}}function $VQ(e){let t;if(e.request!=null&&(t=YVQ(e.request),t==null))return;let r=XVQ(e.response);if(r!=null)return{...e,rootPathParameters:e8a({examples:e.rootPathParameters,convert:rQ_}),endpointPathParameters:e8a({examples:e.endpointPathParameters,convert:rQ_}),servicePathParameters:e8a({examples:e.servicePathParameters,convert:rQ_}),endpointHeaders:e8a({examples:e.endpointHeaders,convert:$QE}),serviceHeaders:e8a({examples:e.serviceHeaders,convert:$QE}),queryParameters:e8a({examples:e.queryParameters,convert:ZVQ}),request:t,response:r}}function YVQ(e){switch(e.type){case"inlinedRequestBody":{let t=[];for(let r of e.properties){let n=gke(r.value);n!=null&&t.push({...r,value:n})}return ft.V31.ExampleRequestBody.inlinedRequestBody({...e,properties:t})}case"reference":{let t=nQ_(e.shape);return t==null?void 0:ft.V31.ExampleRequestBody.reference({...e,shape:t})}default:tc(e)}}function XVQ(e){switch(e.type){case"ok":{if(e.body==null)return ft.V31.ExampleResponse.ok({body:void 0});let t=gke(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=gke(e.body);return t==null?void 0:ft.V31.ExampleResponse.error({...e,body:t})}}}function rQ_(e){let t=gke(e.value);if(t!=null)return{...e,value:t}}function $QE(e){let t=gke(e.value);if(t!=null)return{...e,value:t}}function ZVQ(e){let t=gke(e.value);if(t!=null)return{...e,value:t}}function kVQ(e){let t=[];for(let r of e){let n=eWQ(r);n!=null&&t.push(n)}return t}function eWQ(e){let t=XQE(e.shape);if(t!=null)return{...e,shape:t}}function XQE(e){switch(e.type){case"enum":return ft.V31.ExampleTypeShape.enum(e);case"alias":{let t=gke(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=gke(r.value);n!=null&&t.push({...r,value:n})}return ft.V31.ExampleTypeShape.object({properties:t})}case"union":{let t=tWQ(e.singleUnionType);return t==null?void 0:ft.V31.ExampleTypeShape.union({...e,singleUnionType:t})}case"undiscriminatedUnion":return;default:tc(e)}}function gke(e){let t=nQ_(e.shape);if(t!=null)return{shape:t,jsonExample:e.jsonExample}}function tWQ(e){let t=rWQ(e.shape);if(t!=null)return{...e,shape:t}}function rWQ(e){switch(e.type){case"noProperties":return ft.V31.ExampleSingleUnionTypeProperties.noProperties();case"singleProperty":{let t=nQ_(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=gke(r.value);n!=null&&t.push({...r,value:n})}return ft.V31.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:{properties:t}})}default:tc(e)}}function nQ_(e){switch(e.type){case"container":{let t=nWQ(e.container);return t==null?void 0:ft.V31.ExampleTypeReferenceShape.container(t)}case"named":{let t=XQE(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:tc(e)}}function nWQ(e){switch(e.type){case"list":{let t=[];for(let r of e.list){let n=gke(r);n!=null&&t.push(n)}return ft.V31.ExampleContainer.list(t)}case"set":{let t=[];for(let r of e.set){let n=gke(r);n!=null&&t.push(n)}return ft.V31.ExampleContainer.set(t)}case"map":{let t=[];for(let r of e.map){let n=gke(r.key),i=gke(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=gke(e.optional);return t==null?ft.V31.ExampleContainer.optional():ft.V31.ExampleContainer.optional(t)}default:tc(e)}}var ZQE={laterVersion:"v33",earlierVersion:"v32",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.12.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.12.0",[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.12.0",[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[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]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:"0.0.0",[me.CSHARP_SDK]:"0.0.0",[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V32.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=new iQ_(e);return{...e,services:Object.fromEntries(Object.entries(e.services).map(([r,n])=>[r,{...n,endpoints:n.endpoints.map(i=>t.convertEndpoint(i))}]))}}},iQ_=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:iWQ({examples:t.examples,convert:aWQ})}}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:tc(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:tc(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:tc(r.shape)}}};function iWQ({examples:e,convert:t}){let r=[];for(let n of e){let i=t(n);i!=null&&r.push(i)}return r}function aWQ(e){return{...e,queryParameters:e.queryParameters.filter(t=>!aQ_(t.value))}}function aQ_(e){switch(e.shape.type){case"container":return oWQ(e.shape.container);case"named":return uWQ(e.shape);case"primitive":return!1;case"unknown":return!0;default:tc(e.shape)}}function oWQ(e){switch(e.type){case"map":case"list":case"set":return!0;case"optional":return e.optional!=null&&aQ_(e.optional);default:tc(e)}}function uWQ(e){switch(e.shape.type){case"alias":return aQ_(e.shape.value);case"enum":return!1;case"object":case"union":case"undiscriminatedUnion":return!0;default:tc(e.shape)}}var xqo=fa(Ymd(),1);var kQE={laterVersion:"v34",earlierVersion:"v33",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"0.10.4",[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.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=>xqo.FernIrV33.HttpRequestBody.inlinedRequestBody(a),reference:a=>xqo.FernIrV33.HttpRequestBody.reference(a),fileUpload:a=>xqo.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"?xqo.FernIrV33.FileUploadRequestProperty.file({...o.value}):o))}),bytes:a=>xqo.FernIrV33.HttpRequestBody.bytes(a),_other:a=>{}})}))}]))})};var eLE={laterVersion:"v35",earlierVersion:"v34",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:"0.18.0",[me.GO_MODEL]:"0.18.0",[me.GO_SDK]:"0.18.0",[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.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 tLE={laterVersion:"v36",earlierVersion:"v35",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"0.11.6",[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V35.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e})};var rLE={laterVersion:"v37",earlierVersion:"v36",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.13.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.13.0",[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.13.0",[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"0.12.0",[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.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 nLE={laterVersion:"v38",earlierVersion:"v37",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.15.0-rc0",[me.TYPESCRIPT_BROWSER_SDK]:"0.15.0-rc0",[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.15.0-rc0",[me.TYPESCRIPT_EXPRESS]:"0.12.0-rc0",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:"0.9.0-rc0",[me.PYTHON_PYDANTIC]:"0.9.0-rc0",[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"1.2.0-rc0",[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.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 iLE={laterVersion:"v39",earlierVersion:"v38",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:"0.9.0-rc1",[me.PYTHON_PYDANTIC]:"0.9.0-rc1",[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"1.4.0-rc1",[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:"0.7.0-rc0",[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V38.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,auth:{...e.auth,schemes:e.auth.schemes.map(r=>sWQ(r))}})};function sWQ(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:tc(e)}}var aLE={laterVersion:"v40",earlierVersion:"v39",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:"0.20.0",[me.GO_MODEL]:"0.20.0",[me.GO_SDK]:"0.20.0",[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V39.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e})};var oLE={laterVersion:"v41",earlierVersion:"v40",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.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 uLE={laterVersion:"v42",earlierVersion:"v41",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:"0.8.0-rc0",[me.JAVA_SDK]:"0.9.0-rc0",[me.JAVA_SPRING]:"0.8.0-rc0",[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V41.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:(e,t)=>({...e,auth:{...e.auth,schemes:e.auth.schemes.map(r=>cWQ(r))}})};function cWQ(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(lWQ(e));default:tc(e)}}function lWQ(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:tc(e.configuration.type)}}var sLE={laterVersion:"v43",earlierVersion:"v42",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.17.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.17.0",[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.17.0",[me.TYPESCRIPT_EXPRESS]:"0.13.0",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.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 lLE={laterVersion:"v44",earlierVersion:"v43",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.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=>fWQ({example:a})).filter(Zw)}))}]))})};function fWQ({example:e}){return e._visit({userProvided:t=>ft.V43.HttpEndpointExample.userProvided(cLE({example:t})),generated:t=>ft.V43.HttpEndpointExample.generated(cLE({example:t})),_other:()=>{}})}function cLE({example:e}){return{...e,response:dWQ({example:e.response})}}function dWQ({example:e}){switch(e.type){case"ok":return pWQ({example:e.value});case"error":return ft.V43.ExampleResponse.error(e);default:tc(e)}}function pWQ({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:tc(e)}}var fLE={laterVersion:"v45",earlierVersion:"v44",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V44.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=yg(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:iL(i.valueType)})),types:n.types.map(i=>jWQ(i))}),enum:ft.V44.types.Type.enum,object:n=>ft.V44.types.Type.object({...n,properties:n.properties.map(i=>({...i,valueType:iL(i.valueType)}))}),alias:n=>ft.V44.types.Type.alias({aliasOf:iL(n.aliasOf),resolvedType:SWQ(n.resolvedType)}),undiscriminatedUnion:n=>ft.V44.types.Type.undiscriminatedUnion(DWQ(n)),_other:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:mWQ(e.auth),headers:e.headers.map(r=>zqo(r)),idempotencyHeaders:e.idempotencyHeaders.map(r=>zqo(r)),types:t,services:yg(e.services,r=>CWQ(r)),errors:yg(e.errors,r=>HWQ(r)),webhookGroups:yg(e.webhookGroups,r=>vWQ(r)),websocketChannels:yg(e.websocketChannels,r=>_WQ(r)),pathParameters:e.pathParameters.map(r=>EFu(r)),variables:e.variables.map(r=>IWQ(r))}}};function _WQ(e){return{...e,headers:e.headers.map(t=>zqo(t)),queryParameters:e.queryParameters.map(t=>SFu(t)),pathParameters:e.pathParameters.map(t=>EFu(t)),messages:e.messages.map(t=>hWQ(t))}}function hWQ(e){return{...e,body:yWQ(e.body)}}function yWQ(e){switch(e.type){case"inlinedBody":return ft.V44.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:iL(t.valueType)}))});case"reference":return ft.V44.websocket.WebSocketMessageBody.reference({...e,bodyType:iL(e.bodyType)})}}function vWQ(e){return e.map(t=>bWQ(t))}function bWQ(e){return{...e,headers:e.headers.map(t=>zqo(t)),payload:gWQ(e.payload)}}function gWQ(e){switch(e.type){case"reference":return ft.V44.webhooks.WebhookPayload.reference({...e,payloadType:iL(e.payloadType)});case"inlinedPayload":return ft.V44.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:iL(t.valueType)}))})}}function mWQ(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(OWQ(t));case"oauth":return ft.V44.auth.AuthScheme.oauth(AWQ(t))}})}}function OWQ(e){return{...e,valueType:iL(e.valueType)}}function AWQ(e){return{...e,configuration:ft.V44.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:PWQ(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?wWQ(e.configuration.refreshEndpoint):void 0})}}function PWQ(e){return{...e,requestProperties:{clientId:o0l(e.requestProperties.clientId),clientSecret:o0l(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?o0l(e.requestProperties.scopes):void 0},responseProperties:{accessToken:yBi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?yBi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?yBi(e.responseProperties.refreshToken):void 0}}}function wWQ(e){return{...e,requestProperties:{refreshToken:o0l(e.requestProperties.refreshToken)},responseProperties:{accessToken:yBi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?yBi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?yBi(e.responseProperties.refreshToken):void 0}}}function zqo(e){return{...e,valueType:iL(e.valueType)}}function iL(e){return ft.V45.types.TypeReference._visit(e,{container:t=>ft.V44.types.TypeReference.container(dLE(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 dLE(e){return ft.V45.types.ContainerType._visit(e,{list:t=>ft.V44.types.ContainerType.list(iL(t)),optional:t=>ft.V44.types.ContainerType.optional(iL(t)),set:t=>ft.V44.types.ContainerType.set(iL(t)),map:({keyType:t,valueType:r})=>ft.V44.types.ContainerType.map({keyType:iL(t),valueType:iL(r)}),literal:ft.V44.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function jWQ(e){return{...e,shape:EWQ(e.shape)}}function EWQ(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:iL(t.type)}),noProperties:ft.V44.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function SWQ(e){return ft.V45.types.ResolvedTypeReference._visit(e,{container:t=>ft.V44.types.ResolvedTypeReference.container(dLE(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 DWQ(e){return{members:e.members.map(t=>({...t,type:iL(t.type)}))}}function CWQ(e){return{...e,pathParameters:e.pathParameters.map(t=>EFu(t)),headers:e.headers.map(t=>zqo(t)),endpoints:e.endpoints.map(t=>MWQ(t))}}function EFu(e){return{...e,valueType:iL(e.valueType)}}function IWQ(e){return{...e,type:iL(e.type)}}function MWQ(e){return{...e,pagination:e.pagination!=null?NWQ(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>EFu(t)),pathParameters:e.pathParameters.map(t=>EFu(t)),sdkRequest:e.sdkRequest!=null?QWQ(e.sdkRequest):void 0,requestBody:e.requestBody!=null?VWQ(e.requestBody):void 0,response:e.response!=null?BWQ(e.response):void 0,headers:e.headers.map(t=>zqo(t)),queryParameters:e.queryParameters.map(t=>SFu(t))}}function BWQ(e){return{...e,body:e.body!=null?TWQ(e.body):void 0}}function TWQ(e){switch(e.type){case"json":return ft.V44.http.HttpResponseBody.json(qWQ(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(RWQ(e.value))}}function qWQ(e){switch(e.type){case"response":return ft.V44.http.JsonResponse.response({...e,responseBodyType:iL(e.responseBodyType)});case"nestedPropertyAsResponse":return ft.V44.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:iL(e.responseBodyType),responseProperty:e.responseProperty!=null?oQ_(e.responseProperty):void 0})}}function RWQ(e){switch(e.type){case"json":return ft.V44.http.StreamingResponse.json({...e,payload:iL(e.payload)});case"text":return ft.V44.http.StreamingResponse.text(e);case"sse":return ft.V44.http.StreamingResponse.sse({...e,payload:iL(e.payload)})}}function NWQ(e){switch(e.type){case"cursor":return ft.V44.http.Pagination.cursor(FWQ(e));case"offset":return ft.V44.http.Pagination.offset(xWQ(e))}}function FWQ(e){return{...e,page:SFu(e.page),next:yBi(e.next),results:yBi(e.results)}}function xWQ(e){return{...e,page:SFu(e.page),results:yBi(e.results)}}function o0l(e){return{...e,property:zWQ(e.property)}}function zWQ(e){switch(e.type){case"query":return ft.V44.RequestPropertyValue.query(SFu(e));case"body":return ft.V44.RequestPropertyValue.body(oQ_(e))}}function yBi(e){return{...e,property:oQ_(e.property)}}function oQ_(e){return{...e,valueType:iL(e.valueType)}}function SFu(e){return{...e,valueType:iL(e.valueType)}}function QWQ(e){return{...e,shape:LWQ(e.shape)}}function LWQ(e){return ft.V45.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V44.http.SdkRequestShape.justRequestBody(UWQ(t)),wrapper:ft.V44.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function UWQ(e){switch(e.type){case"bytes":return ft.V44.http.SdkRequestBodyType.bytes(e);case"typeReference":return ft.V44.http.SdkRequestBodyType.typeReference({...e,requestBodyType:iL(e.requestBodyType)})}}function VWQ(e){return ft.V45.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V44.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:iL(r.valueType)}))}),reference:t=>ft.V44.http.HttpRequestBody.reference({...t,requestBodyType:iL(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:iL(r.valueType)});case"file":return ft.V44.http.FileUploadRequestProperty.file(WWQ(r.value))}})}),bytes:t=>ft.V44.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function WWQ(e){switch(e.type){case"file":return ft.V44.http.FileProperty.file(e);case"fileArray":return ft.V44.http.FileProperty.fileArray(e)}}function HWQ(e){return{...e,type:e.type!=null?iL(e.type):void 0}}var _LE={laterVersion:"v46",earlierVersion:"v45",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.21.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.21.0",[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.21.0",[me.TYPESCRIPT_EXPRESS]:"0.16.0",[me.JAVA]:zt,[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]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"2.9.9",[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V45.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,{...r,examples:GWQ(r.examples)}])),services:Object.fromEntries(Object.entries(e.services).map(([t,r])=>[t,{...r,endpoints:r.endpoints.map(n=>({...n,examples:JWQ(n.examples)}))}])),websocketChannels:e.websocketChannels!=null?Object.fromEntries(Object.entries(e.websocketChannels).map(([t,r])=>[t,{...r,examples:KWQ(r.examples)}])):void 0,errors:Object.fromEntries(Object.entries(e.errors).map(([t,r])=>[t,{...r,examples:r.examples.map(n=>({...n,shape:ire(n.shape)}))}]))})};function ire(e){return e.shape._visit({container:t=>({...e,shape:t._visit({list:r=>ft.V45.ExampleTypeReferenceShape.container(ft.V45.ExampleContainer.list(r.map(n=>ire(n)))),set:r=>ft.V45.ExampleTypeReferenceShape.container(ft.V45.ExampleContainer.set(r.map(n=>ire(n)))),map:r=>ft.V45.ExampleTypeReferenceShape.container(ft.V45.ExampleContainer.map(r.map(n=>({key:ire(n.key),value:ire(n.value)})))),optional:r=>ft.V45.ExampleTypeReferenceShape.container(ft.V45.ExampleContainer.optional(r!=null?ire(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:hLE(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 pLE(e){return{...e,properties:e.properties.map(t=>({...t,value:ire(t.value)}))}}function hLE(e){return e.type==="alias"?ft.V45.ExampleTypeShape.alias({value:ire(e.value)}):e.type==="object"?ft.V45.ExampleTypeShape.object(pLE(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:pLE(t.object)}),singleProperty:t=>ft.V45.ExampleSingleUnionTypeProperties.singleProperty(ire(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:ire(e.singleUnionType)}):ft.V45.ExampleTypeShape.enum(e)}function GWQ(e){return e.map(t=>({...t,shape:hLE(t.shape)}))}function u0l(e){return e.map(t=>({...t,value:ire(t.value)}))}function uQ_(e){return e.map(t=>({...t,value:ire(t.value)}))}function yLE(e){return e.map(t=>({...t,value:ire(t.value)}))}function JWQ(e){return e.map(t=>{let r={...t,rootPathParameters:u0l(t.rootPathParameters),servicePathParameters:u0l(t.servicePathParameters),endpointPathParameters:u0l(t.endpointPathParameters),serviceHeaders:uQ_(t.serviceHeaders),endpointHeaders:uQ_(t.endpointHeaders),queryParameters:yLE(t.queryParameters),request:t.request?._visit({inlinedRequestBody:n=>ft.V45.ExampleRequestBody.inlinedRequestBody({...n,properties:n.properties.map(i=>({...i,value:ire(i.value)}))}),reference:n=>ft.V45.ExampleRequestBody.reference(ire(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?ire(i):void 0),stream:i=>ft.V45.ExampleEndpointSuccessResponse.stream(i.map(ire)),sse:i=>ft.V45.ExampleEndpointSuccessResponse.sse(i.map(a=>({...a,data:ire(a.data)}))),_other:i=>{throw new Error(`Unexpected value: ${JSON.stringify(i)}`)}})),error:n=>ft.V45.ExampleResponse.error({...n,body:n.body!=null?ire(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 KWQ(e){return e.map(t=>({...t,pathParameters:u0l(t.pathParameters),headers:uQ_(t.headers),queryParameters:yLE(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:ire(i.value)}))}),reference:n=>ft.V45.ExampleWebSocketMessageBody.reference(ire(n)),_other:n=>{throw new Error(`Unexpected value: ${JSON.stringify(n)}`)}})}))}))}var vLE={laterVersion:"v47",earlierVersion:"v46",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.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(s=>{if(s.example!=null)return ft.V46.HttpEndpointExample.userProvided({...s.example,codeSamples:s.codeSamples})}).filter(Zw),...i.autogeneratedExamples.map(s=>ft.V46.HttpEndpointExample.generated({...s.example,codeSamples:void 0}))]}});return[t,{...r,endpoints:n}]}))})};var bLE={laterVersion:"v48",earlierVersion:"v47",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.29.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.29.0",[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.29.0",[me.TYPESCRIPT_EXPRESS]:"0.17.0",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.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?YWQ(a.pagination):void 0}));return[r,{...n,endpoints:i}]}));return{...e,sdkConfig:{...e.sdkConfig,hasPaginatedEndpoints:$WQ(t)},services:t}}};function $WQ(e){for(let t of Object.values(e))for(let r of t.endpoints)if(r.pagination!=null)return!0;return!1}function YWQ(e){switch(e.type){case"cursor":{let t=XWQ(e);return t!=null?ft.V47.Pagination.cursor(t):void 0}case"offset":{let t=ZWQ(e);return t!=null?ft.V47.Pagination.offset(t):void 0}default:tc(e)}}function XWQ(e){let t=gLE(e.page);if(t!=null)return{...e,page:t}}function ZWQ(e){if(e.step!=null)return;let t=gLE(e.page);if(t!=null)return{...e,page:t}}function gLE(e){switch(e.property.type){case"query":return e.property}}var mLE={laterVersion:"v49",earlierVersion:"v48",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:"0.11.0-rc0",[me.PYTHON_PYDANTIC]:"0.10.0-rc0",[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:"2.11.0-rc0",[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:Xn,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.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:d=>ft.V48.HttpResponseBody.json({...d}),fileDownload:d=>ft.V48.HttpResponseBody.fileDownload({...d}),text:d=>ft.V48.HttpResponseBody.text({...d}),streaming:d=>ft.V48.HttpResponseBody.streaming({...d}),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 OLE={laterVersion:"v50",earlierVersion:"v49",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:"0.34.0",[me.TYPESCRIPT_BROWSER_SDK]:"0.34.0",[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:"0.34.0",[me.TYPESCRIPT_EXPRESS]:"0.17.2",[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:"0.0.0",[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V49.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=yg(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:aL(i.valueType)})),types:n.types.map(i=>lHQ(i))}),enum:ft.V49.types.Type.enum,object:n=>ft.V49.types.Type.object({...n,properties:n.properties.map(i=>({...i,valueType:aL(i.valueType)}))}),alias:n=>ft.V49.types.Type.alias({aliasOf:aL(n.aliasOf),resolvedType:dHQ(n.resolvedType)}),undiscriminatedUnion:n=>ft.V49.types.Type.undiscriminatedUnion(pHQ(n)),_other:()=>{throw new Error("Encountered unknown shape")}})}));return{...e,auth:aHQ(e.auth),headers:e.headers.map(r=>Qqo(r)),idempotencyHeaders:e.idempotencyHeaders.map(r=>Qqo(r)),types:t,services:yg(e.services,r=>_HQ(r)),errors:yg(e.errors,r=>IHQ(r)),webhookGroups:yg(e.webhookGroups,r=>rHQ(r)),websocketChannels:yg(e.websocketChannels,r=>kWQ(r)),pathParameters:e.pathParameters.map(r=>DFu(r)),variables:e.variables.map(r=>hHQ(r))}}};function kWQ(e){return{...e,headers:e.headers.map(t=>Qqo(t)),queryParameters:e.queryParameters.map(t=>cQ_(t)),pathParameters:e.pathParameters.map(t=>DFu(t)),messages:e.messages.map(t=>eHQ(t))}}function eHQ(e){return{...e,body:tHQ(e.body)}}function tHQ(e){switch(e.type){case"inlinedBody":return ft.V49.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:aL(t.valueType)}))});case"reference":return ft.V49.websocket.WebSocketMessageBody.reference({...e,bodyType:aL(e.bodyType)})}}function rHQ(e){return e.map(t=>nHQ(t))}function nHQ(e){return{...e,headers:e.headers.map(t=>Qqo(t)),payload:iHQ(e.payload)}}function iHQ(e){switch(e.type){case"reference":return ft.V49.webhooks.WebhookPayload.reference({...e,payloadType:aL(e.payloadType)});case"inlinedPayload":return ft.V49.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:aL(t.valueType)}))})}}function aHQ(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(oHQ(t));case"oauth":return ft.V49.auth.AuthScheme.oauth(uHQ(t))}})}}function oHQ(e){return{...e,valueType:aL(e.valueType)}}function uHQ(e){return{...e,configuration:ft.V49.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:sHQ(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?cHQ(e.configuration.refreshEndpoint):void 0})}}function sHQ(e){return{...e,requestProperties:{clientId:TZi(e.requestProperties.clientId),clientSecret:TZi(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?TZi(e.requestProperties.scopes):void 0},responseProperties:{accessToken:vBi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?vBi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?vBi(e.responseProperties.refreshToken):void 0}}}function cHQ(e){return{...e,requestProperties:{refreshToken:TZi(e.requestProperties.refreshToken)},responseProperties:{accessToken:vBi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?vBi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?vBi(e.responseProperties.refreshToken):void 0}}}function Qqo(e){return{...e,valueType:aL(e.valueType)}}function aL(e){return ft.V50.types.TypeReference._visit(e,{container:t=>ft.V49.types.TypeReference.container(ALE(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 ALE(e){return ft.V50.types.ContainerType._visit(e,{list:t=>ft.V49.types.ContainerType.list(aL(t)),optional:t=>ft.V49.types.ContainerType.optional(aL(t)),set:t=>ft.V49.types.ContainerType.set(aL(t)),map:({keyType:t,valueType:r})=>ft.V49.types.ContainerType.map({keyType:aL(t),valueType:aL(r)}),literal:ft.V49.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function lHQ(e){return{...e,shape:fHQ(e.shape)}}function fHQ(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:aL(t.type)}),noProperties:ft.V49.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function dHQ(e){return ft.V50.types.ResolvedTypeReference._visit(e,{container:t=>ft.V49.types.ResolvedTypeReference.container(ALE(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 pHQ(e){return{members:e.members.map(t=>({...t,type:aL(t.type)}))}}function _HQ(e){return{...e,pathParameters:e.pathParameters.map(t=>DFu(t)),headers:e.headers.map(t=>Qqo(t)),endpoints:e.endpoints.map(t=>yHQ(t))}}function DFu(e){return{...e,valueType:aL(e.valueType)}}function hHQ(e){return{...e,type:aL(e.type)}}function yHQ(e){return{...e,pagination:e.pagination!=null?OHQ(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>DFu(t)),pathParameters:e.pathParameters.map(t=>DFu(t)),sdkRequest:e.sdkRequest!=null?jHQ(e.sdkRequest):void 0,requestBody:e.requestBody!=null?DHQ(e.requestBody):void 0,response:e.response!=null?vHQ(e.response):void 0,headers:e.headers.map(t=>Qqo(t)),queryParameters:e.queryParameters.map(t=>cQ_(t))}}function vHQ(e){return{...e,body:e.body!=null?bHQ(e.body):void 0}}function bHQ(e){switch(e.type){case"json":return ft.V49.http.HttpResponseBody.json(PLE(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(wLE(e.value));case"streamParameter":return ft.V49.http.HttpResponseBody.streamParameter(mHQ(e))}}function PLE(e){switch(e.type){case"response":return ft.V49.http.JsonResponse.response({...e,responseBodyType:aL(e.responseBodyType)});case"nestedPropertyAsResponse":return ft.V49.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:aL(e.responseBodyType),responseProperty:e.responseProperty!=null?sQ_(e.responseProperty):void 0})}}function wLE(e){switch(e.type){case"json":return ft.V49.http.StreamingResponse.json({...e,payload:aL(e.payload)});case"text":return ft.V49.http.StreamingResponse.text(e);case"sse":return ft.V49.http.StreamingResponse.sse({...e,payload:aL(e.payload)})}}function gHQ(e){switch(e.type){case"json":return ft.V49.http.NonStreamHttpResponseBody.json(PLE(e.value));case"text":return ft.V49.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return ft.V49.http.NonStreamHttpResponseBody.fileDownload(e)}}function mHQ(e){return{nonStreamResponse:gHQ(e.nonStreamResponse),streamResponse:wLE(e.streamResponse)}}function OHQ(e){switch(e.type){case"cursor":return ft.V49.http.Pagination.cursor(AHQ(e));case"offset":return ft.V49.http.Pagination.offset(PHQ(e))}}function AHQ(e){return{...e,page:TZi(e.page),next:vBi(e.next),results:vBi(e.results)}}function PHQ(e){return{...e,page:TZi(e.page),results:vBi(e.results),step:e.step!=null?TZi(e.step):void 0}}function TZi(e){return{...e,property:wHQ(e.property)}}function wHQ(e){switch(e.type){case"query":return ft.V49.RequestPropertyValue.query(cQ_(e));case"body":return ft.V49.RequestPropertyValue.body(sQ_(e))}}function vBi(e){return{...e,property:sQ_(e.property)}}function sQ_(e){return{...e,valueType:aL(e.valueType)}}function cQ_(e){return{...e,valueType:aL(e.valueType)}}function jHQ(e){return{...e,streamParameter:e.streamParameter!=null?TZi(e.streamParameter):void 0,shape:EHQ(e.shape)}}function EHQ(e){return ft.V50.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V49.http.SdkRequestShape.justRequestBody(SHQ(t)),wrapper:ft.V49.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function SHQ(e){switch(e.type){case"bytes":return ft.V49.http.SdkRequestBodyType.bytes(e);case"typeReference":return ft.V49.http.SdkRequestBodyType.typeReference({...e,requestBodyType:aL(e.requestBodyType)})}}function DHQ(e){return ft.V50.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V49.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:aL(r.valueType)}))}),reference:t=>ft.V49.http.HttpRequestBody.reference({...t,requestBodyType:aL(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:aL(r.valueType)});case"file":return ft.V49.http.FileUploadRequestProperty.file(CHQ(r.value))}})}),bytes:t=>ft.V49.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function CHQ(e){switch(e.type){case"file":return ft.V49.http.FileProperty.file(e);case"fileArray":return ft.V49.http.FileProperty.fileArray(e)}}function IHQ(e){return{...e,type:e.type!=null?aL(e.type):void 0}}var SLE={laterVersion:"v51",earlierVersion:"v50",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:"0.1.2",[me.SWIFT_MODEL]:zt,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V50.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>{let t=yg(e.types,r=>{let n=r.autogeneratedExamples.map(a=>jLE(a)),i=r.userProvidedExamples.map(a=>jLE(a));return{...r,examples:[...n,...i]}});return{...e,types:t,services:yg(e.services,r=>LHQ(r)),errors:yg(e.errors,r=>GHQ(r)),webhookGroups:yg(e.webhookGroups,r=>qHQ(r)),websocketChannels:yg(e.websocketChannels,r=>MHQ(r))}}};function MHQ(e){return{...e,examples:e.examples.map(t=>BHQ(t))}}function BHQ(e){return{...e,pathParameters:e.pathParameters.map(t=>s0l(t)),headers:e.headers.map(t=>lQ_(t)),queryParameters:e.queryParameters.map(t=>DLE(t)),messages:e.messages.map(t=>({...t,body:THQ(t.body)}))}}function DLE(e){return{...e,value:Kce(e.value)}}function lQ_(e){return{...e,value:Kce(e.value)}}function s0l(e){return{...e,value:Kce(e.value)}}function THQ(e){switch(e.type){case"inlinedBody":return ft.V50.ExampleWebSocketMessageBody.inlinedBody(CLE(e));case"reference":return ft.V50.ExampleWebSocketMessageBody.reference(Kce(e))}}function CLE(e){return{...e,properties:e.properties.map(t=>({...t,value:Kce(t.value)}))}}function qHQ(e){return e.map(t=>({...t,examples:t.examples?.map(r=>({...r,payload:Kce(r.payload)}))}))}function jLE(e){return{...e,shape:ILE(e.shape)}}function fQ_(e){switch(e.type){case"primitive":return ft.V50.ExampleTypeReferenceShape.primitive({...e.primitive});case"container":return ft.V50.ExampleTypeReferenceShape.container(RHQ(e));case"unknown":return ft.V50.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return ft.V50.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:ILE(e.shape)})}}function RHQ(e){switch(e.container.type){case"list":return ft.V50.ExampleContainer.list(e.container.list.map(t=>Kce(t)));case"set":return ft.V50.ExampleContainer.set(e.container.set.map(t=>Kce(t)));case"optional":return ft.V50.ExampleContainer.optional(e.container.optional!=null?Kce(e.container.optional):void 0);case"map":return ft.V50.ExampleContainer.map(e.container.map.map(t=>({key:Kce(t.key),value:Kce(t.value)})));case"literal":return ft.V50.ExampleContainer.literal(e.container.literal)}}function Kce(e){return{...e,shape:fQ_(e.shape)}}function ILE(e){switch(e.type){case"object":return ft.V50.ExampleTypeShape.object({properties:e.properties.map(t=>MLE(t))});case"alias":return ft.V50.ExampleTypeShape.alias({value:{...Kce(e.value)}});case"enum":return ft.V50.ExampleTypeShape.enum(e);case"union":return ft.V50.ExampleTypeShape.union(FHQ(e));case"undiscriminatedUnion":return ft.V50.ExampleTypeShape.undiscriminatedUnion(NHQ(e))}}function NHQ(e){return{...e,singleUnionType:Kce(e.singleUnionType)}}function FHQ(e){return{...e,singleUnionType:xHQ(e.singleUnionType)}}function xHQ(e){return{...e,shape:zHQ(e.shape)}}function zHQ(e){switch(e.type){case"samePropertiesAsObject":return ft.V50.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:QHQ(e.object)});case"singleProperty":return ft.V50.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:fQ_(e.shape)});case"noProperties":return ft.V50.ExampleSingleUnionTypeProperties.noProperties()}}function QHQ(e){return{...e,properties:e.properties.map(t=>MLE(t))}}function MLE(e){return{...e,value:{...e.value,shape:fQ_(e.value.shape)}}}function LHQ(e){return{...e,endpoints:e.endpoints.map(t=>UHQ(t))}}function UHQ(e){return{...e,autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:ELE(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?ELE(t.example):void 0}))}}function ELE(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>s0l(t)),servicePathParameters:e.servicePathParameters.map(t=>s0l(t)),endpointPathParameters:e.endpointPathParameters.map(t=>s0l(t)),serviceHeaders:e.serviceHeaders.map(t=>lQ_(t)),endpointHeaders:e.endpointHeaders.map(t=>lQ_(t)),queryParameters:e.queryParameters.map(t=>DLE(t)),request:e.request!=null?HHQ(e.request):void 0,response:VHQ(e.response)}}function VHQ(e){switch(e.type){case"error":return ft.V50.ExampleResponse.error({...e,body:e.body!=null?Kce(e.body):void 0});case"ok":return ft.V50.ExampleResponse.ok(WHQ(e))}}function WHQ(e){switch(e.value.type){case"body":return ft.V50.ExampleEndpointSuccessResponse.body(e.value.value!=null?Kce(e.value.value):void 0);case"stream":return ft.V50.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>Kce(t)));case"sse":return ft.V50.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:Kce(t.data)})))}}function HHQ(e){switch(e.type){case"inlinedRequestBody":return ft.V50.ExampleRequestBody.inlinedRequestBody(CLE(e));case"reference":return ft.V50.ExampleRequestBody.reference(Kce(e))}}function GHQ(e){return{...e,examples:e.examples.map(t=>({...t,shape:Kce(t.shape)}))}}var qLE={laterVersion:"v52",earlierVersion:"v51",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:zt,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:Xn,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V51.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?KHQ(e.apiVersion):void 0,auth:rGQ(e.auth),headers:e.headers.map(t=>t8a(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>t8a(t)),types:JHQ(e.types),services:yg(e.services,t=>pGQ(t)),webhookGroups:yg(e.webhookGroups,t=>ZHQ(t)),websocketChannels:yg(e.websocketChannels,t=>$HQ(t)),errors:yg(e.errors,t=>CGQ(t)),pathParameters:e.pathParameters.map(t=>CFu(t)),variables:e.variables.map(t=>_GQ(t))})};function JHQ(e){return yg(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>BLE(r)),userProvidedExamples:t.userProvidedExamples.map(r=>BLE(r)),shape:ft.V52.types.Type._visit(t.shape,{union:r=>ft.V51.types.Type.union({...r,baseProperties:r.baseProperties.map(n=>({...n,valueType:l4(n.valueType)})),types:r.types.map(n=>cGQ(n))}),enum:ft.V51.types.Type.enum,object:r=>ft.V51.types.Type.object({...r,properties:r.properties.map(n=>({...n,valueType:l4(n.valueType)}))}),alias:r=>ft.V51.types.Type.alias({aliasOf:l4(r.aliasOf),resolvedType:fGQ(r.resolvedType)}),undiscriminatedUnion:r=>ft.V51.types.Type.undiscriminatedUnion(dGQ(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function KHQ(e){return ft.V51.ApiVersionScheme.header({...e,header:t8a(e.header)})}function $HQ(e){return{...e,headers:e.headers.map(t=>t8a(t)),queryParameters:e.queryParameters.map(t=>_Q_(t)),pathParameters:e.pathParameters.map(t=>CFu(t)),messages:e.messages.map(t=>YHQ(t)),examples:e.examples.map(t=>IGQ(t))}}function YHQ(e){return{...e,body:XHQ(e.body)}}function XHQ(e){switch(e.type){case"inlinedBody":return ft.V51.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:l4(t.valueType)}))});case"reference":return ft.V51.websocket.WebSocketMessageBody.reference({...e,bodyType:l4(e.bodyType)})}}function ZHQ(e){return e.map(t=>kHQ(t))}function kHQ(e){return{...e,headers:e.headers.map(t=>t8a(t)),payload:eGQ(e.payload),examples:e.examples!=null?e.examples.map(t=>tGQ(t)):void 0}}function eGQ(e){switch(e.type){case"reference":return ft.V51.webhooks.WebhookPayload.reference({...e,payloadType:l4(e.payloadType)});case"inlinedPayload":return ft.V51.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:l4(t.valueType)}))})}}function tGQ(e){return{...e,payload:$ce(e.payload)}}function rGQ(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(nGQ(t));case"oauth":return ft.V51.auth.AuthScheme.oauth(iGQ(t))}})}}function nGQ(e){return{...e,valueType:l4(e.valueType)}}function iGQ(e){return{...e,configuration:ft.V51.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:aGQ(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?oGQ(e.configuration.refreshEndpoint):void 0})}}function aGQ(e){return{...e,requestProperties:{clientId:qZi(e.requestProperties.clientId),clientSecret:qZi(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?qZi(e.requestProperties.scopes):void 0},responseProperties:{accessToken:bBi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?bBi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?bBi(e.responseProperties.refreshToken):void 0}}}function oGQ(e){return{...e,requestProperties:{refreshToken:qZi(e.requestProperties.refreshToken)},responseProperties:{accessToken:bBi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?bBi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?bBi(e.responseProperties.refreshToken):void 0}}}function t8a(e){return{...e,valueType:l4(e.valueType)}}function l4(e){return ft.V52.types.TypeReference._visit(e,{container:t=>ft.V51.types.TypeReference.container(NLE(t)),primitive:t=>ft.V51.types.TypeReference.primitive(RLE(t)),named:ft.V51.types.TypeReference.named,unknown:ft.V51.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function RLE(e){return{v1:uGQ(e.v1),v2:e.v2!=null?sGQ(e.v2):void 0}}function uGQ(e){switch(e){case"UINT":return ft.V51.types.PrimitiveTypeV1.Integer;case"UINT_64":return ft.V51.types.PrimitiveTypeV1.Long}return e}function sGQ(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:tc(e)}}function NLE(e){return ft.V52.types.ContainerType._visit(e,{list:t=>ft.V51.types.ContainerType.list(l4(t)),optional:t=>ft.V51.types.ContainerType.optional(l4(t)),set:t=>ft.V51.types.ContainerType.set(l4(t)),map:({keyType:t,valueType:r})=>ft.V51.types.ContainerType.map({keyType:l4(t),valueType:l4(r)}),literal:ft.V51.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function cGQ(e){return{...e,shape:lGQ(e.shape)}}function lGQ(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:l4(t.type)}),noProperties:ft.V51.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function fGQ(e){return ft.V52.types.ResolvedTypeReference._visit(e,{container:t=>ft.V51.types.ResolvedTypeReference.container(NLE(t)),named:ft.V51.types.ResolvedTypeReference.named,primitive:t=>ft.V51.types.ResolvedTypeReference.primitive(RLE(t)),unknown:ft.V51.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function dGQ(e){return{members:e.members.map(t=>({...t,type:l4(t.type)}))}}function pGQ(e){return{...e,pathParameters:e.pathParameters.map(t=>CFu(t)),headers:e.headers.map(t=>t8a(t)),endpoints:e.endpoints.map(t=>hGQ(t))}}function CFu(e){return{...e,valueType:l4(e.valueType)}}function _GQ(e){return{...e,type:l4(e.type)}}function hGQ(e){return{...e,pagination:e.pagination!=null?mGQ(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>CFu(t)),pathParameters:e.pathParameters.map(t=>CFu(t)),sdkRequest:e.sdkRequest!=null?wGQ(e.sdkRequest):void 0,requestBody:e.requestBody!=null?SGQ(e.requestBody):void 0,response:e.response!=null?yGQ(e.response):void 0,headers:e.headers.map(t=>t8a(t)),queryParameters:e.queryParameters.map(t=>_Q_(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:TLE(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?TLE(t.example):void 0}))}}function yGQ(e){return{...e,body:e.body!=null?vGQ(e.body):void 0}}function vGQ(e){switch(e.type){case"json":return ft.V51.http.HttpResponseBody.json(FLE(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(xLE(e.value));case"streamParameter":return ft.V51.http.HttpResponseBody.streamParameter(gGQ(e))}}function FLE(e){switch(e.type){case"response":return ft.V51.http.JsonResponse.response({...e,responseBodyType:l4(e.responseBodyType)});case"nestedPropertyAsResponse":return ft.V51.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:l4(e.responseBodyType),responseProperty:e.responseProperty!=null?pQ_(e.responseProperty):void 0})}}function xLE(e){switch(e.type){case"json":return ft.V51.http.StreamingResponse.json({...e,payload:l4(e.payload)});case"text":return ft.V51.http.StreamingResponse.text(e);case"sse":return ft.V51.http.StreamingResponse.sse({...e,payload:l4(e.payload)})}}function bGQ(e){switch(e.type){case"json":return ft.V51.http.NonStreamHttpResponseBody.json(FLE(e.value));case"text":return ft.V51.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return ft.V51.http.NonStreamHttpResponseBody.fileDownload(e)}}function gGQ(e){return{nonStreamResponse:bGQ(e.nonStreamResponse),streamResponse:xLE(e.streamResponse)}}function mGQ(e){switch(e.type){case"cursor":return ft.V51.http.Pagination.cursor(OGQ(e));case"offset":return ft.V51.http.Pagination.offset(AGQ(e))}}function OGQ(e){return{...e,page:qZi(e.page),next:bBi(e.next),results:bBi(e.results)}}function AGQ(e){return{...e,page:qZi(e.page),results:bBi(e.results),step:e.step!=null?qZi(e.step):void 0}}function qZi(e){return{...e,property:PGQ(e.property)}}function PGQ(e){switch(e.type){case"query":return ft.V51.RequestPropertyValue.query(_Q_(e));case"body":return ft.V51.RequestPropertyValue.body(pQ_(e))}}function bBi(e){return{...e,property:pQ_(e.property)}}function pQ_(e){return{...e,valueType:l4(e.valueType)}}function _Q_(e){return{...e,valueType:l4(e.valueType)}}function wGQ(e){return{...e,streamParameter:e.streamParameter!=null?qZi(e.streamParameter):void 0,shape:jGQ(e.shape)}}function jGQ(e){return ft.V52.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V51.http.SdkRequestShape.justRequestBody(EGQ(t)),wrapper:ft.V51.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function EGQ(e){switch(e.type){case"bytes":return ft.V51.http.SdkRequestBodyType.bytes(e);case"typeReference":return ft.V51.http.SdkRequestBodyType.typeReference({...e,requestBodyType:l4(e.requestBodyType)})}}function SGQ(e){return ft.V52.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V51.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:l4(r.valueType)}))}),reference:t=>ft.V51.http.HttpRequestBody.reference({...t,requestBodyType:l4(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:l4(r.valueType)});case"file":return ft.V51.http.FileUploadRequestProperty.file(DGQ(r.value))}})}),bytes:t=>ft.V51.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function DGQ(e){switch(e.type){case"file":return ft.V51.http.FileProperty.file(e);case"fileArray":return ft.V51.http.FileProperty.fileArray(e)}}function CGQ(e){return{...e,type:e.type!=null?l4(e.type):void 0,examples:e.examples.map(t=>({...t,shape:$ce(t.shape)}))}}function IGQ(e){return{...e,pathParameters:e.pathParameters.map(t=>c0l(t)),headers:e.headers.map(t=>dQ_(t)),queryParameters:e.queryParameters.map(t=>zLE(t)),messages:e.messages.map(t=>({...t,body:MGQ(t.body)}))}}function zLE(e){return{...e,value:$ce(e.value)}}function dQ_(e){return{...e,value:$ce(e.value)}}function c0l(e){return{...e,value:$ce(e.value)}}function MGQ(e){switch(e.type){case"inlinedBody":return ft.V51.ExampleWebSocketMessageBody.inlinedBody(QLE(e));case"reference":return ft.V51.ExampleWebSocketMessageBody.reference($ce(e))}}function QLE(e){return{...e,properties:e.properties.map(t=>({...t,value:$ce(t.value)}))}}function BLE(e){return{...e,shape:ULE(e.shape)}}function hQ_(e){switch(e.type){case"primitive":return ft.V51.ExampleTypeReferenceShape.primitive(BGQ(e));case"container":return ft.V51.ExampleTypeReferenceShape.container(TGQ(e));case"unknown":return ft.V51.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return ft.V51.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:ULE(e.shape)})}}function LLE(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 BGQ(e){return LLE(e.primitive)}function TGQ(e){switch(e.container.type){case"list":return ft.V51.ExampleContainer.list({list:e.container.list.map(t=>$ce(t)),itemType:l4(e.container.itemType)});case"set":return ft.V51.ExampleContainer.set({set:e.container.set.map(t=>$ce(t)),itemType:l4(e.container.itemType)});case"optional":return ft.V51.ExampleContainer.optional({optional:e.container.optional!=null?$ce(e.container.optional):void 0,valueType:l4(e.container.valueType)});case"map":return ft.V51.ExampleContainer.map({map:e.container.map.map(t=>({key:$ce(t.key),value:$ce(t.value)})),keyType:l4(e.container.keyType),valueType:l4(e.container.valueType)});case"literal":return ft.V51.ExampleContainer.literal({literal:LLE(e.container.literal)})}}function $ce(e){return{...e,shape:hQ_(e.shape)}}function ULE(e){switch(e.type){case"object":return ft.V51.ExampleTypeShape.object({properties:e.properties.map(t=>VLE(t))});case"alias":return ft.V51.ExampleTypeShape.alias({value:{...$ce(e.value)}});case"enum":return ft.V51.ExampleTypeShape.enum(e);case"union":return ft.V51.ExampleTypeShape.union(RGQ(e));case"undiscriminatedUnion":return ft.V51.ExampleTypeShape.undiscriminatedUnion(qGQ(e))}}function qGQ(e){return{...e,singleUnionType:$ce(e.singleUnionType)}}function RGQ(e){return{...e,singleUnionType:NGQ(e.singleUnionType)}}function NGQ(e){return{...e,shape:FGQ(e.shape)}}function FGQ(e){switch(e.type){case"samePropertiesAsObject":return ft.V51.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:xGQ(e.object)});case"singleProperty":return ft.V51.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:hQ_(e.shape)});case"noProperties":return ft.V51.ExampleSingleUnionTypeProperties.noProperties()}}function xGQ(e){return{...e,properties:e.properties.map(t=>VLE(t))}}function VLE(e){return{...e,value:{...e.value,shape:hQ_(e.value.shape)}}}function TLE(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>c0l(t)),servicePathParameters:e.servicePathParameters.map(t=>c0l(t)),endpointPathParameters:e.endpointPathParameters.map(t=>c0l(t)),serviceHeaders:e.serviceHeaders.map(t=>dQ_(t)),endpointHeaders:e.endpointHeaders.map(t=>dQ_(t)),queryParameters:e.queryParameters.map(t=>zLE(t)),request:e.request!=null?LGQ(e.request):void 0,response:zGQ(e.response)}}function zGQ(e){switch(e.type){case"error":return ft.V51.ExampleResponse.error({...e,body:e.body!=null?$ce(e.body):void 0});case"ok":return ft.V51.ExampleResponse.ok(QGQ(e))}}function QGQ(e){switch(e.value.type){case"body":return ft.V51.ExampleEndpointSuccessResponse.body(e.value.value!=null?$ce(e.value.value):void 0);case"stream":return ft.V51.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>$ce(t)));case"sse":return ft.V51.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:$ce(t.data)})))}}function LGQ(e){switch(e.type){case"inlinedRequestBody":return ft.V51.ExampleRequestBody.inlinedRequestBody(QLE(e));case"reference":return ft.V51.ExampleRequestBody.reference($ce(e))}}var GLE={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]:zt,[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]:zt,[me.OPENAPI]:"0.1.0",[me.STOPLIGHT]:zt,[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]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:"0.5.0",[me.SWIFT_MODEL]:zt,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:"0.1.0",[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V52.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?VGQ(e.apiVersion):void 0,auth:XGQ(e.auth),headers:e.headers.map(t=>r8a(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>r8a(t)),types:UGQ(e.types),services:yg(e.services,t=>sJQ(t)),webhookGroups:yg(e.webhookGroups,t=>JGQ(t)),websocketChannels:yg(e.websocketChannels,t=>WGQ(t)),errors:yg(e.errors,t=>wJQ(t)),pathParameters:e.pathParameters.map(t=>IFu(t)),variables:e.variables.map(t=>cJQ(t))})};function UGQ(e){return yg(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>WLE(r)),userProvidedExamples:t.userProvidedExamples.map(r=>WLE(r)),shape:ft.V53.types.Type._visit(t.shape,{union:r=>ft.V52.types.Type.union({...r,baseProperties:r.baseProperties.map(n=>({...n,valueType:f4(n.valueType)})),types:r.types.map(n=>iJQ(n))}),enum:ft.V52.types.Type.enum,object:r=>ft.V52.types.Type.object({...r,properties:r.properties.map(n=>({...n,valueType:f4(n.valueType)}))}),alias:r=>ft.V52.types.Type.alias({aliasOf:f4(r.aliasOf),resolvedType:oJQ(r.resolvedType)}),undiscriminatedUnion:r=>ft.V52.types.Type.undiscriminatedUnion(uJQ(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function VGQ(e){return ft.V52.ApiVersionScheme.header({...e,header:r8a(e.header)})}function WGQ(e){return{...e,headers:e.headers.map(t=>r8a(t)),queryParameters:e.queryParameters.map(t=>bQ_(t)),pathParameters:e.pathParameters.map(t=>IFu(t)),messages:e.messages.map(t=>HGQ(t)),examples:e.examples.map(t=>jJQ(t))}}function HGQ(e){return{...e,body:GGQ(e.body)}}function GGQ(e){switch(e.type){case"inlinedBody":return ft.V52.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:f4(t.valueType)}))});case"reference":return ft.V52.websocket.WebSocketMessageBody.reference({...e,bodyType:f4(e.bodyType)})}}function JGQ(e){return e.map(t=>KGQ(t))}function KGQ(e){return{...e,headers:e.headers.map(t=>r8a(t)),payload:$GQ(e.payload),examples:e.examples!=null?e.examples.map(t=>YGQ(t)):void 0}}function $GQ(e){switch(e.type){case"reference":return ft.V52.webhooks.WebhookPayload.reference({...e,payloadType:f4(e.payloadType)});case"inlinedPayload":return ft.V52.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:f4(t.valueType)}))})}}function YGQ(e){return{...e,payload:Yce(e.payload)}}function XGQ(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(ZGQ(t));case"oauth":return ft.V52.auth.AuthScheme.oauth(kGQ(t))}})}}function ZGQ(e){return{...e,valueType:f4(e.valueType)}}function kGQ(e){return{...e,configuration:ft.V52.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:eJQ(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?tJQ(e.configuration.refreshEndpoint):void 0})}}function eJQ(e){return{...e,requestProperties:{clientId:RZi(e.requestProperties.clientId),clientSecret:RZi(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?RZi(e.requestProperties.scopes):void 0},responseProperties:{accessToken:gBi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?gBi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?gBi(e.responseProperties.refreshToken):void 0}}}function tJQ(e){return{...e,requestProperties:{refreshToken:RZi(e.requestProperties.refreshToken)},responseProperties:{accessToken:gBi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?gBi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?gBi(e.responseProperties.refreshToken):void 0}}}function r8a(e){return{...e,valueType:f4(e.valueType)}}function f4(e){return ft.V53.types.TypeReference._visit(e,{container:t=>ft.V52.types.TypeReference.container(KLE(t)),primitive:t=>ft.V52.types.TypeReference.primitive(JLE(t)),named:ft.V52.types.TypeReference.named,unknown:ft.V52.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function JLE(e){return{v1:rJQ(e.v1),v2:e.v2!=null?nJQ(e.v2):void 0}}function rJQ(e){switch(e){case"FLOAT":return ft.V52.types.PrimitiveTypeV1.Double}return e}function nJQ(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:tc(e)}}function KLE(e){return ft.V53.types.ContainerType._visit(e,{list:t=>ft.V52.types.ContainerType.list(f4(t)),optional:t=>ft.V52.types.ContainerType.optional(f4(t)),set:t=>ft.V52.types.ContainerType.set(f4(t)),map:({keyType:t,valueType:r})=>ft.V52.types.ContainerType.map({keyType:f4(t),valueType:f4(r)}),literal:ft.V52.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function iJQ(e){return{...e,shape:aJQ(e.shape)}}function aJQ(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:f4(t.type)}),noProperties:ft.V52.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function oJQ(e){return ft.V53.types.ResolvedTypeReference._visit(e,{container:t=>ft.V52.types.ResolvedTypeReference.container(KLE(t)),named:ft.V52.types.ResolvedTypeReference.named,primitive:t=>ft.V52.types.ResolvedTypeReference.primitive(JLE(t)),unknown:ft.V52.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function uJQ(e){return{members:e.members.map(t=>({...t,type:f4(t.type)}))}}function sJQ(e){return{...e,pathParameters:e.pathParameters.map(t=>IFu(t)),headers:e.headers.map(t=>r8a(t)),endpoints:e.endpoints.map(t=>lJQ(t))}}function IFu(e){return{...e,valueType:f4(e.valueType)}}function cJQ(e){return{...e,type:f4(e.type)}}function lJQ(e){return{...e,pagination:e.pagination!=null?hJQ(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>IFu(t)),pathParameters:e.pathParameters.map(t=>IFu(t)),sdkRequest:e.sdkRequest!=null?gJQ(e.sdkRequest):void 0,requestBody:e.requestBody!=null?AJQ(e.requestBody):void 0,response:e.response!=null?fJQ(e.response):void 0,headers:e.headers.map(t=>r8a(t)),queryParameters:e.queryParameters.map(t=>bQ_(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:HLE(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?HLE(t.example):void 0}))}}function fJQ(e){return{...e,body:e.body!=null?dJQ(e.body):void 0}}function dJQ(e){switch(e.type){case"json":return ft.V52.http.HttpResponseBody.json($LE(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(YLE(e.value));case"streamParameter":return ft.V52.http.HttpResponseBody.streamParameter(_JQ(e))}}function $LE(e){switch(e.type){case"response":return ft.V52.http.JsonResponse.response({...e,responseBodyType:f4(e.responseBodyType)});case"nestedPropertyAsResponse":return ft.V52.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:f4(e.responseBodyType),responseProperty:e.responseProperty!=null?vQ_(e.responseProperty):void 0})}}function YLE(e){switch(e.type){case"json":return ft.V52.http.StreamingResponse.json({...e,payload:f4(e.payload)});case"text":return ft.V52.http.StreamingResponse.text(e);case"sse":return ft.V52.http.StreamingResponse.sse({...e,payload:f4(e.payload)})}}function pJQ(e){switch(e.type){case"json":return ft.V52.http.NonStreamHttpResponseBody.json($LE(e.value));case"text":return ft.V52.http.NonStreamHttpResponseBody.text(e);case"fileDownload":return ft.V52.http.NonStreamHttpResponseBody.fileDownload(e)}}function _JQ(e){return{nonStreamResponse:pJQ(e.nonStreamResponse),streamResponse:YLE(e.streamResponse)}}function hJQ(e){switch(e.type){case"cursor":return ft.V52.http.Pagination.cursor(yJQ(e));case"offset":return ft.V52.http.Pagination.offset(vJQ(e))}}function yJQ(e){return{...e,page:RZi(e.page),next:gBi(e.next),results:gBi(e.results)}}function vJQ(e){return{...e,page:RZi(e.page),results:gBi(e.results),step:e.step!=null?RZi(e.step):void 0}}function RZi(e){return{...e,property:bJQ(e.property)}}function bJQ(e){switch(e.type){case"query":return ft.V52.RequestPropertyValue.query(bQ_(e));case"body":return ft.V52.RequestPropertyValue.body(vQ_(e))}}function gBi(e){return{...e,property:vQ_(e.property)}}function vQ_(e){return{...e,valueType:f4(e.valueType)}}function bQ_(e){return{...e,valueType:f4(e.valueType)}}function gJQ(e){return{...e,streamParameter:e.streamParameter!=null?RZi(e.streamParameter):void 0,shape:mJQ(e.shape)}}function mJQ(e){return ft.V53.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V52.http.SdkRequestShape.justRequestBody(OJQ(t)),wrapper:ft.V52.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function OJQ(e){switch(e.type){case"bytes":return ft.V52.http.SdkRequestBodyType.bytes(e);case"typeReference":return ft.V52.http.SdkRequestBodyType.typeReference({...e,requestBodyType:f4(e.requestBodyType)})}}function AJQ(e){return ft.V53.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V52.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:f4(r.valueType)}))}),reference:t=>ft.V52.http.HttpRequestBody.reference({...t,requestBodyType:f4(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:f4(r.valueType)});case"file":return ft.V52.http.FileUploadRequestProperty.file(PJQ(r.value))}})}),bytes:t=>ft.V52.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function PJQ(e){switch(e.type){case"file":return ft.V52.http.FileProperty.file(e);case"fileArray":return ft.V52.http.FileProperty.fileArray(e)}}function wJQ(e){return{...e,type:e.type!=null?f4(e.type):void 0,examples:e.examples.map(t=>({...t,shape:Yce(t.shape)}))}}function jJQ(e){return{...e,pathParameters:e.pathParameters.map(t=>l0l(t)),headers:e.headers.map(t=>yQ_(t)),queryParameters:e.queryParameters.map(t=>XLE(t)),messages:e.messages.map(t=>({...t,body:EJQ(t.body)}))}}function XLE(e){return{...e,value:Yce(e.value)}}function yQ_(e){return{...e,value:Yce(e.value)}}function l0l(e){return{...e,value:Yce(e.value)}}function EJQ(e){switch(e.type){case"inlinedBody":return ft.V52.ExampleWebSocketMessageBody.inlinedBody(ZLE(e));case"reference":return ft.V52.ExampleWebSocketMessageBody.reference(Yce(e))}}function ZLE(e){return{...e,properties:e.properties.map(t=>({...t,value:Yce(t.value)}))}}function WLE(e){return{...e,shape:eUE(e.shape)}}function gQ_(e){switch(e.type){case"primitive":return ft.V52.ExampleTypeReferenceShape.primitive(SJQ(e));case"container":return ft.V52.ExampleTypeReferenceShape.container(DJQ(e));case"unknown":return ft.V52.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return ft.V52.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:eUE(e.shape)})}}function kLE(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 SJQ(e){return kLE(e.primitive)}function DJQ(e){switch(e.container.type){case"list":return ft.V52.ExampleContainer.list({list:e.container.list.map(t=>Yce(t)),itemType:f4(e.container.itemType)});case"set":return ft.V52.ExampleContainer.set({set:e.container.set.map(t=>Yce(t)),itemType:f4(e.container.itemType)});case"optional":return ft.V52.ExampleContainer.optional({optional:e.container.optional!=null?Yce(e.container.optional):void 0,valueType:f4(e.container.valueType)});case"map":return ft.V52.ExampleContainer.map({map:e.container.map.map(t=>({key:Yce(t.key),value:Yce(t.value)})),keyType:f4(e.container.keyType),valueType:f4(e.container.valueType)});case"literal":return ft.V52.ExampleContainer.literal({literal:kLE(e.container.literal)})}}function Yce(e){return{...e,shape:gQ_(e.shape)}}function eUE(e){switch(e.type){case"object":return ft.V52.ExampleTypeShape.object({properties:e.properties.map(t=>tUE(t))});case"alias":return ft.V52.ExampleTypeShape.alias({value:{...Yce(e.value)}});case"enum":return ft.V52.ExampleTypeShape.enum(e);case"union":return ft.V52.ExampleTypeShape.union(IJQ(e));case"undiscriminatedUnion":return ft.V52.ExampleTypeShape.undiscriminatedUnion(CJQ(e))}}function CJQ(e){return{...e,singleUnionType:Yce(e.singleUnionType)}}function IJQ(e){return{...e,singleUnionType:MJQ(e.singleUnionType)}}function MJQ(e){return{...e,shape:BJQ(e.shape)}}function BJQ(e){switch(e.type){case"samePropertiesAsObject":return ft.V52.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:TJQ(e.object)});case"singleProperty":return ft.V52.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:gQ_(e.shape)});case"noProperties":return ft.V52.ExampleSingleUnionTypeProperties.noProperties()}}function TJQ(e){return{...e,properties:e.properties.map(t=>tUE(t))}}function tUE(e){return{...e,value:{...e.value,shape:gQ_(e.value.shape)}}}function HLE(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>l0l(t)),servicePathParameters:e.servicePathParameters.map(t=>l0l(t)),endpointPathParameters:e.endpointPathParameters.map(t=>l0l(t)),serviceHeaders:e.serviceHeaders.map(t=>yQ_(t)),endpointHeaders:e.endpointHeaders.map(t=>yQ_(t)),queryParameters:e.queryParameters.map(t=>XLE(t)),request:e.request!=null?NJQ(e.request):void 0,response:qJQ(e.response)}}function qJQ(e){switch(e.type){case"error":return ft.V52.ExampleResponse.error({...e,body:e.body!=null?Yce(e.body):void 0});case"ok":return ft.V52.ExampleResponse.ok(RJQ(e))}}function RJQ(e){switch(e.value.type){case"body":return ft.V52.ExampleEndpointSuccessResponse.body(e.value.value!=null?Yce(e.value.value):void 0);case"stream":return ft.V52.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>Yce(t)));case"sse":return ft.V52.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:Yce(t.data)})))}}function NJQ(e){switch(e.type){case"inlinedRequestBody":return ft.V52.ExampleRequestBody.inlinedRequestBody(ZLE(e));case"reference":return ft.V52.ExampleRequestBody.reference(Yce(e))}}var rUE={laterVersion:"v54",earlierVersion:"v53",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:zt,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:zt,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V53.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:yg(e.services,t=>({...t,endpoints:t.endpoints.map(r=>({...r,response:FJQ(r.response)}))}))})};function FJQ(e){if(e!=null)return{statusCode:e.statusCode,body:e.body?.type==="bytes"?ft.V53.HttpResponseBody.fileDownload({docs:void 0}):e.body}}var aUE={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]:zt,[me.JAVA_MODEL]:"1.7.0",[me.JAVA_SDK]:"2.16.0",[me.JAVA_SPRING]:"1.5.0",[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:"1.10.1",[me.SWIFT_MODEL]:zt,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:"0.3.2",[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V54.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,apiVersion:e.apiVersion!=null?zJQ(e.apiVersion):void 0,auth:JJQ(e.auth),headers:e.headers.map(t=>n8a(t)),idempotencyHeaders:e.idempotencyHeaders.map(t=>n8a(t)),types:xJQ(e.types),services:yg(e.services,t=>rKQ(t)),webhookGroups:yg(e.webhookGroups,t=>VJQ(t)),websocketChannels:yg(e.websocketChannels,t=>QJQ(t)),errors:yg(e.errors,t=>bKQ(t)),pathParameters:e.pathParameters.map(t=>MFu(t)),variables:e.variables.map(t=>nKQ(t)),dynamic:e.dynamic!=null?MKQ(e.dynamic):void 0})};function xJQ(e){return yg(e,t=>({...t,autogeneratedExamples:t.autogeneratedExamples.map(r=>nUE(r)),userProvidedExamples:t.userProvidedExamples.map(r=>nUE(r)),shape:ft.V55.types.Type._visit(t.shape,{union:r=>ft.V54.types.Type.union({...r,baseProperties:r.baseProperties.map(n=>({...n,valueType:kT(n.valueType)})),types:r.types.map(n=>ZJQ(n))}),enum:ft.V54.types.Type.enum,object:r=>ft.V54.types.Type.object({...r,properties:r.properties.map(n=>({...n,valueType:kT(n.valueType)})),extendedProperties:r.extendedProperties?.map(n=>({...n,valueType:kT(n.valueType)}))}),alias:r=>ft.V54.types.Type.alias({aliasOf:kT(r.aliasOf),resolvedType:eKQ(r.resolvedType)}),undiscriminatedUnion:r=>ft.V54.types.Type.undiscriminatedUnion(tKQ(r)),_other:()=>{throw new Error("Encountered unknown shape")}})}))}function zJQ(e){return ft.V54.ApiVersionScheme.header({...e,header:n8a(e.header)})}function QJQ(e){return{...e,headers:e.headers.map(t=>n8a(t)),queryParameters:e.queryParameters.map(t=>AQ_(t)),pathParameters:e.pathParameters.map(t=>MFu(t)),messages:e.messages.map(t=>LJQ(t)),examples:e.examples.map(t=>gKQ(t))}}function LJQ(e){return{...e,body:UJQ(e.body)}}function UJQ(e){switch(e.type){case"inlinedBody":return ft.V54.websocket.WebSocketMessageBody.inlinedBody({...e,properties:e.properties.map(t=>({...t,valueType:kT(t.valueType)}))});case"reference":return ft.V54.websocket.WebSocketMessageBody.reference({...e,bodyType:kT(e.bodyType)})}}function VJQ(e){return e.map(t=>WJQ(t))}function WJQ(e){return{...e,headers:e.headers.map(t=>n8a(t)),payload:HJQ(e.payload),examples:e.examples!=null?e.examples.map(t=>GJQ(t)):void 0}}function HJQ(e){switch(e.type){case"reference":return ft.V54.webhooks.WebhookPayload.reference({...e,payloadType:kT(e.payloadType)});case"inlinedPayload":return ft.V54.webhooks.WebhookPayload.inlinedPayload({...e,properties:e.properties.map(t=>({...t,valueType:kT(t.valueType)}))})}}function GJQ(e){return{...e,payload:roe(e.payload)}}function JJQ(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(KJQ(t));case"oauth":return ft.V54.auth.AuthScheme.oauth($JQ(t))}})}}function KJQ(e){return{...e,valueType:kT(e.valueType)}}function $JQ(e){return{...e,configuration:ft.V54.auth.OAuthConfiguration.clientCredentials({...e.configuration,tokenEndpoint:YJQ(e.configuration.tokenEndpoint),refreshEndpoint:e.configuration.refreshEndpoint!=null?XJQ(e.configuration.refreshEndpoint):void 0})}}function YJQ(e){return{...e,requestProperties:{clientId:NZi(e.requestProperties.clientId),clientSecret:NZi(e.requestProperties.clientSecret),scopes:e.requestProperties.scopes!=null?NZi(e.requestProperties.scopes):void 0},responseProperties:{accessToken:Dyi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Dyi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Dyi(e.responseProperties.refreshToken):void 0}}}function XJQ(e){return{...e,requestProperties:{refreshToken:NZi(e.requestProperties.refreshToken)},responseProperties:{accessToken:Dyi(e.responseProperties.accessToken),expiresIn:e.responseProperties.expiresIn!=null?Dyi(e.responseProperties.expiresIn):void 0,refreshToken:e.responseProperties.refreshToken!=null?Dyi(e.responseProperties.refreshToken):void 0}}}function n8a(e){return{...e,valueType:kT(e.valueType)}}function kT(e){return e.type==="container"&&e.container.type==="nullable"?WKQ(e.container.nullable):e.type==="container"&&e.container.type==="optional"?VKQ(e.container.optional):ft.V55.types.TypeReference._visit(e,{container:t=>ft.V54.types.TypeReference.container(uUE(t)),primitive:t=>ft.V54.types.TypeReference.primitive(oUE(t)),named:ft.V54.types.TypeReference.named,unknown:ft.V54.types.TypeReference.unknown,_other:()=>{throw new Error("Unknown type reference: "+e.type)}})}function oUE(e){return{v1:e.v1,v2:e.v2!=null?e.v2:void 0}}function uUE(e){return ft.V55.types.ContainerType._visit(e,{list:t=>ft.V54.types.ContainerType.list(kT(t)),optional:t=>ft.V54.types.ContainerType.optional(kT(t)),nullable:t=>ft.V54.types.ContainerType.optional(kT(t)),set:t=>ft.V54.types.ContainerType.set(kT(t)),map:({keyType:t,valueType:r})=>ft.V54.types.ContainerType.map({keyType:kT(t),valueType:kT(r)}),literal:ft.V54.types.ContainerType.literal,_other:()=>{throw new Error("Unknown ContainerType: "+e.type)}})}function ZJQ(e){return{...e,shape:kJQ(e.shape)}}function kJQ(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:kT(t.type)}),noProperties:ft.V54.types.SingleUnionTypeProperties.noProperties,_other:()=>{throw new Error(`Unknown SingleUnionTypeProperties: ${JSON.stringify(e)}`)}})}function eKQ(e){return ft.V55.types.ResolvedTypeReference._visit(e,{container:t=>ft.V54.types.ResolvedTypeReference.container(uUE(t)),named:ft.V54.types.ResolvedTypeReference.named,primitive:t=>ft.V54.types.ResolvedTypeReference.primitive(oUE(t)),unknown:ft.V54.types.ResolvedTypeReference.unknown,_other:()=>{throw new Error("Unknown ResolvedTypeReference: "+e.type)}})}function tKQ(e){return{members:e.members.map(t=>({...t,type:kT(t.type)}))}}function rKQ(e){return{...e,pathParameters:e.pathParameters.map(t=>MFu(t)),headers:e.headers.map(t=>n8a(t)),endpoints:e.endpoints.map(t=>iKQ(t))}}function MFu(e){return{...e,valueType:kT(e.valueType)}}function nKQ(e){return{...e,type:kT(e.type)}}function iKQ(e){return{...e,pagination:e.pagination!=null?cKQ(e.pagination):void 0,allPathParameters:e.allPathParameters.map(t=>MFu(t)),pathParameters:e.pathParameters.map(t=>MFu(t)),sdkRequest:e.sdkRequest!=null?pKQ(e.sdkRequest):void 0,requestBody:e.requestBody!=null?yKQ(e.requestBody):void 0,response:e.response!=null?aKQ(e.response):void 0,headers:e.headers.map(t=>n8a(t)),queryParameters:e.queryParameters.map(t=>AQ_(t)),autogeneratedExamples:e.autogeneratedExamples.map(t=>({...t,example:iUE(t.example)})),userSpecifiedExamples:e.userSpecifiedExamples.map(t=>({...t,example:t.example!=null?iUE(t.example):void 0}))}}function aKQ(e){return{...e,body:e.body!=null?oKQ(e.body):void 0}}function oKQ(e){switch(e.type){case"json":return ft.V54.http.HttpResponseBody.json(sUE(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(cUE(e.value));case"streamParameter":return ft.V54.http.HttpResponseBody.streamParameter(sKQ(e));default:tc(e)}}function sUE(e){switch(e.type){case"response":return ft.V54.http.JsonResponse.response({...e,responseBodyType:kT(e.responseBodyType)});case"nestedPropertyAsResponse":return ft.V54.http.JsonResponse.nestedPropertyAsResponse({...e,responseBodyType:kT(e.responseBodyType),responseProperty:e.responseProperty!=null?OQ_(e.responseProperty):void 0})}}function cUE(e){switch(e.type){case"json":return ft.V54.http.StreamingResponse.json({...e,payload:kT(e.payload)});case"text":return ft.V54.http.StreamingResponse.text(e);case"sse":return ft.V54.http.StreamingResponse.sse({...e,payload:kT(e.payload)})}}function uKQ(e){switch(e.type){case"json":return ft.V54.http.NonStreamHttpResponseBody.json(sUE(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:tc(e)}}function sKQ(e){return{nonStreamResponse:uKQ(e.nonStreamResponse),streamResponse:cUE(e.streamResponse)}}function cKQ(e){switch(e.type){case"cursor":return ft.V54.http.Pagination.cursor(lKQ(e));case"offset":return ft.V54.http.Pagination.offset(fKQ(e))}}function lKQ(e){return{...e,page:NZi(e.page),next:Dyi(e.next),results:Dyi(e.results)}}function fKQ(e){return{...e,page:NZi(e.page),results:Dyi(e.results),step:e.step!=null?NZi(e.step):void 0,hasNextPage:e.hasNextPage!=null?Dyi(e.hasNextPage):void 0}}function NZi(e){return{...e,property:dKQ(e.property)}}function dKQ(e){switch(e.type){case"query":return ft.V54.RequestPropertyValue.query(AQ_(e));case"body":return ft.V54.RequestPropertyValue.body(OQ_(e))}}function Dyi(e){return{...e,property:OQ_(e.property)}}function OQ_(e){return{...e,valueType:kT(e.valueType)}}function AQ_(e){return{...e,valueType:kT(e.valueType)}}function pKQ(e){return{...e,streamParameter:e.streamParameter!=null?NZi(e.streamParameter):void 0,shape:_KQ(e.shape)}}function _KQ(e){return ft.V55.http.SdkRequestShape._visit(e,{justRequestBody:t=>ft.V54.http.SdkRequestShape.justRequestBody(hKQ(t)),wrapper:ft.V54.http.SdkRequestShape.wrapper,_other:()=>{throw new Error("Unknown SdkRequestShape: "+e.type)}})}function hKQ(e){switch(e.type){case"bytes":return ft.V54.http.SdkRequestBodyType.bytes(e);case"typeReference":return ft.V54.http.SdkRequestBodyType.typeReference({...e,requestBodyType:kT(e.requestBodyType)})}}function yKQ(e){return ft.V55.http.HttpRequestBody._visit(e,{inlinedRequestBody:t=>ft.V54.http.HttpRequestBody.inlinedRequestBody({...t,properties:t.properties.map(r=>({...r,valueType:kT(r.valueType)})),extendedProperties:t.extendedProperties?.map(r=>({...r,valueType:kT(r.valueType)}))}),reference:t=>ft.V54.http.HttpRequestBody.reference({...t,requestBodyType:kT(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:kT(r.valueType)});case"file":return ft.V54.http.FileUploadRequestProperty.file(vKQ(r.value))}})}),bytes:t=>ft.V54.http.HttpRequestBody.bytes(t),_other:()=>{throw new Error("Unknown HttpRequestBody: "+e.type)}})}function vKQ(e){switch(e.type){case"file":return ft.V54.http.FileProperty.file(e);case"fileArray":return ft.V54.http.FileProperty.fileArray(e)}}function bKQ(e){return{...e,type:e.type!=null?kT(e.type):void 0,examples:e.examples.map(t=>({...t,shape:roe(t.shape)}))}}function gKQ(e){return{...e,pathParameters:e.pathParameters.map(t=>f0l(t)),headers:e.headers.map(t=>mQ_(t)),queryParameters:e.queryParameters.map(t=>lUE(t)),messages:e.messages.map(t=>({...t,body:mKQ(t.body)}))}}function lUE(e){return{...e,value:roe(e.value)}}function mQ_(e){return{...e,value:roe(e.value)}}function f0l(e){return{...e,value:roe(e.value)}}function mKQ(e){switch(e.type){case"inlinedBody":return ft.V54.ExampleWebSocketMessageBody.inlinedBody(fUE(e));case"reference":return ft.V54.ExampleWebSocketMessageBody.reference(roe(e))}}function fUE(e){return{...e,properties:e.properties.map(t=>({...t,value:roe(t.value)}))}}function nUE(e){return{...e,shape:dUE(e.shape)}}function PQ_(e){switch(e.type){case"primitive":return ft.V54.ExampleTypeReferenceShape.primitive(OKQ(e));case"container":return ft.V54.ExampleTypeReferenceShape.container(AKQ(e));case"unknown":return ft.V54.ExampleTypeReferenceShape.unknown(e.unknown);case"named":return ft.V54.ExampleTypeReferenceShape.named({...e,typeName:e.typeName,shape:dUE(e.shape)})}}function OKQ(e){return e.primitive}function AKQ(e){switch(e.container.type){case"list":return ft.V54.ExampleContainer.list({list:e.container.list.map(t=>roe(t)),itemType:kT(e.container.itemType)});case"set":return ft.V54.ExampleContainer.set({set:e.container.set.map(t=>roe(t)),itemType:kT(e.container.itemType)});case"optional":return ft.V54.ExampleContainer.optional({optional:e.container.optional!=null?roe(e.container.optional):void 0,valueType:kT(e.container.valueType)});case"nullable":return ft.V54.ExampleContainer.optional({optional:e.container.nullable!=null?roe(e.container.nullable):void 0,valueType:kT(e.container.valueType)});case"map":return ft.V54.ExampleContainer.map({map:e.container.map.map(t=>({key:roe(t.key),value:roe(t.value)})),keyType:kT(e.container.keyType),valueType:kT(e.container.valueType)});case"literal":return ft.V54.ExampleContainer.literal({literal:e.container.literal})}}function roe(e){return{...e,shape:PQ_(e.shape)}}function dUE(e){switch(e.type){case"object":return ft.V54.ExampleTypeShape.object({properties:e.properties.map(t=>pUE(t))});case"alias":return ft.V54.ExampleTypeShape.alias({value:{...roe(e.value)}});case"enum":return ft.V54.ExampleTypeShape.enum(e);case"union":return ft.V54.ExampleTypeShape.union(wKQ(e));case"undiscriminatedUnion":return ft.V54.ExampleTypeShape.undiscriminatedUnion(PKQ(e))}}function PKQ(e){return{...e,singleUnionType:roe(e.singleUnionType)}}function wKQ(e){return{...e,singleUnionType:jKQ(e.singleUnionType)}}function jKQ(e){return{...e,shape:EKQ(e.shape)}}function EKQ(e){switch(e.type){case"samePropertiesAsObject":return ft.V54.ExampleSingleUnionTypeProperties.samePropertiesAsObject({...e,object:SKQ(e.object)});case"singleProperty":return ft.V54.ExampleSingleUnionTypeProperties.singleProperty({...e,shape:PQ_(e.shape)});case"noProperties":return ft.V54.ExampleSingleUnionTypeProperties.noProperties()}}function SKQ(e){return{...e,properties:e.properties.map(t=>pUE(t))}}function pUE(e){return{...e,value:{...e.value,shape:PQ_(e.value.shape)}}}function iUE(e){return{...e,rootPathParameters:e.rootPathParameters.map(t=>f0l(t)),servicePathParameters:e.servicePathParameters.map(t=>f0l(t)),endpointPathParameters:e.endpointPathParameters.map(t=>f0l(t)),serviceHeaders:e.serviceHeaders.map(t=>mQ_(t)),endpointHeaders:e.endpointHeaders.map(t=>mQ_(t)),queryParameters:e.queryParameters.map(t=>lUE(t)),request:e.request!=null?IKQ(e.request):void 0,response:DKQ(e.response)}}function DKQ(e){switch(e.type){case"error":return ft.V54.ExampleResponse.error({...e,body:e.body!=null?roe(e.body):void 0});case"ok":return ft.V54.ExampleResponse.ok(CKQ(e))}}function CKQ(e){switch(e.value.type){case"body":return ft.V54.ExampleEndpointSuccessResponse.body(e.value.value!=null?roe(e.value.value):void 0);case"stream":return ft.V54.ExampleEndpointSuccessResponse.stream(e.value.value.map(t=>roe(t)));case"sse":return ft.V54.ExampleEndpointSuccessResponse.sse(e.value.value.map(t=>({...t,data:roe(t.data)})))}}function IKQ(e){switch(e.type){case"inlinedRequestBody":return ft.V54.ExampleRequestBody.inlinedRequestBody(fUE(e));case"reference":return ft.V54.ExampleRequestBody.reference(roe(e))}}function MKQ(e){return{...e,types:yg(e.types,t=>BKQ(t)),endpoints:yg(e.endpoints,t=>TKQ(t)),headers:e.headers?.map(t=>eDr(t))}}function BKQ(e){switch(e.type){case"alias":return ft.V54.dynamic.NamedType.alias({...e,typeReference:pct(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=>eDr(t))});case"discriminatedUnion":return ft.V54.dynamic.NamedType.discriminatedUnion({...e,types:Object.fromEntries(Object.entries(e.types).map(([t,r])=>[t,RKQ(r)]))});case"undiscriminatedUnion":return ft.V54.dynamic.NamedType.undiscriminatedUnion({...e,types:e.types.map(t=>pct(t))});default:tc(e)}}function TKQ(e){return{...e,auth:e.auth!=null?qKQ(e.auth):void 0,request:NKQ(e.request)}}function qKQ(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:eDr(e.header)})}}function pct(e){switch(e.type){case"list":return ft.V54.dynamic.TypeReference.list(pct(e.value));case"optional":return GKQ(e.value);case"nullable":return HKQ(e.value);case"map":return ft.V54.dynamic.TypeReference.map({...e,key:pct(e.key),value:pct(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(pct(e.value));case"unknown":return ft.V54.dynamic.TypeReference.unknown();default:tc(e)}}function RKQ(e){switch(e.type){case"samePropertiesAsObject":return ft.V54.dynamic.SingleDiscriminatedUnionType.samePropertiesAsObject({...e,properties:e.properties.map(t=>eDr(t))});case"singleProperty":return ft.V54.dynamic.SingleDiscriminatedUnionType.singleProperty({...e,typeReference:pct(e.typeReference),properties:e.properties?.map(t=>eDr(t))});case"noProperties":return ft.V54.dynamic.SingleDiscriminatedUnionType.noProperties({...e,properties:e.properties?.map(t=>eDr(t))});default:tc(e)}}function eDr(e){return{...e,typeReference:pct(e.typeReference)}}function NKQ(e){switch(e.type){case"body":return ft.V54.dynamic.Request.body(FKQ(e));case"inlined":return ft.V54.dynamic.Request.inlined(xKQ(e));default:tc(e)}}function FKQ(e){return{pathParameters:e.pathParameters?.map(t=>eDr(t)),body:e.body!=null?_UE(e.body):void 0}}function xKQ(e){return{...e,pathParameters:e.pathParameters?.map(t=>eDr(t)),queryParameters:e.queryParameters?.map(t=>eDr(t)),headers:e.headers?.map(t=>eDr(t)),body:e.body!=null?zKQ(e.body):void 0}}function zKQ(e){switch(e.type){case"properties":return ft.V54.dynamic.InlinedRequestBody.properties(e.value.map(t=>eDr(t)));case"referenced":return ft.V54.dynamic.InlinedRequestBody.referenced(QKQ(e));case"fileUpload":return ft.V54.dynamic.InlinedRequestBody.fileUpload(LKQ(e));default:tc(e)}}function QKQ(e){return{...e,bodyType:_UE(e.bodyType)}}function _UE(e){switch(e.type){case"bytes":return ft.V54.dynamic.ReferencedRequestBodyType.bytes();case"typeReference":return ft.V54.dynamic.ReferencedRequestBodyType.typeReference(pct(e.value));default:tc(e)}}function LKQ(e){return{properties:e.properties.map(t=>UKQ(t))}}function UKQ(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(eDr(e));default:tc(e)}}function VKQ(e){return e.type==="container"&&e.container.type==="nullable"?ft.V54.types.TypeReference.container(ft.V54.types.ContainerType.optional(kT(e.container.nullable))):ft.V54.types.TypeReference.container(ft.V54.types.ContainerType.optional(kT(e)))}function WKQ(e){return e.type==="container"&&e.container.type==="optional"?kT(e):ft.V54.types.TypeReference.container(ft.V54.types.ContainerType.optional(kT(e)))}function HKQ(e){return e.type==="optional"?pct(e):ft.V54.dynamic.TypeReference.optional(pct(e))}function GKQ(e){return e.type==="nullable"?ft.V54.dynamic.TypeReference.optional(pct(e.value)):ft.V54.dynamic.TypeReference.optional(pct(e))}var hUE={laterVersion:"v56",earlierVersion:"v55",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.PYTHON_SDK]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:"0.0.2",[me.CSHARP_SDK]:"1.12.0-rc0",[me.SWIFT_MODEL]:zt,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:zt,[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V55.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:yg(e.services,t=>JKQ(t))})};function JKQ(e){return{...e,endpoints:e.endpoints.map(t=>KKQ(t))}}function KKQ(e){return{...e,pagination:$KQ(e.pagination)}}function $KQ(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:tc(e)}}var yUE={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]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:"1.8.0",[me.JAVA_SDK]:"2.34.0",[me.JAVA_SPRING]:"1.6.0",[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.PYTHON_FASTAPI]:"1.6.3",[me.PYTHON_PYDANTIC]:"1.4.8",[me.PYTHON_SDK]:"4.3.19",[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.GO_FIBER]:"0.23.6",[me.GO_MODEL]:"0.23.6",[me.GO_SDK]:"0.37.0",[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:"1.12.0-rc11",[me.SWIFT_MODEL]:zt,[me.SWIFT_SDK]:Xn,[me.PHP_MODEL]:Xn,[me.PHP_SDK]:"0.14.1",[me.RUST_MODEL]:Xn,[me.RUST_SDK]:Xn},jsonifyEarlierVersion:e=>Om.V56.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,dynamic:e.dynamic!=null?YKQ(e.dynamic):void 0})};function YKQ(e){return{...e,endpoints:XKQ(e.endpoints)}}function XKQ(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,ZKQ(r)]).filter(([t,r])=>r!=null))}function ZKQ(e){return{...e,auth:e.auth!=null?t$Q(e.auth):void 0,examples:e.examples!=null?kKQ(e.examples):void 0}}function kKQ(e){return e.map(t=>e$Q(t)).filter(t=>t!=null)}function e$Q(e){return{...e,auth:e.auth!=null?r$Q(e.auth):void 0}}function t$Q(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:tc(e)}}function r$Q(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:tc(e)}}var bUE={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]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:"2.36.5",[me.JAVA_SPRING]:"1.6.1",[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.PYTHON_FASTAPI]:"1.7.0",[me.PYTHON_PYDANTIC]:"1.5.0",[me.PYTHON_SDK]:"4.21.0",[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:"1.1.0",[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:"1.17.5",[me.SWIFT_MODEL]:zt,[me.SWIFT_SDK]:"0.1.0",[me.PHP_MODEL]:zt,[me.PHP_SDK]:"1.15.1",[me.RUST_MODEL]:zt,[me.RUST_SDK]:"0.0.0"},jsonifyEarlierVersion:e=>Om.V57.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,publishConfig:e.publishConfig!=null?d$Q(e.publishConfig):void 0,services:n$Q(e.services),dynamic:e.dynamic!=null?u$Q(e.dynamic):void 0})};function n$Q(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,i$Q(r)]))}function i$Q(e){return{...e,endpoints:a$Q(e.endpoints)}}function a$Q(e){return e.map(o$Q).filter(t=>t!=null)}function o$Q(e){if(e.method!=="HEAD")return{...e,method:e.method}}function u$Q(e){return{...e,endpoints:s$Q(e.endpoints)}}function s$Q(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,c$Q(r)]).filter(([t,r])=>r!=null))}function c$Q(e){let t=e.location.method;if(t!=="HEAD")return{...e,examples:e.examples!=null?l$Q(e.examples):void 0,location:{...e.location,method:t}}}function l$Q(e){return e.map(t=>f$Q(t)).filter(t=>t!=null)}function f$Q(e){let t=e.endpoint.method;if(t!=="HEAD")return{...e,endpoint:{...e.endpoint,method:t}}}function d$Q(e){switch(e.type){case"github":{let t=vUE(e.target);return t==null?void 0:ft.V57.publish.PublishingConfig.github({...e,target:t})}case"direct":{let t=vUE(e.target);return t==null?void 0:ft.V57.publish.PublishingConfig.direct({target:t})}case"filesystem":return;default:tc(e)}}function vUE(e){switch(e.type){case"postman":return ft.V57.publish.PublishTarget.postman(e);case"npm":return ft.V57.publish.PublishTarget.npm(e);case"maven":return ft.V57.publish.PublishTarget.maven(e);case"pypi":return;default:tc(e)}}var gUE={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]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:"1.8.1",[me.JAVA_SDK]:"2.43.0",[me.JAVA_SPRING]:"1.8.2",[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.PYTHON_FASTAPI]:"1.8.0",[me.PYTHON_PYDANTIC]:"1.6.0",[me.PYTHON_SDK]:"4.26.0",[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.GO_FIBER]:"0.23.7",[me.GO_MODEL]:"0.23.7",[me.GO_SDK]:"1.7.0",[me.RUBY_MODEL]:zt,[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]:zt,[me.PHP_SDK]:"1.17.0",[me.RUST_MODEL]:zt,[me.RUST_SDK]:"0.1.1"},jsonifyEarlierVersion:e=>Om.V58.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,dynamic:e.dynamic!=null?_$Q(e.dynamic):void 0,auth:e.auth!=null?p$Q(e.auth):void 0})};function p$Q(e){return{...e,schemes:e.schemes.filter(t=>t.type!=="inferred")}}function _$Q(e){return{...e,endpoints:h$Q(e.endpoints)}}function h$Q(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,y$Q(r)]).filter(([t,r])=>r!=null))}function y$Q(e){return{...e,examples:e.examples!=null?b$Q(e.examples):void 0,auth:v$Q(e.auth)}}function v$Q(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 b$Q(e){return e.map(t=>g$Q(t)).filter(t=>t!=null)}function g$Q(e){return{...e,auth:m$Q(e.auth)}}function m$Q(e){if(e==null)return e;if(e.type!=="inferred")return e}var mUE={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]:"0.18.6",[me.JAVA]:zt,[me.JAVA_MODEL]:"1.8.2",[me.JAVA_SDK]:"3.5.10",[me.JAVA_SPRING]:"1.8.3",[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.PYTHON_FASTAPI]:"1.9.0",[me.PYTHON_PYDANTIC]:"1.7.0",[me.PYTHON_SDK]:"4.30.0",[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.GO_FIBER]:"0.23.8",[me.GO_MODEL]:"0.23.8",[me.GO_SDK]:"1.12.4",[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:zt,[me.CSHARP_SDK]:zt,[me.SWIFT_MODEL]:zt,[me.SWIFT_SDK]:zt,[me.PHP_MODEL]:zt,[me.PHP_SDK]:zt,[me.RUST_MODEL]:zt,[me.RUST_SDK]:zt},jsonifyEarlierVersion:e=>Om.V59.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,services:P$Q(e.services),auth:O$Q(e.auth)})};function O$Q(e){return{...e,schemes:A$Q(e.schemes)}}function A$Q(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:i8a(t.configuration.refreshEndpoint.responseProperties.accessToken),expiresIn:Lqo(t.configuration.refreshEndpoint.responseProperties.expiresIn),refreshToken:Lqo(t.configuration.refreshEndpoint.responseProperties.refreshToken)},requestProperties:{refreshToken:Uqo(t.configuration.refreshEndpoint.requestProperties.refreshToken)}}:void 0,tokenEndpoint:{...t.configuration.tokenEndpoint,responseProperties:{accessToken:i8a(t.configuration.tokenEndpoint.responseProperties.accessToken),expiresIn:Lqo(t.configuration.tokenEndpoint.responseProperties.expiresIn),refreshToken:Lqo(t.configuration.tokenEndpoint.responseProperties.refreshToken)},requestProperties:{clientId:Uqo(t.configuration.tokenEndpoint.requestProperties.clientId),clientSecret:Uqo(t.configuration.tokenEndpoint.requestProperties.clientSecret),scopes:wQ_(t.configuration.tokenEndpoint.requestProperties.scopes),customProperties:t.configuration.tokenEndpoint.requestProperties.customProperties?.map(Uqo)}}})});default:tc(t.configuration.type)}break;case"inferred":return ft.V59.AuthScheme.inferred({...t,tokenEndpoint:{...t.tokenEndpoint,expiryProperty:Lqo(t.tokenEndpoint.expiryProperty),authenticatedRequestHeaders:t.tokenEndpoint.authenticatedRequestHeaders.map(r=>({...r,responseProperty:i8a(r.responseProperty)}))}});default:tc(t)}})}function P$Q(e){return Object.entries(e).reduce((t,[r,n])=>(t[r]={...n,endpoints:w$Q(n.endpoints)},t),{})}function w$Q(e){return e.map(t=>({...t,pagination:j$Q(t.pagination),sdkRequest:E$Q(t.sdkRequest)}))}function j$Q(e){if(!e)return e;switch(e.type){case"cursor":return ft.V59.Pagination.cursor({next:i8a(e.next),results:i8a(e.results),page:Uqo(e.page)});case"offset":return ft.V59.Pagination.offset({hasNextPage:Lqo(e.hasNextPage),results:i8a(e.results),page:Uqo(e.page),step:wQ_(e.step)});case"custom":return ft.V59.Pagination.custom({results:i8a(e.results)});default:tc(e)}}function wQ_(e){if(e)return{propertyPath:e.propertyPath?.map(t=>t.name),property:e.property}}function Uqo(e){return{propertyPath:e.propertyPath?.map(t=>t.name),property:e.property}}function Lqo(e){if(e)return{propertyPath:e.propertyPath?.map(t=>t.name),property:e.property}}function i8a(e){return{propertyPath:e.propertyPath?.map(t=>t.name),property:e.property}}function E$Q(e){return e&&{...e,streamParameter:wQ_(e.streamParameter)}}var OUE={laterVersion:"v61",earlierVersion:"v60",firstGeneratorVersionToConsumeNewIR:{[me.TYPESCRIPT_NODE_SDK]:zt,[me.TYPESCRIPT_BROWSER_SDK]:zt,[me.TYPESCRIPT]:zt,[me.TYPESCRIPT_SDK]:zt,[me.TYPESCRIPT_EXPRESS]:zt,[me.JAVA]:zt,[me.JAVA_MODEL]:zt,[me.JAVA_SDK]:zt,[me.JAVA_SPRING]:zt,[me.OPENAPI_PYTHON_CLIENT]:zt,[me.OPENAPI]:zt,[me.PYTHON_FASTAPI]:zt,[me.PYTHON_PYDANTIC]:zt,[me.PYTHON_SDK]:zt,[me.STOPLIGHT]:zt,[me.POSTMAN]:zt,[me.GO_FIBER]:zt,[me.GO_MODEL]:zt,[me.GO_SDK]:zt,[me.RUBY_MODEL]:zt,[me.RUBY_SDK]:zt,[me.CSHARP_MODEL]:"0.0.4",[me.CSHARP_SDK]:"2.4.0",[me.SWIFT_MODEL]:zt,[me.SWIFT_SDK]:zt,[me.PHP_MODEL]:zt,[me.PHP_SDK]:zt,[me.RUST_MODEL]:zt,[me.RUST_SDK]:zt},jsonifyEarlierVersion:e=>Om.V60.IntermediateRepresentation.jsonOrThrow(e,{unrecognizedObjectKeys:"strip",skipValidation:!0}),migrateBackwards:e=>({...e,dynamic:e.dynamic!=null?S$Q(e.dynamic):void 0})};function S$Q(e){return{...e,endpoints:D$Q(e.endpoints)}}function D$Q(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,C$Q(r)]).filter(([t,r])=>r!=null))}function C$Q(e){return{...e,response:I$Q(e.response)}}function I$Q(e){return ft.V61.dynamic.Response._visit(e,{json:ft.V60.dynamic.Response.json,streaming:ft.V60.dynamic.Response.json,streamParameter:ft.V60.dynamic.Response.json,fileDownload:ft.V60.dynamic.Response.json,text:ft.V60.dynamic.Response.json,bytes:ft.V60.dynamic.Response.json,_other:ft.V60.dynamic.Response.json})}function BFu(){return B$Q}var d0l=class{migrations;constructor(t){this.migrations=t}withMigration(t){return new jQ_([...this.migrations,t])}},jQ_=class extends d0l{build(){return new EQ_(this.migrations)}},EQ_=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(()=>Z0.IntermediateRepresentation.jsonOrThrow(r,{unrecognizedObjectKeys:"strip"}))};let c=this.migrate({intermediateRepresentation:r,shouldMigrate:d=>{let s=d.earlierVersion===t;return a||=s,s||!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()=>Z0.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 zt:return!0;case Xn:throw new Error(`Cannot migrate intermediate representation. Generator was created after intermediate representation ${t.laterVersion}.`)}return i3e(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}},M$Q={Builder:new d0l([])},B$Q=M$Q.Builder.withMigration(OUE).withMigration(mUE).withMigration(gUE).withMigration(bUE).withMigration(yUE).withMigration(hUE).withMigration(aUE).withMigration(rUE).withMigration(GLE).withMigration(qLE).withMigration(SLE).withMigration(OLE).withMigration(mLE).withMigration(bLE).withMigration(vLE).withMigration(_LE).withMigration(fLE).withMigration(lLE).withMigration(sLE).withMigration(uLE).withMigration(oLE).withMigration(aLE).withMigration(iLE).withMigration(nLE).withMigration(rLE).withMigration(tLE).withMigration(eLE).withMigration(kQE).withMigration(ZQE).withMigration(YQE).withMigration(KQE).withMigration(JQE).withMigration(GQE).withMigration(zQE).withMigration(xQE).withMigration(FQE).withMigration(RQE).withMigration(qQE).withMigration(gOw).withMigration(yOw).withMigration(hOw).withMigration(dOw).withMigration(lOw).withMigration(sOw).withMigration(uOw).withMigration(oOw).withMigration(nOw).withMigration(eOw).withMigration(kmw).withMigration(Zmw).withMigration(Ymw).withMigration($mw).withMigration(Kmw).withMigration(Wmw).withMigration(Lmw).withMigration(Qmw).withMigration(zmw).withMigration(jmw).withMigration(Amw).withMigration(Isb).build();function TFu({intermediateRepresentation:e,context:t,targetGenerator:r}){return BFu().migrateForGenerator({intermediateRepresentation:e,context:t,targetGenerator:r}).jsonify()}function SQ_({intermediateRepresentation:e,context:t,targetGenerator:r,irVersion:n}){return BFu().migrateThroughVersion({version:n,intermediateRepresentation:e,context:t,targetGenerator:r}).jsonify()}function qFu({intermediateRepresentation:e,context:t,version:r}){return BFu().migrateThroughVersion({version:r,intermediateRepresentation:e,context:t}).jsonify()}async function AUE({workspace:e,audiences:t,generatorInvocation:r,context:n,irVersionOverride:i,version:a,packageName:o,sourceConfig:c,includeOptionalRequestPropertyExamples:d,ir:s}){let u=s??qH({workspace:e,audiences:t,generationLanguage:r.language,keywords:r.keywords,smartCasing:r.smartCasing,exampleGeneration:{includeOptionalRequestPropertyExamples:d,disabled:r.disableExamples},readme:r.readme,version:a,packageName:o,context:n,sourceResolver:new BH(n,e)});c!=null&&(u.sourceConfig=c),n.logger.debug("Generated IR");let l=i!=null?await qFu({intermediateRepresentation:u,context:n,version:i}):await TFu({intermediateRepresentation:u,context:n,targetGenerator:{name:r.name,version:r.version}});return{latest:u,migrated:l}}var PUE=fa(UHs(),1),mke=require("fs/promises"),wUE=fa(OCe(),1),p0l=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 Tv(this.absolutePathToTmpSnippetJSON)&&await this.copySnippetJSON({absolutePathToTmpSnippetJSON:this.absolutePathToTmpSnippetJSON,absolutePathToLocalSnippetJSON:this.absolutePathToLocalSnippetJSON}),this.absolutePathToTmpSnippetTemplatesJSON!=null&&this.absolutePathToLocalSnippetTemplateJSON!=null&&await Tv(this.absolutePathToTmpSnippetTemplatesJSON)&&await this.copySnippetJSON({absolutePathToTmpSnippetJSON:this.absolutePathToTmpSnippetTemplatesJSON,absolutePathToLocalSnippetJSON:this.absolutePathToLocalSnippetTemplateJSON})}async isFernIgnorePresent(){let t=x_.of(Jl(this.absolutePathToLocalOutput,ys.of(Ers)));return await Tv(t)}async copyGeneratedFilesWithFernIgnore(){let t=x_.of((await wUE.default.dir({})).path),r=x_.of(Jl(this.absolutePathToLocalOutput,ys.of(Ers))),n=await q$Q({absolutePathToFernignore:r});await(0,mke.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,mke.rm)(Jl(t,ys.of(".git")),{recursive:!0}),await(0,mke.rm)(this.absolutePathToLocalOutput,{recursive:!0}),await(0,mke.cp)(t,this.absolutePathToLocalOutput,{recursive:!0})}async copyGeneratedFilesNoFernIgnore(){this.context.logger.debug(`rm -rf ${this.absolutePathToLocalOutput}`),await(0,mke.rm)(this.absolutePathToLocalOutput,{force:!0,recursive:!0}),await this.copyGeneratedFilesToDirectory(this.absolutePathToLocalOutput)}async copyGeneratedFilesToDirectory(t){let[r,...n]=await(0,mke.readdir)(this.absolutePathToTmpOutputDirectory);if(r!=null)if(this.context.logger.debug(`Copying generated files to ${t}`),r.endsWith(".zip")){await(0,PUE.default)(Jl(this.absolutePathToTmpOutputDirectory,ys.of(r)),t);for(let i of n)await(0,mke.cp)(Jl(this.absolutePathToTmpOutputDirectory,ys.of(i)),Jl(t,ys.of(i)),{recursive:!0})}else await(0,mke.cp)(this.absolutePathToTmpOutputDirectory,t,{recursive:!0})}async copySnippetJSON({absolutePathToTmpSnippetJSON:t,absolutePathToLocalSnippetJSON:r}){this.context.logger.debug(`Copying generated snippets to ${r}`),await(0,mke.cp)(t,r)}async runGitCommand(t,r){return(await MH(this.context.logger,"git",t,{cwd:r,doNotPipeOutput:!0})).stdout}},T$Q=/\r?\n/;async function q$Q({absolutePathToFernignore:e}){let t=(await(0,mke.readFile)(e)).toString();return[Ers,...t.trim().split(T$Q).map(r=>{let n=r.indexOf("#");return n!==-1?r.slice(0,n).trim():r.trim()}).filter(r=>r.length>0)]}function R$Q(e,t){let r=F$f(e);if(r?.type==="custom"){let n=r.value,i=t?Wqo.dirname(t):process.cwd(),a=Wqo.isAbsolute(n)?n:Wqo.resolve(i,n);return x_.of(a)}}async function SUE({organization:e,absolutePathToFernConfig:t,workspace:r,generatorInvocation:n,absolutePathToLocalOutput:i,absolutePathToLocalSnippetJSON:a,absolutePathToLocalSnippetTemplateJSON:o,audiences:c,version:d,workspaceTempDir:s,keepDocker:u,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 AUE({workspace:r,audiences:c,generatorInvocation:n,context:l,irVersionOverride:m,packageName:GP.getPackageName({generatorInvocation:n}),version:d??A,sourceConfig:F$Q(r),includeOptionalRequestPropertyExamples:T,ir:V}),Y=await N$Q({workspaceTempDir:s,filename:bKf,context:l,ir:re});l.logger.debug("Wrote IR to: "+Y);let te=(0,Vqo.join)(s.path,vKf),ne=x_.of(te);await(0,a8a.writeFile)(te,""),l.logger.debug("Will write config.json to: "+ne);let Oe=(0,Vqo.join)(s.path,yKf),ge=x_.of(Oe);await(0,a8a.mkdir)(Oe,{recursive:!0}),l.logger.debug("Will write output to: "+ge);let ve;if(a!=null){let De=(0,Vqo.join)(s.path,"snippet.json");ve=x_.of(De),await(0,a8a.writeFile)(De,""),l.logger.debug("Will write snippet.json to: "+ve)}let be;if(o!=null){let De=(0,Vqo.join)(s.path,pfh);be=x_.of(De),await(0,a8a.writeFile)(De,""),l.logger.debug("Will write snippet-templates.json to: "+be)}let Me=U??new _au({dockerImage:`${n.name}:${n.version}`,keepDocker:u}),Se=Me instanceof _au?{outputDirectory:x_.of(ZGs),irPath:x_.of(kGs),configPath:x_.of(pau),snippetPath:x_.of(eJs),snippetTemplatePath:x_.of(tJs)}:{outputDirectory:ge,configPath:ne,irPath:Y,snippetPath:ve,snippetTemplatePath:be},St=Csb({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});await(0,a8a.writeFile)(ne,JSON.stringify(await jUE.GeneratorConfig.jsonOrThrow(St),void 0,4));let yt=R$Q(n,t);return await Me.execute({generatorName:n.name,irPath:Y,configPath:ne,outputPath:ge,snippetPath:ve,snippetTemplatePath:be,licenseFilePath:yt,context:l,inspect:z,runner:R}),await new p0l({context:l,absolutePathToLocalOutput:i,absolutePathToTmpOutputDirectory:ge,absolutePathToLocalSnippetJSON:a,absolutePathToLocalSnippetTemplateJSON:o,absolutePathToTmpSnippetJSON:ve,absolutePathToTmpSnippetTemplatesJSON:be}).copyGeneratedFiles(),{ir:$,generatorConfig:St}}async function N$Q({ir:e,workspaceTempDir:t,filename:r,context:n}){n.logger.debug("Migrated IR");let i;if(r)i=x_.of((0,Vqo.join)(t.path,r));else{let a=await EUE.default.file({tmpdir:t.path});i=x_.of(a.path)}return await mCe(i,e,{pretty:!1}),n.logger.debug(`Wrote IR to ${i}`),i}function F$Q(e){return{sources:e.getSources().map(t=>t.type==="protobuf"?sxe.proto({id:t.id,protoRootUrl:`file:///${x$Q(t)}`}):sxe.openapi())}}function x$Q(e){return`${urb}/${e.id}`}var DQ_=fa(require("os"),1),DUE=fa(require("path"),1),CUE=fa(OCe(),1);async function IUE({token:e,projectConfig:t,workspace:r,generatorGroup:n,version:i,keepDocker:a,inspect:o,context:c,runner:d}){(await Promise.all(n.generators.map(async u=>c.runInteractiveTask({name:u.name},async l=>{u=($=>xxi($,{onError:re=>l.failAndThrow(re)}))(u);let A=await r.toFernWorkspace({context:c},Mio(u)),P=qH({workspace:A,audiences:n.audiences,generationLanguage:u.language,keywords:u.keywords,smartCasing:u.smartCasing,exampleGeneration:{includeOptionalRequestPropertyExamples:!1,disabled:u.disableExamples},readme:u.readme,version:i,packageName:GP.getPackageName({generatorInvocation:u}),context:c,sourceResolver:new BH(c,A)}),C=UCe({token:e?.value});if(u.absolutePathToLocalOutput==null&&(e=await xYa(),e==null)){l.failWithoutThrowing("Please provide a FERN_TOKEN in your environment.");return}let M=await C.organization.get(nR.OrganizationId(t.organization));if(u.absolutePathToLocalOutput==null&&!M.ok){l.failWithoutThrowing(`Failed to load details for organization ${t.organization}.`);return}M.ok&&(M.body.selfHostedSdKs&&(P.selfHosted=!0),M.body.isWhitelabled&&(P.readmeConfig==null&&(P.readmeConfig=W$Q),P.readmeConfig.whiteLabel=!0));let T=z$Q(u),z=L$Q({generatorInvocation:u,org:M.ok?M.body:void 0,version:i,packageName:T,context:l});z!=null&&(P.publishConfig=z);let U=u.absolutePathToLocalOutput??Jl(r.absoluteFilePath,ys.of("sdks"),ys.of(u.language??u.name)),R=u.raw?.snippets?.path!=null?x_.of(Jl(r.absoluteFilePath,ys.of(u.raw.snippets.path))):void 0,V=await Q$Q();await SUE({organization:t.organization,absolutePathToFernConfig:t._absolutePath,workspace:A,generatorInvocation:u,absolutePathToLocalOutput:U,absolutePathToLocalSnippetJSON:R,absolutePathToLocalSnippetTemplateJSON:void 0,version:i,audiences:n.audiences,workspaceTempDir:V,keepDocker:a,context:l,irVersionOverride:u.irVersionOverride,outputVersionOverride:void 0,writeUnitTests:M.ok?M?.body.snippetUnitTestsEnabled??!1:!1,generateOauthClients:M.ok?M?.body.oauthClientEnabled??!1:!1,generatePaginatedClients:M.ok?M?.body.paginationEnabled??!1:!1,includeOptionalRequestPropertyExamples:!1,inspect:o,executionEnvironment:void 0,ir:P,runner:d}),l.logger.info(bd.green("Wrote files to "+U))})))).some(u=>!u)&&c.failAndThrow()}function z$Q(e){return typeof e.raw?.config=="object"&&e.raw?.config!==null?e.raw.config.package_name:void 0}async function Q$Q(){return CUE.default.dir({tmpdir:DQ_.default.platform()==="darwin"?DUE.default.join("/private",DQ_.default.tmpdir()):void 0,prefix:"fern"})}function L$Q({generatorInvocation:e,org:t,version:r,packageName:n,context:i}){if(e.raw?.github!=null&&V$Q(e.raw.github)){let[a,o]=e.raw.github.uri.split("/");return a==null||o==null?i.failAndThrow(`Invalid GitHub repository URI: ${e.raw.github.uri}. Expected format: owner/repo`):Jd.PublishingConfig.github({owner:a,repo:o,uri:e.raw.github.uri,token:e.raw.github.token,mode:e.raw.github.mode,target:U$Q({outputSchema:e.raw.output,version:r,packageName:n})})}if(e.raw?.output?.location==="local-file-system"){let a;if(e.language==="python")a=pde.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 s=o;if(typeof s.group=="string"&&typeof s.artifact=="string")return{groupId:s.group,artifactId:s.artifact};if(typeof s["package-prefix"]=="string"&&n)return{groupId:s["package-prefix"],artifactId:n};typeof s["package-prefix"]=="string"&&!n&&i.logger.warn("Java generator has package-prefix configured but packageName is missing")})(),d=c?`${c.groupId}:${c.artifactId}`:void 0;if(d){let s=r??"0.0.0";a=pde.maven({coordinate:d,version:s,usernameEnvironmentVariable:"MAVEN_USERNAME",passwordEnvironmentVariable:"MAVEN_PASSWORD",mavenUrlEnvironmentVariable:"MAVEN_PUBLISH_REGISTRY_URL"}),i.logger.debug(`Created MavenPublishTarget: coordinate ${d} version ${s}`)}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 Jd.PublishingConfig.filesystem({generateFullProject:t?.selfHostedSdKs??!1,publishTarget:a})}return e.outputMode._visit({downloadFiles:()=>Jd.PublishingConfig.filesystem({generateFullProject:t?.selfHostedSdKs??!1,publishTarget:void 0}),github:()=>{},githubV2:()=>{},publish:()=>{},publishV2:()=>{},_other:()=>{}})}function U$Q({outputSchema:e,version:t,packageName:r}){let n=Jd.PublishTarget.postman({apiKey:"",workspaceId:"",collectionId:void 0});return e==null?n:e.location==="npm"?pde.npm({packageName:e["package-name"],version:t??"0.0.0",tokenEnvironmentVariable:e.token||"NPM_TOKEN"}):e.location==="maven"?pde.maven({version:t??"0.0.0",coordinate:e.coordinate,usernameEnvironmentVariable:e.username||"MAVEN_USERNAME",passwordEnvironmentVariable:e.password||"MAVEN_PASSWORD",mavenUrlEnvironmentVariable:e.url||"MAVEN_PUBLISH_REGISTRY_URL"}):e.location==="pypi"?pde.pypi({version:t,packageName:r}):n}function V$Q(e){return e==null?!1:"uri"in e&&"token"in e}var W$Q={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 O0l=fa(h6i(),1);var MUE=require("fs"),_0l=require("fs/promises"),BUE=require("stream/promises");async function TUE({snippetsS3PreSignedReadUrl:e,absolutePathToLocalSnippetJSON:t,context:r}){try{await H$Q({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}),r.logger.info(bd.green(`Downloaded to ${t}`))}catch{r.logger.debug(bd.yellow("Failed to download snippet.json from output."))}}async function H$Q({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await tZ.get(e,{responseType:"stream"});await Tv(t)&&await(0,_0l.rm)(t,{recursive:!0}),await(0,_0l.mkdir)(Ug(t),{recursive:!0}),await(0,BUE.pipeline)(r.data,(0,MUE.createWriteStream)(t))}var MQ_=fa(lnt(),1);var Hqo=fa(h6i(),1);var qUE=fa(E1s(),1),Oke=require("fs/promises");var RUE=require("path"),NUE=fa(i7s(),1),FUE=fa(OCe(),1);uI();async function xUE({projectConfig:e,workspace:t,organization:r,intermediateRepresentation:n,generatorInvocation:i,version:a,context:o,shouldLogS3Url:c,token:d,whitelabel:s,irVersionOverride:u,absolutePathToPreview:l}){let m=await G$Q({projectConfig:e,workspace:t,organization:r,generatorInvocation:i,version:a,context:o,shouldLogS3Url:c,token:d,whitelabel:s,absolutePathToPreview:l});return await J$Q({intermediateRepresentation:n,job:m,context:o,generatorInvocation:i,irVersionOverride:u}),m}async function G$Q({projectConfig:e,workspace:t,organization:r,generatorInvocation:n,version:i,context:a,shouldLogS3Url:o,token:c,whitelabel:d,absolutePathToPreview:s}){let u=$Oi({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 FUE.default.dir(),C=x_.of(P.path);a.logger.debug(`Writing mock fern definition to ${C}`);let M=Jl(C,ys.of(kve)),T=Jl(M,ys.of(oie));await(0,Oke.mkdir)(T,{recursive:!0});let z=Jl(T,ys.of(aee));await(0,Oke.writeFile)(z,Vg.dump(t.definition.rootApiFile.contents)),await zUE({absolutePathToDefinitionDirectory:T,definition:t.definition});let U=Jl(M,ys.of(vFe));await(0,Oke.writeFile)(U,JSON.stringify(e.rawConfig,void 0,2));try{let $=t.getSources();for(let re of $){let Y=await(0,Oke.readFile)(re.absoluteFilePath),te=(0,RUE.relative)(t.absoluteFilePath,re.absoluteFilePath),ne=Jl(M,ys.of(te));await(0,Oke.mkdir)(Ug(ne),{recursive:!0}),await(0,Oke.writeFile)(ne,new Uint8Array(Y))}}catch($){a.logger.debug(`Failed to write source files to disk, continuing: ${$}`)}let R=Jl(C,ys.of("definition.tgz"));await(0,NUE.create)({file:R,cwd:M},["."]),a.logger.debug("Getting upload URL for Fern definition.");let V=await u.remoteGen.getDefinitionUploadUrl({apiName:t.definition.rootApiFile.contents.name,organizationName:r,version:i});V.ok?(a.logger.debug("Uploading definition..."),await tZ.put(V.body.s3Url,await(0,Oke.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 u.remoteGen.createJobV3({apiName:t.definition.rootApiFile.contents.name,version:i,organizationName:r,generators:[l],uploadToS3:$$Q({outputMode:n.outputMode,generatorInvocation:n,absolutePathToPreview:s,shouldLogS3Url:o}),whitelabel:d,fernDefinitionMetadata:m,preview:s!=null});return A.ok?A.body:K$Q(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 zUE({absolutePathToDefinitionDirectory:e,definition:t}){for(let[r,n]of Object.entries(t.namedDefinitionFiles)){let i=Jl(e,ys.of(r));await(0,Oke.mkdir)(Ug(i),{recursive:!0}),await(0,Oke.writeFile)(i,Vg.dump(n.contents))}for(let[r,n]of Object.entries(t.packageMarkers))if(n.contents.export==null){let i=Jl(e,ys.of(r));await(0,Oke.mkdir)(Ug(i),{recursive:!0}),await(0,Oke.writeFile)(i,Vg.dump(n.contents))}for(let[r,n]of Object.entries(t.importedDefinitions))await zUE({absolutePathToDefinitionDirectory:Jl(e,ys.of(r)),definition:n.definition})}async function J$Q({intermediateRepresentation:e,generatorInvocation:t,job:r,context:n,irVersionOverride:i}){let a=i==null?await TFu({intermediateRepresentation:e,context:n,targetGenerator:{name:t.name,version:t.version}}):await SQ_({intermediateRepresentation:e,context:n,irVersion:i,targetGenerator:{name:t.name,version:t.version}}),o=new qUE.default,c=await YZl(a,{onWrite:s=>{n.logger.debug("Wrote IR to disk: "+s)}});o.append("file",c);let d=jD(ycf(),`/api/remote-gen/jobs/${r.jobId}/start`);try{await tZ.post(d,o,{headers:o.getHeaders(),maxBodyLength:1/0})}catch(s){let u=s instanceof XPy?s.response?.data:s;n.logger.debug(`POST ${d} failed with ${JSON.stringify(s)}`),n.failAndThrow("Failed to start job",u)}}function K$Q(e){if(e?.reason==="status-code"){let t=e.body;switch(t?._error){case"IllegalApiNameError":return Hqo.FernFiddle.remoteGen.createJobV3.Error.illegalApiNameError();case"GeneratorsDoNotExistError":return Hqo.FernFiddle.remoteGen.createJobV3.Error.generatorsDoNotExistError(t.body);case"CannotPublishToNpmScope":return Hqo.FernFiddle.remoteGen.createJobV3.Error.cannotPublishToNpmScope(t.body);case"CannotPublishToMavenScope":return Hqo.FernFiddle.remoteGen.createJobV3.Error.cannotPublishToMavenGroup(t.body);case"InsufficientPermissions":return Hqo.FernFiddle.remoteGen.createJobV3.Error.insufficientPermissions(t.body)}}return e}function $$Q({outputMode:e,generatorInvocation:t,absolutePathToPreview:r,shouldLogS3Url:n}){return e.type==="downloadFiles"||t.absolutePathToLocalSnippets!=null||r!=null||n}function h0l({apiName:e,organization:t,generatorInvocation:r}){let n=Y$Q(r);return{apiName:e,organization:t,customConfig:r.config,outputConfig:n??df.GeneratorOutputConfig.local()}}function Y$Q(e){let t=e.outputMode;switch(t.type){case"downloadFiles":return df.GeneratorOutputConfig.local();case"publishV2":return X$Q({publish:t.publishV2,version:e.version});case"githubV2":return Z$Q({github:t.githubV2,language:e.language,version:e.version});case"publish":case"github":return;default:tc(t)}}function X$Q({publish:e,version:t}){switch(e.type){case"npmOverride":{let r=e.npmOverride;return r==null?void 0:df.GeneratorOutputConfig.publish(df.PublishInfo.npm({version:t,packageName:r.packageName,repoUrl:void 0}))}case"mavenOverride":{let r=e.mavenOverride;return r==null?void 0:df.GeneratorOutputConfig.publish(df.PublishInfo.maven({version:t,coordinate:r.coordinate,repoUrl:void 0}))}case"pypiOverride":{let r=e.pypiOverride;return r==null?void 0:df.GeneratorOutputConfig.publish(df.PublishInfo.pypi({version:t,packageName:r.coordinate,repoUrl:void 0}))}case"rubyGemsOverride":{let r=e.rubyGemsOverride;return r==null?void 0:df.GeneratorOutputConfig.publish(df.PublishInfo.rubygems({version:t,packageName:r.packageName,repoUrl:void 0}))}case"nugetOverride":{let r=e.nugetOverride;return r==null?void 0:df.GeneratorOutputConfig.publish(df.PublishInfo.nuget({version:t,packageName:r.packageName,repoUrl:void 0}))}case"postman":return;default:tc(e)}}function Z$Q({github:e,version:t,language:r}){let n=k$Q({owner:e.owner,repo:e.repo});if(r===GP.GenerationLanguage.GO)return df.GeneratorOutputConfig.publish(df.PublishInfo.go({version:t,repoUrl:n}));let i=e.publishInfo;if(i!=null)switch(i.type){case"maven":return df.GeneratorOutputConfig.publish(df.PublishInfo.maven({version:t,coordinate:i.coordinate,repoUrl:n}));case"npm":return df.GeneratorOutputConfig.publish(df.PublishInfo.npm({version:t,packageName:i.packageName,repoUrl:n}));case"pypi":return df.GeneratorOutputConfig.publish(df.PublishInfo.pypi({version:t,packageName:i.packageName,repoUrl:n}));case"rubygems":return df.GeneratorOutputConfig.publish(df.PublishInfo.rubygems({version:t,packageName:i.packageName,repoUrl:n}));case"nuget":return df.GeneratorOutputConfig.publish(df.PublishInfo.nuget({version:t,packageName:i.packageName,repoUrl:n}));case"postman":return;default:tc(i)}}function k$Q({owner:e,repo:t}){return`https://github.com/${e}/${t}`}var QUE=$Oi();var eYQ=3;function LUE({job:e,taskId:t,taskHandler:r,context:n}){let i=0,a=async()=>{let o=await QUE.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)=>{d();async function d(){try{let s=await a();if(s==null)i++,i===eYQ&&n.failAndThrow(`Failed to get job status after ${i} attempts.`),setTimeout(d,2e3+1e3*i);else{i=0;let u=await r.processUpdate(s);r.isFinished?o(u):setTimeout(d,2e3)}}catch(s){c(s)}}})}var HUE=fa(UHs(),1),GUE=require("fs"),b0l=require("fs/promises"),IQ_=fa(require("path"),1),JUE=require("stream/promises");var y0l=fa(WUE(),1);function mBi(e,t,{target:r="stdout",...n}={}){return y0l.default[r]?Fro.link(e,t):n.fallback===!1?e:typeof n.fallback=="function"?n.fallback(e,t):`${e} (\u200B${t}\u200B)`}mBi.isSupported=y0l.default.stdout;mBi.stderr=(e,t,r={})=>mBi(e,t,{target:"stderr",...r});mBi.stderr.isSupported=y0l.default.stderr;var KUE=fa(OCe(),1),v0l=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(`
|
|
3036
3036
|
`):void 0);for(let i of t.logs.slice(this.lengthOfLastLogs))this.context.logger.log(iYQ(i.level),i.message);this.lengthOfLastLogs=t.logs.length;let n=i=>{this.context.logger.debug(`Generated files. ${mBi("View here",i,{fallback:(a,o)=>`${a}: ${o}`})}`)};return await t.status._visit({notStarted:Hc,running:Hc,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 rYQ({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?Jl(this.absolutePathToPreview,ys.of(IQ_.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 rYQ({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t,context:r}){try{await nYQ({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}),r.logger.info(bd.green(`Downloaded to ${t}`))}catch(n){r.failAndThrow("Failed to download files",n)}}async function nYQ({s3PreSignedReadUrl:e,absolutePathToLocalOutput:t}){let r=await tZ.get(e,{responseType:"stream"}),n=await KUE.default.dir({prefix:"fern",unsafeCleanup:!0}),i=IQ_.default.join(n.path,"output.zip");await(0,JUE.pipeline)(r.data,(0,GUE.createWriteStream)(i)),await Tv(t)&&await(0,b0l.rm)(t,{recursive:!0}),await(0,b0l.mkdir)(t,{recursive:!0}),await(0,HUE.default)(i,t)}function iYQ(e){switch(e){case"DEBUG":return K1.Debug;case"INFO":return K1.Info;case"WARN":return K1.Warn;case"ERROR":return K1.Error;default:return K1.Info}}var m0l=require("fs/promises"),$UE=fa(OCe(),1),aYQ="proto.zip",g0l=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,m0l.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,m0l.unlink)(r)}}}return{absoluteFilePath:t.absoluteFilePath,cleanup:async()=>{}}}async zipSource(t){let r=await $UE.default.dir(),n=Jl(x_.of(r.path),ys.of(aYQ));return this.context.logger.debug(`Zipping source ${t} into ${n}`),await MH(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(sxe.proto({id:n,protoRootUrl:i.downloadUrl}));continue;case"openapi":r.push(sxe.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 YUE({projectConfig:e,organization:t,workspace:r,interactiveTaskContext:n,generatorInvocation:i,version:a,audiences:o,shouldLogS3Url:c,token:d,whitelabel:s,irVersionOverride:u,absolutePathToPreview:l,readme:m}){let A=Bua({token:d.value}),P=GP.getPackageName({generatorInvocation:i}),C=l!=null,M=Me=>xxi(Me,{onError:Be=>n.failAndThrow(Be)},{substituteAsEmpty:C}),T=M(i),z=h0l({apiName:r.definition.rootApiFile.contents.name,organization:t,generatorInvocation:T}),U=qH({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 uYQ({fdr:A,packageName:P,generatorInvocation:i}),context:n,sourceResolver:new BH(n,r),dynamicGeneratorConfig:z}),V=await UCe({token:d.value}).organization.get(nR.OrganizationId(e.organization));V.ok&&V.body.isWhitelabled&&(U.readmeConfig==null&&(U.readmeConfig=cYQ),U.readmeConfig.whiteLabel=!0);let $=r.getSources(),re=DIe({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}),Y=await A.api.v1.register.registerApiDefinition({orgId:MQ_.FernRegistry.OrgId(t),apiId:MQ_.FernRegistry.ApiId(U.apiName.originalName),definition:re,sources:$.length>0?sYQ($):void 0}),te,ne;Y.ok&&(te=Y.body.apiDefinitionId,ne=Y.body.sources);let Oe=new g0l(n,$);if(ne==null&&Oe.sourceTypes.has("protobuf")&&(Y.ok||n.failAndThrow(`Failed to register API definition: ${JSON.stringify(Y.error.content)}`),n.failAndThrow("Did not successfully upload Protobuf source files.")),ne!=null){n.logger.debug("Uploading source files ...");let Me=await Oe.uploadSources(ne);n.logger.debug("Setting IR source configuration ..."),U.sourceConfig=Me}let ge=await xUE({projectConfig:e,workspace:r,organization:t,generatorInvocation:T,context:n,version:a,intermediateRepresentation:{...U,fdrApiDefinitionId:te,publishConfig:oYQ({generatorInvocation:T})},shouldLogS3Url:c,token:d,whitelabel:s!=null?M(s):void 0,irVersionOverride:u,absolutePathToPreview:l});n.logger.debug(`Job ID: ${ge.jobId}`);let ve=ge.taskIds[0];if(ve==null){n.failAndThrow("Did not receive a task ID.");return}n.logger.debug(`Task ID: ${ve}`);let be=new v0l({job:ge,taskId:ve,generatorInvocation:i,interactiveTaskContext:n,absolutePathToPreview:l});return await LUE({job:ge,taskHandler:be,taskId:ve,context:n})}function oYQ({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"]),Jd.PublishingConfig.direct({target:Jd.PublishTarget.postman({apiKey:r.apiKey,workspaceId:r.workspaceId,collectionId:n})})},_other:()=>{}}),_other:()=>{}})}async function uYQ({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 sYQ(e){return Object.fromEntries(Object.values(e).map(t=>[t.id,{type:t.type==="protobuf"?"proto":t.type}]))}var cYQ={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};async function BQ_({projectConfig:e,organization:t,workspace:r,context:n,generatorGroup:i,version:a,shouldLogS3Url:o,token:c,whitelabel:d,absolutePathToPreview:s,mode:u}){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=Mio(P),T=await r.toFernWorkspace({context:n},M),z=await YUE({projectConfig:e,organization:t,workspace:T,interactiveTaskContext:C,generatorInvocation:{...P,outputMode:P.outputMode._visit({downloadFiles:()=>P.outputMode,github:U=>O0l.FernFiddle.OutputMode.github({...U,makePr:u==="pull-request"}),githubV2:U=>u==="pull-request"?O0l.FernFiddle.OutputMode.githubV2(O0l.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:d,readme:P.readme,irVersionOverride:P.irVersionOverride,absolutePathToPreview:s});z!=null&&z.createdSnippets&&(m.push(P),P.absolutePathToLocalSnippets!=null&&z.snippetsS3PreSignedReadUrl!=null&&await TUE({snippetsS3PreSignedReadUrl:z.snippetsS3PreSignedReadUrl,absolutePathToLocalSnippetJSON:P.absolutePathToLocalSnippets,context:C}))}))),(await Promise.all(l)).some(P=>!P)&&n.failAndThrow(),{snippetsProducedBy:m}}var Iyi=fa(lnt(),1);var cVE=require("fs/promises");var cL_=fa($$a(),1);var Jqo=(e,t,r)=>JSON.stringify(e,t,r);function RFu(e,t){return JSON.parse(e,t)}var Jp=class e extends Error{constructor({message:t,statusCode:r,body:n,rawResponse:i}){super(lYQ({message:t,statusCode:r,body:n})),Object.setPrototypeOf(this,e.prototype),this.statusCode=r,this.body=n,this.rawResponse=i}};function lYQ({message:e,statusCode:t,body:r}){let n=[];return e!=null&&n.push(e),t!=null&&n.push(`Status code: ${t.toString()}`),r!=null&&n.push(`Body: ${Jqo(r,void 0,2)}`),n.join(`
|
|
3037
3037
|
`)}var ww=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};var yE=class e extends Jp{constructor(t,r){super({message:"UnprocessableEntityError",statusCode:422,body:t,rawResponse:r}),Object.setPrototypeOf(this,e.prototype)}};var fYQ={arrayFormat:"indices",encode:!0};function XUE(e,t){if(e===void 0||e===null)return"";let r=String(e);return t?encodeURIComponent(r):r}function TQ_(e,t="",r){let n=[];for(let[i,a]of Object.entries(e)){let o=t?`${t}[${i}]`:i;if(a!==void 0)if(Array.isArray(a)){if(a.length===0)continue;for(let c=0;c<a.length;c++){let d=a[c];if(d!==void 0)if(typeof d=="object"&&!Array.isArray(d)&&d!==null){let s=r.arrayFormat==="indices"?`${o}[${c}]`:o;n.push(...TQ_(d,s,r))}else{let s=r.arrayFormat==="indices"?`${o}[${c}]`:o,u=r.encode?encodeURIComponent(s):s;n.push(`${u}=${XUE(d,r.encode)}`)}}}else if(typeof a=="object"&&a!==null){if(Object.keys(a).length===0)continue;n.push(...TQ_(a,o,r))}else{let c=r.encode?encodeURIComponent(o):o;n.push(`${c}=${XUE(a,r.encode)}`)}}return n}function A0l(e,t){return e==null||typeof e!="object"?"":TQ_(e,"",Object.assign(Object.assign({},fYQ),t)).join("&")}function ZUE(e,t){let r=A0l(t,{arrayFormat:"repeat"});return r?`${e}?${r}`:e}function kUE(e){let t={get bodyUsed(){return e.bodyUsed},stream:()=>e.body,arrayBuffer:e.arrayBuffer.bind(e),blob:e.blob.bind(e)};return"bytes"in e&&typeof e.bytes=="function"&&(t.bytes=e.bytes.bind(e)),t}function e9E(e){return e.body!=null}var dYQ=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})};function P0l(e,t){return dYQ(this,void 0,void 0,function*(){if(!e9E(e))return;switch(t){case"binary-response":return kUE(e);case"blob":return yield e.blob();case"arrayBuffer":return yield e.arrayBuffer();case"sse":return e.body;case"streaming":return e.body;case"text":return yield e.text()}let r=yield e.text();if(r.length>0)try{return RFu(r)}catch{return{ok:!1,error:{reason:"non-json",statusCode:e.status,rawBody:r}}}})}var pYQ=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})};function t9E(e){return pYQ(this,void 0,void 0,function*(){var t,r,n;let i=(t=e.headers.get("Content-Type"))===null||t===void 0?void 0:t.toLowerCase();if(i==null||i.length===0)return P0l(e);switch(i.indexOf(";")!==-1&&(i=(n=(r=i.split(";")[0])===null||r===void 0?void 0:r.trim())!==null&&n!==void 0?n:""),i){case"application/hal+json":case"application/json":case"application/ld+json":case"application/problem+json":case"application/vnd.api+json":case"text/json":let a=yield e.text();return a.length>0?RFu(a):void 0;default:if(i.startsWith("application/vnd.")&&i.endsWith("+json")){let o=yield e.text();return o.length>0?RFu(o):void 0}return yield e.text()}})}var _YQ=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})};function r9E(){return _YQ(this,void 0,void 0,function*(){return fetch})}var hYQ=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})};function n9E(e){return hYQ(this,arguments,void 0,function*({body:t,type:r}){return r.includes("json")?Jqo(t):t})}var yYQ="timeout";function i9E(e){let t=new AbortController,r=setTimeout(()=>t.abort(yYQ),e);return{signal:t.signal,abortId:r}}function a9E(...e){let t=e.length===1&&Array.isArray(e[0])?e[0]:e,r=new AbortController;for(let n of t){if(n.aborted){r.abort(n?.reason);break}n.addEventListener("abort",()=>r.abort(n?.reason),{signal:r.signal})}return r.signal}var vYQ=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},o9E=(e,t,r,n,i,a,o,c,d)=>vYQ(void 0,void 0,void 0,function*(){let s=[],u;if(a!=null){let{signal:A,abortId:P}=i9E(a);u=P,s.push(A)}o!=null&&s.push(o);let l=a9E(s),m=yield e(t,{method:r,headers:n,body:i,signal:l,credentials:c?"include":void 0,duplex:d});return u!=null&&clearTimeout(u),m});var NFu;typeof globalThis.Headers<"u"?NFu=globalThis.Headers:NFu=class u9E{constructor(t){if(this.headers=new Map,t)if(t instanceof u9E)t.forEach((r,n)=>this.append(n,r));else if(Array.isArray(t))for(let[r,n]of t)if(typeof r=="string"&&typeof n=="string")this.append(r,n);else throw new TypeError("Each header entry must be a [string, string] tuple");else for(let[r,n]of Object.entries(t))if(typeof n=="string")this.append(r,n);else throw new TypeError("Header values must be strings")}append(t,r){let n=t.toLowerCase(),i=this.headers.get(n)||[];this.headers.set(n,[...i,r])}delete(t){let r=t.toLowerCase();this.headers.delete(r)}get(t){let r=t.toLowerCase(),n=this.headers.get(r);return n?n.join(", "):null}has(t){let r=t.toLowerCase();return this.headers.has(r)}set(t,r){let n=t.toLowerCase();this.headers.set(n,[r])}forEach(t,r){let n=r?t.bind(r):t;this.headers.forEach((i,a)=>n(i.join(", "),a,this))}getSetCookie(){return this.headers.get("set-cookie")||[]}*entries(){for(let[t,r]of this.headers.entries())yield[t,r.join(", ")]}*keys(){yield*this.headers.keys()}*values(){for(let t of this.headers.values())yield t.join(", ")}[Symbol.iterator](){return this.entries()}};var qQ_={headers:new NFu,redirected:!1,status:499,statusText:"Client Closed Request",type:"error",url:""},RQ_={headers:new NFu,redirected:!1,status:0,statusText:"Unknown Error",type:"error",url:""};function NQ_(e){return{headers:e.headers,redirected:e.redirected,status:e.status,statusText:e.statusText,type:e.type,url:e.url}}var bYQ=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})};function gYQ(e){let t=1+(Math.random()*2-1)*.2;return e*t}function s9E(e){return bYQ(this,arguments,void 0,function*(t,r=2){let n=yield t();for(let i=0;i<r&&([408,429].includes(n.status)||n.status>=500);++i){let a=Math.min(1e3*Math.pow(2,i),6e4),o=gYQ(a);yield new Promise(c=>setTimeout(c,o)),n=yield t()}return n})}var mYQ=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},my={get:e=>mYQ(void 0,void 0,void 0,function*(){return typeof e=="function"?e():e})};var FQ_=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})};function OYQ(e){return FQ_(this,void 0,void 0,function*(){let t={};if(e.body!==void 0&&e.contentType!=null&&(t["Content-Type"]=e.contentType),e.headers==null)return t;for(let[r,n]of Object.entries(e.headers)){let i=yield my.get(n);if(typeof i=="string"){t[r]=i;continue}i!=null&&(t[r]=`${i}`)}return t})}function AYQ(e){return FQ_(this,void 0,void 0,function*(){let t=ZUE(e.url,e.queryParameters),r=yield n9E({body:e.body,type:e.requestType==="json"?"json":"other"}),n=yield r9E();try{let i=yield s9E(()=>FQ_(this,void 0,void 0,function*(){return o9E(n,t,e.method,yield OYQ(e),r,e.timeoutMs,e.abortSignal,e.withCredentials,e.duplex)}),e.maxRetries);return i.status>=200&&i.status<400?{ok:!0,body:yield P0l(i,e.responseType),headers:i.headers,rawResponse:NQ_(i)}:{ok:!1,error:{reason:"status-code",statusCode:i.status,body:yield t9E(i)},rawResponse:NQ_(i)}}catch(i){return e.abortSignal!=null&&e.abortSignal.aborted?{ok:!1,error:{reason:"unknown",errorMessage:"The user aborted a request"},rawResponse:qQ_}:i instanceof Error&&i.name==="AbortError"?{ok:!1,error:{reason:"timeout"},rawResponse:qQ_}:i instanceof Error?{ok:!1,error:{reason:"unknown",errorMessage:i.message},rawResponse:RQ_}:{ok:!1,error:{reason:"unknown",errorMessage:Jqo(i)},rawResponse:RQ_}}})}var aj=AYQ;var PYQ=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},jw=class e extends Promise{constructor(t){super(r=>{r(void 0)}),this.innerPromise=t}static fromFunction(t,...r){return new e(t(...r))}static interceptFunction(t){return(...r)=>e.fromPromise(t(...r))}static fromPromise(t){return new e(t)}static fromExecutor(t){let r=new Promise(t);return new e(r)}static fromResult(t){let r=Promise.resolve(t);return new e(r)}unwrap(){return this.unwrappedPromise||(this.unwrappedPromise=this.innerPromise.then(({data:t})=>t)),this.unwrappedPromise}then(t,r){return this.unwrap().then(t,r)}catch(t){return this.unwrap().catch(t)}finally(t){return this.unwrap().finally(t)}withRawResponse(){return PYQ(this,void 0,void 0,function*(){return yield this.innerPromise})}};var w0l=wYQ();function wYQ(){var e,t,r,n,i;return typeof window<"u"&&typeof window.document<"u"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis<"u"&&((e=globalThis?.navigator)===null||e===void 0?void 0:e.userAgent)==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof self?.importScripts=="function"&&(((t=self.constructor)===null||t===void 0?void 0:t.name)==="DedicatedWorkerGlobalScope"||((r=self.constructor)===null||r===void 0?void 0:r.name)==="ServiceWorkerGlobalScope"||((n=self.constructor)===null||n===void 0?void 0:n.name)==="SharedWorkerGlobalScope")?{type:"web-worker"}:typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u"?{type:"deno",version:Deno.version.deno}:typeof Bun<"u"&&typeof Bun.version<"u"?{type:"bun",version:Bun.version}:typeof process<"u"&&"version"in process&&!!process.version&&"versions"in process&&!!(!((i=process.versions)===null||i===void 0)&&i.node)?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:typeof navigator<"u"&&navigator?.product==="ReactNative"?{type:"react-native"}:{type:"unknown"}}var Ww={};lf(Ww,{join:()=>l9E,toQueryString:()=>A0l});function l9E(e,...t){if(!e)return"";if(t.length===0)return e;if(e.includes("://")){let r;try{r=new URL(e)}catch{return c9E(e,...t)}let n=t[t.length-1],i=n&&n.endsWith("/");for(let a of t){let o=d9E(a);o&&(r.pathname=f9E(r.pathname,o))}return i&&!r.pathname.endsWith("/")&&(r.pathname+="/"),r.toString()}return c9E(e,...t)}function c9E(e,...t){if(t.length===0)return e;let r=e,n=t[t.length-1],i=n&&n.endsWith("/");for(let a of t){let o=d9E(a);o&&(r=f9E(r,o))}return i&&!r.endsWith("/")&&(r+="/"),r}function f9E(e,t){return e.endsWith("/")?e+t:e+"/"+t}function d9E(e){if(!e)return e;let t=0,r=e.length;return e.startsWith("/")&&(t=1),e.endsWith("/")&&(r=e.length-1),t===0&&r===e.length?e:e.slice(t,r)}function Hw(...e){let t={};for(let[r,n]of e.filter(i=>i!=null).flatMap(i=>Object.entries(i)))n!=null?t[r]=n:r in t&&delete t[r];return t}function vj(...e){let t={};for(let[r,n]of e.filter(i=>i!=null).flatMap(i=>Object.entries(i)))n!=null&&(t[r]=n);return t}var bj={Production:"https://fai.buildwithfern.com",Development:"https://fai-dev.buildwithfern.com",Local:"http://localhost:8080"};var Kqo=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},j0l=class{constructor(t={}){this._options=t}getAnalyticsHistogram(t,r={},n){return jw.fromPromise(this.__getAnalyticsHistogram(t,r,n))}__getAnalyticsHistogram(t){return Kqo(this,arguments,void 0,function*(r,n={},i){var a,o,c;let{start_date:d,end_date:s,group_by:u}=n,l={};d!=null&&(l.start_date=d),s!=null&&(l.end_date=s),u!=null&&(l.group_by=u);let m=Hw((a=this._options)===null||a===void 0?void 0:a.headers,vj({Authorization:yield this._getAuthorizationHeader()}),i?.headers),A=yield aj({url:Ww.join((c=(o=yield my.get(this._options.baseUrl))!==null&&o!==void 0?o:yield my.get(this._options.environment))!==null&&c!==void 0?c:bj.Production,`analytics/histogram/${encodeURIComponent(r)}`),method:"GET",headers:m,queryParameters:Object.assign(Object.assign({},l),i?.queryParams),timeoutMs:i?.timeoutInSeconds!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i?.maxRetries,abortSignal:i?.abortSignal});if(A.ok)return{data:A.body,rawResponse:A.rawResponse};if(A.error.reason==="status-code")switch(A.error.statusCode){case 422:throw new yE(A.error.body,A.rawResponse);default:throw new Jp({statusCode:A.error.statusCode,body:A.error.body,rawResponse:A.rawResponse})}switch(A.error.reason){case"non-json":throw new Jp({statusCode:A.error.statusCode,body:A.error.rawBody,rawResponse:A.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /analytics/histogram/{domain}.");case"unknown":throw new Jp({message:A.error.errorMessage,rawResponse:A.rawResponse})}})}getAnalyticsInsights(t,r={},n){return jw.fromPromise(this.__getAnalyticsInsights(t,r,n))}__getAnalyticsInsights(t){return Kqo(this,arguments,void 0,function*(r,n={},i){var a,o,c;let{start_date:d,end_date:s}=n,u={};d!=null&&(u.start_date=d),s!=null&&(u.end_date=s);let l=Hw((a=this._options)===null||a===void 0?void 0:a.headers,vj({Authorization:yield this._getAuthorizationHeader()}),i?.headers),m=yield aj({url:Ww.join((c=(o=yield my.get(this._options.baseUrl))!==null&&o!==void 0?o:yield my.get(this._options.environment))!==null&&c!==void 0?c:bj.Production,`analytics/insights/${encodeURIComponent(r)}`),method:"GET",headers:l,queryParameters:Object.assign(Object.assign({},u),i?.queryParams),timeoutMs:i?.timeoutInSeconds!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i?.maxRetries,abortSignal:i?.abortSignal});if(m.ok)return{data:m.body,rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 422:throw new yE(m.error.body,m.rawResponse);default:throw new Jp({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new Jp({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /analytics/insights/{domain}.");case"unknown":throw new Jp({message:m.error.errorMessage,rawResponse:m.rawResponse})}})}generateAllInsights(t={},r){return jw.fromPromise(this.__generateAllInsights(t,r))}__generateAllInsights(){return Kqo(this,arguments,void 0,function*(t={},r){var n,i,a;let{start_date:o,end_date:c}=t,d={};o!=null&&(d.start_date=o),c!=null&&(d.end_date=c);let s=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),u=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,"analytics/insights/generate_all"),method:"POST",headers:s,queryParameters:Object.assign(Object.assign({},d),r?.queryParams),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(u.ok)return{data:u.body,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 422:throw new yE(u.error.body,u.rawResponse);default:throw new Jp({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new Jp({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /analytics/insights/generate_all.");case"unknown":throw new Jp({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}triggerScheduledInsightsGeneration(t){return jw.fromPromise(this.__triggerScheduledInsightsGeneration(t))}__triggerScheduledInsightsGeneration(t){return Kqo(this,void 0,void 0,function*(){var r,n,i;let a=Hw((r=this._options)===null||r===void 0?void 0:r.headers,vj({Authorization:yield this._getAuthorizationHeader()}),t?.headers),o=yield aj({url:Ww.join((i=(n=yield my.get(this._options.baseUrl))!==null&&n!==void 0?n:yield my.get(this._options.environment))!==null&&i!==void 0?i:bj.Production,"analytics/insights/trigger_scheduled"),method:"POST",headers:a,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new Jp({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new Jp({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /analytics/insights/trigger_scheduled.");case"unknown":throw new Jp({message:o.error.errorMessage,rawResponse:o.rawResponse})}})}getSchedulerStatus(t){return jw.fromPromise(this.__getSchedulerStatus(t))}__getSchedulerStatus(t){return Kqo(this,void 0,void 0,function*(){var r,n,i;let a=Hw((r=this._options)===null||r===void 0?void 0:r.headers,vj({Authorization:yield this._getAuthorizationHeader()}),t?.headers),o=yield aj({url:Ww.join((i=(n=yield my.get(this._options.baseUrl))!==null&&n!==void 0?n:yield my.get(this._options.environment))!==null&&i!==void 0?i:bj.Production,"analytics/scheduler/status"),method:"GET",headers:a,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new Jp({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new Jp({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /analytics/scheduler/status.");case"unknown":throw new Jp({message:o.error.errorMessage,rawResponse:o.rawResponse})}})}_getAuthorizationHeader(){return Kqo(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var p9E=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},E0l=class{constructor(t={}){this._options=t}postChatCompletion(t,r,n){return jw.fromPromise(this.__postChatCompletion(t,r,n))}__postChatCompletion(t,r,n){return p9E(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`chat/${encodeURIComponent(t)}`),method:"POST",headers:c,contentType:"application/json",queryParameters:n?.queryParams,requestType:"json",body:r,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /chat/{domain}.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}_getAuthorizationHeader(){return p9E(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var _9E=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},S0l=class{constructor(t={}){this._options=t}getConversationById(t,r,n){return jw.fromPromise(this.__getConversationById(t,r,n))}__getConversationById(t,r,n){return _9E(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`conversation/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"GET",headers:c,queryParameters:n?.queryParams,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /conversation/{domain}/{conversation_id}.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}_getAuthorizationHeader(){return _9E(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var xQ_=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},D0l=class{constructor(t={}){this._options=t}createDiscordIntegration(t,r){return jw.fromPromise(this.__createDiscordIntegration(t,r))}__createDiscordIntegration(t,r){return xQ_(this,void 0,void 0,function*(){var n,i,a;let{domain:o}=t,c={};c.domain=o;let d=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),s=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,"discord/install"),method:"POST",headers:d,queryParameters:Object.assign(Object.assign({},c),r?.queryParams),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 422:throw new yE(s.error.body,s.rawResponse);default:throw new Jp({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new Jp({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /discord/install.");case"unknown":throw new Jp({message:s.error.errorMessage,rawResponse:s.rawResponse})}})}handleDiscordInstallCallback(t){return jw.fromPromise(this.__handleDiscordInstallCallback(t))}__handleDiscordInstallCallback(t){return xQ_(this,void 0,void 0,function*(){var r,n,i;let a=Hw((r=this._options)===null||r===void 0?void 0:r.headers,vj({Authorization:yield this._getAuthorizationHeader()}),t?.headers),o=yield aj({url:Ww.join((i=(n=yield my.get(this._options.baseUrl))!==null&&n!==void 0?n:yield my.get(this._options.environment))!==null&&i!==void 0?i:bj.Production,"discord/install/callback"),method:"GET",headers:a,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new Jp({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new Jp({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /discord/install/callback.");case"unknown":throw new Jp({message:o.error.errorMessage,rawResponse:o.rawResponse})}})}_getAuthorizationHeader(){return xQ_(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var OBi=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},C0l=class{constructor(t={}){this._options=t}createDocument(t,r,n){return jw.fromPromise(this.__createDocument(t,r,n))}__createDocument(t,r,n){return OBi(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`document/${encodeURIComponent(t)}/create`),method:"POST",headers:c,contentType:"application/json",queryParameters:n?.queryParams,requestType:"json",body:r,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /document/{domain}/create.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}batchCreateDocument(t,r,n){return jw.fromPromise(this.__batchCreateDocument(t,r,n))}__batchCreateDocument(t,r,n){return OBi(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`document/${encodeURIComponent(t)}/batch-create`),method:"POST",headers:c,contentType:"application/json",queryParameters:n?.queryParams,requestType:"json",body:r,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /document/{domain}/batch-create.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}getDocumentById(t,r,n){return jw.fromPromise(this.__getDocumentById(t,r,n))}__getDocumentById(t,r,n){return OBi(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`document/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"GET",headers:c,queryParameters:n?.queryParams,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /document/{domain}/{document_id}.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}updateDocument(t,r,n={},i){return jw.fromPromise(this.__updateDocument(t,r,n,i))}__updateDocument(t,r){return OBi(this,arguments,void 0,function*(n,i,a={},o){var c,d,s;let u=Hw((c=this._options)===null||c===void 0?void 0:c.headers,vj({Authorization:yield this._getAuthorizationHeader()}),o?.headers),l=yield aj({url:Ww.join((s=(d=yield my.get(this._options.baseUrl))!==null&&d!==void 0?d:yield my.get(this._options.environment))!==null&&s!==void 0?s:bj.Production,`document/${encodeURIComponent(n)}/${encodeURIComponent(i)}`),method:"PATCH",headers:u,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:a,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:l.body,rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 422:throw new yE(l.error.body,l.rawResponse);default:throw new Jp({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new Jp({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling PATCH /document/{domain}/{document_id}.");case"unknown":throw new Jp({message:l.error.errorMessage,rawResponse:l.rawResponse})}})}deleteDocumentById(t,r,n){return jw.fromPromise(this.__deleteDocumentById(t,r,n))}__deleteDocumentById(t,r,n){return OBi(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`document/${encodeURIComponent(t)}/delete`),method:"DELETE",headers:c,contentType:"application/json",queryParameters:n?.queryParams,requestType:"json",body:r,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling DELETE /document/{domain}/delete.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}batchDeleteDocument(t,r,n){return jw.fromPromise(this.__batchDeleteDocument(t,r,n))}__batchDeleteDocument(t,r,n){return OBi(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`document/${encodeURIComponent(t)}/batch-delete`),method:"DELETE",headers:c,contentType:"application/json",queryParameters:n?.queryParams,requestType:"json",body:r,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling DELETE /document/{domain}/batch-delete.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}getDocuments(t,r={},n){return jw.fromPromise(this.__getDocuments(t,r,n))}__getDocuments(t){return OBi(this,arguments,void 0,function*(r,n={},i){var a,o,c;let{page:d,limit:s}=n,u={};d!=null&&(u.page=d.toString()),s!=null&&(u.limit=s.toString());let l=Hw((a=this._options)===null||a===void 0?void 0:a.headers,vj({Authorization:yield this._getAuthorizationHeader()}),i?.headers),m=yield aj({url:Ww.join((c=(o=yield my.get(this._options.baseUrl))!==null&&o!==void 0?o:yield my.get(this._options.environment))!==null&&c!==void 0?c:bj.Production,`document/${encodeURIComponent(r)}`),method:"GET",headers:l,queryParameters:Object.assign(Object.assign({},u),i?.queryParams),timeoutMs:i?.timeoutInSeconds!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i?.maxRetries,abortSignal:i?.abortSignal});if(m.ok)return{data:m.body,rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 422:throw new yE(m.error.body,m.rawResponse);default:throw new Jp({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new Jp({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /document/{domain}.");case"unknown":throw new Jp({message:m.error.errorMessage,rawResponse:m.rawResponse})}})}deleteAllDocuments(t,r){return jw.fromPromise(this.__deleteAllDocuments(t,r))}__deleteAllDocuments(t,r){return OBi(this,void 0,void 0,function*(){var n,i,a;let o=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),c=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,`document/${encodeURIComponent(t)}/delete-all`),method:"DELETE",headers:o,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 422:throw new yE(c.error.body,c.rawResponse);default:throw new Jp({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new Jp({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling DELETE /document/{domain}/delete-all.");case"unknown":throw new Jp({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}_getAuthorizationHeader(){return OBi(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var zQ_=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},I0l=class{constructor(t={}){this._options=t}createFeedback(t,r,n){return jw.fromPromise(this.__createFeedback(t,r,n))}__createFeedback(t,r,n){return zQ_(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`feedback/${encodeURIComponent(t)}`),method:"POST",headers:c,contentType:"application/json",queryParameters:n?.queryParams,requestType:"json",body:r,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /feedback/{domain}.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}getFeedbackById(t,r,n){return jw.fromPromise(this.__getFeedbackById(t,r,n))}__getFeedbackById(t,r,n){return zQ_(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`feedback/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"GET",headers:c,queryParameters:n?.queryParams,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /feedback/{domain}/{conversation_id}.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}_getAuthorizationHeader(){return zQ_(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var QQ_=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},M0l=class{constructor(t={}){this._options=t}indexReferenceMd(t,r,n){return jw.fromPromise(this.__indexReferenceMd(t,r,n))}__indexReferenceMd(t,r,n){return QQ_(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`github/${encodeURIComponent(t)}/reference-md/index`),method:"POST",headers:c,contentType:"application/json",queryParameters:n?.queryParams,requestType:"json",body:r,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /github/{domain}/reference-md/index.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}checkCodeIndexStatus(t,r){return jw.fromPromise(this.__checkCodeIndexStatus(t,r))}__checkCodeIndexStatus(t,r){return QQ_(this,void 0,void 0,function*(){var n,i,a;let o=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),c=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,`github/${encodeURIComponent(t)}/indexed`),method:"GET",headers:o,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 422:throw new yE(c.error.body,c.rawResponse);default:throw new Jp({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new Jp({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /github/{domain}/indexed.");case"unknown":throw new Jp({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}_getAuthorizationHeader(){return QQ_(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var $qo=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},B0l=class{constructor(t={}){this._options=t}createGuidance(t,r,n){return jw.fromPromise(this.__createGuidance(t,r,n))}__createGuidance(t,r,n){return $qo(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`guidance/${encodeURIComponent(t)}/create`),method:"POST",headers:c,contentType:"application/json",queryParameters:n?.queryParams,requestType:"json",body:r,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /guidance/{domain}/create.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}getGuidanceById(t,r,n){return jw.fromPromise(this.__getGuidanceById(t,r,n))}__getGuidanceById(t,r,n){return $qo(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`guidance/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"GET",headers:c,queryParameters:n?.queryParams,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /guidance/{domain}/{guidance_id}.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}deleteGuidanceById(t,r,n){return jw.fromPromise(this.__deleteGuidanceById(t,r,n))}__deleteGuidanceById(t,r,n){return $qo(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`guidance/${encodeURIComponent(t)}/${encodeURIComponent(r)}`),method:"DELETE",headers:c,queryParameters:n?.queryParams,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling DELETE /guidance/{domain}/{guidance_id}.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}update(t,r,n={},i){return jw.fromPromise(this.__update(t,r,n,i))}__update(t,r){return $qo(this,arguments,void 0,function*(n,i,a={},o){var c,d,s;let u=Hw((c=this._options)===null||c===void 0?void 0:c.headers,vj({Authorization:yield this._getAuthorizationHeader()}),o?.headers),l=yield aj({url:Ww.join((s=(d=yield my.get(this._options.baseUrl))!==null&&d!==void 0?d:yield my.get(this._options.environment))!==null&&s!==void 0?s:bj.Production,`guidance/${encodeURIComponent(n)}/${encodeURIComponent(i)}`),method:"PATCH",headers:u,contentType:"application/json",queryParameters:o?.queryParams,requestType:"json",body:a,timeoutMs:o?.timeoutInSeconds!=null?o.timeoutInSeconds*1e3:6e4,maxRetries:o?.maxRetries,abortSignal:o?.abortSignal});if(l.ok)return{data:l.body,rawResponse:l.rawResponse};if(l.error.reason==="status-code")switch(l.error.statusCode){case 422:throw new yE(l.error.body,l.rawResponse);default:throw new Jp({statusCode:l.error.statusCode,body:l.error.body,rawResponse:l.rawResponse})}switch(l.error.reason){case"non-json":throw new Jp({statusCode:l.error.statusCode,body:l.error.rawBody,rawResponse:l.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling PATCH /guidance/{domain}/{guidance_id}.");case"unknown":throw new Jp({message:l.error.errorMessage,rawResponse:l.rawResponse})}})}getGuidances(t,r={},n){return jw.fromPromise(this.__getGuidances(t,r,n))}__getGuidances(t){return $qo(this,arguments,void 0,function*(r,n={},i){var a,o,c;let{page:d,limit:s}=n,u={};d!=null&&(u.page=d.toString()),s!=null&&(u.limit=s.toString());let l=Hw((a=this._options)===null||a===void 0?void 0:a.headers,vj({Authorization:yield this._getAuthorizationHeader()}),i?.headers),m=yield aj({url:Ww.join((c=(o=yield my.get(this._options.baseUrl))!==null&&o!==void 0?o:yield my.get(this._options.environment))!==null&&c!==void 0?c:bj.Production,`guidance/${encodeURIComponent(r)}`),method:"GET",headers:l,queryParameters:Object.assign(Object.assign({},u),i?.queryParams),timeoutMs:i?.timeoutInSeconds!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i?.maxRetries,abortSignal:i?.abortSignal});if(m.ok)return{data:m.body,rawResponse:m.rawResponse};if(m.error.reason==="status-code")switch(m.error.statusCode){case 422:throw new yE(m.error.body,m.rawResponse);default:throw new Jp({statusCode:m.error.statusCode,body:m.error.body,rawResponse:m.rawResponse})}switch(m.error.reason){case"non-json":throw new Jp({statusCode:m.error.statusCode,body:m.error.rawBody,rawResponse:m.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /guidance/{domain}.");case"unknown":throw new Jp({message:m.error.errorMessage,rawResponse:m.rawResponse})}})}_getAuthorizationHeader(){return $qo(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var h9E=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},T0l=class{constructor(t={}){this._options=t}check(t){return jw.fromPromise(this.__check(t))}__check(t){return h9E(this,void 0,void 0,function*(){var r,n,i;let a=Hw((r=this._options)===null||r===void 0?void 0:r.headers,vj({Authorization:yield this._getAuthorizationHeader()}),t?.headers),o=yield aj({url:Ww.join((i=(n=yield my.get(this._options.baseUrl))!==null&&n!==void 0?n:yield my.get(this._options.environment))!==null&&i!==void 0?i:bj.Production,"health"),method:"GET",headers:a,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new Jp({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new Jp({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /health.");case"unknown":throw new Jp({message:o.error.errorMessage,rawResponse:o.rawResponse})}})}_getAuthorizationHeader(){return h9E(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var q0l=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},R0l=class{constructor(t={}){this._options=t}reconstructQueryIndex(t,r){return jw.fromPromise(this.__reconstructQueryIndex(t,r))}__reconstructQueryIndex(t,r){return q0l(this,void 0,void 0,function*(){var n,i,a;let o=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),c=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,`index/${encodeURIComponent(t)}/reconstruct`),method:"POST",headers:o,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 422:throw new yE(c.error.body,c.rawResponse);default:throw new Jp({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new Jp({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /index/{domain}/reconstruct.");case"unknown":throw new Jp({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}syncIndexToQueryIndex(t,r,n){return jw.fromPromise(this.__syncIndexToQueryIndex(t,r,n))}__syncIndexToQueryIndex(t,r,n){return q0l(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`index/${encodeURIComponent(t)}/sync`),method:"POST",headers:c,contentType:"application/json",queryParameters:n?.queryParams,requestType:"json",body:r,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /index/{domain}/sync.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}getJobStatus(t,r){return jw.fromPromise(this.__getJobStatus(t,r))}__getJobStatus(t,r){return q0l(this,void 0,void 0,function*(){var n,i,a;let o=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),c=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,`jobs/${encodeURIComponent(t)}/status`),method:"GET",headers:o,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 422:throw new yE(c.error.body,c.rawResponse);default:throw new Jp({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new Jp({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /jobs/{job_id}/status.");case"unknown":throw new Jp({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}_getAuthorizationHeader(){return q0l(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var LQ_=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},N0l=class{constructor(t={}){this._options=t}getMcpSemanticQuery(t,r,n){return jw.fromPromise(this.__getMcpSemanticQuery(t,r,n))}__getMcpSemanticQuery(t,r,n){return LQ_(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`mcp/semantic/${encodeURIComponent(t)}`),method:"POST",headers:c,contentType:"application/json",queryParameters:n?.queryParams,requestType:"json",body:r,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /mcp/semantic/{domain}.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}getMcpBmfQuery(t,r,n){return jw.fromPromise(this.__getMcpBmfQuery(t,r,n))}__getMcpBmfQuery(t,r,n){return LQ_(this,void 0,void 0,function*(){var i,a,o;let c=Hw((i=this._options)===null||i===void 0?void 0:i.headers,vj({Authorization:yield this._getAuthorizationHeader()}),n?.headers),d=yield aj({url:Ww.join((o=(a=yield my.get(this._options.baseUrl))!==null&&a!==void 0?a:yield my.get(this._options.environment))!==null&&o!==void 0?o:bj.Production,`mcp/bmf/${encodeURIComponent(t)}`),method:"POST",headers:c,contentType:"application/json",queryParameters:n?.queryParams,requestType:"json",body:r,timeoutMs:n?.timeoutInSeconds!=null?n.timeoutInSeconds*1e3:6e4,maxRetries:n?.maxRetries,abortSignal:n?.abortSignal});if(d.ok)return{data:d.body,rawResponse:d.rawResponse};if(d.error.reason==="status-code")switch(d.error.statusCode){case 422:throw new yE(d.error.body,d.rawResponse);default:throw new Jp({statusCode:d.error.statusCode,body:d.error.body,rawResponse:d.rawResponse})}switch(d.error.reason){case"non-json":throw new Jp({statusCode:d.error.statusCode,body:d.error.rawBody,rawResponse:d.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /mcp/bmf/{domain}.");case"unknown":throw new Jp({message:d.error.errorMessage,rawResponse:d.rawResponse})}})}_getAuthorizationHeader(){return LQ_(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var UQ_=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},F0l=class{constructor(t={}){this._options=t}createQuery(t,r){return jw.fromPromise(this.__createQuery(t,r))}__createQuery(t,r){return UQ_(this,void 0,void 0,function*(){var n,i,a;let{domain:o,body:c}=t,d={};d.domain=o;let s=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),u=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,"queries"),method:"POST",headers:s,contentType:"application/json",queryParameters:Object.assign(Object.assign({},d),r?.queryParams),requestType:"json",body:c,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(u.ok)return{data:u.body,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 422:throw new yE(u.error.body,u.rawResponse);default:throw new Jp({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new Jp({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /queries.");case"unknown":throw new Jp({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}getRecentQueries(t,r={},n){return jw.fromPromise(this.__getRecentQueries(t,r,n))}__getRecentQueries(t){return UQ_(this,arguments,void 0,function*(r,n={},i){var a,o,c;let{page:d,limit:s,cutoff_time:u,include_assistant:l,start_date:m,end_date:A}=n,P={};d!=null&&(P.page=d.toString()),s!=null&&(P.limit=s.toString()),u!=null&&(P.cutoff_time=u),l!=null&&(P.include_assistant=l.toString()),m!=null&&(P.start_date=m),A!=null&&(P.end_date=A);let C=Hw((a=this._options)===null||a===void 0?void 0:a.headers,vj({Authorization:yield this._getAuthorizationHeader()}),i?.headers),M=yield aj({url:Ww.join((c=(o=yield my.get(this._options.baseUrl))!==null&&o!==void 0?o:yield my.get(this._options.environment))!==null&&c!==void 0?c:bj.Production,`queries/${encodeURIComponent(r)}`),method:"GET",headers:C,queryParameters:Object.assign(Object.assign({},P),i?.queryParams),timeoutMs:i?.timeoutInSeconds!=null?i.timeoutInSeconds*1e3:6e4,maxRetries:i?.maxRetries,abortSignal:i?.abortSignal});if(M.ok)return{data:M.body,rawResponse:M.rawResponse};if(M.error.reason==="status-code")switch(M.error.statusCode){case 422:throw new yE(M.error.body,M.rawResponse);default:throw new Jp({statusCode:M.error.statusCode,body:M.error.body,rawResponse:M.rawResponse})}switch(M.error.reason){case"non-json":throw new Jp({statusCode:M.error.statusCode,body:M.error.rawBody,rawResponse:M.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /queries/{domain}.");case"unknown":throw new Jp({message:M.error.errorMessage,rawResponse:M.rawResponse})}})}_getAuthorizationHeader(){return UQ_(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var Yqo=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},x0l=class{constructor(t={}){this._options=t}getSettings(t,r){return jw.fromPromise(this.__getSettings(t,r))}__getSettings(t,r){return Yqo(this,void 0,void 0,function*(){var n,i,a;let{domain:o}=t,c={};c.domain=o;let d=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),s=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,"settings/ask-ai"),method:"GET",headers:d,queryParameters:Object.assign(Object.assign({},c),r?.queryParams),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 422:throw new yE(s.error.body,s.rawResponse);default:throw new Jp({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new Jp({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /settings/ask-ai.");case"unknown":throw new Jp({message:s.error.errorMessage,rawResponse:s.rawResponse})}})}getDocsSettings(t,r){return jw.fromPromise(this.__getDocsSettings(t,r))}__getDocsSettings(t,r){return Yqo(this,void 0,void 0,function*(){var n,i,a;let{domain:o}=t,c={};c.domain=o;let d=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),s=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,"settings/ask-ai/docs"),method:"GET",headers:d,queryParameters:Object.assign(Object.assign({},c),r?.queryParams),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 422:throw new yE(s.error.body,s.rawResponse);default:throw new Jp({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new Jp({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /settings/ask-ai/docs.");case"unknown":throw new Jp({message:s.error.errorMessage,rawResponse:s.rawResponse})}})}toggleAskAi(t,r){return jw.fromPromise(this.__toggleAskAi(t,r))}__toggleAskAi(t,r){return Yqo(this,void 0,void 0,function*(){var n,i,a;let{domain:o,org_name:c}=t,d={};d.domain=o,d.org_name=c;let s=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),u=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,"settings/ask-ai/toggle"),method:"POST",headers:s,queryParameters:Object.assign(Object.assign({},d),r?.queryParams),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(u.ok)return{data:u.body,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 422:throw new yE(u.error.body,u.rawResponse);default:throw new Jp({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new Jp({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /settings/ask-ai/toggle.");case"unknown":throw new Jp({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}reindexAskAi(t,r){return jw.fromPromise(this.__reindexAskAi(t,r))}__reindexAskAi(t,r){return Yqo(this,void 0,void 0,function*(){var n,i,a;let{domain:o,org_name:c}=t,d={};d.domain=o,d.org_name=c;let s=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),u=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,"settings/ask-ai/reindex"),method:"POST",headers:s,queryParameters:Object.assign(Object.assign({},d),r?.queryParams),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(u.ok)return{data:u.body,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 422:throw new yE(u.error.body,u.rawResponse);default:throw new Jp({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new Jp({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /settings/ask-ai/reindex.");case"unknown":throw new Jp({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}getToggleStatus(t,r){return jw.fromPromise(this.__getToggleStatus(t,r))}__getToggleStatus(t,r){return Yqo(this,void 0,void 0,function*(){var n,i,a;let{domain:o}=t,c={};c.domain=o;let d=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),s=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,"settings/ask-ai/toggle/status"),method:"GET",headers:d,queryParameters:Object.assign(Object.assign({},c),r?.queryParams),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 422:throw new yE(s.error.body,s.rawResponse);default:throw new Jp({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new Jp({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /settings/ask-ai/toggle/status.");case"unknown":throw new Jp({message:s.error.errorMessage,rawResponse:s.rawResponse})}})}_getAuthorizationHeader(){return Yqo(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var ABi=function(e,t,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function c(u){try{s(n.next(u))}catch(l){o(l)}}function d(u){try{s(n.throw(u))}catch(l){o(l)}}function s(u){u.done?a(u.value):i(u.value).then(c,d)}s((n=n.apply(e,t||[])).next())})},z0l=class{constructor(t={}){this._options=t}createSlackIntegration(t,r){return jw.fromPromise(this.__createSlackIntegration(t,r))}__createSlackIntegration(t,r){return ABi(this,void 0,void 0,function*(){var n,i,a;let o=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),c=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,"slack/integrations"),method:"POST",headers:o,contentType:"application/json",queryParameters:r?.queryParams,requestType:"json",body:t,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 422:throw new yE(c.error.body,c.rawResponse);default:throw new Jp({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new Jp({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /slack/integrations.");case"unknown":throw new Jp({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}handleSlackEvents(t){return jw.fromPromise(this.__handleSlackEvents(t))}__handleSlackEvents(t){return ABi(this,void 0,void 0,function*(){var r,n,i;let a=Hw((r=this._options)===null||r===void 0?void 0:r.headers,vj({Authorization:yield this._getAuthorizationHeader()}),t?.headers),o=yield aj({url:Ww.join((i=(n=yield my.get(this._options.baseUrl))!==null&&n!==void 0?n:yield my.get(this._options.environment))!==null&&i!==void 0?i:bj.Production,"slack/events"),method:"POST",headers:a,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new Jp({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new Jp({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /slack/events.");case"unknown":throw new Jp({message:o.error.errorMessage,rawResponse:o.rawResponse})}})}handleSlackSlashCommands(t){return jw.fromPromise(this.__handleSlackSlashCommands(t))}__handleSlackSlashCommands(t){return ABi(this,void 0,void 0,function*(){var r,n,i;let a=Hw((r=this._options)===null||r===void 0?void 0:r.headers,vj({Authorization:yield this._getAuthorizationHeader()}),t?.headers),o=yield aj({url:Ww.join((i=(n=yield my.get(this._options.baseUrl))!==null&&n!==void 0?n:yield my.get(this._options.environment))!==null&&i!==void 0?i:bj.Production,"slack/slash-commands"),method:"POST",headers:a,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new Jp({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new Jp({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /slack/slash-commands.");case"unknown":throw new Jp({message:o.error.errorMessage,rawResponse:o.rawResponse})}})}handleSlackInteractions(t){return jw.fromPromise(this.__handleSlackInteractions(t))}__handleSlackInteractions(t){return ABi(this,void 0,void 0,function*(){var r,n,i;let a=Hw((r=this._options)===null||r===void 0?void 0:r.headers,vj({Authorization:yield this._getAuthorizationHeader()}),t?.headers),o=yield aj({url:Ww.join((i=(n=yield my.get(this._options.baseUrl))!==null&&n!==void 0?n:yield my.get(this._options.environment))!==null&&i!==void 0?i:bj.Production,"slack/interactions"),method:"POST",headers:a,queryParameters:t?.queryParams,timeoutMs:t?.timeoutInSeconds!=null?t.timeoutInSeconds*1e3:6e4,maxRetries:t?.maxRetries,abortSignal:t?.abortSignal});if(o.ok)return{data:o.body,rawResponse:o.rawResponse};if(o.error.reason==="status-code")throw new Jp({statusCode:o.error.statusCode,body:o.error.body,rawResponse:o.rawResponse});switch(o.error.reason){case"non-json":throw new Jp({statusCode:o.error.statusCode,body:o.error.rawBody,rawResponse:o.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling POST /slack/interactions.");case"unknown":throw new Jp({message:o.error.errorMessage,rawResponse:o.rawResponse})}})}handleSlackOauthCallback(t,r){return jw.fromPromise(this.__handleSlackOauthCallback(t,r))}__handleSlackOauthCallback(t,r){return ABi(this,void 0,void 0,function*(){var n,i,a;let{code:o,state:c}=t,d={};d.code=o,c!=null&&(d.state=c);let s=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),u=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,"slack/oauth/callback"),method:"GET",headers:s,queryParameters:Object.assign(Object.assign({},d),r?.queryParams),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(u.ok)return{data:u.body,rawResponse:u.rawResponse};if(u.error.reason==="status-code")switch(u.error.statusCode){case 422:throw new yE(u.error.body,u.rawResponse);default:throw new Jp({statusCode:u.error.statusCode,body:u.error.body,rawResponse:u.rawResponse})}switch(u.error.reason){case"non-json":throw new Jp({statusCode:u.error.statusCode,body:u.error.rawBody,rawResponse:u.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /slack/oauth/callback.");case"unknown":throw new Jp({message:u.error.errorMessage,rawResponse:u.rawResponse})}})}getSlackInstallLink(t,r){return jw.fromPromise(this.__getSlackInstallLink(t,r))}__getSlackInstallLink(t,r){return ABi(this,void 0,void 0,function*(){var n,i,a;let{domain:o}=t,c={};c.domain=o;let d=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),s=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,"slack/get-install"),method:"GET",headers:d,queryParameters:Object.assign(Object.assign({},c),r?.queryParams),timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(s.ok)return{data:s.body,rawResponse:s.rawResponse};if(s.error.reason==="status-code")switch(s.error.statusCode){case 422:throw new yE(s.error.body,s.rawResponse);default:throw new Jp({statusCode:s.error.statusCode,body:s.error.body,rawResponse:s.rawResponse})}switch(s.error.reason){case"non-json":throw new Jp({statusCode:s.error.statusCode,body:s.error.rawBody,rawResponse:s.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /slack/get-install.");case"unknown":throw new Jp({message:s.error.errorMessage,rawResponse:s.rawResponse})}})}listSlackIntegrations(t,r){return jw.fromPromise(this.__listSlackIntegrations(t,r))}__listSlackIntegrations(t,r){return ABi(this,void 0,void 0,function*(){var n,i,a;let o=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),c=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,`slack/integrations/${encodeURIComponent(t)}`),method:"GET",headers:o,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 422:throw new yE(c.error.body,c.rawResponse);default:throw new Jp({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new Jp({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /slack/integrations/{domain}.");case"unknown":throw new Jp({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}getSlackInstallLinkById(t,r){return jw.fromPromise(this.__getSlackInstallLinkById(t,r))}__getSlackInstallLinkById(t,r){return ABi(this,void 0,void 0,function*(){var n,i,a;let o=Hw((n=this._options)===null||n===void 0?void 0:n.headers,vj({Authorization:yield this._getAuthorizationHeader()}),r?.headers),c=yield aj({url:Ww.join((a=(i=yield my.get(this._options.baseUrl))!==null&&i!==void 0?i:yield my.get(this._options.environment))!==null&&a!==void 0?a:bj.Production,`slack/get-install/${encodeURIComponent(t)}`),method:"GET",headers:o,queryParameters:r?.queryParams,timeoutMs:r?.timeoutInSeconds!=null?r.timeoutInSeconds*1e3:6e4,maxRetries:r?.maxRetries,abortSignal:r?.abortSignal});if(c.ok)return{data:c.body,rawResponse:c.rawResponse};if(c.error.reason==="status-code")switch(c.error.statusCode){case 422:throw new yE(c.error.body,c.rawResponse);default:throw new Jp({statusCode:c.error.statusCode,body:c.error.body,rawResponse:c.rawResponse})}switch(c.error.reason){case"non-json":throw new Jp({statusCode:c.error.statusCode,body:c.error.rawBody,rawResponse:c.rawResponse});case"timeout":throw new ww("Timeout exceeded when calling GET /slack/get-install/{integration_id}.");case"unknown":throw new Jp({message:c.error.errorMessage,rawResponse:c.rawResponse})}})}_getAuthorizationHeader(){return ABi(this,void 0,void 0,function*(){let t=yield my.get(this._options.token);if(t!=null)return`Bearer ${t}`})}};var FFu=class{constructor(t={}){this._options=Object.assign(Object.assign({},t),{headers:Hw({"X-Fern-Language":"JavaScript","X-Fern-SDK-Name":"@fern-api/fai-sdk","X-Fern-SDK-Version":"0.0.1-fd71fc3bb","X-Fern-Runtime":w0l.type,"X-Fern-Runtime-Version":w0l.version},t?.headers)})}get analytics(){var t;return(t=this._analytics)!==null&&t!==void 0?t:this._analytics=new j0l(this._options)}get chat(){var t;return(t=this._chat)!==null&&t!==void 0?t:this._chat=new E0l(this._options)}get conversation(){var t;return(t=this._conversation)!==null&&t!==void 0?t:this._conversation=new S0l(this._options)}get discord(){var t;return(t=this._discord)!==null&&t!==void 0?t:this._discord=new D0l(this._options)}get document(){var t;return(t=this._document)!==null&&t!==void 0?t:this._document=new C0l(this._options)}get feedback(){var t;return(t=this._feedback)!==null&&t!==void 0?t:this._feedback=new I0l(this._options)}get github(){var t;return(t=this._github)!==null&&t!==void 0?t:this._github=new M0l(this._options)}get guidance(){var t;return(t=this._guidance)!==null&&t!==void 0?t:this._guidance=new B0l(this._options)}get health(){var t;return(t=this._health)!==null&&t!==void 0?t:this._health=new T0l(this._options)}get index(){var t;return(t=this._index)!==null&&t!==void 0?t:this._index=new R0l(this._options)}get mcp(){var t;return(t=this._mcp)!==null&&t!==void 0?t:this._mcp=new N0l(this._options)}get query(){var t;return(t=this._query)!==null&&t!==void 0?t:this._query=new F0l(this._options)}get settings(){var t;return(t=this._settings)!==null&&t!==void 0?t:this._settings=new x0l(this._options)}get slack(){var t;return(t=this._slack)!==null&&t!==void 0?t:this._slack=new z0l(this._options)}};function y9E({token:e}){return new FFu({baseUrl:"https://fai.buildwithfern.com",token:e})}var rVE=fa(tVE(),1);var nVE=require("util"),fZQ=(0,nVE.promisify)(rVE.default);async function iVE(e,t,r){let n=JUo(e,t),i=[];for(let a of n){let o=await Promise.all(a.map(async c=>{try{let d=await fZQ(c);return d==null||d.height==null||d.width==null?void 0:{filePath:c,width:d.width,height:d.height,blurDataUrl:void 0}}catch(d){r.logger.error(`Failed to measure image size for ${c}. ${d?.message}`);return}}));i.push(...o.filter(Zw))}return new Map(i.map(a=>[a.filePath,a]))}var dZQ=10,aVE=10;async function lVE({token:e,organization:t,docsWorkspace:r,domain:n,customDomains:i,apiWorkspaces:a,ossWorkspaces:o,context:c,preview:d,editThisPage:s,isPrivate:u=!1,disableTemplates:l=!1}){let m=Bua({token:e.value}),A=u?{type:"private",authType:"sso"}:{type:"public"},P,C=i[0]??n,M=pZQ(n),T=r.config.experimental?.dynamicSnippets,z=d||T,R=await new MRr(n,r,o,a,c,s,async $=>{let re=new Map($.map(ve=>[ve.absoluteFilePath,ve])),te=$.map(ve=>({...ve,mediaType:cL_.lookup(ve.absoluteFilePath)})).filter(ve=>ve.mediaType!==!1).filter(ve=>z7.parse(ve.mediaType)?.isImage()??!1).map(ve=>ve.absoluteFilePath),ne=await iVE(te,dZQ,c),Oe=[];[...ne.values()].forEach(ve=>{let be=re.get(ve.filePath);if(be==null)return;let Me={filePath:Iyi.FernRegistry.docs.v1.write.FilePath(zas(be.relativeFilePath)),width:ve.width,height:ve.height,blurDataUrl:ve.blurDataUrl,alt:void 0};Oe.push(Me)});let ge=$.filter(({absoluteFilePath:ve})=>!ne.has(ve)).map(({relativeFilePath:ve})=>zas(ve));if(d){let ve=await m.docs.v2.write.startDocsPreviewRegister({orgId:Iyi.FernRegistry.OrgId(t),authConfig:u?{type:"private",authType:"sso"}:{type:"public"},filepaths:ge.map(be=>Iyi.FernRegistry.docs.v1.write.FilePath(be)),images:Oe,basePath:M});return ve.ok?(C=ve.body.previewUrl,P=ve.body.docsRegistrationId,await oVE(ve.body.uploadUrls,r.absoluteFilePath,c,aVE),uVE(ve.body.uploadUrls,r.absoluteFilePath)):await sVE(ve.error,c)}else{let ve=await m.docs.v2.write.startDocsRegister({domain:n,customDomains:i,authConfig:A,apiId:Iyi.FernRegistry.ApiId(""),orgId:Iyi.FernRegistry.OrgId(t),filepaths:ge.map(be=>Iyi.FernRegistry.docs.v1.write.FilePath(be)),images:Oe});return ve.ok?(P=ve.body.docsRegistrationId,await oVE(ve.body.uploadUrls,r.absoluteFilePath,c,aVE),uVE(ve.body.uploadUrls,r.absoluteFilePath)):sVE(ve.error,c)}},async({ir:$,snippetsConfig:re,playgroundConfig:Y,apiName:te,workspace:ne})=>{let Oe=DIe({ir:$,snippetsConfig:re,playgroundConfig:Y,context:c}),ge;T&&(ge=await _ZQ({workspace:ne,organization:t,context:c,snippetsConfig:re}));let ve=await m.api.v1.register.registerApiDefinition({orgId:Iyi.FernRegistry.OrgId(t),apiId:Iyi.FernRegistry.ApiId($.apiName.originalName),definition:Oe,definitionV2:void 0,dynamicIRs:ge});if(ve.ok)return c.logger.debug(`Registered API Definition ${ve.body.apiDefinitionId}`),ve.body.dynamicIRs&&ge&&await hZQ({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
|
|
3038
3038
|
${JSON.stringify(ve.error)}`):c.failAndThrow(`Failed to publish docs because API definition could not be uploaded. Please contact support@buildwithfern.com
|
|
3039
|
-
${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(Iyi.FernRegistry.docs.v1.write.DocsRegistrationId(P),{docsDefinition:R});if(V.ok){let $=Hwe(C);await yZQ({docsDefinition:R,organization:t,token:e,url:$.replace("https://",""),context:c,fdr:m});let re=mBi($,$);c.logger.info(bd.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 oVE(e,t,r,n){let i=Date.now(),a=Object.keys(e).length;r.logger.debug(`Start uploading ${a} files...`);let o=JUo(Object.entries(e),n),c=0;for(let s of o){await Promise.all(s.map(async([l,{uploadUrl:m}])=>{let A=ys.of(l),P=A1(t,A);try{let C=cL_.lookup(P);await tZ.put(m,await(0,cVE.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 u=Date.now();c+=s.length,r.logger.debug(`Uploaded ${c}/${a} files in ${u-i}ms`)}let d=Date.now();r.logger.debug(`Finished uploading ${a} files in ${d-i}ms`)}function uVE(e,t){let r=[];for(let[n,i]of Object.entries(e)){let a=ys.of(n),o=A1(t,a);r.push({relativeFilePath:a,absoluteFilePath:o,fileId:i.fileId})}return r}async function sVE(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 pZQ(e){try{return new URL(Hwe(e)).pathname}catch{return}}async function _ZQ({workspace:e,organization:t,context:r,snippetsConfig:n}){let i={};if(!e)return;Object.keys(n).length===0&&(r.logger.warn(`WARNING: No snippets defined for ${e.workspaceName}.`),r.logger.warn("Did you add snippets to your docs configuration?"),r.logger.warn("For more info: https://buildwithfern.com/learn/docs/api-references/sdk-snippets"));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 d=h0l({apiName:e.workspaceName??"",organization:t,generatorInvocation:c}),s="";if(d?.outputConfig.type==="publish")switch(d.outputConfig.value.type){case"npm":case"nuget":case"pypi":case"rubygems":s=d.outputConfig.value.packageName;break;case"maven":s=d.outputConfig.value.coordinate;break;case"go":s=d.outputConfig.value.repoUrl;break}if(c.language==="php"&&c.config&&typeof c.config=="object"&&"packageName"in c.config&&(s=c.config.packageName??""),!!c.language&&c.language&&a[c.language]===s){let u=qH({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:s,version:void 0,context:r,sourceResolver:new BH(r,e),dynamicGeneratorConfig:d}),l=Gnu({ir:u,disableExamples:!0,smartCasing:c.smartCasing,generationLanguage:c.language,generatorConfig:d});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 hZQ({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 yZQ({docsDefinition:e,organization:t,token:r,url:n,context:i,fdr:a}){if(e.config.aiChatConfig==null)return;i.logger.debug("Processing AI Chat configuration from docs.yml");let o=new URL(Hwe(n)).hostname;if(e.config.aiChatConfig.location!=null){for(let c of e.config.aiChatConfig.location)if(c==="docs"){let d=y9E({token:r.value}),s=await d.settings.getDocsSettings({domain:o});if(s.job_id)continue;s.ask_ai_enabled?i.logger.debug("Starting Ask Fern docs content reindexing..."):(i.logger.debug("Starting Ask Fern docs content indexing..."),(await a.docs.v2.write.addAlgoliaPreviewWhitelistEntry({domain:o})).ok?(await d.settings.toggleAskAi({domain:o,org_name:t})).success&&(i.logger.debug("Turned on Ask Fern for docs domain."),i.logger.info(bd.green("Note: it may take a few minutes after publishing for Ask Fern to show up on your docs."))):i.logger.warn(`Failed to add domain ${o} to Algolia whitelist. Please try regenerating to test AI chat in preview.`))}}}async function lL_({organization:e,apiWorkspaces:t,ossWorkspaces:r,docsWorkspace:n,context:i,token:a,instanceUrl:o,preview:c,disableTemplates:d}){let s=n.config.instances;if(n.config=xxi(n.config,{onError:m=>i.failAndThrow(m)},{substituteAsEmpty:c}),s.length===0){i.failAndThrow("No instances specified in docs.yml! Cannot register docs.");return}if(s.length>1&&o==null){i.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${s[0]?.url})`);return}let u=s.find(m=>m.url===o)??s[0];if(u==null){i.failAndThrow(`No docs instance with url ${o}. Failed to register.`);return}let l=[];u.customDomain!=null&&(typeof u.customDomain=="string"?l.push(u.customDomain):Array.isArray(u.customDomain)&&l.push(...u.customDomain)),await i.runInteractiveTask({name:u.url},async()=>{await lVE({docsWorkspace:n,customDomains:l,domain:u.url,token:a,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:c,editThisPage:u.editThisPage,isPrivate:u.private,disableTemplates:d})})}var fWE=fa(h6i(),1);var Rhe={RequestReference:"requestReference",InlinedRequestProperty:"inlinedRequestProperty",Response:"response",StreamingResponse:"streamingResponse"};function oL(e,t){return r=>{r!=null&&e.docs?.(r,[...t,"docs"])}}function tDr({example:e,visitor:t,nodePath:r}){if(typeof e=="string")e.startsWith("$")&&t.exampleTypeReference?.(e,r);else if(Zq(e))for(let n of Object.values(e))tDr({example:n,visitor:t,nodePath:r});else if(Array.isArray(e))for(let n of e)tDr({example:n,visitor:t,nodePath:r})}function Wzr(e){return(t,r,{_default:n,validation:i,location:a}={})=>{e.typeReference?.({typeReference:t,_default:n,validation:i,location:a,nodePath:r},r)}}function fVE({service:e,visitor:t,nodePath:r}){t.httpService?.(e,r),rN(e,{url:n=>{t.serviceBaseUrl?.(n,[...r,"url"])},"base-path":Hc,"display-name":Hc,availability:Hc,headers:n=>{dVE({headers:n,visitor:t,nodePath:[...r,"headers"]})},audiences:Hc,auth:Hc,"path-parameters":n=>{QFu({pathParameters:n,visitor:t,nodePath:[...r,"path-parameters"]})},endpoints:n=>{for(let[i,a]of Object.entries(n)){let o=[...r,"endpoints",i];vZQ({endpointId:i,endpoint:a,service:e,visitor:t,nodePathForEndpoint:o})}},idempotent:Hc,transport:Hc,source:Hc})}function vZQ({endpointId:e,endpoint:t,service:r,visitor:n,nodePathForEndpoint:i}){let a=Wzr(n);n.httpEndpoint?.({endpointId:e,endpoint:t,service:r},i),rN(t,{docs:oL(n,i),"display-name":Hc,availability:Hc,"base-path":Hc,path:Hc,idempotent:Hc,url:o=>{n.endpointBaseUrl?.({baseUrl:o,service:r},[...i,"url"])},"path-parameters":o=>{QFu({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}rN(o,{name:Hc,docs:oL(n,c),"path-parameters":d=>{QFu({pathParameters:d,visitor:n,nodePath:[...c,"path-parameters"]})},"query-parameters":d=>{if(d!=null)for(let[s,u]of Object.entries(d)){let l=[...c,"query-parameters",s];n.queryParameter?.({queryParameterKey:s,queryParameter:u},l),typeof u=="string"?a(u,l):rN(u,{name:Hc,docs:oL(n,l),availability:Hc,type:m=>{a(m,[...l,"type"],{_default:u.default,validation:u.validation})},"allow-multiple":Hc,audiences:Hc,encoding:Hc,default:Hc,validation:Hc})}},"content-type":Hc,headers:d=>{dVE({headers:d,visitor:n,nodePath:[...c,"headers"]})},body:d=>{if(d==null)return;let s=[...c,"body"];typeof d=="string"?a(d,s,{location:"requestReference"}):s9(d)?(n.typeDeclaration?.({typeName:{isInlined:!0,location:"inlinedRequest"},declaration:d},s),rN(d,{extends:u=>{if(u==null)return;let l=typeof u=="string"?[u]:u;for(let m of l){let A=[...s,"extends",m];n.extension?.(m,A),a(m,A)}},properties:u=>{if(u!=null)for(let[l,m]of Object.entries(u)){let A=[...s,"properties",l];typeof m=="string"?a(m,A,{location:Rhe.InlinedRequestProperty}):rN(m,{name:Hc,docs:oL(n,A),availability:Hc,type:P=>{a(P,[...A,"type"],{location:Rhe.InlinedRequestProperty,_default:m.default,validation:m.validation})},style:Hc,"content-type":Hc,audiences:Hc,encoding:Hc,default:Hc,validation:Hc})}},"extra-properties":Hc})):(oL(n,s)(d.docs),a(d.type,s))}})},audiences:Hc,method:Hc,auth:Hc,"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:Rhe.StreamingResponse}):a(o.type,[...i,"response-stream"],{location:Rhe.StreamingResponse}))},response:o=>{if(o==null)return;let c=[...i,"response"];typeof o=="string"?a(o,c,{location:Rhe.Response}):rN(o,{docs:oL(n,c),type:d=>{d!=null&&a(d,[...c,"type"],{location:Rhe.Response})},property:Hc,"status-code":Hc})},errors:o=>{if(o!=null)for(let c of o){let d=[...i,"errors",typeof c=="string"?c:c.error];typeof c=="string"?n.errorReference?.(c,d):rN(c,{docs:oL(n,d),error:s=>{n.errorReference?.(s,[...d,"error"])}})}},examples:o=>{if(o!=null)for(let[c,d]of o.entries())bZQ({nodePathForExample:[...i,{key:"examples",arrayIndex:c}],visitor:n,service:r,endpoint:t,example:d})},pagination:Hc,source:Hc,transport:Hc,retries:Hc})}function bZQ({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 u of Object.values(i.headers))tDr({example:u,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 u of Object.values(i["path-parameters"]))tDr({example:u,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 u of Object.values(i["query-parameters"]))tDr({example:u,visitor:t,nodePath:c});let d=[...e,"request"];t.exampleRequest?.({service:r,endpoint:n,example:i.request},d),i.request!=null&&tDr({example:i.request,visitor:t,nodePath:d});let s=[...e,"response"];if(t.exampleResponse?.({service:r,endpoint:n,example:i.response},s),i.response!=null&&sua(n,i.response,{body:u=>{u.body!=null&&tDr({example:u.body,visitor:t,nodePath:s}),u.error!=null&&t.errorReference?.(u.error,[...s,"error"])},stream:u=>{for(let l of u.stream)tDr({example:l,visitor:t,nodePath:s})},events:u=>{for(let{data:l}of u.stream)tDr({example:l,visitor:t,nodePath:s})}}),i["code-samples"]!=null)for(let[u,l]of i["code-samples"].entries())t.exampleCodeSample?.({service:r,endpoint:n,example:i,sample:l},[...e,{key:"code-samples",arrayIndex:u}])}function QFu({pathParameters:e,visitor:t,nodePath:r}){if(e==null)return;let n=Wzr(t);for(let[i,a]of Object.entries(e)){let o=[...r,i];t.pathParameter?.({pathParameterKey:i,pathParameter:a},o),U$a(a)?typeof a=="string"?t.variableReference?.(a,o):rN(a,{docs:oL(t,o),variable:c=>t.variableReference?.(c,[...o,"variable"]),availability:Hc}):typeof a=="string"?n(a,o):rN(a,{docs:oL(t,o),type:c=>{n(c,[...o,"type"],{_default:a.default,validation:a.validation})},availability:Hc,encoding:Hc,default:Hc,validation:Hc,name:Hc,audiences:Hc})}}function dVE({headers:e,visitor:t,nodePath:r}){if(e==null)return;let n=Wzr(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):rN(a,{name:Hc,availability:Hc,type:c=>{n(c,o,{_default:a.default,validation:a.validation})},docs:oL(t,o),audiences:Hc,encoding:Hc,env:Hc,default:Hc,validation:Hc})}}function pVE({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),fL_({typeName:n,declaration:i,visitor:t,nodePathForType:a})}}function fL_({typeName:e,declaration:t,visitor:r,nodePathForType:n}){let i=Wzr(r);r.typeDeclaration?.({typeName:{isInlined:!1,name:e},declaration:t,nodePath:n},n);let a=o=>{if(o!=null)for(let[c,d]of o.entries()){let s=[...n,{key:"examples",arrayIndex:c}];r.exampleType?.({typeName:e,typeDeclaration:t,example:d},s),tDr({example:d.value,nodePath:s,visitor:r})}};mee(t,{alias:o=>{typeof o=="string"?i(o,n):rN(o,{type:c=>{i(c,[...n,"type"])},docs:oL(r,n),availability:Hc,audiences:Hc,examples:a,validation:Hc,encoding:Hc,source:Hc,inline:Hc})},object:o=>{rN(o,{docs:oL(r,n),extends:c=>{if(c==null)return;let d=typeof c=="string"?[c]:c;for(let s of d){let u=[...n,"extends",s];r.extension?.(s,u),i(s,u)}},properties:c=>{if(c!=null)for(let[d,s]of Object.entries(c)){let u=[...n,"properties",d];typeof s=="string"?i(s,u):rN(s,{name:Hc,docs:oL(r,u),availability:Hc,type:l=>{i(l,[...u,"type"],{_default:s.default,validation:s.validation})},audiences:Hc,encoding:Hc,default:Hc,validation:Hc,access:Hc})}},"extra-properties":Hc,availability:Hc,audiences:Hc,encoding:Hc,source:Hc,examples:a,inline:Hc})},discriminatedUnion:o=>{rN(o,{docs:oL(r,n),discriminant:Hc,extends:c=>{if(c==null)return;let d=typeof c=="string"?[c]:c;for(let s of d){let u=[...n,"extends",s];r.extension?.(s,u),i(s,u)}},union:c=>{for(let[d,s]of Object.entries(c)){let u=[...n,"union",d];typeof s=="string"?i(s,u):rN(s,{docs:oL(r,u),name:Hc,key:Hc,type:l=>{typeof l=="string"&&i(l,[...n,"type"])},"display-name":Hc,availability:Hc})}},"base-properties":Hc,availability:Hc,audiences:Hc,encoding:Hc,source:Hc,examples:a,inline:Hc})},undiscriminatedUnion:o=>{rN(o,{docs:oL(r,n),discriminated:Hc,union:c=>{for(let[d,s]of c.entries()){let u=[...n,`union[${d}]`];typeof s!="string"&&rN(s,{docs:oL(r,u),type:l=>{i(l,[...n,"type"])},"display-name":Hc,validation:Hc})}},availability:Hc,audiences:Hc,encoding:Hc,source:Hc,examples:a,inline:Hc})},enum:o=>{rN(o,{docs:oL(r,n),enum:c=>{for(let d of c){let s=[...n,typeof d=="string"?d:d.name??d.value];typeof d!="string"&&rN(d,{docs:oL(r,s),name:Hc,value:Hc,casing:Hc})}},availability:Hc,audiences:Hc,default:Hc,encoding:Hc,source:Hc,examples:a,inline:Hc})}})}function _VE({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),gZQ({errorName:n,declaration:i,visitor:t,nodePathForError:a})}}function gZQ({errorName:e,declaration:t,visitor:r,nodePathForError:n}){let i=Wzr(r);typeof t=="string"?i(t,n):rN(t,{docs:oL(r,n),"status-code":Hc,type:a=>{if(a==null)return;let o=[...n,"type"];typeof a=="string"?i(a,o):fL_({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 hVE({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 yVE({webhook:e,visitor:t,nodePathForWebhook:r}){let n=Wzr(t);rN(e,{"display-name":Hc,method:Hc,examples:Hc,headers:i=>{mZQ({headers:i,visitor:t,nodePath:[...r,"headers"]})},payload:i=>{let a=[...r,"payload"];if(typeof i=="string"){n(i,a,{location:"requestReference"});return}if(OZQ(i)){n(i.type,[...a,"type"],{location:"requestReference"});return}let o=[...a];t.typeDeclaration?.({typeName:{isInlined:!0,location:"inlinedRequest"},declaration:i},o),rN(i,{name:Hc,extends:c=>{if(c==null)return;let d=typeof c=="string"?[c]:c;for(let s of d){let u=[...o,"extends",s];t.extension?.(s,u),n(s,u)}},properties:c=>{if(c!=null)for(let[d,s]of Object.entries(c)){let u=[...o,"properties",d];typeof s=="string"?n(s,u,{location:Rhe.InlinedRequestProperty}):rN(s,{name:Hc,docs:oL(t,u),availability:Hc,type:l=>{n(l,[...u,"type"],{_default:s.default,validation:s.validation,location:Rhe.InlinedRequestProperty})},audiences:Hc,encoding:Hc,default:Hc,validation:Hc,access:Hc})}}})},audiences:Hc,availability:Hc,docs:oL(t,r)})}function mZQ({headers:e,visitor:t,nodePath:r}){if(e==null)return;let n=Wzr(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):rN(a,{name:Hc,availability:Hc,type:c=>{n(c,o,{_default:a.default,validation:a.validation})},docs:oL(t,o),audiences:Hc,encoding:Hc,env:Hc,default:Hc,validation:Hc})}}function OZQ(e){return e.type!=null}function jme(e,t){rN(e,{docs:oL(t,[]),imports:r=>{hVE({imports:r,visitor:t,nodePath:["imports"]})},types:r=>{pVE({typeDeclarations:r,visitor:t,nodePath:["types"]})},service:r=>{r!=null&&fVE({service:r,visitor:t,nodePath:["service"]})},webhooks:r=>{for(let[n,i]of Object.entries(r??{}))yVE({webhook:i,visitor:t,nodePathForWebhook:["webhooks",n]})},channel:Hc,errors:r=>{_VE({errorDeclarations:r,visitor:t,nodePath:["errors"]})}})}function dL_(e,t){rN(e,{docs:Hc,imports:Hc,types:Hc,service:Hc,webhooks:Hc,errors:Hc,channel:Hc,export:r=>{t.export?.(typeof r=="string"?r:r?.dependency,["export"])},navigation:r=>{t.navigation?.(r,["navigation"])}})}function pL_(e,t){t.file?.(e,[]),rN(e,{version:Hc,product:Hc,name:Hc,"default-url":Hc,"display-name":Hc,imports:Hc,auth:Hc,"idempotency-headers":Hc,"auth-schemes":r=>Object.entries(r??{}).map(([n,i])=>{zaf(i)&&t.oauth?.({name:n,oauth:i},["auth-scheme",n])}),pagination:Hc,"default-environment":r=>{t.defaultEnvironment?.(r,["default-environment"])},docs:Hc,headers:Hc,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:Hc,errors:r=>{if(r!=null)for(let n of r)t.errorReference?.(n,["errors",n])},"base-path":Hc,"path-parameters":r=>{QFu({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 yml=new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$");function vVE({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let o=(c,d)=>{for(let s of r){let u=s.definitionFile?.[a];if(u!=null){let l=u(c,{relativeFilepath:e,contents:t});n(l.map(m=>({severity:m.severity,relativeFilepath:e,nodePath:d,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 bVE({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let o=(c,d)=>{for(let s of r){let u=s.packageMarker?.[a];if(u!=null){let l=u(c,{relativeFilepath:e,contents:t});n(l.map(m=>({severity:m.severity,relativeFilepath:e,nodePath:d,message:m.message})))}}};return{[a]:o}}return{...i("export"),...i("navigation")}}function gVE({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let o=(c,d)=>{for(let s of r){let u=s.rootApiFile?.[a];if(u!=null){let l=u(c,{relativeFilepath:e,contents:t});n(l.map(m=>({severity:m.severity,relativeFilepath:e,nodePath:d,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 _L_={name:"content-type-only-for-multipart",DISABLE_RULE:!1,create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{if(e.request==null)return[];if(uua(e.request)!=null)return[];if(typeof e.request!="string"&&e.request.body!=null&&s9(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 Ux=cIe({generationLanguage:void 0,keywords:void 0,smartCasing:!1});var hL_={name:"exploded-form-data-is-array",create:({workspace:e})=>{let t=new OF(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(!AZQ(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 d=YS({relativeFilepath:n,definitionFile:i,casingsGenerator:Ux,rootApiFile:e.definition.rootApiFile.contents}),s=t.resolveType({type:c.type,file:d});if(s==null)return[];mVE(s)||a.push({message:`${o} is exploded and must be a list. Did you mean list<${c.type}>?`,severity:"error"})}return a}}}}};function mVE(e){return e._type!=="container"?!1:e.container._type==="list"?!0:e.container._type==="optional"||e.container._type==="nullable"?mVE(e.container.itemType):!1}function AZQ(e){return e?.properties!=null}var yL_={name:"import-file-exists",create:({workspace:e})=>{let t=Object.keys(TPi(e.definition)),r=new Set;return t.forEach(n=>{let i=Jl(e.definition.absoluteFilePath,ys.of(n));r.add(i)}),{definitionFile:{import:({importedAs:n,importPath:i},{relativeFilepath:a})=>{let o=[],c=Jl(e.definition.absoluteFilePath,Ug(a),ys.of(i));return r.has(c)||o.push({severity:"fatal",message:`Import ${bd.bold(n)} points to non-existent path ${bd.bold(i)}.`}),o}}}}};function vml(e){return e.definition.rootApiFile.contents.environments==null?[]:Object.values(e.definition.rootApiFile.contents.environments).reduce((t,r)=>{if(vnt(r))for(let n of Object.keys(r.urls))t.includes(n)||t.push(n);return t},[])}var vL_={name:"matching-environment-urls",create:({workspace:e})=>{let t=vml(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 ${bd.bold(o)}`})};return MLr(n,{singleBaseUrl:()=>{for(let o of t)a(o)},multipleBaseUrls:o=>{for(let c of t)o.urls[c]==null&&a(c)}}),i}}}}};var bL_={name:"no-circular-imports",DISABLE_RULE:!0,create:({workspace:e})=>{let t=PZQ(e.definition.namedDefinitionFiles);return{definitionFile:{import:({importPath:r},{relativeFilepath:n})=>{let i=t[n];if(i==null)return[];let a=G8i({referencedIn:n,importPath:ys.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 PZQ(e){let t={};for(let r of VBr(e))t[r]=OVE(r,[r],e);return t}function OVE(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=G8i({referencedIn:e,importPath:ys.of(a)});t.includes(o)?t[0]===o&&t[0]===wZQ(t)&&n.push({startingFilepath:o,chainWithoutStartingFilepath:t.slice(1)}):n.push(...OVE(o,[...t,o],r))}return n}function wZQ(e){return e.reduce((t,r)=>r<t?r:t)}var bml=class{workspace;typeResolver;constructor(t){this.workspace=t,this.typeResolver=new OF(t)}isTypeComplex(t,r){let n=YS({relativeFilepath:r.relativeFilepath,definitionFile:r.contents,casingsGenerator:Ux,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:tc(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:tc(t)}}isNamedTypeComplex({type:t,file:r,visited:n}){if(n.has(t.rawName))return!1;if(n.add(t.rawName),Kzi(t.declaration))return!0;if(CTr(t.declaration))return!1;if(bx(t.declaration))return this.objectHasComplexProperties({typeName:t.rawName,objectDeclaration:t.declaration,file:r,visited:n});if(V$a(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}tc(t.declaration)}objectHasComplexProperties({typeName:t,objectDeclaration:r,file:n,visited:i}){return CRr({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:tc(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:tc(t)}}};var gL_={name:"no-complex-query-params",create:({workspace:e})=>{let t=new bml(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 mL_={name:"no-conflicting-endpoint-parameters",create:()=>({definitionFile:{pathParameter:({pathParameterKey:e})=>e===L9s?[{severity:"fatal",message:`Path parameter ${bd.bold(e)} is not suitable for code generation, because it can conflict with the request body parameter.`}]:[]}})};function LFu({service:e,endpoint:t}){return e["base-path"]+t.path}var gml=class{root=new OL_;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 LFu({service:t.service,endpoint:t.endpoint}).split("/").filter(r=>r.length>0)}},OL_=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 AL_={name:"no-conflicting-endpoint-paths",create:({workspace:e})=>{let t=new gml;return Qee(e,(r,n)=>{jme(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 ${LFu({service:r,endpoint:n})} conflicts with other endpoints:`,...o.map(c=>` - ${c.relativeFilepath} -> ${c.endpointId} ${bd.dim(LFu({service:c.service,endpoint:c.endpoint}))}`)].join(`
|
|
3039
|
+
${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(Iyi.FernRegistry.docs.v1.write.DocsRegistrationId(P),{docsDefinition:R});if(V.ok){let $=Hwe(C);await yZQ({docsDefinition:R,organization:t,token:e,url:$.replace("https://",""),context:c,fdr:m});let re=mBi($,$);c.logger.info(bd.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 oVE(e,t,r,n){let i=Date.now(),a=Object.keys(e).length;r.logger.debug(`Start uploading ${a} files...`);let o=JUo(Object.entries(e),n),c=0;for(let s of o){await Promise.all(s.map(async([l,{uploadUrl:m}])=>{let A=ys.of(l),P=A1(t,A);try{let C=cL_.lookup(P);await tZ.put(m,await(0,cVE.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 u=Date.now();c+=s.length,r.logger.debug(`Uploaded ${c}/${a} files in ${u-i}ms`)}let d=Date.now();r.logger.debug(`Finished uploading ${a} files in ${d-i}ms`)}function uVE(e,t){let r=[];for(let[n,i]of Object.entries(e)){let a=ys.of(n),o=A1(t,a);r.push({relativeFilePath:a,absoluteFilePath:o,fileId:i.fileId})}return r}async function sVE(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 pZQ(e){try{return new URL(Hwe(e)).pathname}catch{return}}async function _ZQ({workspace:e,organization:t,context:r,snippetsConfig:n}){let i={};if(!e)return;Object.keys(n).length===0&&(r.logger.warn(`WARNING: No snippets defined for ${e.workspaceName}.`),r.logger.warn("Did you add snippets to your docs configuration?"),r.logger.warn("For more info: https://buildwithfern.com/learn/docs/api-references/sdk-snippets"));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 d=h0l({apiName:e.workspaceName??"",organization:t,generatorInvocation:c}),s="";if(d?.outputConfig.type==="publish")switch(d.outputConfig.value.type){case"npm":case"nuget":case"pypi":case"rubygems":s=d.outputConfig.value.packageName;break;case"maven":s=d.outputConfig.value.coordinate;break;case"go":s=d.outputConfig.value.repoUrl;break}if(c.language==="php"&&c.config&&typeof c.config=="object"&&"packageName"in c.config&&(s=c.config.packageName??""),!!c.language&&c.language&&a[c.language]===s){let u=qH({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:s,version:void 0,context:r,sourceResolver:new BH(r,e),dynamicGeneratorConfig:d}),l=Gnu({ir:u,disableExamples:!0,smartCasing:c.smartCasing,generationLanguage:c.language,generatorConfig:d});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 hZQ({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 yZQ({docsDefinition:e,organization:t,token:r,url:n,context:i,fdr:a}){if(e.config.aiChatConfig==null)return;i.logger.debug("Processing AI Chat configuration from docs.yml");let o=new URL(Hwe(n)).hostname;if(e.config.aiChatConfig.location!=null){for(let c of e.config.aiChatConfig.location)if(c==="docs"){let d=y9E({token:r.value}),s=await d.settings.getDocsSettings({domain:o});if(s.job_id)continue;i.logger.debug(`Starting Ask Fern docs content ${s.ask_ai_enabled?"reindexing":"indexing"}...`),(await a.docs.v2.write.addAlgoliaPreviewWhitelistEntry({domain:o})).ok?(s.ask_ai_enabled?await d.settings.reindexAskAi({domain:o,org_name:t}):await d.settings.toggleAskAi({domain:o,org_name:t})).success&&i.logger.info(bd.green("Note: it may take a few minutes after publishing for Ask Fern answers to reflect new content.")):i.logger.warn(`Failed to add domain ${o} to Algolia whitelist. Please try regenerating to test AI chat in preview.`)}}}async function lL_({organization:e,apiWorkspaces:t,ossWorkspaces:r,docsWorkspace:n,context:i,token:a,instanceUrl:o,preview:c,disableTemplates:d}){let s=n.config.instances;if(n.config=xxi(n.config,{onError:m=>i.failAndThrow(m)},{substituteAsEmpty:c}),s.length===0){i.failAndThrow("No instances specified in docs.yml! Cannot register docs.");return}if(s.length>1&&o==null){i.failAndThrow(`More than one docs instances. Please specify one (e.g. --instance ${s[0]?.url})`);return}let u=s.find(m=>m.url===o)??s[0];if(u==null){i.failAndThrow(`No docs instance with url ${o}. Failed to register.`);return}let l=[];u.customDomain!=null&&(typeof u.customDomain=="string"?l.push(u.customDomain):Array.isArray(u.customDomain)&&l.push(...u.customDomain)),await i.runInteractiveTask({name:u.url},async()=>{await lVE({docsWorkspace:n,customDomains:l,domain:u.url,token:a,organization:e,context:i,apiWorkspaces:t,ossWorkspaces:r,preview:c,editThisPage:u.editThisPage,isPrivate:u.private,disableTemplates:d})})}var fWE=fa(h6i(),1);var Rhe={RequestReference:"requestReference",InlinedRequestProperty:"inlinedRequestProperty",Response:"response",StreamingResponse:"streamingResponse"};function oL(e,t){return r=>{r!=null&&e.docs?.(r,[...t,"docs"])}}function tDr({example:e,visitor:t,nodePath:r}){if(typeof e=="string")e.startsWith("$")&&t.exampleTypeReference?.(e,r);else if(Zq(e))for(let n of Object.values(e))tDr({example:n,visitor:t,nodePath:r});else if(Array.isArray(e))for(let n of e)tDr({example:n,visitor:t,nodePath:r})}function Wzr(e){return(t,r,{_default:n,validation:i,location:a}={})=>{e.typeReference?.({typeReference:t,_default:n,validation:i,location:a,nodePath:r},r)}}function fVE({service:e,visitor:t,nodePath:r}){t.httpService?.(e,r),rN(e,{url:n=>{t.serviceBaseUrl?.(n,[...r,"url"])},"base-path":Hc,"display-name":Hc,availability:Hc,headers:n=>{dVE({headers:n,visitor:t,nodePath:[...r,"headers"]})},audiences:Hc,auth:Hc,"path-parameters":n=>{QFu({pathParameters:n,visitor:t,nodePath:[...r,"path-parameters"]})},endpoints:n=>{for(let[i,a]of Object.entries(n)){let o=[...r,"endpoints",i];vZQ({endpointId:i,endpoint:a,service:e,visitor:t,nodePathForEndpoint:o})}},idempotent:Hc,transport:Hc,source:Hc})}function vZQ({endpointId:e,endpoint:t,service:r,visitor:n,nodePathForEndpoint:i}){let a=Wzr(n);n.httpEndpoint?.({endpointId:e,endpoint:t,service:r},i),rN(t,{docs:oL(n,i),"display-name":Hc,availability:Hc,"base-path":Hc,path:Hc,idempotent:Hc,url:o=>{n.endpointBaseUrl?.({baseUrl:o,service:r},[...i,"url"])},"path-parameters":o=>{QFu({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}rN(o,{name:Hc,docs:oL(n,c),"path-parameters":d=>{QFu({pathParameters:d,visitor:n,nodePath:[...c,"path-parameters"]})},"query-parameters":d=>{if(d!=null)for(let[s,u]of Object.entries(d)){let l=[...c,"query-parameters",s];n.queryParameter?.({queryParameterKey:s,queryParameter:u},l),typeof u=="string"?a(u,l):rN(u,{name:Hc,docs:oL(n,l),availability:Hc,type:m=>{a(m,[...l,"type"],{_default:u.default,validation:u.validation})},"allow-multiple":Hc,audiences:Hc,encoding:Hc,default:Hc,validation:Hc})}},"content-type":Hc,headers:d=>{dVE({headers:d,visitor:n,nodePath:[...c,"headers"]})},body:d=>{if(d==null)return;let s=[...c,"body"];typeof d=="string"?a(d,s,{location:"requestReference"}):s9(d)?(n.typeDeclaration?.({typeName:{isInlined:!0,location:"inlinedRequest"},declaration:d},s),rN(d,{extends:u=>{if(u==null)return;let l=typeof u=="string"?[u]:u;for(let m of l){let A=[...s,"extends",m];n.extension?.(m,A),a(m,A)}},properties:u=>{if(u!=null)for(let[l,m]of Object.entries(u)){let A=[...s,"properties",l];typeof m=="string"?a(m,A,{location:Rhe.InlinedRequestProperty}):rN(m,{name:Hc,docs:oL(n,A),availability:Hc,type:P=>{a(P,[...A,"type"],{location:Rhe.InlinedRequestProperty,_default:m.default,validation:m.validation})},style:Hc,"content-type":Hc,audiences:Hc,encoding:Hc,default:Hc,validation:Hc})}},"extra-properties":Hc})):(oL(n,s)(d.docs),a(d.type,s))}})},audiences:Hc,method:Hc,auth:Hc,"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:Rhe.StreamingResponse}):a(o.type,[...i,"response-stream"],{location:Rhe.StreamingResponse}))},response:o=>{if(o==null)return;let c=[...i,"response"];typeof o=="string"?a(o,c,{location:Rhe.Response}):rN(o,{docs:oL(n,c),type:d=>{d!=null&&a(d,[...c,"type"],{location:Rhe.Response})},property:Hc,"status-code":Hc})},errors:o=>{if(o!=null)for(let c of o){let d=[...i,"errors",typeof c=="string"?c:c.error];typeof c=="string"?n.errorReference?.(c,d):rN(c,{docs:oL(n,d),error:s=>{n.errorReference?.(s,[...d,"error"])}})}},examples:o=>{if(o!=null)for(let[c,d]of o.entries())bZQ({nodePathForExample:[...i,{key:"examples",arrayIndex:c}],visitor:n,service:r,endpoint:t,example:d})},pagination:Hc,source:Hc,transport:Hc,retries:Hc})}function bZQ({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 u of Object.values(i.headers))tDr({example:u,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 u of Object.values(i["path-parameters"]))tDr({example:u,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 u of Object.values(i["query-parameters"]))tDr({example:u,visitor:t,nodePath:c});let d=[...e,"request"];t.exampleRequest?.({service:r,endpoint:n,example:i.request},d),i.request!=null&&tDr({example:i.request,visitor:t,nodePath:d});let s=[...e,"response"];if(t.exampleResponse?.({service:r,endpoint:n,example:i.response},s),i.response!=null&&sua(n,i.response,{body:u=>{u.body!=null&&tDr({example:u.body,visitor:t,nodePath:s}),u.error!=null&&t.errorReference?.(u.error,[...s,"error"])},stream:u=>{for(let l of u.stream)tDr({example:l,visitor:t,nodePath:s})},events:u=>{for(let{data:l}of u.stream)tDr({example:l,visitor:t,nodePath:s})}}),i["code-samples"]!=null)for(let[u,l]of i["code-samples"].entries())t.exampleCodeSample?.({service:r,endpoint:n,example:i,sample:l},[...e,{key:"code-samples",arrayIndex:u}])}function QFu({pathParameters:e,visitor:t,nodePath:r}){if(e==null)return;let n=Wzr(t);for(let[i,a]of Object.entries(e)){let o=[...r,i];t.pathParameter?.({pathParameterKey:i,pathParameter:a},o),U$a(a)?typeof a=="string"?t.variableReference?.(a,o):rN(a,{docs:oL(t,o),variable:c=>t.variableReference?.(c,[...o,"variable"]),availability:Hc}):typeof a=="string"?n(a,o):rN(a,{docs:oL(t,o),type:c=>{n(c,[...o,"type"],{_default:a.default,validation:a.validation})},availability:Hc,encoding:Hc,default:Hc,validation:Hc,name:Hc,audiences:Hc})}}function dVE({headers:e,visitor:t,nodePath:r}){if(e==null)return;let n=Wzr(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):rN(a,{name:Hc,availability:Hc,type:c=>{n(c,o,{_default:a.default,validation:a.validation})},docs:oL(t,o),audiences:Hc,encoding:Hc,env:Hc,default:Hc,validation:Hc})}}function pVE({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),fL_({typeName:n,declaration:i,visitor:t,nodePathForType:a})}}function fL_({typeName:e,declaration:t,visitor:r,nodePathForType:n}){let i=Wzr(r);r.typeDeclaration?.({typeName:{isInlined:!1,name:e},declaration:t,nodePath:n},n);let a=o=>{if(o!=null)for(let[c,d]of o.entries()){let s=[...n,{key:"examples",arrayIndex:c}];r.exampleType?.({typeName:e,typeDeclaration:t,example:d},s),tDr({example:d.value,nodePath:s,visitor:r})}};mee(t,{alias:o=>{typeof o=="string"?i(o,n):rN(o,{type:c=>{i(c,[...n,"type"])},docs:oL(r,n),availability:Hc,audiences:Hc,examples:a,validation:Hc,encoding:Hc,source:Hc,inline:Hc})},object:o=>{rN(o,{docs:oL(r,n),extends:c=>{if(c==null)return;let d=typeof c=="string"?[c]:c;for(let s of d){let u=[...n,"extends",s];r.extension?.(s,u),i(s,u)}},properties:c=>{if(c!=null)for(let[d,s]of Object.entries(c)){let u=[...n,"properties",d];typeof s=="string"?i(s,u):rN(s,{name:Hc,docs:oL(r,u),availability:Hc,type:l=>{i(l,[...u,"type"],{_default:s.default,validation:s.validation})},audiences:Hc,encoding:Hc,default:Hc,validation:Hc,access:Hc})}},"extra-properties":Hc,availability:Hc,audiences:Hc,encoding:Hc,source:Hc,examples:a,inline:Hc})},discriminatedUnion:o=>{rN(o,{docs:oL(r,n),discriminant:Hc,extends:c=>{if(c==null)return;let d=typeof c=="string"?[c]:c;for(let s of d){let u=[...n,"extends",s];r.extension?.(s,u),i(s,u)}},union:c=>{for(let[d,s]of Object.entries(c)){let u=[...n,"union",d];typeof s=="string"?i(s,u):rN(s,{docs:oL(r,u),name:Hc,key:Hc,type:l=>{typeof l=="string"&&i(l,[...n,"type"])},"display-name":Hc,availability:Hc})}},"base-properties":Hc,availability:Hc,audiences:Hc,encoding:Hc,source:Hc,examples:a,inline:Hc})},undiscriminatedUnion:o=>{rN(o,{docs:oL(r,n),discriminated:Hc,union:c=>{for(let[d,s]of c.entries()){let u=[...n,`union[${d}]`];typeof s!="string"&&rN(s,{docs:oL(r,u),type:l=>{i(l,[...n,"type"])},"display-name":Hc,validation:Hc})}},availability:Hc,audiences:Hc,encoding:Hc,source:Hc,examples:a,inline:Hc})},enum:o=>{rN(o,{docs:oL(r,n),enum:c=>{for(let d of c){let s=[...n,typeof d=="string"?d:d.name??d.value];typeof d!="string"&&rN(d,{docs:oL(r,s),name:Hc,value:Hc,casing:Hc})}},availability:Hc,audiences:Hc,default:Hc,encoding:Hc,source:Hc,examples:a,inline:Hc})}})}function _VE({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),gZQ({errorName:n,declaration:i,visitor:t,nodePathForError:a})}}function gZQ({errorName:e,declaration:t,visitor:r,nodePathForError:n}){let i=Wzr(r);typeof t=="string"?i(t,n):rN(t,{docs:oL(r,n),"status-code":Hc,type:a=>{if(a==null)return;let o=[...n,"type"];typeof a=="string"?i(a,o):fL_({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 hVE({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 yVE({webhook:e,visitor:t,nodePathForWebhook:r}){let n=Wzr(t);rN(e,{"display-name":Hc,method:Hc,examples:Hc,headers:i=>{mZQ({headers:i,visitor:t,nodePath:[...r,"headers"]})},payload:i=>{let a=[...r,"payload"];if(typeof i=="string"){n(i,a,{location:"requestReference"});return}if(OZQ(i)){n(i.type,[...a,"type"],{location:"requestReference"});return}let o=[...a];t.typeDeclaration?.({typeName:{isInlined:!0,location:"inlinedRequest"},declaration:i},o),rN(i,{name:Hc,extends:c=>{if(c==null)return;let d=typeof c=="string"?[c]:c;for(let s of d){let u=[...o,"extends",s];t.extension?.(s,u),n(s,u)}},properties:c=>{if(c!=null)for(let[d,s]of Object.entries(c)){let u=[...o,"properties",d];typeof s=="string"?n(s,u,{location:Rhe.InlinedRequestProperty}):rN(s,{name:Hc,docs:oL(t,u),availability:Hc,type:l=>{n(l,[...u,"type"],{_default:s.default,validation:s.validation,location:Rhe.InlinedRequestProperty})},audiences:Hc,encoding:Hc,default:Hc,validation:Hc,access:Hc})}}})},audiences:Hc,availability:Hc,docs:oL(t,r)})}function mZQ({headers:e,visitor:t,nodePath:r}){if(e==null)return;let n=Wzr(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):rN(a,{name:Hc,availability:Hc,type:c=>{n(c,o,{_default:a.default,validation:a.validation})},docs:oL(t,o),audiences:Hc,encoding:Hc,env:Hc,default:Hc,validation:Hc})}}function OZQ(e){return e.type!=null}function jme(e,t){rN(e,{docs:oL(t,[]),imports:r=>{hVE({imports:r,visitor:t,nodePath:["imports"]})},types:r=>{pVE({typeDeclarations:r,visitor:t,nodePath:["types"]})},service:r=>{r!=null&&fVE({service:r,visitor:t,nodePath:["service"]})},webhooks:r=>{for(let[n,i]of Object.entries(r??{}))yVE({webhook:i,visitor:t,nodePathForWebhook:["webhooks",n]})},channel:Hc,errors:r=>{_VE({errorDeclarations:r,visitor:t,nodePath:["errors"]})}})}function dL_(e,t){rN(e,{docs:Hc,imports:Hc,types:Hc,service:Hc,webhooks:Hc,errors:Hc,channel:Hc,export:r=>{t.export?.(typeof r=="string"?r:r?.dependency,["export"])},navigation:r=>{t.navigation?.(r,["navigation"])}})}function pL_(e,t){t.file?.(e,[]),rN(e,{version:Hc,product:Hc,name:Hc,"default-url":Hc,"display-name":Hc,imports:Hc,auth:Hc,"idempotency-headers":Hc,"auth-schemes":r=>Object.entries(r??{}).map(([n,i])=>{zaf(i)&&t.oauth?.({name:n,oauth:i},["auth-scheme",n])}),pagination:Hc,"default-environment":r=>{t.defaultEnvironment?.(r,["default-environment"])},docs:Hc,headers:Hc,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:Hc,errors:r=>{if(r!=null)for(let n of r)t.errorReference?.(n,["errors",n])},"base-path":Hc,"path-parameters":r=>{QFu({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 yml=new RegExp("^[a-zA-Z][a-zA-Z0-9_]*$");function vVE({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let o=(c,d)=>{for(let s of r){let u=s.definitionFile?.[a];if(u!=null){let l=u(c,{relativeFilepath:e,contents:t});n(l.map(m=>({severity:m.severity,relativeFilepath:e,nodePath:d,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 bVE({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let o=(c,d)=>{for(let s of r){let u=s.packageMarker?.[a];if(u!=null){let l=u(c,{relativeFilepath:e,contents:t});n(l.map(m=>({severity:m.severity,relativeFilepath:e,nodePath:d,message:m.message})))}}};return{[a]:o}}return{...i("export"),...i("navigation")}}function gVE({relativeFilepath:e,contents:t,allRuleVisitors:r,addViolations:n}){function i(a){let o=(c,d)=>{for(let s of r){let u=s.rootApiFile?.[a];if(u!=null){let l=u(c,{relativeFilepath:e,contents:t});n(l.map(m=>({severity:m.severity,relativeFilepath:e,nodePath:d,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 _L_={name:"content-type-only-for-multipart",DISABLE_RULE:!1,create:()=>({definitionFile:{httpEndpoint:({endpoint:e})=>{if(e.request==null)return[];if(uua(e.request)!=null)return[];if(typeof e.request!="string"&&e.request.body!=null&&s9(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 Ux=cIe({generationLanguage:void 0,keywords:void 0,smartCasing:!1});var hL_={name:"exploded-form-data-is-array",create:({workspace:e})=>{let t=new OF(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(!AZQ(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 d=YS({relativeFilepath:n,definitionFile:i,casingsGenerator:Ux,rootApiFile:e.definition.rootApiFile.contents}),s=t.resolveType({type:c.type,file:d});if(s==null)return[];mVE(s)||a.push({message:`${o} is exploded and must be a list. Did you mean list<${c.type}>?`,severity:"error"})}return a}}}}};function mVE(e){return e._type!=="container"?!1:e.container._type==="list"?!0:e.container._type==="optional"||e.container._type==="nullable"?mVE(e.container.itemType):!1}function AZQ(e){return e?.properties!=null}var yL_={name:"import-file-exists",create:({workspace:e})=>{let t=Object.keys(TPi(e.definition)),r=new Set;return t.forEach(n=>{let i=Jl(e.definition.absoluteFilePath,ys.of(n));r.add(i)}),{definitionFile:{import:({importedAs:n,importPath:i},{relativeFilepath:a})=>{let o=[],c=Jl(e.definition.absoluteFilePath,Ug(a),ys.of(i));return r.has(c)||o.push({severity:"fatal",message:`Import ${bd.bold(n)} points to non-existent path ${bd.bold(i)}.`}),o}}}}};function vml(e){return e.definition.rootApiFile.contents.environments==null?[]:Object.values(e.definition.rootApiFile.contents.environments).reduce((t,r)=>{if(vnt(r))for(let n of Object.keys(r.urls))t.includes(n)||t.push(n);return t},[])}var vL_={name:"matching-environment-urls",create:({workspace:e})=>{let t=vml(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 ${bd.bold(o)}`})};return MLr(n,{singleBaseUrl:()=>{for(let o of t)a(o)},multipleBaseUrls:o=>{for(let c of t)o.urls[c]==null&&a(c)}}),i}}}}};var bL_={name:"no-circular-imports",DISABLE_RULE:!0,create:({workspace:e})=>{let t=PZQ(e.definition.namedDefinitionFiles);return{definitionFile:{import:({importPath:r},{relativeFilepath:n})=>{let i=t[n];if(i==null)return[];let a=G8i({referencedIn:n,importPath:ys.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 PZQ(e){let t={};for(let r of VBr(e))t[r]=OVE(r,[r],e);return t}function OVE(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=G8i({referencedIn:e,importPath:ys.of(a)});t.includes(o)?t[0]===o&&t[0]===wZQ(t)&&n.push({startingFilepath:o,chainWithoutStartingFilepath:t.slice(1)}):n.push(...OVE(o,[...t,o],r))}return n}function wZQ(e){return e.reduce((t,r)=>r<t?r:t)}var bml=class{workspace;typeResolver;constructor(t){this.workspace=t,this.typeResolver=new OF(t)}isTypeComplex(t,r){let n=YS({relativeFilepath:r.relativeFilepath,definitionFile:r.contents,casingsGenerator:Ux,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:tc(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:tc(t)}}isNamedTypeComplex({type:t,file:r,visited:n}){if(n.has(t.rawName))return!1;if(n.add(t.rawName),Kzi(t.declaration))return!0;if(CTr(t.declaration))return!1;if(bx(t.declaration))return this.objectHasComplexProperties({typeName:t.rawName,objectDeclaration:t.declaration,file:r,visited:n});if(V$a(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}tc(t.declaration)}objectHasComplexProperties({typeName:t,objectDeclaration:r,file:n,visited:i}){return CRr({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:tc(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:tc(t)}}};var gL_={name:"no-complex-query-params",create:({workspace:e})=>{let t=new bml(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 mL_={name:"no-conflicting-endpoint-parameters",create:()=>({definitionFile:{pathParameter:({pathParameterKey:e})=>e===L9s?[{severity:"fatal",message:`Path parameter ${bd.bold(e)} is not suitable for code generation, because it can conflict with the request body parameter.`}]:[]}})};function LFu({service:e,endpoint:t}){return e["base-path"]+t.path}var gml=class{root=new OL_;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 LFu({service:t.service,endpoint:t.endpoint}).split("/").filter(r=>r.length>0)}},OL_=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 AL_={name:"no-conflicting-endpoint-paths",create:({workspace:e})=>{let t=new gml;return Qee(e,(r,n)=>{jme(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 ${LFu({service:r,endpoint:n})} conflicts with other endpoints:`,...o.map(c=>` - ${c.relativeFilepath} -> ${c.endpointId} ${bd.dim(LFu({service:c.service,endpoint:c.endpoint}))}`)].join(`
|
|
3040
3040
|
`)}]}}}}};var PL_={name:"no-conflicting-request-wrapper-properties",create:({workspace:e})=>({definitionFile:{httpEndpoint:({endpoint:t,service:r},{contents:n,relativeFilepath:i})=>{let a=jZQ({endpoint:t,service:r,relativeFilepath:i,definitionFile:n,workspace:e}),o=[];for(let[c,d]of Object.entries(a))d.length<=1||o.push({severity:"fatal",message:`Multiple request properties have the name ${bd.bold(c)}. This is not suitable for code generation. Use the "name" property to deconflict.
|
|
3041
3041
|
`+d.map(s=>` - ${EZQ(s)}`).join(`
|
|
3042
3042
|
`)});return o}}})};function jZQ({endpoint:e,service:t,relativeFilepath:r,definitionFile:n,workspace:i}){let a={},o=(c,d)=>{(a[c]??=[]).push(d)};if(e.request!=null&&typeof e.request!="string"&&e.request.body!=null&&!s9(e.request.body)&&U9s({request:e.request,file:YS({relativeFilepath:r,definitionFile:n,casingsGenerator:Ux,rootApiFile:i.definition.rootApiFile.contents}),typeResolver:new OF(i)})&&o(Unu,{type:"referenced-body",propertyName:Unu}),t.headers!=null)for(let[c,d]of Object.entries(t.headers))o(eHr({headerKey:c,header:d}).name,{type:"service-header",headerKey:c,header:d});if(e.request!=null&&typeof e.request!="string"){if(e.request.headers!=null)for(let[c,d]of Object.entries(e.request.headers))o(eHr({headerKey:c,header:d}).name,{type:"endpoint-header",headerKey:c,header:d});if(e.request["query-parameters"]!=null)for(let[c,d]of Object.entries(e.request["query-parameters"]))o(yji({queryParameterKey:c,queryParameter:d}).name,{type:"endpoint-query-parameter",queryParameterKey:c,queryParameter:d});if(e.request.body!=null&&s9(e.request.body)){let c=CRr({typeName:void 0,objectDeclaration:{extends:e.request.body.extends,properties:e.request.body.properties??{}},filepathOfDeclaration:r,definitionFile:n,workspace:i,typeResolver:new OF(i),smartCasing:!1});for(let d of c)o(d.name,{type:"inlined-body",property:d})}}return a}function EZQ(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: ${nuo({property:e.property,prefixBreadcrumbs:["<Request Body>"]})}`;case"referenced-body":return`Body property "${e.propertyName}"`;default:tc(e)}}var wL_=fa(require("path"),1);var jL_={name:"no-duplicate-declarations",create:({workspace:e,logger:t})=>{let r=SZQ(e),n={},i=({declaredName:a,relativeFilepath:o})=>{let c=wL_.default.dirname(o),d=r[c]?.[a];if(d==null)return t.error(`Could not find declarations for name: ${a}. This is an error in the Fern validator.`),[];let s=n[c]??=new Set;if(!s.has(a))return s.add(a),[];let u=d.indexOf(o);return d.filter((m,A)=>A!==u).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 SZQ(e){let t={};return Qee(e,(r,n)=>{let i=wL_.default.dirname(r),a=t[i]??={},o=c=>{(a[c]??=[]).push(r)};jme(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 UFu(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 EL_={name:"no-duplicate-enum-values",create:()=>({definitionFile:{typeDeclaration:({declaration:e})=>CTr(e)?UFu(e.enum.map(r=>typeof r=="string"?r:r.value)).map(r=>({severity:"fatal",message:`Duplicated enum value: ${bd.bold(r)}.`})):[]}})};var SL_={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(Zw);return UFu(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(Zw);return UFu(t).map(r=>({severity:"fatal",message:`Duplicate example name: ${r}`}))}}})};function AVE(e){if(!e.isInlined)return e.name;switch(e.location){case"inlinedRequest":return"<Inlined Request>";default:tc(e.location)}}var DL_={name:"no-duplicate-field-names",create:({workspace:e})=>{let t=new OF(e);return{definitionFile:{typeDeclaration:({typeName:r,declaration:n},{relativeFilepath:i,contents:a})=>{let o=[];return mee(n,{alias:ppt,enum:c=>{let d=PVE(c.enum,s=>suo(s).name);for(let s of d)o.push({severity:"fatal",message:`Name "${s}" is used by multiple values.`})},object:c=>{let d=AVE(r),s=CRr({typeName:d,objectDeclaration:c,filepathOfDeclaration:i,definitionFile:a,workspace:e,typeResolver:t,smartCasing:!1}),u=e$l(s,l=>l.name);for(let[l,m]of Object.entries(u))if(m.length>1){let A=[`Object has multiple properties named "${l}":`,...m.map(P=>` - ${nuo({property:P,prefixBreadcrumbs:[d]})}`)].join(`
|