fern-api 0.77.0 → 0.77.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +4 -4
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -1717,7 +1717,7 @@ ${aGp.default.cursorShow}`)}releaseCursor(){this.extraLinesUnderPrompt>0&&Pfc(th
1717
1717
  `+Ptn.default.red(">> ")+t),this.screen.render(r,i)}getMaskedValue(t){return this.status==="answered"?this.opt.mask?Ptn.default.cyan(_Gp(t,this.opt.mask)):Ptn.default.italic(Ptn.default.dim("[hidden]")):this.opt.mask?_Gp(t,this.opt.mask):Ptn.default.italic(Ptn.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 pGo=oi(u5(),1),LQp=oi(FQp(),1),UQp=oi(XAe(),1);var h7a=class extends s5{_run(t){this.done=t,this.editorResult=new UQp.Subject;let r=t$(this.rl);this.lineSubscription=r.line.subscribe(this.startExternalEditor.bind(this));let i=this.opt.waitUserInput===void 0?!0:this.opt.waitUserInput,n=this.handleSubmitEvents(this.editorResult);return n.success.forEach(this.onEnd.bind(this)),n.error.forEach(this.onError.bind(this)),this.currentText=this.opt.default,this.opt.default=null,i?this.render():this.startExternalEditor(),this}render(t){let r="",i=this.getQuestion();i+=this.status==="answered"?pGo.default.dim("Received"):pGo.default.dim("Press <enter> to launch your preferred editor."),t&&(r=pGo.default.red(">> ")+t),this.screen.render(i,r)}startExternalEditor(){this.rl.pause(),(0,LQp.editAsync)(this.currentText,this.endExternalEditor.bind(this),{postfix:this.opt.postfix??".txt"})}endExternalEditor(t,r){this.rl.resume(),t?this.editorResult.error(t):this.editorResult.next(r)}onEnd(t){this.editorResult.unsubscribe(),this.lineSubscription.unsubscribe(),this.answer=t.value,this.status="answered",this.render(),this.screen.done(),this.done(this.answer)}onError(t){this.render(t.isValid)}};var GQp=require("stream");var HQp=oi(require("readline"),1),$Qp=oi(WQp(),1),Atn=class{constructor(t){this.rl||=HQp.default.createInterface(oJD(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 oJD(e={}){e.skipTTYChecks=e.skipTTYChecks===void 0?!0:e.skipTTYChecks;let t=e.input||process.stdin;if(!e.skipTTYChecks&&!t.isTTY){let n=new Error("Prompts can not be meaningfully rendered in non-TTY environments");throw n.isTtyError=!0,n}let r=new $Qp.default;return r.pipe(e.output||process.stdout),{terminal:!0,...e,input:t,output:r}}var y7a=class extends Atn{constructor(t={}){super(t),this.log=new GQp.Writable({write:(r,i,n)=>{this.writeLog(r),n()}}),this.bottomBar=t.bottomBar||"",this.render()}render(){return this.write(this.bottomBar),this}clean(){return XNa(this.rl,this.bottomBar.split(`
1718
1718
  `).length),this}updateBottomBar(t){return XNa(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+`
1719
1719
  `}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&&U$o(this.rl,t.length+this.rl.line.length),this.rl.output.write(t)}};var BM=oi(XAe(),1),KQp=oi(bNa(),1);var _Go=oi(XAe(),1),QQp=oi(bNa(),1),hGo=function(e,t,r){return typeof e[t]!="function"?(0,_Go.of)(e):(0,_Go.from)((0,QQp.default)(e[t])(r).then(i=>(e[t]=i,e)))};var JQp={set:(e,t="",r)=>{let i=e;t.split(".").forEach((n,a,u)=>{n==="__proto__"||n==="constructor"||(a===u.length-1?i[n]=r:(!(n in i)||typeof i[n]!="object")&&(i[n]={}),i=i[n])})},get:(e,t="",r)=>{let i=a=>String.prototype.split.call(t,a).filter(Boolean).reduce((u,c)=>u!=null?u[c]:u,e),n=i(/[,[\]]+?/)||i(/[,.[\]]+?/);return n===void 0||n===e?r:n}},jWn=class extends Atn{constructor(t,r){super(r),this.prompts=t}run(t,r){this.answers=typeof r=="object"?{...r}:{};let i;return Array.isArray(t)?i=(0,BM.from)(t):(0,BM.isObservable)(t)?i=t:Object.values(t).every(n=>typeof n=="object"&&!Array.isArray(n)&&n!=null)?i=(0,BM.from)(Object.entries(t).map(([n,a])=>({name:n,...a}))):i=(0,BM.from)([t]),this.process=i.pipe((0,BM.concatMap)(this.processQuestion.bind(this)),(0,BM.publish)()),this.process.connect(),this.process.pipe((0,BM.reduce)((n,a)=>(JQp.set(n,a.name,a.answer),n),this.answers)).toPromise(Promise).then(this.onCompletion.bind(this),this.onError.bind(this))}onCompletion(){return this.close(),this.answers}onError(t){return this.close(),Promise.reject(t)}processQuestion(t){return t={...t},(0,BM.defer)(()=>(0,BM.of)(t).pipe((0,BM.concatMap)(this.setDefaultType.bind(this)),(0,BM.concatMap)(this.filterIfRunnable.bind(this)),(0,BM.concatMap)(()=>hGo(t,"message",this.answers)),(0,BM.concatMap)(()=>hGo(t,"default",this.answers)),(0,BM.concatMap)(()=>hGo(t,"choices",this.answers)),(0,BM.concatMap)(this.fetchAnswer.bind(this))))}fetchAnswer(t){let r=this.prompts[t.type];return this.activePrompt=new r(t,this.rl,this.answers),(0,BM.defer)(()=>(0,BM.from)(this.activePrompt.run().then(i=>({name:t.name,answer:i}))))}setDefaultType(t){return this.prompts[t.type]||(t.type="input"),(0,BM.defer)(()=>(0,BM.of)(t))}filterIfRunnable(t){if(t.askAnswered!==!0&&JQp.get(this.answers,t.name)!==void 0)return BM.EMPTY;if(t.when===!1)return BM.EMPTY;if(typeof t.when!="function")return(0,BM.of)(t);let{answers:r}=this;return(0,BM.defer)(()=>(0,BM.from)((0,KQp.default)(t.when)(r).then(i=>{if(i)return t})).pipe((0,BM.filter)(i=>i!=null)))}};function YQp(e){let t=function(r,i){let n;try{n=new jWn(t.prompts,e)}catch(u){return Promise.reject(u)}let a=n.run(r,i);return a.ui=n,a};return t.prompts={},t.registerPrompt=function(r,i){return t.prompts[r]=i,this},t.restoreDefaultPrompts=function(){this.registerPrompt("list",kNa),this.registerPrompt("input",mtn),this.registerPrompt("number",e7a),this.registerPrompt("confirm",t7a),this.registerPrompt("rawlist",r7a),this.registerPrompt("expand",i7a),this.registerPrompt("checkbox",n7a),this.registerPrompt("password",a7a),this.registerPrompt("editor",h7a)},t.restoreDefaultPrompts(),t}var hdc=YQp();function sJD(e,t){hdc.registerPrompt(e,t)}function cJD(){hdc.restoreDefaultPrompts()}var lJD={prompt:hdc,ui:{BottomBar:y7a,Prompt:jWn},createPromptModule:YQp,registerPrompt:sJD,restoreDefaultPrompts:cJD,Separator:uue},yGo=lJD;var xWn=require("path"),RKp=require("fs"),NKp=require("readline"),sKp="posthog-node";function YYD(e,{organization:t,projectId:r,prefix:i,severityAllowList:n=["error"]}={}){return a=>{if(!(n==="*"||n.includes(a.level)))return a;a.tags||(a.tags={});let c=a.tags[NGo.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 o=a.exception?.values||[],l=o.map(g=>({...g,stacktrace:g.stacktrace?{...g.stacktrace,type:"raw",frames:(g.stacktrace.frames||[]).map(O=>({...O,platform:"node:javascript"}))}:void 0})),v={$exception_message:o[0]?.value||a.message,$exception_type:o[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:o[0]?.value||a.message,$sentry_exception_type:o[0]?.type,$sentry_tags:a.tags};return t&&r&&(v.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),e.capture({event:"$exception",distinctId:c,properties:v}),a}}var NGo=class{constructor(t,r,i,n){this.name=sKp,this.name=sKp,this.setupOnce=function(a,u){let c=u()?.getClient()?.getDsn()?.projectId;a(YYD(t,{organization:r,projectId:c,prefix:i,severityAllowList:n}))}}};NGo.POSTHOG_ID_TAG="posthog_distinct_id";var BGo="0123456789abcdef",FGo=class e{constructor(t){this.bytes=t}static ofInner(t){if(t.length!==16)throw new TypeError("not 128-bit length");return new e(t)}static fromFieldsV7(t,r,i,n){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||!Number.isInteger(n)||t<0||r<0||i<0||n<0||t>0xffffffffffff||r>4095||i>1073741823||n>4294967295)throw new RangeError("invalid field value");let a=new Uint8Array(16);return a[0]=t/2**40,a[1]=t/2**32,a[2]=t/2**24,a[3]=t/2**16,a[4]=t/2**8,a[5]=t,a[6]=112|r>>>8,a[7]=r,a[8]=128|i>>>24,a[9]=i>>>16,a[10]=i>>>8,a[11]=i,a[12]=n>>>24,a[13]=n>>>16,a[14]=n>>>8,a[15]=n,new e(a)}static parse(t){let r;switch(t.length){case 32:r=/^[0-9a-f]{32}$/i.exec(t)?.[0];break;case 36:r=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break;case 38:r=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(t)?.slice(1,6).join("");break;case 45:r=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(t)?.slice(1,6).join("");break}if(r){let i=new Uint8Array(16);for(let n=0;n<16;n+=4){let a=parseInt(r.substring(2*n,2*n+8),16);i[n+0]=a>>>24,i[n+1]=a>>>16,i[n+2]=a>>>8,i[n+3]=a}return new e(i)}else throw new SyntaxError("could not parse UUID string")}toString(){let t="";for(let r=0;r<this.bytes.length;r++)t+=BGo.charAt(this.bytes[r]>>>4),t+=BGo.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+=BGo.charAt(this.bytes[r]>>>4),t+=BGo.charAt(this.bytes[r]&15);return t}toJSON(){return this.toString()}getVariant(){let t=this.bytes[8]>>>4;if(t<0)throw new Error("unreachable");if(t<=7)return this.bytes.every(r=>r===0)?"NIL":"VAR_0";if(t<=11)return"VAR_10";if(t<=13)return"VAR_110";if(t<=15)return this.bytes.every(r=>r===255)?"MAX":"VAR_RESERVED";throw new Error("unreachable")}getVersion(){return this.getVariant()==="VAR_10"?this.bytes[6]>>>4:void 0}clone(){return new e(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;r<16;r++){let i=this.bytes[r]-t.bytes[r];if(i!==0)return Math.sign(i)}return 0}},ipc=class{constructor(t){this.timestamp=0,this.counter=0,this.random=t??XYD()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(t,r){let i=this.generateOrAbortCore(t,r);return i===void 0&&(this.timestamp=0,i=this.generateOrAbortCore(t,r)),i}generateOrAbortCore(t,r){if(!Number.isInteger(t)||t<1||t>0xffffffffffff)throw new RangeError("`unixTsMs` must be a 48-bit positive integer");if(r<0||r>0xffffffffffff)throw new RangeError("`rollbackAllowance` out of reasonable range");if(t>this.timestamp)this.timestamp=t,this.resetCounter();else if(t+r>=this.timestamp)this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter());else return;return FGo.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,FGo.ofInner(t)}},XYD=()=>({nextUint32:()=>Math.trunc(Math.random()*65536)*65536+Math.trunc(Math.random()*65536)}),cKp,npc=()=>ZYD().toString(),ZYD=()=>(cKp||(cKp=new ipc)).generate();function kYD(e,t){let r=!1;return Object.assign(i=>{let a=global.process.listeners("uncaughtException").filter(u=>u.name!=="domainUncaughtExceptionClear"&&u._posthogErrorHandler!==!0).length===0;e(i,{mechanism:{type:"onuncaughtexception",handled:!1}}),!r&&a&&(r=!0,t())},{_posthogErrorHandler:!0})}function eXD(e,t){global.process.on("uncaughtException",kYD(e,t))}function tXD(e){global.process.on("unhandledRejection",t=>{e(t,{mechanism:{type:"onunhandledrejection",handled:!1}})})}var IGo,lKp,zGo;function rXD(e){let t=globalThis._posthogChunkIds;if(!t)return console.error("No chunk id map found"),{};let r=Object.keys(t);return zGo&&r.length===lKp||(lKp=r.length,zGo=r.reduce((i,n)=>{IGo||(IGo={});let a=IGo[n];if(a)i[a[0]]=a[1];else{let u=e(n);for(let c=u.length-1;c>=0;c--){let s=u[c]?.filename,o=t[n];if(s&&o){i[s]=o,IGo[n]=[s,o];break}}}return i},{})),zGo}function iXD(e){return typeof Event<"u"&&FKp(e,Event)}function nXD(e){return LKp(e,"Object")}function dpc(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return FKp(e,Error)}}function FKp(e,t){try{return e instanceof t}catch{return!1}}function aXD(e){return LKp(e,"ErrorEvent")}function LKp(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}async function oXD(e,t,r,i){let a=i&&i.mechanism||{handled:!0,type:"generic"},u=UKp(a,r,i);return{$exception_list:await Promise.all(u.map(async s=>{let o=await pXD(e,t,s);return o.value=o.value||"",o.type=o.type||"Error",o.mechanism=a,o}))}}function UKp(e,t,r){let i=uXD(e,t,r);return i.cause?[i,...UKp(e,i.cause,r)]:[i]}function uXD(e,t,r){if(dpc(t))return t;if(e.synthetic=!0,nXD(t)){let n=sXD(t);if(n)return n;let a=cXD(t),u=r?.syntheticException||new Error(a);return u.message=a,u}let i=r?.syntheticException||new Error(t);return i.message=`${t}`,i}function sXD(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(dpc(r))return r}}function cXD(e){if("name"in e&&typeof e.name=="string"){let i=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(i+=` with message '${e.message}'`),i}else if("message"in e&&typeof e.message=="string")return e.message;let t=fXD(e);if(aXD(e))return`Event \`ErrorEvent\` captured as exception with message \`${e.message}\``;let r=lXD(e);return`${r&&r!=="Object"?`'${r}'`:"Object"} captured as exception with keys: ${t}`}function lXD(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function fXD(e,t=40){let r=Object.keys(dXD(e));r.sort();let i=r[0];if(!i)return"[object has no keys]";if(i.length>=t)return fKp(i,t);for(let n=r.length;n>0;n--){let a=r.slice(0,n).join(", ");if(!(a.length>t))return n===r.length?a:fKp(a,t)}return""}function fKp(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function dXD(e){return dpc(e)?{message:e.message,name:e.name,stack:e.stack,...dKp(e)}:iXD(e)?{type:e.type,target:pKp(e.target),currentTarget:pKp(e.currentTarget),...dKp(e)}:e}function dKp(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 pKp(e){try{return Object.prototype.toString.call(e)}catch{return"<unknown>"}}async function pXD(e,t,r){let i={type:r.name||r.constructor.name,value:r.message},n=_XD(e,r);for(let a of t)n=await a(n);return n.length&&(i.stacktrace={frames:n,type:"raw"}),i}function _XD(e,t){return hXD(e(t.stack||"",1),e)}function hXD(e,t){let r=rXD(t);return e.forEach(i=>{i.filename&&(i.chunk_id=r[i.filename])}),e}var yXD=2e3,BWn=class e{static async captureException(t,r,i,n,a){let u={...a};n||(u.$process_person_profile=!1);let c=await oXD(this.stackParser,this.frameModifiers,r,i);t.capture({event:"$exception",distinctId:n||npc(),properties:{...c,...u}})}constructor(t,r){this.client=t,this._exceptionAutocaptureEnabled=r.enableExceptionAutocapture||!1,this.startAutocaptureIfEnabled()}startAutocaptureIfEnabled(){this.isEnabled()&&(eXD(this.onException.bind(this),this.onFatalError.bind(this)),tXD(this.onException.bind(this)))}onException(t,r){e.captureException(this.client,t,r)}async onFatalError(){await this.client.shutdown(yXD)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}};function vXD(e=process.argv[1]?(0,xWn.dirname)(process.argv[1]):process.cwd(),t=xWn.sep==="\\"){let r=t?_Kp(e):e;return i=>{if(!i)return;let n=t?_Kp(i):i,{dir:a,base:u,ext:c}=xWn.posix.parse(n);(c===".js"||c===".mjs"||c===".cjs")&&(u=u.slice(0,c.length*-1));let d=decodeURIComponent(u);a||(a=".");let s=a.lastIndexOf("/node_modules");if(s>-1)return`${a.slice(s+14).replace(/\//g,".")}:${d}`;if(a.startsWith(r)){let o=a.slice(r.length+1).replace(/\//g,".");return o?`${o}:${d}`:d}return d}}function _Kp(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}var LGo=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)}}},RGo=new LGo(25),VKp=new LGo(20),ppc=7,bXD=1e3,gXD=1e4;async function OXD(e){let t={};for(let n=e.length-1;n>=0;n--){let a=e[n],u=a?.filename;if(!a||typeof u!="string"||typeof a.lineno!="number"||wXD(u)||SXD(a))continue;t[u]||(t[u]=[]),t[u].push(a.lineno)}let r=Object.keys(t);if(r.length==0)return e;let i=[];for(let n of r){if(VKp.get(n))continue;let a=t[n];if(!a)continue;a.sort((d,s)=>d-s);let u=EXD(a);if(u.every(d=>DXD(n,d)))continue;let c=MXD(RGo,n,{});i.push(mXD(n,u,c))}return await Promise.all(i).catch(()=>{}),e&&e.length>0&&PXD(e,RGo),RGo.reduce(),e}function mXD(e,t,r){return new Promise(i=>{let n=(0,RKp.createReadStream)(e),a=(0,NKp.createInterface)({input:n});function u(){n.destroy(),i()}let c=0,d=0,s=t[d];if(s===void 0){u();return}let o=s[0],l=s[1];function v(){VKp.set(e,1),a.close(),a.removeAllListeners(),u()}n.on("error",v),a.on("error",v),a.on("close",u),a.on("line",g=>{if(c++,!(c<o)&&(r[c]=AXD(g,0),c>=l)){if(d===t.length-1){a.close(),a.removeAllListeners();return}d++;let O=t[d];if(O===void 0){a.close(),a.removeAllListeners();return}o=O[0],l=O[1]}})})}function PXD(e,t){for(let r of e)if(r.filename&&r.context_line===void 0&&typeof r.lineno=="number"){let i=t.get(r.filename);if(i===void 0)continue;jXD(r.lineno,r,i)}}function jXD(e,t,r){if(t.lineno===void 0||r===void 0)return;t.pre_context=[];for(let n=WKp(e);n<e;n++){let a=r[n];if(a===void 0){hKp(t);return}t.pre_context.push(a)}if(r[e]===void 0){hKp(t);return}t.context_line=r[e];let i=HKp(e);t.post_context=[];for(let n=e+1;n<=i;n++){let a=r[n];if(a===void 0)break;t.post_context.push(a)}}function hKp(e){delete e.pre_context,delete e.context_line,delete e.post_context}function wXD(e){return e.startsWith("node:")||e.endsWith(".min.js")||e.endsWith(".min.cjs")||e.endsWith(".min.mjs")||e.startsWith("data:")}function SXD(e){return e.lineno!==void 0&&e.lineno>gXD||e.colno!==void 0&&e.colno>bXD}function DXD(e,t){let r=RGo.get(e);if(r===void 0)return!1;for(let i=t[0];i<=t[1];i++)if(r[i]===void 0)return!1;return!0}function EXD(e){if(!e.length)return[];let t=0,r=e[0];if(typeof r!="number")return[];let i=yKp(r),n=[];for(;;){if(t===e.length-1){n.push(i);break}let a=e[t+1];if(typeof a!="number")break;a<=i[1]?i[1]=a+ppc:(n.push(i),i=yKp(a)),t++}return n}function yKp(e){return[WKp(e),HKp(e)]}function WKp(e){return Math.max(1,e-ppc)}function HKp(e){return e+ppc}function MXD(e,t,r){let i=e.get(t);return i===void 0?(e.set(t,r),r):i}function AXD(e,t){let r=e,i=r.length;if(i<=150)return r;t>i&&(t=i);let n=Math.max(t-60,0);n<5&&(n=0);let a=Math.min(n+140,i);return a>i-5&&(a=i),a===i&&(n=Math.max(a-140,0)),r=r.slice(n,a),n>0&&(r=`...${r}`),a<i&&(r+="..."),r}var qXD="4.18.0",pue;(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"})(pue||(pue={}));var vKp;(function(e){e.Left="left",e.Right="right",e.Center="center"})(vKp||(vKp={}));var bKp;(function(e){e.Button="button",e.Tab="tab",e.Selector="selector"})(bKp||(bKp={}));var gKp;(function(e){e.Popover="popover",e.API="api",e.Widget="widget"})(gKp||(gKp={}));var OKp;(function(e){e.Html="html",e.Text="text"})(OKp||(OKp={}));var mKp;(function(e){e.Number="number",e.Emoji="emoji"})(mKp||(mKp={}));var PKp;(function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"})(PKp||(PKp={}));var jKp;(function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"})(jKp||(jKp={}));var wKp;(function(e){e.Regex="regex",e.NotRegex="not_regex",e.Exact="exact",e.IsNot="is_not",e.Icontains="icontains",e.NotIcontains="not_icontains"})(wKp||(wKp={}));var SKp;(function(e){e.Contains="contains",e.Exact="exact",e.Regex="regex"})(SKp||(SKp={}));var TXD=e=>{if("flags"in e){let t=BXD(e.flags),r=IXD(e.flags);return{...e,featureFlags:t,featureFlagPayloads:r}}else{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([n,a])=>[n,$Kp(a)])),i=Object.fromEntries(Object.entries(t).map(([n,a])=>[n,CXD(n,a,r[n])]));return{...e,featureFlags:t,featureFlagPayloads:r,flags:i}}};function CXD(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 BXD=e=>Object.fromEntries(Object.entries(e??{}).map(([t,r])=>[t,_pc(r)]).filter(([,t])=>t!==void 0)),IXD=e=>{let t=e??{};return Object.fromEntries(Object.keys(t).filter(r=>{let i=t[r];return i.enabled&&i.metadata&&i.metadata.payload!==void 0}).map(r=>{let i=t[r].metadata?.payload;return[r,i?$Kp(i):void 0]}))},_pc=e=>e===void 0?void 0:e.variant??e.enabled,$Kp=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}},zXD=1,xXD=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"]),RXD="utf8";function NXD(e,t){if(!e||typeof e!="string"||FXD(e))throw new Error(t)}function FXD(e){return e.trim().length===0}function LXD(e){return e?.replace(/\/+$/,"")}async function UXD(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(n=>setTimeout(n,t.retryDelay));try{return await e()}catch(n){if(r=n,!t.retryCheck(n))throw n}}throw r}function DKp(){return new Date().getTime()}function tpc(){return new Date().toISOString()}function UGo(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}function VXD(){return typeof fetch<"u"?fetch:typeof globalThis.fetch<"u"?globalThis.fetch:void 0}function WXD(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 HXD(e,t=0,r){let i=WXD(e);return r?.has(i)?!1:parseInt(i,16)/4294967295<t}function EKp(e){return Promise.all(e.map(t=>(t??Promise.resolve()).then(r=>({status:"fulfilled",value:r}),r=>({status:"rejected",reason:r}))))}var E7a=String.fromCharCode,MKp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",xGo={};function $XD(e,t){if(!xGo[e]){xGo[e]={};for(let r=0;r<e.length;r++)xGo[e][e.charAt(r)]=r}return xGo[e][t]}var TWn={compressToBase64:function(e){if(e==null)return"";let t=TWn._compress(e,6,function(r){return MKp.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:TWn._decompress(e.length,32,function(t){return $XD(MKp,e.charAt(t))})},compress:function(e){return TWn._compress(e,16,function(t){return E7a(t)})},_compress:function(e,t,r){if(e==null)return"";let i={},n={},a=[],u,c,d="",s="",o="",l=2,v=3,g=2,O=0,m=0,P;for(P=0;P<e.length;P+=1)if(d=e.charAt(P),Object.prototype.hasOwnProperty.call(i,d)||(i[d]=v++,n[d]=!0),s=o+d,Object.prototype.hasOwnProperty.call(i,s))o=s;else{if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(c=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|c&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,c=c>>1}else{for(c=1,u=0;u<g;u++)O=O<<1|c,m==t-1?(m=0,a.push(r(O)),O=0):m++,c=0;for(c=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|c&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,c=c>>1}l--,l==0&&(l=Math.pow(2,g),g++),delete n[o]}else for(c=i[o],u=0;u<g;u++)O=O<<1|c&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,c=c>>1;l--,l==0&&(l=Math.pow(2,g),g++),i[s]=v++,o=String(d)}if(o!==""){if(Object.prototype.hasOwnProperty.call(n,o)){if(o.charCodeAt(0)<256){for(u=0;u<g;u++)O=O<<1,m==t-1?(m=0,a.push(r(O)),O=0):m++;for(c=o.charCodeAt(0),u=0;u<8;u++)O=O<<1|c&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,c=c>>1}else{for(c=1,u=0;u<g;u++)O=O<<1|c,m==t-1?(m=0,a.push(r(O)),O=0):m++,c=0;for(c=o.charCodeAt(0),u=0;u<16;u++)O=O<<1|c&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,c=c>>1}l--,l==0&&(l=Math.pow(2,g),g++),delete n[o]}else for(c=i[o],u=0;u<g;u++)O=O<<1|c&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,c=c>>1;l--,l==0&&(l=Math.pow(2,g),g++)}for(c=2,u=0;u<g;u++)O=O<<1|c&1,m==t-1?(m=0,a.push(r(O)),O=0):m++,c=c>>1;for(;;)if(O=O<<1,m==t-1){a.push(r(O));break}else m++;return a.join("")},decompress:function(e){return e==null?"":e==""?null:TWn._decompress(e.length,32768,function(t){return e.charCodeAt(t)})},_decompress:function(e,t,r){let i=[],n=[],a={val:r(0),position:t,index:1},u=4,c=4,d=3,s="",o,l,v,g,O,m,P;for(o=0;o<3;o+=1)i[o]=o;for(v=0,O=Math.pow(2,2),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),v|=(g>0?1:0)*m,m<<=1;switch(v){case 0:for(v=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),v|=(g>0?1:0)*m,m<<=1;P=E7a(v);break;case 1:for(v=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),v|=(g>0?1:0)*m,m<<=1;P=E7a(v);break;case 2:return""}for(i[3]=P,l=P,n.push(P);;){if(a.index>e)return"";for(v=0,O=Math.pow(2,d),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),v|=(g>0?1:0)*m,m<<=1;switch(P=v){case 0:for(v=0,O=Math.pow(2,8),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),v|=(g>0?1:0)*m,m<<=1;i[c++]=E7a(v),P=c-1,u--;break;case 1:for(v=0,O=Math.pow(2,16),m=1;m!=O;)g=a.val&a.position,a.position>>=1,a.position==0&&(a.position=t,a.val=r(a.index++)),v|=(g>0?1:0)*m,m<<=1;i[c++]=E7a(v),P=c-1,u--;break;case 2:return n.join("")}if(u==0&&(u=Math.pow(2,d),d++),i[P])s=i[P];else if(P===c)s=l+l.charAt(0);else return null;n.push(s),i[c++]=l+s.charAt(0),u--,l=s,u==0&&(u=Math.pow(2,d),d++)}}},apc=class{constructor(){this.events={},this.events={}}on(t,r){return this.events[t]||(this.events[t]=[]),this.events[t].push(r),()=>{this.events[t]=this.events[t].filter(i=>i!==r)}}emit(t,r){for(let i of this.events[t]||[])i(r);for(let i of this.events["*"]||[])i(t,r)}},IWn=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()}},M7a=class extends Error{constructor(t){super("Network error while fetching PostHog",t instanceof Error?{cause:t}:{}),this.error=t,this.name="PostHogFetchNetworkError"}};async function AKp(e){if(e instanceof IWn){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 rpc(e){return typeof e=="object"&&(e instanceof IWn||e instanceof M7a)}function qKp(e){return typeof e=="object"&&e instanceof IWn&&e.status===413}var opc;(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(opc||(opc={}));var upc=class{constructor(t,r){this.flushPromise=null,this.shutdownPromise=null,this.pendingPromises={},this._events=new apc,this._isInitialized=!1,NXD(t,"You must pass your PostHog project's api key."),this.apiKey=t,this.host=LXD(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:rpc},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(pue.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(pue.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(pue.OptedOut,!0)})}on(t,r){return this._events.on(t,r)}debug(t=!0){if(this.removeDebugCallback?.(),t){let r=this.on("*",(i,n)=>console.log("PostHog Debug",i,n));this.removeDebugCallback=()=>{r(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}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=npc();return this.pendingPromises[r]=t,t.catch(()=>{}).finally(()=>{delete this.pendingPromises[r]}),t}identifyStateless(t,r,i){this.wrap(()=>{let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};this.enqueue("identify",n,i)})}async identifyStatelessImmediate(t,r,i){let n={...this.buildPayload({distinct_id:t,event:"$identify",properties:r})};await this.sendImmediate("identify",n,i)}captureStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:t,event:r,properties:i});this.enqueue("capture",a,n)})}async captureStatelessImmediate(t,r,i,n){let a=this.buildPayload({distinct_id:t,event:r,properties:i});await this.sendImmediate("capture",a,n)}aliasStateless(t,r,i,n){this.wrap(()=>{let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});this.enqueue("alias",a,n)})}async aliasStatelessImmediate(t,r,i,n){let a=this.buildPayload({event:"$create_alias",distinct_id:r,properties:{...i||{},distinct_id:r,alias:t}});await this.sendImmediate("alias",a,n)}groupIdentifyStateless(t,r,i,n,a,u){this.wrap(()=>{let c=this.buildPayload({distinct_id:a||`$${t}_${r}`,event:"$groupidentify",properties:{$group_type:t,$group_key:r,$group_set:i||{},...u||{}}});this.enqueue("capture",c,n)})}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`,i={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(r,i,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(n=>n.json()).catch(n=>{this.logMsgIfDebug(()=>console.error("Remote config could not be loaded",n)),this._events.emit("error",n)})}async getDecide(t,r={},i={},n={},a={}){await this._initPromise;let c=HXD(this.apiKey,zXD,xXD)?`${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:i,group_properties:n,...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=>TXD(s)).catch(s=>{this._events.emit("error",s)})}async getFeatureFlagStateless(t,r,i={},n={},a={},u){await this._initPromise;let c=await this.getFeatureFlagDetailStateless(t,r,i,n,a,u);if(c===void 0)return{response:void 0,requestId:void 0};let d=_pc(c.response);return d===void 0&&(d=!1),{response:d,requestId:c.requestId}}async getFeatureFlagDetailStateless(t,r,i={},n={},a={},u){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(r,i,n,a,u,[t]);return c===void 0?void 0:{response:c.flags[t],requestId:c.requestId}}async getFeatureFlagPayloadStateless(t,r,i={},n={},a={},u){await this._initPromise;let c=await this.getFeatureFlagPayloadsStateless(r,i,n,a,u,[t]);if(!c)return;let d=c[t];return d===void 0?null:d}async getFeatureFlagPayloadsStateless(t,r={},i={},n={},a,u){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a,u)).payloads}async getFeatureFlagsStateless(t,r={},i={},n={},a,u){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(t,r,i,n,a,u)}async getFeatureFlagsAndPayloadsStateless(t,r={},i={},n={},a,u){await this._initPromise;let c=await this.getFeatureFlagDetailsStateless(t,r,i,n,a,u);return c?{flags:c.featureFlags,payloads:c.featureFlagPayloads,requestId:c.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(t,r={},i={},n={},a,u){await this._initPromise;let c={};(a??this.disableGeoip)&&(c.geoip_disable=!0),u&&(c.flag_keys_to_evaluate=u);let d=await this.getDecide(t,r,i,n,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(opc.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"}},n=(await this.fetchWithRetry(t,r).then(a=>{if(a.status!==200||!a.json){let u=`Surveys API could not be loaded: ${a.status}`,c=new Error(u);this.logMsgIfDebug(()=>console.error(c)),this._events.emit("error",new Error(u));return}return a.json()}).catch(a=>{this.logMsgIfDebug(()=>console.error("Surveys API could not be loaded",a)),this._events.emit("error",a)}))?.surveys;return n&&this.logMsgIfDebug(()=>console.log("PostHog Debug","Surveys fetched from API: ",JSON.stringify(n))),n??[]}get props(){return this._props||(this._props=this.getPersistedProperty(pue.Props)),this._props||{}}set props(t){this._props=t}async register(t){this.wrap(()=>{this.props={...this.props,...t},this.setPersistedProperty(pue.Props,this.props)})}async unregister(t){this.wrap(()=>{delete this.props[t],this.setPersistedProperty(pue.Props,this.props)})}enqueue(t,r,i){this.wrap(()=>{if(this.optedOut){this._events.emit(t,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");return}let n=this.prepareMessage(t,r,i),a=this.getPersistedProperty(pue.Queue)||[];a.length>=this.maxQueueSize&&(a.shift(),this.logMsgIfDebug(()=>console.info("Queue is full, the oldest event is dropped."))),a.push({message:n}),this.setPersistedProperty(pue.Queue,a),this._events.emit(t,n),a.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=UGo(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(t,r,i){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 n={api_key:this.apiKey,batch:[this.prepareMessage(t,r,i)],sent_at:tpc()};this.historicalMigration&&(n.historical_migration=!0);let a=JSON.stringify(n),u=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${DKp()}&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(TWn.compressToBase64(a))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:a};try{await this.fetchWithRetry(u,c)}catch(d){this._events.emit("error",d)}}prepareMessage(t,r,i){let n={...r,type:t,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:i?.timestamp?i?.timestamp:tpc(),uuid:i?.uuid?i.uuid:npc()};return(i?.disableGeoip??this.disableGeoip)&&(n.properties||(n.properties={}),n.properties.$geoip_disable=!0),n.distinctId&&(n.distinct_id=n.distinctId,delete n.distinctId),n}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async t=>{await AKp(t)})}async flush(){let t=EKp([this.flushPromise]).then(()=>this._flush());return this.flushPromise=t,this.addPendingPromise(t),EKp([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(pue.Queue)||[];if(!t.length)return;let r=[],i=t.length;for(;t.length>0&&r.length<i;){let n=t.slice(0,this.maxBatchSize),a=n.map(v=>v.message),u=()=>{let g=(this.getPersistedProperty(pue.Queue)||[]).slice(n.length);this.setPersistedProperty(pue.Queue,g),t=g},c={api_key:this.apiKey,batch:a,sent_at:tpc()};this.historicalMigration&&(c.historical_migration=!0);let d=JSON.stringify(c),s=this.captureMode==="form"?`${this.host}/e/?ip=1&_=${DKp()}&v=${this.getLibraryVersion()}`:`${this.host}/batch/`,o=this.captureMode==="form"?{method:"POST",mode:"no-cors",credentials:"omit",headers:{...this.getCustomHeaders(),"Content-Type":"application/x-www-form-urlencoded"},body:`data=${encodeURIComponent(TWn.compressToBase64(d))}&compression=lz64`}:{method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:d},l={retryCheck:v=>qKp(v)?!1:rpc(v)};try{await this.fetchWithRetry(s,o,l)}catch(v){if(qKp(v)&&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 v instanceof M7a||u(),this._events.emit("error",v),v}u(),r.push(...a)}this._events.emit("flush",r)}async fetchWithRetry(t,r,i,n){var a;(a=AbortSignal).timeout??(a.timeout=function(s){let o=new AbortController;return setTimeout(()=>o.abort(),s),o.signal});let u=r.body?r.body:"",c=-1;try{c=Buffer.byteLength(u,RXD)}catch{c=new TextEncoder().encode(u).length}return await UXD(async()=>{let d=null;try{d=await this.fetch(t,{signal:AbortSignal.timeout(n??this.requestTimeout),...r})}catch(o){throw new M7a(o)}if(!(r.mode==="no-cors")&&(d.status<200||d.status>=400))throw new IWn(d,c);return d},{...this._retryOptions,...i})}async _shutdown(t=3e4){await this._initPromise;let r=!1;this.clearFlushTimer();let i=async()=>{try{for(await Promise.all(Object.values(this.pendingPromises));!((this.getPersistedProperty(pue.Queue)||[]).length===0||(await this.flush(),r)););}catch(n){if(!rpc(n))throw n;await AKp(n)}};return Promise.race([new Promise((n,a)=>{UGo(()=>{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)}),i()])}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}},spc=VXD();if(!spc){let e=uKp();spc=async(t,r)=>{let i=await e.request({url:t,headers:r.headers,method:r.method.toLowerCase(),data:r.body,signal:r.signal,validateStatus:()=>!0});return{status:i.status,text:async()=>i.data,json:async()=>i.data}}}var GKp=spc,VGo=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()}},QKp=new VGo(async()=>{try{return await import("crypto")}catch{return}});async function GXD(){return await QKp.getValue()}var QXD=new VGo(async()=>{if(typeof globalThis.crypto?.subtle<"u")return globalThis.crypto.subtle;try{let e=await QKp.getValue();if(e?.webcrypto?.subtle)return e.webcrypto.subtle}catch{}});async function JXD(){return await QXD.getValue()}async function KXD(e){let t=await GXD();if(t)return t.createHash("sha1").update(e).digest("hex");let r=await JXD();if(r){let i=await r.digest("SHA-1",new TextEncoder().encode(e));return Array.from(new Uint8Array(i)).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 YXD=60*1e3,XXD=1152921504606847e3,ZXD=["is_not"],CWn=class e extends Error{constructor(t){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=t,Object.setPrototypeOf(this,e.prototype)}},c5=class e extends Error{constructor(t){super(t),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,e.prototype)}},cpc=class{constructor({pollingInterval:t,personalApiKey:r,projectApiKey:i,timeout:n,host:a,customHeaders:u,...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=n,this.projectApiKey=i,this.host=a,this.poller=void 0,this.fetch=c.fetch||GKp,this.onError=c.onError,this.customHeaders=u,this.onLoad=c.onLoad,this.loadFeatureFlags()}debug(t=!0){this.debugMode=t}logMsgIfDebug(t){this.debugMode&&t()}async getFeatureFlag(t,r,i={},n={},a={}){await this.loadFeatureFlags();let u,c;if(!this.loadedSuccessfullyOnce)return u;for(let d of this.featureFlags)if(t===d.key){c=d;break}if(c!==void 0)try{u=await this.computeFlagLocally(c,r,i,n,a),this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${t} -> ${u}`))}catch(d){d instanceof c5?this.logMsgIfDebug(()=>console.debug(`InconclusiveMatchError when computing flag locally: ${t}: ${d}`)):d instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${t}: ${d}`))}return u}async computeFeatureFlagPayloadLocally(t,r){await this.loadFeatureFlags();let i;if(this.loadedSuccessfullyOnce){if(typeof r=="boolean"?i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r.toString()]:typeof r=="string"&&(i=this.featureFlagsByKey?.[t]?.filters?.payloads?.[r]),i==null)return null;try{return JSON.parse(i)}catch{return i}}}async getAllFlagsAndPayloads(t,r={},i={},n={}){await this.loadFeatureFlags();let a={},u={},c=this.featureFlags.length==0;return await Promise.all(this.featureFlags.map(async d=>{try{let s=await this.computeFlagLocally(d,t,r,i,n);a[d.key]=s;let o=await this.computeFeatureFlagPayloadLocally(d.key,s);o&&(u[d.key]=o)}catch(s){s instanceof c5||s instanceof Error&&this.onError?.(new Error(`Error computing flag locally: ${d.key}: ${s}`)),c=!0}})),{response:a,payloads:u,fallbackToDecide:c}}async computeFlagLocally(t,r,i={},n={},a={}){if(t.ensure_experience_continuity)throw new c5("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 c5("Flag has unknown group type index");if(!(d in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${t.key} without group names passed in`)),!1;let s=a[d];return await this.matchFeatureFlagProperties(t,i[d],s)}else return await this.matchFeatureFlagProperties(t,r,n)}async matchFeatureFlagProperties(t,r,i){let n=t.filters||{},a=n.groups||[],u=!1,c,d=[...a].sort((s,o)=>{let l=!!s.variant,v=!!o.variant;return l&&v?0:l?-1:v?1:0});for(let s of d)try{if(await this.isConditionMatch(t,r,s,i)){let o=s.variant,l=n.multivariate?.variants||[];o&&l.some(v=>v.key===o)?c=o:c=await this.getMatchingVariant(t,r)||!0;break}}catch(o){if(o instanceof c5)u=!0;else throw o}if(c!==void 0)return c;if(u)throw new c5("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(t,r,i,n){let a=i.rollout_percentage,u=c=>{this.logMsgIfDebug(()=>console.warn(c))};if((i.properties||[]).length>0){for(let c of i.properties){let d=c.type,s=!1;if(d==="cohort"?s=KKp(c,n,this.cohorts,this.debugMode):s=JKp(c,n,u),!s)return!1}if(a==null)return!0}return!(a!=null&&await TKp(t.key,r)>a/100)}async getMatchingVariant(t,r){let i=await TKp(t.key,r,"variant"),n=this.variantLookupTable(t).find(a=>i>=a.valueMin&&i<a.valueMax);if(n)return n.key}variantLookupTable(t){let r=[],i=0,n=0;return((t.filters||{}).multivariate?.variants||[]).forEach(c=>{n=i+c.rollout_percentage/100,r.push({valueMin:i,valueMax:n,key:c.key}),i=n}),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(YXD,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 CWn(`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 CWn(`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 CWn(`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((i,n)=>(i[n.key]=n,i),{}),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 CWn&&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(),i=null;if(this.timeout&&typeof this.timeout=="number"){let n=new AbortController;i=UGo(()=>{n.abort()},this.timeout),r.signal=n.signal}try{return await this.fetch(t,r)}finally{clearTimeout(i)}}stopPoller(){clearTimeout(this.poller)}_requestRemoteConfigPayload(t){let r=`${this.host}/api/projects/@current/feature_flags/${t}/remote_config/`,i=this.getPersonalApiKeyRequestOptions(),n=null;if(this.timeout&&typeof this.timeout=="number"){let a=new AbortController;n=UGo(()=>{a.abort()},this.timeout),i.signal=a.signal}try{return this.fetch(r,i)}finally{clearTimeout(n)}}};async function TKp(e,t,r=""){let i=await KXD(`${e}.${t}${r}`);return parseInt(i.slice(0,15),16)/XXD}function JKp(e,t,r){let i=e.key,n=e.value,a=e.operator||"exact";if(i in t){if(a==="is_not_set")throw new c5("Operator is_not_set is not supported")}else throw new c5(`Property ${i} not found in propertyValues`);let u=t[i];if(u==null&&!ZXD.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function c(s,o){return Array.isArray(s)?s.map(l=>String(l).toLowerCase()).includes(String(o).toLowerCase()):String(s).toLowerCase()===String(o).toLowerCase()}function d(s,o,l){if(l==="gt")return s>o;if(l==="gte")return s>=o;if(l==="lt")return s<o;if(l==="lte")return s<=o;throw new Error(`Invalid operator: ${l}`)}switch(a){case"exact":return c(n,u);case"is_not":return!c(n,u);case"is_set":return i in t;case"icontains":return String(u).toLowerCase().includes(String(n).toLowerCase());case"not_icontains":return!String(u).toLowerCase().includes(String(n).toLowerCase());case"regex":return CKp(String(n))&&String(u).match(String(n))!==null;case"not_regex":return CKp(String(n))&&String(u).match(String(n))===null;case"gt":case"gte":case"lt":case"lte":{let s=typeof n=="number"?n:null;if(typeof n=="string")try{s=parseFloat(n)}catch{}return s!=null&&u!=null?typeof u=="string"?d(u,String(n),a):d(u,s,a):d(String(u),String(n),a)}case"is_date_after":case"is_date_before":{let s=kXD(String(n));if(s==null&&(s=BKp(n)),s==null)throw new c5(`Invalid date: ${n}`);let o=BKp(u);return["is_date_before"].includes(a)?o<s:o>s}default:throw new c5(`Unknown operator: ${a}`)}}function KKp(e,t,r,i=!1){let n=String(e.value);if(!(n in r))throw new c5("can't match cohort without a given cohort property value");let a=r[n];return YKp(a,t,r,i)}function YKp(e,t,r,i=!1){if(!e)return!0;let n=e.type,a=e.values;if(!a||a.length===0)return!0;let u=!1;if("values"in a[0]){for(let c of a)try{let d=YKp(c,t,r,i);if(n==="AND"){if(!d)return!1}else if(d)return!0}catch(d){if(d instanceof c5)i&&console.debug(`Failed to compute property ${c} locally: ${d}`),u=!0;else throw d}if(u)throw new c5("Can't match cohort without a given cohort property value");return n==="AND"}else{for(let c of a)try{let d;c.type==="cohort"?d=KKp(c,t,r,i):d=JKp(c,t);let s=c.negation||!1;if(n==="AND"){if(!d&&!s||d&&s)return!1}else if(d&&!s||!d&&s)return!0}catch(d){if(d instanceof c5)i&&console.debug(`Failed to compute property ${c} locally: ${d}`),u=!0;else throw d}if(u)throw new c5("can't match cohort without a given cohort property value");return n==="AND"}}function CKp(e){try{return new RegExp(e),!0}catch{return!1}}function BKp(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 c5(`${e} is in an invalid date format`)}else throw new c5(`The date provided ${e} must be a string, number, or date object`)}function kXD(e){let t=/^-?(?<number>[0-9]+)(?<interval>[a-z])$/,r=e.match(t),i=new Date(new Date().toISOString());if(r){if(!r.groups)return null;let n=parseInt(r.groups.number);if(n>=1e4)return null;let a=r.groups.interval;if(a=="h")i.setUTCHours(i.getUTCHours()-n);else if(a=="d")i.setUTCDate(i.getUTCDate()-n);else if(a=="w")i.setUTCDate(i.getUTCDate()-n*7);else if(a=="m")i.setUTCMonth(i.getUTCMonth()-n);else if(a=="y")i.setUTCFullYear(i.getUTCFullYear()-n);else return null;return i}else return null}var lpc=class{constructor(){this._memoryStorage={}}getProperty(t){return this._memoryStorage[t]}setProperty(t,r){this._memoryStorage[t]=r!==null?r:void 0}},eZD=100,IKp=30*1e3,tZD=50*1e3,fpc=class extends upc{constructor(t,r={}){if(super(t,r),this._memoryStorage=new lpc,this.options=r,this.options.featureFlagsPollingInterval=typeof r.featureFlagsPollingInterval=="number"?Math.max(r.featureFlagsPollingInterval,eZD):IKp,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 cpc({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:r.personalApiKey,projectApiKey:t,timeout:r.requestTimeout??1e4,host:this.host,fetch:r.fetch,onError:i=>{this._events.emit("error",i)},onLoad:i=>{this._events.emit("localEvaluationFlagsLoaded",i)},customHeaders:this.getCustomHeaders()})}this.errorTracking=new BWn(this,r),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=r.maxCacheSize||tZD}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):GKp(t,r)}getLibraryVersion(){return qXD}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:i,properties:n,groups:a,sendFeatureFlags:u,timestamp:c,disableGeoip:d,uuid:s}=t,o=g=>{super.captureStateless(r,i,g,{timestamp:c,disableGeoip:d,uuid:s})},l=async(g,O,m)=>(await super.getFeatureFlagsStateless(g,O,void 0,void 0,m)).flags,v=Promise.resolve().then(async()=>{if(u)return await l(r,a,d);if(i==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let g={};for(let[O,m]of Object.entries(a||{}))g[O]=String(m);return await this.getAllFlags(r,{groups:g,disableGeoip:d,onlyEvaluateLocally:!0})}return{}}).then(g=>{let O={};if(g)for(let[P,D]of Object.entries(g))O[`$feature/${P}`]=D;let m=Object.keys(g||{}).filter(P=>g?.[P]!==!1).sort();return m.length>0&&(O.$active_feature_flags=m),O}).catch(()=>({})).then(g=>{o({...g,...n,$groups:a})});this.addPendingPromise(v)}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:i,properties:n,groups:a,sendFeatureFlags:u,timestamp:c,disableGeoip:d,uuid:s}=t,o=g=>super.captureStatelessImmediate(r,i,g,{timestamp:c,disableGeoip:d,uuid:s}),l=async(g,O,m)=>(await super.getFeatureFlagsStateless(g,O,void 0,void 0,m)).flags;await Promise.resolve().then(async()=>{if(u)return await l(r,a,d);if(i==="$feature_flag_called")return{};if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let g={};for(let[O,m]of Object.entries(a||{}))g[O]=String(m);return await this.getAllFlags(r,{groups:g,disableGeoip:d,onlyEvaluateLocally:!0})}return{}}).then(g=>{let O={};if(g)for(let[P,D]of Object.entries(g))O[`$feature/${P}`]=D;let m=Object.keys(g||{}).filter(P=>g?.[P]!==!1).sort();return m.length>0&&(O.$active_feature_flags=m),O}).catch(()=>({})).then(g=>{o({...g,...n,$groups:a})})}identify({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;super.identifyStateless(t,{$set:a,$set_once:n},{disableGeoip:i})}async identifyImmediate({distinctId:t,properties:r,disableGeoip:i}){let n=r?.$set_once;delete r?.$set_once;let a=r?.$set||r;await super.identifyStatelessImmediate(t,{$set:a,$set_once:n},{disableGeoip:i})}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=IKp){return this.isLocalEvaluationReady()?!0:this.featureFlagsPoller===void 0?!1:new Promise(r=>{let i=setTimeout(()=>{n(),r(!1)},t),n=this._events.on("localEvaluationFlagsLoaded",a=>{clearTimeout(i),n(),r(a>0)})})}async getFeatureFlag(t,r,i){let{groups:n,disableGeoip:a}=i||{},{onlyEvaluateLocally:u,sendFeatureFlagEvents:c,personProperties:d,groupProperties:s}=i||{},o=this.addLocalPersonAndGroupProperties(r,n,d,s);d=o.allPersonProperties,s=o.allGroupProperties,u==null&&(u=!1),c==null&&(c=!0);let l=await this.featureFlagsPoller?.getFeatureFlag(t,r,n,d,s),v=l!==void 0,g,O;if(!v&&!u){let P=await super.getFeatureFlagDetailStateless(t,r,n,d,s,a);if(P===void 0)return;O=P.response,l=_pc(O),g=P?.requestId}let m=`${t}_${l}`;return c&&(!(r in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[r].includes(m))&&(Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[r])?this.distinctIdHasSentFlagCalls[r].push(m):this.distinctIdHasSentFlagCalls[r]=[m],this.capture({distinctId:r,event:"$feature_flag_called",properties:{$feature_flag:t,$feature_flag_response:l,$feature_flag_id:O?.metadata?.id,$feature_flag_version:O?.metadata?.version,$feature_flag_reason:O?.reason?.description??O?.reason?.code,locally_evaluated:v,[`$feature/${t}`]:l,$feature_flag_request_id:g},groups:n,disableGeoip:a})),l}async getFeatureFlagPayload(t,r,i,n){let{groups:a,disableGeoip:u}=n||{},{onlyEvaluateLocally:c,sendFeatureFlagEvents:d,personProperties:s,groupProperties:o}=n||{},l=this.addLocalPersonAndGroupProperties(r,a,s,o);s=l.allPersonProperties,o=l.allGroupProperties;let v;return this.featureFlagsPoller!==void 0&&(i||(i=await this.getFeatureFlag(t,r,{...n,onlyEvaluateLocally:!0,sendFeatureFlagEvents:!1})),i&&(v=await this.featureFlagsPoller?.computeFeatureFlagPayloadLocally(t,i))),c==null&&(c=!1),d==null&&(d=!0),c==null&&(c=!1),!(v!==void 0)&&!c&&(v=await super.getFeatureFlagPayloadStateless(t,r,a,s,o,u)),v}async getRemoteConfigPayload(t){return(await this.featureFlagsPoller?._requestRemoteConfigPayload(t))?.json()}async isFeatureEnabled(t,r,i){let n=await this.getFeatureFlag(t,r,i);if(n!==void 0)return!!n||!1}async getAllFlags(t,r){return(await this.getAllFlagsAndPayloads(t,r)).featureFlags||{}}async getAllFlagsAndPayloads(t,r){let{groups:i,disableGeoip:n}=r||{},{onlyEvaluateLocally:a,personProperties:u,groupProperties:c}=r||{},d=this.addLocalPersonAndGroupProperties(t,i,u,c);u=d.allPersonProperties,c=d.allGroupProperties,a==null&&(a=!1);let s=await this.featureFlagsPoller?.getAllFlagsAndPayloads(t,i,u,c),o={},l={},v=!0;if(s&&(o=s.response,l=s.payloads,v=s.fallbackToDecide),v&&!a){let g=await super.getFeatureFlagsAndPayloadsStateless(t,i,u,c,n);o={...o,...g.flags||{}},l={...l,...g.payloads||{}}}return{featureFlags:o,featureFlagPayloads:l}}groupIdentify({groupType:t,groupKey:r,properties:i,distinctId:n,disableGeoip:a}){super.groupIdentifyStateless(t,r,i,{disableGeoip:a},n)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}async _shutdown(t){return this.featureFlagsPoller?.stopPoller(),super._shutdown(t)}addLocalPersonAndGroupProperties(t,r,i,n){let a={distinct_id:t,...i||{}},u={};if(r)for(let c of Object.keys(r))u[c]={$group_key:r[c],...n?.[c]||{}};return{allPersonProperties:a,allGroupProperties:u}}captureException(t,r,i){let n=new Error("PostHog syntheticException");BWn.captureException(this,t,{syntheticException:n},r,i)}},zKp=/\(error: (.*)\)/,XKp=50,ZKp="?";function rZD(e){let t=/^\s*[-]{4,}$/,r=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/;return i=>{let n=i.match(r);if(n){let a,u,c,d,s;if(n[1]){c=n[1];let v=c.lastIndexOf(".");if(c[v-1]==="."&&v--,v>0){a=c.slice(0,v),u=c.slice(v+1);let g=a.indexOf(".Module");g>0&&(c=c.slice(g+1),a=a.slice(0,g))}d=void 0}u&&(d=a,s=u),u==="<anonymous>"&&(s=void 0,c=void 0),c===void 0&&(s=s||ZKp,c=d?`${d}.${s}`:s);let o=n[2]?.startsWith("file://")?n[2].slice(7):n[2],l=n[5]==="native";return o?.match(/\/[A-Z]:/)&&(o=o.slice(1)),!o&&n[5]&&!l&&(o=n[5]),{filename:o?decodeURI(o):void 0,module:e?e(o):void 0,function:c,lineno:xKp(n[3]),colno:xKp(n[4]),in_app:iZD(o||"",l),platform:"node:javascript"}}if(i.match(t))return{filename:i,platform:"node:javascript"}}}function iZD(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 xKp(e){return parseInt(e||"",10)||void 0}function nZD(e){return[90,rZD(e)]}function aZD(e){let r=[nZD(e)].sort((i,n)=>i[0]-n[0]).map(i=>i[1]);return(i,n=0)=>{let a=[],u=i.split(`
1720
- `);for(let c=n;c<u.length;c++){let d=u[c];if(d.length>1024)continue;let s=zKp.test(d)?d.replace(zKp,"$1"):d;if(!s.match(/\S*Error: /)){for(let o of r){let l=o(s);if(l){a.push(l);break}}if(a.length>=XKp)break}}return oZD(a)}}function oZD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,XKp).map(r=>({...r,filename:r.filename||uZD(t).filename,function:r.function||ZKp}))}function uZD(e){return e[e.length-1]||{}}BWn.stackParser=aZD(vXD());BWn.frameModifiers=[OXD];var zWn=class extends fpc{getLibraryId(){return"posthog-node"}};var WGo=class{posthog;constructor({posthogApiKey:t}){this.posthog=new zWn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.77.0",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var A7a=class{async sendEvent(){}async identify(){}async flush(){}};var RWn=require("fs/promises"),rYp=require("os"),iYp=require("path");var kKp=oi(require("crypto")),$Go=new Uint8Array(256),HGo=$Go.length;function hpc(){return HGo>$Go.length-16&&(kKp.default.randomFillSync($Go),HGo=0),$Go.slice(HGo,HGo+=16)}var n$=[];for(let e=0;e<256;++e)n$.push((e+256).toString(16).slice(1));function eYp(e,t=0){return n$[e[t+0]]+n$[e[t+1]]+n$[e[t+2]]+n$[e[t+3]]+"-"+n$[e[t+4]]+n$[e[t+5]]+"-"+n$[e[t+6]]+n$[e[t+7]]+"-"+n$[e[t+8]]+n$[e[t+9]]+"-"+n$[e[t+10]]+n$[e[t+11]]+n$[e[t+12]]+n$[e[t+13]]+n$[e[t+14]]+n$[e[t+15]]}var tYp=oi(require("crypto")),ypc={randomUUID:tYp.default.randomUUID};function sZD(e,t,r){if(ypc.randomUUID&&!t&&!e)return ypc.randomUUID();e=e||{};let i=e.random||(e.rng||hpc)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return eYp(i)}var _ue=sZD;var cZD="id",lZD=".fern",q7a=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new zWn(r),this.userId=t==null?void 0:noc(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.77.0",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Bu($c.of((0,rYp.homedir)()),za.of(lZD),za.of(cZD));await Cf(t)||(await(0,RWn.mkdir)((0,iYp.dirname)(t),{recursive:!0}),await(0,RWn.writeFile)(t,_ue())),this.persistedDistinctId=(await(0,RWn.readFile)(t)).toString()}return this.persistedDistinctId}};var vpc;async function NWn(){return vpc==null&&(vpc=await fZD()),vpc}async function fZD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new A7a;let r=await uLo();return r!=null?new q7a({token:r,posthogApiKey:e}):await BUn()!=null?new WGo({posthogApiKey:e}):new q7a({token:void 0,posthogApiKey:e})}catch{return new A7a}}function T7a(e,t){return function(){return e.apply(t,arguments)}}var{toString:dZD}=Object.prototype,{getPrototypeOf:gpc}=Object,{iterator:QGo,toStringTag:aYp}=Symbol,JGo=(e=>t=>{let r=dZD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),HGt=e=>(e=e.toLowerCase(),t=>JGo(t)===e),KGo=e=>t=>typeof t===e,{isArray:LWn}=Array,FWn=KGo("undefined");function C7a(e){return e!==null&&!FWn(e)&&e.constructor!==null&&!FWn(e.constructor)&&hue(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var oYp=HGt("ArrayBuffer");function pZD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&oYp(e.buffer),t}var _ZD=KGo("string"),hue=KGo("function"),uYp=KGo("number"),B7a=e=>e!==null&&typeof e=="object",hZD=e=>e===!0||e===!1,GGo=e=>{if(JGo(e)!=="object")return!1;let t=gpc(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(aYp in e)&&!(QGo in e)},yZD=e=>{if(!B7a(e)||C7a(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},vZD=HGt("Date"),bZD=HGt("File"),gZD=HGt("Blob"),OZD=HGt("FileList"),mZD=e=>B7a(e)&&hue(e.pipe),PZD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||hue(e.append)&&((t=JGo(e))==="formdata"||t==="object"&&hue(e.toString)&&e.toString()==="[object FormData]"))},jZD=HGt("URLSearchParams"),[wZD,SZD,DZD,EZD]=["ReadableStream","Request","Response","Headers"].map(HGt),MZD=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function I7a(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),LWn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{if(C7a(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,c;for(i=0;i<u;i++)c=a[i],t.call(null,e[c],c,e)}}function sYp(e,t){if(C7a(e))return null;t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var ztn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,cYp=e=>!FWn(e)&&e!==ztn;function bpc(){let{caseless:e,skipUndefined:t}=cYp(this)&&this||{},r={},i=(n,a)=>{let u=e&&sYp(r,a)||a;GGo(r[u])&&GGo(n)?r[u]=bpc(r[u],n):GGo(n)?r[u]=bpc({},n):LWn(n)?r[u]=n.slice():(!t||!FWn(n))&&(r[u]=n)};for(let n=0,a=arguments.length;n<a;n++)arguments[n]&&I7a(arguments[n],i);return r}var AZD=(e,t,r,{allOwnKeys:i}={})=>(I7a(t,(n,a)=>{r&&hue(n)?e[a]=T7a(n,r):e[a]=n},{allOwnKeys:i}),e),qZD=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),TZD=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},CZD=(e,t,r,i)=>{let n,a,u,c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!c[u]&&(t[u]=e[u],c[u]=!0);e=r!==!1&&gpc(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},BZD=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},IZD=e=>{if(!e)return null;if(LWn(e))return e;let t=e.length;if(!uYp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},zZD=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gpc(Uint8Array)),xZD=(e,t)=>{let i=(e&&e[QGo]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},RZD=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},NZD=HGt("HTMLFormElement"),FZD=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),nYp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),LZD=HGt("RegExp"),lYp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};I7a(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},UZD=e=>{lYp(e,(t,r)=>{if(hue(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(hue(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},VZD=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return LWn(e)?i(e):i(String(e).split(t)),r},WZD=()=>{},HZD=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function $ZD(e){return!!(e&&hue(e.append)&&e[aYp]==="FormData"&&e[QGo])}var GZD=e=>{let t=new Array(10),r=(i,n)=>{if(B7a(i)){if(t.indexOf(i)>=0)return;if(C7a(i))return i;if(!("toJSON"in i)){t[n]=i;let a=LWn(i)?[]:{};return I7a(i,(u,c)=>{let d=r(u,n+1);!FWn(d)&&(a[c]=d)}),t[n]=void 0,a}}return i};return r(e,0)},QZD=HGt("AsyncFunction"),JZD=e=>e&&(B7a(e)||hue(e))&&hue(e.then)&&hue(e.catch),fYp=((e,t)=>e?setImmediate:t?((r,i)=>(ztn.addEventListener("message",({source:n,data:a})=>{n===ztn&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),ztn.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",hue(ztn.postMessage)),KZD=typeof queueMicrotask<"u"?queueMicrotask.bind(ztn):typeof process<"u"&&process.nextTick||fYp,YZD=e=>e!=null&&hue(e[QGo]),ss={isArray:LWn,isArrayBuffer:oYp,isBuffer:C7a,isFormData:PZD,isArrayBufferView:pZD,isString:_ZD,isNumber:uYp,isBoolean:hZD,isObject:B7a,isPlainObject:GGo,isEmptyObject:yZD,isReadableStream:wZD,isRequest:SZD,isResponse:DZD,isHeaders:EZD,isUndefined:FWn,isDate:vZD,isFile:bZD,isBlob:gZD,isRegExp:LZD,isFunction:hue,isStream:mZD,isURLSearchParams:jZD,isTypedArray:zZD,isFileList:OZD,forEach:I7a,merge:bpc,extend:AZD,trim:MZD,stripBOM:qZD,inherits:TZD,toFlatObject:CZD,kindOf:JGo,kindOfTest:HGt,endsWith:BZD,toArray:IZD,forEachEntry:xZD,matchAll:RZD,isHTMLForm:NZD,hasOwnProperty:nYp,hasOwnProp:nYp,reduceDescriptors:lYp,freezeMethods:UZD,toObjectSet:VZD,toCamelCase:FZD,noop:WZD,toFiniteNumber:HZD,findKey:sYp,global:ztn,isContextDefined:cYp,isSpecCompliantForm:$ZD,toJSONObject:GZD,isAsyncFn:QZD,isThenable:JZD,setImmediate:fYp,asap:KZD,isIterable:YZD};function UWn(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}ss.inherits(UWn,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:ss.toJSONObject(this.config),code:this.code,status:this.status}}});var dYp=UWn.prototype,pYp={};["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=>{pYp[e]={value:e}});Object.defineProperties(UWn,pYp);Object.defineProperty(dYp,"isAxiosError",{value:!0});UWn.from=(e,t,r,i,n,a)=>{let u=Object.create(dYp);ss.toFlatObject(e,u,function(o){return o!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return UWn.call(u,c,d,r,i,n),e&&u.cause==null&&Object.defineProperty(u,"cause",{value:e,configurable:!0}),u.name=e&&e.name||"Error",a&&Object.assign(u,a),u};var Vp=UWn;var _Yp=oi(gGo(),1),YGo=_Yp.default;function Opc(e){return ss.isPlainObject(e)||ss.isArray(e)}function yYp(e){return ss.endsWith(e,"[]")?e.slice(0,-2):e}function hYp(e,t,r){return e?e.concat(t).map(function(n,a){return n=yYp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function XZD(e){return ss.isArray(e)&&!e.some(Opc)}var ZZD=ss.toFlatObject(ss,{},null,function(t){return/^is[A-Z]/.test(t)});function kZD(e,t,r){if(!ss.isObject(e))throw new TypeError("target must be an object");t=t||new(YGo||FormData),r=ss.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,P){return!ss.isUndefined(P[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&ss.isSpecCompliantForm(t);if(!ss.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(ss.isDate(O))return O.toISOString();if(ss.isBoolean(O))return O.toString();if(!d&&ss.isBlob(O))throw new Vp("Blob is not supported. Use a Buffer instead.");return ss.isArrayBuffer(O)||ss.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,P){let D=O;if(O&&!P&&typeof O=="object"){if(ss.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(ss.isArray(O)&&XZD(O)||(ss.isFileList(O)||ss.endsWith(m,"[]"))&&(D=ss.toArray(O)))return m=yYp(m),D.forEach(function(M,E){!(ss.isUndefined(M)||M===null)&&t.append(u===!0?hYp([m],E,a):u===null?m:m+"[]",s(M))}),!1}return Opc(O)?!0:(t.append(hYp(P,m,a),s(O)),!1)}let l=[],v=Object.assign(ZZD,{defaultVisitor:o,convertValue:s,isVisitable:Opc});function g(O,m){if(!ss.isUndefined(O)){if(l.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));l.push(O),ss.forEach(O,function(D,A){(!(ss.isUndefined(D)||D===null)&&n.call(t,D,ss.isString(A)?A.trim():A,m,v))===!0&&g(D,m?m.concat(A):[A])}),l.pop()}}if(!ss.isObject(e))throw new TypeError("data must be an object");return g(e),t}var Exi=kZD;function vYp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function bYp(e,t){this._pairs=[],e&&Exi(e,this,t)}var gYp=bYp.prototype;gYp.append=function(t,r){this._pairs.push([t,r])};gYp.toString=function(t){let r=t?function(i){return t.call(this,i,vYp)}:vYp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var OYp=bYp;function ekD(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function xtn(e,t,r){if(!t)return e;let i=r&&r.encode||ekD;ss.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=ss.isURLSearchParams(t)?t.toString():new OYp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var mpc=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ss.forEach(this.handlers,function(i){i!==null&&t(i)})}},Ppc=mpc;var VWn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var wYp=oi(require("crypto"),1);var mYp=oi(require("url"),1),PYp=mYp.default.URLSearchParams;var jpc="abcdefghijklmnopqrstuvwxyz",jYp="0123456789",SYp={DIGIT:jYp,ALPHA:jpc,ALPHA_DIGIT:jpc+jpc.toUpperCase()+jYp},tkD=(e=16,t=SYp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);wYp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},DYp={isNode:!0,classes:{URLSearchParams:PYp,FormData:YGo,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:SYp,generateString:tkD,protocols:["http","https","file","data"]};var Dpc={};Na(Dpc,{hasBrowserEnv:()=>Spc,hasStandardBrowserEnv:()=>rkD,hasStandardBrowserWebWorkerEnv:()=>ikD,navigator:()=>wpc,origin:()=>nkD});var Spc=typeof window<"u"&&typeof document<"u",wpc=typeof navigator=="object"&&navigator||void 0,rkD=Spc&&(!wpc||["ReactNative","NativeScript","NS"].indexOf(wpc.product)<0),ikD=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",nkD=Spc&&window.location.href||"http://localhost";var rq={...Dpc,...DYp};function Epc(e,t){return Exi(e,new rq.classes.URLSearchParams,{visitor:function(r,i,n,a){return rq.isNode&&ss.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function akD(e){return ss.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function okD(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function ukD(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let c=Number.isFinite(+u),d=a>=r.length;return u=!u&&ss.isArray(n)?n.length:u,d?(ss.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!c):((!n[u]||!ss.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&ss.isArray(n[u])&&(n[u]=okD(n[u])),!c)}if(ss.isFormData(e)&&ss.isFunction(e.entries)){let r={};return ss.forEachEntry(e,(i,n)=>{t(akD(i),n,r,0)}),r}return null}var XGo=ukD;function skD(e,t,r){if(ss.isString(e))try{return(t||JSON.parse)(e),ss.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var Mpc={transitional:VWn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=ss.isObject(t);if(a&&ss.isHTMLForm(t)&&(t=new FormData(t)),ss.isFormData(t))return n?JSON.stringify(XGo(t)):t;if(ss.isArrayBuffer(t)||ss.isBuffer(t)||ss.isStream(t)||ss.isFile(t)||ss.isBlob(t)||ss.isReadableStream(t))return t;if(ss.isArrayBufferView(t))return t.buffer;if(ss.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Epc(t,this.formSerializer).toString();if((c=ss.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return Exi(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),skD(t)):t}],transformResponse:[function(t){let r=this.transitional||Mpc.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(ss.isResponse(t)||ss.isReadableStream(t))return t;if(t&&ss.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(c){if(u)throw c.name==="SyntaxError"?Vp.from(c,Vp.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:rq.classes.FormData,Blob:rq.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ss.forEach(["delete","get","head","post","put","patch"],e=>{Mpc.headers[e]={}});var WWn=Mpc;var ckD=ss.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"]),EYp=e=>{let t={},r,i,n;return e&&e.split(`
1720
+ `);for(let c=n;c<u.length;c++){let d=u[c];if(d.length>1024)continue;let s=zKp.test(d)?d.replace(zKp,"$1"):d;if(!s.match(/\S*Error: /)){for(let o of r){let l=o(s);if(l){a.push(l);break}}if(a.length>=XKp)break}}return oZD(a)}}function oZD(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,XKp).map(r=>({...r,filename:r.filename||uZD(t).filename,function:r.function||ZKp}))}function uZD(e){return e[e.length-1]||{}}BWn.stackParser=aZD(vXD());BWn.frameModifiers=[OXD];var zWn=class extends fpc{getLibraryId(){return"posthog-node"}};var WGo=class{posthog;constructor({posthogApiKey:t}){this.posthog=new zWn(t)}async identify(){}async sendEvent(t){t.orgId!=null&&this.posthog.capture({distinctId:t.orgId,event:"CLI",properties:{...t,...t.properties,version:"0.77.1",usingAccessToken:!0}})}async flush(){await this.posthog.flush()}};var A7a=class{async sendEvent(){}async identify(){}async flush(){}};var RWn=require("fs/promises"),rYp=require("os"),iYp=require("path");var kKp=oi(require("crypto")),$Go=new Uint8Array(256),HGo=$Go.length;function hpc(){return HGo>$Go.length-16&&(kKp.default.randomFillSync($Go),HGo=0),$Go.slice(HGo,HGo+=16)}var n$=[];for(let e=0;e<256;++e)n$.push((e+256).toString(16).slice(1));function eYp(e,t=0){return n$[e[t+0]]+n$[e[t+1]]+n$[e[t+2]]+n$[e[t+3]]+"-"+n$[e[t+4]]+n$[e[t+5]]+"-"+n$[e[t+6]]+n$[e[t+7]]+"-"+n$[e[t+8]]+n$[e[t+9]]+"-"+n$[e[t+10]]+n$[e[t+11]]+n$[e[t+12]]+n$[e[t+13]]+n$[e[t+14]]+n$[e[t+15]]}var tYp=oi(require("crypto")),ypc={randomUUID:tYp.default.randomUUID};function sZD(e,t,r){if(ypc.randomUUID&&!t&&!e)return ypc.randomUUID();e=e||{};let i=e.random||(e.rng||hpc)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t){r=r||0;for(let n=0;n<16;++n)t[r+n]=i[n];return t}return eYp(i)}var _ue=sZD;var cZD="id",lZD=".fern",q7a=class{posthog;userId;constructor({token:t,posthogApiKey:r}){this.posthog=new zWn(r),this.userId=t==null?void 0:noc(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.77.1",...t,...t.properties}})}async flush(){await this.posthog.flush()}persistedDistinctId;async getPersistedDistinctId(){if(this.persistedDistinctId==null){let t=Bu($c.of((0,rYp.homedir)()),za.of(lZD),za.of(cZD));await Cf(t)||(await(0,RWn.mkdir)((0,iYp.dirname)(t),{recursive:!0}),await(0,RWn.writeFile)(t,_ue())),this.persistedDistinctId=(await(0,RWn.readFile)(t)).toString()}return this.persistedDistinctId}};var vpc;async function NWn(){return vpc==null&&(vpc=await fZD()),vpc}async function fZD(){try{let e="phc_yQgAEdJJkVpI24NdSRID2mor1x1leRpDoC9yZ9mfXal",t=process.env.FERN_DISABLE_TELEMETRY==="true";if(e==null||t)return new A7a;let r=await uLo();return r!=null?new q7a({token:r,posthogApiKey:e}):await BUn()!=null?new WGo({posthogApiKey:e}):new q7a({token:void 0,posthogApiKey:e})}catch{return new A7a}}function T7a(e,t){return function(){return e.apply(t,arguments)}}var{toString:dZD}=Object.prototype,{getPrototypeOf:gpc}=Object,{iterator:QGo,toStringTag:aYp}=Symbol,JGo=(e=>t=>{let r=dZD.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),HGt=e=>(e=e.toLowerCase(),t=>JGo(t)===e),KGo=e=>t=>typeof t===e,{isArray:LWn}=Array,FWn=KGo("undefined");function C7a(e){return e!==null&&!FWn(e)&&e.constructor!==null&&!FWn(e.constructor)&&hue(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var oYp=HGt("ArrayBuffer");function pZD(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&oYp(e.buffer),t}var _ZD=KGo("string"),hue=KGo("function"),uYp=KGo("number"),B7a=e=>e!==null&&typeof e=="object",hZD=e=>e===!0||e===!1,GGo=e=>{if(JGo(e)!=="object")return!1;let t=gpc(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(aYp in e)&&!(QGo in e)},yZD=e=>{if(!B7a(e)||C7a(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},vZD=HGt("Date"),bZD=HGt("File"),gZD=HGt("Blob"),OZD=HGt("FileList"),mZD=e=>B7a(e)&&hue(e.pipe),PZD=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||hue(e.append)&&((t=JGo(e))==="formdata"||t==="object"&&hue(e.toString)&&e.toString()==="[object FormData]"))},jZD=HGt("URLSearchParams"),[wZD,SZD,DZD,EZD]=["ReadableStream","Request","Response","Headers"].map(HGt),MZD=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function I7a(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let i,n;if(typeof e!="object"&&(e=[e]),LWn(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{if(C7a(e))return;let a=r?Object.getOwnPropertyNames(e):Object.keys(e),u=a.length,c;for(i=0;i<u;i++)c=a[i],t.call(null,e[c],c,e)}}function sYp(e,t){if(C7a(e))return null;t=t.toLowerCase();let r=Object.keys(e),i=r.length,n;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}var ztn=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,cYp=e=>!FWn(e)&&e!==ztn;function bpc(){let{caseless:e,skipUndefined:t}=cYp(this)&&this||{},r={},i=(n,a)=>{let u=e&&sYp(r,a)||a;GGo(r[u])&&GGo(n)?r[u]=bpc(r[u],n):GGo(n)?r[u]=bpc({},n):LWn(n)?r[u]=n.slice():(!t||!FWn(n))&&(r[u]=n)};for(let n=0,a=arguments.length;n<a;n++)arguments[n]&&I7a(arguments[n],i);return r}var AZD=(e,t,r,{allOwnKeys:i}={})=>(I7a(t,(n,a)=>{r&&hue(n)?e[a]=T7a(n,r):e[a]=n},{allOwnKeys:i}),e),qZD=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),TZD=(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},CZD=(e,t,r,i)=>{let n,a,u,c={};if(t=t||{},e==null)return t;do{for(n=Object.getOwnPropertyNames(e),a=n.length;a-- >0;)u=n[a],(!i||i(u,e,t))&&!c[u]&&(t[u]=e[u],c[u]=!0);e=r!==!1&&gpc(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},BZD=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;let i=e.indexOf(t,r);return i!==-1&&i===r},IZD=e=>{if(!e)return null;if(LWn(e))return e;let t=e.length;if(!uYp(t))return null;let r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},zZD=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&gpc(Uint8Array)),xZD=(e,t)=>{let i=(e&&e[QGo]).call(e),n;for(;(n=i.next())&&!n.done;){let a=n.value;t.call(e,a[0],a[1])}},RZD=(e,t)=>{let r,i=[];for(;(r=e.exec(t))!==null;)i.push(r);return i},NZD=HGt("HTMLFormElement"),FZD=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,i,n){return i.toUpperCase()+n}),nYp=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),LZD=HGt("RegExp"),lYp=(e,t)=>{let r=Object.getOwnPropertyDescriptors(e),i={};I7a(r,(n,a)=>{let u;(u=t(n,a,e))!==!1&&(i[a]=u||n)}),Object.defineProperties(e,i)},UZD=e=>{lYp(e,(t,r)=>{if(hue(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;let i=e[r];if(hue(i)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},VZD=(e,t)=>{let r={},i=n=>{n.forEach(a=>{r[a]=!0})};return LWn(e)?i(e):i(String(e).split(t)),r},WZD=()=>{},HZD=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function $ZD(e){return!!(e&&hue(e.append)&&e[aYp]==="FormData"&&e[QGo])}var GZD=e=>{let t=new Array(10),r=(i,n)=>{if(B7a(i)){if(t.indexOf(i)>=0)return;if(C7a(i))return i;if(!("toJSON"in i)){t[n]=i;let a=LWn(i)?[]:{};return I7a(i,(u,c)=>{let d=r(u,n+1);!FWn(d)&&(a[c]=d)}),t[n]=void 0,a}}return i};return r(e,0)},QZD=HGt("AsyncFunction"),JZD=e=>e&&(B7a(e)||hue(e))&&hue(e.then)&&hue(e.catch),fYp=((e,t)=>e?setImmediate:t?((r,i)=>(ztn.addEventListener("message",({source:n,data:a})=>{n===ztn&&a===r&&i.length&&i.shift()()},!1),n=>{i.push(n),ztn.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",hue(ztn.postMessage)),KZD=typeof queueMicrotask<"u"?queueMicrotask.bind(ztn):typeof process<"u"&&process.nextTick||fYp,YZD=e=>e!=null&&hue(e[QGo]),ss={isArray:LWn,isArrayBuffer:oYp,isBuffer:C7a,isFormData:PZD,isArrayBufferView:pZD,isString:_ZD,isNumber:uYp,isBoolean:hZD,isObject:B7a,isPlainObject:GGo,isEmptyObject:yZD,isReadableStream:wZD,isRequest:SZD,isResponse:DZD,isHeaders:EZD,isUndefined:FWn,isDate:vZD,isFile:bZD,isBlob:gZD,isRegExp:LZD,isFunction:hue,isStream:mZD,isURLSearchParams:jZD,isTypedArray:zZD,isFileList:OZD,forEach:I7a,merge:bpc,extend:AZD,trim:MZD,stripBOM:qZD,inherits:TZD,toFlatObject:CZD,kindOf:JGo,kindOfTest:HGt,endsWith:BZD,toArray:IZD,forEachEntry:xZD,matchAll:RZD,isHTMLForm:NZD,hasOwnProperty:nYp,hasOwnProp:nYp,reduceDescriptors:lYp,freezeMethods:UZD,toObjectSet:VZD,toCamelCase:FZD,noop:WZD,toFiniteNumber:HZD,findKey:sYp,global:ztn,isContextDefined:cYp,isSpecCompliantForm:$ZD,toJSONObject:GZD,isAsyncFn:QZD,isThenable:JZD,setImmediate:fYp,asap:KZD,isIterable:YZD};function UWn(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}ss.inherits(UWn,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:ss.toJSONObject(this.config),code:this.code,status:this.status}}});var dYp=UWn.prototype,pYp={};["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=>{pYp[e]={value:e}});Object.defineProperties(UWn,pYp);Object.defineProperty(dYp,"isAxiosError",{value:!0});UWn.from=(e,t,r,i,n,a)=>{let u=Object.create(dYp);ss.toFlatObject(e,u,function(o){return o!==Error.prototype},s=>s!=="isAxiosError");let c=e&&e.message?e.message:"Error",d=t==null&&e?e.code:t;return UWn.call(u,c,d,r,i,n),e&&u.cause==null&&Object.defineProperty(u,"cause",{value:e,configurable:!0}),u.name=e&&e.name||"Error",a&&Object.assign(u,a),u};var Vp=UWn;var _Yp=oi(gGo(),1),YGo=_Yp.default;function Opc(e){return ss.isPlainObject(e)||ss.isArray(e)}function yYp(e){return ss.endsWith(e,"[]")?e.slice(0,-2):e}function hYp(e,t,r){return e?e.concat(t).map(function(n,a){return n=yYp(n),!r&&a?"["+n+"]":n}).join(r?".":""):t}function XZD(e){return ss.isArray(e)&&!e.some(Opc)}var ZZD=ss.toFlatObject(ss,{},null,function(t){return/^is[A-Z]/.test(t)});function kZD(e,t,r){if(!ss.isObject(e))throw new TypeError("target must be an object");t=t||new(YGo||FormData),r=ss.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,P){return!ss.isUndefined(P[m])});let i=r.metaTokens,n=r.visitor||o,a=r.dots,u=r.indexes,d=(r.Blob||typeof Blob<"u"&&Blob)&&ss.isSpecCompliantForm(t);if(!ss.isFunction(n))throw new TypeError("visitor must be a function");function s(O){if(O===null)return"";if(ss.isDate(O))return O.toISOString();if(ss.isBoolean(O))return O.toString();if(!d&&ss.isBlob(O))throw new Vp("Blob is not supported. Use a Buffer instead.");return ss.isArrayBuffer(O)||ss.isTypedArray(O)?d&&typeof Blob=="function"?new Blob([O]):Buffer.from(O):O}function o(O,m,P){let D=O;if(O&&!P&&typeof O=="object"){if(ss.endsWith(m,"{}"))m=i?m:m.slice(0,-2),O=JSON.stringify(O);else if(ss.isArray(O)&&XZD(O)||(ss.isFileList(O)||ss.endsWith(m,"[]"))&&(D=ss.toArray(O)))return m=yYp(m),D.forEach(function(M,E){!(ss.isUndefined(M)||M===null)&&t.append(u===!0?hYp([m],E,a):u===null?m:m+"[]",s(M))}),!1}return Opc(O)?!0:(t.append(hYp(P,m,a),s(O)),!1)}let l=[],v=Object.assign(ZZD,{defaultVisitor:o,convertValue:s,isVisitable:Opc});function g(O,m){if(!ss.isUndefined(O)){if(l.indexOf(O)!==-1)throw Error("Circular reference detected in "+m.join("."));l.push(O),ss.forEach(O,function(D,A){(!(ss.isUndefined(D)||D===null)&&n.call(t,D,ss.isString(A)?A.trim():A,m,v))===!0&&g(D,m?m.concat(A):[A])}),l.pop()}}if(!ss.isObject(e))throw new TypeError("data must be an object");return g(e),t}var Exi=kZD;function vYp(e){let t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(i){return t[i]})}function bYp(e,t){this._pairs=[],e&&Exi(e,this,t)}var gYp=bYp.prototype;gYp.append=function(t,r){this._pairs.push([t,r])};gYp.toString=function(t){let r=t?function(i){return t.call(this,i,vYp)}:vYp;return this._pairs.map(function(n){return r(n[0])+"="+r(n[1])},"").join("&")};var OYp=bYp;function ekD(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function xtn(e,t,r){if(!t)return e;let i=r&&r.encode||ekD;ss.isFunction(r)&&(r={serialize:r});let n=r&&r.serialize,a;if(n?a=n(t,r):a=ss.isURLSearchParams(t)?t.toString():new OYp(t,r).toString(i),a){let u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var mpc=class{constructor(){this.handlers=[]}use(t,r,i){return this.handlers.push({fulfilled:t,rejected:r,synchronous:i?i.synchronous:!1,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ss.forEach(this.handlers,function(i){i!==null&&t(i)})}},Ppc=mpc;var VWn={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};var wYp=oi(require("crypto"),1);var mYp=oi(require("url"),1),PYp=mYp.default.URLSearchParams;var jpc="abcdefghijklmnopqrstuvwxyz",jYp="0123456789",SYp={DIGIT:jYp,ALPHA:jpc,ALPHA_DIGIT:jpc+jpc.toUpperCase()+jYp},tkD=(e=16,t=SYp.ALPHA_DIGIT)=>{let r="",{length:i}=t,n=new Uint32Array(e);wYp.default.randomFillSync(n);for(let a=0;a<e;a++)r+=t[n[a]%i];return r},DYp={isNode:!0,classes:{URLSearchParams:PYp,FormData:YGo,Blob:typeof Blob<"u"&&Blob||null},ALPHABET:SYp,generateString:tkD,protocols:["http","https","file","data"]};var Dpc={};Na(Dpc,{hasBrowserEnv:()=>Spc,hasStandardBrowserEnv:()=>rkD,hasStandardBrowserWebWorkerEnv:()=>ikD,navigator:()=>wpc,origin:()=>nkD});var Spc=typeof window<"u"&&typeof document<"u",wpc=typeof navigator=="object"&&navigator||void 0,rkD=Spc&&(!wpc||["ReactNative","NativeScript","NS"].indexOf(wpc.product)<0),ikD=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",nkD=Spc&&window.location.href||"http://localhost";var rq={...Dpc,...DYp};function Epc(e,t){return Exi(e,new rq.classes.URLSearchParams,{visitor:function(r,i,n,a){return rq.isNode&&ss.isBuffer(r)?(this.append(i,r.toString("base64")),!1):a.defaultVisitor.apply(this,arguments)},...t})}function akD(e){return ss.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function okD(e){let t={},r=Object.keys(e),i,n=r.length,a;for(i=0;i<n;i++)a=r[i],t[a]=e[a];return t}function ukD(e){function t(r,i,n,a){let u=r[a++];if(u==="__proto__")return!0;let c=Number.isFinite(+u),d=a>=r.length;return u=!u&&ss.isArray(n)?n.length:u,d?(ss.hasOwnProp(n,u)?n[u]=[n[u],i]:n[u]=i,!c):((!n[u]||!ss.isObject(n[u]))&&(n[u]=[]),t(r,i,n[u],a)&&ss.isArray(n[u])&&(n[u]=okD(n[u])),!c)}if(ss.isFormData(e)&&ss.isFunction(e.entries)){let r={};return ss.forEachEntry(e,(i,n)=>{t(akD(i),n,r,0)}),r}return null}var XGo=ukD;function skD(e,t,r){if(ss.isString(e))try{return(t||JSON.parse)(e),ss.trim(e)}catch(i){if(i.name!=="SyntaxError")throw i}return(r||JSON.stringify)(e)}var Mpc={transitional:VWn,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){let i=r.getContentType()||"",n=i.indexOf("application/json")>-1,a=ss.isObject(t);if(a&&ss.isHTMLForm(t)&&(t=new FormData(t)),ss.isFormData(t))return n?JSON.stringify(XGo(t)):t;if(ss.isArrayBuffer(t)||ss.isBuffer(t)||ss.isStream(t)||ss.isFile(t)||ss.isBlob(t)||ss.isReadableStream(t))return t;if(ss.isArrayBufferView(t))return t.buffer;if(ss.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(a){if(i.indexOf("application/x-www-form-urlencoded")>-1)return Epc(t,this.formSerializer).toString();if((c=ss.isFileList(t))||i.indexOf("multipart/form-data")>-1){let d=this.env&&this.env.FormData;return Exi(c?{"files[]":t}:t,d&&new d,this.formSerializer)}}return a||n?(r.setContentType("application/json",!1),skD(t)):t}],transformResponse:[function(t){let r=this.transitional||Mpc.transitional,i=r&&r.forcedJSONParsing,n=this.responseType==="json";if(ss.isResponse(t)||ss.isReadableStream(t))return t;if(t&&ss.isString(t)&&(i&&!this.responseType||n)){let u=!(r&&r.silentJSONParsing)&&n;try{return JSON.parse(t,this.parseReviver)}catch(c){if(u)throw c.name==="SyntaxError"?Vp.from(c,Vp.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:rq.classes.FormData,Blob:rq.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ss.forEach(["delete","get","head","post","put","patch"],e=>{Mpc.headers[e]={}});var WWn=Mpc;var ckD=ss.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"]),EYp=e=>{let t={},r,i,n;return e&&e.split(`
1721
1721
  `).forEach(function(u){n=u.indexOf(":"),r=u.substring(0,n).trim().toLowerCase(),i=u.substring(n+1).trim(),!(!r||t[r]&&ckD[r])&&(r==="set-cookie"?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)}),t};var MYp=Symbol("internals");function z7a(e){return e&&String(e).trim().toLowerCase()}function ZGo(e){return e===!1||e==null?e:ss.isArray(e)?e.map(ZGo):String(e)}function lkD(e){let t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g,i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}var fkD=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Apc(e,t,r,i,n){if(ss.isFunction(i))return i.call(this,t,r);if(n&&(t=r),!!ss.isString(t)){if(ss.isString(i))return t.indexOf(i)!==-1;if(ss.isRegExp(i))return i.test(t)}}function dkD(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,i)=>r.toUpperCase()+i)}function pkD(e,t){let r=ss.toCamelCase(" "+t);["get","set","has"].forEach(i=>{Object.defineProperty(e,i+r,{value:function(n,a,u){return this[i].call(this,t,n,a,u)},configurable:!0})})}var HWn=class{constructor(t){t&&this.set(t)}set(t,r,i){let n=this;function a(c,d,s){let o=z7a(d);if(!o)throw new Error("header name must be a non-empty string");let l=ss.findKey(n,o);(!l||n[l]===void 0||s===!0||s===void 0&&n[l]!==!1)&&(n[l||d]=ZGo(c))}let u=(c,d)=>ss.forEach(c,(s,o)=>a(s,o,d));if(ss.isPlainObject(t)||t instanceof this.constructor)u(t,r);else if(ss.isString(t)&&(t=t.trim())&&!fkD(t))u(EYp(t),r);else if(ss.isObject(t)&&ss.isIterable(t)){let c={},d,s;for(let o of t){if(!ss.isArray(o))throw TypeError("Object iterator must return a key-value pair");c[s=o[0]]=(d=c[s])?ss.isArray(d)?[...d,o[1]]:[d,o[1]]:o[1]}u(c,r)}else t!=null&&a(r,t,i);return this}get(t,r){if(t=z7a(t),t){let i=ss.findKey(this,t);if(i){let n=this[i];if(!r)return n;if(r===!0)return lkD(n);if(ss.isFunction(r))return r.call(this,n,i);if(ss.isRegExp(r))return r.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=z7a(t),t){let i=ss.findKey(this,t);return!!(i&&this[i]!==void 0&&(!r||Apc(this,this[i],i,r)))}return!1}delete(t,r){let i=this,n=!1;function a(u){if(u=z7a(u),u){let c=ss.findKey(i,u);c&&(!r||Apc(i,i[c],c,r))&&(delete i[c],n=!0)}}return ss.isArray(t)?t.forEach(a):a(t),n}clear(t){let r=Object.keys(this),i=r.length,n=!1;for(;i--;){let a=r[i];(!t||Apc(this,this[a],a,t,!0))&&(delete this[a],n=!0)}return n}normalize(t){let r=this,i={};return ss.forEach(this,(n,a)=>{let u=ss.findKey(i,a);if(u){r[u]=ZGo(n),delete r[a];return}let c=t?dkD(a):String(a).trim();c!==a&&delete r[a],r[c]=ZGo(n),i[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){let r=Object.create(null);return ss.forEach(this,(i,n)=>{i!=null&&i!==!1&&(r[n]=t&&ss.isArray(i)?i.join(", "):i)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
1722
1722
  `)}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 i=new this(t);return r.forEach(n=>i.set(n)),i}static accessor(t){let i=(this[MYp]=this[MYp]={accessors:{}}).accessors,n=this.prototype;function a(u){let c=z7a(u);i[c]||(pkD(n,u),i[c]=!0)}return ss.isArray(t)?t.forEach(a):a(t),this}};HWn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ss.reduceDescriptors(HWn.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(i){this[r]=i}}});ss.freezeMethods(HWn);var h3=HWn;function x7a(e,t){let r=this||WWn,i=t||r,n=h3.from(i.headers),a=i.data;return ss.forEach(e,function(c){a=c.call(r,a,n.normalize(),t?t.status:void 0)}),n.normalize(),a}function R7a(e){return!!(e&&e.__CANCEL__)}function AYp(e,t,r){Vp.call(this,e??"canceled",Vp.ERR_CANCELED,t,r),this.name="CanceledError"}ss.inherits(AYp,Vp,{__CANCEL__:!0});var kAe=AYp;function iar(e,t,r){let i=r.config.validateStatus;!r.status||!i||i(r.status)?e(r):t(new Vp("Request failed with status code "+r.status,[Vp.ERR_BAD_REQUEST,Vp.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function qpc(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Tpc(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Rtn(e,t,r){let i=!qpc(t);return e&&(i||r==!1)?Tpc(e,t):t}var $Yp=oi(v7a(),1),GYp=oi(require("http"),1),QYp=oi(require("https"),1),JYp=oi(require("util"),1),KYp=oi(Cdc(),1),TOi=oi(require("zlib"),1);var Ntn="1.12.0";function N7a(e){let t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}var _kD=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Cpc(e,t,r){let i=r&&r.Blob||rq.classes.Blob,n=N7a(e);if(t===void 0&&i&&(t=!0),n==="data"){e=n.length?e.slice(n.length+1):e;let a=_kD.exec(e);if(!a)throw new Vp("Invalid URL",Vp.ERR_INVALID_URL);let u=a[1],c=a[2],d=a[3],s=Buffer.from(decodeURIComponent(d),c?"base64":"utf8");if(t){if(!i)throw new Vp("Blob is not supported",Vp.ERR_NOT_SUPPORT);return new i([s],{type:u})}return s}throw new Vp("Unsupported protocol "+n,Vp.ERR_NOT_SUPPORT)}var Ltn=oi(require("stream"),1);var qYp=oi(require("stream"),1);var Bpc=Symbol("internals"),Ipc=class extends qYp.default.Transform{constructor(t){t=ss.toFlatObject(t,{maxRate:0,chunkSize:64*1024,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,(i,n)=>!ss.isUndefined(n[i])),super({readableHighWaterMark:t.chunkSize});let r=this[Bpc]={timeWindow:t.timeWindow,chunkSize:t.chunkSize,maxRate:t.maxRate,minChunkSize:t.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null};this.on("newListener",i=>{i==="progress"&&(r.isCaptured||(r.isCaptured=!0))})}_read(t){let r=this[Bpc];return r.onReadCallback&&r.onReadCallback(),super._read(t)}_transform(t,r,i){let n=this[Bpc],a=n.maxRate,u=this.readableHighWaterMark,c=n.timeWindow,d=1e3/c,s=a/d,o=n.minChunkSize!==!1?Math.max(n.minChunkSize,s*.01):0,l=(g,O)=>{let m=Buffer.byteLength(g);n.bytesSeen+=m,n.bytes+=m,n.isCaptured&&this.emit("progress",n.bytesSeen),this.push(g)?process.nextTick(O):n.onReadCallback=()=>{n.onReadCallback=null,process.nextTick(O)}},v=(g,O)=>{let m=Buffer.byteLength(g),P=null,D=u,A,M=0;if(a){let E=Date.now();(!n.ts||(M=E-n.ts)>=c)&&(n.ts=E,A=s-n.bytes,n.bytes=A<0?-A:0,M=0),A=s-n.bytes}if(a){if(A<=0)return setTimeout(()=>{O(null,g)},c-M);A<D&&(D=A)}D&&m>D&&m-D>o&&(P=g.subarray(D),g=g.subarray(0,D)),l(g,P?()=>{process.nextTick(O,null,P)}:O)};v(t,function g(O,m){if(O)return i(O);m?v(m,g):i(null)})}},zpc=Ipc;var YYp=require("events");var CYp=oi(require("util"),1),BYp=require("stream");var{asyncIterator:TYp}=Symbol,hkD=async function*(e){e.stream?yield*e.stream():e.arrayBuffer?yield await e.arrayBuffer():e[TYp]?yield*e[TYp]():yield e},kGo=hkD;var ykD=rq.ALPHABET.ALPHA_DIGIT+"-_",F7a=typeof TextEncoder=="function"?new TextEncoder:new CYp.default.TextEncoder,Ftn=`\r
1723
1723
  `,vkD=F7a.encode(Ftn),bkD=2,xpc=class{constructor(t,r){let{escapeName:i}=this.constructor,n=ss.isString(r),a=`Content-Disposition: form-data; name="${i(t)}"${!n&&r.name?`; filename="${i(r.name)}"`:""}${Ftn}`;n?r=F7a.encode(String(r).replace(/\r?\n|\r\n?/g,Ftn)):a+=`Content-Type: ${r.type||"application/octet-stream"}${Ftn}`,this.headers=F7a.encode(a+Ftn),this.contentLength=n?r.byteLength:r.size,this.size=this.headers.byteLength+this.contentLength+bkD,this.name=t,this.value=r}async*encode(){yield this.headers;let{value:t}=this;ss.isTypedArray(t)?yield t:yield*kGo(t),yield vkD}static escapeName(t){return String(t).replace(/[\r\n"]/g,r=>({"\r":"%0D","\n":"%0A",'"':"%22"})[r])}},gkD=(e,t,r)=>{let{tag:i="form-data-boundary",size:n=25,boundary:a=i+"-"+rq.generateString(n,ykD)}=r||{};if(!ss.isFormData(e))throw TypeError("FormData instance required");if(a.length<1||a.length>70)throw Error("boundary must be 10-70 characters long");let u=F7a.encode("--"+a+Ftn),c=F7a.encode("--"+a+"--"+Ftn),d=c.byteLength,s=Array.from(e.entries()).map(([l,v])=>{let g=new xpc(l,v);return d+=g.size,g});d+=u.byteLength*s.length,d=ss.toFiniteNumber(d);let o={"Content-Type":`multipart/form-data; boundary=${a}`};return Number.isFinite(d)&&(o["Content-Length"]=d),t&&t(o),BYp.Readable.from((async function*(){for(let l of s)yield u,yield*l.encode();yield c})())},IYp=gkD;var zYp=oi(require("stream"),1),Rpc=class extends zYp.default.Transform{__transform(t,r,i){this.push(t),i()}_transform(t,r,i){if(t.length!==0&&(this._transform=this.__transform,t[0]!==120)){let n=Buffer.alloc(2);n[0]=120,n[1]=156,this.push(n,r)}this.__transform(t,r,i)}},xYp=Rpc;var OkD=(e,t)=>ss.isAsyncFn(e)?function(...r){let i=r.pop();e.apply(this,r).then(n=>{try{t?i(null,...t(n)):i(null,n)}catch(a){i(a)}},i)}:e,RYp=OkD;function mkD(e,t){e=e||10;let r=new Array(e),i=new Array(e),n=0,a=0,u;return t=t!==void 0?t:1e3,function(d){let s=Date.now(),o=i[a];u||(u=s),r[n]=d,i[n]=s;let l=a,v=0;for(;l!==n;)v+=r[l++],l=l%e;if(n=(n+1)%e,n===a&&(a=(a+1)%e),s-u<t)return;let g=o&&s-o;return g?Math.round(v*1e3/g):void 0}}var NYp=mkD;function PkD(e,t){let r=0,i=1e3/t,n,a,u=(s,o=Date.now())=>{r=o,n=null,a&&(clearTimeout(a),a=null),e(...s)};return[(...s)=>{let o=Date.now(),l=o-r;l>=i?u(s,o):(n=s,a||(a=setTimeout(()=>{a=null,u(n)},i-l)))},()=>n&&u(n)]}var FYp=PkD;var qOi=(e,t,r=3)=>{let i=0,n=NYp(50,250);return FYp(a=>{let u=a.loaded,c=a.lengthComputable?a.total:void 0,d=u-i,s=n(d),o=u<=c;i=u;let l={loaded:u,total:c,progress:c?u/c:void 0,bytes:d,rate:s||void 0,estimated:s&&c&&o?(c-u)/s:void 0,event:a,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(l)},r)},$Wn=(e,t)=>{let r=e!=null;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},GWn=e=>(...t)=>ss.asap(()=>e(...t));function Npc(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),i=e.slice(t+1);if(/;base64/i.test(r)){let a=i.length,u=i.length;for(let v=0;v<u;v++)if(i.charCodeAt(v)===37&&v+2<u){let g=i.charCodeAt(v+1),O=i.charCodeAt(v+2);(g>=48&&g<=57||g>=65&&g<=70||g>=97&&g<=102)&&(O>=48&&O<=57||O>=65&&O<=70||O>=97&&O<=102)&&(a-=2,v+=2)}let c=0,d=u-1,s=v=>v>=2&&i.charCodeAt(v-2)===37&&i.charCodeAt(v-1)===51&&(i.charCodeAt(v)===68||i.charCodeAt(v)===100);d>=0&&(i.charCodeAt(d)===61?(c++,d--):s(d)&&(c++,d-=3)),c===1&&d>=0&&(i.charCodeAt(d)===61||s(d))&&c++;let l=Math.floor(a/4)*3-(c||0);return l>0?l:0}return Buffer.byteLength(i,"utf8")}var LYp={flush:TOi.default.constants.Z_SYNC_FLUSH,finishFlush:TOi.default.constants.Z_SYNC_FLUSH},jkD={flush:TOi.default.constants.BROTLI_OPERATION_FLUSH,finishFlush:TOi.default.constants.BROTLI_OPERATION_FLUSH},UYp=ss.isFunction(TOi.default.createBrotliDecompress),{http:wkD,https:SkD}=KYp.default,DkD=/https:?/,VYp=rq.protocols.map(e=>e+":"),WYp=(e,[t,r])=>(e.on("end",r).on("error",r),t);function EkD(e,t){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e,t)}function XYp(e,t,r){let i=t;if(!i&&i!==!1){let n=$Yp.default.getProxyForUrl(r);n&&(i=new URL(n))}if(i){if(i.username&&(i.auth=(i.username||"")+":"+(i.password||"")),i.auth){(i.auth.username||i.auth.password)&&(i.auth=(i.auth.username||"")+":"+(i.auth.password||""));let a=Buffer.from(i.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+a}e.headers.host=e.hostname+(e.port?":"+e.port:"");let n=i.hostname||i.host;e.hostname=n,e.host=n,e.port=i.port,e.path=r,i.protocol&&(e.protocol=i.protocol.includes(":")?i.protocol:`${i.protocol}:`)}e.beforeRedirects.proxy=function(a){XYp(a,t,a.href)}}var MkD=typeof process<"u"&&ss.kindOf(process)==="process",AkD=e=>new Promise((t,r)=>{let i,n,a=(d,s)=>{n||(n=!0,i&&i(d,s))},u=d=>{a(d),t(d)},c=d=>{a(d,!0),r(d)};e(u,c,d=>i=d).catch(c)}),qkD=({address:e,family:t})=>{if(!ss.isString(e))throw TypeError("address must be a string");return{address:e,family:t||(e.indexOf(".")<0?6:4)}},HYp=(e,t)=>qkD(ss.isObject(e)?e:{address:e,family:t}),ZYp=MkD&&function(t){return AkD(async function(i,n,a){let{data:u,lookup:c,family:d}=t,{responseType:s,responseEncoding:o}=t,l=t.method.toUpperCase(),v,g=!1,O;if(c){let Oe=RYp(c,Fe=>ss.isArray(Fe)?Fe:[Fe]);c=(Fe,dt,De)=>{Oe(Fe,dt,(Me,Tt,Pe)=>{if(Me)return De(Me);let wt=ss.isArray(Tt)?Tt.map(at=>HYp(at)):[HYp(Tt,Pe)];dt.all?De(Me,wt):De(Me,wt[0].address,wt[0].family)})}}let m=new YYp.EventEmitter,P=()=>{t.cancelToken&&t.cancelToken.unsubscribe(D),t.signal&&t.signal.removeEventListener("abort",D),m.removeAllListeners()};a((Oe,Fe)=>{v=!0,Fe&&(g=!0,P())});function D(Oe){m.emit("abort",!Oe||Oe.type?new kAe(null,t,O):Oe)}m.once("abort",n),(t.cancelToken||t.signal)&&(t.cancelToken&&t.cancelToken.subscribe(D),t.signal&&(t.signal.aborted?D():t.signal.addEventListener("abort",D)));let A=Rtn(t.baseURL,t.url,t.allowAbsoluteUrls),M=new URL(A,rq.hasBrowserEnv?rq.origin:void 0),E=M.protocol||VYp[0];if(E==="data:"){if(t.maxContentLength>-1){let Fe=String(t.url||A||"");if(Npc(Fe)>t.maxContentLength)return n(new Vp("maxContentLength size of "+t.maxContentLength+" exceeded",Vp.ERR_BAD_RESPONSE,t))}let Oe;if(l!=="GET")return iar(i,n,{status:405,statusText:"method not allowed",headers:{},config:t});try{Oe=Cpc(t.url,s==="blob",{Blob:t.env&&t.env.Blob})}catch(Fe){throw Vp.from(Fe,Vp.ERR_BAD_REQUEST,t)}return s==="text"?(Oe=Oe.toString(o),(!o||o==="utf8")&&(Oe=ss.stripBOM(Oe))):s==="stream"&&(Oe=Ltn.default.Readable.from(Oe)),iar(i,n,{data:Oe,status:200,statusText:"OK",headers:new h3,config:t})}if(VYp.indexOf(E)===-1)return n(new Vp("Unsupported protocol "+E,Vp.ERR_BAD_REQUEST,t));let T=h3.from(t.headers).normalize();T.set("User-Agent","axios/"+Ntn,!1);let{onUploadProgress:z,onDownloadProgress:$}=t,I=t.maxRate,R,U;if(ss.isSpecCompliantForm(u)){let Oe=T.getContentType(/boundary=([-_\w\d]{10,70})/i);u=IYp(u,Fe=>{T.set(Fe)},{tag:`axios-${Ntn}-boundary`,boundary:Oe&&Oe[1]||void 0})}else if(ss.isFormData(u)&&ss.isFunction(u.getHeaders)){if(T.set(u.getHeaders()),!T.hasContentLength())try{let Oe=await JYp.default.promisify(u.getLength).call(u);Number.isFinite(Oe)&&Oe>=0&&T.setContentLength(Oe)}catch{}}else if(ss.isBlob(u)||ss.isFile(u))u.size&&T.setContentType(u.type||"application/octet-stream"),T.setContentLength(u.size||0),u=Ltn.default.Readable.from(kGo(u));else if(u&&!ss.isStream(u)){if(!Buffer.isBuffer(u))if(ss.isArrayBuffer(u))u=Buffer.from(new Uint8Array(u));else if(ss.isString(u))u=Buffer.from(u,"utf-8");else return n(new Vp("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Vp.ERR_BAD_REQUEST,t));if(T.setContentLength(u.length,!1),t.maxBodyLength>-1&&u.length>t.maxBodyLength)return n(new Vp("Request body larger than maxBodyLength limit",Vp.ERR_BAD_REQUEST,t))}let Y=ss.toFiniteNumber(T.getContentLength());ss.isArray(I)?(R=I[0],U=I[1]):R=U=I,u&&(z||R)&&(ss.isStream(u)||(u=Ltn.default.Readable.from(u,{objectMode:!1})),u=Ltn.default.pipeline([u,new zpc({maxRate:ss.toFiniteNumber(R)})],ss.noop),z&&u.on("progress",WYp(u,$Wn(Y,qOi(GWn(z),!1,3)))));let J;if(t.auth){let Oe=t.auth.username||"",Fe=t.auth.password||"";J=Oe+":"+Fe}if(!J&&M.username){let Oe=M.username,Fe=M.password;J=Oe+":"+Fe}J&&T.delete("authorization");let X;try{X=xtn(M.pathname+M.search,t.params,t.paramsSerializer).replace(/^\?/,"")}catch(Oe){let Fe=new Error(Oe.message);return Fe.config=t,Fe.url=t.url,Fe.exists=!0,n(Fe)}T.set("Accept-Encoding","gzip, compress, deflate"+(UYp?", br":""),!1);let ae={path:X,method:l,headers:T.toJSON(),agents:{http:t.httpAgent,https:t.httpsAgent},auth:J,protocol:E,family:d,beforeRedirect:EkD,beforeRedirects:{}};!ss.isUndefined(c)&&(ae.lookup=c),t.socketPath?ae.socketPath=t.socketPath:(ae.hostname=M.hostname.startsWith("[")?M.hostname.slice(1,-1):M.hostname,ae.port=M.port,XYp(ae,t.proxy,E+"//"+M.hostname+(M.port?":"+M.port:"")+ae.path));let de,pe=DkD.test(ae.protocol);if(ae.agent=pe?t.httpsAgent:t.httpAgent,t.transport?de=t.transport:t.maxRedirects===0?de=pe?QYp.default:GYp.default:(t.maxRedirects&&(ae.maxRedirects=t.maxRedirects),t.beforeRedirect&&(ae.beforeRedirects.config=t.beforeRedirect),de=pe?SkD:wkD),t.maxBodyLength>-1?ae.maxBodyLength=t.maxBodyLength:ae.maxBodyLength=1/0,t.insecureHTTPParser&&(ae.insecureHTTPParser=t.insecureHTTPParser),O=de.request(ae,function(Fe){if(O.destroyed)return;let dt=[Fe],De=+Fe.headers["content-length"];if($||U){let at=new zpc({maxRate:ss.toFiniteNumber(U)});$&&at.on("progress",WYp(at,$Wn(De,qOi(GWn($),!0,3)))),dt.push(at)}let Me=Fe,Tt=Fe.req||O;if(t.decompress!==!1&&Fe.headers["content-encoding"])switch((l==="HEAD"||Fe.statusCode===204)&&delete Fe.headers["content-encoding"],(Fe.headers["content-encoding"]||"").toLowerCase()){case"gzip":case"x-gzip":case"compress":case"x-compress":dt.push(TOi.default.createUnzip(LYp)),delete Fe.headers["content-encoding"];break;case"deflate":dt.push(new xYp),dt.push(TOi.default.createUnzip(LYp)),delete Fe.headers["content-encoding"];break;case"br":UYp&&(dt.push(TOi.default.createBrotliDecompress(jkD)),delete Fe.headers["content-encoding"])}Me=dt.length>1?Ltn.default.pipeline(dt,ss.noop):dt[0];let Pe=Ltn.default.finished(Me,()=>{Pe(),P()}),wt={status:Fe.statusCode,statusText:Fe.statusMessage,headers:new h3(Fe.headers),config:t,request:Tt};if(s==="stream")wt.data=Me,iar(i,n,wt);else{let at=[],me=0;Me.on("data",function(bt){at.push(bt),me+=bt.length,t.maxContentLength>-1&&me>t.maxContentLength&&(g=!0,Me.destroy(),n(new Vp("maxContentLength size of "+t.maxContentLength+" exceeded",Vp.ERR_BAD_RESPONSE,t,Tt)))}),Me.on("aborted",function(){if(g)return;let bt=new Vp("stream has been aborted",Vp.ERR_BAD_RESPONSE,t,Tt);Me.destroy(bt),n(bt)}),Me.on("error",function(bt){O.destroyed||n(Vp.from(bt,null,t,Tt))}),Me.on("end",function(){try{let bt=at.length===1?at[0]:Buffer.concat(at);s!=="arraybuffer"&&(bt=bt.toString(o),(!o||o==="utf8")&&(bt=ss.stripBOM(bt))),wt.data=bt}catch(bt){return n(Vp.from(bt,null,t,wt.request,wt))}iar(i,n,wt)})}m.once("abort",at=>{Me.destroyed||(Me.emit("error",at),Me.destroy())})}),m.once("abort",Oe=>{n(Oe),O.destroy(Oe)}),O.on("error",function(Fe){n(Vp.from(Fe,null,t,O))}),O.on("socket",function(Fe){Fe.setKeepAlive(!0,1e3*60)}),t.timeout){let Oe=parseInt(t.timeout,10);if(Number.isNaN(Oe)){n(new Vp("error trying to parse `config.timeout` to int",Vp.ERR_BAD_OPTION_VALUE,t,O));return}O.setTimeout(Oe,function(){if(v)return;let dt=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",De=t.transitional||VWn;t.timeoutErrorMessage&&(dt=t.timeoutErrorMessage),n(new Vp(dt,De.clarifyTimeoutError?Vp.ETIMEDOUT:Vp.ECONNABORTED,t,O)),D()})}if(ss.isStream(u)){let Oe=!1,Fe=!1;u.on("end",()=>{Oe=!0}),u.once("error",dt=>{Fe=!0,O.destroy(dt)}),u.on("close",()=>{!Oe&&!Fe&&D(new kAe("Request stream has been aborted",t,O))}),u.pipe(O)}else O.end(u)})};var kYp=rq.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,rq.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(rq.origin),rq.navigator&&/(msie|trident)/i.test(rq.navigator.userAgent)):()=>!0;var eXp=rq.hasStandardBrowserEnv?{write(e,t,r,i,n,a){let u=[e+"="+encodeURIComponent(t)];ss.isNumber(r)&&u.push("expires="+new Date(r).toGMTString()),ss.isString(i)&&u.push("path="+i),ss.isString(n)&&u.push("domain="+n),a===!0&&u.push("secure"),document.cookie=u.join("; ")},read(e){let t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};var tXp=e=>e instanceof h3?{...e}:e;function $Gt(e,t){t=t||{};let r={};function i(s,o,l,v){return ss.isPlainObject(s)&&ss.isPlainObject(o)?ss.merge.call({caseless:v},s,o):ss.isPlainObject(o)?ss.merge({},o):ss.isArray(o)?o.slice():o}function n(s,o,l,v){if(ss.isUndefined(o)){if(!ss.isUndefined(s))return i(void 0,s,l,v)}else return i(s,o,l,v)}function a(s,o){if(!ss.isUndefined(o))return i(void 0,o)}function u(s,o){if(ss.isUndefined(o)){if(!ss.isUndefined(s))return i(void 0,s)}else return i(void 0,o)}function c(s,o,l){if(l in t)return i(s,o);if(l in e)return i(void 0,s)}let d={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:c,headers:(s,o,l)=>n(tXp(s),tXp(o),l,!0)};return ss.forEach(Object.keys({...e,...t}),function(o){let l=d[o]||n,v=l(e[o],t[o],o);ss.isUndefined(v)&&l!==c||(r[o]=v)}),r}var eQo=e=>{let t=$Gt({},e),{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:a,headers:u,auth:c}=t;if(t.headers=u=h3.from(u),t.url=xtn(Rtn(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&u.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),ss.isFormData(r)){if(rq.hasStandardBrowserEnv||rq.hasStandardBrowserWebWorkerEnv)u.setContentType(void 0);else if(ss.isFunction(r.getHeaders)){let d=r.getHeaders(),s=["content-type","content-length"];Object.entries(d).forEach(([o,l])=>{s.includes(o.toLowerCase())&&u.set(o,l)})}}if(rq.hasStandardBrowserEnv&&(i&&ss.isFunction(i)&&(i=i(t)),i||i!==!1&&kYp(t.url))){let d=n&&a&&eXp.read(a);d&&u.set(n,d)}return t};var TkD=typeof XMLHttpRequest<"u",rXp=TkD&&function(e){return new Promise(function(r,i){let n=eQo(e),a=n.data,u=h3.from(n.headers).normalize(),{responseType:c,onUploadProgress:d,onDownloadProgress:s}=n,o,l,v,g,O;function m(){g&&g(),O&&O(),n.cancelToken&&n.cancelToken.unsubscribe(o),n.signal&&n.signal.removeEventListener("abort",o)}let P=new XMLHttpRequest;P.open(n.method.toUpperCase(),n.url,!0),P.timeout=n.timeout;function D(){if(!P)return;let M=h3.from("getAllResponseHeaders"in P&&P.getAllResponseHeaders()),T={data:!c||c==="text"||c==="json"?P.responseText:P.response,status:P.status,statusText:P.statusText,headers:M,config:e,request:P};iar(function($){r($),m()},function($){i($),m()},T),P=null}"onloadend"in P?P.onloadend=D:P.onreadystatechange=function(){!P||P.readyState!==4||P.status===0&&!(P.responseURL&&P.responseURL.indexOf("file:")===0)||setTimeout(D)},P.onabort=function(){P&&(i(new Vp("Request aborted",Vp.ECONNABORTED,e,P)),P=null)},P.onerror=function(E){let T=E&&E.message?E.message:"Network Error",z=new Vp(T,Vp.ERR_NETWORK,e,P);z.event=E||null,i(z),P=null},P.ontimeout=function(){let E=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded",T=n.transitional||VWn;n.timeoutErrorMessage&&(E=n.timeoutErrorMessage),i(new Vp(E,T.clarifyTimeoutError?Vp.ETIMEDOUT:Vp.ECONNABORTED,e,P)),P=null},a===void 0&&u.setContentType(null),"setRequestHeader"in P&&ss.forEach(u.toJSON(),function(E,T){P.setRequestHeader(T,E)}),ss.isUndefined(n.withCredentials)||(P.withCredentials=!!n.withCredentials),c&&c!=="json"&&(P.responseType=n.responseType),s&&([v,O]=qOi(s,!0),P.addEventListener("progress",v)),d&&P.upload&&([l,g]=qOi(d),P.upload.addEventListener("progress",l),P.upload.addEventListener("loadend",g)),(n.cancelToken||n.signal)&&(o=M=>{P&&(i(!M||M.type?new kAe(null,e,P):M),P.abort(),P=null)},n.cancelToken&&n.cancelToken.subscribe(o),n.signal&&(n.signal.aborted?o():n.signal.addEventListener("abort",o)));let A=N7a(n.url);if(A&&rq.protocols.indexOf(A)===-1){i(new Vp("Unsupported protocol "+A+":",Vp.ERR_BAD_REQUEST,e));return}P.send(a||null)})};var CkD=(e,t)=>{let{length:r}=e=e?e.filter(Boolean):[];if(t||r){let i=new AbortController,n,a=function(s){if(!n){n=!0,c();let o=s instanceof Error?s:this.reason;i.abort(o instanceof Vp?o:new kAe(o instanceof Error?o.message:o))}},u=t&&setTimeout(()=>{u=null,a(new Vp(`timeout ${t} of ms exceeded`,Vp.ETIMEDOUT))},t),c=()=>{e&&(u&&clearTimeout(u),u=null,e.forEach(s=>{s.unsubscribe?s.unsubscribe(a):s.removeEventListener("abort",a)}),e=null)};e.forEach(s=>s.addEventListener("abort",a));let{signal:d}=i;return d.unsubscribe=()=>ss.asap(c),d}},iXp=CkD;var BkD=function*(e,t){let r=e.byteLength;if(!t||r<t){yield e;return}let i=0,n;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},IkD=async function*(e,t){for await(let r of zkD(e))yield*BkD(r,t)},zkD=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}let t=e.getReader();try{for(;;){let{done:r,value:i}=await t.read();if(r)break;yield i}}finally{await t.cancel()}},Fpc=(e,t,r,i)=>{let n=IkD(e,t),a=0,u,c=d=>{u||(u=!0,i&&i(d))};return new ReadableStream({async pull(d){try{let{done:s,value:o}=await n.next();if(s){c(),d.close();return}let l=o.byteLength;if(r){let v=a+=l;r(v)}d.enqueue(new Uint8Array(o))}catch(s){throw c(s),s}},cancel(d){return c(d),n.return()}},{highWaterMark:2})};var nXp=64*1024,{isFunction:tQo}=ss,sXp=(({fetch:e,Request:t,Response:r})=>({fetch:e,Request:t,Response:r}))(ss.global),{ReadableStream:aXp,TextEncoder:oXp}=ss.global,uXp=(e,...t)=>{try{return!!e(...t)}catch{return!1}},xkD=e=>{let{fetch:t,Request:r,Response:i}=Object.assign({},sXp,e),n=tQo(t),a=tQo(r),u=tQo(i);if(!n)return!1;let c=n&&tQo(aXp),d=n&&(typeof oXp=="function"?(O=>m=>O.encode(m))(new oXp):async O=>new Uint8Array(await new r(O).arrayBuffer())),s=a&&c&&uXp(()=>{let O=!1,m=new r(rq.origin,{body:new aXp,method:"POST",get duplex(){return O=!0,"half"}}).headers.has("Content-Type");return O&&!m}),o=u&&c&&uXp(()=>ss.isReadableStream(new i("").body)),l={stream:o&&(O=>O.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach(O=>{!l[O]&&(l[O]=(m,P)=>{let D=m&&m[O];if(D)return D.call(m);throw new Vp(`Response type '${O}' is not supported`,Vp.ERR_NOT_SUPPORT,P)})});let v=async O=>{if(O==null)return 0;if(ss.isBlob(O))return O.size;if(ss.isSpecCompliantForm(O))return(await new r(rq.origin,{method:"POST",body:O}).arrayBuffer()).byteLength;if(ss.isArrayBufferView(O)||ss.isArrayBuffer(O))return O.byteLength;if(ss.isURLSearchParams(O)&&(O=O+""),ss.isString(O))return(await d(O)).byteLength},g=async(O,m)=>{let P=ss.toFiniteNumber(O.getContentLength());return P??v(m)};return async O=>{let{url:m,method:P,data:D,signal:A,cancelToken:M,timeout:E,onDownloadProgress:T,onUploadProgress:z,responseType:$,headers:I,withCredentials:R="same-origin",fetchOptions:U}=eQo(O);$=$?($+"").toLowerCase():"text";let Y=iXp([A,M&&M.toAbortSignal()],E),J=null,X=Y&&Y.unsubscribe&&(()=>{Y.unsubscribe()}),ae;try{if(z&&s&&P!=="get"&&P!=="head"&&(ae=await g(I,D))!==0){let De=new r(m,{method:"POST",body:D,duplex:"half"}),Me;if(ss.isFormData(D)&&(Me=De.headers.get("content-type"))&&I.setContentType(Me),De.body){let[Tt,Pe]=$Wn(ae,qOi(GWn(z)));D=Fpc(De.body,nXp,Tt,Pe)}}ss.isString(R)||(R=R?"include":"omit");let de=a&&"credentials"in r.prototype,pe={...U,signal:Y,method:P.toUpperCase(),headers:I.normalize().toJSON(),body:D,duplex:"half",credentials:de?R:void 0};J=a&&new r(m,pe);let Oe=await(a?t(J,U):t(m,pe)),Fe=o&&($==="stream"||$==="response");if(o&&(T||Fe&&X)){let De={};["status","statusText","headers"].forEach(wt=>{De[wt]=Oe[wt]});let Me=ss.toFiniteNumber(Oe.headers.get("content-length")),[Tt,Pe]=T&&$Wn(Me,qOi(GWn(T),!0))||[];Oe=new i(Fpc(Oe.body,nXp,Tt,()=>{Pe&&Pe(),X&&X()}),De)}$=$||"text";let dt=await l[ss.findKey(l,$)||"text"](Oe,O);return!Fe&&X&&X(),await new Promise((De,Me)=>{iar(De,Me,{data:dt,headers:h3.from(Oe.headers),status:Oe.status,statusText:Oe.statusText,config:O,request:J})})}catch(de){throw X&&X(),de&&de.name==="TypeError"&&/Load failed|fetch/i.test(de.message)?Object.assign(new Vp("Network Error",Vp.ERR_NETWORK,O,J),{cause:de.cause||de}):Vp.from(de,de&&de.code,O,J)}}},RkD=new Map,Lpc=e=>{let t=ss.merge.call({skipUndefined:!0},sXp,e?e.env:null),{fetch:r,Request:i,Response:n}=t,a=[i,n,r],u=a.length,c=u,d,s,o=RkD;for(;c--;)d=a[c],s=o.get(d),s===void 0&&o.set(d,s=c?new Map:xkD(t)),o=s;return s},Qu5=Lpc();var Upc={http:ZYp,xhr:rXp,fetch:{get:Lpc}};ss.forEach(Upc,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});var cXp=e=>`- ${e}`,FkD=e=>ss.isFunction(e)||e===null||e===!1,rQo={getAdapter:(e,t)=>{e=ss.isArray(e)?e:[e];let{length:r}=e,i,n,a={};for(let u=0;u<r;u++){i=e[u];let c;if(n=i,!FkD(i)&&(n=Upc[(c=String(i)).toLowerCase()],n===void 0))throw new Vp(`Unknown adapter '${c}'`);if(n&&(ss.isFunction(n)||(n=n.get(t))))break;a[c||"#"+u]=n}if(!n){let u=Object.entries(a).map(([d,s])=>`adapter ${d} `+(s===!1?"is not supported by the environment":"is not available in the build")),c=r?u.length>1?`since :
@@ -1955,14 +1955,14 @@ ${E}${A}${T}${Cm_.default.cursorHide}`});function Tru({message:e,error:t,logger:
1955
1955
  `)+`
1956
1956
  `;return this.lastPaint=i,i}get isTTY(){return this.stdout.isTTY&&!Zm_.default}};function ZTE(e){return typeof e.spinner!="string"&&e.spinner.interval!=null?e.spinner.interval:100}function kTE(e){let t=1;for(let r of e)r===`
1957
1957
  `&&t++;return t}function eCE(e,{includeDebugInfo:t}){let r=e.parts.join(" ");switch(e.prefix!=null&&(r=M$t({prefix:e.prefix,content:r})),t&&(r=M$t({prefix:Es.dim(rCE(e)),content:r})),r+=`
1958
- `,e.level){case Sb.Error:return Es.red(r);case Sb.Warn:return Es.hex("FFA500")(r);case Sb.Trace:case Sb.Debug:case Sb.Info:return r}}var tCE=Math.max(...ABi.map(e=>km_(e).length));function rCE(e){return`${km_(e.level).padEnd(tCE)} ${e.time.toISOString()} `}function km_(e){switch(e){case Sb.Trace:return"TRACE";case Sb.Debug:return"DEBUG";case Sb.Info:return"INFO";case Sb.Warn:return"WARN";case Sb.Error:return"ERROR";default:Ao(e)}}var eP_=oi(TRa(),1);function tP_(e){return e.filter(t=>t.isUpgradeAvailable).length>0}function iCE(e){return(e.cliUpgradeInfo?.isUpgradeAvailable??!1)||tP_(e.generatorUpgradeInfo)}async function rP_({cliEnvironment:e,upgradeInfo:t}){if(!iCE(t))return;let r=`${Es.underline("Upgrades available")}
1958
+ `,e.level){case Sb.Error:return Es.red(r);case Sb.Warn:return Es.hex("FFA500")(r);case Sb.Trace:case Sb.Debug:case Sb.Info:return r}}var tCE=Math.max(...ABi.map(e=>km_(e).length));function rCE(e){return`${km_(e.level).padEnd(tCE)} ${e.time.toISOString()} `}function km_(e){switch(e){case Sb.Trace:return"TRACE";case Sb.Debug:return"DEBUG";case Sb.Info:return"INFO";case Sb.Warn:return"WARN";case Sb.Error:return"ERROR";default:Ao(e)}}var eP_=oi(TRa(),1);function tP_(e){return e.filter(t=>t.isUpgradeAvailable).length>0}function iCE(e){return(e.cliUpgradeInfo?.isUpgradeAvailable??!1)||tP_(e.generatorUpgradeInfo)}async function rP_({cliEnvironment:e,upgradeInfo:t}){if(!iCE(t)||e.packageVersion==t.cliUpgradeInfo?.latestVersion)return;let r=`${Es.underline("Upgrades available")}
1959
1959
 
1960
1960
  `;t.cliUpgradeInfo?.isUpgradeAvailable&&(r+="Fern "+Es.dim(e.packageVersion)+Es.reset(" \u2192 ")+Es.green(t.cliUpgradeInfo.latestVersion)+`
1961
1961
  (Run `+Es.cyan(`${e.cliName} upgrade`)+" to update)");let i=await sSc({generatorUpgradeInfo:t.generatorUpgradeInfo,limit:2,includeBoxen:!1});i!=null&&(r+=i);let n=t.generatorUpgradeInfo.filter(a=>a.isUpgradeAvailable);return n.length>0&&(r+=`
1962
1962
  Run ${Es.cyan("fern generator upgrade")} to upgrade your generators.`),n.length>2&&(r+=`
1963
1963
  Run ${Es.cyan("fern generator upgrade --list")} to see the full list of generator upgrades available.`),JWn(r,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"})}async function sSc({generatorUpgradeInfo:e,header:t,limit:r,includeBoxen:i=!0}){if(!tP_(e))return;let n=t??"",a=e.filter(c=>c.isUpgradeAvailable);r!=null&&(a=a.slice(0,r+1));let u=a.sort((c,d)=>c.generatorName.localeCompare(d.generatorName)||c.currentVersion.localeCompare(d.currentVersion));for(let c of u)n+=`
1964
1964
  ${await nCE(c.generatorName)} (${c.apiName!=null?"API: "+c.apiName+", ":""}Group: ${c.generatorGroup}) `+Es.dim(c.currentVersion)+Es.reset(" \u2192 ")+Es.green(c.latestVersion);return n+=`
1965
- `,i?JWn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function nCE(e){let r=await new eP_.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 aCE({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await iP_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,l)=>{c.versions[s]==null&&(c.versions[s]={});let v=vIi(o.name,l),g=await Krr({generatorName:v,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:l});g!=null&&(c.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),c}let u={type:"multiApi",versions:{}};return await iP_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,d,s,o)=>{if(c==null)return;u.versions[c]==null&&(u.versions[c]={}),u.versions[c][d]==null&&(u.versions[c][d]={});let l=vIi(s.name,o),v=await Krr({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});v!=null&&(u.versions[c][d][s.name]={previousVersion:s.version,latestVersion:v})},generatorFilter:r,groupFilter:i}),u}async function iP_({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let c=await mGt({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(c==null||c.groups==null)){for(let d of c.groups)if(!(n!=null&&d.groupName!==n))for(let s of d.generators)i!=null&&s.name!==i||await r(a.workspaceName,d.groupName,s,u)}})}))}function nP_(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,c]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let d=Mue(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return i}async function zru({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let c=await aCE({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(c.type==="multiApi")for(let[d,s]of Object.entries(c.versions))u.push(...nP_(s,d,t.logger));else u.push(...nP_(c.versions,void 0,t.logger))}return u}var Q8a=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),c=u?`status code ${u}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var rJn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var cSc=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),aP_=typeof globalThis.AbortController=="function",oP_=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",uP_=typeof globalThis.ReadableStream=="function",sP_=typeof globalThis.FormData=="function",xru=["get","post","put","patch","head","delete"],oCE=()=>{};oCE();var cP_={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Rru=2147483647,lP_=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Nru=Symbol("stop"),fP_={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},dP_={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 uCE=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=lP_,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof i=="string"?new TextEncoder().encode(i).length:i.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},pP_=(e,t)=>{let r=Number(e.headers.get("content-length"))||0,i=0;return e.status===204?(t&&t({percent:1,totalBytes:r,transferredBytes:i},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(n){let a=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array);async function u(){let{done:c,value:d}=await a.read();if(c){n.close();return}if(t){i+=d.byteLength;let s=r===0?0:i/r;t({percent:s,transferredBytes:i,totalBytes:r},d)}n.enqueue(d),await u()}await u()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},_P_=(e,t,r)=>{let i=uCE(r??e.body),n=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(a){let u=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function c(){let{done:d,value:s}=await u.read();if(d){t&&t({percent:1,transferredBytes:n,totalBytes:Math.max(i,n)},new Uint8Array),a.close();return}n+=s.byteLength;let o=i===0?0:n/i;(i<n||o===1)&&(o=.99),t&&t({percent:Number(o.toFixed(2)),transferredBytes:n,totalBytes:i},s),a.enqueue(s),await c()}await c()}})})};var iJn=e=>e!==null&&typeof e=="object";var J8a=(...e)=>{for(let t of e)if((!iJn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return dSc({},...e)},lSc=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function Fru(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:dSc(e[r]??[],t[r]??[])}var fSc=(e={},t={})=>({beforeRequest:Fru(e,t,"beforeRequest"),beforeRetry:Fru(e,t,"beforeRetry"),afterResponse:Fru(e,t,"afterResponse"),beforeError:Fru(e,t,"beforeError")}),dSc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(iJn(n)){for(let[a,u]of Object.entries(n))iJn(u)&&a in t&&(u=dSc(t[a],u)),t={...t,[a]:u};iJn(n.hooks)&&(i=fSc(i,n.hooks),t.hooks=i),iJn(n.headers)&&(r=lSc(r,n.headers),t.headers=r)}return t};var yP_=e=>xru.includes(e)?e.toUpperCase():e,sCE=["get","put","head","delete","options","trace"],cCE=[408,413,429,500,502,503,504],lCE=[413,429,503],hP_={limit:2,methods:sCE,statusCodes:cCE,afterStatusCodes:lCE,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},vP_=(e={})=>{if(typeof e=="number")return{...hP_,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{...hP_,...e}};async function pSc(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new rJn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function _Sc(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var bP_=(e,t)=>{let r={};for(let i in t)!(i in dP_)&&!(i in fP_)&&!(i in e)&&(r[i]=t[i]);return r},gP_=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 K8a=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>Rru)throw new RangeError(`The \`timeout\` option cannot be greater than ${Rru}`);await Promise.resolve();let c=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(i._decorateResponse(c),!c.ok&&i._options.throwHttpErrors){let d=new Q8a(c,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!uP_)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return pP_(c.clone(),i._options.onDownloadProgress)}return c},u=(i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n()).finally(async()=>{i.request.bodyUsed||await i.request.body?.cancel()});for(let[c,d]of Object.entries(cP_))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(u[c]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let s=await u;if(c==="json"){if(s.status===204||(await s.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await s.text())}return s[c]()});return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:lSc(this._input.headers,r.headers),hooks:fSc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:yP_(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:vP_(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(aP_&&oP_){let i=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=i?AbortSignal.any([i,this.abortController.signal]):this.abortController.signal}if(cSc&&(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),gP_(this._options.searchParams)){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(sP_&&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(!cSc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=_P_(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof rJn)throw t;if(t instanceof Q8a){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),Rru);if(this._retryCount<1)throw r;await _Sc(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===Nru)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=bP_(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):pSc(r,t,this.abortController,this._options)}};var hSc=e=>{let t=(r,i)=>K8a.create(r,J8a(e,i));for(let r of xru)t[r]=(i,n)=>K8a.create(i,J8a(e,n,{method:r}));return t.create=r=>hSc(J8a(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),hSc(J8a(e,r))),t.stop=Nru,t},fCE=hSc(),OP_=fCE;var WP_=oi(VP_(),1);function OSc(e){let t=(0,WP_.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Rj_=oi(xj_(),1),Nj_=oi(ogi(),1),BSc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},ISc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function zSc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??OSc(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,Rj_.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 OP_(u,{headers:d,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new BSc(e):l}if(t.allVersions)return s;let o=new ISc(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(i&&!l)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!l){let g=Object.keys(s.versions);if(r=Nj_.default.maxSatisfying(g,r),!r)throw o}let{time:v}=s;if(s=s.versions[r],s.time=v,!s)throw o}return s}async function t5a(e,t){let{version:r}=await zSc(e.toLowerCase(),t);return r}async function n3i({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:t5a(e.packageName,{version:t?"prerelease":"latest"})}var Fj_=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],Xru=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=Sb.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new Iru(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),u=this.getCliName();(n==null||a==null||u==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:u}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.77.0"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Es.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new H8}failWithoutThrowing(t,r){this.didSucceed=!1,Tru({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await NWn()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await rP_({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1965
+ `,i?JWn(n,{padding:1,float:"center",textAlignment:"center",borderColor:"yellow",borderStyle:"round"}):n}async function nCE(e){let r=await new eP_.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 aCE({cliContext:e,project:{apiWorkspaces:t},generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){if(t.length===1){let c={type:"singleApi",versions:{}};return await iP_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(d,s,o,l)=>{c.versions[s]==null&&(c.versions[s]={});let v=vIi(o.name,l),g=await Krr({generatorName:v,cliVersion:e.environment.packageVersion,currentGeneratorVersion:o.version,channel:n,includeMajor:a,context:l});g!=null&&(c.versions[s][o.name]={previousVersion:o.version,latestVersion:g})},generatorFilter:r,groupFilter:i}),c}let u={type:"multiApi",versions:{}};return await iP_({cliContext:e,apiWorkspaces:t,perGeneratorAction:async(c,d,s,o)=>{if(c==null)return;u.versions[c]==null&&(u.versions[c]={}),u.versions[c][d]==null&&(u.versions[c][d]={});let l=vIi(s.name,o),v=await Krr({generatorName:l,cliVersion:e.environment.packageVersion,currentGeneratorVersion:s.version,channel:n,includeMajor:a,context:o});v!=null&&(u.versions[c][d][s.name]={previousVersion:s.version,latestVersion:v})},generatorFilter:r,groupFilter:i}),u}async function iP_({cliContext:e,apiWorkspaces:t,perGeneratorAction:r,generatorFilter:i,groupFilter:n}){await Promise.all(t.map(async a=>{await e.runTaskForWorkspace(a,async u=>{let c=await mGt({absolutePathToWorkspace:a.absoluteFilePath,context:u});if(!(c==null||c.groups==null)){for(let d of c.groups)if(!(n!=null&&d.groupName!==n))for(let s of d.generators)i!=null&&s.name!==i||await r(a.workspaceName,d.groupName,s,u)}})}))}function nP_(e,t,r){let i=[];for(let[n,a]of Object.entries(e))for(let[u,c]of Object.entries(a)){r.debug(`Checking if ${u} in group ${n} has an upgrade available...`);let d=Mue(c.latestVersion,c.previousVersion);r.debug(`Latest version: ${c.latestVersion}. `+(d?"Upgrade available.":"No upgrade available.")),i.push({generatorName:u,generatorGroup:n,apiName:t,isUpgradeAvailable:d,currentVersion:c.previousVersion,latestVersion:c.latestVersion})}return i}async function zru({project:e,cliContext:t,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a}){let u=[];if(e!=null){let c=await aCE({cliContext:t,project:e,generatorFilter:r,groupFilter:i,channel:n,includeMajor:a});if(c.type==="multiApi")for(let[d,s]of Object.entries(c.versions))u.push(...nP_(s,d,t.logger));else u.push(...nP_(c.versions,void 0,t.logger))}return u}var Q8a=class extends Error{response;request;options;constructor(t,r,i){let n=t.status||t.status===0?t.status:"",a=t.statusText||"",u=`${n} ${a}`.trim(),c=u?`status code ${u}`:"an unknown error";super(`Request failed with ${c}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=t,this.request=r,this.options=i}};var rJn=class extends Error{request;constructor(t){super(`Request timed out: ${t.method} ${t.url}`),this.name="TimeoutError",this.request=t}};var cSc=(()=>{let e=!1,t=!1,r=typeof globalThis.ReadableStream=="function",i=typeof globalThis.Request=="function";if(r&&i)try{t=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type")}catch(n){if(n instanceof Error&&n.message==="unsupported BodyInit type")return!1;throw n}return e&&!t})(),aP_=typeof globalThis.AbortController=="function",oP_=typeof globalThis.AbortSignal=="function"&&typeof globalThis.AbortSignal.any=="function",uP_=typeof globalThis.ReadableStream=="function",sP_=typeof globalThis.FormData=="function",xru=["get","post","put","patch","head","delete"],oCE=()=>{};oCE();var cP_={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},Rru=2147483647,lP_=new TextEncoder().encode("------WebKitFormBoundaryaxpyiPgbbPti10Rw").length,Nru=Symbol("stop"),fP_={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0},dP_={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 uCE=e=>{if(!e)return 0;if(e instanceof FormData){let t=0;for(let[r,i]of e)t+=lP_,t+=new TextEncoder().encode(`Content-Disposition: form-data; name="${r}"`).length,t+=typeof i=="string"?new TextEncoder().encode(i).length:i.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},pP_=(e,t)=>{let r=Number(e.headers.get("content-length"))||0,i=0;return e.status===204?(t&&t({percent:1,totalBytes:r,transferredBytes:i},new Uint8Array),new Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new Response(new ReadableStream({async start(n){let a=e.body.getReader();t&&t({percent:0,transferredBytes:0,totalBytes:r},new Uint8Array);async function u(){let{done:c,value:d}=await a.read();if(c){n.close();return}if(t){i+=d.byteLength;let s=r===0?0:i/r;t({percent:s,transferredBytes:i,totalBytes:r},d)}n.enqueue(d),await u()}await u()}}),{status:e.status,statusText:e.statusText,headers:e.headers})},_P_=(e,t,r)=>{let i=uCE(r??e.body),n=0;return new Request(e,{duplex:"half",body:new ReadableStream({async start(a){let u=e.body instanceof ReadableStream?e.body.getReader():new Response("").body.getReader();async function c(){let{done:d,value:s}=await u.read();if(d){t&&t({percent:1,transferredBytes:n,totalBytes:Math.max(i,n)},new Uint8Array),a.close();return}n+=s.byteLength;let o=i===0?0:n/i;(i<n||o===1)&&(o=.99),t&&t({percent:Number(o.toFixed(2)),transferredBytes:n,totalBytes:i},s),a.enqueue(s),await c()}await c()}})})};var iJn=e=>e!==null&&typeof e=="object";var J8a=(...e)=>{for(let t of e)if((!iJn(t)||Array.isArray(t))&&t!==void 0)throw new TypeError("The `options` argument must be an object");return dSc({},...e)},lSc=(e={},t={})=>{let r=new globalThis.Headers(e),i=t instanceof globalThis.Headers,n=new globalThis.Headers(t);for(let[a,u]of n.entries())i&&u==="undefined"||u===void 0?r.delete(a):r.set(a,u);return r};function Fru(e,t,r){return Object.hasOwn(t,r)&&t[r]===void 0?[]:dSc(e[r]??[],t[r]??[])}var fSc=(e={},t={})=>({beforeRequest:Fru(e,t,"beforeRequest"),beforeRetry:Fru(e,t,"beforeRetry"),afterResponse:Fru(e,t,"afterResponse"),beforeError:Fru(e,t,"beforeError")}),dSc=(...e)=>{let t={},r={},i={};for(let n of e)if(Array.isArray(n))Array.isArray(t)||(t=[]),t=[...t,...n];else if(iJn(n)){for(let[a,u]of Object.entries(n))iJn(u)&&a in t&&(u=dSc(t[a],u)),t={...t,[a]:u};iJn(n.hooks)&&(i=fSc(i,n.hooks),t.hooks=i),iJn(n.headers)&&(r=lSc(r,n.headers),t.headers=r)}return t};var yP_=e=>xru.includes(e)?e.toUpperCase():e,sCE=["get","put","head","delete","options","trace"],cCE=[408,413,429,500,502,503,504],lCE=[413,429,503],hP_={limit:2,methods:sCE,statusCodes:cCE,afterStatusCodes:lCE,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:e=>.3*2**(e-1)*1e3},vP_=(e={})=>{if(typeof e=="number")return{...hP_,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{...hP_,...e}};async function pSc(e,t,r,i){return new Promise((n,a)=>{let u=setTimeout(()=>{r&&r.abort(),a(new rJn(e))},i.timeout);i.fetch(e,t).then(n).catch(a).then(()=>{clearTimeout(u)})})}async function _Sc(e,{signal:t}){return new Promise((r,i)=>{t&&(t.throwIfAborted(),t.addEventListener("abort",n,{once:!0}));function n(){clearTimeout(a),i(t.reason)}let a=setTimeout(()=>{t?.removeEventListener("abort",n),r()},e)})}var bP_=(e,t)=>{let r={};for(let i in t)!(i in dP_)&&!(i in fP_)&&!(i in e)&&(r[i]=t[i]);return r},gP_=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 K8a=class e{static create(t,r){let i=new e(t,r),n=async()=>{if(typeof i._options.timeout=="number"&&i._options.timeout>Rru)throw new RangeError(`The \`timeout\` option cannot be greater than ${Rru}`);await Promise.resolve();let c=await i._fetch();for(let d of i._options.hooks.afterResponse){let s=await d(i.request,i._options,i._decorateResponse(c.clone()));s instanceof globalThis.Response&&(c=s)}if(i._decorateResponse(c),!c.ok&&i._options.throwHttpErrors){let d=new Q8a(c,i.request,i._options);for(let s of i._options.hooks.beforeError)d=await s(d);throw d}if(i._options.onDownloadProgress){if(typeof i._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!uP_)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return pP_(c.clone(),i._options.onDownloadProgress)}return c},u=(i._options.retry.methods.includes(i.request.method.toLowerCase())?i._retry(n):n()).finally(async()=>{i.request.bodyUsed||await i.request.body?.cancel()});for(let[c,d]of Object.entries(cP_))c==="bytes"&&typeof globalThis.Response?.prototype?.bytes!="function"||(u[c]=async()=>{i.request.headers.set("accept",i.request.headers.get("accept")||d);let s=await u;if(c==="json"){if(s.status===204||(await s.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await s.text())}return s[c]()});return u}request;abortController;_retryCount=0;_input;_options;constructor(t,r={}){if(this._input=t,this._options={...r,headers:lSc(this._input.headers,r.headers),hooks:fSc({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:yP_(r.method??this._input.method??"GET"),prefixUrl:String(r.prefixUrl||""),retry:vP_(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(aP_&&oP_){let i=this._options.signal??this._input.signal;this.abortController=new globalThis.AbortController,this._options.signal=i?AbortSignal.any([i,this.abortController.signal]):this.abortController.signal}if(cSc&&(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),gP_(this._options.searchParams)){let n="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,n);(sP_&&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(!cSc)throw new Error("Request streams are not supported in your environment. The `duplex` option for `Request` is not available.");this.request.body&&(this.request=_P_(this.request,this._options.onUploadProgress,this._options.body))}}_calculateRetryDelay(t){if(this._retryCount++,this._retryCount>this._options.retry.limit||t instanceof rJn)throw t;if(t instanceof Q8a){if(!this._options.retry.statusCodes.includes(t.response.status))throw t;let i=t.response.headers.get("Retry-After")??t.response.headers.get("RateLimit-Reset")??t.response.headers.get("X-RateLimit-Reset")??t.response.headers.get("X-Rate-Limit-Reset");if(i&&this._options.retry.afterStatusCodes.includes(t.response.status)){let n=Number(i)*1e3;Number.isNaN(n)?n=Date.parse(i)-Date.now():n>=Date.parse("2024-01-01")&&(n-=Date.now());let a=this._options.retry.maxRetryAfter??n;return n<a?n:a}if(t.response.status===413)throw t}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(t){return this._options.parseJson&&(t.json=async()=>this._options.parseJson(await t.text())),t}async _retry(t){try{return await t()}catch(r){let i=Math.min(this._calculateRetryDelay(r),Rru);if(this._retryCount<1)throw r;await _Sc(i,{signal:this._options.signal});for(let n of this._options.hooks.beforeRetry)if(await n({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===Nru)return;return this._retry(t)}}async _fetch(){for(let i of this._options.hooks.beforeRequest){let n=await i(this.request,this._options);if(n instanceof Request){this.request=n;break}if(n instanceof Response)return n}let t=bP_(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,t):pSc(r,t,this.abortController,this._options)}};var hSc=e=>{let t=(r,i)=>K8a.create(r,J8a(e,i));for(let r of xru)t[r]=(i,n)=>K8a.create(i,J8a(e,n,{method:r}));return t.create=r=>hSc(J8a(r)),t.extend=r=>(typeof r=="function"&&(r=r(e??{})),hSc(J8a(e,r))),t.stop=Nru,t},fCE=hSc(),OP_=fCE;var WP_=oi(VP_(),1);function OSc(e){let t=(0,WP_.default)("npm",{registry:"https://registry.npmjs.org/"}),r=t[`${e}:registry`]||t.config_registry||t.registry;return r.slice(-1)==="/"?r:`${r}/`}var Rj_=oi(xj_(),1),Nj_=oi(ogi(),1),BSc=class extends Error{constructor(t){super(`Package \`${t}\` could not be found`),this.name="PackageNotFoundError"}},ISc=class extends Error{constructor(t,r){super(`Version \`${r}\` for package \`${t}\` could not be found`),this.name="VersionNotFoundError"}};async function zSc(e,t={}){let{version:r="latest"}=t,{omitDeprecated:i=!0}=t,n=e.split("/")[0],a=t.registryUrl??OSc(n),u=new URL(encodeURIComponent(e).replace(/^%40/,"@"),a),c=(0,Rj_.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 OP_(u,{headers:d,keepalive:!0}).json()}catch(l){throw l?.response?.status===404?new BSc(e):l}if(t.allVersions)return s;let o=new ISc(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(i&&!l)for(let[g,O]of Object.entries(s.versions))O.deprecated&&delete s.versions[g];if(!l){let g=Object.keys(s.versions);if(r=Nj_.default.maxSatisfying(g,r),!r)throw o}let{time:v}=s;if(s=s.versions[r],s.time=v,!s)throw o}return s}async function t5a(e,t){let{version:r}=await zSc(e.toLowerCase(),t);return r}async function n3i({cliEnvironment:e,includePreReleases:t=!1}){return e.packageName!=="fern-api"?e.packageVersion:t5a(e.packageName,{version:t?"prerelease":"latest"})}var Fj_=["#2E86AB","#A23B72","#F18F01","#C73E1D","#CCE2A3"],Xru=class{environment;didSucceed=!0;numTasks=0;ttyAwareLogger;logLevel=Sb.Info;isLocal;constructor(t,r,{isLocal:i}){this.ttyAwareLogger=new Iru(t,r),this.isLocal=i??!1;let n=this.getPackageName(),a=this.getPackageVersion(),u=this.getCliName();(n==null||a==null||u==null)&&this.exitProgram(),this.environment={packageName:n,packageVersion:a,cliName:u}}getPackageName(){return"fern-api"}getPackageVersion(){return"0.77.1"}getCliName(){return"fern"}setLogLevel(t){this.logLevel=t}logDebugInfo(){this.logger.debug(`Running ${Es.bold(`${this.environment.cliName}`)} (${this.environment.packageName}@${this.environment.packageVersion})`)}failAndThrow(t,r){throw this.failWithoutThrowing(t,r),new H8}failWithoutThrowing(t,r){this.didSucceed=!1,Tru({message:t,error:r,logger:this.logger})}async exit({code:t}={}){(!this._suppressUpgradeMessage||!this.isLocal)&&await this.nudgeUpgradeIfAvailable(),this.ttyAwareLogger.finish(),await(await NWn()).flush(),this.exitProgram({code:t})}async nudgeUpgradeIfAvailable(){try{let t=await Promise.race([this.isUpgradeAvailable(),new Promise((i,n)=>setTimeout(()=>n("Request timed out"),300))]),r=await rP_({cliEnvironment:this.environment,upgradeInfo:t});r!=null&&(r.endsWith(`
1966
1966
  `)||(r+=`
1967
1967
  `),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=IHs(t.map(i=>i.type==="docs"?"docs":i.workspaceName??"api"),i=>i.length);r!=null&&(this.longestWorkspaceName=r)}project;registerProject(t){this.project=t}runTask(t){return this.runTaskWithInit(this.constructTaskInit(),t)}addTask(){return this.addTaskWithInit(this.constructTaskInit())}async runTaskForWorkspace(t,r){await this.runTaskWithInit(this.constructTaskInitForWorkspace(t),r)}addTaskWithInit(t){let r=new U8a(t);return this.ttyAwareLogger.registerTask(r),r}USE_NODE_18_OR_ABOVE_MESSAGE="The Fern CLI requires Node 18+ or above.";async runTaskWithInit(t,r){let i=this.addTaskWithInit(t).start(),n;try{n=await r(i)}catch(a){throw a.message.includes("globalThis")?(i.logger.error(this.USE_NODE_18_OR_ABOVE_MESSAGE),i.failWithoutThrowing()):i.failWithoutThrowing(void 0,a),new H8}finally{i.finish()}return n}async instrumentPostHogEvent(t){this.isLocal||(await NWn()).sendEvent(t)}logger=ltr((t,...r)=>this.log(t,...r));stderr=ltr((t,...r)=>this.logStderr(t,...r));constructTaskInitForWorkspace(t){let r=Lj_(t.type==="docs"?"docs":t.workspaceName??"api"),i=1+(this.longestWorkspaceName!=null?Lj_(this.longestWorkspaceName):r).length,n=r.padEnd(i),a=Fj_[this.numTasks++%Fj_.length],u=Es.hex(a)(n);return{...this.constructTaskInit(),logPrefix:u}}constructTaskInit(){return{logImmediately:t=>this.logImmediately(t),takeOverTerminal:t=>this.ttyAwareLogger.takeOverTerminal(t),onResult:t=>{t===CI.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 i=t.filter(n=>ABi.indexOf(n.level)>=ABi.indexOf(this.logLevel));this.ttyAwareLogger.log(i,{includeDebugInfo:this.logLevel===Sb.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 n3i({cliEnvironment:this.environment,includePreReleases:t}),i=Mue(r,this.environment.packageVersion);this.logger.debug(`Latest version: ${r}. `+(i?"Upgrade available.":"No upgrade available."));let n={isUpgradeAvailable:i,latestVersion:r},a=await zru({project:this.project,cliContext:this});this._isUpgradeAvailable={cliUpgradeInfo:n,generatorUpgradeInfo:a}}return this._isUpgradeAvailable}async confirmPrompt(t,r=!1){return await Q1c({message:t,default:r})}async getInput(t){return await J1c({message:t.message,default:t.default})}};function Lj_(e){return`[${e}]:`}var AQt=class{generatorsConfiguration;workspaceName;cliVersion;absoluteFilePath;changelog;constructor({generatorsConfiguration:t,workspaceName:r,cliVersion:i,absoluteFilePath:n,changelog:a}){this.generatorsConfiguration=t,this.workspaceName=r,this.cliVersion=i,this.absoluteFilePath=n,this.changelog=a}};var Mqe=class extends AQt{definition;sources;type="fern";constructor({definition:t,sources:r,...i}){super(i),this.definition=t,this.sources=r??[]}async getDefinition(){return this.definition}async toFernWorkspace(){return this}getSources(){return this.sources}getAbsoluteFilePaths(){return[this.absoluteFilePath]}};var Smi={enableUniqueErrorsPerEndpoint:!1,detectGlobalHeaders:!0,objectQueryParameters:!1,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1};function r5a({options:e,overrides:t}){return{enableUniqueErrorsPerEndpoint:t?.enableUniqueErrorsPerEndpoint??e?.enableUniqueErrorsPerEndpoint??Smi.enableUniqueErrorsPerEndpoint,detectGlobalHeaders:t?.detectGlobalHeaders??e?.detectGlobalHeaders??Smi.detectGlobalHeaders,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??Smi.objectQueryParameters,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??Smi.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??Smi.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??Smi.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??Smi.inlinePathParameters,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??Smi.useBytesForBinaryResponse,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??Smi.respectForwardCompatibleEnums}}var qK={openapi:e=>({...e,type:"openapi",_visit:function(t){return qK._visit(this,t)}}),protobuf:e=>({...e,type:"protobuf",_visit:function(t){return qK._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 lJn={protobuf:e=>({...e,type:"protobuf",_visit:function(t){return lJn._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"protobuf":return t.protobuf(e);default:return t._other(e)}}};var PU={basic:e=>({...e,type:"basic",_visit:function(t){return PU._visit(this,t)}}),bearer:e=>({...e,type:"bearer",_visit:function(t){return PU._visit(this,t)}}),header:e=>({...e,type:"header",_visit:function(t){return PU._visit(this,t)}}),query:e=>({...e,type:"query",_visit:function(t){return PU._visit(this,t)}}),oauth:e=>({...e,type:"oauth",_visit:function(t){return PU._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 Yg={primitive:e=>({value:e,type:"primitive",_visit:function(t){return Yg._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Yg._visit(this,t)}}),array:e=>({value:e,type:"array",_visit:function(t){return Yg._visit(this,t)}}),map:e=>({value:e,type:"map",_visit:function(t){return Yg._visit(this,t)}}),enum:e=>({value:e,type:"enum",_visit:function(t){return Yg._visit(this,t)}}),literal:e=>({value:e,type:"literal",_visit:function(t){return Yg._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Yg._visit(this,t)}}),unknown:e=>({value:e,type:"unknown",_visit:function(t){return Yg._visit(this,t)}}),_visit:(e,t)=>{switch(e.type){case"primitive":return t.primitive(e.value);case"object":return t.object(e);case"array":return t.array(e.value);case"map":return t.map(e.value);case"enum":return t.enum(e.value);case"literal":return t.literal(e.value);case"oneOf":return t.oneOf(e.value);case"unknown":return t.unknown(e.value);default:return t._other(e)}}};var D_={int:e=>({value:e,type:"int",_visit:function(t){return D_._visit(this,t)}}),int64:e=>({value:e,type:"int64",_visit:function(t){return D_._visit(this,t)}}),uint:e=>({value:e,type:"uint",_visit:function(t){return D_._visit(this,t)}}),uint64:e=>({value:e,type:"uint64",_visit:function(t){return D_._visit(this,t)}}),float:e=>({value:e,type:"float",_visit:function(t){return D_._visit(this,t)}}),double:e=>({value:e,type:"double",_visit:function(t){return D_._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return D_._visit(this,t)}}),datetime:e=>({value:e,type:"datetime",_visit:function(t){return D_._visit(this,t)}}),date:e=>({value:e,type:"date",_visit:function(t){return D_._visit(this,t)}}),base64:e=>({value:e,type:"base64",_visit:function(t){return D_._visit(this,t)}}),boolean:e=>({value:e,type:"boolean",_visit:function(t){return D_._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 a3i={boolean:e=>({value:e,type:"boolean",_visit:function(t){return a3i._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return a3i._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 o3i={discriminated:e=>({value:e,type:"discriminated",_visit:function(t){return o3i._visit(this,t)}}),undiscriminated:e=>({value:e,type:"undiscriminated",_visit:function(t){return o3i._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 v$={GenerallyAvailable:"GenerallyAvailable",Beta:"Beta",Deprecated:"Deprecated",_visit:(e,t)=>{switch(e){case v$.GenerallyAvailable:return t.generallyAvailable();case v$.Beta:return t.beta();case v$.Deprecated:return t.deprecated();default:return t._other()}}};var m6e={cursor:e=>({...e,type:"cursor",_visit:function(t){return m6e._visit(this,t)}}),offset:e=>({...e,type:"offset",_visit:function(t){return m6e._visit(this,t)}}),custom:e=>({...e,type:"custom",_visit:function(t){return m6e._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 Dmi={language:e=>({...e,type:"language",_visit:function(t){return Dmi._visit(this,t)}}),sdk:e=>({...e,type:"sdk",_visit:function(t){return Dmi._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 b$={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 b$.Curl:return t.curl();case b$.Python:return t.python();case b$.Javascript:return t.javascript();case b$.Typescript:return t.typescript();case b$.Go:return t.go();case b$.Ruby:return t.ruby();case b$.Csharp:return t.csharp();case b$.Java:return t.java();case b$.Js:return t.js();case b$.Node:return t.node();case b$.Ts:return t.ts();case b$.Nodets:return t.nodets();case b$.Golang:return t.golang();case b$.Dotnet:return t.dotnet();case b$.Jvm:return t.jvm();default:return t._other()}}};var qQt={unknown:e=>({value:e,type:"unknown",_visit:function(t){return qQt._visit(this,t)}}),full:e=>({...e,type:"full",_visit:function(t){return qQt._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 TQt={withStreaming:e=>({...e,type:"withStreaming",_visit:function(t){return TQt._visit(this,t)}}),withoutStreaming:e=>({value:e,type:"withoutStreaming",_visit:function(t){return TQt._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 g$={Get:"GET",Post:"POST",Put:"PUT",Patch:"PATCH",Delete:"DELETE",Head:"HEAD",Options:"OPTIONS",Trace:"TRACE",_visit:(e,t)=>{switch(e){case g$.Get:return t.get();case g$.Post:return t.post();case g$.Put:return t.put();case g$.Patch:return t.patch();case g$.Delete:return t.delete();case g$.Head:return t.head();case g$.Options:return t.options();case g$.Trace:return t.trace();default:return t._other()}}};var kar={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return kar._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return kar._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return kar._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return kar._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 Emi={file:e=>({...e,type:"file",_visit:function(t){return Emi._visit(this,t)}}),json:e=>({value:e,type:"json",_visit:function(t){return Emi._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 TK={file:e=>({...e,type:"file",_visit:function(t){return TK._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return TK._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return TK._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return TK._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return TK._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return TK._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return TK._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 Ov={primitive:e=>({...e,type:"primitive",_visit:function(t){return Ov._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return Ov._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return Ov._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return Ov._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return Ov._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return Ov._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return Ov._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return Ov._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return Ov._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return Ov._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return Ov._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 xw={int:e=>({...e,type:"int",_visit:function(t){return xw._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return xw._visit(this,t)}}),uint:()=>({type:"uint",_visit:function(e){return xw._visit(this,e)}}),uint64:()=>({type:"uint64",_visit:function(e){return xw._visit(this,e)}}),float:()=>({type:"float",_visit:function(e){return xw._visit(this,e)}}),double:e=>({...e,type:"double",_visit:function(t){return xw._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return xw._visit(this,t)}}),datetime:()=>({type:"datetime",_visit:function(e){return xw._visit(this,e)}}),date:()=>({type:"date",_visit:function(e){return xw._visit(this,e)}}),base64:()=>({type:"base64",_visit:function(e){return xw._visit(this,e)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return xw._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 px={boolean:e=>({value:e,type:"boolean",_visit:function(t){return px._visit(this,t)}}),string:e=>({value:e,type:"string",_visit:function(t){return px._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 Mmi={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return Mmi._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return Mmi._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 Tee={octetStream:e=>({...e,type:"octetStream",_visit:function(t){return Tee._visit(this,t)}}),multipart:e=>({...e,type:"multipart",_visit:function(t){return Tee._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return Tee._visit(this,t)}}),formUrlEncoded:e=>({...e,type:"formUrlEncoded",_visit:function(t){return Tee._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 OB={file:e=>({...e,type:"file",_visit:function(t){return OB._visit(this,t)}}),json:e=>({...e,type:"json",_visit:function(t){return OB._visit(this,t)}}),text:e=>({...e,type:"text",_visit:function(t){return OB._visit(this,t)}}),bytes:e=>({...e,type:"bytes",_visit:function(t){return OB._visit(this,t)}}),streamingSse:e=>({...e,type:"streamingSse",_visit:function(t){return OB._visit(this,t)}}),streamingText:e=>({...e,type:"streamingText",_visit:function(t){return OB._visit(this,t)}}),streamingJson:e=>({...e,type:"streamingJson",_visit:function(t){return OB._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 zl={primitive:e=>({...e,type:"primitive",_visit:function(t){return zl._visit(this,t)}}),object:e=>({...e,type:"object",_visit:function(t){return zl._visit(this,t)}}),array:e=>({...e,type:"array",_visit:function(t){return zl._visit(this,t)}}),map:e=>({...e,type:"map",_visit:function(t){return zl._visit(this,t)}}),optional:e=>({...e,type:"optional",_visit:function(t){return zl._visit(this,t)}}),enum:e=>({...e,type:"enum",_visit:function(t){return zl._visit(this,t)}}),reference:e=>({...e,type:"reference",_visit:function(t){return zl._visit(this,t)}}),literal:e=>({...e,type:"literal",_visit:function(t){return zl._visit(this,t)}}),oneOf:e=>({value:e,type:"oneOf",_visit:function(t){return zl._visit(this,t)}}),nullable:e=>({...e,type:"nullable",_visit:function(t){return zl._visit(this,t)}}),unknown:e=>({...e,type:"unknown",_visit:function(t){return zl._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 Cee={discriminated:e=>({...e,type:"discriminated",_visit:function(t){return Cee._visit(this,t)}}),undiscriminated:e=>({...e,type:"undiscriminated",_visit:function(t){return Cee._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 vp={int:e=>({...e,type:"int",_visit:function(t){return vp._visit(this,t)}}),int64:e=>({...e,type:"int64",_visit:function(t){return vp._visit(this,t)}}),uint:e=>({...e,type:"uint",_visit:function(t){return vp._visit(this,t)}}),uint64:e=>({...e,type:"uint64",_visit:function(t){return vp._visit(this,t)}}),float:e=>({...e,type:"float",_visit:function(t){return vp._visit(this,t)}}),double:e=>({...e,type:"double",_visit:function(t){return vp._visit(this,t)}}),string:e=>({...e,type:"string",_visit:function(t){return vp._visit(this,t)}}),datetime:e=>({...e,type:"datetime",_visit:function(t){return vp._visit(this,t)}}),date:e=>({...e,type:"date",_visit:function(t){return vp._visit(this,t)}}),base64:e=>({...e,type:"base64",_visit:function(t){return vp._visit(this,t)}}),boolean:e=>({...e,type:"boolean",_visit:function(t){return vp._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 Av={};Na(Av,{AllOfPropertyConflict:()=>BJn,ArraySchema:()=>_nu,ArraySchemaWithExample:()=>$nu,Availability:()=>uiu,Base64WithExample:()=>Lnu,BasicSecurityScheme:()=>liu,BearerSecurityScheme:()=>fiu,BooleanSchema:()=>snu,BooleanWithExample:()=>Unu,BytesResponse:()=>wJn,CasingOverrides:()=>_iu,CommonProperty:()=>Pnu,CommonPropertyWithExample:()=>eau,CursorPagination:()=>$iu,CustomCodeSample:()=>Wiu,CustomCodeSampleLanguage:()=>Liu,CustomCodeSampleSdk:()=>Viu,CustomPagination:()=>Qiu,DateWithExample:()=>Fnu,DatetimeWithExample:()=>Nnu,DiscriminatedOneOfSchema:()=>Onu,DiscriminatedOneOfSchemaWithExample:()=>Znu,DoubleSchema:()=>onu,DoubleWithExample:()=>xnu,Encoding:()=>oiu,Endpoint:()=>Jiu,EndpointExample:()=>MJn,EndpointResponseExample:()=>Fiu,EndpointSdkName:()=>ror,EndpointWithExample:()=>yw_,EnumSchema:()=>_Jn,EnumSchemaWithExample:()=>Wnu,EnumValue:()=>c3i,ErrorExample:()=>Iiu,FernExample:()=>xiu,FileResponse:()=>PJn,FileSchema:()=>Diu,FloatWithExample:()=>znu,FormUrlEncodedRequest:()=>Tiu,FullEndpointExample:()=>Hiu,FullExample:()=>FT,FullObjectExample:()=>miu,FullOneOfExample:()=>jiu,GlobalHeader:()=>lnu,Header:()=>f3i,HeaderExample:()=>EJn,HeaderSecurityScheme:()=>diu,HeaderWithExample:()=>_3i,HttpEndpointServer:()=>SJn,HttpError:()=>ziu,HttpErrorWithExample:()=>qnu,HttpMethod:()=>vJn,IdempotencyHeader:()=>fnu,Int64WithExample:()=>Cnu,IntSchema:()=>nnu,IntWithExample:()=>Tnu,JsonRequest:()=>qiu,JsonRequestWithExample:()=>Dnu,JsonResponse:()=>jJn,JsonResponseWithExample:()=>xJn,KeyValuePair:()=>Piu,LiteralExample:()=>Oiu,LiteralSchema:()=>CJn,LiteralSchemaValue:()=>dnu,LongSchema:()=>anu,MapSchema:()=>hnu,MapSchemaWithExample:()=>Gnu,MultipartRequest:()=>mJn,MultipartRequestProperty:()=>Aiu,MultipartRequestPropertyEncoding:()=>Miu,MultipartSchema:()=>Eiu,NamedFullExample:()=>j6e,Namespace:()=>hiu,NamespaceId:()=>giu,NullableSchema:()=>vnu,NullableSchemaWithExample:()=>Jnu,OauthSecurityScheme:()=>viu,ObjectProperty:()=>gnu,ObjectPropertyConflictInfo:()=>IJn,ObjectPropertyWithExample:()=>Xnu,ObjectSchema:()=>pnu,ObjectSchemaWithExample:()=>Knu,OctetStreamRequest:()=>OJn,OffsetPagination:()=>Giu,OneOfSchema:()=>bnu,OneOfSchemaWithExample:()=>Ynu,OpenApiIntermediateRepresentation:()=>_w_,OpenApiSource:()=>riu,OptionalSchema:()=>ynu,OptionalSchemaWithExample:()=>Qnu,Pagination:()=>AJn,ParseFormUrlEncodedRequest:()=>Enu,ParseMultipartRequest:()=>Snu,ParseOctetStreamRequest:()=>wnu,PathParameter:()=>bJn,PathParameterExample:()=>Riu,PathParameterWithExample:()=>jnu,PrimitiveExample:()=>yJn,PrimitiveSchema:()=>p3i,PrimitiveSchemaValue:()=>cnu,PrimitiveSchemaValueWithExample:()=>Vnu,PrimitiveSchemaWithExample:()=>RJn,PropertyKey:()=>hJn,ProtobufEncoding:()=>aiu,ProtobufSource:()=>iiu,QueryParameter:()=>gJn,QueryParameterExample:()=>DJn,QueryParameterWithExample:()=>zJn,QuerySecurityScheme:()=>piu,ReferencedSchema:()=>ior,Request:()=>Ciu,RequestWithExample:()=>Mnu,Response:()=>Biu,ResponseWithExample:()=>Anu,Schema:()=>tm,SchemaId:()=>Bee,SchemaWithExample:()=>RM,Schemas:()=>inu,SdkGroup:()=>yiu,SdkGroupInfo:()=>wiu,SdkGroupName:()=>l3i,SecurityScheme:()=>biu,SecuritySchemeId:()=>ciu,Server:()=>o5a,Source:()=>niu,StatusCode:()=>eor,StreamingResponseExample:()=>Niu,StringSchema:()=>unu,StringSchemaWithExample:()=>Rnu,SupportedSdkLanguage:()=>Uiu,Tag:()=>siu,TagId:()=>Iee,Tags:()=>Siu,TextResponse:()=>d3i,Uint64WithExample:()=>Inu,UintWithExample:()=>Bnu,UnDiscriminatedOneOfSchema:()=>mnu,UnDiscriminatedOneOfSchemaWithExample:()=>knu,UnknownSchemaWithExample:()=>Hnu,Webhook:()=>Kiu,WebhookExampleCall:()=>TJn,WebhookHttpMethod:()=>qJn,WebhookWithExample:()=>vw_,WebsocketChannel:()=>rnu,WebsocketHandshake:()=>Yiu,WebsocketHandshakeWithExample:()=>hw_,WebsocketMessageExample:()=>enu,WebsocketMessageOrigin:()=>Xiu,WebsocketMessageSchema:()=>Ziu,WebsocketServer:()=>kiu,WebsocketSessionExample:()=>tnu,WithAvailability:()=>oy,WithDescription:()=>Of,WithEncoding:()=>Tue,WithInline:()=>xM,WithName:()=>pg,WithNamespace:()=>x0,WithSdkGroupName:()=>Vm,WithSdkMethodName:()=>tor,WithSource:()=>Ch,WithStatusCode:()=>P6e,WithTitle:()=>Um,commons:()=>LSc,example:()=>USc,finalIr:()=>VSc,parseIr:()=>WSc});var LSc={};Na(LSc,{BasicSecurityScheme:()=>liu,BearerSecurityScheme:()=>fiu,Encoding:()=>oiu,HeaderSecurityScheme:()=>diu,Namespace:()=>hiu,NamespaceId:()=>giu,OauthSecurityScheme:()=>viu,OpenApiSource:()=>riu,ProtobufEncoding:()=>aiu,ProtobufSource:()=>iiu,QuerySecurityScheme:()=>piu,SchemaId:()=>Bee,SdkGroup:()=>yiu,SdkGroupName:()=>l3i,SecurityScheme:()=>biu,SecuritySchemeId:()=>ciu,Server:()=>o5a,Source:()=>niu,StatusCode:()=>eor,Tag:()=>siu,TagId:()=>Iee,WithAvailability:()=>oy,WithDescription:()=>Of,WithEncoding:()=>Tue,WithInline:()=>xM,WithName:()=>pg,WithNamespace:()=>x0,WithSdkGroupName:()=>Vm,WithSdkMethodName:()=>tor,WithSource:()=>Ch,WithStatusCode:()=>P6e,WithTitle:()=>Um});var gt={};Na(gt,{JsonError:()=>fJn,ParseError:()=>dJn,any:()=>tw_,bigint:()=>Vj_,boolean:()=>rw_,booleanLiteral:()=>ew_,date:()=>Wj_,discriminant:()=>fw_,enum_:()=>kru,getObjectLikeUtils:()=>CQt,getObjectUtils:()=>ynn,getSchemaUtils:()=>NT,isProperty:()=>s3i,lazy:()=>Hj_,lazyObject:()=>Xj_,list:()=>tiu,number:()=>iw_,object:()=>eiu,objectWithoutOptionalProperties:()=>Yj_,optional:()=>xSc,property:()=>Gj_,record:()=>uw_,set:()=>sw_,string:()=>nw_,stringLiteral:()=>kj_,transform:()=>RSc,undiscriminatedUnion:()=>lw_,union:()=>pw_,unknown:()=>aw_,withParsedProperties:()=>FSc});var fw={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 oq(e,t){return`Expected ${t}. Received ${vBE(e)}.`}function vBE(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 jU(e){return{...e,json:Uj_(e.json),parse:Uj_(e.parse)}}function Uj_(e){return(t,r)=>{let i=e(t,r),{skipValidation:n=!1}=r??{};return!i.ok&&n?(console.warn(["Failed to validate.",...i.errors.map(a=>" - "+(a.path.length>0?`${a.path.join(".")}: ${a.message}`:a.message))].join(`
1968
1968
  `)),{ok:!0,value:t}):i}}function Zru(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var fJn=class e extends Error{errors;constructor(t){super(t.map(Zru).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};var dJn=class e extends Error{errors;constructor(t){super(t.map(Zru).join("; ")),this.errors=t,Object.setPrototypeOf(this,e.prototype)}};function NT(e){return{optional:()=>xSc(e),transform:t=>RSc(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new dJn(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new fJn(i.errors)}}}function xSc(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>fw.OPTIONAL};return{...t,...NT(t)}}function RSc(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);return a.ok?{ok:!0,value:t.transform(a.value)}:a},json:(i,n)=>{let a=t.untransform(i);return e.json(a,n)},getType:()=>e.getType()};return{...r,...NT(r)}}function Vj_(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:oq(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:oq(t,"bigint")}]},getType:()=>fw.BIGINT};return{...jU(e),...NT(e)}}var bBE=/^([+-]?\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 Wj_(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:oq(t,"string")}]}:bBE.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:oq(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:oq(t,"Date object")}]},getType:()=>fw.DATE};return{...jU(e),...NT(e)}}function CK(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...jU(r),...NT(r)}}}function kru(e){let t=new Set(e);return CK(fw.ENUM,(i,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:a=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:a,message:oq(i,"string")}]}:!t.has(i)&&!n?{ok:!1,errors:[{path:a,message:oq(i,"enum")}]}:{ok:!0,value:i})()}function Hj_(e){let t=NSc(e);return{...t,...NT(t)}}function NSc(e){return{parse:(t,r)=>pJn(e).parse(t,r),json:(t,r)=>pJn(e).json(t,r),getType:()=>pJn(e).getType()}}function pJn(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}function i5a(e){return Object.entries(e)}function n5a(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[n,a])=>(r.has(n)&&(i[n]=a),i),{})}function u3i(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 a5a(e){return Object.keys(e)}function $j_(e,t){let r=[],i=[];for(let n of e)t(n)?r.push(n):i.push(n);return[r,i]}function CQt(e){return{withParsedProperties:t=>FSc(e,t)}}function FSc(e,t){let r={parse:(i,n)=>{let a=e.parse(i,n);if(!a.ok)return a;let u=Object.entries(t).reduce((c,[d,s])=>({...c,[d]:typeof s=="function"?s(a.value):s}),{});return{ok:!0,value:{...a.value,...u}}},json:(i,n)=>{if(!u3i(i))return{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:oq(i,"object")}]};let a=new Set(Object.keys(t)),u=n5a(i,Object.keys(i).filter(c=>!a.has(c)));return e.json(u,n)},getType:()=>e.getType()};return{...r,...NT(r),...CQt(r)}}function Gj_(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function s3i(e){return e.isProperty}function eiu(e){let t={_getRawProperties:()=>Object.entries(e).map(([r,i])=>s3i(i)?i.rawKey:r),_getParsedProperties:()=>a5a(e),parse:(r,i)=>{let n={},a=[];for(let[u,c]of i5a(e)){let d=s3i(c)?c.rawKey:u,s=s3i(c)?c.valueSchema:c,o={rawKey:d,parsedKey:u,valueSchema:s};n[d]=o,Kj_(s)&&a.push(d)}return Qj_({value:r,requiredKeys:a,getProperty:u=>{let c=n[u];if(c!=null)return{transformedKey:c.parsedKey,transform:d=>c.valueSchema.parse(d,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],u]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},json:(r,i)=>{let n=[];for(let[a,u]of i5a(e)){let c=s3i(u)?u.valueSchema:u;Kj_(c)&&n.push(a)}return Qj_({value:r,requiredKeys:n,getProperty:a=>{let u=e[a];if(u!=null)return s3i(u)?{transformedKey:u.rawKey,transform:c=>u.valueSchema.json(c,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}:{transformedKey:a,transform:c=>u.json(c,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],a]})}},unrecognizedObjectKeys:i?.unrecognizedObjectKeys,skipValidation:i?.skipValidation,breadcrumbsPrefix:i?.breadcrumbsPrefix,omitUndefined:i?.omitUndefined})},getType:()=>fw.OBJECT};return{...jU(t),...NT(t),...CQt(t),...ynn(t)}}function Qj_({value:e,requiredKeys:t,getProperty:r,unrecognizedObjectKeys:i="fail",skipValidation:n=!1,breadcrumbsPrefix:a=[]}){if(!u3i(e))return{ok:!1,errors:[{path:a,message:oq(e,"object")}]};let u=new Set(t),c=[],d={};for(let[s,o]of Object.entries(e)){let l=r(s);if(l!=null){u.delete(s);let v=l.transform(o);v.ok?d[l.transformedKey]=v.value:(d[s]=o,c.push(...v.errors))}else switch(i){case"fail":c.push({path:[...a,s],message:`Unexpected key "${s}"`});break;case"strip":break;case"passthrough":d[s]=o;break}}return c.push(...t.filter(s=>u.has(s)).map(s=>({path:a,message:`Missing required key "${s}"`}))),c.length===0||n?{ok:!0,value:d}:{ok:!1,errors:c}}function ynn(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,n)=>Jj_({extensionKeys:t._getRawProperties(),value:i,transformBase:a=>e.parse(a,n),transformExtension:a=>t.parse(a,n)}),json:(i,n)=>Jj_({extensionKeys:t._getParsedProperties(),value:i,transformBase:a=>e.json(a,n),transformExtension:a=>t.json(a,n)}),getType:()=>fw.OBJECT};return{...r,...NT(r),...CQt(r),...ynn(r)}},passthrough:()=>{let t={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(r,i)=>{let n=e.parse(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},json:(r,i)=>{let n=e.json(r,{...i,unrecognizedObjectKeys:"passthrough"});return n.ok?{ok:!0,value:{...r,...n.value}}:n},getType:()=>fw.OBJECT};return{...t,...NT(t),...CQt(t),...ynn(t)}}}}function Jj_({extensionKeys:e,value:t,transformBase:r,transformExtension:i}){let n=new Set(e),[a,u]=$j_(a5a(t),s=>n.has(s)),c=r(n5a(t,u)),d=i(n5a(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 Kj_(e){return!gBE(e)}function gBE(e){switch(e.getType()){case fw.ANY:case fw.UNKNOWN:case fw.OPTIONAL:return!0;default:return!1}}function Yj_(e){return eiu(e)}function Xj_(e){let t={...NSc(e),_getRawProperties:()=>pJn(e)._getRawProperties(),_getParsedProperties:()=>pJn(e)._getParsedProperties()};return{...t,...NT(t),...CQt(t),...ynn(t)}}function tiu(e){let t={parse:(r,i)=>Zj_(r,(n,a)=>e.parse(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),json:(r,i)=>Zj_(r,(n,a)=>e.json(n,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${a}]`]})),getType:()=>fw.LIST};return{...jU(t),...NT(t)}}function Zj_(e,t){return Array.isArray(e)?e.map((i,n)=>t(i,n)).reduce((i,n)=>{if(i.ok&&n.ok)return{ok:!0,value:[...i.value,n.value]};let a=[];return i.ok||a.push(...i.errors),n.ok||a.push(...n.errors),{ok:!1,errors:a}},{ok:!0,value:[]}):{ok:!1,errors:[{message:oq(e,"list"),path:[]}]}}function kj_(e){return CK(fw.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:oq(r,`"${e}"`)}]})()}function ew_(e){return CK(fw.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:oq(r,`${e.toString()}`)}]})()}var tw_=CK(fw.ANY,e=>({ok:!0,value:e}));var rw_=CK(fw.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:oq(e,"boolean")}]});var iw_=CK(fw.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:oq(e,"number")}]});var nw_=CK(fw.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:oq(e,"string")}]});var aw_=CK(fw.UNKNOWN,e=>({ok:!0,value:e}));function uw_(e,t){let r={parse:(i,n)=>ow_({value:i,isKeyNumeric:e.getType()===fw.NUMBER,transformKey:a=>e.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.parse(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(i,n)=>ow_({value:i,isKeyNumeric:e.getType()===fw.NUMBER,transformKey:a=>e.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${a} (key)`]}),transformValue:(a,u)=>t.json(a,{...n,breadcrumbsPrefix:[...n?.breadcrumbsPrefix??[],`${u}`]}),breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>fw.RECORD};return{...jU(r),...NT(r)}}function ow_({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:n=[]}){return u3i(e)?i5a(e).reduce((a,[u,c])=>{if(c==null)return a;let d=a,s=u;if(t){let g=u.length>0?Number(u):NaN;isNaN(g)||(s=g)}let o=r(s),l=i(c,s);if(d.ok&&o.ok&&l.ok)return{ok:!0,value:{...d.value,[o.value]:l.value}};let v=[];return d.ok||v.push(...d.errors),o.ok||v.push(...o.errors),l.ok||v.push(...l.errors),{ok:!1,errors:v}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:oq(e,"object")}]}}function sw_(e){let t=tiu(e),r={parse:(i,n)=>{let a=t.parse(i,n);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:(i,n)=>i instanceof Set?t.json([...i],n):{ok:!1,errors:[{path:n?.breadcrumbsPrefix??[],message:oq(i,"Set")}]},getType:()=>fw.SET};return{...jU(r),...NT(r)}}function lw_(e){let t={parse:(r,i)=>cw_((n,a)=>n.parse(r,a),e,i),json:(r,i)=>cw_((n,a)=>n.json(r,a),e,i),getType:()=>fw.UNDISCRIMINATED_UNION};return{...jU(t),...NT(t)}}function cw_(e,t,r){let i=[];for(let[n,a]of t.entries()){let u=e(a,{...r,skipValidation:!1});if(u.ok)return u;for(let c of u.errors)i.push({path:c.path,message:`[Variant ${n}] ${c.message}`})}return{ok:!1,errors:i}}function fw_(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}function pw_(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,n=kru(a5a(t)),a={parse:(u,c)=>dw_({value:u,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:d=>n.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:(u,c)=>dw_({value:u,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:d=>n.json(d,{allowUnrecognizedEnumValues:c?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...c?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:d=>t[d],allowUnrecognizedUnionMembers:c?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(d,s)=>s.json(d,c),breadcrumbsPrefix:c?.breadcrumbsPrefix}),getType:()=>fw.UNION};return{...jU(a),...NT(a),...CQt(a)}}function dw_({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:a=!1,transformAdditionalProperties:u,breadcrumbsPrefix:c=[]}){if(!u3i(e))return{ok:!1,errors:[{path:c,message:oq(e,"object")}]};let{[t]:d,...s}=e;if(d==null)return{ok:!1,errors:[{path:c,message:`Missing discriminant ("${t}")`}]};let o=i(d);if(!o.ok)return{ok:!1,errors:o.errors};let l=n(o.value);if(l==null)return a?{ok:!0,value:{[r]:o.value,...s}}:{ok:!1,errors:[{path:[...c,t],message:"Unexpected discriminant value"}]};let v=u(s,l);return v.ok?{ok:!0,value:{[r]:d,...v.value}}:v}var Um=gt.objectWithoutOptionalProperties({title:gt.string().optional()});var riu=gt.objectWithoutOptionalProperties({file:gt.string()});var iiu=gt.objectWithoutOptionalProperties({file:gt.string()});var niu=gt.union("type",{openapi:riu,protobuf:iiu}).transform({transform:e=>{switch(e.type){case"openapi":return qK.openapi(e);case"protobuf":return qK.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Ch=gt.objectWithoutOptionalProperties({source:niu.optional()});var aiu=gt.objectWithoutOptionalProperties({typeName:gt.string()});var oiu=gt.union("type",{protobuf:aiu}).transform({transform:e=>{switch(e.type){case"protobuf":return lJn.protobuf(e);default:return e}},untransform:({_visit:e,...t})=>t});var Tue=gt.objectWithoutOptionalProperties({encoding:oiu.optional()});var Of=gt.objectWithoutOptionalProperties({description:gt.string().optional()});var uiu=gt.enum_(["GenerallyAvailable","Beta","Deprecated"]);var oy=gt.objectWithoutOptionalProperties({availability:uiu.optional()});var eor=gt.number();var P6e=gt.objectWithoutOptionalProperties({statusCode:eor.optional()});var pg=gt.objectWithoutOptionalProperties({nameOverride:gt.string().optional(),generatedName:gt.string()});var xM=gt.objectWithoutOptionalProperties({inline:gt.boolean().optional()});var Bee=gt.string();var Iee=gt.string();var siu=gt.objectWithoutOptionalProperties({id:Iee}).extend(Of);var ciu=gt.string();var liu=gt.objectWithoutOptionalProperties({usernameVariableName:gt.string().optional(),usernameEnvVar:gt.string().optional(),passwordVariableName:gt.string().optional(),passwordEnvVar:gt.string().optional()});var fiu=gt.objectWithoutOptionalProperties({tokenVariableName:gt.string().optional(),tokenEnvVar:gt.string().optional()});var diu=gt.objectWithoutOptionalProperties({headerName:gt.string(),prefix:gt.string().optional(),headerVariableName:gt.string().optional(),headerEnvVar:gt.string().optional()});var piu=gt.objectWithoutOptionalProperties({queryParameterName:gt.string()});var _iu=gt.objectWithoutOptionalProperties({snake:gt.string().optional(),camel:gt.string().optional(),screamingSnake:gt.string().optional(),pascal:gt.string().optional()});var c3i=gt.objectWithoutOptionalProperties({nameOverride:gt.string().optional(),generatedName:gt.string(),value:gt.string(),casing:_iu.optional()}).extend(Of).extend(oy);var hiu=gt.objectWithoutOptionalProperties({type:gt.stringLiteral("namespace"),name:gt.string()});var yiu=gt.undiscriminatedUnion([gt.string(),hiu]);var l3i=gt.list(yiu);var Vm=gt.objectWithoutOptionalProperties({groupName:l3i.optional()});var x0=gt.objectWithoutOptionalProperties({namespace:gt.string().optional()});var _Jn=gt.objectWithoutOptionalProperties({default:c3i.optional(),values:gt.list(c3i)}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Ch).extend(Um).extend(xM);var viu=gt.objectWithoutOptionalProperties({scopesEnum:_Jn.optional()});var biu=gt.union("type",{basic:liu,bearer:fiu,header:diu,query:piu,oauth:viu}).transform({transform:e=>{switch(e.type){case"basic":return PU.basic(e);case"bearer":return PU.bearer(e);case"header":return PU.header(e);case"query":return PU.query(e);case"oauth":return PU.oauth(e);default:return e}},untransform:({_visit:e,...t})=>t});var o5a=gt.objectWithoutOptionalProperties({name:gt.string().optional(),url:gt.string(),audiences:gt.list(gt.string()).optional()}).extend(Of);var giu=gt.string();var tor=gt.objectWithoutOptionalProperties({sdkMethodName:gt.string().optional()});var USc={};Na(USc,{FullExample:()=>FT,FullObjectExample:()=>miu,FullOneOfExample:()=>jiu,KeyValuePair:()=>Piu,LiteralExample:()=>Oiu,PrimitiveExample:()=>yJn,PropertyKey:()=>hJn});var hJn=gt.string();var yJn=gt.union("type",{int:gt.object({value:gt.number()}),int64:gt.object({value:gt.number()}),uint:gt.object({value:gt.number()}),uint64:gt.object({value:gt.number()}),float:gt.object({value:gt.number()}),double:gt.object({value:gt.number()}),string:gt.object({value:gt.string()}),datetime:gt.object({value:gt.string()}),date:gt.object({value:gt.string()}),base64:gt.object({value:gt.string()}),boolean:gt.object({value:gt.boolean()})}).transform({transform:e=>{switch(e.type){case"int":return D_.int(e.value);case"int64":return D_.int64(e.value);case"uint":return D_.uint(e.value);case"uint64":return D_.uint64(e.value);case"float":return D_.float(e.value);case"double":return D_.double(e.value);case"string":return D_.string(e.value);case"datetime":return D_.datetime(e.value);case"date":return D_.date(e.value);case"base64":return D_.base64(e.value);case"boolean":return D_.boolean(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Oiu=gt.union("type",{boolean:gt.object({value:gt.boolean()}),string:gt.object({value:gt.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return a3i.boolean(e.value);case"string":return a3i.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var FT=gt.union("type",{primitive:gt.object({value:yJn}),object:gt.lazyObject(()=>miu),array:gt.object({value:gt.list(gt.lazy(()=>FT))}),map:gt.object({value:gt.list(gt.lazyObject(()=>Piu))}),enum:gt.object({value:gt.string()}),literal:gt.object({value:Oiu}),oneOf:gt.object({value:gt.lazy(()=>jiu)}),unknown:gt.object({value:gt.lazy(()=>FT)})}).transform({transform:e=>{switch(e.type){case"primitive":return Yg.primitive(e.value);case"object":return Yg.object(e);case"array":return Yg.array(e.value);case"map":return Yg.map(e.value);case"enum":return Yg.enum(e.value);case"literal":return Yg.literal(e.value);case"oneOf":return Yg.oneOf(e.value);case"unknown":return Yg.unknown(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var miu=gt.objectWithoutOptionalProperties({properties:gt.record(hJn,gt.lazy(()=>FT))});var Piu=gt.objectWithoutOptionalProperties({key:yJn,value:gt.lazy(()=>FT)});var jiu=gt.union("type",{discriminated:gt.object({value:gt.record(hJn,gt.lazy(()=>FT))}),undiscriminated:gt.object({value:gt.lazy(()=>FT)})}).transform({transform:e=>{switch(e.type){case"discriminated":return o3i.discriminated(e.value);case"undiscriminated":return o3i.undiscriminated(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var VSc={};Na(VSc,{AllOfPropertyConflict:()=>BJn,ArraySchema:()=>_nu,Availability:()=>uiu,BooleanSchema:()=>snu,BytesResponse:()=>wJn,CasingOverrides:()=>_iu,CommonProperty:()=>Pnu,CursorPagination:()=>$iu,CustomCodeSample:()=>Wiu,CustomCodeSampleLanguage:()=>Liu,CustomCodeSampleSdk:()=>Viu,CustomPagination:()=>Qiu,DiscriminatedOneOfSchema:()=>Onu,DoubleSchema:()=>onu,Endpoint:()=>Jiu,EndpointExample:()=>MJn,EndpointResponseExample:()=>Fiu,EndpointSdkName:()=>ror,EnumSchema:()=>_Jn,EnumValue:()=>c3i,ErrorExample:()=>Iiu,FernExample:()=>xiu,FileResponse:()=>PJn,FileSchema:()=>Diu,FormUrlEncodedRequest:()=>Tiu,FullEndpointExample:()=>Hiu,GlobalHeader:()=>lnu,Header:()=>f3i,HeaderExample:()=>EJn,HttpEndpointServer:()=>SJn,HttpError:()=>ziu,HttpMethod:()=>vJn,IdempotencyHeader:()=>fnu,IntSchema:()=>nnu,JsonRequest:()=>qiu,JsonResponse:()=>jJn,LiteralSchema:()=>CJn,LiteralSchemaValue:()=>dnu,LongSchema:()=>anu,MapSchema:()=>hnu,MultipartRequest:()=>mJn,MultipartRequestProperty:()=>Aiu,MultipartRequestPropertyEncoding:()=>Miu,MultipartSchema:()=>Eiu,NullableSchema:()=>vnu,ObjectProperty:()=>gnu,ObjectPropertyConflictInfo:()=>IJn,ObjectSchema:()=>pnu,OctetStreamRequest:()=>OJn,OffsetPagination:()=>Giu,OneOfSchema:()=>bnu,OpenApiIntermediateRepresentation:()=>_w_,OptionalSchema:()=>ynu,Pagination:()=>AJn,PathParameter:()=>bJn,PathParameterExample:()=>Riu,PrimitiveSchema:()=>p3i,PrimitiveSchemaValue:()=>cnu,QueryParameter:()=>gJn,QueryParameterExample:()=>DJn,ReferencedSchema:()=>ior,Request:()=>Ciu,Response:()=>Biu,Schema:()=>tm,Schemas:()=>inu,SdkGroupInfo:()=>wiu,StreamingResponseExample:()=>Niu,StringSchema:()=>unu,SupportedSdkLanguage:()=>Uiu,Tags:()=>Siu,TextResponse:()=>d3i,UnDiscriminatedOneOfSchema:()=>mnu,Webhook:()=>Kiu,WebhookExampleCall:()=>TJn,WebhookHttpMethod:()=>qJn,WebsocketChannel:()=>rnu,WebsocketHandshake:()=>Yiu,WebsocketMessageExample:()=>enu,WebsocketMessageOrigin:()=>Xiu,WebsocketMessageSchema:()=>Ziu,WebsocketServer:()=>kiu,WebsocketSessionExample:()=>tnu});var wiu=gt.objectWithoutOptionalProperties({summary:gt.string().optional(),description:gt.string().optional()});var Siu=gt.objectWithoutOptionalProperties({tagsById:gt.record(Iee,siu),orderedTagIds:gt.list(Iee).optional()});var vJn=gt.enum_(["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS","TRACE"]);var bJn=gt.objectWithoutOptionalProperties({name:gt.string(),schema:gt.lazy(()=>tm),variableReference:gt.string().optional(),parameterNameOverride:gt.string().optional()}).extend(Of).extend(oy).extend(Ch);var gJn=gt.objectWithoutOptionalProperties({name:gt.string(),schema:gt.lazy(()=>tm),parameterNameOverride:gt.string().optional()}).extend(Of).extend(oy).extend(Ch);var f3i=gt.objectWithoutOptionalProperties({name:gt.string(),schema:gt.lazy(()=>tm),env:gt.string().optional(),parameterNameOverride:gt.string().optional()}).extend(Of).extend(oy).extend(Ch);var ror=gt.objectWithoutOptionalProperties({groupName:l3i,methodName:gt.string()});var OJn=gt.objectWithoutOptionalProperties({contentType:gt.string().optional()}).extend(Of).extend(Ch);var Diu=gt.objectWithoutOptionalProperties({isOptional:gt.boolean(),isArray:gt.boolean()}).extend(Of);var Eiu=gt.union("type",{file:Diu,json:gt.object({value:gt.lazy(()=>tm)})}).transform({transform:e=>{switch(e.type){case"file":return Emi.file(e);case"json":return Emi.json(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Miu=gt.enum_(["json","form"]);var Aiu=gt.objectWithoutOptionalProperties({key:gt.string(),schema:Eiu,contentType:gt.string().optional(),exploded:gt.boolean().optional(),encoding:Miu.optional()}).extend(Of);var mJn=gt.objectWithoutOptionalProperties({name:gt.string().optional(),properties:gt.list(Aiu)}).extend(Of).extend(Ch);var qiu=gt.objectWithoutOptionalProperties({schema:gt.lazy(()=>tm),contentType:gt.string().optional(),additionalProperties:gt.boolean()}).extend(Of).extend(Ch);var Tiu=gt.objectWithoutOptionalProperties({schema:gt.lazy(()=>tm),contentType:gt.string().optional(),additionalProperties:gt.boolean()}).extend(Of).extend(Ch);var Ciu=gt.union("type",{octetStream:OJn,multipart:mJn,json:qiu,formUrlEncoded:Tiu}).transform({transform:e=>{switch(e.type){case"octetStream":return kar.octetStream(e);case"multipart":return kar.multipart(e);case"json":return kar.json(e);case"formUrlEncoded":return kar.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var PJn=gt.objectWithoutOptionalProperties({}).extend(Of).extend(Ch).extend(P6e);var jJn=gt.objectWithoutOptionalProperties({schema:gt.lazy(()=>tm),responseProperty:gt.string().optional()}).extend(Of).extend(Ch).extend(P6e);var d3i=gt.objectWithoutOptionalProperties({}).extend(Of).extend(Ch).extend(P6e);var wJn=gt.objectWithoutOptionalProperties({}).extend(Of).extend(Ch).extend(P6e);var Biu=gt.union("type",{file:PJn,json:jJn,text:d3i,bytes:wJn,streamingSse:jJn,streamingText:d3i,streamingJson:jJn}).transform({transform:e=>{switch(e.type){case"file":return TK.file(e);case"json":return TK.json(e);case"text":return TK.text(e);case"bytes":return TK.bytes(e);case"streamingSse":return TK.streamingSse(e);case"streamingText":return TK.streamingText(e);case"streamingJson":return TK.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var Iiu=gt.objectWithoutOptionalProperties({name:gt.string().optional(),description:gt.string().optional(),example:gt.lazy(()=>FT)});var ziu=gt.objectWithoutOptionalProperties({schema:gt.lazy(()=>tm).optional(),examples:gt.list(Iiu).optional()}).extend(Of).extend(pg).extend(Ch);var SJn=gt.objectWithoutOptionalProperties({name:gt.string().optional(),url:gt.string().optional(),audiences:gt.list(gt.string()).optional()});var xiu=gt.unknown();var Riu=gt.objectWithoutOptionalProperties({name:gt.string(),parameterNameOverride:gt.string().optional(),value:gt.lazy(()=>FT)});var DJn=gt.objectWithoutOptionalProperties({name:gt.string(),value:gt.lazy(()=>FT)});var EJn=gt.objectWithoutOptionalProperties({name:gt.string(),value:gt.lazy(()=>FT)});var Niu=gt.objectWithoutOptionalProperties({sse:gt.boolean(),events:gt.list(gt.lazy(()=>FT))});var Fiu=gt.union("type",{withStreaming:Niu,withoutStreaming:gt.object({value:gt.lazy(()=>FT)})}).transform({transform:e=>{switch(e.type){case"withStreaming":return TQt.withStreaming(e);case"withoutStreaming":return TQt.withoutStreaming(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var Liu=gt.objectWithoutOptionalProperties({name:gt.string().optional(),language:gt.string(),code:gt.string(),install:gt.string().optional()}).extend(Of);var Uiu=gt.enum_(["curl","python","javascript","typescript","go","ruby","csharp","java","js","node","ts","nodets","golang","dotnet","jvm"]);var Viu=gt.objectWithoutOptionalProperties({name:gt.string().optional(),sdk:Uiu,code:gt.string()}).extend(Of);var Wiu=gt.union("type",{language:Liu,sdk:Viu}).transform({transform:e=>{switch(e.type){case"language":return Dmi.language(e);case"sdk":return Dmi.sdk(e);default:return e}},untransform:({_visit:e,...t})=>t});var Hiu=gt.objectWithoutOptionalProperties({name:gt.string().optional(),pathParameters:gt.list(Riu).optional(),queryParameters:gt.list(DJn).optional(),headers:gt.list(EJn).optional(),request:gt.lazy(()=>FT).optional(),response:Fiu.optional(),codeSamples:gt.list(Wiu)}).extend(Of);var MJn=gt.union("type",{unknown:gt.object({value:xiu}),full:Hiu}).transform({transform:e=>{switch(e.type){case"unknown":return qQt.unknown(e.value);case"full":return qQt.full(e);default:return e}},untransform:({_visit:e,...t})=>t});var $iu=gt.objectWithoutOptionalProperties({cursor:gt.string(),nextCursor:gt.property("next_cursor",gt.string()),results:gt.string()});var Giu=gt.objectWithoutOptionalProperties({offset:gt.string(),results:gt.string(),step:gt.string().optional(),hasNextPage:gt.string().optional()});var Qiu=gt.objectWithoutOptionalProperties({results:gt.string()});var AJn=gt.union("type",{cursor:$iu,offset:Giu,custom:Qiu}).transform({transform:e=>{switch(e.type){case"cursor":return m6e.cursor(e);case"offset":return m6e.offset(e);case"custom":return m6e.custom(e);default:return e}},untransform:({_visit:e,...t})=>t});var Jiu=gt.objectWithoutOptionalProperties({authed:gt.boolean(),internal:gt.boolean().optional(),idempotent:gt.boolean().optional(),method:vJn,audiences:gt.list(gt.string()),path:gt.string(),summary:gt.string().optional(),operationId:gt.string().optional(),tags:gt.list(Iee),pathParameters:gt.list(bJn),queryParameters:gt.list(gJn),headers:gt.list(f3i),sdkName:ror.optional(),generatedRequestName:gt.string(),requestNameOverride:gt.string().optional(),request:Ciu.optional(),response:Biu.optional(),errors:gt.record(eor,ziu),servers:gt.list(SJn),examples:gt.list(MJn),pagination:AJn.optional()}).extend(Of).extend(oy).extend(Ch).extend(x0);var qJn=gt.enum_(["GET","POST"]);var TJn=gt.objectWithoutOptionalProperties({name:gt.string().optional(),payload:gt.lazy(()=>FT)}).extend(Of);var Kiu=gt.objectWithoutOptionalProperties({audiences:gt.list(gt.string()),sdkName:ror.optional(),method:qJn,summary:gt.string().optional(),operationId:gt.string(),tags:gt.list(Iee),headers:gt.list(f3i),generatedPayloadName:gt.string(),payload:gt.lazy(()=>tm),examples:gt.list(TJn)}).extend(Of).extend(Ch).extend(x0);var Yiu=gt.objectWithoutOptionalProperties({queryParameters:gt.list(gJn),headers:gt.list(f3i),pathParameters:gt.list(bJn)});var Xiu=gt.enum_(["client","server"]);var Ziu=gt.objectWithoutOptionalProperties({name:gt.string(),origin:Xiu,body:gt.lazy(()=>tm)});var kiu=gt.objectWithoutOptionalProperties({name:gt.string(),url:gt.string()});var enu=gt.objectWithoutOptionalProperties({messageType:gt.string(),payload:gt.lazy(()=>FT)}).extend(Of);var tnu=gt.objectWithoutOptionalProperties({name:gt.string().optional(),queryParameters:gt.list(DJn).optional(),headers:gt.list(EJn).optional(),messages:gt.list(enu)}).extend(Of);var rnu=gt.objectWithoutOptionalProperties({audiences:gt.list(gt.string()),path:gt.string(),groupName:l3i,summary:gt.string().optional(),handshake:Yiu,messages:gt.list(Ziu),servers:gt.list(kiu),examples:gt.list(tnu)}).extend(Of).extend(Ch);var inu=gt.objectWithoutOptionalProperties({rootSchemas:gt.record(Bee,gt.lazy(()=>tm)),namespacedSchemas:gt.record(giu,gt.record(Bee,gt.lazy(()=>tm)))});var nnu=gt.objectWithoutOptionalProperties({default:gt.number().optional(),minimum:gt.number().optional(),maximum:gt.number().optional(),exclusiveMinimum:gt.boolean().optional(),exclusiveMaximum:gt.boolean().optional(),multipleOf:gt.number().optional()});var anu=gt.objectWithoutOptionalProperties({default:gt.number().optional()});var onu=gt.objectWithoutOptionalProperties({default:gt.number().optional(),minimum:gt.number().optional(),maximum:gt.number().optional(),exclusiveMinimum:gt.boolean().optional(),exclusiveMaximum:gt.boolean().optional(),multipleOf:gt.number().optional()});var unu=gt.objectWithoutOptionalProperties({default:gt.string().optional(),pattern:gt.string().optional(),format:gt.string().optional(),minLength:gt.number().optional(),maxLength:gt.number().optional()});var snu=gt.objectWithoutOptionalProperties({default:gt.boolean().optional()});var cnu=gt.union("type",{int:nnu,int64:anu,uint:gt.object({}),uint64:gt.object({}),float:gt.object({}),double:onu,string:unu,datetime:gt.object({}),date:gt.object({}),base64:gt.object({}),boolean:snu}).transform({transform:e=>{switch(e.type){case"int":return xw.int(e);case"int64":return xw.int64(e);case"uint":return xw.uint();case"uint64":return xw.uint64();case"float":return xw.float();case"double":return xw.double(e);case"string":return xw.string(e);case"datetime":return xw.datetime();case"date":return xw.date();case"base64":return xw.base64();case"boolean":return xw.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var p3i=gt.objectWithoutOptionalProperties({schema:cnu}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Um);var lnu=gt.objectWithoutOptionalProperties({header:gt.string(),name:gt.string().optional(),optional:gt.boolean().optional(),env:gt.string().optional(),schema:gt.lazy(()=>tm).optional()});var fnu=gt.objectWithoutOptionalProperties({header:gt.string(),name:gt.string().optional(),env:gt.string().optional(),schema:gt.lazy(()=>tm).optional()});var _w_=gt.objectWithoutOptionalProperties({apiVersion:gt.unknown().optional(),title:gt.string().optional(),description:gt.string().optional(),basePath:gt.string().optional(),servers:gt.list(o5a),websocketServers:gt.list(o5a),groups:gt.record(gt.string(),wiu),tags:Siu,hasEndpointsMarkedInternal:gt.boolean(),endpoints:gt.list(Jiu),webhooks:gt.list(Kiu),channels:gt.record(gt.string(),rnu),groupedSchemas:inu,variables:gt.record(gt.string(),p3i),nonRequestReferencedSchemas:gt.set(Bee),securitySchemes:gt.record(ciu,biu),globalHeaders:gt.list(lnu).optional(),idempotencyHeaders:gt.list(fnu).optional()});var ior=gt.objectWithoutOptionalProperties({schema:Bee}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Ch).extend(Um);var dnu=gt.union("type",{boolean:gt.object({value:gt.boolean()}),string:gt.object({value:gt.string()})}).transform({transform:e=>{switch(e.type){case"boolean":return px.boolean(e.value);case"string":return px.string(e.value);default:return e}},untransform:({_visit:e,...t})=>t});var CJn=gt.objectWithoutOptionalProperties({value:dnu}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Um);var tm=gt.union("type",{primitive:p3i,object:gt.lazyObject(()=>pnu),array:gt.lazyObject(()=>_nu),map:gt.lazyObject(()=>hnu),optional:gt.lazyObject(()=>ynu),enum:_Jn,reference:ior,literal:CJn,oneOf:gt.object({value:gt.lazy(()=>bnu)}),nullable:gt.lazyObject(()=>vnu),unknown:pg}).transform({transform:e=>{switch(e.type){case"primitive":return Ov.primitive(e);case"object":return Ov.object(e);case"array":return Ov.array(e);case"map":return Ov.map(e);case"optional":return Ov.optional(e);case"enum":return Ov.enum(e);case"reference":return Ov.reference(e);case"literal":return Ov.literal(e);case"oneOf":return Ov.oneOf(e.value);case"nullable":return Ov.nullable(e);case"unknown":return Ov.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var BJn=gt.objectWithoutOptionalProperties({propertyKey:gt.string(),allOfSchemaIds:gt.list(Bee),conflictingTypeSignatures:gt.boolean()});var pnu=gt.objectWithoutOptionalProperties({allOf:gt.list(ior),properties:gt.list(gt.lazyObject(()=>gnu)),allOfPropertyConflicts:gt.list(BJn),additionalProperties:gt.boolean()}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Ch).extend(Um).extend(xM);var IJn=gt.objectWithoutOptionalProperties({differentSchema:gt.boolean()});var gnu=gt.objectWithoutOptionalProperties({key:gt.string(),schema:gt.lazy(()=>tm),readonly:gt.boolean().optional(),writeonly:gt.boolean().optional(),conflict:gt.record(Bee,IJn),generatedName:gt.string(),nameOverride:gt.string().optional(),audiences:gt.list(gt.string())}).extend(oy);var _nu=gt.objectWithoutOptionalProperties({value:gt.lazy(()=>tm)}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Um).extend(xM);var hnu=gt.objectWithoutOptionalProperties({key:p3i,value:gt.lazy(()=>tm)}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Tue).extend(Um).extend(xM);var ynu=gt.objectWithoutOptionalProperties({value:gt.lazy(()=>tm)}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Um).extend(xM);var vnu=gt.objectWithoutOptionalProperties({value:gt.lazy(()=>tm)}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Um).extend(xM);var bnu=gt.union("type",{discriminated:gt.lazyObject(()=>Onu),undiscriminated:gt.lazyObject(()=>mnu)}).transform({transform:e=>{switch(e.type){case"discriminated":return Mmi.discriminated(e);case"undiscriminated":return Mmi.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var Onu=gt.objectWithoutOptionalProperties({discriminantProperty:gt.string(),commonProperties:gt.list(gt.lazyObject(()=>Pnu)),schemas:gt.record(gt.string(),gt.lazy(()=>tm))}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Tue).extend(Ch).extend(Um).extend(xM);var Pnu=gt.objectWithoutOptionalProperties({key:gt.string(),schema:gt.lazy(()=>tm)});var mnu=gt.objectWithoutOptionalProperties({schemas:gt.list(gt.lazy(()=>tm))}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Tue).extend(Ch).extend(Um).extend(xM);var WSc={};Na(WSc,{ArraySchemaWithExample:()=>$nu,Base64WithExample:()=>Lnu,BooleanWithExample:()=>Unu,CommonPropertyWithExample:()=>eau,DateWithExample:()=>Fnu,DatetimeWithExample:()=>Nnu,DiscriminatedOneOfSchemaWithExample:()=>Znu,DoubleWithExample:()=>xnu,EndpointWithExample:()=>yw_,EnumSchemaWithExample:()=>Wnu,FloatWithExample:()=>znu,HeaderWithExample:()=>_3i,HttpErrorWithExample:()=>qnu,Int64WithExample:()=>Cnu,IntWithExample:()=>Tnu,JsonRequestWithExample:()=>Dnu,JsonResponseWithExample:()=>xJn,MapSchemaWithExample:()=>Gnu,NamedFullExample:()=>j6e,NullableSchemaWithExample:()=>Jnu,ObjectPropertyWithExample:()=>Xnu,ObjectSchemaWithExample:()=>Knu,OneOfSchemaWithExample:()=>Ynu,OptionalSchemaWithExample:()=>Qnu,ParseFormUrlEncodedRequest:()=>Enu,ParseMultipartRequest:()=>Snu,ParseOctetStreamRequest:()=>wnu,PathParameterWithExample:()=>jnu,PrimitiveSchemaValueWithExample:()=>Vnu,PrimitiveSchemaWithExample:()=>RJn,QueryParameterWithExample:()=>zJn,RequestWithExample:()=>Mnu,ResponseWithExample:()=>Anu,SchemaWithExample:()=>RM,StringSchemaWithExample:()=>Rnu,Uint64WithExample:()=>Inu,UintWithExample:()=>Bnu,UnDiscriminatedOneOfSchemaWithExample:()=>knu,UnknownSchemaWithExample:()=>Hnu,WebhookWithExample:()=>vw_,WebsocketHandshakeWithExample:()=>hw_});var j6e=gt.objectWithoutOptionalProperties({name:gt.string().optional(),value:gt.unknown()}).extend(Of);var zJn=gt.objectWithoutOptionalProperties({name:gt.string(),schema:gt.lazy(()=>RM),parameterNameOverride:gt.string().optional()}).extend(Of).extend(oy).extend(Ch);var _3i=gt.objectWithoutOptionalProperties({name:gt.string(),schema:gt.lazy(()=>RM),env:gt.string().optional(),parameterNameOverride:gt.string().optional()}).extend(Of).extend(oy).extend(Ch);var hw_=gt.objectWithoutOptionalProperties({queryParameters:gt.list(zJn),headers:gt.list(_3i)});var jnu=gt.objectWithoutOptionalProperties({name:gt.string(),schema:gt.lazy(()=>RM),variableReference:gt.string().optional(),parameterNameOverride:gt.string().optional()}).extend(Of).extend(oy).extend(Ch);var wnu=gt.objectWithoutOptionalProperties({}).extend(OJn).extend(tor);var Snu=gt.objectWithoutOptionalProperties({}).extend(mJn).extend(tor);var Dnu=gt.objectWithoutOptionalProperties({schema:gt.lazy(()=>RM),contentType:gt.string().optional(),fullExamples:gt.list(j6e).optional(),additionalProperties:gt.boolean()}).extend(Of).extend(Ch).extend(tor);var Enu=gt.objectWithoutOptionalProperties({schema:gt.lazy(()=>RM),contentType:gt.string().optional(),fullExamples:gt.list(j6e).optional(),additionalProperties:gt.boolean()}).extend(Of).extend(Ch).extend(tor);var Mnu=gt.union("type",{octetStream:wnu,multipart:Snu,json:Dnu,formUrlEncoded:Enu}).transform({transform:e=>{switch(e.type){case"octetStream":return Tee.octetStream(e);case"multipart":return Tee.multipart(e);case"json":return Tee.json(e);case"formUrlEncoded":return Tee.formUrlEncoded(e);default:return e}},untransform:({_visit:e,...t})=>t});var xJn=gt.objectWithoutOptionalProperties({schema:gt.lazy(()=>RM),responseProperty:gt.string().optional(),fullExamples:gt.list(j6e).optional()}).extend(Of).extend(Ch).extend(P6e);var Anu=gt.union("type",{file:PJn,json:xJn,text:d3i,bytes:wJn,streamingSse:xJn,streamingText:d3i,streamingJson:xJn}).transform({transform:e=>{switch(e.type){case"file":return OB.file(e);case"json":return OB.json(e);case"text":return OB.text(e);case"bytes":return OB.bytes(e);case"streamingSse":return OB.streamingSse(e);case"streamingText":return OB.streamingText(e);case"streamingJson":return OB.streamingJson(e);default:return e}},untransform:({_visit:e,...t})=>t});var qnu=gt.objectWithoutOptionalProperties({statusCode:eor,schema:gt.lazy(()=>RM),fullExamples:gt.list(j6e).optional()}).extend(Of).extend(pg).extend(Ch);var yw_=gt.objectWithoutOptionalProperties({authed:gt.boolean(),internal:gt.boolean().optional(),idempotent:gt.boolean().optional(),method:vJn,audiences:gt.list(gt.string()),path:gt.string(),summary:gt.string().optional(),operationId:gt.string().optional(),tags:gt.list(Iee),pathParameters:gt.list(jnu),queryParameters:gt.list(zJn),headers:gt.list(_3i),sdkName:ror.optional(),generatedRequestName:gt.string(),requestNameOverride:gt.string().optional(),request:Mnu.optional(),response:Anu.optional(),errors:gt.record(eor,qnu),servers:gt.list(SJn),examples:gt.list(MJn),pagination:AJn.optional()}).extend(Of).extend(oy).extend(Ch).extend(x0);var vw_=gt.objectWithoutOptionalProperties({audiences:gt.list(gt.string()),sdkName:ror.optional(),method:qJn,summary:gt.string().optional(),operationId:gt.string(),tags:gt.list(Iee),headers:gt.list(_3i),generatedPayloadName:gt.string(),payload:gt.lazy(()=>RM),examples:gt.list(TJn)}).extend(Of).extend(Ch).extend(x0);var Tnu=gt.objectWithoutOptionalProperties({default:gt.number().optional(),minimum:gt.number().optional(),maximum:gt.number().optional(),exclusiveMinimum:gt.boolean().optional(),exclusiveMaximum:gt.boolean().optional(),multipleOf:gt.number().optional(),example:gt.number().optional()});var Cnu=gt.objectWithoutOptionalProperties({default:gt.number().optional(),example:gt.number().optional()});var Bnu=gt.objectWithoutOptionalProperties({default:gt.number().optional(),example:gt.number().optional()});var Inu=gt.objectWithoutOptionalProperties({default:gt.number().optional(),example:gt.number().optional()});var znu=gt.objectWithoutOptionalProperties({example:gt.number().optional()});var xnu=gt.objectWithoutOptionalProperties({default:gt.number().optional(),minimum:gt.number().optional(),maximum:gt.number().optional(),exclusiveMinimum:gt.boolean().optional(),exclusiveMaximum:gt.boolean().optional(),multipleOf:gt.number().optional(),example:gt.number().optional()});var Rnu=gt.objectWithoutOptionalProperties({default:gt.string().optional(),pattern:gt.string().optional(),format:gt.string().optional(),minLength:gt.number().optional(),maxLength:gt.number().optional(),example:gt.string().optional()});var Nnu=gt.objectWithoutOptionalProperties({example:gt.string().optional()});var Fnu=gt.objectWithoutOptionalProperties({example:gt.string().optional()});var Lnu=gt.objectWithoutOptionalProperties({example:gt.string().optional()});var Unu=gt.objectWithoutOptionalProperties({default:gt.boolean().optional(),example:gt.boolean().optional()});var Vnu=gt.union("type",{int:Tnu,int64:Cnu,uint:Bnu,uint64:Inu,float:znu,double:xnu,string:Rnu,datetime:Nnu,date:Fnu,base64:Lnu,boolean:Unu}).transform({transform:e=>{switch(e.type){case"int":return vp.int(e);case"int64":return vp.int64(e);case"uint":return vp.uint(e);case"uint64":return vp.uint64(e);case"float":return vp.float(e);case"double":return vp.double(e);case"string":return vp.string(e);case"datetime":return vp.datetime(e);case"date":return vp.date(e);case"base64":return vp.base64(e);case"boolean":return vp.boolean(e);default:return e}},untransform:({_visit:e,...t})=>t});var RJn=gt.objectWithoutOptionalProperties({schema:Vnu}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Um);var Wnu=gt.objectWithoutOptionalProperties({default:c3i.optional(),values:gt.list(c3i),example:gt.string().optional()}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Ch).extend(Um).extend(xM);var Hnu=gt.objectWithoutOptionalProperties({example:gt.unknown()}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Um);var RM=gt.union("type",{primitive:RJn,object:gt.lazyObject(()=>Knu),array:gt.lazyObject(()=>$nu),map:gt.lazyObject(()=>Gnu),optional:gt.lazyObject(()=>Qnu),enum:Wnu,reference:ior,literal:CJn,oneOf:gt.object({value:gt.lazy(()=>Ynu)}),nullable:gt.lazyObject(()=>Jnu),unknown:Hnu}).transform({transform:e=>{switch(e.type){case"primitive":return zl.primitive(e);case"object":return zl.object(e);case"array":return zl.array(e);case"map":return zl.map(e);case"optional":return zl.optional(e);case"enum":return zl.enum(e);case"reference":return zl.reference(e);case"literal":return zl.literal(e);case"oneOf":return zl.oneOf(e.value);case"nullable":return zl.nullable(e);case"unknown":return zl.unknown(e);default:return e}},untransform:({_visit:e,...t})=>t});var $nu=gt.objectWithoutOptionalProperties({value:gt.lazy(()=>RM),example:gt.list(gt.unknown()).optional()}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Um).extend(xM);var Gnu=gt.objectWithoutOptionalProperties({key:RJn,value:gt.lazy(()=>RM),example:gt.unknown().optional()}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Tue).extend(Um).extend(xM);var Qnu=gt.objectWithoutOptionalProperties({value:gt.lazy(()=>RM)}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Um).extend(xM);var Jnu=gt.objectWithoutOptionalProperties({value:gt.lazy(()=>RM)}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Um).extend(xM);var Knu=gt.objectWithoutOptionalProperties({allOf:gt.list(ior),properties:gt.list(gt.lazyObject(()=>Xnu)),allOfPropertyConflicts:gt.list(BJn),fullExamples:gt.list(j6e).optional(),additionalProperties:gt.boolean()}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Ch).extend(Um).extend(xM);var Xnu=gt.objectWithoutOptionalProperties({key:gt.string(),schema:gt.lazy(()=>RM),readonly:gt.boolean().optional(),writeonly:gt.boolean().optional(),audiences:gt.list(gt.string()),conflict:gt.record(Bee,IJn),nameOverride:gt.string().optional(),generatedName:gt.string()}).extend(oy);var Ynu=gt.union("type",{discriminated:gt.lazyObject(()=>Znu),undiscriminated:gt.lazyObject(()=>knu)}).transform({transform:e=>{switch(e.type){case"discriminated":return Cee.discriminated(e);case"undiscriminated":return Cee.undiscriminated(e);default:return e}},untransform:({_visit:e,...t})=>t});var Znu=gt.objectWithoutOptionalProperties({discriminantProperty:gt.string(),commonProperties:gt.list(gt.lazyObject(()=>eau)),schemas:gt.record(gt.string(),gt.lazy(()=>RM))}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Tue).extend(Ch).extend(Um).extend(xM);var eau=gt.objectWithoutOptionalProperties({key:gt.string(),schema:gt.lazy(()=>RM)});var knu=gt.objectWithoutOptionalProperties({schemas:gt.list(gt.lazy(()=>RM))}).extend(Vm).extend(x0).extend(pg).extend(Of).extend(oy).extend(Tue).extend(Ch).extend(Um).extend(xM);var bw_=/^(\d+)/,NJn=/^[a-zA-Z][a-zA-Z0-9_]*$/,gw_={"<":"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 h3i(e){let t=["zero","one","two","three","four","five","six","seven","eight","nine"],r=["ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],i=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];if(e<0||e>9999)return;if(e<10)return t[e];if(e<20)return r[e-10];if(e<100){let u=Math.floor(e/10),c=e%10;return c===0?i[u]:`${i[u]}_${t[c]}`}if(e<1e3){let u=Math.floor(e/100),c=e%100;return c===0?`${t[u]}_hundred`:`${t[u]}_hundred_${h3i(c)}`}let n=Math.floor(e/1e3),a=e%1e3;return a===0?`${t[n]}_thousand`:`${t[n]}_thousand_${h3i(a)}`}function u5a(e){let t=e.match(bw_);if(t&&t[0]!=null){let r=t[0],i=e.substring(r.length),n=parseFloat(r);if(!isNaN(n)&&isFinite(n)){let a=h3i(n);return i.length>0?`${a}_${i}`:a}}}function FJn(e){let t=u5a(e),r=gw_[e];return t!=null?QB(R_(t)):r??(e.toLowerCase()==="n/a"?"NOT_APPLICABLE":QB(R_(e)))}function Cue(e,t){return e.type==="primitive"&&t.type==="primitive"?Ow_(e.schema,t.schema):e.type==="enum"&&t.type==="enum"?OBE(e.values,t.values):e.type==="array"&&t.type==="array"?Cue(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"?Cue(e.value,t.value):e.type==="oneOf"&&t.type==="oneOf"?mBE(e.value,t.value):e.type==="object"&&t.type==="object"?PBE(e,t):e.type==="map"&&t.type==="map"?Ow_(e.key.schema,t.key.schema)&&Cue(e.value,t.value):e.type==="literal"&&t.type==="literal"?e.value===t.value:!1}function Ow_(e,t){return e.type===t.type}function OBE(e,t){let r=new Set(...e.map(n=>n.value)),i=new Set(...t.map(n=>n.value));return W8(r,i)}function mBE(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,i])=>{let n=t.schemas[r];return n==null?!1:Cue(i,n)}):e.type==="undiscriminated"&&t.type==="undiscriminated"?e.schemas.length===t.schemas.length&&e.schemas.every((r,i)=>{let n=t.schemas[i];return n==null?!1:Cue(r,n)}):!1}function PBE(e,t){if(Object.keys(e.properties).length!==Object.keys(t.properties).length)return!1;let r=Object.fromEntries(e.properties.map(i=>[i.key,i.schema]));return Object.entries(t.properties).every(([i,n])=>{let a=r[i];return a==null?!1:Cue(a,n.schema)})}function mR(e){switch(e){case v$.Deprecated:return"deprecated";case v$.Beta:return"pre-release";case v$.GenerallyAvailable:return"generally-available";default:return}}function jBE(e){let t=e.find(i=>typeof i=="object"&&i.type==="namespace"),r=e.filter(i=>typeof i=="string"||i.type!=="namespace");return t?[t,...r]:r}function mw_(e){let t=e?jBE(e):void 0;if(t==null||t.length===0)return jZi;let r=[];for(let[i,n]of t.entries())if(typeof n=="string")r.push(R_(n));else if(typeof n=="object")switch(n.type){case"namespace":{i<t.length-1?r.push(R_(n.name)):r.push(n.name,jZi);break}default:Ao(n.type)}else Ao(n);return r.join("/")}function y3i(e){return wy.of(`${mw_(e)}.yml`)}function HSc({sdkName:e,namespaceOverride:t}){let r;return e==null||e.groupName.length===0&&t==null?jZi:(t!=null?r=[{type:"namespace",name:t},...e.groupName.filter(i=>typeof i=="string"||i.type!=="namespace")]:r=e.groupName,mw_(r))}function Pw_({sdkName:e,namespaceOverride:t}){return wy.of(`${HSc({sdkName:e,namespaceOverride:t})}.yml`)}function jw_({location:e,namespaceOverride:t}){return t!=null?GN(wy.of(t),e):e}function tau(e){switch(e.type){case"protobuf":return{proto:{type:e.typeName}};default:Ao(e.type)}}function LJn(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:Ao(e)}}function uq(e){return typeof e=="string"?e:e.type}function UJn(e){if(typeof e!="string")return e.docs}function s5a(e){if(typeof e!="string")return e.default}function $Sc(e){if(typeof e!="string")return e.validation}var wBE=-2147483648,SBE=2147483647,DBE=-17976931348623157e292,EBE=17976931348623157e292;function Xg({schema:e,fileContainingReference:t,declarationFile:r=t,context:i,namespace:n,declarationDepth:a}){switch(i.shouldMarkSchemaAsReferenced()&&i.markSchemaAsReferenced(e,n),e.type){case"primitive":return rau(e);case"array":return JSc({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"map":return KSc({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"reference":return QSc({schema:e,fileContainingReference:t,context:i,namespace:n});case"unknown":return XSc();case"optional":return iau({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"nullable":return YSc({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"enum":return xBE({schema:e,fileContainingReference:t,context:i,declarationFile:r,declarationDepth:a});case"literal":return e.value,ZSc(e);case"object":return RBE({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});case"oneOf":return NBE({schema:e.value,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});default:Ao(e)}}function rau(e){switch(e.schema.type){case"string":return qBE({description:e.description,schema:e.schema});case"int":return TBE({description:e.description,schema:e.schema});case"float":return CBE({description:e.description,schema:e.schema});case"double":return BBE({description:e.description,schema:e.schema});case"boolean":return MBE({description:e.description,schema:e.schema});case"int64":return ABE({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:mR(e.availability)}:{}}}function MBE({description:e,schema:t}){let r="boolean";if(e==null&&t.default==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),i}function ABE({description:e,schema:t}){let r="long";if(e==null&&t.default==null)return r;let i={type:r};return e!=null&&(i.docs=e),t.default!=null&&(i.default=t.default),i}function qBE({description:e,schema:t}){let r="string",i=IBE(t);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function TBE({description:e,schema:t}){let r="integer",i=Sw_(t,r);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function CBE({description:e,schema:t}){let r="float";if(e==null)return r;let i={type:r};return e!=null&&(i.docs=e),i}function BBE({description:e,schema:t}){let r="double",i=Sw_(t,r);if(e==null&&t.default==null&&i==null)return r;let n={type:r};return e!=null&&(n.docs=e),t.default!=null&&(n.default=t.default),i!=null&&(n.validation=i),n}function IBE(e){if(e==null)return;let{format:t,pattern:r,minLength:i,maxLength:n}=e,a=zBE(t);if(!(a==null&&r==null&&i==null&&n==null))return{format:a,pattern:r,minLength:i,maxLength:n}}function zBE(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 Sw_(e,t){if(e==null)return;let{minimum:r,maximum:i,multipleOf:n}=e,{exclusiveMinimum:a,exclusiveMaximum:u}=e;if(r=GSc(r,t),i=GSc(i,t),n=GSc(n,t),!(r==null&&i==null&&a==null&&u==null&&n==null))return{min:r,max:i,exclusiveMin:a,exclusiveMax:u,multipleOf:n}}function GSc(e,t){if(e===void 0)return;let[r,i]=t==="integer"?[wBE,SBE]:[DBE,EBE];return e<r||e>i?void 0:e}function QSc({schema:e,fileContainingReference:t,context:r,namespace:i}){let n=r.getSchema(e.schema,i);if(n==null)return"unknown";let a=FBE(n)??e.schema,u=LJn(n),c=LBE(n),d=nau({context:r,fileContainingReference:t,declarationFile:y3i(u),type:a}),s=n.type==="nullable"?`optional<${d}>`:d;return e.description==null&&c==null?s:{type:n.type==="nullable"?`optional<${d}>`:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:mR(e.availability)}:{}}}function JSc({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=Xg({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=`list<${uq(u)}>`;return e.description==null&&e.title==null?c:{...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:mR(e.availability)}:{},type:c}}function KSc({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=rau(e.key),c=Xg({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),d=e.encoding!=null?tau(e.encoding):void 0,s=`map<${uq(u)}, ${uq(c)}>`;if(e.description==null&&d==null&&e.title==null)return s;let o={type:s};return e.description!=null&&(o.docs=e.description),e.encoding!=null&&(o.encoding=d),e.availability!=null&&(o.availability=mR(e.availability)),o}function YSc({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){if(!i.respectNullableSchemas)return iau({schema:e,fileContainingReference:t,context:i,declarationFile:r,namespace:n,declarationDepth:a});let u=Xg({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=uq(u),d=UJn(u),s=s5a(u),o=$Sc(u),l=c.startsWith("nullable<")?c:`nullable<${c}>`;if(e.availability==null&&e.description==null&&d==null&&s==null&&o==null&&e.title==null)return ww_({typeReference:l,itemType:c});let v={type:l};return(e.description!=null||d!=null)&&(v.docs=e.description??d),s!=null&&(v.default=s),o!=null&&(v.validation=o),e.availability!=null&&(v.availability=mR(e.availability)),ww_({typeReference:v,itemType:c})}function iau({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=Xg({schema:e.value,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=uq(u),d=UJn(u),s=s5a(u),o=$Sc(u),l=c.startsWith("optional<")?c:`optional<${c}>`;if(e.availability==null&&e.description==null&&d==null&&s==null&&o==null&&e.title==null)return l;let v={type:l};return(e.description!=null||d!=null)&&(v.docs=e.description??d),s!=null&&(v.default=s),o!=null&&(v.validation=o),e.availability!=null&&(v.availability=mR(e.availability)),v}function XSc(){return"unknown"}function ZSc(e){let t;switch(e.value.type){case"boolean":{t=`literal<${e.value.value}>`;break}case"string":{t=`literal<"${e.value.value}">`;break}default:Ao(e.value)}return e.description==null&&e.title==null?t:{type:t,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:mR(e.availability)}:{}}}function xBE({schema:e,fileContainingReference:t,declarationFile:r,context:i,declarationDepth:n}){let a=c5a(e,n),u=e.nameOverride??e.generatedName;i.builder.addType(r,{name:u,schema:a.schema});let c=nau({type:u,fileContainingReference:t,declarationFile:r,context:i});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=mR(e.availability)),d}function RBE({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=kSc({schema:e,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=e.nameOverride??e.generatedName;i.builder.addType(r,{name:c,schema:u.schema});let d=nau({type:c,fileContainingReference:t,declarationFile:r,context:i});return e.description==null&&e.title==null?d:{type:d,...e.description!=null?{docs:e.description}:{},...e.availability!=null?{availability:mR(e.availability)}:{}}}function NBE({schema:e,fileContainingReference:t,declarationFile:r,context:i,namespace:n,declarationDepth:a}){let u=eDc({schema:e,declarationFile:r,context:i,namespace:n,declarationDepth:a}),c=e.nameOverride??e.generatedName;i.builder.addType(r,{name:c,schema:u.schema});let d=nau({type:c,fileContainingReference:t,declarationFile:r,context:i});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:mR(e.availability)}:{}}}function nau({type:e,fileContainingReference:t,declarationFile:r,context:i}){if(r===t)return e;let n=i.builder.addImport({file:t,fileToImport:r});return n!=null?`${n}.${e}`:e}function FBE(e){return Ov._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 LBE(e){return Ov._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:()=>{}})}function ww_({typeReference:e,itemType:t}){return t.startsWith("optional<")?e:typeof e=="string"?`optional<${e}>`:{...e,type:`optional<${e.type}>`}}var v5;(function(e){e[e.Channel=0]="Channel",e[e.Endpoint=1]="Endpoint",e[e.Request=2]="Request",e[e.Webhook=3]="Webhook"})(v5||(v5={}));function Ami(e){switch(e.type){case"openapi":return{openapi:e.file};case"protobuf":return{proto:e.file};default:Ao(e)}}function Ew_({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a;switch(e.type){case"primitive":a=WBE(e);break;case"array":a=UBE({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"map":a=VBE({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"reference":a=HBE({schema:e,context:t,declarationFile:r,namespace:i});break;case"unknown":a=GBE(e.nameOverride,e.generatedName);break;case"optional":a=Mw_({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"nullable":a=$BE({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"enum":a=c5a(e,n);break;case"literal":a=QBE(e,e.nameOverride,e.generatedName);break;case"object":a=kSc({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;case"oneOf":a=eDc({schema:e.value,context:t,declarationFile:r,namespace:i,declarationDepth:n});break;default:Ao(e)}return a}function kSc({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a=t.isInState(v5.Request)&&t.respectReadonlySchemas&&(t.getEndpointMethod()==="POST"||t.getEndpointMethod()==="PUT"||t.getEndpointMethod()==="PATCH"),u=!1,c={},d=new Set;for(let g of e.properties){if(g.readonly&&(u=!0),a&&g.readonly)continue;if(Object.keys(g.conflict).length>0){if(Object.entries(g.conflict).every(([E,T])=>!T.differentSchema))continue;Object.entries(g.conflict).forEach(([E])=>{tDc({property:g.key,schemaId:E,context:t,namespace:i}).forEach(z=>{d.add(z)})})}let O=Xg({schema:g.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1}),m=g.audiences,P=g.nameOverride,D=mR(g.availability),A=XBE(g);c[g.key]=YBE({typeReference:O,audiences:m,name:P,availability:D,propertyAccess:A})}let s=new Set;for(let g of e.allOfPropertyConflicts)g.allOfSchemaIds.forEach(O=>d.add(O)),g.conflictingTypeSignatures&&s.add(g.propertyKey);let o=[];for(let g of e.allOf){let O=Aw_({schema:g.schema,context:t,namespace:i});if(O==null||d.has(g.schema)||d.has(O))continue;let m=Xg({schema:Ov.reference(g),context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});o.push(uq(m))}for(let g of d){let O=rDc(t,g,i);for(let m of O.properties)c[m.key]==null&&(s.has(m.key)&&(c[m.key]="unknown"),c[m.key]=Xg({schema:m.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1}));for(let m of O.allOf){if(d.has(m.schema))continue;let P=Xg({schema:Ov.reference(m),context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});o.push(uq(P))}}let l={docs:e.description??void 0,properties:Object.fromEntries(Object.entries(c).map(([g,O])=>KBE(g)?[g,typeof O=="string"?{type:O,name:`_${g}`}:{...O,name:`_${g}`}]:[g,O]))};o.length>0&&(l.extends=o),e.additionalProperties&&(l["extra-properties"]=!0),e.availability!=null&&(l.availability=mR(e.availability)),e.source!=null&&(l.source=Ami(e.source)),l.inline=iDc(e,n);let v=e.nameOverride??e.generatedName;return{name:u&&t.respectReadonlySchemas&&!a?`${v}Read`:v,schema:l}}function tDc({property:e,schemaId:t,context:r,namespace:i}){let n=r.getSchema(t,i);if(n==null)return[];if(n.type==="reference")return tDc({property:e,schemaId:n.schema,context:r,namespace:i});if(n.type==="object"){let{properties:a,allOf:u}=rDc(r,t,i),c=a.some(s=>s.key===e),d=[...u.flatMap(s=>tDc({property:e,context:r,schemaId:s.schema,namespace:i}))];if(c||d.length>0)return[t,...d]}return[]}function rDc(e,t,r){let i=e.getSchema(t,r);if(i==null)return{properties:[],allOf:[]};if(i.type==="object")return{properties:i.properties,allOf:i.allOf};if(i.type==="reference")return rDc(e,i.schema,r);throw new Error(`Cannot getAllProperties for a non-object schema. schemaId=${t}, type=${i.type}`)}function UBE({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:JSc({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:i,declarationDepth:n})}}function VBE({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:KSc({schema:e,fileContainingReference:r,declarationFile:r,context:t,namespace:i,declarationDepth:n})}}function WBE(e){let t=rau(e);if(typeof t=="string")return{name:e.nameOverride??e.generatedName,schema:t};let{default:r,...i}=t;return{name:e.nameOverride??e.generatedName,schema:{...i}}}function Dw_(e){return e.camel==null&&e.pascal==null&&e.screamingSnake==null&&e.snake==null}function c5a(e,t){let r={enum:e.values.map(a=>{let u=a.nameOverride??a.generatedName,c=a.value;if(u===c&&a.description==null&&(a.casing==null||Dw_(a.casing)))return u;let d={value:a.value};if(u!==c&&(d.name=u),a.description!=null&&(d.docs=a.description),a.casing!=null&&!Dw_(a.casing)){let s={},o=!1;a.casing.camel!=null&&(s.camel=a.casing.camel,o=!0),a.casing.screamingSnake!=null&&(s["screaming-snake"]=a.casing.screamingSnake,o=!0),a.casing.snake!=null&&(s.snake=a.casing.snake,o=!0),a.casing.pascal!=null&&(s.pascal=a.casing.pascal,o=!0),o&&(d.casing=s)}return d})};e.description!=null&&(r.docs=e.description),e.default!=null&&(r.default=e.default.value),r.inline=iDc(e,t);let i=new Set,n={...r,enum:[],source:e.source!=null?Ami(e.source):void 0};for(let a of r.enum){let u=typeof a=="string"?a:a.name??a.value;i.has(u.toLowerCase())||(n.enum.push(a),i.add(u.toLowerCase()))}return{name:e.nameOverride??e.generatedName,schema:n}}function HBE({schema:e,context:t,declarationFile:r,namespace:i}){return{name:e.nameOverride??e.generatedName,schema:QSc({schema:e,context:t,fileContainingReference:r,namespace:i})}}function $BE({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return t.respectNullableSchemas?{name:e.nameOverride??e.generatedName,schema:YSc({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:i,declarationDepth:n})}:Mw_({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n})}function Mw_({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){return{name:e.nameOverride??e.generatedName,schema:iau({schema:e,context:t,fileContainingReference:r,declarationFile:r,namespace:i,declarationDepth:n})}}function GBE(e,t){return{name:e??t,schema:XSc()}}function QBE(e,t,r){return{name:t??r,schema:ZSc(e)}}function eDc({schema:e,context:t,declarationFile:r,namespace:i,declarationDepth:n}){let a=e.encoding!=null?tau(e.encoding):void 0;if(e.type==="discriminated"){let c={};for(let s of e.commonProperties)c[s.key]=Xg({schema:s.schema,fileContainingReference:r,context:t,namespace:i,declarationDepth:n+1});let d={};for(let[s,o]of Object.entries(e.schemas))d[s]=Xg({schema:o,context:t,fileContainingReference:r,namespace:i,declarationDepth:n+1});return{name:e.nameOverride??e.generatedName,schema:{discriminant:e.discriminantProperty,"base-properties":c,docs:e.description??void 0,availability:e.availability!=null?mR(e.availability):void 0,union:d,encoding:a,source:e.source!=null?Ami(e.source):void 0}}}let u=[];for(let c of e.schemas)u.push(Xg({schema:c,fileContainingReference:r,context:t,namespace:i,declarationDepth:n+1}));return{name:e.nameOverride??e.generatedName,schema:{discriminated:!1,docs:e.description??void 0,union:u,encoding:a,source:e.source!=null?Ami(e.source):void 0,inline:iDc(e,n)}}}var JBE=/^[0-9]/;function KBE(e){return JBE.test(e)}function Aw_({schema:e,context:t,namespace:r}){let i=t.getSchema(e,r);if(i!=null)return i.type==="reference"?Aw_({context:t,schema:i.schema,namespace:r}):e}function YBE({typeReference:e,audiences:t,name:r,availability:i,propertyAccess:n}){return t.length===0&&r==null&&i==null&&n==null?e:{...typeof e=="string"?{type:e}:{...e},...t.length>0?{audiences:t}:{},...r!=null?{name:r}:{},...i!=null?{availability:i}:{},...n!=null?{access:n}:{}}}function iDc(e,t){return e.inline===!0||t>0?!0:void 0}function XBE(e){if(!(e.readonly&&e.writeonly)){if(e.readonly)return ZN.ObjectPropertyAccess.ReadOnly;if(e.writeonly)return ZN.ObjectPropertyAccess.WriteOnly}}function qw_(e){let t=e.replace(/^x-|^X-/,"");return R_(t)}var Tw_="BasicAuthScheme",aau="BearerAuthScheme";function Cw_(e){if(e.authOverrides!=null){for(let[r,i]of Object.entries(e.authOverrides["auth-schemes"]??{}))e.builder.addAuthScheme({name:r,schema:i});e.authOverrides.auth!=null&&e.builder.setAuth(e.authOverrides.auth);return}let t=!1;for(let[r,i]of Object.entries(e.ir.securitySchemes))if(i.type==="basic"){let n={scheme:"basic"};i.usernameVariableName!=null&&(n.username===void 0?n.username={name:i.usernameVariableName}:n.username.name=i.usernameVariableName),i.usernameEnvVar!=null&&(n.username===void 0?n.username={env:i.usernameEnvVar}:n.username.env=i.usernameEnvVar),i.passwordVariableName!=null&&(n.password===void 0?n.password={name:i.passwordVariableName}:n.password.name=i.passwordVariableName),i.passwordEnvVar!=null&&(n.password===void 0?n.password={env:i.passwordEnvVar}:n.password.env=i.passwordEnvVar),e.builder.addAuthScheme({name:Tw_,schema:n}),t||(e.builder.setAuth(Tw_),t=!0)}else if(i.type==="bearer"){let n={scheme:"bearer"};i.tokenVariableName!=null&&(n.token===void 0?n.token={name:i.tokenVariableName}:n.token.name=i.tokenVariableName),i.tokenEnvVar!=null&&(n.token===void 0?n.token={env:i.tokenEnvVar}:n.token.env=i.tokenEnvVar),e.builder.addAuthScheme({name:aau,schema:n}),t||(e.builder.setAuth(aau),t=!0)}else if(i.type==="header")if(t)e.builder.addGlobalHeader({name:i.headerName,schema:{type:"string",name:i.headerVariableName??qw_(i.headerName),env:i.headerEnvVar}});else{let n={header:i.headerName,name:i.headerVariableName??"apiKey",type:"string"};i.headerEnvVar!=null&&(n.env=i.headerEnvVar),i.prefix!=null&&(n.prefix=i.prefix),e.builder.addAuthScheme({name:r,schema:n}),e.builder.setAuth(r),t=!0}else if(i.type==="oauth"){let n={scheme:"bearer"};e.builder.addAuthScheme({name:aau,schema:n}),t||(e.builder.setAuth(aau),t=!0),i.scopesEnum!=null&&i.scopesEnum.values.length>0&&e.builder.addType(wy.of("__package__.yml"),{name:"OauthScope",schema:c5a(i.scopesEnum,0).schema})}}function nor({header:e,context:t,fileContainingReference:r,namespace:i}){let n=Xg({schema:e.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),a=uq(n),u=e.name.replace(/^x-|^X-/,""),c=e.parameterNameOverride!=null?e.parameterNameOverride:R_(u);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=mR(e.availability)),d}function oau({pathParameter:e,context:t,fileContainingReference:r,namespace:i}){let n=Xg({schema:e.schema,context:t,fileContainingReference:r,namespace:i,declarationDepth:0});if(e.variableReference==null&&e.description==null&&e.availability==null)return uq(n);let a=e.variableReference!=null?{variable:`$${e.variableReference}`}:{type:uq(n)};return e.description!=null&&(a.docs=e.description),e.availability!=null&&(a.availability=mR(e.availability)),a}function sau({queryParameter:e,context:t,fileContainingReference:r,namespace:i}){let n=nDc({schema:e.schema,context:t,fileContainingReference:r,namespace:i});if(n==null)return;let a=uq(n.value),u=s5a(n.value);a==="unknown"?a="string":a==="optional<unknown>"&&(a="optional<string>");let c={type:a};return u!=null&&(c.default=u),n.allowMultiple&&(c["allow-multiple"]=!0),e.description!=null&&(c.docs=e.description),e.parameterNameOverride!=null&&(c.name=e.parameterNameOverride),e.availability!=null&&(c.availability=mR(e.availability)),ZBE(n.value)&&n.value.validation!==void 0&&(c.validation=n.value.validation),c.default==null&&c["allow-multiple"]==null&&c.docs==null&&c.name==null&&c.availability==null&&c.validation==null?a:c}function nDc({schema:e,context:t,fileContainingReference:r,namespace:i}){if(e.type==="reference"){let n=t.getSchema(e.schema,i);if(n==null)return;if(n.type==="array")return{value:Xg({schema:Ov.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:n.value,description:e.description??n.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:void 0}),context:t,declarationFile:wy.of(SS),fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(n.type==="oneOf"&&n.value.type==="undiscriminated"){let a=[],u=!1;for(let[c,d]of Object.entries(n.value.schemas))d.type==="primitive"&&d.schema.type==="string"&&(u=!0),d.type==="literal"&&d.value.type==="string"&&(NJn.test(d.value.value)?a.push(d.value.value):a.push({value:d.value.value,name:FJn(d.value.value)}));if(a.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:a}}),u&&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(n.value.schemas.length===2){let[c,d]=n.value.schemas;if(c!=null&&d!=null&&uau({array:c,primitive:d}))return{value:Xg({schema:Ov.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:i,declarationDepth:0}),allowMultiple:!0};if(c!=null&&d!=null&&uau({array:c,primitive:d}))return{value:Xg({schema:Ov.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:i,declarationDepth:0}),allowMultiple:!0}}for(let[c,d]of Object.entries(n.value.schemas))return nDc({schema:d,context:t,fileContainingReference:r,namespace:i})}else if(t.objectQueryParameters)return{value:Xg({schema:e,context:t,fileContainingReference:r,declarationFile:wy.of(SS),namespace:i,declarationDepth:0}),allowMultiple:!1}}if(e.type==="optional"||e.type==="nullable"){if(e.value.type==="reference"){let n=t.getSchema(e.value.schema,i);if(n==null)return;if(n.type==="array")return{value:Xg({schema:Ov.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:n.value,description:e.description??n.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,declarationFile:wy.of(SS),namespace:i,declarationDepth:0}),allowMultiple:!0};if(t.objectQueryParameters)return{value:Xg({schema:e,context:t,fileContainingReference:r,declarationFile:wy.of(SS),namespace:i,declarationDepth:0}),allowMultiple:!1}}if(e.value.type==="array")return{value:Xg({schema:Ov.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:e.value.value,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(e.value.type==="oneOf"&&e.value.value.type==="undiscriminated"){let n=[],a=!1;for(let[u,c]of Object.entries(e.value.value.schemas))c.type==="primitive"&&c.schema.type==="string"&&(a=!0),c.type==="literal"&&c.value.type==="string"&&(NJn.test(c.value.value)?n.push(c.value.value):n.push({value:c.value.value,name:FJn(c.value.value)}));if(n.length>0)return t.builder.addType(r,{name:e.generatedName,schema:{enum:n}}),a&&t.respectForwardCompatibleEnums?(t.builder.addType(r,{name:`${e.generatedName}OrString`,schema:{discriminated:!1,union:[{type:"string"},{type:`optional<${e.value.value.generatedName}>`}]}}),{value:`optional<${e.value.value.generatedName}OrString>`,allowMultiple:!1}):{value:`optional<${e.value.value.generatedName}>`,allowMultiple:!1};if(e.value.value.schemas.length===2){let[u,c]=e.value.value.schemas;if(u!=null&&c!=null&&uau({array:u,primitive:c}))return{value:Xg({schema:Ov.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0};if(u!=null&&c!=null&&uau({array:c,primitive:u}))return{value:Xg({schema:Ov.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:u,description:e.description,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!0}}if(t.objectQueryParameters)return{value:Xg({schema:e,context:t,fileContainingReference:r,declarationFile:wy.of(SS),namespace:i,declarationDepth:0}),allowMultiple:!1};for(let[u,c]of Object.entries(e.value.value.schemas))return nDc({schema:Ov.optional({nameOverride:e.nameOverride,generatedName:e.generatedName,title:e.title,value:c,description:void 0,availability:e.availability,namespace:void 0,groupName:void 0,inline:e.inline}),context:t,fileContainingReference:r,namespace:i})}else if(e.value.type==="object")return t.objectQueryParameters?{value:Xg({schema:e,context:t,fileContainingReference:r,declarationFile:wy.of(SS),namespace:i,declarationDepth:0}),allowMultiple:!1}:void 0;return{value:Xg({schema:e,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!1}}return e.type==="array"?{value:Xg({schema:Ov.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:i,declarationDepth:0}),allowMultiple:!0}:{value:Xg({schema:e,context:t,fileContainingReference:r,namespace:i,declarationDepth:0}),allowMultiple:!1}}function uau({array:e,primitive:t}){return e?.type==="array"&&e.value.type==="primitive"&&t?.type==="primitive"&&e.value.schema.type===t.schema.type}function ZBE(e){return e.type!=null}function Bw_({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"]=kBE(e.queryParameters)),e.headers!=null&&e.headers.length>0&&(r.headers=eIE({context:t,namedFullExamples:e.headers}));for(let i of e.messages){let n=v3i(i.payload);n!=null&&r.messages.push({type:i.messageType,body:n})}return r}function kBE(e){let t={};return e.forEach(r=>{let i=v3i(r.value);Array.isArray(i)?t[r.name]=i[0]:i!=null&&(t[r.name]=i)}),t}function eIE({context:e,namedFullExamples:t}){let r=e.builder.getGlobalHeaderNames(),i={};return t.forEach(n=>{let a=v3i(n.value);r.has(n.name)||a!=null&&(i[n.name]=a)}),i}function v3i(e){switch(e.type){case"primitive":return Iw_(e.value);case"object":return zw_(e.properties);case"array":return tIE(e.value);case"map":return rIE(e.value);case"oneOf":return iIE(e.value);case"enum":return e.value;case"literal":return nIE(e.value);case"unknown":return v3i(e.value);default:Ao(e)}}function Iw_(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:Ao(e)}}function zw_(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,v3i(r)]))}function tIE(e){return e.map(t=>v3i(t))}function rIE(e){return Object.fromEntries(e.map(t=>[Iw_(t.key),v3i(t.value)]))}function iIE(e){return e.type==="discriminated"?zw_(e.value):v3i(e.value)}function nIE(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Ao(e)}}function qmi(e){return e.find(t=>typeof t!="string"&&t.type==="namespace")?.name}function cau(e,t){return t??(e?.groupName!=null?qmi(e.groupName):void 0)}function xw_({channel:e,context:t,declarationFile:r}){let i={path:e.path,url:e.servers[0]?.name,auth:!1};e.audiences!=null&&e.audiences.length>0&&(i.audiences=e.audiences),e.summary!=null&&(i["display-name"]=e.summary),e.description!=null&&(i.docs=e.description);let n=qmi(e.groupName),a={};if(e.handshake.pathParameters.length>0)for(let d of e.handshake.pathParameters)a[d.name]=oau({pathParameter:d,context:t,fileContainingReference:r,namespace:n});Object.keys(a).length>0&&(i["path-parameters"]=a);let u={};if(e.handshake.queryParameters.length>0)for(let d of e.handshake.queryParameters){let s=sau({queryParameter:d,context:t,fileContainingReference:r,namespace:n});s!=null&&(u[d.name]=s)}Object.keys(u).length>0&&(i["query-parameters"]=u);let c={};if(e.handshake.headers.length>0)for(let d of e.handshake.headers){let s=nor({header:d,context:t,fileContainingReference:r,namespace:n});c[d.name]=s}Object.keys(c).length>0&&(i.headers=c),t.builder.addChannel(r,{channel:i});for(let d of e.messages)t.builder.addChannelMessage(r,{messageId:d.name,message:{origin:d.origin,body:Xg({schema:d.body,context:t,fileContainingReference:r,namespace:n,declarationDepth:0})}});for(let d of e.examples){let s=Bw_({context:t,websocketExample:d});t.builder.addChannelExample(r,{example:s})}}function Rw_(e){return typeof e=="object"&&e!==null&&"type"in e&&e.type==="grouped"}var Tmi="Base",aIE="Default";function vnn(e){return Object.entries(e).reduce((t,[r,i])=>(WAe(i)?Object.entries(i.urls).forEach(([n,a])=>{t[n]=a}):t[r]=typeof i=="string"?i:i.url,t),{})}function Nw_(e){if(e.environmentOverrides!=null){for(let[D,A]of Object.entries(e.environmentOverrides.environments??{}))e.builder.addEnvironment({name:D,schema:A});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=[],i=e.ir.servers.some(D=>Rw_(D)),n=e.ir.servers;for(let D of n)if(Rw_(D)){let A={urls:{}};for(let[M,E]of Object.entries(D.urls))A.urls[M]=E.url;D.name&&(t[D.name]=A)}else if("url"in D&&D.url){let A=D.audiences?{url:D.url,audiences:D.audiences}:D.url;if(D.name==null){r.push(A);continue}t[D.name]=A}let a={},u={},c=[];for(let D of e.ir.endpoints)for(let A of D.servers){if(A.url==null&&A.name!=null){a[A.name]||(a[A.name]=[]);continue}if(A.url==null)continue;let M=A.audiences?{url:A.url,audiences:A.audiences}:A.url;if(A.name==null){c.push(M);continue}a[A.name]||(a[A.name]=[]),a[A.name]?.push({url:A.url,audiences:A.audiences}),u[A.name]=M}let d={},s=[];for(let D of e.ir.websocketServers){let A=D.audiences?{url:D.url,audiences:D.audiences}:D.url;if(D.name==null){s.push(A);continue}d[D.name]=A}let o=Object.keys(t).length,l=o>0,v=Object.keys(u).length>0,g=Object.keys(a).some(D=>a[D]?.length===0),O=Object.keys(d).length>0;if(!l&&!v&&O&&e.ir.servers.length===0){for(let[D,A]of Object.entries(d))e.builder.addEnvironment({name:D,schema:A});e.builder.setDefaultEnvironment(Object.keys(d)[0]),e.builder.setDefaultUrl(Tmi);return}if(c.length>0&&e.logger.error(`Skipping endpoint level servers ${c.map(D=>typeof D=="string"?D:D.url).join(", ")} because x-fern-server-name was not provided.`),!l){let D=e.ir.servers[0]?.url,A=e.ir.servers[0]?.audiences;if(D!=null){let M=A?{url:D,audiences:A}:D;t[aIE]=M}}let m=Object.values(t).map(D=>typeof D=="string"?D:WAe(D)?Object.values(D.urls)[0]:D.url),P=r.filter(D=>{let A=typeof D=="string"?D:D.url;return!m.includes(A)});if(P.length>0&&e.logger.error(`Skipping top level servers ${P.map(D=>typeof D=="string"?D:D.url).join(", ")} because x-fern-server-name was not provided.`),i){let D=!0;for(let[A,M]of Object.entries(t))if(e.builder.addEnvironment({name:A,schema:M}),D){if(e.builder.setDefaultEnvironment(A),WAe(M)){let E=Object.keys(M.urls)[0];E&&e.builder.setDefaultUrl(E)}D=!1}return}if(!v&&!g){let D=!0;for(let[A,M]of Object.entries(t))if(D){if(O){let E=typeof M=="string"?M:WAe(M)?Object.values(M.urls)[0]:M.url;e.builder.addEnvironment({name:A,schema:{urls:{[Tmi]:E??"",...vnn(d)}}})}else e.builder.addEnvironment({name:A,schema:M});e.builder.setDefaultEnvironment(A),D=!1}else if(O){let E=typeof M=="string"?M:WAe(M)?Object.values(M.urls)[0]:M.url;e.builder.addEnvironment({name:A,schema:{urls:{[Tmi]:E??"",...vnn(d)}}})}else e.builder.addEnvironment({name:A,schema:M});O&&e.builder.setDefaultUrl(Tmi)}else if(o===1){let D=Object.keys(t)[0],A=Object.values(t)[0],M=typeof A=="string"?A:WAe(A)?Object.values(A.urls)[0]:A.url;e.builder.addEnvironment({name:D,schema:{urls:{[Tmi]:M??"",...vnn(u),...vnn(d)}}}),e.builder.setDefaultEnvironment(D),e.builder.setDefaultUrl(Tmi)}else{let D=new Map;for(let A of e.ir.endpoints)for(let M of A.servers)if(M.url!=null&&M.name!=null){D.has(M.name)||D.set(M.name,new Map);let E=M.url.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",T=D.get(M.name);T&&T.set(E,M.url)}if(D.size>0){let A=!0;for(let[M,E]of Object.entries(t)){let T=typeof E=="string"?E:WAe(E)?Object.values(E.urls)[0]:E.url;if(!T)continue;let z=T.match(/[-]([a-z0-9]+)\./i)?.[1]?.toLowerCase()||"production",$={[Tmi]:T};for(let[I,R]of D.entries()){let U=R.get(z)||R.get("production")||R.values().next().value;U&&($[I]=U)}O&&Object.assign($,vnn(d)),Object.keys($).length>1?e.builder.addEnvironment({name:M,schema:{urls:$}}):e.builder.addEnvironment({name:M,schema:T}),A&&(e.builder.setDefaultEnvironment(M),A=!1)}D.size>0&&e.builder.setDefaultUrl(Tmi)}else{let A=!0;for(let[M,E]of Object.entries(t)){if(O||Object.keys(u).length>0){let T=typeof E=="string"?E:WAe(E)?Object.values(E.urls)[0]:E.url;e.builder.addEnvironment({name:M,schema:{urls:{[Tmi]:T??"",...vnn(u),...vnn(d)}}})}else e.builder.addEnvironment({name:M,schema:E});A&&(e.builder.setDefaultEnvironment(M),A=!1)}}}}function lau(e){return uq(e).startsWith("optional")?e:typeof e=="string"?`optional<${e}>`:{...e,type:`optional<${e.type}>`}}var aDc=class{schema;count=0;constructor(t){this.schema=t}increment(){this.count+=1}},oIE=.75,uIE=new Set("authorization");function Fw_(e){if(e.globalHeaderOverrides!=null){for(let[r,i]of Object.entries(e.globalHeaderOverrides.headers??{}))e.builder.addGlobalHeader({name:r,schema:i});return}let t=Object.fromEntries((e.ir.globalHeaders??[]).map(r=>[r.header,r]));for(let[r,i]of Object.entries(t)){let n="optional<string>";if(i.name==null&&i.env==null&&typeof i.schema=="string")n=i.schema;else if(i!=null){let a=i.schema?LJn(i.schema):void 0,u=a!=null?qmi(a):void 0,c=wy.of("api.yml");n={name:i.name,env:i.env,type:i.schema!=null?uq(Xg({schema:i.schema,context:e,fileContainingReference:u?GN(wy.of(R_(u)),c):c,namespace:u,declarationDepth:0}))??"optional<string>":"optional<string>"}}e.builder.addGlobalHeader({name:r,schema:n})}if(e.detectGlobalHeaders){let r={};for(let n of e.ir.endpoints)for(let a of n.headers){if(uIE.has(a.name.toLowerCase()))continue;let u=r[a.name];if(u==null){let c=t[a.name],d=nor({header:{...a,schema:c?.schema??a.schema,name:c?.name??a.name},fileContainingReference:wy.of(i6),context:e,namespace:void 0});u=new aDc(d),r[a.name]=u}u.increment()}let i=e.ir.endpoints.length*oIE;for(let[n,a]of Object.entries(r)){let u=t[n],c=a.count===e.ir.endpoints.length,d=a.count>=i;u==null&&(c?e.builder.addGlobalHeader({name:n,schema:a.schema}):d&&e.builder.addGlobalHeader({name:n,schema:lau(a.schema)}))}}}function Lw_(e){for(let t of e.ir.idempotencyHeaders??[]){let r=t.schema?LJn(t.schema):void 0,i=r!=null?qmi(r):void 0,n=nor({header:{...t,schema:t.schema??Ov.primitive({description:void 0,availability:void 0,generatedName:"",title:void 0,namespace:void 0,groupName:void 0,nameOverride:void 0,schema:xw.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:wy.of(i6),context:e,namespace:i});e.builder.addIdempotencyHeader({name:t.header,schema:lau(n)})}}function BK(e){switch(e.type){case"primitive":return Vw_(e.value);case"object":return Ww_(e.properties);case"array":return Hw_(e.value);case"map":return cIE(e.value);case"oneOf":return lIE(e.value);case"enum":return typeof e.value=="string"&&e.value.startsWith("$")?`\\${e.value}`:e.value;case"literal":return fIE(e.value);case"unknown":return BK(e.value);default:Ao(e)}}function Uw_(e){switch(e.type){case"withStreaming":return e.sse?{stream:sIE(e.events)}:{stream:Hw_(e.events)};case"withoutStreaming":return{body:BK(e.value)};default:Ao(e)}}function Vw_(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:Ao(e)}}function Ww_(e){return Object.fromEntries(Object.entries(e).map(([t,r])=>[t,BK(r)]))}function sIE(e){return e.map(t=>({event:"",data:BK(t)}))}function Hw_(e){return e.map(t=>BK(t))}function cIE(e){return Object.fromEntries(e.map(t=>[Vw_(t.key),BK(t.value)]))}function lIE(e){return e.type==="discriminated"?Ww_(e.value):BK(e.value)}function fIE(e){switch(e.type){case"string":return e.value;case"boolean":return e.value;default:Ao(e)}}function $w_({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"]=dIE(e.pathParameters)),e.queryParameters!=null&&e.queryParameters.length>0&&(r["query-parameters"]=pIE(e.queryParameters));let i=e.headers!=null&&e.headers.length>0,n=t.builder.getGlobalHeaders(),a=Object.keys(n).length>0,u=new Set(e.headers?.map(c=>c.name)??[]);if(i||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(n))if(!u.has(d))if(s!=null&&typeof s=="object"&&s.type!=null){let o=v6({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:$o}});o!=null&&c.push({name:d,value:Yg.literal(a3i.string(o))})}else c.push({name:d,value:Yg.primitive(D_.string(d))});r.headers=_IE({context:t,namedFullExamples:c})}return e.request!=null&&(r.request=BK(e.request)),e.response!=null&&(r.response=Uw_(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(yy)),r}function dIE(e){let t={};return e.forEach(r=>{let i=BK(r.value);i!=null&&(t[r.parameterNameOverride??r.name]=i)}),t}function pIE(e){let t={};return e.forEach(r=>{let i=BK(r.value);Array.isArray(i)?t[r.name]=i[0]:i!=null&&(t[r.name]=i)}),t}function _IE({context:e,namedFullExamples:t}){let r={};return t.forEach(i=>{let n=BK(i.value);n!=null&&(r[i.name]=n)}),r}function Gw_(e){return g$._visit(e,{get:()=>ZN.HttpMethodSchema.Get,post:()=>ZN.HttpMethodSchema.Post,put:()=>ZN.HttpMethodSchema.Put,patch:()=>ZN.HttpMethodSchema.Patch,delete:()=>ZN.HttpMethodSchema.Delete,head:()=>ZN.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 Qw_(e){return e==="POST"||e==="PUT"||e==="PATCH"}function Jw_({endpoint:e,declarationFile:t,context:r}){let{nonRequestReferencedSchemas:i}=r.ir,n=[],a=new Set,u=e.path,c=cau(e.sdkName,e.namespace),d={};for(let P of e.pathParameters)P.parameterNameOverride&&(u=u.replace(P.name,P.parameterNameOverride)),d[P.parameterNameOverride??P.name]=oau({pathParameter:P,context:r,fileContainingReference:t,namespace:c}),a.add(P.name);let s={};for(let P of e.queryParameters){let D=sau({queryParameter:P,context:r,fileContainingReference:t,namespace:c});D!=null&&(s[P.name]=D,a.add(P.name))}let o;if(e.pagination!=null)switch(e.pagination.type){case"cursor":o={cursor:e.pagination.cursor,next_cursor:e.pagination.nextCursor,results:e.pagination.results};break;case"offset":o={offset:e.pagination.offset,step:e.pagination.step,results:e.pagination.results,"has-next-page":e.pagination.hasNextPage};break;case"custom":o={type:"custom",results:e.pagination.results};break;default:Ao(e.pagination)}let l={path:u,method:Gw_(e.method),auth:e.authed,docs:e.description??void 0,pagination:o,source:e.source!=null?Ami(e.source):void 0};!vIE({context:r,request:e.request})&&Object.keys(d).length>0&&(l["path-parameters"]=d),e.summary!=null&&(l["display-name"]=e.summary);let v={},g=r.builder.getGlobalHeaderNames(),O=r.builder.getAuthHeaderName();O!=null&&g.add(O);let m=e.headers.filter(P=>!g.has(P.name));for(let P of m){let D=nor({header:P,context:r,fileContainingReference:t,namespace:c});v[P.name]=D,a.add(typeof D=="string"?P.name:D.name??P.name)}if(e.request!=null){r.setInState(v5.Request);let P=yIE({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(i),headers:Object.keys(v).length>0?v:void 0,usedNames:a,namespace:c});l.request=P.value,n=[...n,...P.schemaIdsToExclude??[]],r.unsetInState(v5.Request)}else{let P=r.inlinePathParameters&&Object.keys(d).length>0,D=Object.keys(s).length>0,A=Object.keys(v).length>0,M={};(P||D||A)&&(M.name=e.requestNameOverride??e.generatedRequestName),P&&(M["path-parameters"]=d),D&&(M["query-parameters"]=s),A&&(M.headers=v),Object.keys(M).length>0&&(l.request=M)}if(e.response!=null&&e.response._visit({json:P=>{let D=Xg({schema:P.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l.response={docs:P.description??void 0,type:uq(D)},P.statusCode!=null&&(l.response["status-code"]=P.statusCode),P.responseProperty!=null&&(l.response.property=P.responseProperty)},streamingJson:P=>{let D=Xg({schema:P.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:P.description??void 0,type:uq(D),format:"json"}},streamingSse:P=>{let D=Xg({schema:P.schema,context:r,fileContainingReference:t,namespace:c,declarationDepth:0});l["response-stream"]={docs:P.description??void 0,type:uq(D),format:"sse"}},file:P=>{l.response={docs:P.description??void 0,type:"file","status-code":P.statusCode}},bytes:P=>{l.response={docs:P.description??void 0,type:"bytes","status-code":P.statusCode}},streamingText:P=>{l["response-stream"]={docs:P.description??void 0,type:"text"}},text:P=>{l.response={docs:P.description??void 0,type:"text","status-code":P.statusCode}},_other:()=>{throw new Error("Unrecognized Response type: "+e.response?.type)}}),r.builder.getEnvironmentType()==="multi"){let P=r.getDefaultServerName(),D=e.servers[0];D==null?P!=null&&(l.url=P):l.url=D.name??void 0}return e.idempotent&&(l.idempotent=!0),e.availability!=null&&(l.availability=mR(e.availability)),Object.entries(e.errors).forEach(([P,D])=>{let A=D.generatedName,M=wy.of(SS);r.builder.enableUniqueErrorsPerEndpoint&&(A=`${e.generatedRequestName}${D.generatedName}`,D.schema!=null&&(D.schema.type!=="reference"&&D.schema.type!=="oneOf"?D.schema.generatedName=`${e.generatedRequestName}${D.schema.generatedName}`:D.schema.type==="oneOf"&&(D.schema.value.generatedName=`${e.generatedRequestName}${D.schema.value.generatedName}`)));let E={"status-code":parseInt(P)},T=jw_({location:Kw_,namespaceOverride:c});if(D.schema!=null){let I=Xg({schema:D.schema,context:r,fileContainingReference:T,declarationFile:T,namespace:c,declarationDepth:0});E.type=uq(I),E.docs=D.description}r.builder.addError(T,{name:A,schema:r.isErrorUnknownSchema(parseInt(P))?{...E,type:"unknown"}:E}),l.errors==null&&(l.errors=[]);let z=r.builder.addImport({file:t,fileToImport:T});l.errors.push(z!=null?`${z}.${A}`:A),E.type!=null&&D.examples?.forEach(I=>{let R={value:BK(I.example),name:I.name,docs:I.description};r.builder.addErrorExample(T,{name:A,example:R})})}),e.examples.length>0&&(l.examples=hIE({endpointExamples:e.examples,context:r})),r.ir.hasEndpointsMarkedInternal&&(e.internal==null||!e.internal)?l.audiences=[oDc,...e.audiences]:e.audiences.length>0&&(l.audiences=e.audiences),{value:l,schemaIdsToExclude:n}}function hIE({endpointExamples:e,context:t}){return e.map(r=>{try{return $w_({endpointExample:r,context:t})}catch(i){throw console.error(`Error building endpoint example: ${i}`),i}})}function yIE({endpoint:e,declarationFile:t,context:r,request:i,requestNameOverride:n,generatedRequestName:a,pathParameters:u,queryParameters:c,nonRequestReferencedSchemas:d,headers:s,usedNames:o,namespace:l}){if(i.type==="json"||i.type==="formUrlEncoded"){let v=i.schema.type==="reference"?i.schema.schema:void 0,g=i.schema.type==="reference"?r.getSchema(i.schema.schema,l):i.schema;if(g?.type!=="object"||v!=null&&d.includes(v)){let A=Xg({schema:i.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:0}),M={schemaIdsToExclude:[],value:{body:A}},E=Object.keys(u??{}).length>0,T=Object.keys(c??{}).length>0,z=Object.keys(s??{}).length>0;return E&&(M.value["path-parameters"]=u),T&&(M.value["query-parameters"]=c),z&&(M.value.headers=s),(E||T||z)&&(M.value.name=n??a),i.contentType!=null&&(M.value["content-type"]=i.contentType),i.description!=null&&(M.value.docs=i.description),M}let O=Object.fromEntries(g.properties.filter(A=>A.readonly==null?!0:!(Qw_(e.method)&&A.readonly)).map(A=>{let M=Xg({schema:A.schema,fileContainingReference:t,context:r,namespace:l,declarationDepth:1}),E=A.nameOverride??A.key,T=mR(A.availability);if(!o.has(E)&&A.audiences.length<=0)return o.add(E),A.nameOverride!=null?[A.key,{type:uq(M),docs:UJn(M),name:A.nameOverride,availability:T}]:[A.key,T?{...typeof M=="string"?{type:M}:M,availability:T}:M];let z={type:uq(M),docs:UJn(M)};return o.has(E)&&(z.name=A.generatedName),A.audiences.length>0&&(z.audiences=A.audiences),T!=null&&(z.availability=T),o.add(E),[A.key,z]})),m=g.allOf.map(A=>{let M=Xg({schema:Ov.reference(A),fileContainingReference:t,context:r,namespace:l,declarationDepth:0});return uq(M)}).filter(A=>A!=="unknown"),P={properties:O};m.length>0&&(P.extends=m),i.additionalProperties&&(P["extra-properties"]=!0);let D={name:n??g.nameOverride??g.generatedName,"path-parameters":u,"query-parameters":c,headers:s,body:P};return i.contentType!=null&&(D["content-type"]=i.contentType),i.description!=null&&(D.docs=i.description),{schemaIdsToExclude:v!=null?[v]:[],value:D}}else if(i.type==="octetStream"){let v={body:"bytes","content-type":i.contentType??Bq.APPLICATION_OCTET_STREAM,"query-parameters":c};return c!=null&&(v.name=n??a),i.description!=null&&(v.docs=i.description),{schemaIdsToExclude:[],value:v}}else if(i.type==="multipart"){let v=Object.fromEntries(i.properties.map(g=>{if(g.schema.type==="file"){let O=g.schema.isArray?"list<file>":"file";if(O=g.schema.isOptional?`optional<${O}>`:O,g.description!=null||g.contentType!=null){let m={type:O};if(g.description!=null&&(m.docs=g.description),g.contentType!=null){let P=g.contentType.split(",")[0];m["content-type"]=P}return[g.key,m]}return[g.key,O]}else{let O=Xg({schema:g.schema.value,fileContainingReference:t,context:r,namespace:l,declarationDepth:1});if(g.contentType||g.exploded||g.encoding){let m=typeof O=="string"?{type:O}:O;g.contentType!=null&&(m["content-type"]=g.contentType),g.encoding==="form"?m.style="form":g.encoding==="json"?m.style="json":g.exploded&&(m.style="exploded"),O=m}return[g.key,O]}}));return{schemaIdsToExclude:i.name==null?[]:[i.name],value:{name:n??i.name??a,"path-parameters":u,"query-parameters":c,headers:s,body:{properties:v},"content-type":Bq.MULTIPART_FORM_DATA,...i.description?{docs:i.description}:{}}}}else Ao(i)}function vIE({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:Ao(t)}}function bIE({location:e,namespaceOverride:t}){return t!=null?{...e,file:GN(wy.of(t),e.file)}:e}function gIE(e){let t=e.namespace,r=e.tags.filter(d=>d!==t)[0],i=e.operationId;if(i==null)return r!=null?{file:wy.of(`${R_(r)}.yml`),endpointId:e.summary!=null?R_(e.summary):R_(`${e.method}_${e.path.split("/").join("_")}`)}:e.summary!=null?{file:wy.of(SS),endpointId:R_(e.summary)}:{file:wy.of(SS),endpointId:R_(`${e.method}_${e.path.split("/").join("_")}`)};if(r==null)return{file:wy.of(SS),endpointId:i};let n=l5a(r),a=l5a(i);if(W8(n,a))return{file:wy.of("__package__.yml"),endpointId:r};let u=PIE({operationId:i,tag:r,path:e.path,method:e.method});if(u!=null)return u;let c=[];for(let d=0;d<n.length;++d){let s=n[d];if(s!=null&&s===a[d])c.push(s);else{let o=R_(r);return{file:wy.of(`${o}.yml`),endpointId:i,tag:r}}}if(c.length>=a.length)throw new Error(`Cannot get file for endpoint ${JSON.stringify(e)}`);return{file:wy.of(R_(c.join("_"))+".yml"),endpointId:R_(a.slice(c.length).join("_")),tag:r}}function f5a(e){let t=e.tags[0];if(e.sdkName!=null){let r=HSc({sdkName:e.sdkName,namespaceOverride:e.namespace}),i=`${r}.yml`,n=r.toLowerCase()===t?.toLowerCase().replaceAll(" ","");return{file:wy.of(i),endpointId:e.sdkName.methodName,tag:n?t:void 0}}return bIE({namespaceOverride:e.namespace,location:gIE(e)})}function l5a(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=w3e(t),t}var OIE=new RegExp("[^a-zA-Z0-9{}]+"),mIE=new RegExp("[{}]","g");function PIE({operationId:e,tag:t,path:r,method:i}){let a=`${r.split(OIE).join("_").replaceAll(mIE,"_")}_${i.toLowerCase()}`;if(e.endsWith(a))return{file:wy.of(R_(t)+".yml"),endpointId:R_(e.slice(0,-1*a.length)),tag:t}}function Yw_(e){let t=new Set,{endpoints:r,tags:i}=e.ir,n=[];for(let a of r){let{endpointId:u,file:c,tag:d}=f5a(a),s=c.split(".")[0];s!=null&&t.add(s);let o;if(a.sdkName!=null){let g=e.ir.groups;for(let O of a.sdkName.groupName){let m=typeof O=="string"?O:O.name,P=g[m];if(P==null)break;if(P.summary!=null||P.description!=null){o=g[m];break}}}let l=d==null?void 0:i.tagsById[d];e.setInState(v5.Endpoint),e.setEndpointMethod(a.method);let v=Jw_({context:e,endpoint:a,declarationFile:c});e.unsetEndpointMethod(),e.unsetInState(v5.Endpoint),n=[...n,...v.schemaIdsToExclude],e.builder.addEndpoint(c,{name:u,schema:v.value,source:a.source!=null?Ami(a.source):void 0}),(l?.id!=null||l?.description!=null)&&e.builder.setServiceInfo(c,{"display-name":o?.summary??l?.id,docs:o?.description??l?.description??void 0})}return{schemaIdsToExclude:n,sdkGroups:t}}function Xw_(e){for(let[t,r]of Object.entries(e.ir.variables)){let i=r.groupName!=null?qmi(r.groupName):void 0,n=Xg({schema:Ov.primitive(r),context:e,fileContainingReference:wy.of(SS),namespace:i,declarationDepth:0});e.builder.addVariable({name:t,schema:{type:uq(n),docs:r.description??void 0}})}}function Zw_(e){for(let t of e.ir.webhooks){let r=SIE({webhook:t,context:e});if(r==null)continue;let i=cau(t.sdkName,t.namespace),n={};for(let u of t.headers)n[u.name]=nor({header:u,context:e,fileContainingReference:r.file,namespace:i});let a={audiences:t.audiences,method:t.method,"display-name":t.summary??void 0,headers:n,payload:Xg({schema:t.payload,context:e,fileContainingReference:r.file,namespace:i,declarationDepth:0}),examples:t.examples!=null?t.examples.map(u=>({docs:u.description,name:u.name,payload:BK(u.payload)})):void 0};e.builder.addWebhook(r.file,{name:r.endpointId,schema:a}),t.description!=null&&(a.docs=t.description)}}function jIE({location:e,namespaceOverride:t}){if(e!=null)return t!=null?{...e,file:GN(wy.of(t),e.file)}:e}function wIE({webhook:e,context:t}){let r=e.tags[0],i=e.operationId;if(r==null)return{file:wy.of(SS),endpointId:i};let n=l5a(r),a=l5a(i);if(W8(n,a))return{file:wy.of("__package__.yml"),endpointId:r};let u=[];for(let c=0;c<n.length;++c){let d=n[c];if(d!=null&&d===a[c])u.push(d);else{let s=R_(r);return{file:wy.of(`${s}.yml`),endpointId:i,tag:r}}}if(u.length>=a.length){t.logger.warn(`Skipping webhook ${e.operationId} because couldn't compute file location`);return}return{file:wy.of(R_(u.join("_"))+".yml"),endpointId:R_(a.slice(u.length).join("_")),tag:r}}function SIE({webhook:e,context:t}){return e.sdkName!=null?{file:Pw_({sdkName:e.sdkName,namespaceOverride:e.namespace}),endpointId:e.sdkName.methodName}:jIE({namespaceOverride:e.namespace,location:wIE({webhook:e,context:t})})}var DIE=wy.of(SS);function e1_(e){switch(e.type){case"object":case"primitive":case"enum":case"array":case"map":case"reference":case"literal":case"optional":case"nullable":return kw_({namespace:e.namespace,groupName:e.groupName});case"oneOf":return kw_({namespace:e.value.namespace,groupName:e.value.groupName});case"unknown":return DIE;default:Ao(e)}}function kw_({namespace:e,groupName:t}){return e!=null&&t!=null?y3i([{type:"namespace",name:e},...t]):e!=null?y3i([{type:"namespace",name:e}]):y3i(t)}var oDc="external",Kw_=wy.of(SS);function t1_({schemas:e,schemaIdsToExclude:t,namespace:r,context:i}){for(let[n,a]of Object.entries(e)){if(t.includes(n))continue;let u=e1_(a),c=Ew_({schema:a,context:i,declarationFile:u,namespace:r,declarationDepth:0});if(tzi(c.schema)){let d=uq(c.schema);if(d===(c.name??n)||d===`optional<${c.name??n}>`||d===`optional<nullable<${c.name??n}>>`)continue}i.builder.addType(u,{name:c.name??n,schema:c.schema})}}function r1_(e){e.ir.apiVersion!=null&&e.builder.setApiVersion(e.ir.apiVersion),Nw_(e),Fw_(e),Lw_(e),Cw_(e),Xw_(e),e.ir.basePath!=null&&e.builder.setBasePath(e.ir.basePath),e.ir.hasEndpointsMarkedInternal&&e.builder.addAudience(oDc);let t=Yw_(e),r=t.sdkGroups;e.setInState(v5.Webhook),Zw_(e),e.unsetInState(v5.Webhook),e.setInState(v5.Channel);for(let n of Object.values(e.ir.channels)){let a=y3i(n.groupName);xw_({channel:n,context:e,declarationFile:a})}e.unsetInState(v5.Channel);let i=EIE({context:e,schemaIdsToExcludeFromServices:t.schemaIdsToExclude});t1_({schemas:e.ir.groupedSchemas.rootSchemas,schemaIdsToExclude:i,namespace:void 0,context:e});for(let[n,a]of Object.entries(e.ir.groupedSchemas.namespacedSchemas))t1_({schemas:a,schemaIdsToExclude:i,namespace:n,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 EIE({context:e,schemaIdsToExcludeFromServices:t}){let r=e.getReferencedSchemaIds();if(r==null)return t;let i=new Set([...Object.keys(e.ir.groupedSchemas.rootSchemas),...Object.values(e.ir.groupedSchemas.namespacedSchemas).flatMap(a=>Object.keys(a))]),n=new Set(t);for(let a of i)r.includes(a)||n.add(a);return Array.from(n)}var d5a=class{context;constructor(t){this.context=t}};var fau=class e{files={};directories={};getAllFiles(){let t={},r=(i,n)=>{for(let[u,c]of Object.entries(i.files)){let d=n!=null?wy.of(`${n}${"/"}${u}`):wy.of(u);t[d]=c}let a=Object.keys(i.directories).sort();for(let u of a){let c=n!=null?`${n}${"/"}${u}`:u,d=i.directories[u];r(d,c)}};return r(this),t}getOrCreateFile(t){return this.getOrCreateFileRecursive(t.split("/"))}getOrCreateFileRecursive(t){if(t.length===1)return this.files[wy.of(t[0])]??={};let[r,...i]=t;if(r==null)throw new Error(`Internal error; cannot add file with path: ${t}`);return this.directories[r]||(this.directories[r]=new e),this.directories[r].getOrCreateFileRecursive(i)}};var bnn=class{enableUniqueErrorsPerEndpoint;root;rootApiFile;packageMarkerFile={};basePath=void 0;constructor(t){this.enableUniqueErrorsPerEndpoint=t,this.root=new fau,this.rootApiFile={name:"api","error-discrimination":{strategy:"status-code"}}}setDisplayName({displayName:t}){this.rootApiFile["display-name"]=t}addNavigation({navigation:t}){this.packageMarkerFile.navigation=t}setServiceInfo(t,{auth:r,"base-path":i,"display-name":n,docs:a}){let u=this.getOrCreateFile(t);u.service==null&&(u.service={auth:!1,"base-path":"",endpoints:{}}),r!=null&&(u.service.auth=r),i!=null&&(u.service["base-path"]=i),n!=null&&(u.service["display-name"]=n),a!=null&&(u.docs=a)}addAudience(t){this.rootApiFile.audiences==null&&(this.rootApiFile.audiences=[]),this.rootApiFile.audiences.push(t)}setAuth(t){this.rootApiFile.auth=t}addAuthScheme({name:t,schema:r}){this.rootApiFile["auth-schemes"]==null&&(this.rootApiFile["auth-schemes"]={}),this.rootApiFile["auth-schemes"][t]==null&&(this.rootApiFile["auth-schemes"][t]=r)}setDefaultEnvironment(t){this.rootApiFile["default-environment"]=t}setDefaultUrl(t){this.rootApiFile["default-url"]=t}setBasePath(t){this.basePath=t}setApiVersion(t){this.rootApiFile.version=t}getEnvironmentType(){let t=Object.entries(this.rootApiFile.environments??{})[0];if(t!=null)return lir(t[1],{singleBaseUrl:()=>"single",multipleBaseUrls:()=>"multi"})}addEnvironment({name:t,schema:r}){this.rootApiFile.environments==null&&(this.rootApiFile.environments={}),this.rootApiFile.environments[t]=r}getGlobalHeaderNames(){let t=Object.keys(this.rootApiFile.headers??{});if(this.rootApiFile["auth-schemes"]!=null)for(let i of Object.values(this.rootApiFile["auth-schemes"]))i1_(i)&&t.push(i.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(i1_(t))return t.header;return"Authorization"}}addGlobalHeader({name:t,schema:r}){let i=this.getVersionHeader();i!=null&&i===t||(this.rootApiFile.headers==null&&(this.rootApiFile.headers={}),this.rootApiFile.headers[t]=r)}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:i}){if(t===r)return;let n=i??R_((R3e(r)+"/"+HZi(r,{stripExtension:!0})).replaceAll("__package__","root"));if(t===wy.of(i6))return this.rootApiFile.imports==null&&(this.rootApiFile.imports={}),this.rootApiFile.imports[n]=fBo(R3e(K8n.of(`/${t}`)),K8n.of(`/${r}`)),n;let a=this.getOrCreateFile(t);return a.imports==null&&(a.imports={}),a.imports[n]=fBo(R3e(K8n.of(`/${t}`)),K8n.of(`/${r}`)),n}addType(t,{name:r,schema:i}){if(t===wy.of(i6))return;let n=this.getOrCreateFile(t);n.types==null&&(n.types={}),n.types[r]=i}addTypeExample(t,r,i){let n=this.getOrCreateFile(t);n.types==null&&(n.types={});let a=n.types[r];a!=null&&(typeof a=="string"?n.types[r]={type:a,examples:[i]}:(a.examples==null&&(a.examples=[]),a.examples.push(i)))}addError(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.errors==null&&(n.errors={}),n.errors[r]==null?n.errors[r]=i:n.errors[r]?.type!==i.type&&(n.errors[r]={"status-code":i["status-code"],type:"unknown"})}addErrorExample(t,{name:r,example:i}){let n=this.getOrCreateFile(t);if(n.errors==null)return;let a=n.errors[r];if(a==null)return;a.examples==null&&(a.examples=[]),(a.examples.some(c=>W8(c,i))??!1)||a.examples?.push(i)}addEndpoint(t,{name:r,schema:i,source:n}){let a=this.getOrCreateFile(t);a.service==null&&(a.service={auth:!1,"base-path":"",endpoints:{}}),n!=null&&(a.service.source=n),a.service.endpoints[r]=i}addWebhook(t,{name:r,schema:i}){let n=this.getOrCreateFile(t);n.webhooks==null&&(n.webhooks={}),n.webhooks[r]=i}addChannel(t,{channel:r}){let i=this.getOrCreateFile(t);i.channel=r;let n=this.basePath;n!=null&&(i.channel.path=GN(n,r.path))}addChannelExample(t,{example:r}){let i=this.getOrCreateFile(t);i.channel==null&&(i.channel={path:"",auth:!1}),i.channel.messages==null&&(i.channel.messages={}),i.channel.examples==null&&(i.channel.examples=[]),i.channel.examples.push(r)}addChannelMessage(t,{messageId:r,message:i}){let n=this.getOrCreateFile(t);n.channel==null&&(n.channel={path:"",auth:!1}),n.channel.messages==null&&(n.channel.messages={}),n.channel.messages[r]=i}build(){let t=this.root.getAllFiles(),r=this.basePath;if(r!=null){this.packageMarkerFile.service!=null&&(this.packageMarkerFile.service={...this.packageMarkerFile.service,endpoints:Object.fromEntries(Object.entries(this.packageMarkerFile.service.endpoints).map(([n,a])=>[n,{...a,path:GN(r,a.path)}]))});for(let n of Object.values(t))n.service!=null&&(n.service={...n.service,endpoints:Object.fromEntries(Object.entries(n.service.endpoints).map(([a,u])=>[a,{...u,path:GN(r,u.path)}]))})}return{rootApiFile:this.rootApiFile,packageMarkerFile:this.packageMarkerFile,definitionFiles:t}}getOrCreateFile(t){return t===SS?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 i1_(e){return e?.header!=null}var dau=class{logger;taskContext;ir;builder;environmentOverrides;authOverrides;globalHeaderOverrides;detectGlobalHeaders;objectQueryParameters;respectReadonlySchemas;respectNullableSchemas;onlyIncludeReferencedSchemas;inlinePathParameters;useBytesForBinaryResponse;respectForwardCompatibleEnums;enableUniqueErrorsPerEndpoint;defaultServerName=void 0;unknownSchema=new Set;referencedSchemaIds;endpointMethod;state=new Set;constructor({taskContext:t,ir:r,options:i,environmentOverrides:n,globalHeaderOverrides:a,authOverrides:u}){this.logger=t.logger,this.taskContext=t,this.ir=r,this.environmentOverrides=n,this.authOverrides=u,this.globalHeaderOverrides=a,this.detectGlobalHeaders=i?.detectGlobalHeaders??!0,this.objectQueryParameters=i?.objectQueryParameters??!1,this.respectReadonlySchemas=i?.respectReadonlySchemas??!1,this.respectNullableSchemas=i?.respectNullableSchemas??!1,this.onlyIncludeReferencedSchemas=i?.onlyIncludeReferencedSchemas??!1,this.inlinePathParameters=i?.inlinePathParameters??!1,this.useBytesForBinaryResponse=i?.useBytesForBinaryResponse??!1,this.respectForwardCompatibleEnums=i?.respectForwardCompatibleEnums??!1,this.referencedSchemaIds=i?.onlyIncludeReferencedSchemas?new Set:void 0,this.enableUniqueErrorsPerEndpoint=i?.enableUniqueErrorsPerEndpoint??!1,this.builder=new bnn(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,o]of Object.entries(d.errors)){let l=parseInt(s),v=c[l];v==null&&o.schema!=null?c[l]=o.schema:v!=null&&o.schema!=null&&Cue(v,o.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(v5.Channel,v5.Endpoint,v5.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:Ao(t)}}markObjectSchemaAsReferenced(t,r){for(let i of t.allOf)this.markSchemaIdAsReferenced(i.schema,r);for(let i of t.properties)this.markSchemaAsReferenced(i.schema,r)}markOneofSchemaAsReferenced(t,r){switch(t.type){case"discriminated":for(let i of Object.values(t.schemas))this.markSchemaAsReferenced(i,r);return;case"undiscriminated":for(let i of t.schemas)this.markSchemaAsReferenced(i,r);return;default:Ao(t)}}markSchemaIdAsReferenced(t,r){if(this.referencedSchemaIds!=null&&!this.referencedSchemaIds.has(t)){this.referencedSchemaIds.add(t);let i=this.getSchema(t,r);i!=null&&this.markSchemaAsReferenced(i,r)}}isInAnyState(...t){return t.some(r=>this.isInState(r))}};function uDc(e){let t=new dau(e);return r1_(t)}var pau=class{args;constructor(t){this.args=t}convert({context:t,ir:r,settings:i,absoluteFilePath:n}){let a=uDc({taskContext:t,ir:r,options:r5a({overrides:{...i,respectReadonlySchemas:i?.respectReadonlySchemas??this.args.respectReadonlySchemas,respectNullableSchemas:i?.respectNullableSchemas??this.args.respectNullableSchemas,onlyIncludeReferencedSchemas:i?.onlyIncludeReferencedSchemas??this.args.onlyIncludeReferencedSchemas,inlinePathParameters:i?.inlinePathParameters??this.args.inlinePathParameters,objectQueryParameters:i?.objectQueryParameters??this.args.objectQueryParameters,useBytesForBinaryResponse:i?.useBytesForBinaryResponse??this.args.useBytesForBinaryResponse,respectForwardCompatibleEnums:i?.respectForwardCompatibleEnums??this.args.respectForwardCompatibleEnums}}),authOverrides:i?.auth!=null?{auth:i.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:n??this.args.absoluteFilePath,rootApiFile:{defaultUrl:a.rootApiFile["default-url"],contents:a.rootApiFile,rawContents:xd.dump(a.rootApiFile)},namedDefinitionFiles:{...Sd(a.definitionFiles,u=>({absoluteFilepath:n??this.args.absoluteFilePath,rawContents:xd.dump(u),contents:u})),[wy.of(SS)]:{absoluteFilepath:n??this.args.absoluteFilePath,rawContents:xd.dump(a.packageMarkerFile),contents:a.packageMarkerFile}},packageMarkers:{},importedDefinitions:{}}}};var p5a=class extends AQt{inlinePathParameters;objectQueryParameters;onlyIncludeReferencedSchemas;respectReadonlySchemas;respectNullableSchemas;exampleGeneration;useBytesForBinaryResponse;respectForwardCompatibleEnums;inlineAllOfSchemas;converter;constructor(t){super(t),this.inlinePathParameters=t.inlinePathParameters,this.objectQueryParameters=t.objectQueryParameters,this.onlyIncludeReferencedSchemas=t.onlyIncludeReferencedSchemas,this.respectReadonlySchemas=t.respectReadonlySchemas,this.respectNullableSchemas=t.respectNullableSchemas,this.exampleGeneration=t.exampleGeneration,this.useBytesForBinaryResponse=t.useBytesForBinaryResponse,this.respectForwardCompatibleEnums=t.respectForwardCompatibleEnums,this.inlineAllOfSchemas=t.inlineAllOfSchemas,this.converter=new pau(t)}async getDefinition({context:t,absoluteFilePath:r,relativePathToDependency:i},n){let a=await this.getOpenAPIIr({context:t,relativePathToDependency:i},n);return this.converter.convert({context:t,ir:a,settings:n,absoluteFilePath:r})}async toFernWorkspace({context:t},r){let i=await this.getDefinition({context:t},r);return new Mqe({absoluteFilePath:this.absoluteFilePath,workspaceName:this.workspaceName,generatorsConfiguration:this.generatorsConfiguration,dependenciesConfiguration:{dependencies:{}},definition:i,cliVersion:this.cliVersion})}};var O$={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 VJn={of(e){return e}};var n1_={properties:{"stream-condition":{type:"string"},response:"Schema","response-stream":"Schema"},required:["stream-condition","response","response-stream"],extensionsPrefix:"x-"},sDc={id:"",typeExtension:{oas3:e=>({...e,XFernStreaming:n1_,Operation:{...e.Operation,properties:{...e.Operation?.properties,"x-fern-streaming":"XFernStreaming"}}})}},ad={SOURCE:VJn.of("source"),SDK_NAMESPACE:VJn.of("x-fern-sdk-namespace"),SDK_METHOD_NAME:VJn.of("x-fern-sdk-method-name"),SDK_GROUP_NAME:VJn.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:VJn.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",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 w3={disableExamples:!1,discriminatedUnionV2:!1,useTitlesAsName:!0,audiences:void 0,optionalAdditionalProperties:!0,coerceEnumsToLiterals:!0,respectReadonlySchemas:!1,respectNullableSchemas:!1,onlyIncludeReferencedSchemas:!1,inlinePathParameters:!1,preserveSchemaIds:!1,objectQueryParameters:!1,shouldUseUndiscriminatedUnionsWithLiterals:!1,shouldUseIdiomaticRequestNames:!1,filter:void 0,asyncApiNaming:"v1",exampleGeneration:void 0,defaultFormParameterEncoding:"json",useBytesForBinaryResponse:!1,respectForwardCompatibleEnums:!1,additionalPropertiesDefaultsTo:!1,typeDatesAsStrings:!0,preserveSingleSchemaOneOf:!1,inlineAllOfSchemas:!1,groupMultiApiEnvironments:!1};function w6e({options:e,overrides:t}){return{disableExamples:t?.disableExamples??w3.disableExamples,discriminatedUnionV2:t?.discriminatedUnionV2??e?.discriminatedUnionV2??w3.discriminatedUnionV2,useTitlesAsName:t?.useTitlesAsName??e?.useTitlesAsName??w3.useTitlesAsName,audiences:t?.audiences??e?.audiences??w3.audiences,optionalAdditionalProperties:t?.optionalAdditionalProperties??e?.optionalAdditionalProperties??w3.optionalAdditionalProperties,coerceEnumsToLiterals:t?.coerceEnumsToLiterals??e?.coerceEnumsToLiterals??w3.coerceEnumsToLiterals,respectReadonlySchemas:t?.respectReadonlySchemas??e?.respectReadonlySchemas??w3.respectReadonlySchemas,respectNullableSchemas:t?.respectNullableSchemas??e?.respectNullableSchemas??w3.respectNullableSchemas,onlyIncludeReferencedSchemas:t?.onlyIncludeReferencedSchemas??e?.onlyIncludeReferencedSchemas??w3.onlyIncludeReferencedSchemas,inlinePathParameters:t?.inlinePathParameters??e?.inlinePathParameters??w3.inlinePathParameters,preserveSchemaIds:t?.preserveSchemaIds??w3.preserveSchemaIds,shouldUseUndiscriminatedUnionsWithLiterals:t?.shouldUseUndiscriminatedUnionsWithLiterals??e?.shouldUseUndiscriminatedUnionsWithLiterals??w3.shouldUseUndiscriminatedUnionsWithLiterals,shouldUseIdiomaticRequestNames:t?.shouldUseIdiomaticRequestNames??e?.shouldUseIdiomaticRequestNames??w3.shouldUseIdiomaticRequestNames,objectQueryParameters:t?.objectQueryParameters??e?.objectQueryParameters??w3.objectQueryParameters,filter:t?.filter??e?.filter??w3.filter,asyncApiNaming:t?.asyncApiNaming??e?.asyncApiNaming??w3.asyncApiNaming,useBytesForBinaryResponse:t?.useBytesForBinaryResponse??e?.useBytesForBinaryResponse??w3.useBytesForBinaryResponse,exampleGeneration:t?.exampleGeneration??e?.exampleGeneration??void 0,defaultFormParameterEncoding:t?.defaultFormParameterEncoding??e?.defaultFormParameterEncoding??void 0,respectForwardCompatibleEnums:t?.respectForwardCompatibleEnums??e?.respectForwardCompatibleEnums??w3.respectForwardCompatibleEnums,additionalPropertiesDefaultsTo:t?.additionalPropertiesDefaultsTo??e?.additionalPropertiesDefaultsTo??w3.additionalPropertiesDefaultsTo,typeDatesAsStrings:t?.typeDatesAsStrings??e?.typeDatesAsStrings??w3.typeDatesAsStrings,preserveSingleSchemaOneOf:t?.preserveSingleSchemaOneOf??e?.preserveSingleSchemaOneOf??w3.preserveSingleSchemaOneOf,inlineAllOfSchemas:t?.inlineAllOfSchemas??e?.inlineAllOfSchemas??w3.inlineAllOfSchemas,groupMultiApiEnvironments:t?.groupMultiApiEnvironments??e?.groupMultiApiEnvironments??w3.groupMultiApiEnvironments}}var a1_={naming:"v1"};function hf(e,t){let r=Array.isArray(t)?t:[t];for(let i of r){let n=e[i];if(n!=null)return n}}function _5a(e,t,r,i,n=[]){try{let a=hf(e,t);if(a!=null)return r.parse(a)}catch{let u=w3e(n).join(" -> ");i.error(`${u.length>0?`${u}: `:""}Failed to parse ${t}`)}}function gnn(e){let t=hf(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 o1_({schema:e,logger:t}){return hf(e,ad.ENCODING)??void 0}function u1_(e){return hf(e,ad.FERN_ENUM)}function s1_({nameOverride:e,generatedName:t,title:r,schema:i,description:n,availability:a}){let u=hf(i,ad.SDK_NAMESPACE),c=hf(i,ad.SDK_GROUP_NAME),d=hf(i,ad.TYPE_DEFINITION);if(d!=null)return h5a({fernType:d,nameOverride:e,generatedName:t,title:r,description:n,availability:a,namespace:u,groupName:typeof c=="string"?[c]:c})}function h5a({fernType:e,nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c}){return v6({type:e,_default:void 0,validation:void 0,visitor:{primitive:d=>{switch(d.v1){case"BASE_64":return zl.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c,schema:vp.base64({example:void 0})});case"BOOLEAN":return zl.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c,schema:vp.boolean({default:void 0,example:void 0})});case"DATE":return zl.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c,schema:vp.date({example:void 0})});case"DATE_TIME":return zl.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c,schema:vp.datetime({example:void 0})});case"FLOAT":return zl.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c,schema:vp.float({example:void 0})});case"DOUBLE":return zl.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c,schema:vp.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 zl.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c,schema:vp.uint({default:void 0,example:void 0})});case"INTEGER":return zl.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c,schema:vp.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 zl.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c,schema:vp.uint64({default:void 0,example:void 0})});case"LONG":return zl.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c,schema:vp.int64({default:void 0,example:void 0})});case"STRING":case"UUID":case"BIG_INTEGER":return zl.primitive({nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c,schema:vp.string({default:void 0,pattern:void 0,maxLength:void 0,minLength:void 0,example:void 0,format:void 0})});default:Ao(d.v1)}},unknown:()=>zl.unknown({nameOverride:t,generatedName:r,title:i,example:void 0,description:n,availability:a,namespace:u,groupName:c}),map:({keyType:d,valueType:s})=>d?.type==="primitive"&&s!=null?zl.map({nameOverride:t,generatedName:r,title:i,key:d,value:s,description:n,availability:a,namespace:u,groupName:c,encoding:void 0,example:void 0,inline:void 0}):void 0,list:d=>d!=null?zl.array({nameOverride:t,generatedName:r,title:i,value:d,description:n,availability:a,namespace:u,groupName:c,example:void 0,inline:void 0}):void 0,optional:d=>d!=null?zl.optional({nameOverride:t,generatedName:r,title:i,value:d,description:n,availability:a,namespace:u,groupName:c,inline:void 0}):void 0,nullable:d=>d!=null?zl.nullable({nameOverride:t,generatedName:r,title:i,value:d,description:n,availability:a,namespace:u,groupName:c,inline:void 0}):void 0,set:d=>d!=null?zl.array({nameOverride:t,generatedName:r,title:i,value:d,description:n,availability:a,namespace:u,groupName:c,example:void 0,inline:void 0}):void 0,literal:d=>zl.literal({nameOverride:t,generatedName:r,title:i,value:d._visit({string:s=>px.string(s),boolean:s=>px.boolean(s),_other:()=>{throw new Error("Unexpected literal type")}}),description:n,availability:a,namespace:u,groupName:c}),named:d=>zl.reference({schema:d,nameOverride:t,generatedName:r,title:i,description:n,availability:a,namespace:u,groupName:c,source:qK.openapi({file:"<memory>"})})}})}function c1_(e){let t=hf(e,ad.SOURCE);if(t!=null)return t.endsWith(".proto")?qK.protobuf({file:t}):qK.openapi({file:t})}function Onn(e){if(e!=null&&typeof e=="boolean")return e}function ep(e){return e?.$ref!=null}function l1_({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,additionalProperties:n,description:a,availability:u,wrapAsNullable:c,context:d,namespace:s,groupName:o,example:l,encoding:v,source:g}){return n===void 0&&(n=d.options.additionalPropertiesDefaultsTo),typeof n=="boolean"||WJn(n,d.options)?_au({nameOverride:e,generatedName:t,title:r,wrapAsNullable:c,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:vp.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:zl.unknown({nameOverride:void 0,generatedName:`${t}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:void 0,groupName:void 0}),namespace:s,groupName:o,example:l,encoding:v}):_au({nameOverride:e,generatedName:t,title:r,wrapAsNullable:c,description:a,availability:u,keySchema:{nameOverride:void 0,generatedName:`${t}Key`,title:void 0,description:void 0,availability:void 0,schema:vp.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:f1_(n0(n,d.options.optionalAdditionalProperties?c:!1,d,[...i,"Value"],g,s,void 0,void 0,void 0)),namespace:s,groupName:o,example:l,encoding:v})}function f1_(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=f1_(e.value);break;case"oneOf":e.value.inline=!0;break;default:Ao(e)}return e}function _au({nameOverride:e,generatedName:t,title:r,keySchema:i,valueSchema:n,wrapAsNullable:a,description:u,availability:c,namespace:d,groupName:s,example:o,encoding:l}){return a?zl.nullable({nameOverride:e,generatedName:t,title:r,value:zl.map({nameOverride:e,generatedName:t,title:r,description:u,availability:i.availability,key:i,value:n,namespace:d,groupName:s,encoding:l,example:o,inline:void 0}),description:u,availability:c,namespace:d,groupName:s,inline:void 0}):zl.map({nameOverride:e,generatedName:t,title:r,description:u,availability:c,key:i,value:n,namespace:d,groupName:s,encoding:l,example:o,inline:void 0})}function WJn(e,t){return e==null?t.additionalPropertiesDefaultsTo:typeof e=="boolean"?e:!ep(e)&&Object.keys(e).length===0}function d1_({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,item:n,description:a,availability:u,wrapAsNullable:c,context:d,namespace:s,groupName:o,example:l,source:v}){let g=n==null?zl.unknown({nameOverride:e,generatedName:t,title:r,description:void 0,availability:void 0,example:void 0,namespace:s,groupName:o}):n0(n,!1,d,[...i,"Item"],v,s);return MIE({nameOverride:e,generatedName:t,title:r,namespace:s,groupName:o,itemSchema:g,wrapAsNullable:c,description:a,availability:u,example:l})}function MIE({nameOverride:e,generatedName:t,title:r,itemSchema:i,wrapAsNullable:n,description:a,availability:u,namespace:c,groupName:d,example:s}){return n?zl.nullable({nameOverride:e,generatedName:t,title:r,value:zl.array({nameOverride:e,generatedName:t,title:r,value:i,description:a,availability:u,namespace:c,groupName:d,example:s,inline:void 0}),description:a,availability:u,namespace:c,groupName:d,inline:void 0}):zl.array({nameOverride:e,generatedName:t,title:r,value:i,description:a,availability:u,namespace:c,groupName:d,example:s,inline:void 0})}function IK(e){switch(hf(e,ad.AVAILABILITY)){case"deprecated":return v$.Deprecated;case"beta":return v$.Beta;case"generally-available":return v$.GenerallyAvailable;default:break}if(!ep(e)&&e.deprecated)return v$.Deprecated}function cDc({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,availability:u,required:c,wrapAsNullable:d,discriminator:s,context:o,namespace:l,groupName:v,encoding:g,source:O}){let m=s.propertyName,P=Object.fromEntries(Object.entries(s.mapping??{}).map(([A,M])=>{let E=Cmi({$ref:M},!1,o,[M],g,O,l);return o.markReferencedByDiscriminatedUnion({$ref:M},m,1),[A,E]})),D=Object.entries(n).filter(([A])=>A!==m).map(([A,M])=>{let E=c!=null&&c.includes(A),T=n0(M,!E,o,[...i,A],O,l);return{key:A,schema:T}});return p1_({nameOverride:e,generatedName:t,title:r,wrapAsNullable:d,properties:D,description:a,availability:u,discriminant:m,subtypes:P,namespace:l,groupName:v,source:O})}function lDc({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,availability:u,required:c,wrapAsNullable:d,discriminant:s,variants:o,context:l,namespace:v,groupName:g,encoding:O,source:m}){let P=Object.fromEntries(Object.entries(o).map(([A,M])=>{if(ep(M)){let E=Cmi(M,!1,l,[M.$ref],O,m,v);return l.markReferencedByDiscriminatedUnion(M,s,1),[A,E]}else{let E=HJn(M,!1,l,[...i,A],O,m,v,new Set([s]));return[A,E]}})),D=Object.entries(n).filter(([A])=>A!==s).map(([A,M])=>{let E=c!=null&&c.includes(A),T=n0(M,!E,l,[...i,A],m,v);return{key:A,schema:T}});return p1_({nameOverride:e,generatedName:t,title:r,wrapAsNullable:d,properties:D,description:a,availability:u,discriminant:s,subtypes:P,namespace:v,groupName:g,source:m})}function p1_({nameOverride:e,generatedName:t,title:r,wrapAsNullable:i,properties:n,description:a,availability:u,discriminant:c,subtypes:d,namespace:s,groupName:o,source:l}){return i?zl.nullable({nameOverride:e,generatedName:t,title:r,value:zl.oneOf(Cee.discriminated({description:a,availability:u,discriminantProperty:c,nameOverride:e,generatedName:t,title:r,schemas:d,commonProperties:n,namespace:s,groupName:o,encoding:void 0,source:l,inline:void 0})),namespace:s,groupName:o,description:a,availability:u,inline:void 0}):zl.oneOf(Cee.discriminated({description:a,availability:u,discriminantProperty:c,nameOverride:e,generatedName:t,title:r,schemas:d,commonProperties:n,namespace:s,groupName:o,encoding:void 0,source:l,inline:void 0}))}function _1_(e){if(e.proto!=null)return lJn.protobuf({typeName:e.proto.type})}function b3i({nameOverride:e,generatedName:t,title:r,fernEnum:i,enumVarNames:n,enumValues:a,_default:u,description:c,availability:d,wrapAsNullable:s,namespace:o,groupName:l,context:v,source:g,inline:O}){let m=qIE(n??[]),P=new Set(a),D=Array.from(P).map((M,E)=>{let T=i?.[M],z=m[E],$=NJn.test(M),I=T?.name??z,R=$?M:FJn(M);return I!=null&&!NJn.test(I)&&(v?.logger.warn(`Enum name override ${I} is not a valid name. Falling back on ${R}.`),I=void 0),{nameOverride:I,generatedName:R,value:M,description:T?.description,availability:d,casing:{snake:T?.casing?.snake??void 0,pascal:T?.casing?.pascal??void 0,screamingSnake:T?.casing?.screamingSnake??void 0,camel:T?.casing?.camel??void 0}}}),A=u!=null?D.find(M=>M.value===u):void 0;return AIE({wrapAsNullable:s,nameOverride:e,generatedName:t,title:r,values:D,_default:A,description:c,availability:d,namespace:o,groupName:l,source:g,inline:O})}function AIE({wrapAsNullable:e,nameOverride:t,generatedName:r,title:i,values:n,_default:a,description:u,availability:c,namespace:d,groupName:s,source:o,inline:l}){return e?zl.nullable({nameOverride:t,generatedName:r,title:i,value:zl.enum({nameOverride:t,generatedName:r,title:i,values:n,description:u,default:a,availability:c,example:void 0,namespace:d,groupName:s,source:o,inline:l}),description:u,availability:c,namespace:d,groupName:s,inline:l}):zl.enum({nameOverride:t,generatedName:r,title:i,values:n,description:u,availability:c,default:a,example:void 0,namespace:d,groupName:s,source:o,inline:l})}function qIE(e){if(e.length<=1||e[0]==null)return e;let t=e[0],r=0;for(;t[r]!=null&&e.every(i=>i[r]===t[r]);)r++;return e.map(i=>i.substring(r))}function h1_({nameOverride:e,generatedName:t,title:r,format:i,_default:n,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,description:o,availability:l,wrapAsNullable:v,example:g,namespace:O,groupName:m}){return i==="int64"?b5({nameOverride:e,generatedName:t,title:r,primitive:vp.int64({default:n,example:g}),wrapAsNullable:v,description:o,availability:l,namespace:O,groupName:m}):i==="uint32"?b5({nameOverride:e,generatedName:t,title:r,primitive:vp.uint({default:n,example:g}),wrapAsNullable:v,description:o,availability:l,namespace:O,groupName:m}):i==="uint64"?b5({nameOverride:e,generatedName:t,title:r,primitive:vp.uint64({default:n,example:g}),wrapAsNullable:v,description:o,availability:l,namespace:O,groupName:m}):b5({nameOverride:e,generatedName:t,title:r,primitive:vp.int({default:n,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,example:g}),wrapAsNullable:v,description:o,availability:l,namespace:O,groupName:m})}function y1_(e){return typeof e=="string"?px.string(e):typeof e=="boolean"?px.boolean(e):px.string(`${e}`)}function v1_({nameOverride:e,generatedName:t,title:r,wrapAsNullable:i,value:n,description:a,availability:u,namespace:c,groupName:d}){return i?zl.nullable({nameOverride:e,generatedName:t,title:r,value:zl.literal({nameOverride:e,generatedName:t,title:r,value:y1_(n),description:a,availability:u,namespace:c,groupName:d}),description:a,availability:u,namespace:c,groupName:d,inline:void 0}):zl.literal({nameOverride:e,generatedName:t,title:r,value:y1_(n),description:a,availability:u,namespace:c,groupName:d})}function fDc({nameOverride:e,generatedName:t,title:r,format:i,_default:n,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,description:o,availability:l,wrapAsNullable:v,example:g,namespace:O,groupName:m}){return i==null||i==="double"?b5({nameOverride:e,generatedName:t,title:r,primitive:vp.double({default:n,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,example:g}),wrapAsNullable:v,description:o,availability:l,namespace:O,groupName:m}):i==="float"?b5({nameOverride:e,generatedName:t,title:r,primitive:vp.float({example:g}),wrapAsNullable:v,description:o,availability:l,namespace:O,groupName:m}):i==="int32"?b5({nameOverride:e,generatedName:t,title:r,primitive:vp.int({default:n,minimum:a,maximum:u,exclusiveMinimum:c,exclusiveMaximum:d,multipleOf:s,example:g}),wrapAsNullable:v,description:o,availability:l,namespace:O,groupName:m}):i==="int64"?b5({nameOverride:e,generatedName:t,title:r,primitive:vp.int64({default:n,example:g}),wrapAsNullable:v,description:o,availability:l,namespace:O,groupName:m}):i==="uint32"?b5({nameOverride:e,generatedName:t,title:r,primitive:vp.uint({default:n,example:g}),wrapAsNullable:v,description:o,availability:l,namespace:O,groupName:m}):i==="uint64"?b5({nameOverride:e,generatedName:t,title:r,primitive:vp.uint64({default:n,example:g}),wrapAsNullable:v,description:o,availability:l,namespace:O,groupName:m}):i==="time-delta"?b5({nameOverride:e,generatedName:t,title:r,primitive:vp.float({example:g}),wrapAsNullable:v,description:o,availability:l,namespace:O,groupName:m}):b5({nameOverride:e,generatedName:t,title:r,primitive:vp.float({example:g}),wrapAsNullable:v,description:o,availability:l,namespace:O,groupName:m})}var TIE={isApplicable:e=>e[0]==="#"&&e[1]==="components"&&e[2]==="schemas",applyStrategy:e=>{let t=[e[3]??""];return{refUnderProcessing:e.slice(4),newBreadcrumbs:t}}},CIE={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}}},BIE={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}}},IIE={isApplicable:e=>e[0]==="properties",applyStrategy:e=>{let t=[e[1]??""];return{refUnderProcessing:e.slice(2),newBreadcrumbs:t}}},zIE={isApplicable:e=>e[0]==="items",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},xIE={isApplicable:e=>e[0]==="allOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},RIE={isApplicable:e=>e[0]==="anyOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})},NIE={isApplicable:e=>e[0]==="oneOf",applyStrategy:e=>({refUnderProcessing:e.slice(1),newBreadcrumbs:[]})};function hau(e){let t=e.split("/").map(a=>a.replace(/~1/g,"/")),r=[],i=[TIE,CIE,BIE,IIE,zIE,xIE,RIE,NIE],n;do{n=t;for(let a of i)if(a.isApplicable(t)){let{refUnderProcessing:u,newBreadcrumbs:c}=a.applyStrategy(t);t=u,r=[...r,...c]}}while(t.join("")!==n.join(""));return r}function g5(e,t){let i=e.map(n=>/^[^a-zA-Z0-9]+$/.test(n)?n:QB(R_(n))).join("");return/^\d/.test(i)?u5a(i)??i:i}function dDc(e){let t=e.join("_");return R_(t)}function bA(e){switch(e.type){case"object":return Ov.object({allOf:e.allOf,properties:e.properties.map(t=>LIE(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 Ov.array({description:e.description,availability:e.availability,value:bA(e.value),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"enum":return Ov.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 Ov.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 Ov.nullable({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:bA(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"optional":return Ov.optional({generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,description:e.description,availability:e.availability,value:bA(e.value),namespace:e.namespace,groupName:e.groupName,inline:e.inline});case"primitive":return Ov.primitive({description:e.description,availability:e.availability,schema:b1_(e.schema),generatedName:e.generatedName,nameOverride:e.nameOverride,title:e.title,namespace:e.namespace,groupName:e.groupName});case"map":return Ov.map({description:e.description,availability:e.availability,key:Ov.primitive({description:e.key.description,availability:e.key.availability,schema:b1_(e.key.schema),generatedName:e.key.generatedName,title:e.key.title,nameOverride:e.key.nameOverride,namespace:e.namespace,groupName:e.groupName}),value:bA(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 Ov.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 Ov.oneOf(FIE(e.value));case"unknown":return Ov.unknown({nameOverride:e.nameOverride,generatedName:e.generatedName});default:Ao(e)}}function FIE(e){switch(e.type){case"discriminated":return Mmi.discriminated({commonProperties:e.commonProperties.map(t=>({key:t.key,schema:bA(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,bA(r)])),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});case"undiscriminated":return Mmi.undiscriminated({description:e.description,availability:e.availability,generatedName:e.generatedName,title:e.title,nameOverride:e.nameOverride,schemas:e.schemas.map(t=>bA(t)),namespace:e.namespace,groupName:e.groupName,encoding:e.encoding,source:e.source,inline:e.inline});default:Ao(e)}}function b1_(e){switch(e.type){case"string":return xw.string(e);case"base64":return xw.base64();case"boolean":return xw.boolean(e);case"date":return xw.date();case"datetime":return xw.datetime();case"double":return xw.double(e);case"float":return xw.float();case"int":return xw.int(e);case"int64":return xw.int64(e);case"uint":return xw.uint();case"uint64":return xw.uint64();default:Ao(e)}}function LIE(e){return{conflict:e.conflict,generatedName:e.generatedName,key:e.key,schema:bA(e.schema),audiences:e.audiences,nameOverride:e.nameOverride,availability:e.availability,readonly:e.readonly,writeonly:e.writeonly}}function yau(e,t){return Cue(bA(e),bA(t))}function g1_({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,properties:n,description:a,required:u,wrapAsNullable:c,allOf:d,context:s,propertiesToExclude:o,namespace:l,groupName:v,fullExamples:g,additionalProperties:O,availability:m,source:P}){let D=[...u??[]],A={...n},M=[],E=[];for(let R of d)if(!s.options.inlineAllOfSchemas&&ep(R)){let U=s.resolveSchemaReference(R);if(U.discriminator!=null&&U.discriminator.mapping!=null)continue;if(U.oneOf!=null||U.anyOf!=null){let J=U.oneOf??U.anyOf;if(J!=null){for(let X of J){let ae=ep(X)?s.resolveSchemaReference(X):X,de=n0(ae,!1,s.DUMMY,i,P,l);de.type==="object"&&M.push(...de.properties.map(pe=>pe.schema.type!=="optional"&&pe.schema.type!=="nullable"?{...pe,schema:zl.optional({nameOverride:void 0,generatedName:"",title:void 0,value:pe.schema,description:void 0,availability:pe.availability,namespace:void 0,groupName:void 0,inline:void 0})}:pe))}continue}}let Y=g3i(R);if(Y==null)continue;E.push({schemaId:Y,convertedSchema:pDc(R,[Y],P,s.options.preserveSchemaIds),properties:O1_({schema:R,context:s,breadcrumbs:i,source:P,namespace:l})}),s.markSchemaAsReferencedByNonRequest(Y)}else if(ep(R)){let U=s.resolveSchemaReference(R),Y=n0(U,!1,s,i,P,l);Y.type==="object"&&M.push(...Y.properties)}else{let U=R.required??[];M=M.map(J=>(J.schema.type==="optional"||J.schema.type==="nullable")&&U.includes(J.key)?{...J,schema:J.schema.value}:J);let Y=n0(R,!1,s,i,P,l);Y.type==="object"&&M.push(...Y.properties)}let T={};for(let R of E)for(let[U,Y]of Object.entries(R.properties)){let J=T[U];J!=null?(J.schemaIds.push(R.schemaId),J.schemas.some(ae=>yau(ae,Y))||J.schemas.push(Y)):T[U]={schemaIds:[R.schemaId],schemas:[Y]}}let z=[];for(let[R,U]of Object.entries(T))U.schemaIds.length>1&&z.push({propertyKey:R,allOfSchemaIds:U.schemaIds,conflictingTypeSignatures:U.schemas.length>1});let $=Object.fromEntries(Object.entries(A).filter(([R,U])=>!(!ep(U)&&U.type==="null"))),I=Object.entries($).map(([R,U])=>{let Y=hf(U,ad.AUDIENCES)??[],J=IK(U),X=ep(U)?!1:U.readOnly,ae=ep(U)?!1:U.writeOnly,de=D.includes(R)&&!X,pe=hf(U,ad.FERN_PROPERTY_NAME),Oe=[...i,R],Fe=dDc(Oe),dt=de?n0(U,!1,s,Oe,P,l):zl.optional({nameOverride:e,generatedName:Fe,title:r,description:void 0,availability:J,value:n0(U,!1,s,Oe,P,l),namespace:l,groupName:v,inline:void 0}),De={};for(let Me of E){let Tt=Me.properties[R];Tt!=null&&!yau(dt,Tt)?De[Me.schemaId]={differentSchema:!0}:Tt!=null&&(De[Me.schemaId]={differentSchema:!1})}return{key:R,schema:dt,nameOverride:pe,audiences:Y,conflict:De,generatedName:dDc([...i,R]),availability:J,readonly:X,writeonly:ae}});return I.push(...M.map(R=>{let U=R.conflict;for(let Y of E){let J=Y.properties[R.key];J!=null&&!yau(R.schema,J)?U[Y.schemaId]={differentSchema:!0}:J!=null&&(U[Y.schemaId]={differentSchema:!1})}return{...R,conflict:U}})),UIE({nameOverride:e,generatedName:t,title:r,wrapAsNullable:c,properties:I.filter(R=>!o.has(R.key)),description:a,allOf:E.map(R=>R.convertedSchema),allOfPropertyConflicts:z,namespace:l,groupName:v,fullExamples:g,additionalProperties:O,availability:m,source:P,context:s})}function UIE({nameOverride:e,generatedName:t,title:r,wrapAsNullable:i,properties:n,description:a,allOf:u,allOfPropertyConflicts:c,namespace:d,groupName:s,fullExamples:o,additionalProperties:l,availability:v,source:g,context:O}){return i?zl.nullable({nameOverride:e,generatedName:t,title:r,value:zl.object({description:a,properties:n,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:c,namespace:d,groupName:s,fullExamples:o,additionalProperties:WJn(l,O.options),availability:void 0,source:g,inline:void 0}),description:a,availability:v,namespace:d,groupName:s,inline:void 0}):zl.object({description:a,properties:n,nameOverride:e,generatedName:t,title:r,allOf:u,allOfPropertyConflicts:c,namespace:d,groupName:s,fullExamples:o,additionalProperties:WJn(l,O.options),availability:v,source:g,inline:void 0})}function O1_({schema:e,context:t,breadcrumbs:r,source:i,namespace:n}){let a={},[u,c]=ep(e)?[t.resolveSchemaReference(e),hau(e.$ref)]:[e,r];for(let d of u.allOf??[])a={...a,...O1_({schema:d,context:t,breadcrumbs:c,source:i,namespace:n})};for(let[d,s]of Object.entries(u.properties??{})){let o=n0(s,!1,t,[...c,d],i,n);a[d]=o}return a}function O3i({nameOverride:e,generatedName:t,title:r,breadcrumbs:i,description:n,availability:a,wrapAsNullable:u,context:c,subtypes:d,namespace:s,groupName:o,encoding:l,source:v,subtypePrefixOverrides:g}){let O=HIE({schemas:d}),m=d.flatMap((D,A)=>{if(!ep(D)&&D.enum!=null&&c.options.coerceEnumsToLiterals&&D.type==="string")return D.enum.map(E=>zl.literal({nameOverride:void 0,generatedName:g5([t,E],c.options.preserveSchemaIds),title:void 0,value:px.string(String(E)),namespace:s,groupName:void 0,description:void 0,availability:E.availability}));let M=O[A];if(g!=null){let E=g[A];E!=null&&"name"in E&&(M=E.name)}return[n0(D,!1,c,[...i,M??`${A}`],v,s)]}),P=VIE(m);return WIE({uniqueSubtypes:P,nameOverride:e,generatedName:t,title:r,wrapAsNullable:u,description:n,availability:a,namespace:s,groupName:o,context:c,encoding:l,source:v})}function VIE(e){let t=[];for(let r=0;r<e.length;++r){let i=e[r],n=!1;for(let a=r+1;a<e.length;++a){let u=e[a];if(i!=null&&u!=null&&Cue(i,u)){n=!0;break}}i!=null&&!n&&t.push(i)}return t}function WIE({uniqueSubtypes:e,nameOverride:t,generatedName:r,title:i,wrapAsNullable:n,description:a,availability:u,namespace:c,groupName:d,context:s,encoding:o,source:l}){if(Object.entries(e).every(([g,O])=>O.type==="literal")){let g={},O=[];return Object.entries(e).forEach(([m,P])=>{P.type==="literal"&&P.value.type==="string"&&(O.push(P.value.value),P.description!=null&&(g[P.value.value]={description:P.description}))}),b3i({nameOverride:t,generatedName:r,title:i,wrapAsNullable:n,description:a,availability:u,fernEnum:g,enumVarNames:void 0,enumValues:O,_default:void 0,namespace:c,groupName:d,context:s,source:l,inline:void 0})}return e.length===1&&e[0]!=null&&!s.options.preserveSingleSchemaOneOf?e[0]:m1_({nameOverride:t,generatedName:r,title:i,wrapAsNullable:n,description:a,availability:u,subtypes:e,namespace:c,groupName:d,encoding:o,source:l})}function _Dc({nameOverride:e,generatedName:t,title:r,description:i,availability:n,wrapAsNullable:a,context:u,namespace:c,groupName:d,discriminator:s,encoding:o,source:l}){let v=Object.entries(s.mapping??{}).map(([m,P],D)=>{let A={$ref:P},M=Cmi(A,!1,u,[P],o,l,c);return u.markSchemaWithDiscriminantValue(A,s.propertyName,m),M.type==="object"&&(M.properties={[s.propertyName]:zl.literal({nameOverride:void 0,generatedName:g5([t,m],u.options.preserveSchemaIds),title:void 0,value:px.string(m),namespace:void 0,groupName:void 0,description:void 0,availability:void 0}),...M.properties.filter(E=>E.key!==s.propertyName)}),M}),g=[];for(let m=0;m<v.length;++m){let P=v[m],D=!1;for(let A=m+1;A<v.length;++A){let M=v[A];if(P!=null&&M!=null&&Cue(P,M)){D=!0;break}}P!=null&&!D&&g.push(P)}if(Object.entries(g).every(([m,P])=>P.type==="literal")){let m={},P=[];return Object.entries(g).forEach(([D,A])=>{A.type==="literal"&&A.value.type==="string"&&(P.push(A.value.value),A.description!=null&&(m[A.value.value]={description:A.description}))}),b3i({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:i,availability:n,fernEnum:m,enumVarNames:void 0,enumValues:P,_default:void 0,namespace:c,groupName:d,context:u,source:l,inline:void 0})}return g.length===1&&g[0]!=null&&!u.options.preserveSingleSchemaOneOf?g[0]:m1_({nameOverride:e,generatedName:t,title:r,wrapAsNullable:a,description:i,availability:n,subtypes:g,namespace:c,groupName:d,encoding:o,source:l})}function HIE({schemas:e}){let t={},r=0;for(let a of e){if(!ep(a)){if(a.properties!=null&&Object.entries(a.properties).length>0){let u=Object.keys(a.properties),c={},d=u;for(let[s,o]of Object.entries(t)){let l=dAo(o,u);d=dAo(d,o),c[s]=l}c[r]=d,t=c}}r++}let i=[],n=0;for(let a of e){let u=t[n];if(u!=null&&u.length>0){let c=u.sort();if(c[0]!=null){i.push(c[0]),++n;continue}}ep(a)?i.push(h3i(n)??`${n}`):a.type==="array"||a.type==="boolean"||a.type==="integer"||a.type==="number"||a.type==="string"?i.push(""):i.push(h3i(n)??`${n}`),++n}return i}function m1_({nameOverride:e,generatedName:t,title:r,wrapAsNullable:i,description:n,availability:a,subtypes:u,namespace:c,groupName:d,encoding:s,source:o}){return i?zl.nullable({nameOverride:e,generatedName:t,title:r,value:zl.oneOf(Cee.undiscriminated({description:n,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,namespace:c,groupName:d,encoding:s,source:o,inline:void 0})),description:n,availability:a,namespace:c,groupName:d,inline:void 0}):zl.oneOf(Cee.undiscriminated({description:n,availability:a,nameOverride:e,generatedName:t,title:r,schemas:u,namespace:c,groupName:d,encoding:s,source:o,inline:void 0}))}function $Jn(e){if(e.default!=null&&typeof e.default=="string")return e.default}function vau({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="number")return e.example;let i=gnn(e);for(let n of i??[])if(typeof n=="number")return n;if(r&&typeof r=="number")return r}function P1_({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="boolean")return e.example;let i=gnn(e);for(let n of i??[])if(typeof n=="boolean")return n;if(r&&typeof r=="boolean")return r}function aor({schema:e,logger:t,fallback:r}){if(e.example!=null&&typeof e.example=="string")return e.example;let i=gnn(e);for(let n of i??[])if(typeof n=="string")return n;if(r&&typeof r=="string")return r}function j1_({schema:e,logger:t,fallback:r}){if(e.example!=null&&Array.isArray(e.example))return e.example;let i=gnn(e);for(let n of i??[])if(Array.isArray(n))return n;if(r&&Array.isArray(r))return r}var mnn="#/components/schemas/";function n0(e,t,r,i,n,a,u=!1,c=new Set,d){let s=c1_(e)??n,o=ZIE({schema:e,logger:r.logger});if(ep(e)){let l=g3i(e);return l!=null?(u?r.markSchemaAsReferencedByRequest(l):r.markSchemaAsReferencedByNonRequest(l),Cmi(e,t,r,i,o,s,a)):HJn(r.resolveSchemaReference(e),t,r,hau(e.$ref),o,s,a,c,u,d)}return HJn(e,t,r,i,o,s,a,c,u,d)}function Cmi(e,t,r,i,n,a,u){let c=e.$ref.includes("properties")?HJn(r.resolveSchemaReference(e),t,r,i,n,a,u,new Set):zl.reference(pDc(e,i,a,r.options.preserveSchemaIds));return t?zl.nullable({title:void 0,nameOverride:void 0,generatedName:g5(i,r.options.preserveSchemaIds),value:c,description:void 0,availability:void 0,namespace:void 0,groupName:void 0,inline:void 0}):c}function $IE(e){if(e!=null&&!e.includes(" ")&&/^[a-zA-Z]+$/.test(e))return e}function HJn(e,t,r,i,n,a,u,c=new Set,d=!1,s){typeof e=="string"&&(e={type:e});let o=hf(e,ad.TYPE_NAME)??(r.options.useTitlesAsName?$IE(e.title):void 0),l=hf(e,ad.SDK_GROUP_NAME)??hf(e,O$.TAGS)?.[0],v=(typeof l=="string"?[l]:l)??[];v=r.resolveGroupName(v);let g=g5(i,r.options.preserveSchemaIds),O=e.title,m=e.description,P=IK(e),D=[];e.example!=null&&D.push({name:void 0,value:e.example,description:void 0});let A=hf(e,O$.EXAMPLES);A!=null&&Object.keys(A).length>0&&D.push(...Object.entries(A).map(([T,z])=>({name:z?.summary??T,value:z.value,description:z.description})));let M=gnn(e);M!=null&&Object.keys(M).length>0&&D.push(...M.map(T=>({name:void 0,value:T,description:void 0})));let E=s1_({schema:e,description:m,title:O,nameOverride:o,generatedName:g,availability:P});if(E!=null)return E;try{if(Array.isArray(e.type)){let z=e.type.indexOf("null"),$=z!==-1;if(e.type.length===1)e.type=e.type[0];else if(e.type.length===2&&$)e.type.splice(z,1),e.type=e.type[0],e.nullable=!0;else if($&&(e.type.splice(z,1),e.nullable=!0),e.oneOf==null)e.oneOf=[...new Set(e.type)];else{let I=new Set([...e.oneOf,...e.type]);e.oneOf=[...I]}}if(!t&&e.nullable===!0)return HJn(e,!0,r,i,n,a,u,c,d,s);if("const"in e&&(e.enum=[e.const]),e.enum!=null&&(e.type==="string"||e.type==null||e.type==="enum")){if(!Oau(e.enum))return b5({nameOverride:o,generatedName:g,title:O,primitive:vp.string({default:$Jn(e),minLength:e.minLength,maxLength:e.maxLength,pattern:e.pattern,format:e.format,example:aor({schema:e,logger:r.logger,fallback:s})}),namespace:u,groupName:v,wrapAsNullable:t,description:m,availability:P});let z=u1_(e);return e.enum.length===1&&e.enum[0]!=null&&z==null?v1_({nameOverride:o,generatedName:g,title:O,wrapAsNullable:t,value:e.enum[0],description:m,availability:P,namespace:u,groupName:v}):b3i({nameOverride:o,generatedName:g,title:O,fernEnum:z,enumVarNames:hf(e,[O$.ENUM_VAR_NAMES]),enumValues:e.enum,_default:e.default,description:m,availability:P,wrapAsNullable:t,namespace:u,groupName:v,context:r,source:a,inline:void 0})}if(Oau(e.type)&&e.type.length>1){let z=e.type.includes("null"),$=e.type.filter(I=>I!=="null").map(I=>({type:I,nullable:z}));return O3i({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:P,wrapAsNullable:t,context:r,subtypes:$,namespace:u,groupName:v,encoding:n,source:a})}if(e.type==="boolean"){let z=hf(e,ad.BOOLEAN_LITERAL);return z!=null?w1_({nameOverride:o,generatedName:g,title:O,literal:px.boolean(z),wrapAsNullable:t,description:m,availability:P,namespace:u,groupName:v}):b5({nameOverride:o,generatedName:g,title:O,primitive:vp.boolean({default:GIE(e.default),example:P1_({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:m,availability:P,namespace:u,groupName:v})}if(e.type==="number")return fDc({nameOverride:o,generatedName:g,title:O,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Onn(e.exclusiveMinimum),exclusiveMaximum:Onn(e.exclusiveMaximum),multipleOf:e.multipleOf,description:m,availability:P,wrapAsNullable:t,example:vau({schema:e,logger:r.logger,fallback:s}),namespace:u,groupName:v});if(e.type==="integer")return h1_({nameOverride:o,generatedName:g,title:O,format:e.format,_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Onn(e.exclusiveMinimum),exclusiveMaximum:Onn(e.exclusiveMaximum),multipleOf:e.multipleOf,description:m,availability:P,wrapAsNullable:t,example:vau({schema:e,logger:r.logger,fallback:s}),namespace:u,groupName:v});if(e.type==="float")return fDc({nameOverride:o,generatedName:g,title:O,format:"float",_default:e.default,minimum:e.minimum,maximum:e.maximum,exclusiveMinimum:Onn(e.exclusiveMinimum),exclusiveMaximum:Onn(e.exclusiveMaximum),multipleOf:e.multipleOf,description:m,availability:P,wrapAsNullable:t,example:vau({schema:e,logger:r.logger,fallback:s}),namespace:u,groupName:v});if(e.type==="string"){if(e.format==="date-time")return b5({nameOverride:o,generatedName:g,title:O,primitive:vp.datetime({example:aor({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:m,availability:P,namespace:u,groupName:v});if(e.format==="date"&&r.options.typeDatesAsStrings===!1)return b5({nameOverride:o,generatedName:g,title:O,primitive:vp.date({example:aor({schema:e,logger:r.logger,fallback:s})}),wrapAsNullable:t,description:m,availability:P,namespace:u,groupName:v});if(e.format==="json-string")return zl.unknown({nameOverride:o,generatedName:g,title:O,description:m,availability:P,namespace:u,groupName:v,example:void 0});let z=E1_(e,"const");return z!=null?w1_({nameOverride:o,generatedName:g,title:O,literal:px.string(z),wrapAsNullable:t,description:m,availability:P,namespace:u,groupName:v}):b5({nameOverride:o,generatedName:g,title:O,primitive:vp.string({default:$Jn(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:aor({schema:e,logger:r.logger,fallback:s})}),namespace:u,groupName:v,wrapAsNullable:t,description:m,availability:P})}if(e.type==="array")return d1_({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,item:e.items,description:m,availability:P,wrapAsNullable:t,context:r,namespace:u,groupName:v,example:j1_({schema:e,logger:r.logger,fallback:s}),source:a});if(e.additionalProperties!=null&&e.additionalProperties!==!1&&bau(e))return l1_({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,additionalProperties:e.additionalProperties,description:m,availability:P,wrapAsNullable:t,context:r,namespace:u,groupName:v,encoding:n,example:e.example,source:a});if(e.oneOf!=null&&e.oneOf.length>0&&hf(e,ad.IS_DISCRIMINATED)===!1)return O3i({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:P,wrapAsNullable:t,context:r,subtypes:e.oneOf,namespace:u,groupName:v,encoding:n,source:a});if(e.type==="object"&&e.discriminator!=null&&e.discriminator.mapping!=null)return r.options.discriminatedUnionV2?_Dc({nameOverride:o,generatedName:g,title:O,description:m,availability:P,wrapAsNullable:t,context:r,namespace:u,groupName:v,discriminator:e.discriminator,encoding:n,source:a}):cDc({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:P,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,namespace:u,groupName:v,encoding:n,source:a});if(e.oneOf!=null&&e.oneOf.length>0){let z=hf(e,ad.IS_UNDISCRIMINATED);if(e.discriminator!=null&&e.discriminator.mapping!=null&&Object.keys(e.discriminator.mapping).length>0)return r.options.discriminatedUnionV2||z?_Dc({nameOverride:o,generatedName:g,title:O,description:m,availability:P,wrapAsNullable:t,context:r,namespace:u,groupName:v,discriminator:e.discriminator,encoding:n,source:a}):cDc({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:P,discriminator:e.discriminator,properties:e.properties??{},required:e.required,wrapAsNullable:t,context:r,namespace:u,groupName:v,encoding:n,source:a});if(e.oneOf.length===1&&e.oneOf[0]!=null){if(r.options.preserveSingleSchemaOneOf)return O3i({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:P,wrapAsNullable:t,context:r,subtypes:e.oneOf.filter(I=>ep(I)||I.type!=="null"),encoding:n,namespace:u,groupName:v,source:a});let $=n0(e.oneOf[0],t,r,i,a,u,d);return GJn($,m,u,v)}else if(e.oneOf.length>1){if(e.oneOf.length===2&&e.oneOf[0]!=null&&e.oneOf[1]!=null){let U=e.oneOf[0],Y=e.oneOf[1];if(!ep(U)&&U.type==="null")return n0(Y,!0,r,i,a,u);if(!ep(Y)&&Y.type==="null")return n0(U,!0,r,i,a,u)}let $=KIE({schemas:e.oneOf});if($!=null)return b3i({nameOverride:o,generatedName:g,title:O,fernEnum:void 0,enumVarNames:void 0,enumValues:$,_default:e.default,description:m,availability:P,wrapAsNullable:t,namespace:u,groupName:v,context:r,source:a,inline:void 0});let I=S1_({schemas:e.oneOf,context:r});if(I!=null&&!r.options.discriminatedUnionV2&&!z)return lDc({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,properties:e.properties??{},required:e.required,description:m,availability:P,wrapAsNullable:t,discriminant:I.discriminant,variants:I.schemas,context:r,namespace:u,groupName:v,encoding:n,source:a});let R=e.oneOf.filter(U=>!ep(U)&&U.type==="null").length>0;return O3i({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:P,wrapAsNullable:t||R,context:r,subtypes:e.oneOf.filter(U=>ep(U)||U.type!=="null"),encoding:n,namespace:u,groupName:v,source:a})}}if(e.anyOf!=null&&e.anyOf.length>0){if(e.anyOf.length===1&&e.anyOf[0]!=null){let I=n0(e.anyOf[0],t,r,i,a,u,d);return GJn(I,m,u,v)}if(e.anyOf.length===2){let[I,R]=e.anyOf;if(I!=null&&R!=null){if(!ep(I)&&I.type==="null"){let U=n0(R,!0,r,i,a,u);return GJn(U,m,u,v)}else if(!ep(R)&&R.type==="null"){let U=n0(I,!0,r,i,a,u);return GJn(U,m,u,v)}}}let z=S1_({schemas:e.anyOf,context:r});if(z!=null&&!r.options.discriminatedUnionV2)return lDc({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,properties:e.properties??{},required:e.required,description:m,availability:P,wrapAsNullable:t,discriminant:z.discriminant,variants:z.schemas,context:r,namespace:u,groupName:v,encoding:n,source:a});let $=e.anyOf.filter(I=>!ep(I)&&I.type==="null").length>0;return O3i({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,description:m,availability:P,wrapAsNullable:t||$,context:r,subtypes:e.anyOf.filter(I=>ep(I)||I.type!=="null"),encoding:n,namespace:u,groupName:v,source:a})}if(e.allOf!=null||e.properties!=null){let z=[];for(let I of e.allOf??[])(ep(I)||Object.keys(I).length>0)&&z.push(I);if((e.properties==null||bau(e))&&z.length===1&&z[0]!=null){let I=n0(z[0],t,r,i,a,u,d);return GJn(I,m,u,v)}let $=z.filter(I=>{let R=gau(I);return R||r.logger.warn(`Skipping non-object allOf element: ${JSON.stringify(I)}`),R});if((e.properties==null||bau(e))&&$.length===1&&$[0]!=null){let I=n0($[0],t,r,i,a,u,d);return GJn(I,m,u,v)}return g1_({nameOverride:o,generatedName:g,title:O,breadcrumbs:i,properties:e.properties??{},description:m,required:e.required,wrapAsNullable:t,allOf:$,context:r,propertiesToExclude:c,namespace:u,groupName:v,fullExamples:D,additionalProperties:e.additionalProperties,availability:P,encoding:n,source:a})}if(e.type==="object"&&QIE(e)&&JIE(e)&&bau(e))return _au({nameOverride:o,generatedName:g,title:O,description:m,availability:P,wrapAsNullable:t,keySchema:{nameOverride:void 0,generatedName:`${g}Key`,title:void 0,description:void 0,availability:void 0,schema:vp.string({default:$Jn(e),pattern:e.pattern,format:e.format,minLength:e.minLength,maxLength:e.maxLength,example:aor({schema:e,logger:r.logger,fallback:s})}),namespace:u,groupName:v},valueSchema:zl.unknown({nameOverride:void 0,generatedName:`${g}Value`,title:void 0,description:void 0,availability:void 0,example:void 0,namespace:u,groupName:v}),namespace:u,groupName:v,encoding:n,example:e.example});e.type!=null&&r.logger.warn(`Failed to parse an OpenAPI schema at the following location: ${i.join("->")}. Coercing to unknown.`);let T=e.example??e.default;return zl.unknown({nameOverride:o,generatedName:g,title:O,description:m,availability:P,namespace:u,groupName:v,example:T})}catch(T){return r.logger.debug(`Error converting schema: ${T.message}
@@ -2416,7 +2416,7 @@ error-discriminant: error`;await(0,p6s.writeFile)(r,n)}}};var Y34={version:"0.0.
2416
2416
  `));if(await r.takeOverTerminal(async()=>{await QF4(i)||r.failAndThrow("Canceled.")}),r.getResult()===CI.Failure)return;let n=i.flatMap(({migrations:a,version:u})=>a.map(c=>({migration:c,context:r.addInteractiveTask({name:`${u} ${c.name}`})})));for(let{migration:a,context:u}of n){let c=u.start();if(await a.run({context:c}),c.finish(),c.getResult()===CI.Failure){r.logger.error("Failed to run migrations. You may need to undo changes to files.");return}}}async function QF4(e){let t="wantsToContinue",r=["Some migrations need to be run:"];for(let{migrations:n}of e)for(let a of n)r.push(M$t({prefix:" \u25E6 ",content:`${a.name}
2417
2417
  ${Es.dim(a.summary)}`}));r.push("Do you wish to continue?");let{[t]:i}=await yGo.prompt({name:t,type:"confirm",message:r.join(`
2418
2418
  `)});return i}var PSw=require("fs/promises");var dSw=Symbol.for("immer-nothing"),uSw=Symbol.for("immer-draftable"),jze=Symbol.for("immer-state"),JF4=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function SEe(e,...t){if(process.env.NODE_ENV!=="production"){let r=JF4[e],i=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${i}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var kwa=Object.getPrototypeOf;function e1a(e){return!!e&&!!e[jze]}function czn(e){return e?pSw(e)||Array.isArray(e)||!!e[uSw]||!!e.constructor?.[uSw]||wmo(e)||CFs(e):!1}var KF4=Object.prototype.constructor.toString();function pSw(e){if(!e||typeof e!="object")return!1;let t=kwa(e);if(t===null)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===KF4}function MFs(e,t){TFs(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,i)=>t(i,r,e))}function TFs(e){let t=e[jze];return t?t.type_:Array.isArray(e)?1:wmo(e)?2:CFs(e)?3:0}function Mjd(e,t){return TFs(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function _Sw(e,t,r){let i=TFs(e);i===2?e.set(t,r):i===3?e.add(r):e[t]=r}function YF4(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function wmo(e){return e instanceof Map}function CFs(e){return e instanceof Set}function szn(e){return e.copy_||e.base_}function Ajd(e,t){if(wmo(e))return new Map(e);if(CFs(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=pSw(e);if(t===!0||t==="class_only"&&!r){let i=Object.getOwnPropertyDescriptors(e);delete i[jze];let n=Reflect.ownKeys(i);for(let a=0;a<n.length;a++){let u=n[a],c=i[u];c.writable===!1&&(c.writable=!0,c.configurable=!0),(c.get||c.set)&&(i[u]={configurable:!0,writable:!0,enumerable:c.enumerable,value:e[u]})}return Object.create(kwa(e),i)}else{let i=kwa(e);if(i!==null&&r)return{...e};let n=Object.create(i);return Object.assign(n,e)}}function Ijd(e,t=!1){return BFs(e)||e1a(e)||!czn(e)||(TFs(e)>1&&Object.defineProperties(e,{set:{value:EFs},add:{value:EFs},clear:{value:EFs},delete:{value:EFs}}),Object.freeze(e),t&&Object.values(e).forEach(r=>Ijd(r,!0))),e}function EFs(){SEe(2)}function BFs(e){return Object.isFrozen(e)}var XF4={};function lzn(e){let t=XF4[e];return t||SEe(0,e),t}var Pmo;function hSw(){return Pmo}function ZF4(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function sSw(e,t){t&&(lzn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function qjd(e){Tjd(e),e.drafts_.forEach(kF4),e.drafts_=null}function Tjd(e){e===Pmo&&(Pmo=e.parent_)}function cSw(e){return Pmo=ZF4(Pmo,e)}function kF4(e){let t=e[jze];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function lSw(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[jze].modified_&&(qjd(t),SEe(4)),czn(e)&&(e=AFs(t,e),t.parent_||qFs(t,e)),t.patches_&&lzn("Patches").generateReplacementPatches_(r[jze].base_,e,t.patches_,t.inversePatches_)):e=AFs(t,r,[]),qjd(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==dSw?e:void 0}function AFs(e,t,r){if(BFs(t))return t;let i=t[jze];if(!i)return MFs(t,(n,a)=>fSw(e,i,t,n,a,r)),t;if(i.scope_!==e)return t;if(!i.modified_)return qFs(e,i.base_,!0),i.base_;if(!i.finalized_){i.finalized_=!0,i.scope_.unfinalizedDrafts_--;let n=i.copy_,a=n,u=!1;i.type_===3&&(a=new Set(n),n.clear(),u=!0),MFs(a,(c,d)=>fSw(e,i,n,c,d,r,u)),qFs(e,n,!1),r&&e.patches_&&lzn("Patches").generatePatches_(i,r,e.patches_,e.inversePatches_)}return i.copy_}function fSw(e,t,r,i,n,a,u){if(process.env.NODE_ENV!=="production"&&n===r&&SEe(5),e1a(n)){let c=a&&t&&t.type_!==3&&!Mjd(t.assigned_,i)?a.concat(i):void 0,d=AFs(e,n,c);if(_Sw(r,i,d),e1a(d))e.canAutoFreeze_=!1;else return}else u&&r.add(n);if(czn(n)&&!BFs(n)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;AFs(e,n),(!t||!t.scope_.parent_)&&typeof i!="symbol"&&(wmo(r)?r.has(i):Object.prototype.propertyIsEnumerable.call(r,i))&&qFs(e,n)}}function qFs(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ijd(t,r)}function e44(e,t){let r=Array.isArray(e),i={type_:r?1:0,scope_:t?t.scope_:hSw(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},n=i,a=zjd;r&&(n=[i],a=jmo);let{revoke:u,proxy:c}=Proxy.revocable(n,a);return i.draft_=c,i.revoke_=u,c}var zjd={get(e,t){if(t===jze)return e;let r=szn(e);if(!Mjd(r,t))return t44(e,r,t);let i=r[t];return e.finalized_||!czn(i)?i:i===Djd(e.base_,t)?(Ejd(e),e.copy_[t]=Bjd(i,e)):i},has(e,t){return t in szn(e)},ownKeys(e){return Reflect.ownKeys(szn(e))},set(e,t,r){let i=ySw(szn(e),t);if(i?.set)return i.set.call(e.draft_,r),!0;if(!e.modified_){let n=Djd(szn(e),t),a=n?.[jze];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(YF4(r,n)&&(r!==void 0||Mjd(e.base_,t)))return!0;Ejd(e),Cjd(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Djd(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Ejd(e),Cjd(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=szn(e),i=Reflect.getOwnPropertyDescriptor(r,t);return i&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:i.enumerable,value:r[t]}},defineProperty(){SEe(11)},getPrototypeOf(e){return kwa(e.base_)},setPrototypeOf(){SEe(12)}},jmo={};MFs(zjd,(e,t)=>{jmo[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});jmo.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&SEe(13),jmo.set.call(this,e,t,void 0)};jmo.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&SEe(14),zjd.set.call(this,e[0],t,r,e[0])};function Djd(e,t){let r=e[jze];return(r?szn(r):e)[t]}function t44(e,t,r){let i=ySw(t,r);return i?"value"in i?i.value:i.get?.call(e.draft_):void 0}function ySw(e,t){if(!(t in e))return;let r=kwa(e);for(;r;){let i=Object.getOwnPropertyDescriptor(r,t);if(i)return i;r=kwa(r)}}function Cjd(e){e.modified_||(e.modified_=!0,e.parent_&&Cjd(e.parent_))}function Ejd(e){e.copy_||(e.copy_=Ajd(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var r44=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,i)=>{if(typeof t=="function"&&typeof r!="function"){let a=r;r=t;let u=this;return function(d=a,...s){return u.produce(d,o=>r.call(this,o,...s))}}typeof r!="function"&&SEe(6),i!==void 0&&typeof i!="function"&&SEe(7);let n;if(czn(t)){let a=cSw(this),u=Bjd(t,void 0),c=!0;try{n=r(u),c=!1}finally{c?qjd(a):Tjd(a)}return sSw(a,i),lSw(n,a)}else if(!t||typeof t!="object"){if(n=r(t),n===void 0&&(n=t),n===dSw&&(n=void 0),this.autoFreeze_&&Ijd(n,!0),i){let a=[],u=[];lzn("Patches").generateReplacementPatches_(t,n,a,u),i(a,u)}return n}else SEe(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(u,...c)=>this.produceWithPatches(u,d=>t(d,...c));let i,n;return[this.produce(t,r,(u,c)=>{i=u,n=c}),i,n]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){czn(e)||SEe(8),e1a(e)&&(e=i44(e));let t=cSw(this),r=Bjd(e,void 0);return r[jze].isManual_=!0,Tjd(t),r}finishDraft(e,t){let r=e&&e[jze];(!r||!r.isManual_)&&SEe(9);let{scope_:i}=r;return sSw(i,t),lSw(void 0,i)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let n=t[r];if(n.path.length===0&&n.op==="replace"){e=n.value;break}}r>-1&&(t=t.slice(r+1));let i=lzn("Patches").applyPatches_;return e1a(e)?i(e,t):this.produce(e,n=>i(n,t))}};function Bjd(e,t){let r=wmo(e)?lzn("MapSet").proxyMap_(e,t):CFs(e)?lzn("MapSet").proxySet_(e,t):e44(e,t);return(t?t.scope_:hSw()).drafts_.push(r),r}function i44(e){return e1a(e)||SEe(10,e),vSw(e)}function vSw(e){if(!czn(e)||BFs(e))return e;let t=e[jze],r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Ajd(e,t.scope_.immer_.useStrictShallowCopy_)}else r=Ajd(e,!0);return MFs(r,(i,n)=>{_Sw(r,i,vSw(n))}),t&&(t.finalized_=!1),r}var n44=new r44,bSw=n44.produce;async function gSw({cliEnvironment:e,version:t}){try{return await t5a(e.packageName,{version:t}),!0}catch{return!1}}var Smo="FERN_CWD";async function Dmo({version:e,cliContext:t,env:r}){t.suppressUpgradeMessage();let i=["--quiet","--yes",`${t.environment.packageName}@${e}`,...process.argv.slice(2)];t.logger.debug([`Re-running CLI at version ${e}.`,`${Es.dim(`+ npx ${i.map(c=>`"${c}"`).join(" ")}`)}`].join(`
2419
- `));let{failed:n,stdout:a,stderr:u}=await hx(t.logger,"npx",["--quiet",...i],{stdio:"inherit",reject:!1,env:{...r,[Smo]:process.env[Smo]??process.cwd()}});if(a.includes("code EEXIST")||u.includes("code EEXIST"))return await Dmo({version:e,cliContext:t});n&&t.failWithoutThrowing()}var OSw="FERN_PRE_UPGRADE_VERSION";async function jSw({cliContext:e,includePreReleases:t,targetVersion:r}){r!=null&&(await gSw({cliEnvironment:e.environment,version:r})||e.failAndThrow(`Failed to upgrade to ${r} because it does not exist. See https://www.npmjs.com/package/${e.environment.packageName}?activeTab=versions.`),Mue(r,e.environment.packageVersion)||e.failAndThrow(`Cannot upgrade because target version (${r}) is not ahead of existing version ${e.environment.packageVersion}`));let i=r!=null?{targetVersion:r,isUpgradeAvailable:!0}:void 0;if(i==null){let n=await e.isUpgradeAvailable({includePreReleases:t});n.cliUpgradeInfo!=null&&(i={targetVersion:n.cliUpgradeInfo.latestVersion,isUpgradeAvailable:n.cliUpgradeInfo.isUpgradeAvailable})}if(i&&!i.isUpgradeAvailable){let n=process.env[OSw];if(n==null){e.logger.info("No upgrade available.");return}await mSw({cliContext:e,previousVersion:n,newVersion:i.targetVersion})}else if(i!=null){let n=await PGt();if(n==null)return e.failAndThrow(`Directory "${mH}" not found.`);let a=await e.runTask(c=>Ngi({directory:n,context:c})),u=bSw(a.rawConfig,c=>{c.version=i.targetVersion});await(0,PSw.writeFile)(a._absolutePath,JSON.stringify(u,void 0,2)),e.logger.info(`Upgrading from ${Es.dim(e.environment.packageVersion)} \u2192 ${Es.green(i.targetVersion)}`),e.environment.packageVersion==="0.0.0"?await mSw({cliContext:e,previousVersion:a.version,newVersion:i.targetVersion}):(await hx(e.logger,"npm",["install","-g",`${e.environment.packageName}@${i.targetVersion}`]),await Dmo({version:i.targetVersion,cliContext:e,env:{[OSw]:e.environment.packageVersion}}))}}async function mSw({cliContext:e,previousVersion:t,newVersion:r}){await e.runTask(async i=>{await Sjd({fromVersion:t,toVersion:r,context:i})}),await e.exitIfFailed()}async function wSw({project:e,cliContext:t,errorOnBrokenLinks:r}){let i=e.docsWorkspaces;if(i==null){t.failAndThrow("No docs workspace found");return}await t.runTaskForWorkspace(i,async n=>{let a=performance.now(),u=await Promise.all(e.apiWorkspaces.map(async o=>o.toFernWorkspace({context:n}))),c=await R$(e),d=await HWa(i,n,u,c,!0),s=performance.now()-a;LZn({violations:d,context:n,logWarnings:!0,logSummary:!0,logBreadcrumbs:!1,elapsedMillis:s}),d.length>0&&r&&n.failAndThrow()})}async function SSw({project:e,cliContext:t,logWarnings:r,brokenLinks:i,errorOnBrokenLinks:n,isLocal:a,directFromOpenapi:u}){let c=e.docsWorkspaces;c!=null&&await t.runTaskForWorkspace(c,async d=>{let s=i||n?[]:["valid-markdown-links"];await N0u({workspace:c,context:d,logWarnings:r,apiWorkspaces:e.apiWorkspaces,ossWorkspaces:await R$(e),errorOnBrokenLinks:n,excludeRules:s})}),await Promise.all(e.apiWorkspaces.map(async d=>{d.generatorsConfiguration?.groups.length===0&&d.type!="fern"||await t.runTaskForWorkspace(d,async s=>{if(d instanceof D3&&u){await d.getIntermediateRepresentation({context:s,audiences:{type:"all"},enableUniqueErrorsPerEndpoint:!1,generateV1Examples:!1});return}let o=await d.toFernWorkspace({context:s});await Tvi({workspace:o,context:s,logWarnings:r,ossWorkspace:d instanceof D3?d:void 0})})}))}var Jvi=require("fs/promises");var xjd=oi(require("path"),1);async function DSw({project:e,cliContext:t,sdkLanguage:r,preserveSchemaIds:i}){await Promise.all(e.apiWorkspaces.map(async n=>{await t.runTaskForWorkspace(n,async a=>{n instanceof Mqe?await a44({workspace:n,context:a}):await o44({workspace:await n.toFernWorkspace({context:a},{preserveSchemaIds:i}),context:a})})}))}async function a44({workspace:e,context:t}){for(let[r,i]of Object.entries(e.definition.importedDefinitions)){let n=Bu(e.absoluteFilePath,za.of(AL),za.of(r),za.of(`.${AL}`));await ESw({definition:i.definition,absolutePathToOutputDirectory:n}),t.logger.info(Es.green(`Wrote imported definition at ${xjd.default.relative(process.cwd(),n)}`))}}async function o44({workspace:e,context:t}){let r=Bu(e.absoluteFilePath,za.of(`.${AL}`));await ESw({definition:e.definition,absolutePathToOutputDirectory:r}),t.logger.info(Es.green(`Wrote definition to ${xjd.default.relative(process.cwd(),r)}`))}async function ESw({definition:e,absolutePathToOutputDirectory:t}){let r=(i,n)=>{let a={imports:0,types:1,services:2},u=i in a?a[i]:Object.keys(a).length,c=n in a?a[n]:Object.keys(a).length;return u==null?-1:c==null?1:u!==c?u-c:i.localeCompare(n)};await Cf(t)&&await(0,Jvi.rm)(t,{recursive:!0}),await(0,Jvi.mkdir)(t,{recursive:!0}),await(0,Jvi.writeFile)(Bu(t,za.of(i6)),xd.dump(e.rootApiFile.contents,{sortKeys:r}));for(let[i,n]of Object.entries(e.packageMarkers)){let a=Bu(t,za.of(i));await(0,Jvi.mkdir)(zd(a),{recursive:!0}),await(0,Jvi.writeFile)(a,xd.dump(n.contents,{sortKeys:r}))}for(let[i,n]of Object.entries(e.namedDefinitionFiles)){let a=Bu(t,za.of(i));await(0,Jvi.mkdir)(zd(a),{recursive:!0}),await(0,Jvi.writeFile)(a,xd.dump(n.contents,{sortKeys:r}))}}var MSw=require("fs/promises");async function ASw({project:e,outputPath:t,cliContext:r}){let i=e.docsWorkspaces;i!=null&&await r.runTaskForWorkspace(i,async n=>{let a=await R$(e),u=await Promise.all(e.apiWorkspaces.map(async s=>s.toFernWorkspace({context:n},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1}))),d=await new cJt(i.config.instances[0]?.url??"http://localhost:8080",i,a,u,n).resolve();await(0,MSw.writeFile)($c.of(t),JSON.stringify(d,null,2)),n.logger.info(Es.green(`Docs definition written to ${t}`))})}var IFs=u44();function u44(){return typeof window<"u"&&typeof window.document<"u"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis<"u"&&globalThis?.navigator?.userAgent==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof self?.importScripts=="function"&&(self.constructor?.name==="DedicatedWorkerGlobalScope"||self.constructor?.name==="ServiceWorkerGlobalScope"||self.constructor?.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&&!!process.versions?.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"}}jJ4();var PJ4="The Fern CLI requires Node 18+ or above.";async function jJ4(){let e=process.argv.includes("--local"),t=new Xru(process.stdout,process.stderr,{isLocal:e}),r=async()=>{await t.exit()};if(IFs.type==="node"&&IFs.parsedVersion!=null&&IFs.parsedVersion>=18){let{setGlobalDispatcher:i,Agent:n}=await Promise.resolve().then(()=>oi(tDd(),1));i(new n({connect:{timeout:2147483647},bodyTimeout:0,headersTimeout:2147483647}))}if(process.env.HTTP_PROXY!=null){let{setGlobalDispatcher:i,ProxyAgent:n}=await Promise.resolve().then(()=>oi(tDd(),1)),a=new n(process.env.HTTP_PROXY);i(a)}process.on("SIGINT",async()=>{t.suppressUpgradeMessage(),await r()});try{let i=process.env[Smo];i!=null&&process.chdir(i);let n=await SJ4(t);t.environment.packageVersion===n?await wJ4(t):await Dmo({version:n,cliContext:t})}catch(i){await t.instrumentPostHogEvent({command:process.argv.join(" "),properties:{failed:!0,error:i}}),i?.message.includes("globalThis")?(t.logger.error(PJ4),t.failWithoutThrowing()):i instanceof H8?t.failWithoutThrowing():i instanceof ggi?t.logger.error(`Failed. ${i.log}`):t.failWithoutThrowing("Failed.",i)}await r()}async function wJ4(e){let t=Zg_(Xjc(process.argv)).scriptName(e.environment.cliName).version(!1).fail((r,i,n)=>{i==null&&(n.showHelp(),e.logger.error(r))}).strict().exitProcess(!1).command("$0",!1,r=>r.option("version",{describe:"Print current version",alias:"v"}).version(!1),r=>{r.version!=null?e.logger.info(e.environment.packageVersion):(t.showHelp(),e.failAndThrow())}).option("log-level",{default:Sb.Info,choices:ABi}).demandCommand().recommendCommands();MJ4(t,e),EJ4(t,e),AJ4(t,e),qJ4(t,e),TJ4(t,e),CJ4(t,e),zJ4(t,e),BJ4(t,e),IJ4(t,e),NJ4(t,e),xJ4(t,e),RJ4(t,e),UJ4(t,e),VJ4(t,e),WJ4(t,e),QJ4(t,e),JJ4(t,e),$J4(t,e),GJ4(t,e),HJ4(t,e),LJ4(t,e),FJ4({cli:t,cliContext:e,onRun:()=>{e.suppressUpgradeMessage()}}),XJ4(t,e),ZJ4(t,e),kJ4(t,e),I8_(t,e),z8_(t,e),eK4(t,e),t.middleware(async r=>{e.setLogLevel(r["log-level"]),e.logDebugInfo()}),await t.parse()}async function SJ4(e){if(process.env.FERN_NO_VERSION_REDIRECTION==="true")return e.environment.packageVersion;let t=await PGt();if(t!=null){let r=await e.runTask(i=>Ngi({directory:t,context:i}));return r.version==="*"?e.environment.packageVersion:r.version}return n3i({cliEnvironment:e.environment})}async function DJ4(e){let t=await PGt();if(t!=null)return(await e.runTask(i=>Ngi({directory:t,context:i}))).organization}function EJ4(e,t){e.command("init","Initialize a Fern API",r=>r.option("api",{boolean:!0,description:"Initialize an api."}).option("docs",{boolean:!0,description:"Initialize a docs website."}).option("organization",{alias:"org",type:"string",description:"Organization name"}).option("openapi",{type:"string",description:"Filepath or url to an existing OpenAPI spec"}).option("mintlify",{type:"string",description:"Migrate docs from Mintlify provided a path to a mint.json file"}).option("readme",{type:"string",description:"Migrate docs from Readme provided a URL to a Readme generated docs site"}),async r=>{if(r.organization==null){let i=await DJ4(t);i!=null?r.organization=i:r.organization=await t.getInput({message:"Please enter your organization"})}if(r.api!=null&&r.docs!=null)return t.failWithoutThrowing("Cannot specify both --api and --docs. Please choose one.");if(r.readme!=null&&r.mintlify!=null)return t.failWithoutThrowing("Cannot specify both --readme and --mintlify. Please choose one.");if(r.readme!=null)await t.runTask(async i=>{await Ijc({readmeUrl:r.readme,organization:r.organization??"fern",taskContext:i,versionOfCli:await n3i({cliEnvironment:t.environment})})});else if(r.docs!=null)await t.runTask(async i=>{await Thc({organization:r.organization,versionOfCli:await n3i({cliEnvironment:t.environment}),taskContext:i})});else if(r.mintlify!=null)await t.runTask(async i=>{await Zhc({pathToMintJson:r.mintlify,organization:r.organization??"fern",taskContext:i,versionOfCli:await n3i({cliEnvironment:t.environment})})});else{let i;if(r.openapi!=null){if($Zi(r.openapi)){let a=await rO_({url:r.openapi,logger:t.logger});a.status==="failure"&&t.failAndThrow(a.errorMessage);let u=a.filePath;i=$c.of(u)}else i=$c.of($v(TI(),r.openapi));await Cf(i)||t.failAndThrow(`${i} does not exist`)}await t.runTask(async n=>{await Ahc({organization:r.organization,versionOfCli:await n3i({cliEnvironment:t.environment}),context:n,openApiPath:i})})}})}function MJ4(e,t){e.command("diff","Diff two versions of an API",r=>r.option("from",{string:!0,demandOption:!0,description:"The previous version of the API"}).option("to",{string:!0,demandOption:!0,description:"The next version of the API"}).option("from-version",{string:!0,description:"The previous version of the API (e.g. 1.1.0)"}).option("from-generator-version",{string:!0,description:"The previous version of the generator (e.g. 1.1.0)"}).option("to-generator-version",{string:!0,description:"The next version of the generator (e.g. 1.1.0)"}).option("quiet",{boolean:!0,default:!1,alias:"q",description:"Whether to suppress output written to stderr"}).middleware(i=>{if(!WHs(i.fromGeneratorVersion,i.toGeneratorVersion))throw new Error("Both --from-generator-version and --to-generator-version must be provided together, or neither should be provided")}),async r=>{let i=UHs(r.fromVersion),n=VHs({from:r.fromGeneratorVersion,to:r.toGeneratorVersion}),a=await U8_({context:t,from:r.from,to:r.to,fromVersion:i,generatorVersions:n});if(i!=null){let{errors:c,...d}=a;t.logger.info(JSON.stringify(d))}!r.quiet&&a.errors.length>0&&t.stderr.info(a.errors.join(`
2419
+ `));let{failed:n,stdout:a,stderr:u}=await hx(t.logger,"npx",["--quiet",...i],{stdio:"inherit",reject:!1,env:{...r,[Smo]:process.env[Smo]??process.cwd()}});if(a.includes("code EEXIST")||u.includes("code EEXIST"))return await Dmo({version:e,cliContext:t});n&&t.failWithoutThrowing()}var OSw="FERN_PRE_UPGRADE_VERSION";async function jSw({cliContext:e,includePreReleases:t,targetVersion:r}){r!=null&&(await gSw({cliEnvironment:e.environment,version:r})||e.failAndThrow(`Failed to upgrade to ${r} because it does not exist. See https://www.npmjs.com/package/${e.environment.packageName}?activeTab=versions.`),Mue(r,e.environment.packageVersion)||e.failAndThrow(`Cannot upgrade because target version (${r}) is not ahead of existing version ${e.environment.packageVersion}`));let i=r!=null?{targetVersion:r,isUpgradeAvailable:!0}:void 0;if(i==null){let n=await e.isUpgradeAvailable({includePreReleases:t});n.cliUpgradeInfo!=null&&(i={targetVersion:n.cliUpgradeInfo.latestVersion,isUpgradeAvailable:n.cliUpgradeInfo.isUpgradeAvailable})}if(i&&!i.isUpgradeAvailable){let n=process.env[OSw];if(n==null){e.logger.info("No upgrade available.");return}await mSw({cliContext:e,previousVersion:n,newVersion:i.targetVersion})}else if(i!=null){let n=await PGt();if(n==null)return e.failAndThrow(`Directory "${mH}" not found.`);let a=await e.runTask(c=>Ngi({directory:n,context:c})),u=bSw(a.rawConfig,c=>{c.version=i.targetVersion});await(0,PSw.writeFile)(a._absolutePath,JSON.stringify(u,void 0,2)),e.logger.info(`Upgrading from ${Es.dim(e.environment.packageVersion)} \u2192 ${Es.green(i.targetVersion)}`),e.environment.packageVersion=i.targetVersion,e.environment.packageVersion==="0.0.0"?await mSw({cliContext:e,previousVersion:a.version,newVersion:i.targetVersion}):(await hx(e.logger,"npm",["install","-g",`${e.environment.packageName}@${i.targetVersion}`]),await Dmo({version:i.targetVersion,cliContext:e,env:{[OSw]:e.environment.packageVersion}}))}}async function mSw({cliContext:e,previousVersion:t,newVersion:r}){await e.runTask(async i=>{await Sjd({fromVersion:t,toVersion:r,context:i})}),await e.exitIfFailed()}async function wSw({project:e,cliContext:t,errorOnBrokenLinks:r}){let i=e.docsWorkspaces;if(i==null){t.failAndThrow("No docs workspace found");return}await t.runTaskForWorkspace(i,async n=>{let a=performance.now(),u=await Promise.all(e.apiWorkspaces.map(async o=>o.toFernWorkspace({context:n}))),c=await R$(e),d=await HWa(i,n,u,c,!0),s=performance.now()-a;LZn({violations:d,context:n,logWarnings:!0,logSummary:!0,logBreadcrumbs:!1,elapsedMillis:s}),d.length>0&&r&&n.failAndThrow()})}async function SSw({project:e,cliContext:t,logWarnings:r,brokenLinks:i,errorOnBrokenLinks:n,isLocal:a,directFromOpenapi:u}){let c=e.docsWorkspaces;c!=null&&await t.runTaskForWorkspace(c,async d=>{let s=i||n?[]:["valid-markdown-links"];await N0u({workspace:c,context:d,logWarnings:r,apiWorkspaces:e.apiWorkspaces,ossWorkspaces:await R$(e),errorOnBrokenLinks:n,excludeRules:s})}),await Promise.all(e.apiWorkspaces.map(async d=>{d.generatorsConfiguration?.groups.length===0&&d.type!="fern"||await t.runTaskForWorkspace(d,async s=>{if(d instanceof D3&&u){await d.getIntermediateRepresentation({context:s,audiences:{type:"all"},enableUniqueErrorsPerEndpoint:!1,generateV1Examples:!1});return}let o=await d.toFernWorkspace({context:s});await Tvi({workspace:o,context:s,logWarnings:r,ossWorkspace:d instanceof D3?d:void 0})})}))}var Jvi=require("fs/promises");var xjd=oi(require("path"),1);async function DSw({project:e,cliContext:t,sdkLanguage:r,preserveSchemaIds:i}){await Promise.all(e.apiWorkspaces.map(async n=>{await t.runTaskForWorkspace(n,async a=>{n instanceof Mqe?await a44({workspace:n,context:a}):await o44({workspace:await n.toFernWorkspace({context:a},{preserveSchemaIds:i}),context:a})})}))}async function a44({workspace:e,context:t}){for(let[r,i]of Object.entries(e.definition.importedDefinitions)){let n=Bu(e.absoluteFilePath,za.of(AL),za.of(r),za.of(`.${AL}`));await ESw({definition:i.definition,absolutePathToOutputDirectory:n}),t.logger.info(Es.green(`Wrote imported definition at ${xjd.default.relative(process.cwd(),n)}`))}}async function o44({workspace:e,context:t}){let r=Bu(e.absoluteFilePath,za.of(`.${AL}`));await ESw({definition:e.definition,absolutePathToOutputDirectory:r}),t.logger.info(Es.green(`Wrote definition to ${xjd.default.relative(process.cwd(),r)}`))}async function ESw({definition:e,absolutePathToOutputDirectory:t}){let r=(i,n)=>{let a={imports:0,types:1,services:2},u=i in a?a[i]:Object.keys(a).length,c=n in a?a[n]:Object.keys(a).length;return u==null?-1:c==null?1:u!==c?u-c:i.localeCompare(n)};await Cf(t)&&await(0,Jvi.rm)(t,{recursive:!0}),await(0,Jvi.mkdir)(t,{recursive:!0}),await(0,Jvi.writeFile)(Bu(t,za.of(i6)),xd.dump(e.rootApiFile.contents,{sortKeys:r}));for(let[i,n]of Object.entries(e.packageMarkers)){let a=Bu(t,za.of(i));await(0,Jvi.mkdir)(zd(a),{recursive:!0}),await(0,Jvi.writeFile)(a,xd.dump(n.contents,{sortKeys:r}))}for(let[i,n]of Object.entries(e.namedDefinitionFiles)){let a=Bu(t,za.of(i));await(0,Jvi.mkdir)(zd(a),{recursive:!0}),await(0,Jvi.writeFile)(a,xd.dump(n.contents,{sortKeys:r}))}}var MSw=require("fs/promises");async function ASw({project:e,outputPath:t,cliContext:r}){let i=e.docsWorkspaces;i!=null&&await r.runTaskForWorkspace(i,async n=>{let a=await R$(e),u=await Promise.all(e.apiWorkspaces.map(async s=>s.toFernWorkspace({context:n},{enableUniqueErrorsPerEndpoint:!0,detectGlobalHeaders:!1}))),d=await new cJt(i.config.instances[0]?.url??"http://localhost:8080",i,a,u,n).resolve();await(0,MSw.writeFile)($c.of(t),JSON.stringify(d,null,2)),n.logger.info(Es.green(`Docs definition written to ${t}`))})}var IFs=u44();function u44(){return typeof window<"u"&&typeof window.document<"u"?{type:"browser",version:window.navigator.userAgent}:typeof globalThis<"u"&&globalThis?.navigator?.userAgent==="Cloudflare-Workers"?{type:"workerd"}:typeof EdgeRuntime=="string"?{type:"edge-runtime"}:typeof self=="object"&&typeof self?.importScripts=="function"&&(self.constructor?.name==="DedicatedWorkerGlobalScope"||self.constructor?.name==="ServiceWorkerGlobalScope"||self.constructor?.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&&!!process.versions?.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"}}jJ4();var PJ4="The Fern CLI requires Node 18+ or above.";async function jJ4(){let e=process.argv.includes("--local"),t=new Xru(process.stdout,process.stderr,{isLocal:e}),r=async()=>{await t.exit()};if(IFs.type==="node"&&IFs.parsedVersion!=null&&IFs.parsedVersion>=18){let{setGlobalDispatcher:i,Agent:n}=await Promise.resolve().then(()=>oi(tDd(),1));i(new n({connect:{timeout:2147483647},bodyTimeout:0,headersTimeout:2147483647}))}if(process.env.HTTP_PROXY!=null){let{setGlobalDispatcher:i,ProxyAgent:n}=await Promise.resolve().then(()=>oi(tDd(),1)),a=new n(process.env.HTTP_PROXY);i(a)}process.on("SIGINT",async()=>{t.suppressUpgradeMessage(),await r()});try{let i=process.env[Smo];i!=null&&process.chdir(i);let n=await SJ4(t);t.environment.packageVersion===n?await wJ4(t):await Dmo({version:n,cliContext:t})}catch(i){await t.instrumentPostHogEvent({command:process.argv.join(" "),properties:{failed:!0,error:i}}),i?.message.includes("globalThis")?(t.logger.error(PJ4),t.failWithoutThrowing()):i instanceof H8?t.failWithoutThrowing():i instanceof ggi?t.logger.error(`Failed. ${i.log}`):t.failWithoutThrowing("Failed.",i)}await r()}async function wJ4(e){let t=Zg_(Xjc(process.argv)).scriptName(e.environment.cliName).version(!1).fail((r,i,n)=>{i==null&&(n.showHelp(),e.logger.error(r))}).strict().exitProcess(!1).command("$0",!1,r=>r.option("version",{describe:"Print current version",alias:"v"}).version(!1),r=>{r.version!=null?e.logger.info(e.environment.packageVersion):(t.showHelp(),e.failAndThrow())}).option("log-level",{default:Sb.Info,choices:ABi}).demandCommand().recommendCommands();MJ4(t,e),EJ4(t,e),AJ4(t,e),qJ4(t,e),TJ4(t,e),CJ4(t,e),zJ4(t,e),BJ4(t,e),IJ4(t,e),NJ4(t,e),xJ4(t,e),RJ4(t,e),UJ4(t,e),VJ4(t,e),WJ4(t,e),QJ4(t,e),JJ4(t,e),$J4(t,e),GJ4(t,e),HJ4(t,e),LJ4(t,e),FJ4({cli:t,cliContext:e,onRun:()=>{e.suppressUpgradeMessage()}}),XJ4(t,e),ZJ4(t,e),kJ4(t,e),I8_(t,e),z8_(t,e),eK4(t,e),t.middleware(async r=>{e.setLogLevel(r["log-level"]),e.logDebugInfo()}),await t.parse()}async function SJ4(e){if(process.env.FERN_NO_VERSION_REDIRECTION==="true")return e.environment.packageVersion;let t=await PGt();if(t!=null){let r=await e.runTask(i=>Ngi({directory:t,context:i}));return r.version==="*"?e.environment.packageVersion:r.version}return n3i({cliEnvironment:e.environment})}async function DJ4(e){let t=await PGt();if(t!=null)return(await e.runTask(i=>Ngi({directory:t,context:i}))).organization}function EJ4(e,t){e.command("init","Initialize a Fern API",r=>r.option("api",{boolean:!0,description:"Initialize an api."}).option("docs",{boolean:!0,description:"Initialize a docs website."}).option("organization",{alias:"org",type:"string",description:"Organization name"}).option("openapi",{type:"string",description:"Filepath or url to an existing OpenAPI spec"}).option("mintlify",{type:"string",description:"Migrate docs from Mintlify provided a path to a mint.json file"}).option("readme",{type:"string",description:"Migrate docs from Readme provided a URL to a Readme generated docs site"}),async r=>{if(r.organization==null){let i=await DJ4(t);i!=null?r.organization=i:r.organization=await t.getInput({message:"Please enter your organization"})}if(r.api!=null&&r.docs!=null)return t.failWithoutThrowing("Cannot specify both --api and --docs. Please choose one.");if(r.readme!=null&&r.mintlify!=null)return t.failWithoutThrowing("Cannot specify both --readme and --mintlify. Please choose one.");if(r.readme!=null)await t.runTask(async i=>{await Ijc({readmeUrl:r.readme,organization:r.organization??"fern",taskContext:i,versionOfCli:await n3i({cliEnvironment:t.environment})})});else if(r.docs!=null)await t.runTask(async i=>{await Thc({organization:r.organization,versionOfCli:await n3i({cliEnvironment:t.environment}),taskContext:i})});else if(r.mintlify!=null)await t.runTask(async i=>{await Zhc({pathToMintJson:r.mintlify,organization:r.organization??"fern",taskContext:i,versionOfCli:await n3i({cliEnvironment:t.environment})})});else{let i;if(r.openapi!=null){if($Zi(r.openapi)){let a=await rO_({url:r.openapi,logger:t.logger});a.status==="failure"&&t.failAndThrow(a.errorMessage);let u=a.filePath;i=$c.of(u)}else i=$c.of($v(TI(),r.openapi));await Cf(i)||t.failAndThrow(`${i} does not exist`)}await t.runTask(async n=>{await Ahc({organization:r.organization,versionOfCli:await n3i({cliEnvironment:t.environment}),context:n,openApiPath:i})})}})}function MJ4(e,t){e.command("diff","Diff two versions of an API",r=>r.option("from",{string:!0,demandOption:!0,description:"The previous version of the API"}).option("to",{string:!0,demandOption:!0,description:"The next version of the API"}).option("from-version",{string:!0,description:"The previous version of the API (e.g. 1.1.0)"}).option("from-generator-version",{string:!0,description:"The previous version of the generator (e.g. 1.1.0)"}).option("to-generator-version",{string:!0,description:"The next version of the generator (e.g. 1.1.0)"}).option("quiet",{boolean:!0,default:!1,alias:"q",description:"Whether to suppress output written to stderr"}).middleware(i=>{if(!WHs(i.fromGeneratorVersion,i.toGeneratorVersion))throw new Error("Both --from-generator-version and --to-generator-version must be provided together, or neither should be provided")}),async r=>{let i=UHs(r.fromVersion),n=VHs({from:r.fromGeneratorVersion,to:r.toGeneratorVersion}),a=await U8_({context:t,from:r.from,to:r.to,fromVersion:i,generatorVersions:n});if(i!=null){let{errors:c,...d}=a;t.logger.info(JSON.stringify(d))}!r.quiet&&a.errors.length>0&&t.stderr.info(a.errors.join(`
2420
2420
  `));let u=a.bump==="major"?1:0;await t.exit({code:u})})}function AJ4(e,t){e.command("token","Generate a Fern Token",r=>r.option("organization",{alias:"org",type:"string",description:"The organization to create a token for. Defaults to the one in `fern.config.json`"}),async r=>{await t.runTask(async i=>{await WOw({orgId:r.organization??(await lq(t,{commandLineApiWorkspace:void 0,defaultToAllApiWorkspaces:!0})).config.organization,taskContext:i})})})}function qJ4(e,t){e.command("add <generator>",`Add a code generator to ${C4}`,r=>r.positional("generator",{type:"string",demandOption:!0}).option("api",{string:!0,description:"Only run the command on the provided API"}).option("group",{string:!0,description:"Add the generator to the specified group"}),async r=>{await R8_({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1}),generatorName:r.generator,groupName:r.group,cliContext:t})})}function TJ4(e,t){e.command(["generate"],"Generate all generators in the specified group",r=>r.option("api",{string:!0,description:"If multiple APIs, specify the name with --api <name>. Otherwise, just --api."}).option("docs",{string:!0,description:"If multiple docs sites, specify the name with --docs <name>. Otherwise just --docs."}).option("instance",{string:!0,description:"The url for the instance of docs (e.g. --instance acme.docs.buildwithfern.com)"}).option("preview",{boolean:!0,default:!1,description:"Whether to generate a preview link for the docs"}).option("group",{type:"string",description:"The group to generate"}).option("mode",{choices:Object.values(lOw),description:"Defaults to the mode specified in generators.yml"}).option("version",{type:"string",description:"The version for the generated packages"}).option("printZipUrl",{boolean:!0,hidden:!0,default:!1}).option("local",{boolean:!0,default:!1,description:"Run the generator(s) locally, using Docker"}).option("keepDocker",{boolean:!0,default:!1,description:"Prevent auto-deletion of the Docker containers."}).option("force",{boolean:!0,default:!1,description:"Ignore prompts to confirm generation, defaults to false"}).option("broken-links",{boolean:!0,description:"Log a warning if there are broken links in the docs.",default:!1}).option("strict-broken-links",{boolean:!0,description:"Throw an error (rather than logging a warning) if there are broken links in the docs.",default:!1}).option("disable-snippets",{boolean:!0,description:"Disable snippets in docs generation.",default:!1}).option("runner",{choices:["docker","podman"],description:"Choose the container runtime to use for local generation.",default:void 0}).option("lfs-override",{type:"string",hidden:!0,description:"Override output mode to local-file-system with the specified path"}).option("disable-dynamic-snippets",{boolean:!0,description:"Disable dynamic SDK snippets in docs generation",default:!1}),async r=>r.api!=null&&r.docs!=null?t.failWithoutThrowing("Cannot specify both --api and --docs. Please choose one."):r.local&&r.preview?t.failWithoutThrowing("The --local flag is incompatible with --preview."):r.api!=null?await PPd({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1}),cliContext:t,version:r.version,groupName:r.group,shouldLogS3Url:r.printZipUrl,keepDocker:r.keepDocker,useLocalDocker:r.local||r.runner!=null,preview:r.preview,mode:r.mode,force:r.force,runner:r.runner,inspect:!1,lfsOverride:r.lfsOverride}):r.docs!=null?(r.group!=null&&t.logger.warn("--group is ignored when generating docs"),r.version!=null&&t.logger.warn("--version is ignored when generating docs"),await fOw({project:await lq(t,{commandLineApiWorkspace:void 0,defaultToAllApiWorkspaces:!0},!0),cliContext:t,instance:r.instance,preview:r.preview,brokenLinks:r.brokenLinks,strictBrokenLinks:r.strictBrokenLinks,disableTemplates:r.disableSnippets,disableDynamicSnippets:r.disableDynamicSnippets})):await PPd({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1}),cliContext:t,version:r.version,groupName:r.group,shouldLogS3Url:r.printZipUrl,keepDocker:r.keepDocker,useLocalDocker:r.local,preview:r.preview,mode:r.mode,force:r.force,runner:r.runner,inspect:!1,lfsOverride:r.lfsOverride}))}function CJ4(e,t){e.command("ir <path-to-output>","Generate IR (Intermediate Representation)",r=>r.positional("path-to-output",{type:"string",description:"Path to write intermediate representation (IR)",demandOption:!0}).option("api",{string:!0,description:"Only run the command on the provided API"}).option("version",{string:!0,description:"The version of IR to produce"}).option("language",{choices:Object.values($h.GenerationLanguage),description:"Generate IR for a particular language"}).option("audience",{type:"array",string:!0,default:[],description:"Filter the IR for certain audiences"}).option("smart-casing",{boolean:!0,description:"Whether to use smart casing"}).option("from-openapi",{boolean:!0,description:"Whether to use the new parser and go directly from OpenAPI to IR",default:!1}).option("disable-examples",{boolean:!0,description:"Whether to disable automatic example generation in the IR",default:!1}),async r=>{await vOw({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1,sdkLanguage:r.language}),irFilepath:$v(TI(),r.pathToOutput),cliContext:t,generationLanguage:r.language,audiences:r.audience.length>0?{type:"select",audiences:r.audience}:{type:"all"},version:r.version,keywords:void 0,smartCasing:r.smartCasing??!1,readme:void 0,directFromOpenapi:r.fromOpenapi,disableExamples:r.disableExamples})})}function BJ4(e,t){e.command("openapi-ir <path-to-output>",!1,r=>r.positional("path-to-output",{type:"string",description:"Path to write intermediate representation (IR)",demandOption:!0}).option("language",{choices:Object.values($h.GenerationLanguage),description:"Generate IR for a particular language"}).option("api",{string:!0,description:"Only run the command on the provided API"}),async r=>{await OOw({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1,sdkLanguage:r.language}),irFilepath:$v(TI(),r.pathToOutput),cliContext:t,sdkLanguage:r.language})})}function IJ4(e,t){e.command("dynamic-ir <path-to-output>",!1,r=>r.positional("path-to-output",{type:"string",description:"Path to write intermediate representation (IR)",demandOption:!0}).option("api",{string:!0,description:"Only run the command on the provided API"}).option("version",{string:!0,description:"The version of IR to produce"}).option("language",{choices:Object.values($h.GenerationLanguage),description:"Generate IR for a particular language"}).option("audience",{type:"array",string:!0,default:[],description:"Filter the IR for certain audiences"}).option("smart-casing",{boolean:!0,description:"Whether to use smart casing"}).option("disable-examples",{boolean:!0,description:"Whether to suppress examples from being included in the IR"}),async r=>{await pOw({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1,sdkLanguage:r.language}),irFilepath:$v(TI(),r.pathToOutput),cliContext:t,generationLanguage:r.language,audiences:{type:"all"},version:r.version,keywords:void 0,smartCasing:r.smartCasing??!1,disableDynamicExamples:r.disableExamples??!1})})}function zJ4(e,t){e.command("fdr <path-to-output>",!1,r=>r.positional("path-to-output",{type:"string",description:"Path to write FDR API definition",demandOption:!0}).option("api",{string:!0,description:"Only run the command on the provided API"}).option("audience",{type:"array",string:!0,default:[],description:"Filter the FDR API definition for certain audiences"}).option("v2",{boolean:!0,description:"Use v2 format"}).option("from-openapi",{boolean:!0,description:"Whether to use the new parser and go directly from OpenAPI to IR",default:!1}),async r=>{r.v2?await jPd({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1}),outputFilepath:$v(TI(),r.pathToOutput),directFromOpenapi:!1,cliContext:t,audiences:r.audience.length>0?{type:"select",audiences:r.audience}:{type:"all"}}):r.fromOpenapi?await jPd({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1}),outputFilepath:$v(TI(),r.pathToOutput),directFromOpenapi:!0,cliContext:t,audiences:r.audience.length>0?{type:"select",audiences:r.audience}:{type:"all"}}):await hOw({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1}),outputFilepath:$v(TI(),r.pathToOutput),cliContext:t,audiences:r.audience.length>0?{type:"select",audiences:r.audience}:{type:"all"}})})}function xJ4(e,t){e.command(["register"],!1,r=>r.option("version",{type:"string",description:"The version for the registered api"}).option("api",{string:!0,description:"Only run the command on the provided API"}),async r=>{let i=await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1}),n=await t.runTask(a=>A7e(a));await LOw({project:i,cliContext:t,token:n,version:r.version})})}function RJ4(e,t){e.command(["register-v2"],!1,r=>r.option("api",{string:!0,description:"Only run the command on the provided API"}),async r=>{let i=await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1}),n=await t.runTask(a=>A7e(a));await UOw({project:i,cliContext:t,token:n})})}function NJ4(e,t){e.command("check","Validates your Fern Definition. Logs errors.",r=>r.option("api",{string:!0,description:"Only run the command on the provided API"}).option("warnings",{boolean:!0,description:"Log warnings in addition to errors.",default:!1}).option("broken-links",{boolean:!0,description:"Log a warning if there are broken links in the docs.",default:!1}).option("strict-broken-links",{boolean:!0,description:"Throw an error (rather than logging a warning) if there are broken links in the docs.",default:!1}).option("local",{boolean:!0,description:"Run validation locally without sending data to Fern API.",default:!1}).option("from-openapi",{boolean:!0,description:"Whether to use the new parser and go directly from OpenAPI to IR",default:!1}),async r=>{await SSw({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!0}),cliContext:t,logWarnings:r.warnings,brokenLinks:r.brokenLinks,errorOnBrokenLinks:r.strictBrokenLinks,directFromOpenapi:r.fromOpenapi})})}function FJ4({cli:e,cliContext:t,onRun:r}){e.command("upgrade",`Upgrades Fern CLI version in ${Lae}`,i=>i.option("rc",{boolean:!0,hidden:!0,default:!1}).option("version",{string:!0,description:"The version to upgrade to. Defaults to the latest release."}),async i=>{await jSw({cliContext:t,includePreReleases:i.rc,targetVersion:i.version}),r()})}function LJ4(e,t){e.command("api update",`Pulls the latest OpenAPI spec from the specified origin in ${C4} and updates the local spec.`,r=>r.option("api",{string:!0,description:"The API to update the spec for. If not specified, all APIs with a declared origin will be updated."}),async r=>{await t.instrumentPostHogEvent({command:"fern api update"}),await QOw({cliContext:t,project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!0})})})}function UJ4(e,t){e.command("login","Log in to Fern via GitHub",r=>r.option("device-code",{boolean:!0,default:!1,description:"Use device code authorization"}),async r=>{await t.runTask(async i=>{await t.instrumentPostHogEvent({command:"fern login"}),await G7a(i,{useDeviceCodeFlow:r.deviceCode})})})}function VJ4(e,t){e.command("logout","Log out of Fern",r=>r,async()=>{await t.runTask(async r=>{await t.instrumentPostHogEvent({command:"fern logout"}),await g_c(r)})})}function WJ4(e,t){e.command("format","Formats your Fern Definition",r=>r.option("ci",{boolean:!0,default:!1,description:"Fail with non-zero exit status if files are not formatted correctly."}).option("api",{string:!0,description:"Only run the command on the provided API"}),async r=>{await t.instrumentPostHogEvent({command:"fern format"}),await Oph({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!0}),cliContext:t,shouldFix:!r.ci})})}function HJ4(e,t){e.command("test","Runs tests specified in --command, this spins up a mock server in the background that is terminated upon completion of the tests.",r=>r.option("api",{string:!0,description:"The API to mock."}).option("command",{string:!0,description:"The command to run to test your SDK."}).option("language",{choices:Object.values($h.GenerationLanguage),description:"Run the tests configured to a specific language"}),async r=>{await t.instrumentPostHogEvent({command:"fern test"}),await VOw({cliContext:t,project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1,nameOverride:".mock",sdkLanguage:r.language}),testCommand:r.command,generationLanguage:r.language})})}function $J4(e,t){e.command("mock","Starts a mock server for an API.",r=>r.option("port",{number:!0,description:"The port the server binds to."}).option("api",{string:!0,description:"The API to mock."}),async r=>{await t.instrumentPostHogEvent({command:"fern mock"}),await IOw({cliContext:t,project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1}),port:r.port})})}function GJ4(e,t){e.command("write-overrides","Generate a basic openapi overrides file.",r=>[r.option("api",{string:!0,description:"Only run the command on the provided API"}),r.option("exclude-models",{boolean:!0,description:"When generating the initial overrides, also stub the models (in addition to the endpoints)",default:!1})],async r=>{await t.instrumentPostHogEvent({command:"fern generate-overrides"}),await POw({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!0}),includeModels:!r.excludeModels,cliContext:t})})}function QJ4(e,t){e.command("write-definition","Write underlying Fern Definition for OpenAPI specs and API Dependencies.",r=>r.option("api",{string:!0,description:"Only run the command on the provided API"}).option("language",{choices:Object.values($h.GenerationLanguage),description:"Write the definition for a particular SDK language"}).option("preserve-schemas",{string:!0,description:"Preserve potentially unsafe schema Ids in the generated fern definition"}),async r=>{let i=r.preserveSchemas!=null;await t.instrumentPostHogEvent({command:"fern write-definition"}),await DSw({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!0,sdkLanguage:r.language,preserveSchemaIds:i}),cliContext:t,sdkLanguage:r.language,preserveSchemaIds:i})})}function JJ4(e,t){e.command("docs","Commands for managing your docs",r=>(KJ4(r,t),YJ4(r,t),r))}function KJ4(e,t){e.command("dev","Run a local development server to preview your docs",r=>r.option("port",{number:!0,description:"Run the development server on the following port"}).option("bundle-path",{string:!0,hidden:!0,description:"Path of the local docs bundle to use"}).option("broken-links",{boolean:!0,default:!1,description:"Check for broken links in your docs"}).option("beta",{boolean:!0,default:!1,description:"Run the app router development server"}).option("legacy",{boolean:!0,default:!1,description:"Run the legacy development server"}).option("backend-port",{number:!0,description:"Run the development backend server on the following port"}),async r=>{r.beta&&t.logger.warn("--beta flag now accesses the same functionality as default and will be deprecated in a future release");let i;r.port!=null?i=r.port:i=await UQn({port:[3e3,3001,3002,3003,3004,3005,3006,3007,3008,3009,3010]});let n;r.backendPort!=null?n=r.backendPort:n=await UQn({port:[3001,3002,3003,3004,3005,3006,3007,3008,3009,3010,3011]});let a=r.bundlePath;await dph({loadProject:()=>lq(t,{defaultToAllApiWorkspaces:!0,commandLineApiWorkspace:void 0}),cliContext:t,port:i,bundlePath:a,brokenLinks:r.brokenLinks,legacyPreview:r.legacy,backendPort:n})})}function YJ4(e,t){e.command("broken-links","Check for broken links in your docs",r=>r.option("strict",{boolean:!0,default:!1,description:"Fail with non-zero exit status"}),async r=>{let i=await lq(t,{commandLineApiWorkspace:void 0,defaultToAllApiWorkspaces:!0});await wSw({project:i,cliContext:t,errorOnBrokenLinks:r.strict})})}function XJ4(e,t){e.command("jsonschema <path-to-output>","Generate JSON Schema for a specific type",r=>r.option("api",{string:!0,description:"Only run the command on the provided API"}).positional("path-to-output",{type:"string",description:"Path to write JSON Schema",demandOption:!0}).option("type",{string:!0,demandOption:!0,description:"The type to generate JSON Schema for (e.g. 'MySchema' or 'mypackage.MySchema')"}),async r=>{await t.instrumentPostHogEvent({command:"fern jsonschema",properties:{output:r.output}}),await MOw({typeLocator:r.type,project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1}),jsonschemaFilepath:$v(TI(),r.pathToOutput),cliContext:t})})}function ZJ4(e,t){e.command("write-docs-definition <output-path>",!1,r=>r.positional("output-path",{type:"string",description:"Path to write the docs definition",demandOption:!0}),async r=>{await t.instrumentPostHogEvent({command:"fern write-docs-definition",properties:{outputPath:r.outputPath}}),await ASw({project:await lq(t,{defaultToAllApiWorkspaces:!0,commandLineApiWorkspace:void 0}),outputPath:$v(TI(),r.outputPath),cliContext:t})})}function kJ4(e,t){e.command("export <output-path>","Export your API to an OpenAPI spec",r=>r.positional("output-path",{type:"string",description:"Path to write the OpenAPI spec",demandOption:!0}).option("api",{string:!0,description:"Only run the command on the provided API"}),async r=>{await t.instrumentPostHogEvent({command:"fern export",properties:{outputPath:r.outputPath}}),await gph({project:await lq(t,{commandLineApiWorkspace:r.api,defaultToAllApiWorkspaces:!1}),cliContext:t,outputPath:$v(TI(),r.outputPath)})})}function eK4(e,t){e.command("protoc-gen-fern",!1,r=>{},async()=>{let r=Yjc,i=await tK4(process.stdin),n=LIa(vRd,i),a=r.run(n);await rK4(process.stdout,pHs(xMo,a)),process.exit(0)})}function tK4(e){return new Promise((t,r)=>{let i=[];e.on("data",n=>i.push(n)),e.on("end",()=>{t(new Uint8Array(Buffer.concat(i)))}),e.on("error",n=>{r(n)})})}function rK4(e,t){return new Promise((r,i)=>{e.write(t,n=>{n?i(n):r()})})}
2421
2421
  /*! Bundled license information:
2422
2422
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fern-api",
3
- "version": "0.77.0",
3
+ "version": "0.77.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/fern-api/fern.git",